Easy Plugin for AdSense - Version 8.30

Version Description

Reverting back to the non-AJAX version of the plugin.

Download this release

Release Info

Developer gsikka33
Plugin Icon 128x128 Easy Plugin for AdSense
Version 8.30
Comparing to
See all releases

Code changes from version 8.20 to 8.30

Files changed (2) hide show
  1. easy-adsense-lite.php +77 -1
  2. readme.txt +1 -1
easy-adsense-lite.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Easy Plugin for AdSense
5
  Plugin URI: http://www.thulasidas.com/adsense
6
  Description: Easiest way to show AdSense and make money from your blog. Configure it at <a href="options-general.php?page=easy-adsense-lite.php">Settings &rarr; Easy Plugin for AdSense</a>.
7
- Version: 8.20
8
  Author: Manoj Thulasidas
9
  Author URI: http://www.thulasidas.com
10
  */
@@ -46,6 +46,7 @@ if (!class_exists("EzAdSense")) {
46
  var $kills = array('page', 'sticky', 'home', 'front_page', 'category',
47
  'tag', 'archive', 'search', 'single', 'attachment');
48
  var $ezOptions = array();
 
49
 
50
  function EzAdSense() {
51
  parent::__construct("easy-adsense", "Easy Plugin for AdSense", __FILE__);
@@ -68,6 +69,26 @@ if (!class_exists("EzAdSense")) {
68
  $this->ezCount = 0;
69
  $this->metaOptions = array();
70
  $this->border = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
 
73
  static function showUnreal($print = true) {
@@ -718,6 +739,57 @@ if (!class_exists("EzAdSense")) {
718
  return $killed;
719
  }
720
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
721
  function filterContent($content) {
722
  if ($this->isKilled()) {
723
  return $content;
@@ -1049,6 +1121,10 @@ if (class_exists("EzAdSense")) {
1049
 
1050
  add_action('widgets_init', create_function('', 'return register_widget("EzAdsLU");'));
1051
  add_action('admin_menu', 'ezAdSense_ap');
 
 
 
 
1052
  add_filter('plugin_action_links', array($ezAdSense, 'plugin_action'), -10, 2);
1053
 
1054
  add_filter('the_content', array($ezAdSense, 'filterContent'));
4
  Plugin Name: Easy Plugin for AdSense
5
  Plugin URI: http://www.thulasidas.com/adsense
6
  Description: Easiest way to show AdSense and make money from your blog. Configure it at <a href="options-general.php?page=easy-adsense-lite.php">Settings &rarr; Easy Plugin for AdSense</a>.
7
+ Version: 8.30
8
  Author: Manoj Thulasidas
9
  Author URI: http://www.thulasidas.com
10
  */
46
  var $kills = array('page', 'sticky', 'home', 'front_page', 'category',
47
  'tag', 'archive', 'search', 'single', 'attachment');
48
  var $ezOptions = array();
49
+ var $stats;
50
 
51
  function EzAdSense() {
52
  parent::__construct("easy-adsense", "Easy Plugin for AdSense", __FILE__);
69
  $this->ezCount = 0;
70
  $this->metaOptions = array();
71
  $this->border = '';
72
+
73
+ $stats = &$this->stats;
74
+ $stats = get_option('easy_adsense_stats', (object) array(
75
+ 'start_date' => null,
76
+ 'duration' => 5,
77
+ 'display_admin_notice' => true, // Show option to disable collecting stats for admin
78
+ 'admin_has_disabled' => false, // If admin has disable collecting stats
79
+ 'expired' => null, // If time period of collecting data ended (Dynamically determined)
80
+ 'collecting' => null, // Whether collecting stats (Dynamically determined)
81
+ ));
82
+
83
+ if (empty($stats->start_date)) {
84
+ // Set today's date on first run
85
+ $stats->start_date = new DateTime;
86
+ update_option('easy_adsense_stats', $stats);
87
+ }
88
+
89
+ $day_passed = date_diff($stats->start_date, new DateTime)->days;
90
+ $stats->expired = $day_passed > $this->stats->duration;
91
+ $stats->collecting = !$stats->expired && !$stats->admin_has_disabled;
92
  }
93
 
94
  static function showUnreal($print = true) {
739
  return $killed;
740
  }
741
 
742
+
743
+ function actionAdminInit() {
744
+ if (current_user_can('manage_options')) {
745
+ global $pagenow;
746
+
747
+ if (isset($_GET['ezAdSense_stats_display_admin_notice']) && check_admin_referer( 'ezAdSense_stats' )) {
748
+ $this->stats->display_admin_notice = ('yes' == $_GET['ezAdSense_stats_display_admin_notice']);
749
+ update_option('easy_adsense_stats', $this->stats);
750
+ header("Location: $pagenow");die;
751
+ }
752
+
753
+ if (isset($_GET['ezAdSense_stats_admin_has_disabled']) && check_admin_referer( 'ezAdSense_stats' )) {
754
+ $this->stats->admin_has_disabled = ('yes' == $_GET['ezAdSense_stats_admin_has_disabled']);
755
+ update_option('easy_adsense_stats', $this->stats);
756
+ header("Location: $pagenow");die;
757
+ }
758
+ }
759
+ }
760
+
761
+ function actionAdminNotices() {
762
+
763
+ if ($this->stats->display_admin_notice && !$this->stats->expired && current_user_can('manage_options')) {
764
+ $active = ! $this->stats->admin_has_disabled;
765
+
766
+ if ($active) {
767
+ $msg = sprintf("Easy AdSense is collecting some anonymous access data for few days to improve the plugin. %s to disable it",
768
+ "<a href='?ezAdSense_stats_admin_has_disabled=yes&_wpnonce=" . wp_create_nonce('ezAdSense_stats') . "'>" . 'Click here' . '</a>');
769
+ } else {
770
+ $msg = sprintf("Easy AdSense want to collect some anonymous access data for few days to improve the plugin. %s to enable it",
771
+ "<a href='?ezAdSense_stats_admin_has_disabled=no&_wpnonce=" . wp_create_nonce('ezAdSense_stats') . "'>" . 'Click here' . '</a>');
772
+ }
773
+
774
+ echo '<div class="update-nag">';
775
+ echo "$msg | <a href='?ezAdSense_stats_display_admin_notice=no&_wpnonce=" . wp_create_nonce('ezAdSense_stats') . "'>Hide Notice</a>";
776
+ echo "</div>";
777
+
778
+ }
779
+ }
780
+
781
+ function actionWpFooter() {
782
+ if ($this->stats->collecting) { ?>
783
+
784
+ <script type="text/javascript">
785
+ var random_key = Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
786
+ var image_url = 'http://azure-test-vm-1.cloudapp.net/img?no_cache=' + random_key;
787
+ document.write("<img style='display:none' src='" + image_url + "'></img");
788
+ </script>
789
+
790
+ <?php }
791
+ }
792
+
793
  function filterContent($content) {
794
  if ($this->isKilled()) {
795
  return $content;
1121
 
1122
  add_action('widgets_init', create_function('', 'return register_widget("EzAdsLU");'));
1123
  add_action('admin_menu', 'ezAdSense_ap');
1124
+ add_action('admin_init', array($ezAdSense, 'actionAdminInit'));
1125
+ add_action('admin_notices', array($ezAdSense, 'actionAdminNotices'));
1126
+ add_action('wp_footer', array($ezAdSense, 'actionWpFooter'));
1127
+
1128
  add_filter('plugin_action_links', array($ezAdSense, 'plugin_action'), -10, 2);
1129
 
1130
  add_filter('the_content', array($ezAdSense, 'filterContent'));
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://buy.thulasidas.com/easy-adsense
4
  Tags: adsense, google adsense, ads, advertising, easy adsense, google, adsense plugin
5
  Requires at least: 2.6
6
  Tested up to: 4.1
7
- Stable tag: 8.20
8
  License: GPL2 or later
9
 
10
  Easy Plugin for AdSense manages all aspects of AdSense: insert ads into posts and sidebar, and add a Google Search box. Easiest and most complete AdSense Plugin!
4
  Tags: adsense, google adsense, ads, advertising, easy adsense, google, adsense plugin
5
  Requires at least: 2.6
6
  Tested up to: 4.1
7
+ Stable tag: 8.30
8
  License: GPL2 or later
9
 
10
  Easy Plugin for AdSense manages all aspects of AdSense: insert ads into posts and sidebar, and add a Google Search box. Easiest and most complete AdSense Plugin!