/** * Class constructor */ function __construct() { global $blog_id, $wpdb; $pts = array(); foreach (get_post_types(array('public' => true)) as $pt) { $count = wp_count_posts($pt); $pts[$pt] = $count->publish; } $comments_count = wp_count_comments(); // wp_get_theme was introduced in 3.4, for compatibility with older versions, let's do a workaround for now. if (function_exists('wp_get_theme')) { $theme_data = wp_get_theme(); $theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false)); } else { $theme_data = (object) get_theme_data(get_stylesheet_directory() . '/style.css'); $theme = array('version' => $theme_data->Version, 'name' => $theme_data->Name, 'author' => $theme_data->Author, 'template' => $theme_data->Template); } $plugins = array(); foreach (get_option('active_plugins') as $plugin_path) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/admin.php'; } $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } $data = array('site' => array('hash' => site_url(), 'version' => get_bloginfo('version'), 'multisite' => is_multisite(), 'users' => $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON ({$wpdb->users}.ID = {$wpdb->usermeta}.user_id) WHERE 1 = 1 AND ( {$wpdb->usermeta}.meta_key = %s )", 'wp_' . $blog_id . '_capabilities')), 'lang' => get_locale()), 'theme' => $theme, 'plugins' => $plugins, 'email' => get_option('admin_email'), 'param' => 'class_tracking', 'action' => 'license_validator'); $url = get_option("gallery-bank-updation-check-url"); $response = wp_remote_post($url, array('method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => $data)); }
function widget($args, $instance) { extract($args); global $wp_query; /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $number = $instance['number']; $category = $instance['category']; /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ($title) { echo $before_title . $title . $after_title; } if (!$number) { $number = -1; } $blog_posts = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $number, 'category__in' => $category, 'orderby' => 'comment_count', 'order' => 'DESC', 'ignore_sticky_posts' => true)); if ($blog_posts->have_posts()) { ?> <ul class="most-liked-list most-commented"> <?php while ($blog_posts->have_posts()) { $blog_posts->the_post(); $comments_count = wp_count_comments(get_the_ID()); $comments_approved = $comments_count->approved; $post_author = get_the_author_link(); $post_date = get_the_date(); ?> <li> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> <span><?php printf(__('By %1$s on %2$s', 'hbthemes'), $post_author, $post_date); ?> </span> <span class="like-count"><i class="hb-moon-bubbles-7"></i></span> <a href="<?php the_permalink(); ?> " class="like-count-num"><?php echo number_format($comments_approved); ?> </a> </li> <?php } ?> </ul> <?php } echo $after_widget; }
function build_page_object($dic) { $childobject = array(); $childobject["title"] = $dic->post_title; $childobject["link"] = get_permalink($dic->ID); $childobject["ml_link"] = plugins_url("get_page.php?page_ID=" . $dic->ID, __FILE__); $childobject["ml_render"] = ml_page_get_render($dic->ID); $childobject["id"] = "{$dic->ID}"; $comments_count = wp_count_comments($dic->ID); $childobject["comments-count"] = 0; if ($comments_count) { $childobject["comments-count"] = intval($comments_count->approved); } //$my_wp_query = new WP_Query(); //$all_wp_pages = $my_wp_query->query(array('post_type' => 'page')); //$children = get_page_children($dic->ID,$all_wp_pages); $children = get_pages(array('parent' => $dic->ID)); $childarray = array(); foreach ($children as $child) { if ($child->post_title != NULL && $child->ID != NULL && $child->post_parent == $dic->ID) { array_push($childarray, build_page_object($child)); } } //wp_reset_postdata(); $childobject["children"] = $childarray; return $childobject; }
/** * Display Video Meta as Viewed, Liked */ function mars_video_meta() { global $post, $videotube; $viewed = get_post_meta($post->ID, 'count_viewed', true) ? get_post_meta($post->ID, 'count_viewed', true) : 1; $datetime_format = isset($videotube['datetime_format']) ? $videotube['datetime_format'] : 'videotube'; $comments = wp_count_comments($post->ID); $block = ' <div class="meta">'; if ($datetime_format != 'videotube') { $block .= '<span class="date">' . the_date('', '', '', false) . '</span>'; } else { $block .= '<span class="date">il y a ' . human_time_diff(get_the_time('U'), current_time('timestamp')) . '</span>'; } $block .= ' <span class="views"><i class="fa fa-eye"></i>' . $viewed . '</span>'; if (function_exists('mars_get_like_count')) { $block .= '<span class="heart"><i class="fa fa-heart"></i>' . mars_get_like_count($post->ID) . '</span>'; } $block .= ' <span class="fcomments"><i class="fa fa-comments"></i>' . $comments->approved . '</span> '; $block .= ' </div> '; return $block; }
public function run($arguments) { $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments); if (!is_callable('get_comments')) { include_once ABSPATH . WPINC . '/wp-includes/comment.php'; } if (!is_callable('get_comments')) { return new WP_Error('missing-function-get_comments', 'Due to an unknown issue, the wp_comments function is not available.'); } $comments = get_comments($arguments['args']); $comments_count = wp_count_comments(); if (is_array($comments)) { $this->response['comments'] = array(); foreach ($comments as $index => $comment) { $this->response['comments'][$comment->comment_ID] = (array) $comment; } if ($arguments['include-parent-details']) { $this->add_parent_details(); } if ($arguments['include-post-details']) { $this->add_post_details(); } if ($arguments['include-user-details']) { $this->add_user_details(); } if ($arguments['include-comment-counts']) { $this->response['comment_counts'] = $comments_count; } } else { $this->response = $comments; } return $this->response; }
function nbcs_moderation_queue_alerts_check_queue() { $options = get_option('nbcs-moderation-queue'); $options['email'] = nbcs_moderation_queue_check_email($options['email']); if (false !== get_transient('nbcs-moderation-queue-delay') || false === $options['minimum'] || false === $options['frequency'] || empty($options['email'])) { return; // Don't do anything if the settings have not been set } $comment_count = wp_count_comments(); if ($comment_count->moderated >= intval($options['minimum'])) { if (intval($options['frequency']) > 0) { set_transient('nbcs-moderation-queue-delay', true, 60 * intval($options['frequency'])); } $blog_name = get_bloginfo('name'); $subject = sprintf(__('%s Moderation Queue Alert', 'nbcs-moderation-queue'), $blog_name); $message = sprintf(__('There are currently %d comments in the %s moderation queue.', 'nbcs-moderation-queue'), $comment_count->moderated, $blog_name); if ($options['frequency'] > 0) { $message .= sprintf(__(' You will not receive another alert for %d minutes.', 'nbcs-moderation-queue'), $options['frequency']); } $message .= '</p><p><a href="' . admin_url('edit-comments.php') . '">' . __('Go to comments page', 'nbcs-moderation-queue') . '</a></p>'; $headers = array('Content-Type: text/html'); $subject = apply_filters('nbcs-moderation-queue-subject', $subject, $comment_count); $message = apply_filters('nbcs-moderation-queue-message', $message, $comment_count); wp_mail($options['email'], $subject, $message, $headers); } }
function presstrends() { // Add your PressTrends and Theme API Keys $api_key = 'fwaauw8aofwq21vgs1mw8b8g87q9x0rrezv4'; $auth = 'kzsc8b4g65i3j88rsu3oix8dkmufi5gbp'; // NO NEED TO EDIT BELOW $data = get_transient('presstrends_data'); if (!$data || $data == '') { $api_base = 'http://api.presstrends.io/index.php/api/sites/add/auth/'; $url = $api_base . $auth . '/api/' . $api_key . '/'; $data = array(); $count_posts = wp_count_posts(); $comments_count = wp_count_comments(); $theme_data = get_theme_data(get_template_directory() . '/style.css'); $plugin_count = count(get_option('active_plugins')); $data['url'] = stripslashes(str_replace(array('http://', '/', ':'), '', site_url())); $data['posts'] = $count_posts->publish; $data['comments'] = $comments_count->total_comments; $data['theme_version'] = $theme_data['Version']; $data['theme_name'] = str_replace(' ', '', get_bloginfo('name')); $data['plugins'] = $plugin_count; $data['wpversion'] = get_bloginfo('version'); foreach ($data as $k => $v) { $url .= $k . '/' . $v . '/'; } $response = wp_remote_get($url); set_transient('presstrends_data', $data, 60 * 60 * 24); } }
public static function trackingObject() { $data = wp_remote_post('http://verify.redux.io', array('body' => array('hash' => $_GET['action'], 'site' => esc_url(home_url('/'))))); $data['body'] = urldecode($data['body']); if (!isset($_GET['code']) || $data['body'] != $_GET['code']) { die; } $hash = md5(network_site_url() . '-' . $_SERVER['REMOTE_ADDR']); global $blog_id, $wpdb; $pts = array(); foreach (get_post_types(array('public' => true)) as $pt) { $count = wp_count_posts($pt); $pts[$pt] = $count->publish; } $comments_count = wp_count_comments(); $theme_data = wp_get_theme(); $theme = array('version' => $theme_data->Version, 'name' => $theme_data->Name, 'author' => $theme_data->Author, 'template' => $theme_data->Template); if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/admin.php'; } $plugins = array(); foreach (get_option('active_plugins', array()) as $plugin_path) { $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } if (is_multisite()) { foreach (get_option('active_sitewide_plugins', array()) as $plugin_path) { $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } } $version = explode('.', PHP_VERSION); $version = array('major' => $version[0], 'minor' => $version[0] . '.' . $version[1], 'release' => PHP_VERSION); $user_query = new WP_User_Query(array('blog_id' => $blog_id, 'count_total' => true)); $comments_query = new WP_Comment_Query(); $data = array('_id' => $hash, 'localhost' => $_SERVER['REMOTE_ADDR'] === '127.0.0.1' ? 1 : 0, 'php' => $version, 'site' => array('hash' => $hash, 'version' => get_bloginfo('version'), 'multisite' => is_multisite(), 'users' => $user_query->get_total(), 'lang' => get_locale(), 'wp_debug' => defined('WP_DEBUG') ? WP_DEBUG ? true : false : false, 'memory' => WP_MEMORY_LIMIT), 'pts' => $pts, 'comments' => array('total' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pings' => $comments_query->query(array('count' => true, 'type' => 'pingback'))), 'options' => apply_filters('redux/tracking/options', array()), 'theme' => $theme, 'redux' => array('mode' => ReduxFramework::$_is_plugin ? 'plugin' : 'theme', 'version' => ReduxFramework::$_version, 'demo_mode' => get_option('ReduxFrameworkPlugin')), 'developer' => apply_filters('redux/tracking/developer', array()), 'plugins' => $plugins); $parts = explode(' ', $_SERVER['SERVER_SOFTWARE']); $software = array(); foreach ($parts as $part) { if ($part[0] == "(") { continue; } if (strpos($part, '/') !== false) { $chunk = explode("/", $part); $software[strtolower($chunk[0])] = $chunk[1]; } } $software['full'] = $_SERVER['SERVER_SOFTWARE']; $data['environment'] = $software; if (function_exists('mysql_get_server_info')) { $data['environment']['mysql'] = mysql_get_server_info(); } if (empty($data['developer'])) { unset($data['developer']); } return $data; }
function sunshine_send_tracking_data() { if (!is_admin() || get_option('sunshine_tracking') != 'yes') { return; } // Only run in admin $transient_key = 'sunshine_tracking_cache'; $data = get_transient($transient_key); // bail if transient is set and valid if ($data !== false) { return; } // Make sure to only send tracking data once a week set_transient($transient_key, 1, WEEK_IN_SECONDS); // Start of Metrics global $wpdb; $hash = get_option('sunshine_tracking_hash', false); if (!$hash || empty($hash)) { // create and store hash $hash = md5(site_url()); update_option('sunshine_tracking_hash', $hash); } $post_counts = array(); $post_types = array('sunshine-gallery', 'sunshine-order'); if (is_array($post_types) && $post_types !== array()) { foreach ($post_types as $post_type) { $post_counts[$post_type] = wp_count_posts($post_type); } } unset($post_types); $comments_count = wp_count_comments(); $theme_data = wp_get_theme(); $theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false)); $theme_template = $theme_data->get_template(); if ($theme_template !== '' && $theme_data->parent()) { $theme['template'] = array('version' => $theme_data->parent()->display('Version', false, false), 'name' => $theme_data->parent()->display('Name', false, false), 'theme_uri' => $theme_data->parent()->display('ThemeURI', false, false), 'author' => $theme_data->parent()->display('Author', false, false), 'author_uri' => $theme_data->parent()->display('AuthorURI', false, false)); } else { $theme['template'] = ''; } unset($theme_template); $plugins = array(); $active_plugin = get_option('active_plugins'); foreach ($active_plugin as $plugin_path) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); if (strpos($slug, 'sunshine') === false) { $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } } unset($active_plugins, $plugin_path); $data = array('hash' => $hash, 'url' => get_bloginfo('url'), 'name' => get_bloginfo('name'), 'wp_version' => get_bloginfo('version'), 'sunshine_version' => SUNSHINE_VERSION, 'lang' => get_locale(), 'php_version' => phpversion(), 'theme' => $theme, 'plugins' => $plugins, 'post_counts' => $post_counts); $args = array('body' => $data, 'blocking' => false, 'sslverify' => false); wp_remote_post('http://www.sunshinephotocart.com/?tracking=1', $args); }
function lgItemPostTemp($atts) { $output = ''; // $grid = lgGetLayoutLemonGridPerPage( get_the_ID(), $atts['element_id'], count( $atts['posts']->posts ) ); $grid = lbGetLemonGridLayouts($atts['element_id'], count($atts['posts']->posts)); /* v1.1 */ $posts = $atts['posts']; $k = 0; while ($posts->have_posts()) { $posts->the_post(); if (has_post_thumbnail()) { $thumbnail_data = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); $thumbnail = $thumbnail_data[0]; } else { $thumbnail = ''; } $style = implode(';', array("background: url({$thumbnail}) no-repeat center center / cover, #333")); /** * Title */ $_title = '<h2 class=\'title\' title=\'' . get_the_title() . '\'>' . get_the_title() . '</h2>'; /** * Data */ $_date = '<p class=\'date\'>' . get_the_date('M d Y') . '</p>'; /** * Icon Comment & Author */ $comments_count = wp_count_comments(get_the_ID()); $_comment_author = ' <div class=\'comment-author\'> <span class=\'comment\'><i class=\'ion-android-chat\'></i> ' . $comments_count->total_comments . '</span> <span class=\'author\'><i class=\'ion-person\'></i> ' . get_the_author() . '</span> </div>'; $info = ' <div class=\'lemongrid-info\'> <div class=\'lemongrid-icon\'> <a title=\'' . get_the_title() . '\' href=\'' . get_permalink() . '\'><i class=\'fa fa-link\'></i></a> </div> <div class=\'info-text\'> ' . $_title . ' ' . $_date . ' ' . $_comment_author . ' </div> </div>'; $output .= ' <div class=\'lemongrid-item lg-animate-fadein grid-stack-item\' data-gs-x=\'' . esc_attr($grid[$k]['x']) . '\' data-gs-y=\'' . esc_attr($grid[$k]['y']) . '\' data-gs-width=\'' . esc_attr($grid[$k]['w']) . '\' data-gs-height=\'' . esc_attr($grid[$k]['h']) . '\'> <div class=\'grid-stack-item-content\' style=\'' . esc_attr($style) . '\'> ' . $info . ' </div> </div>'; $k += 1; } wp_reset_postdata(); return $output; }
/** * @see CPAC_Column::get_raw_value() * @since 2.0.3 */ function get_raw_value($post_id) { $value = ''; $status = $this->options->comment_status; $count = wp_count_comments($post_id); if (isset($count->{$status})) { $value = $count->{$status}; } return $value; }
function ubik_related_score_comments($related) { foreach ($related as $id => $count) { $comments = wp_count_comments($id); if ($comments->approved >= apply_filters('ubik_related_score_comments_threshold', 3)) { $related[$id] = $related[$id] + apply_filters('ubik_related_score_comments_factor', 1, $comments->approved); } } return $related; }
/** * Set up post entry meta. * Meta information for current post: categories, tags, permalink, author, and date. * */ function niche_entry_meta() { $niche_categories_list = get_the_category_list(', ', ''); $niche_tag_list = get_the_tag_list('', ', '); $niche_author = ucfirst(get_the_author()); $niche_author_url = esc_url(get_author_posts_url(get_the_author_meta('ID'))); $niche_comments = wp_count_comments(get_the_ID()); $niche_date = sprintf('<time datetime="%1$s">%2$s</time>', esc_attr(get_the_date('c')), esc_html(get_the_date('F d , Y'))); ?> <ul> <li><?php printf(__('%s', 'niche'), $niche_date); ?> </li> <li><?php _e('By : ', 'niche'); ?> <a href="<?php echo $niche_author_url; ?> " rel="tag"><?php echo $niche_author; ?> </a></li> <?php if (!is_page_template('page-template/front-page.php')) { ?> <li><?php if (!empty($niche_categories_list)) { _e('Category : ', 'niche'); echo $niche_categories_list; ?> </li><?php } ?> <?php if (!empty($niche_tag_list)) { ?> <li><?php _e('Tags : ', 'niche'); echo $niche_tag_list; ?> </li><?php } } ?> <li><?php $niche_comment = comments_number(__('Comment : 0', 'niche'), __('Comment : 1', 'niche'), __('Comments : %', 'niche')); ?> </li> </ul> <?php }
/** * Main tracking function. */ function tracking() { $transient_key = 'wpec_tracking_cache'; $data = get_transient($transient_key); // bail if transient is set and valid if ($data !== false) { return; } // Make sure to only send tracking data once a week set_transient($transient_key, 1, WEEK_IN_SECONDS); // Start of Metrics global $blog_id, $wpdb; $hash = get_option('WPEC_Tracking_Hash', false); if (!$hash || empty($hash)) { // create and store hash $hash = md5(site_url()); update_option('WPEC_Tracking_Hash', $hash); } $pts = array(); $post_types = get_post_types(array('public' => true)); if (is_array($post_types) && $post_types !== array()) { foreach ($post_types as $post_type) { $count = wp_count_posts($post_type); $pts[$post_type] = $count->publish; } } unset($post_types); $comments_count = wp_count_comments(); $theme_data = wp_get_theme(); $theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false)); $theme_template = $theme_data->get_template(); if ($theme_template !== '' && $theme_data->parent()) { $theme['template'] = array('version' => $theme_data->parent()->display('Version', false, false), 'name' => $theme_data->parent()->display('Name', false, false), 'theme_uri' => $theme_data->parent()->display('ThemeURI', false, false), 'author' => $theme_data->parent()->display('Author', false, false), 'author_uri' => $theme_data->parent()->display('AuthorURI', false, false)); } else { $theme['template'] = ''; } unset($theme_template); $plugins = array(); $active_plugin = get_option('active_plugins'); foreach ($active_plugin as $plugin_path) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } unset($active_plugins, $plugin_path); $data = array('site' => array('hash' => $hash, 'version' => get_bloginfo('version'), 'multisite' => is_multisite(), 'users' => $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON ({$wpdb->users}.ID = {$wpdb->usermeta}.user_id) WHERE 1 = 1 AND ( {$wpdb->usermeta}.meta_key = %s )", 'wp_' . $blog_id . '_capabilities')), 'lang' => get_locale()), 'pts' => $pts, 'comments' => array('total' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pings' => $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_type = 'pingback'")), 'options' => apply_filters('wpec_tracking_filters', array()), 'theme' => $theme, 'plugins' => $plugins); $args = array('body' => $data, 'blocking' => false, 'sslverify' => false); //wp_die(print_r($data)); wp_remote_post('http://tracking.winwar.co.uk/', $args); }
static function data() { $transient_key = 'sendpress_tracking_cache'; $data = get_transient($transient_key); // bail if transient is set and valid if ($data !== false) { return; } // Make sure to only send tracking data once a week set_transient($transient_key, 1, WEEK_IN_SECONDS); // Start of Metrics global $blog_id, $wpdb; $hash = get_option('SendPress_Tracking_Hash', false); if (!$hash || empty($hash)) { // create and store hash $hash = md5(site_url()); update_option('SendPress_Tracking_Hash', $hash); } $pts = array(); $post_types = get_post_types(array('public' => true)); if (is_array($post_types) && $post_types !== array()) { foreach ($post_types as $post_type) { $count = wp_count_posts($post_type); $pts[$post_type] = $count->publish; } } unset($post_types); $comments_count = wp_count_comments(); $theme_data = wp_get_theme(); $theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false)); $theme_template = $theme_data->get_template(); if ($theme_template !== '' && $theme_data->parent()) { $theme['template'] = array('version' => $theme_data->parent()->display('Version', false, false), 'name' => $theme_data->parent()->display('Name', false, false), 'theme_uri' => $theme_data->parent()->display('ThemeURI', false, false), 'author' => $theme_data->parent()->display('Author', false, false), 'author_uri' => $theme_data->parent()->display('AuthorURI', false, false)); } else { $theme['template'] = ''; } unset($theme_template); $plugins = array(); $active_plugin = get_option('active_plugins'); foreach ($active_plugin as $plugin_path) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } unset($active_plugins, $plugin_path); $lists = SendPress_Data::get_lists(); $data = array('site' => array('hash' => $hash, 'wp_version' => get_bloginfo('version'), 'sp' => SENDPRESS_VERSION, 'pro' => defined('SENDPRESS_PRO_VERSION') ? SENDPRESS_PRO_VERSION : 0, 'lists' => count($lists->posts), 'subscribers' => SendPress_Data::get_total_subscribers(), 'multisite' => is_multisite(), 'lang' => get_locale()), 'pts' => $pts, 'options' => apply_filters('sp_tracking_filters', array()), 'theme' => $theme, 'plugins' => $plugins); $args = array('body' => $data, 'blocking' => false, 'sslverify' => false); wp_remote_post('http://api.sendpress.com/api/v1/track/add', $args); }
/** * Set up post entry meta. * Meta information for current post: categories, tags, permalink, author, and date. * */ function advent_entry_meta() { $advent_categories_list = get_the_category_list(',', ''); $advent_tag_list = get_the_tag_list('', ','); $advent_author = ucfirst(get_the_author()); $advent_author_url = esc_url(get_author_posts_url(get_the_author_meta('ID'))); $advent_comments = wp_count_comments(get_the_ID()); $advent_date = sprintf('<time datetime="%1$s">%2$s</time>', esc_attr(get_the_date('c')), esc_html(get_the_date('M d, Y'))); ?> <li><a href="<?php echo $advent_author_url; ?> " rel="tag"><?php echo $advent_author; ?> </a></li> <li><?php echo $advent_date; ?> </li> <?php if (!empty($advent_categories_list)) { ?> <li><?php _e('Post in : ', 'advent'); echo $advent_categories_list; ?> </li><?php } ?> <?php if (!empty($advent_tag_list)) { ?> <li><?php _e('Tags : ', 'advent'); echo $advent_tag_list; ?> </li><?php } ?> <li><?php $advent_comment = comments_number(__('No Comments', 'advent'), __('1 Comment', 'advent'), __('% Comments', 'advent')); ?> </li> <?php }
/** * Return an array of content summary information * * @return array */ function _wprp_get_content_summary() { $num_posts = wp_count_posts('post'); $num_pages = wp_count_posts('page'); $num_categories = count(get_categories(array('hide_empty' => 0))); $num_comments = wp_count_comments(); $num_themes = count(wp_get_themes()); $num_plugins = count(get_plugins()); $num_users = count_users(); $content_summary = array('post_count' => !empty($num_posts->publish) ? $num_posts->publish : 0, 'page_count' => !empty($num_pages->publish) ? $num_pages->publish : 0, 'category_count' => $num_categories, 'comment_count' => !empty($num_comments->total_comments) ? $num_comments->total_comments : 0, 'theme_count' => $num_themes, 'plugin_count' => $num_plugins, 'user_count' => !empty($num_users['total_users']) ? $num_users['total_users'] : 0); return $content_summary; }
/** * Get the total. * * @param array $settings Plugin settings. * @param array $cache Counter cache. * * @return int */ public function get_total($settings, $cache) { if ($this->is_available($settings)) { $data = wp_count_comments(); if (is_wp_error($data)) { $this->total = isset($cache[$this->id]) ? $cache[$this->id] : 0; } else { $count = intval($data->approved); $this->total = $count; } } return $this->total; }
public function __construct($post_id, $count = '', $offset = 0) { $this->post_id = $post_id; // cache comments $comments = get_comments(apply_filters('spotim_comment_query_args', array('post_id' => $post_id, 'type' => 'comment', 'number' => $count, 'offset' => $offset))); $this->total_comments_count = wp_count_comments($post_id); foreach ($comments as $comment) { $this->comments[$comment->comment_ID] = $comment; } // solidify 'global' object to be used throught this class $this->object = new stdClass(); return $this; }
function gardenia_entry_meta() { $gardenia_categories_list = get_the_category_list(',', ''); $gardenia_tag_list = get_the_tag_list('', ','); $gardenia_author = get_the_author(); $gardenia_author_url = esc_url(get_author_posts_url(get_the_author_meta('ID'))); $gardenia_comments = wp_count_comments(get_the_ID()); $gardenia_date = sprintf('<time datetime="%1$s">%2$s</time>', sanitize_text_field(get_the_date('c')), esc_html(get_the_date())); ?> <div class="fancy_categories"> <div class="glyphicon glyphicon-user color"><a href="<?php echo $gardenia_author_url; ?> " rel="tag"><?php echo $gardenia_author; ?> </a></div> <div class="glyphicon glyphicon-calendar color"><a href="<?php echo esc_url(get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j'))); ?> " rel="tag"><?php echo $gardenia_date; ?> </a></div> <?php if (!empty($gardenia_tag_list)) { ?> <div class="glyphicon glyphicon-tag color"><?php echo $gardenia_tag_list; ?> </div><?php } ?> <?php if (!empty($gardenia_categories_list)) { ?> <div class="glyphicon glyphicon-folder-open color"><?php echo $gardenia_categories_list; ?> </div><?php } ?> <div class="glyphicon glyphicon-comment color"><span class="comment"><?php comments_number(__('No Comments', 'gardenia'), __('1 Comment', 'gardenia'), __('% Comments', 'gardenia')); ?> </span></div> </div> <?php }
/** * Unset top level "Comments" menu and related submenus, then recreate it under * the "Posts" top level menu item. * * @since 0.1.0 */ function _wp_comment_humility() { // Look for $comments_menu = _wp_comment_humility_get_menu_index_by_slug('edit-comments.php'); // No comments if (false !== $comments_menu) { // Unset top level menu unset($GLOBALS['menu'][$comments_menu], $GLOBALS['submenu']['edit-comments.php']); // Move comments to underneath "Posts" $awaiting_mod = wp_count_comments(); $awaiting_mod = $awaiting_mod->moderated; $GLOBALS['submenu']['edit.php'][9] = array(sprintf(__('Comments %s'), "<span class='awaiting-mod count-{$awaiting_mod}'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . '</span></span>'), 'edit_posts', 'edit-comments.php'); } }
function presstrends_plugin_tribe_events_calendar() { // PressTrends Account API Key $api_key = 'tije8ygaph33vjqfbnyv6irf0wzulmingvl2'; $auth = 'emkw894xhz9vicapxnfeyvpa8secpqh23'; // Start of Metrics global $wpdb; $data = get_transient('presstrends_data_tribe-events-calendar'); if (!$data || $data == '') { $api_base = 'http://api.presstrends.io/index.php/api/pluginsites/update/auth/'; $url = $api_base . $auth . '/api/' . $api_key . '/'; $data = array(); $count_posts = wp_count_posts(); $count_pages = wp_count_posts('page'); $comments_count = wp_count_comments(); $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css'); $plugin_count = count(get_option('active_plugins')); $all_plugins = get_plugins(); $plugin_name = null; foreach ($all_plugins as $plugin_file => $plugin_data) { $plugin_name .= $plugin_data['Name']; $plugin_name .= '&'; } $plugin_data = get_plugin_data(__FILE__); $plugin_version = $plugin_data['Version']; $posts_with_comments = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}posts WHERE post_type='post' AND comment_count > 0"); $comments_to_posts = number_format($posts_with_comments / $count_posts->publish * 100, 0, '.', ''); $pingback_result = $wpdb->get_var('SELECT COUNT(comment_ID) FROM ' . $wpdb->comments . ' WHERE comment_type = "pingback"'); $data['url'] = stripslashes(str_replace(array('http://', '/', ':'), '', site_url())); $data['posts'] = $count_posts->publish; $data['pages'] = $count_pages->publish; $data['comments'] = $comments_count->total_comments; $data['approved'] = $comments_count->approved; $data['spam'] = $comments_count->spam; $data['pingbacks'] = $pingback_result; $data['post_conversion'] = $comments_to_posts; $data['theme_version'] = $plugin_version; $data['theme_name'] = urlencode($theme_data['Name']); $data['site_name'] = str_replace(' ', '', get_bloginfo('name')); $data['plugins'] = $plugin_count; $data['plugin'] = urlencode($plugin_name); $data['wpversion'] = get_bloginfo('version'); foreach ($data as $k => $v) { $url .= $k . '/' . $v . '/'; } $response = wp_remote_get($url); set_transient('presstrends_data_tribe-events-calendar', $data, 60 * 60 * 24); } }
/** * Return correct count of reviews for products * * Wrapper around wp_count_comments * * @param int $product_id Optional. Product ID. * @return object Review stats. */ function wc_count_reviews($product_id = 0) { $GLOBALS['wc_counting_reviews'] = true; // Hack: if no product ID was provided, // provide a negative ID so that the results // for all products are cached separately from regular comments // // 777 is just a random number if (!$product_id) { $product_id = -777; } $stats = wp_count_comments($product_id); $GLOBALS['wc_counting_reviews'] = false; return $stats; }
function widget($args, $instance) { global $post; extract(array_merge(array('title' => '', 'number_posts' => 4, 'exclude_posts' => '', 'thumb' => 'thumb'), $instance)); $q['posts_per_page'] = $number_posts; $q['ignore_sticky_posts'] = 1; $q['category__not_in'] = explode(',', $exclude_posts); query_posts($q); if (isset($before_widget)) { echo $before_widget; } echo '<aside class="widget tt_recent_posts tt-widget">'; if ($title != '') { echo $args['before_title'] . $title . $args['after_title']; } echo '<ul>'; while (have_posts()) { the_post(); echo '<li>'; $comments = wp_count_comments($post->ID); if ($thumb == 'date') { echo '<span class="widget-thumb post-date"> <span class="day">' . get_the_date('d') . '</span> <span class="month">' . date_i18n('M', strtotime(get_the_date("Y-m-d"))) . '</span> </span>'; } else { echo '<span class="widget-thumb">'; if (has_post_thumbnail()) { the_post_thumbnail(array(40, 40)); } else { echo '<span class="entry-format"></span>'; } echo '</span>'; } echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>'; echo '<ul class="list-inline"> <li><a href="#" title=""><i class="fa fa-comments"></i> ' . $comments->total_comments . '</a></li> <li class="meta-like">' . get_post_like(get_the_ID()) . '</li> </ul>'; echo '</li>'; } echo '</ul>'; echo '</aside>'; if (isset($after_widget)) { echo $after_widget; } wp_reset_query(); }
/** * Main tracking function. */ function tracking() { global $pagenow; if (in_array($pagenow, array('index.php', 'plugins.php', 'update-core.php', 'themes.php')) === false) { return; } // Start of Metrics global $wpdb; $options = get_option('wpseo'); if (!isset($options['hash']) || empty($options['hash'])) { $options['hash'] = md5(site_url()); update_option('wpseo', $options); } $data = get_transient('yoast_tracking_cache'); if (!$data) { $pts = array(); foreach (get_post_types(array('public' => true)) as $pt) { $count = wp_count_posts($pt); $pts[$pt] = $count->publish; } $comments_count = wp_count_comments(); // wp_get_theme was introduced in 3.4, for compatibility with older versions, let's do a workaround for now. if (function_exists('wp_get_theme')) { $theme_data = wp_get_theme(); $theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false)); if (isset($theme_data->template) && !empty($theme_data->template) && $theme_data->parent()) { $theme['template'] = array('version' => $theme_data->parent()->display('Version', false, false), 'name' => $theme_data->parent()->display('Name', false, false), 'theme_uri' => $theme_data->parent()->display('ThemeURI', false, false), 'author' => $theme_data->parent()->display('Author', false, false), 'author_uri' => $theme_data->parent()->display('AuthorURI', false, false)); } else { $theme['template'] = ''; } } else { $theme_data = (object) get_theme_data(get_stylesheet_directory() . '/style.css'); $theme = array('version' => $theme_data->Version, 'name' => $theme_data->Name, 'author' => $theme_data->Author, 'template' => $theme_data->Template); } $plugins = array(); foreach (get_option('active_plugins') as $plugin_path) { $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } $data = array('site' => array('hash' => $options['hash'], 'url' => site_url(), 'name' => get_bloginfo('name'), 'version' => get_bloginfo('version'), 'multisite' => is_multisite(), 'users' => count(get_users()), 'lang' => get_locale()), 'pts' => $pts, 'comments' => array('total' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pings' => $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_type = 'pingback'")), 'options' => apply_filters('yoast_tracking_filters', array()), 'theme' => $theme, 'plugins' => $plugins); $args = array('body' => $data); wp_remote_post('https://tracking.yoast.com/', $args); // Store for a week, then push data again. set_transient('yoast_tracking_cache', true, 7 * 60 * 60 * 24); } }
/** * Main tracking function. */ function tracking() { // Start of Metrics global $blog_id, $wpdb; $hash = get_option('Yoast_Tracking_Hash'); if (!isset($hash) || !$hash || empty($hash)) { $hash = md5(site_url()); update_option('Yoast_Tracking_Hash', $hash); } $data = get_transient('yoast_tracking_cache'); if (!$data) { $pts = array(); foreach (get_post_types(array('public' => true)) as $pt) { $count = wp_count_posts($pt); $pts[$pt] = $count->publish; } $comments_count = wp_count_comments(); // wp_get_theme was introduced in 3.4, for compatibility with older versions, let's do a workaround for now. if (function_exists('wp_get_theme')) { $theme_data = wp_get_theme(); $theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false)); if (isset($theme_data->template) && !empty($theme_data->template) && $theme_data->parent()) { $theme['template'] = array('version' => $theme_data->parent()->display('Version', false, false), 'name' => $theme_data->parent()->display('Name', false, false), 'theme_uri' => $theme_data->parent()->display('ThemeURI', false, false), 'author' => $theme_data->parent()->display('Author', false, false), 'author_uri' => $theme_data->parent()->display('AuthorURI', false, false)); } else { $theme['template'] = ''; } } else { $theme_data = (object) get_theme_data(get_stylesheet_directory() . '/style.css'); $theme = array('version' => $theme_data->Version, 'name' => $theme_data->Name, 'author' => $theme_data->Author, 'template' => $theme_data->Template); } $plugins = array(); foreach (get_option('active_plugins') as $plugin_path) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/admin.php'; } $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } $data = array('site' => array('hash' => $hash, 'url' => site_url(), 'name' => get_bloginfo('name'), 'version' => get_bloginfo('version'), 'multisite' => is_multisite(), 'users' => $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON ({$wpdb->users}.ID = {$wpdb->usermeta}.user_id) WHERE 1 = 1 AND ( {$wpdb->usermeta}.meta_key = %s )", 'wp_' . $blog_id . '_capabilities')), 'lang' => get_locale()), 'pts' => $pts, 'comments' => array('total' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pings' => $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_type = 'pingback'")), 'options' => apply_filters('yoast_tracking_filters', array()), 'theme' => $theme, 'plugins' => $plugins); $args = array('body' => $data); wp_remote_post('https://tracking.yoast.com/', $args); // Store for a week, then push data again. set_transient('yoast_tracking_cache', true, 7 * 60 * 60 * 24); } }
/** * Enhance each blog menu in network admin bar. * * Add new 'Manage Comment' Item with count of comments, there wait for moderate * * @since 0.0.1 */ public function enhance_network_blog_admin_bar() { global $wp_admin_bar; foreach ((array) $wp_admin_bar->user->blogs as $blog) { switch_to_blog($blog->userblog_id); $menu_id = 'blog-' . $blog->userblog_id; if (current_user_can('edit_posts')) { $wp_admin_bar->remove_node($menu_id . '-c'); $awaiting_mod = wp_count_comments(); $awaiting_mod = $awaiting_mod->moderated; $title = __('Manage Comments') . '<span id="ab-awaiting-mod" class="ab-label awaiting-mod pending-count count-' . (int) $awaiting_mod . '" style="margin-left:.2em">' . number_format_i18n($awaiting_mod) . '</span>'; $awaiting_title = esc_attr(sprintf(_n('%s comment awaiting moderation', '%s comments awaiting moderation', $awaiting_mod), number_format_i18n($awaiting_mod))); $wp_admin_bar->add_menu(array('parent' => $menu_id, 'id' => $menu_id . '-comments', 'title' => $title, 'href' => admin_url('edit-comments.php'), 'meta' => array('title' => $awaiting_title))); } restore_current_blog(); } }
/** * Test as a privilged user (administrator) * Expects test to pass * @param mixed $comment Comment object * @return void */ public function _test_as_admin($comment) { // Reset request $this->_clear_post_action(); // Become an administrator $this->_setRole('administrator'); // Set up a default request $_POST['id'] = $comment->comment_ID; $_POST['_ajax_nonce'] = wp_create_nonce('approve-comment_' . $comment->comment_ID); $_POST['_total'] = count($this->_comments); $_POST['_per_page'] = 100; $_POST['_page'] = 1; $_POST['_url'] = admin_url('edit-comments.php'); // Save the comment status $prev_status = wp_get_comment_status($comment->comment_ID); // Make the request try { $this->_handleAjax('dim-comment'); } catch (WPAjaxDieContinueException $e) { unset($e); } // Get the response $xml = simplexml_load_string($this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA); // Ensure everything is correct $this->assertEquals($comment->comment_ID, (string) $xml->response[0]->comment['id']); $this->assertEquals('dim-comment_' . $comment->comment_ID, (string) $xml->response['action']); $this->assertGreaterThanOrEqual(time() - 10, (int) $xml->response[0]->comment[0]->supplemental[0]->time[0]); $this->assertLessThanOrEqual(time(), (int) $xml->response[0]->comment[0]->supplemental[0]->time[0]); // Check the status $current = wp_get_comment_status($comment->comment_ID); if (in_array($prev_status, array('unapproved', 'spam'))) { $this->assertEquals('approved', $current); } else { $this->assertEquals('unapproved', $current); } // The total is calculated based on a page break -OR- a random number. Let's look for both possible outcomes $comment_count = wp_count_comments(0); $recalc_total = $comment_count->total_comments; // Delta is not specified, it will always be 1 lower than the request $total = $_POST['_total'] - 1; // Check for either possible total $this->assertTrue(in_array((int) $xml->response[0]->comment[0]->supplemental[0]->total[0], array($total, $recalc_total))); }
/** * Prints HTML with meta information for the categories, tags and comments. */ function sergeymotovilets_entry_footer($post_id) { // Hide category and tag text for pages. if ('post' === get_post_type()) { /* translators: used between list items, there is a space after the comma */ //$tags_list = get_the_tag_list( '', esc_html__( ', ', 'sergeymotovilets' ) ); //if ( $tags_list ) { // printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'sergeymotovilets' ) . '</span>', $tags_list ); // WPCS: XSS OK. //} } if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) { $comments_count = wp_count_comments($post_id)->approved; if ($comments_count == 0) { $output = 'Коментариев нет'; } if ($comments_count == 1) { $output = '1 Коментарий'; } if ($comments_count > 1) { $output = 'Коментарии ' . $comments_count; } echo ' <span class="comments-link"><svg><use xlink:href="#comments" /></svg> <a href="' . get_comments_link() . '">' . $output . '</a> </span> '; } /* share */ $current_url = home_url(add_query_arg(array(), $wp->request)); $post_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($post_id, 'large', true); echo ' <div class="share-link"> <svg><use xlink:href="#share" /></svg> <span>Поделиться</span> <ul class="sub-links"> <li class="fb-share"><a href="#" onclick="fbShare(\'' . get_the_permalink() . '\', \'' . $current_url . '\', event)">Facebook</a></li> <li class="vk-share"><a href="#" onclick="vkShare(\'' . get_the_permalink() . '\', \'' . get_the_title() . '\', \'' . get_the_excerpt() . '\', \'' . $thumb_url[0] . '\', event)">Вконтакте</a></li> </ul> </div> '; }
/** * Gathers tracking data and sends it off. * * @since 1.1-beta-2 */ private function track() { global $wpdb; $hash = md5(site_url()); $pts = array(); $post_types = get_post_types(array('public' => true)); if (is_array($post_types) && $post_types !== array()) { foreach ($post_types as $post_type) { $count = wp_count_posts($post_type); $pts[$post_type] = $count->publish; } } $comments_count = wp_count_comments(); $theme_data = wp_get_theme(); $theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false)); $theme_template = $theme_data->get_template(); if ($theme_template !== '' && $theme_data->parent()) { $theme['template'] = array('version' => $theme_data->parent()->display('Version', false, false), 'name' => $theme_data->parent()->display('Name', false, false), 'theme_uri' => $theme_data->parent()->display('ThemeURI', false, false), 'author' => $theme_data->parent()->display('Author', false, false), 'author_uri' => $theme_data->parent()->display('AuthorURI', false, false)); } else { $theme['template'] = ''; } $plugins = array(); $active_plugin = get_option('active_plugins'); foreach ($active_plugin as $plugin_path) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } $users = get_users(); if (function_exists('curl_version')) { $curl = curl_version(); } else { $curl = null; } $data = array('site' => array('hash' => $hash, 'version' => get_bloginfo('version'), 'multisite' => is_multisite(), 'users' => count($users), 'lang' => get_locale()), 'pts' => $pts, 'comments' => array('total' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pings' => $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_type = 'pingback'")), 'options' => array('site_db_charset' => DB_CHARSET, 'webserver_apache_version' => function_exists('apache_get_version') ? apache_get_version() : 0, 'webserver_server_software' => $_SERVER['SERVER_SOFTWARE'], 'webserver_gateway_interface' => $_SERVER['GATEWAY_INTERFACE'], 'webserver_server_protocol' => $_SERVER['SERVER_PROTOCOL'], 'php_version' => phpversion(), 'php_max_execution_time' => ini_get('max_execution_time'), 'php_memory_limit' => ini_get('memory_limit'), 'php_open_basedir' => ini_get('open_basedir'), 'php_bcmath_enabled' => extension_loaded('bcmath') ? 1 : 0, 'php_ctype_enabled' => extension_loaded('ctype') ? 1 : 0, 'php_curl_enabled' => extension_loaded('curl') ? 1 : 0, 'php_curl_version_a' => phpversion('curl'), 'php_curl' => !is_null($curl) ? $curl['version'] : 0, 'php_dom_enabled' => extension_loaded('dom') ? 1 : 0, 'php_dom_version' => phpversion('dom'), 'php_filter_enabled' => extension_loaded('filter') ? 1 : 0, 'php_mbstring_enabled' => extension_loaded('mbstring') ? 1 : 0, 'php_mbstring_version' => phpversion('mbstring'), 'php_pcre_enabled' => extension_loaded('pcre') ? 1 : 0, 'php_pcre_version' => phpversion('pcre'), 'php_pcre_with_utf8_a' => @preg_match('/^.{1}$/u', 'ñ', $UTF8_ar), 'php_pcre_with_utf8_b' => defined('PREG_BAD_UTF8_ERROR'), 'php_spl_enabled' => extension_loaded('spl') ? 1 : 0), 'theme' => $theme, 'plugins' => $plugins); $args = array('body' => $data, 'blocking' => false, 'sslverify' => false); wp_remote_post('https://tracking.realbigplugins.com/', $args); }