Plugin Directory

Changeset 1012695


Ignore:
Timestamp:
10/23/2014 10:46:24 AM (11 years ago)
Author:
drumba
Message:

remove presstrends

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wplike2get/trunk/wpLike2Get.php

    r1012678 r1012695  
    433433    }
    434434}
    435 
    436 
    437 /**
    438  * PressTrends Plugin API
    439  */
    440 function presstrends_wpLike2Get_plugin()
    441 {
    442 
    443     // PressTrends Account API Key
    444     $api_key = 'uksntz4he7uz89ifuteizgda3jmayiz1p488';
    445     $auth = 'xdwrgixg6t3ovq2b3pte7c9b341ncdvo9';
    446 
    447     // Start of Metrics
    448     global $wpdb;
    449     $data = get_transient('presstrends_cache_data');
    450     if (!$data || $data == '') {
    451         $api_base = 'http://api.presstrends.io/index.php/api/pluginsites/update/auth/';
    452         $url = $api_base . $auth . '/api/' . $api_key . '/';
    453 
    454         $count_posts = wp_count_posts();
    455         $count_pages = wp_count_posts('page');
    456         $comments_count = wp_count_comments();
    457 
    458         // wp_get_theme was introduced in 3.4, for compatibility with older versions, let's do a workaround for now.
    459         if (function_exists('wp_get_theme')) {
    460             $theme_data = wp_get_theme();
    461             $theme_name = urlencode($theme_data->Name);
    462         } else {
    463             $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
    464             $theme_name = $theme_data['Name'];
    465         }
    466 
    467         $plugin_name = '&';
    468         foreach (get_plugins() as $plugin_info) {
    469             $plugin_name .= $plugin_info['Name'] . '&';
    470         }
    471         // CHANGE __FILE__ PATH IF LOCATED OUTSIDE MAIN PLUGIN FILE
    472         $plugin_data = get_plugin_data(__FILE__);
    473         $posts_with_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='post' AND comment_count > 0");
    474         $data = array('url' => stripslashes(str_replace(array('http://', '/', ':'), '', site_url())), 'posts' => $count_posts->publish, 'pages' => $count_pages->publish, 'comments' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pingbacks' => $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'pingback'"), 'post_conversion' => ($count_posts->publish > 0 && $posts_with_comments > 0) ? number_format(($posts_with_comments / $count_posts->publish) * 100, 0, '.', '') : 0, 'theme_version' => $plugin_data['Version'], 'theme_name' => $theme_name, 'site_name' => str_replace(' ', '', get_bloginfo('name')), 'plugins' => count(get_option('active_plugins')), 'plugin' => urlencode($plugin_name), 'wpversion' => get_bloginfo('version'),);
    475 
    476         foreach ($data as $k => $v) {
    477             $url .= $k . '/' . $v . '/';
    478         }
    479         wp_remote_get($url);
    480         set_transient('presstrends_cache_data', $data, 60 * 60 * 24);
    481     }
    482 }
    483 
    484 // PressTrends WordPress Action
    485 add_action('admin_init', 'presstrends_wpLike2Get_plugin');
Note: See TracChangeset for help on using the changeset viewer.