Easy Plugin for AdSense - Version 5.18

Version Description

Coding improvements: refactoring, minor fixes.

=

Download this release

Release Info

Developer manojtd
Plugin Icon 128x128 Easy Plugin for AdSense
Version 5.18
Comparing to
See all releases

Code changes from version 5.17 to 5.18

Files changed (4) hide show
  1. easy-adsense-lite.php +37 -67
  2. myPlugins.php +2 -1
  3. readme.txt +5 -4
  4. tail-text.php +2 -2
easy-adsense-lite.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Easy AdSense
4
  Plugin URI: http://www.thulasidas.com/adsense
5
  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 AdSense</a>.
6
- Version: 5.17
7
  Author: Manoj Thulasidas
8
  Author URI: http://www.thulasidas.com
9
  */
@@ -120,6 +120,7 @@ if (!class_exists("ezAdSense")) {
120
  'margin_lu' => 12,
121
  'text_lu' => $this->defaults['defaultText'],
122
  'title_gsearch' => '',
 
123
  'margin_gsearch' => 0,
124
  'text_gsearch' => $this->defaults['defaultText'],
125
  'max_count' => 3,
@@ -135,6 +136,8 @@ if (!class_exists("ezAdSense")) {
135
  'border_widget' => false,
136
  'border_lu' => false,
137
  'limit_lu' => 1,
 
 
138
  'kill_invites' => false,
139
  'kill_rating' => false,
140
  'kill_attach' => false,
@@ -143,7 +146,9 @@ if (!class_exists("ezAdSense")) {
143
  'kill_cat' => false,
144
  'kill_tag' => false,
145
  'kill_archive' => false,
146
- 'kill_inline' => false
 
 
147
  );
148
  $ezAdOptions = get_option($mOptions);
149
  if (empty($ezAdOptions)) {
@@ -269,7 +274,7 @@ if (!class_exists("ezAdSense")) {
269
 
270
  $ezAdOptions['force_midad'] = isset($_POST['ezForceMidAd']);
271
  $ezAdOptions['force_widget'] = isset($_POST['ezForceWidget']);
272
- $ezAdOptions['allow_feeds'] = false ; // isset($_POST['ezAllowFeeds']);
273
  $ezAdOptions['kill_pages'] = isset($_POST['ezKillPages']);
274
  $ezAdOptions['kill_home'] = isset($_POST['ezKillHome']);
275
  $ezAdOptions['kill_attach'] = isset($_POST['ezKillAttach']);
@@ -387,72 +392,38 @@ if (!class_exists("ezAdSense")) {
387
  function contentMeta() {
388
  $ezAdOptions = $this->getAdminOptions();
389
  global $post;
390
- $meta = array() ;
391
- if ($post) $meta = get_post_custom($post->ID);
392
- $adkeys = array('adsense', 'adsense-top', 'adsense-middle', 'adsense-bottom') ;
393
- $ezkeys = array('adsense', 'show_leadin', 'show_midtext', 'show_leadout') ;
 
 
 
394
  $metaOptions = array() ;
395
- // initialize to ezAdOptions
396
- foreach ($ezkeys as $key => $optKey) {
397
- if (isset($ezAdOptions[$optKey]))
398
- $metaOptions[$ezkeys[$key]] = $ezAdOptions[$optKey] ;
399
- }
400
- // overwrite with custom fields
401
- if (!empty($meta)) {
402
- foreach ($meta as $key => $val) {
403
- $tkey = array_search(strtolower(trim($key)), $adkeys) ;
404
- if ($tkey !== FALSE) {
405
- $value = strtolower(trim($val[0])) ;
406
- // ensure valid values for options
407
- if ($value == 'left' || $value == 'right'
408
- || $value == 'center' || $value == 'no') {
409
- if ($value == 'left' || $value == 'right') $value = 'float:' . $value ;
410
- if ($value == 'center') $value = 'text-align:' . $value ;
411
- $metaOptions[$ezkeys[$tkey]] = $value ;
412
- }
413
- }
414
- }
415
- }
416
- return $metaOptions ;
417
- }
418
-
419
- function widgetMeta() {
420
- $ezAdOptions = $this->getAdminOptions();
421
- global $post;
422
- $meta = get_post_custom($post->ID);
423
- $adkeys = array('adsense', 'adsense-widget',
424
- 'adsense-search', 'adsense-linkunits') ;
425
- $ezkeys = array('adsense', 'show_widget',
426
- 'title_gsearch', 'show_lu') ;
427
- $metaOptions = array() ;
428
- // initialize to ezAdOptions
429
- foreach ($ezkeys as $key => $optKey) {
430
- if (isset($ezAdOptions[$optKey]))
431
- $metaOptions[$ezkeys[$key]] = $ezAdOptions[$optKey] ;
432
- }
433
- // overwrite with custom fields
434
- if (!empty($meta)) {
435
- foreach ($meta as $key => $val) {
436
- $tkey = array_search(strtolower(trim($key)), $adkeys) ;
437
- if ($tkey !== FALSE) {
438
- $value = strtolower(trim($val[0])) ;
439
- // ensure valid values for options
440
- if ($value == 'left' || $value == 'right'
441
- || $value == 'center' || $value == 'no') {
442
- if ($value != 'no') $value = 'text-align:' . $value ;
443
- if ($ezkeys[$tkey] != 'title_gsearch')
444
- $metaOptions[$ezkeys[$tkey]] = $value ;
445
- }
446
- }
447
- }
448
  }
449
  return $metaOptions ;
450
  }
451
 
452
  function ezAdSense_content($content) {
453
- // if (!$ezAdOptions['allow_feeds'] && is_feed()) return $content ;
454
- if (is_feed()) return $content ;
455
  $ezAdOptions = $this->getAdminOptions();
 
456
  if ($ezAdOptions['kill_pages'] && is_page()) return $content ;
457
  if ($ezAdOptions['kill_attach'] && is_attachment()) return $content ;
458
  if ($ezAdOptions['kill_home'] && is_home()) return $content ;
@@ -642,7 +613,7 @@ if (!class_exists("ezAdSense")) {
642
  $ezAdOptions = $this->getAdminOptions();
643
  $ezAdOptions['text_widget'] =
644
  $this->handleDefaultText($ezAdOptions['text_widget'], '160x600') ;
645
- $metaOptions = $this->widgetMeta() ;
646
  if (isset($metaOptions['adsense']) && $metaOptions['adsense'] == 'no') return ;
647
  $show_widget = $metaOptions['show_widget'] ;
648
  if ($show_widget == 'no') return ;
@@ -695,9 +666,8 @@ if (!class_exists("ezAdSense")) {
695
  $ezAdOptions['text_lu'] =
696
  $this->handleDefaultText($ezAdOptions['text_lu'], '160x160') ;
697
  $title = empty($ezAdOptions['title_lu']) ? '' :
698
- $before_title . stripslashes(htmlspecialchars($ezAdOptions['title_lu'])) .
699
- $after_title ;
700
- $metaOptions = $this->widgetMeta() ;
701
  if (isset($metaOptions['adsense']) && $metaOptions['adsense'] == 'no') return ;
702
  $show_lu = $metaOptions['show_lu'] ;
703
  $border = '' ;
@@ -730,7 +700,7 @@ if (!class_exists("ezAdSense")) {
730
  $ezAdOptions = $this->getAdminOptions();
731
  $ezAdOptions['text_gsearch'] =
732
  $this->handleDefaultText($ezAdOptions['text_gsearch'], '160x160') ;
733
- $metaOptions = $this->widgetMeta() ;
734
  if (isset($metaOptions['adsense']) && $metaOptions['adsense'] == 'no') return ;
735
  $title_gsearch = $metaOptions['title_gsearch'] ;
736
  if ($title_gsearch != 'no') {
3
  Plugin Name: Easy AdSense
4
  Plugin URI: http://www.thulasidas.com/adsense
5
  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 AdSense</a>.
6
+ Version: 5.18
7
  Author: Manoj Thulasidas
8
  Author URI: http://www.thulasidas.com
9
  */
120
  'margin_lu' => 12,
121
  'text_lu' => $this->defaults['defaultText'],
122
  'title_gsearch' => '',
123
+ 'kill_gsearch_title' => '',
124
  'margin_gsearch' => 0,
125
  'text_gsearch' => $this->defaults['defaultText'],
126
  'max_count' => 3,
136
  'border_widget' => false,
137
  'border_lu' => false,
138
  'limit_lu' => 1,
139
+ 'title_lu' => '',
140
+ 'kill_lu_title' => false,
141
  'kill_invites' => false,
142
  'kill_rating' => false,
143
  'kill_attach' => false,
146
  'kill_cat' => false,
147
  'kill_tag' => false,
148
  'kill_archive' => false,
149
+ 'kill_inline' => false,
150
+ 'kill_widget_title' => false,
151
+ 'title_widget' => ''
152
  );
153
  $ezAdOptions = get_option($mOptions);
154
  if (empty($ezAdOptions)) {
274
 
275
  $ezAdOptions['force_midad'] = isset($_POST['ezForceMidAd']);
276
  $ezAdOptions['force_widget'] = isset($_POST['ezForceWidget']);
277
+ $ezAdOptions['allow_feeds'] = isset($_POST['ezAllowFeeds']);
278
  $ezAdOptions['kill_pages'] = isset($_POST['ezKillPages']);
279
  $ezAdOptions['kill_home'] = isset($_POST['ezKillHome']);
280
  $ezAdOptions['kill_attach'] = isset($_POST['ezKillAttach']);
392
  function contentMeta() {
393
  $ezAdOptions = $this->getAdminOptions();
394
  global $post;
395
+ $lookup = array('adsense' => 'adsense',
396
+ 'adsense-top' =>'show_leadin',
397
+ 'adsense-middle' => 'show_midtext',
398
+ 'adsense-bottom' => 'show_leadout',
399
+ 'adsense-widget' => 'show_widget',
400
+ 'adsense-search' => 'title_gsearch',
401
+ 'adsense-linkunits' => 'show_lu') ;
402
  $metaOptions = array() ;
403
+ foreach ($lookup as $metaKey => $optKey) {
404
+ if (!empty($ezAdOptions[$optKey])) $metaOptions[$optKey] = $ezAdOptions[$optKey] ;
405
+ else $metaOptions[$optKey] = '' ;
406
+ $customStyle = get_post_custom_values($metaKey, $post->ID, true);
407
+ if (is_array($customStyle))
408
+ $metaStyle = strtolower($customStyle[0]) ;
409
+ else
410
+ $metaStyle = strtolower($customStyle) ;
411
+ $style = '' ;
412
+ if ($metaStyle == 'left')
413
+ $style = 'float:left;display:block;' ;
414
+ else if ($metaStyle == 'right')
415
+ $style = 'float:right;display:block;' ;
416
+ else if ($metaStyle == 'center')
417
+ $style = 'text-align:center;display:block;' ;
418
+ else $style = $metaStyle ;
419
+ if (!empty($style)) $metaOptions[$optKey] = $style ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  }
421
  return $metaOptions ;
422
  }
423
 
424
  function ezAdSense_content($content) {
 
 
425
  $ezAdOptions = $this->getAdminOptions();
426
+ if (!$ezAdOptions['allow_feeds'] && is_feed()) return $content ;
427
  if ($ezAdOptions['kill_pages'] && is_page()) return $content ;
428
  if ($ezAdOptions['kill_attach'] && is_attachment()) return $content ;
429
  if ($ezAdOptions['kill_home'] && is_home()) return $content ;
613
  $ezAdOptions = $this->getAdminOptions();
614
  $ezAdOptions['text_widget'] =
615
  $this->handleDefaultText($ezAdOptions['text_widget'], '160x600') ;
616
+ $metaOptions = $this->contentMeta() ;
617
  if (isset($metaOptions['adsense']) && $metaOptions['adsense'] == 'no') return ;
618
  $show_widget = $metaOptions['show_widget'] ;
619
  if ($show_widget == 'no') return ;
666
  $ezAdOptions['text_lu'] =
667
  $this->handleDefaultText($ezAdOptions['text_lu'], '160x160') ;
668
  $title = empty($ezAdOptions['title_lu']) ? '' :
669
+ $before_title . stripslashes(htmlspecialchars($ezAdOptions['title_lu'])) . $after_title ;
670
+ $metaOptions = $this->contentMeta() ;
 
671
  if (isset($metaOptions['adsense']) && $metaOptions['adsense'] == 'no') return ;
672
  $show_lu = $metaOptions['show_lu'] ;
673
  $border = '' ;
700
  $ezAdOptions = $this->getAdminOptions();
701
  $ezAdOptions['text_gsearch'] =
702
  $this->handleDefaultText($ezAdOptions['text_gsearch'], '160x160') ;
703
+ $metaOptions = $this->contentMeta() ;
704
  if (isset($metaOptions['adsense']) && $metaOptions['adsense'] == 'no') return ;
705
  $title_gsearch = $metaOptions['title_gsearch'] ;
706
  if ($title_gsearch != 'no') {
myPlugins.php CHANGED
@@ -92,7 +92,7 @@ $myPlugins['theme-tweaker'] =
92
  'pro' => 'Note that <em><strong>Theme Tweaker</strong></em> may not work with some themes. Please verify its suitability using the Lite version first. The Lite version of the plugin is fully functional. The Pro version lets you create and save your tweaked <code>style.css</code> files, and even generate your own child themes!',
93
  'benefits' => '<li>Ability to generate and download <code>style.css</code> files with your modified colors.</li>
94
  <li>Ability to create a child theme so that your changes can be applied even when the underlying theme is updated.</li>
95
- <li>More color schemes.</li>') ;
96
 
97
  $myPlugins['easy-latex'] =
98
  array('value' => 'Easy WP LaTeX',
@@ -214,6 +214,7 @@ if (!function_exists('renderRating')) {
214
  else
215
  $msg = "You will find it feature-rich and robust." ;
216
  $plgKey = basename($plgDir) ;
 
217
  if (!$killable) $display = "style='display:none'" ;
218
  echo <<<ENDRATING
219
  <div class='updated' id='rating'>
92
  'pro' => 'Note that <em><strong>Theme Tweaker</strong></em> may not work with some themes. Please verify its suitability using the Lite version first. The Lite version of the plugin is fully functional. The Pro version lets you create and save your tweaked <code>style.css</code> files, and even generate your own child themes!',
93
  'benefits' => '<li>Ability to generate and download <code>style.css</code> files with your modified colors.</li>
94
  <li>Ability to create a child theme so that your changes can be applied even when the underlying theme is updated.</li>
95
+ <li>Scanning for *all* the style files in your theme directory to find all possible color definitions.</li>') ;
96
 
97
  $myPlugins['easy-latex'] =
98
  array('value' => 'Easy WP LaTeX',
214
  else
215
  $msg = "You will find it feature-rich and robust." ;
216
  $plgKey = basename($plgDir) ;
217
+ $display = '' ;
218
  if (!$killable) $display = "style='display:none'" ;
219
  echo <<<ENDRATING
220
  <div class='updated' id='rating'>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://affiliates.thulasidas.com/
4
  Tags: adsense, google adsense, ads, advertising, easy adsense, google, adsense plugin
5
  Requires at least: 2.6
6
  Tested up to: 3.4
7
- Stable tag: 5.17
8
 
9
  Easy AdSense manages all aspects of AdSense: insert ads into posts and sidebar, and add a Google Search box. Easiest and most complete AdSense Plugin!
10
 
@@ -32,13 +32,13 @@ Easy AdSense is the freely distributed version of a premium plugin. The [Pro ver
32
 
33
  = New in this Release =
34
 
35
- Taking care of some debug notices from WordPress debug mode.
36
 
37
  == Upgrade Notice ==
38
 
39
- = 5.17 =
40
 
41
- Taking care of some debug notices from WordPress debug mode.
42
 
43
  == Screenshots ==
44
 
@@ -128,6 +128,7 @@ A big "Thank You" to all my translators. Easy AdSense V2.6+ sports an *Easy Tran
128
 
129
  == Change Log ==
130
 
 
131
  * V5.17: Taking care of some debug notices from WordPress debug mode. [Aug 27, 2012]
132
  * V5.16: Adding nl_NL translation. [Aug 12, 2012]
133
  * V5.15: Minor changes to the admin page. [July 18, 2012]
4
  Tags: adsense, google adsense, ads, advertising, easy adsense, google, adsense plugin
5
  Requires at least: 2.6
6
  Tested up to: 3.4
7
+ Stable tag: 5.18
8
 
9
  Easy AdSense manages all aspects of AdSense: insert ads into posts and sidebar, and add a Google Search box. Easiest and most complete AdSense Plugin!
10
 
32
 
33
  = New in this Release =
34
 
35
+ Coding improvements: refactoring, minor fixes.
36
 
37
  == Upgrade Notice ==
38
 
39
+ = 5.18 =
40
 
41
+ Coding improvements: refactoring, minor fixes.
42
 
43
  == Screenshots ==
44
 
128
 
129
  == Change Log ==
130
 
131
+ * V5.18: Coding improvements: refactoring, minor fixes. [Aug 30, 2012]
132
  * V5.17: Taking care of some debug notices from WordPress debug mode. [Aug 27, 2012]
133
  * V5.16: Adding nl_NL translation. [Aug 12, 2012]
134
  * V5.15: Minor changes to the admin page. [July 18, 2012]
tail-text.php CHANGED
@@ -47,7 +47,7 @@ function makeTextWithTooltipTag($plg, $text, $tip, $title='', $width='')
47
  function renderPlg($name, $plg) {
48
  if (!empty($plg['hide']) && $plg['hide']) return ;
49
  $plugindir = get_option('siteurl') . '/' . PLUGINDIR . '/' . basename(dirname(__FILE__)) ;
50
- if ($plg['kind'] != '' && $plg['kind'] != 'plugin') return ;
51
  $value = '<em><strong>'.$plg['value'].'</strong></em>';
52
  $desc = $plg['desc'] ;
53
  $title = $plg['title'] ;
@@ -69,7 +69,7 @@ function renderPlg($name, $plg) {
69
  }
70
  function renderBook($name, $plg) {
71
  $plugindir = get_option('siteurl') . '/' . PLUGINDIR . '/' . basename(dirname(__FILE__)) ;
72
- if ($plg['kind'] != 'book') return ;
73
  $value = '<em><strong>'.$plg['value'].'</strong></em>';
74
  $desc = $plg['desc'] ;
75
  $title = $plg['title'] ;
47
  function renderPlg($name, $plg) {
48
  if (!empty($plg['hide']) && $plg['hide']) return ;
49
  $plugindir = get_option('siteurl') . '/' . PLUGINDIR . '/' . basename(dirname(__FILE__)) ;
50
+ if (!empty($plg['kind']) && $plg['kind'] != '' && $plg['kind'] != 'plugin') return ;
51
  $value = '<em><strong>'.$plg['value'].'</strong></em>';
52
  $desc = $plg['desc'] ;
53
  $title = $plg['title'] ;
69
  }
70
  function renderBook($name, $plg) {
71
  $plugindir = get_option('siteurl') . '/' . PLUGINDIR . '/' . basename(dirname(__FILE__)) ;
72
+ if (empty($plg['kind']) || $plg['kind'] != 'book') return ;
73
  $value = '<em><strong>'.$plg['value'].'</strong></em>';
74
  $desc = $plg['desc'] ;
75
  $title = $plg['title'] ;