Version Description
Download this release
Release Info
Developer | hchouhan |
Plugin | I Recommend This |
Version | 1.4.4 |
Comparing to | |
See all releases |
Code changes from version 1.4.3 to 1.4.4
- i-recommend-this.php +53 -1
i-recommend-this.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: I Recommend This
|
4 |
Plugin URI: http://www.harishchouhan.com/personal-projects/i-recommend-this/
|
5 |
Description: This plugin allows your visitors to simply recommend or like your posts instead of commment it.
|
6 |
-
Version: 1.4.
|
7 |
Author: Harish Chouhan
|
8 |
Author URI: http://www.harishchouhan.com
|
9 |
|
@@ -363,4 +363,56 @@ function addHeaderLinks() {
|
|
363 |
|
364 |
add_action('init', enqueueScripts);
|
365 |
add_action('wp_head', addHeaderLinks);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
?>
|
3 |
Plugin Name: I Recommend This
|
4 |
Plugin URI: http://www.harishchouhan.com/personal-projects/i-recommend-this/
|
5 |
Description: This plugin allows your visitors to simply recommend or like your posts instead of commment it.
|
6 |
+
Version: 1.4.4
|
7 |
Author: Harish Chouhan
|
8 |
Author URI: http://www.harishchouhan.com
|
9 |
|
363 |
|
364 |
add_action('init', enqueueScripts);
|
365 |
add_action('wp_head', addHeaderLinks);
|
366 |
+
|
367 |
+
// Start of Presstrends Magic
|
368 |
+
function presstrends_plugin() {
|
369 |
+
|
370 |
+
// PressTrends Account API Key
|
371 |
+
$api_key = '0o9bxvlwkq4x71se6ey7ggnrjckfsmzs89k8';
|
372 |
+
$auth = 'wu9y7j98r8vkpgl7e3dsw0hzbhbpibdg3';
|
373 |
+
|
374 |
+
// Start of Metrics
|
375 |
+
global $wpdb;
|
376 |
+
$data = get_transient( 'presstrends_data' );
|
377 |
+
if (!$data || $data == ''){
|
378 |
+
$api_base = 'http://api.presstrends.io/index.php/api/pluginsites/update/auth/';
|
379 |
+
$url = $api_base . $auth . '/api/' . $api_key . '/';
|
380 |
+
$data = array();
|
381 |
+
$count_posts = wp_count_posts();
|
382 |
+
$count_pages = wp_count_posts('page');
|
383 |
+
$comments_count = wp_count_comments();
|
384 |
+
$theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
|
385 |
+
$plugin_count = count(get_option('active_plugins'));
|
386 |
+
$all_plugins = get_plugins();
|
387 |
+
foreach($all_plugins as $plugin_file => $plugin_data) {
|
388 |
+
$plugin_name .= $plugin_data['Name'];
|
389 |
+
$plugin_name .= '&';}
|
390 |
+
$plugin_data = get_plugin_data( __FILE__ );
|
391 |
+
$plugin_version = $plugin_data['Version'];
|
392 |
+
$posts_with_comments = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}posts WHERE post_type='post' AND comment_count > 0");
|
393 |
+
$comments_to_posts = number_format(($posts_with_comments / $count_posts->publish) * 100, 0, '.', '');
|
394 |
+
$pingback_result = $wpdb->get_var('SELECT COUNT(comment_ID) FROM '.$wpdb->comments.' WHERE comment_type = "pingback"');
|
395 |
+
$data['url'] = stripslashes(str_replace(array('http://', '/', ':' ), '', site_url()));
|
396 |
+
$data['posts'] = $count_posts->publish;
|
397 |
+
$data['pages'] = $count_pages->publish;
|
398 |
+
$data['comments'] = $comments_count->total_comments;
|
399 |
+
$data['approved'] = $comments_count->approved;
|
400 |
+
$data['spam'] = $comments_count->spam;
|
401 |
+
$data['pingbacks'] = $pingback_result;
|
402 |
+
$data['post_conversion'] = $comments_to_posts;
|
403 |
+
$data['theme_version'] = $plugin_version;
|
404 |
+
$data['theme_name'] = urlencode($theme_data['Name']);
|
405 |
+
$data['site_name'] = str_replace( ' ', '', get_bloginfo( 'name' ));
|
406 |
+
$data['plugins'] = $plugin_count;
|
407 |
+
$data['plugin'] = urlencode($plugin_name);
|
408 |
+
$data['wpversion'] = get_bloginfo('version');
|
409 |
+
foreach ( $data as $k => $v ) {
|
410 |
+
$url .= $k . '/' . $v . '/';}
|
411 |
+
$response = wp_remote_get( $url );
|
412 |
+
set_transient('presstrends_data', $data, 60*60*24);}
|
413 |
+
}
|
414 |
+
|
415 |
+
// PressTrends WordPress Action
|
416 |
+
add_action('admin_init', 'presstrends_plugin');
|
417 |
+
|
418 |
?>
|