Easy Plugin for AdSense - Version 7.20

Version Description

Some refactoring changes.

Download this release

Release Info

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

Code changes from version 7.13 to 7.20

EzAdmin.php CHANGED
@@ -41,6 +41,21 @@ if (!class_exists('EzAdmin')) {
41
  }
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  function renderInvite() {
45
  if ($this->killAuthor) {
46
  return;
@@ -214,7 +229,7 @@ $moreInfo
214
 
215
  $s1 = sprintf(__('Download the Lite version of %s', 'easy-common'), $plg['value']);
216
  $s2 = __('Lite Version', 'easy-common');
217
- $s3 = sprintf(__('Buy the Pro version of %s for $%.2f', 'easy-common'), $plg['value'], $price);
218
  $s4 = __('Pro Version', 'easy-common');
219
  $s5 = __('Buy the Pro Version', 'easy-common');
220
 
@@ -226,9 +241,9 @@ $moreInfo
226
  $s8 = sprintf(__('It costs only $%.2f!', 'easy-common'), $price);
227
  $s9 = __('Instant download link.', 'easy-common');
228
  $value .= '<b><i> Lite</i></b>';
229
- $s10 = sprintf(__('Thank you for using %s. The \"Pro\" version gives you more options.', 'easy-common'), $value);
230
- $s11 = __("Consider buying it.", 'easy-common');
231
- echo "$s10 $filter $s11 <a href='http://buy.thulasidas.com/$slug' title='$s3. $s9'>$s8</a>";
232
  echo "</div>";
233
  }
234
 
41
  }
42
  }
43
 
44
+ function renderNags(&$options) {
45
+ if (empty($options['kill_rating'])) {
46
+ $this->renderRating();
47
+ }
48
+ else {
49
+ echo "<input type='hidden' name='kill_rating' value='true' />";
50
+ }
51
+ if (empty($options['kill_invites'])) {
52
+ $this->renderInvite();
53
+ }
54
+ else {
55
+ echo "<input type='hidden' name='kill_invites' value='true' />";
56
+ }
57
+ }
58
+
59
  function renderInvite() {
60
  if ($this->killAuthor) {
61
  return;
229
 
230
  $s1 = sprintf(__('Download the Lite version of %s', 'easy-common'), $plg['value']);
231
  $s2 = __('Lite Version', 'easy-common');
232
+ $s3 = sprintf(__('Buy the Pro version of %s for $%.2f', 'easy-common'), $plg['value'], $price);
233
  $s4 = __('Pro Version', 'easy-common');
234
  $s5 = __('Buy the Pro Version', 'easy-common');
235
 
241
  $s8 = sprintf(__('It costs only $%.2f!', 'easy-common'), $price);
242
  $s9 = __('Instant download link.', 'easy-common');
243
  $value .= '<b><i> Lite</i></b>';
244
+ $s10 = sprintf(__('Thank you for using %s. The "Pro" version gives you more options.', 'easy-common'), $value);
245
+ $s11 = __("Consider buying it.", 'easy-common');
246
+ echo "$s10 $filter $s11 <a href='http://buy.thulasidas.com/$slug' title='$s3. $s9'>$s8</a>";
247
  echo "</div>";
248
  }
249
 
EzOptions.php CHANGED
@@ -221,12 +221,12 @@ if (!class_exists("EzBaseOption")) {
221
  $style = "";
222
  }
223
  echo "{$this->before}\n";
224
- echo "<span $style id='{$this->name}' $toolTip>{$this->desc} {$this->between}</span>";
225
  echo "\n{$this->after}\n";
226
  }
227
 
228
  function postRender() {
229
-
230
  }
231
 
232
  function render() {
@@ -531,6 +531,7 @@ if (!class_exists("EzBasePlugin")) {
531
  var $ezTran, $ezAdmin, $myPlugins;
532
  var $isPro, $strPro;
533
  var $options = array(), $ezOptions = array();
 
534
 
535
  function __construct($slug, $name, $file) {
536
  $this->slug = $slug;
@@ -567,10 +568,128 @@ if (!class_exists("EzBasePlugin")) {
567
  }
568
  }
569
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  function handleSubmits() {
571
  if (empty($_POST)) {
572
  return;
573
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
574
  }
575
 
576
  function setOptionValues() {
@@ -601,6 +720,18 @@ if (!class_exists("EzBasePlugin")) {
601
  return $this->ezAdmin;
602
  }
603
 
 
 
 
 
 
 
 
 
 
 
 
 
604
  function printAdminPage() {
605
  // if translating, print translation interface
606
  if ($this->ezTran->printAdminPage()) {
221
  $style = "";
222
  }
223
  echo "{$this->before}\n";
224
+ echo "<span $style id='{$this->name}' $toolTip>{$this->desc} {$this->between}";
225
  echo "\n{$this->after}\n";
226
  }
227
 
228
  function postRender() {
229
+ echo "</span>";
230
  }
231
 
232
  function render() {
531
  var $ezTran, $ezAdmin, $myPlugins;
532
  var $isPro, $strPro;
533
  var $options = array(), $ezOptions = array();
534
+ var $prefix;
535
 
536
  function __construct($slug, $name, $file) {
537
  $this->slug = $slug;
568
  }
569
  }
570
 
571
+ function mkDefaultOptions() {
572
+ $defaultOptions = array(
573
+ 'kill_invites' => false,
574
+ 'kill_rating' => false,
575
+ 'kill_author' => false);
576
+ return $defaultOptions;
577
+ }
578
+
579
+ function mkEzOptions() {
580
+ $this->ezOptions['kill_invites'] = new EzBaseOption('hidden', 'kill_invites');
581
+ $this->ezOptions['kill_rating'] = new EzBaseOption('hidden', 'kill_rating');
582
+
583
+ $o = new EzCheckBox('kill_author');
584
+ $o->title = __('If you find the author links and ads on the plugin admin page distracting or annoying, you can suppress them by checking this box. Please remember to save your options after checking.', 'easy-latex');
585
+ $o->desc = __('Kill author links on the admin page?', 'easy-latex');
586
+ $o->before = "<br /><b>";
587
+ $o->after = "</b><br />";
588
+ $this->ezOptions['kill_author'] = clone $o;
589
+ }
590
+
591
+ function resetOptions() {
592
+ $defaultOptions = $this->mkDefaultOptions();
593
+ update_option($this->optionName, $defaultOptions);
594
+ $this->options = $defaultOptions;
595
+ unset($_POST);
596
+ }
597
+
598
+ function cleanDB() {
599
+ if (!empty($this->prefix)) {
600
+ global $wpdb;
601
+ $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '$this->prefix%'");
602
+ }
603
+ }
604
+
605
+ function renderNonce() {
606
+ wp_nonce_field("$this->prefix-submit", "$this->prefix-nonce");
607
+ }
608
+
609
+ function renderSubmitButtons() {
610
+ $update = new EzSubmit('saveChanges');
611
+ $update->desc = __('Save Changes', 'easy-common');
612
+ $update->title = __('Save the changes as specified above', 'easy-common');
613
+ $update->tipTitle = $update->desc;
614
+
615
+ $reset = new EzSubmit('resetOptions');
616
+ $reset->desc = __('Reset Options', 'easy-common');
617
+ $reset->title = __('This <b>Reset Options</b> button discards all your changes and loads the default options. This is your only warning!', 'easy-common');
618
+ $reset->tipWarning = true;
619
+
620
+ $cleanDB = new EzSubmit('cleanDB');
621
+ $cleanDB->desc = __('Clean Database', 'easy-common');
622
+ $cleanDB->title = __('The <b>Database Cleanup</b> button discards all your AdSense settings you have saved so far for <b>all</b> the themes, including the current one. Use it only if you know that you will not be using these themes. Please be careful with all database operations -- keep a backup.', 'easy-common');
623
+ $cleanDB->tipWarning = true;
624
+
625
+ $uninstall = new EzSubmit('uninstall');
626
+ $uninstall->desc = __('Uninstall', 'easy-common');
627
+ $uninstall->title = __('The <b>Uninstall</b> button really kills %s after cleaning up all the options it wrote in your database. This is your only warning! Please be careful with all database operations -- keep a backup.', 'easy-common');
628
+ $uninstall->tipWarning = true;
629
+
630
+ $update->render();
631
+ $reset->render();
632
+ $cleanDB->render();
633
+ $uninstall->render();
634
+ }
635
+
636
  function handleSubmits() {
637
  if (empty($_POST)) {
638
  return;
639
  }
640
+ if (empty($this->prefix)) {
641
+ $this->adminMsg = "<div class='error'><p><strong>" .
642
+ __('Cannot handle submits without specifying plugin!', 'easy-common') .
643
+ "</strong></div>";
644
+ return;
645
+ }
646
+ if (!check_admin_referer("$this->prefix-submit", "$this->prefix-nonce")) {
647
+ return;
648
+ }
649
+
650
+ if (isset($_POST['saveChanges'])) {
651
+ $this->mkEzOptions();
652
+ $this->setOptionValues();
653
+
654
+ foreach ($this->ezOptions as $k => $o) {
655
+ if (isset($this->options[$k])) {
656
+ $this->options[$k] = $o->get();
657
+ }
658
+ else {
659
+ if (WP_DEBUG) {
660
+ echo "<div class='error'>Warning: <code>option[$k]</code> is not defined, but <code>ezOption[$k]</code> exists!</div>";
661
+ }
662
+ }
663
+ }
664
+
665
+ update_option($this->optionName, $this->options);
666
+
667
+ $this->adminMsg = "<div class='updated'><p><strong>" .
668
+ __('Settings Updated.', 'easy-common') .
669
+ "</strong></div>";
670
+ }
671
+ else if (isset($_POST['resetOptions'])) {
672
+ $this->resetOptions();
673
+ $this->adminMsg = "<div class='updated'><p><strong>" .
674
+ __('Ok, all your settings have been discarded!', 'easy-common') .
675
+ "</strong></div>";
676
+ }
677
+ else if (isset($_POST['cleanDB']) || isset($_POST['uninstall'])) {
678
+ $this->resetOptions();
679
+ $this->cleanDB($this->prefix);
680
+ $this->adminMsg = "<div class='updated'><p><strong>" .
681
+ __('Database has been cleaned. All your options for this plugin (for all themes) have been removed.', 'easy-common') .
682
+ "</strong></p> </div>";
683
+
684
+ if (isset($_POST['uninstall'])) {
685
+ remove_action('admin_menu', "{$this->prefix}_ap");
686
+ $this->adminMsg = "<div class='updated'><p><strong>" .
687
+ __('This plugin can be deactivated now. ', 'easy-common') .
688
+ "<a href='plugins.php'>" .
689
+ __('Go to Plugins', 'easy-common') .
690
+ "</a>.</strong></div>";
691
+ }
692
+ }
693
  }
694
 
695
  function setOptionValues() {
720
  return $this->ezAdmin;
721
  }
722
 
723
+ function info($hide = true) {
724
+ if (!function_exists('get_plugin_data')) {
725
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
726
+ }
727
+ $plugin_data = get_plugin_data($this->plgFile);
728
+ $str = "{$plugin_data['Name']} V{$plugin_data['Version']}";
729
+ if ($hide) {
730
+ $str = "<!-- $str -->";
731
+ }
732
+ return $str;
733
+ }
734
+
735
  function printAdminPage() {
736
  // if translating, print translation interface
737
  if ($this->ezTran->printAdminPage()) {
EzTran.php CHANGED
@@ -149,17 +149,21 @@ if (!class_exists("EzTran")) {
149
 
150
  class EzTran {
151
 
 
 
 
152
  var $status, $error, $plgName, $plgDir, $plgURL, $domain, $locale, $state,
153
- $isEmbedded = true, $isPro = false;
154
  var $adminMsg;
155
  var $helpers = array();
 
156
 
157
  function __construct($plgFile, $plgName, $domain = '') {
158
  if (!empty($_POST['ezt-savePot'])) {
159
  // saving cannot be done from handleSubmits
160
  // because it would be too late for the headers.
161
- $locale = $_POST['locale'];
162
- $file = "{$locale}.po";
163
  $potArray = unserialize(gzinflate(base64_decode($_POST['potArray'])));
164
  header('Content-Description: File Transfer');
165
  header('Content-Disposition: attachment; filename="' . $file . '"');
@@ -168,7 +172,7 @@ if (!class_exists("EzTran")) {
168
  header('Pragma: no-cache');
169
  ob_start();
170
  foreach ($potArray as $domain => $str) {
171
- $filePO = "{$locale}_$domain.po";
172
  echo "\n# Begin $filePO\n";
173
  print htmlspecialchars_decode($str, ENT_QUOTES);
174
  echo "# End $filePO\n\n";
@@ -193,12 +197,10 @@ if (!class_exists("EzTran")) {
193
  $this->plgURL = plugin_dir_url($plgFile);
194
  $locale = get_locale();
195
  $this->locale = str_replace('-', '_', $locale);
 
196
  if (!session_id()) {
197
  session_start();
198
  }
199
- if (empty($_SESSION[$this->domain])) {
200
- $_SESSION[$this->domain] = array();
201
- }
202
  }
203
 
204
  function EzTran($plgFile, $plgName = '', $domain = '') {
@@ -282,7 +284,7 @@ if (!class_exists("EzTran")) {
282
  function getTranPOs(&$contents) {
283
  $keys = $domains = array();
284
  self::getStrings($contents, $keys, $domains);
285
- $tl = substr($this->locale, 0, 2);
286
  global $l10n;
287
  $POs = array();
288
  foreach ($keys as $n => $k) {
@@ -322,7 +324,7 @@ if (!class_exists("EzTran")) {
322
  # Your Website: {$msg["blog"]}
323
  # Your URL: {$msg["url"]}
324
  # Your Locale: {$msg["locale"]}
325
- # Your Language: {$msg["lang"]}
326
  #, fuzzy
327
  msgid ""
328
  msgstr ""
@@ -355,6 +357,63 @@ EOF;
355
  }
356
  }
357
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  function handleSubmits() {
359
  $adminNeeded = false;
360
  if (empty($_POST)) {
@@ -370,6 +429,14 @@ EOF;
370
  $adminNeeded = true;
371
  if (isset($_POST['ezt-translate'])) {
372
  $_POST['eztran'] = 'eztran';
 
 
 
 
 
 
 
 
373
  return $adminNeeded;
374
  }
375
  if (!isset($_POST['eztran'])) {
@@ -380,13 +447,13 @@ EOF;
380
  }
381
  if (isset($_POST['ezt-clear'])) {
382
  $this->status = '<div class="updated">Reloaded the translations from PHP files and MO.</div> ';
383
- unset($_SESSION[$this->domain]['ezt-POs']);
384
- $this->setLang();
 
385
  return $adminNeeded;
386
  }
387
  if (!empty($_POST['ezt-mailPot'])) {
388
  if ($this->isEmbedded || $this->isPro) {
389
-
390
  $locale = $_POST['locale'];
391
  $file = "{$locale}.po";
392
  $potArray = unserialize(gzinflate(base64_decode($_POST['potArray'])));
@@ -464,7 +531,6 @@ EOF;
464
  wp_nonce_field('ezTranSubmit', 'ezTranNonce');
465
  echo "<input type='hidden' name='eztran' value='eztran'>";
466
  $locale = $this->locale;
467
- $made = isset($_POST['ezt-make']);
468
  echo "\n<script type='text/javascript' src='{$this->plgURL}/wz_tooltip.js'></script>\n";
469
  if ($this->isEmbedded) {
470
  echo "<h2>Translation Interface for {$this->plgName}</h2>";
@@ -473,29 +539,33 @@ EOF;
473
  echo "<h2>Translating {$this->plgName} using Easy Translator</h2>";
474
  }
475
 
476
- if (isset($_SESSION[$this->domain]['ezt-POs'])) {
477
  if (empty($this->status)) {
478
  $this->status = '<div class="updated">Continuing from your last translation session. Click on "Reload Translation" if you would like to start from scratch.</div> ';
479
  }
480
- $POs = $_SESSION[$this->domain]['ezt-POs'];
 
481
  }
482
  else {
483
  $s = $this->getFileContents();
484
  $POs = $this->getTranPOs($s);
485
 
486
  // cache the POs
487
- $_SESSION[$this->domain]['ezt-POs'] = $POs;
 
488
  }
489
 
490
- if ($made) {
491
  $potArray = $this->mkPotStr($POs, $_POST);
492
  $pot = '';
493
  foreach ($potArray as $p) {
494
  $pot .= htmlspecialchars($p, ENT_QUOTES);
495
  }
496
  $this->updatePot($POs, $_POST);
497
- // cache the updated POs
498
- $_SESSION[$this->domain]['ezt-POs'] = $POs;
 
 
499
  }
500
  else {
501
  global $current_user;
@@ -517,10 +587,12 @@ EOF;
517
  get_bloginfo('url') . '" />' . "\n<br />";
518
  $pot .= '<div style="width: 15%; float:left">Your Locale:</div>' .
519
  '<input type="text" style="width: 30%" name="locale" value="' .
520
- $locale . '" /><br />' . "\n";
 
521
  $pot .= '<div style="width: 15%; float:left">Your Language:</div>' .
522
- '<input type="text" style="width: 30%" name="lang" value="' .
523
- get_bloginfo('language') . '" /><br />' . "\n";
 
524
  $pot .= '<div style="width: 15%; float:left">Character Set:</div>' .
525
  '<input type="text" style="width: 30%" name="charset" value="' .
526
  get_bloginfo('charset') . '" />' . "\n<br /><br />";
@@ -546,16 +618,17 @@ EOF;
546
  $pot .= "<div class='error'>No translatable strings found for the plugin {$this->plgName}. Although the translation interface is ready, the plugin author has not yet internationalized this plugin.</div>";
547
  }
548
  }
 
549
  $makeStr = '<div class="submit">
550
  <input type="submit" name="ezt-make" value="Display &amp; Save POT File" title="Make a POT file with the translation strings below and display it" />&nbsp;
551
- <input type="submit" name="ezt-clear" value="Reload Translation" title="Discard your changes and reload the translation" onclick="return confirm(\'Are you sure you want to discard your changes?\nThe page will take a few minutes to reload because we will be querying Google for translations for each translatable string in the plugin files.\nPlease be patient.\');" />&nbsp;
552
  </div>' . $this->status . $this->error;
553
  $saveStr = '<div class="submit">
554
  <input type="submit" name="ezt-savePot" value="Save POT file" title="Saves the strings shown below to your PC as a POT file" />&nbsp;
555
  <input type="submit" name="ezt-mailPot" value="Mail POT file" title="Email the translation to the plugin autor" onClick="return confirm(\'Are you sure you want to email the author?\');" />&nbsp;
556
  <input type="submit" name="ezt-editMore" value="Edit More" title="If you are not happy with the strings, edit it further"/>
557
  </div>' . $this->status . $this->error;
558
- if ($made) {
559
  echo "<div style='background-color:#eef;border: solid 1px #005;padding:5px'>If you are happy with the POT file as below, please save it or email it to the author. If not, edit it further. $backButton</div>";
560
  $this->status = '<div class="updated">Ready to email the POT file to the author. Click on "Mail POT file" to send it.</div> ';
561
  $b64 = base64_encode(gzdeflate(serialize($potArray)));
@@ -595,8 +668,95 @@ EOF1;
595
  $invite = "<span style='color:red'> Would you like to see <b>$plgName</b> in your langugage (<b>$locale</b>)?&nbsp; <input type='submit' name='ezt-translate' onmouseover=\"Tip('$tip', WIDTH, 350, TITLE, 'How to Translate?', STICKY, 1, CLOSEBTN, true, CLICKCLOSE, true, FIX, [this, 0, 5])\" onmouseout=\"UnTip()\" value ='Please help translate ' /></span>";
596
  }
597
  else if ($this->state == "English") {
598
- $tip = htmlentities("If you would like to improve this translation, please use the translation interface. It picks up the translatable strings in <b>$plgName</b> and presents them and their existing translations in <b>$locale</b> in an easy-to-edit form. You can then generate a translation file and email it to the author all from the same form. Slick, isn\'t it? $patience");
599
- $invite = "If you speak another language, please help translate this plugin. Select a language: <select id='><option value=af>Afrikaans</option><option value=sq>Albanian</option><option value=ar>Arabic</option><option value=hy>Armenian</option><option value=az>Azerbaijani</option><option value=eu>Basque</option><option value=be>Belarusian</option><option value=bn>Bengali</option><option value=bs>Bosnian</option><option value=bg>Bulgarian</option><option value=ca>Catalan</option><option value=ceb>Cebuano</option><option value=zh-CN>Chinese</option><option value=hr>Croatian</option><option value=cs>Czech</option><option value=da>Danish</option><option value=nl>Dutch</option><option SELECTED value=en>English</option><option value=eo>Esperanto</option><option value=et>Estonian</option><option value=tl>Filipino</option><option value=fi>Finnish</option><option value=fr>French</option><option value=gl>Galician</option><option value=ka>Georgian</option><option value=de>German</option><option value=el>Greek</option><option value=gu>Gujarati</option><option value=ht>Haitian Creole</option><option value=ha>Hausa</option><option value=iw>Hebrew</option><option value=hi>Hindi</option><option value=hmn>Hmong</option><option value=hu>Hungarian</option><option value=is>Icelandic</option><option value=ig>Igbo</option><option value=id>Indonesian</option><option value=ga>Irish</option><option value=it>Italian</option><option value=ja>Japanese</option><option value=jw>Javanese</option><option value=kn>Kannada</option><option value=km>Khmer</option><option value=ko>Korean</option><option value=lo>Lao</option><option value=la>Latin</option><option value=lv>Latvian</option><option value=lt>Lithuanian</option><option value=mk>Macedonian</option><option value=ms>Malay</option><option value=mt>Maltese</option><option value=mi>Maori</option><option value=mr>Marathi</option><option value=mn>Mongolian</option><option value=ne>Nepali</option><option value=no>Norwegian</option><option value=fa>Persian</option><option value=pl>Polish</option><option value=pt>Portuguese</option><option value=pa>Punjabi</option><option value=ro>Romanian</option><option value=ru>Russian</option><option value=sr>Serbian</option><option value=sk>Slovak</option><option value=sl>Slovenian</option><option value=so>Somali</option><option value=es>Spanish</option><option value=sw>Swahili</option><option value=sv>Swedish</option><option value=ta>Tamil</option><option value=te>Telugu</option><option value=th>Thai</option><option value=tr>Turkish</option><option value=uk>Ukrainian</option><option value=ur>Urdu</option><option value=vi>Vietnamese</option><option value=cy>Welsh</option><option value=yi>Yiddish</option><option value=yo>Yoruba</option><option value=zu>Zulu</option></select>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
600
  }
601
  else {
602
  $tip = htmlentities("If you would like to improve this translation, please use the translation interface. It picks up the translatable strings in <b>$plgName</b> and presents them and their existing translations in <b>$locale</b> in an easy-to-edit form. You can then generate a translation file and email it to the author all from the same form. Slick, isn\'t it? $patience");
@@ -605,8 +765,14 @@ EOF1;
605
  return $invite;
606
  }
607
 
608
- function loadTran($helper = '', $domain = '') {
609
  $locale = '';
 
 
 
 
 
 
610
  if (empty($helper)) {
611
  $moDir = "{$this->plgDir}/lang";
612
  }
@@ -615,38 +781,45 @@ EOF1;
615
  }
616
  if (empty($domain)) {
617
  $domain = $this->domain;
618
- $moFile = "$moDir/{$this->locale}.mo";
619
  }
620
  else {
621
- $moFile = "$moDir/{$this->locale}_{$domain}.mo";
622
  }
 
623
  if (file_exists($moFile) && is_readable($moFile)) {
624
- load_textdomain($domain, $moFile);
625
- $locale = basename(dirname($moFile));
626
  }
627
  else {
628
  // look for any other similar locale with the same first two characters
629
- $lo = substr($this->locale, 0, 2);
630
- $pattern = str_replace($this->locale, "$lo*", $moFile);
631
  $moFiles = glob($pattern);
632
  if (!empty($moFiles)) {
633
  $moFile = $moFiles[0];
634
- load_textdomain($domain, $moFile);
635
- $locale = basename(dirname($moFile));
 
 
 
 
 
636
  }
637
  }
638
  return $locale;
639
  }
640
 
641
- function setLang() {
642
- $locale = $this->locale;
 
 
643
  $this->helpers = array('' => 'easy-common', 'easy-adsense' => 'easy-common');
644
- $lo = substr($locale, 0, 2);
645
  if ($lo != 'en') {
646
- $locale = $this->loadTran();
647
  // Append translations in the helpers
648
  foreach ($this->helpers as $helper => $domain) {
649
- $this->loadTran($helper, $domain);
650
  }
651
  if (empty($locale)) {
652
  $this->state = "Not Translated";
@@ -656,19 +829,17 @@ EOF1;
656
  }
657
  else {
658
  $this->state = "Alternate MO";
 
659
  }
660
  }
661
  else {
662
  // TODO: Ask English speakers to help translate to their second lang
663
  $this->state = "English";
664
  }
665
- return $locale;
666
  }
667
 
668
  function renderTranslator() {
669
- if ($this->state == "English") {
670
- return;
671
- }
672
  echo "<br />\n";
673
  echo "<br />\n";
674
  echo '<div style="background-color:#ddd;padding:5px;border: solid 1px;margin:5px;">';
149
 
150
  class EzTran {
151
 
152
+ // locale is the blog-locale or the language explicity loaded
153
+ // target is the language target for the translation. defaults to locale.
154
+
155
  var $status, $error, $plgName, $plgDir, $plgURL, $domain, $locale, $state,
156
+ $isEmbedded = true, $isPro = false, $target, $POs;
157
  var $adminMsg;
158
  var $helpers = array();
159
+ var $sessionVars = array('POs', 'ezt-locale', 'ezt-target');
160
 
161
  function __construct($plgFile, $plgName, $domain = '') {
162
  if (!empty($_POST['ezt-savePot'])) {
163
  // saving cannot be done from handleSubmits
164
  // because it would be too late for the headers.
165
+ $target = $_POST['ezt-target'];
166
+ $file = "{$target}.po";
167
  $potArray = unserialize(gzinflate(base64_decode($_POST['potArray'])));
168
  header('Content-Description: File Transfer');
169
  header('Content-Disposition: attachment; filename="' . $file . '"');
172
  header('Pragma: no-cache');
173
  ob_start();
174
  foreach ($potArray as $domain => $str) {
175
+ $filePO = "{$target}_$domain.po";
176
  echo "\n# Begin $filePO\n";
177
  print htmlspecialchars_decode($str, ENT_QUOTES);
178
  echo "# End $filePO\n\n";
197
  $this->plgURL = plugin_dir_url($plgFile);
198
  $locale = get_locale();
199
  $this->locale = str_replace('-', '_', $locale);
200
+ $this->target = $this->locale;
201
  if (!session_id()) {
202
  session_start();
203
  }
 
 
 
204
  }
205
 
206
  function EzTran($plgFile, $plgName = '', $domain = '') {
284
  function getTranPOs(&$contents) {
285
  $keys = $domains = array();
286
  self::getStrings($contents, $keys, $domains);
287
+ $tl = substr($this->target, 0, 2);
288
  global $l10n;
289
  $POs = array();
290
  foreach ($keys as $n => $k) {
324
  # Your Website: {$msg["blog"]}
325
  # Your URL: {$msg["url"]}
326
  # Your Locale: {$msg["locale"]}
327
+ # Your Language: {$msg["ezt-target"]}
328
  #, fuzzy
329
  msgid ""
330
  msgstr ""
357
  }
358
  }
359
 
360
+ function putSessionVars($var = array()) {
361
+ if (empty($var)) {
362
+ $var = $this->sessionVars;
363
+ }
364
+ if (!is_array($var)) {
365
+ $var = array($var);
366
+ }
367
+ if (empty($_SESSION[$this->domain])) {
368
+ $_SESSION[$this->domain] = array();
369
+ }
370
+ foreach ($var as $v) {
371
+ $prop = str_replace("ezt-", "", $v);
372
+ if (isset($this->$prop)) {
373
+ $_SESSION[$this->domain][$v] = $this->$prop;
374
+ }
375
+ }
376
+ }
377
+
378
+ function getSessionVars($var = array()) {
379
+ if (empty($var)) {
380
+ $var = $this->sessionVars;
381
+ }
382
+ if (!is_array($var)) {
383
+ $var = array($var);
384
+ }
385
+ foreach ($var as $v) {
386
+ $prop = str_replace("ezt-", "", $v);
387
+ if (isset($_SESSION[$this->domain][$v])) {
388
+ $this->$prop = $_SESSION[$this->domain][$v];
389
+ }
390
+ }
391
+ }
392
+
393
+ function rmSessionVars($var = array()) {
394
+ if (empty($var)) {
395
+ $var = $this->sessionVars;
396
+ }
397
+ if (!is_array($var)) {
398
+ $var = array($var);
399
+ }
400
+ foreach ($var as $v) {
401
+ unset($_SESSION[$this->domain][$v]);
402
+ $prop = str_replace("ezt-", "", $v);
403
+ $this->$prop = '';
404
+ }
405
+ }
406
+
407
+ function isCached() {
408
+ $cached = !empty($_SESSION[$this->domain]);
409
+ if ($cached) {
410
+ foreach ($this->sessionVars as $v) {
411
+ $cached = $cached && !empty($_SESSION[$this->domain][$v]);
412
+ }
413
+ }
414
+ return $cached;
415
+ }
416
+
417
  function handleSubmits() {
418
  $adminNeeded = false;
419
  if (empty($_POST)) {
429
  $adminNeeded = true;
430
  if (isset($_POST['ezt-translate'])) {
431
  $_POST['eztran'] = 'eztran';
432
+ if (isset($_POST['ezt-createpo'])) {
433
+ $this->getSessionVars();
434
+ if ($this->target != $_POST['ezt-createpo']) {
435
+ $this->rmSessionVars();
436
+ $this->target = $_POST['ezt-createpo'];
437
+ $this->setLang($this->target);
438
+ }
439
+ }
440
  return $adminNeeded;
441
  }
442
  if (!isset($_POST['eztran'])) {
447
  }
448
  if (isset($_POST['ezt-clear'])) {
449
  $this->status = '<div class="updated">Reloaded the translations from PHP files and MO.</div> ';
450
+ $_SESSION[$this->domain] = array();
451
+ $this->target = $_POST['ezt-target'];
452
+ $this->setLang($this->target);
453
  return $adminNeeded;
454
  }
455
  if (!empty($_POST['ezt-mailPot'])) {
456
  if ($this->isEmbedded || $this->isPro) {
 
457
  $locale = $_POST['locale'];
458
  $file = "{$locale}.po";
459
  $potArray = unserialize(gzinflate(base64_decode($_POST['potArray'])));
531
  wp_nonce_field('ezTranSubmit', 'ezTranNonce');
532
  echo "<input type='hidden' name='eztran' value='eztran'>";
533
  $locale = $this->locale;
 
534
  echo "\n<script type='text/javascript' src='{$this->plgURL}/wz_tooltip.js'></script>\n";
535
  if ($this->isEmbedded) {
536
  echo "<h2>Translation Interface for {$this->plgName}</h2>";
539
  echo "<h2>Translating {$this->plgName} using Easy Translator</h2>";
540
  }
541
 
542
+ if ($this->isCached()) {
543
  if (empty($this->status)) {
544
  $this->status = '<div class="updated">Continuing from your last translation session. Click on "Reload Translation" if you would like to start from scratch.</div> ';
545
  }
546
+ $this->getSessionVars();
547
+ $POs = $this->POs;
548
  }
549
  else {
550
  $s = $this->getFileContents();
551
  $POs = $this->getTranPOs($s);
552
 
553
  // cache the POs
554
+ $this->POs = $POs;
555
+ $this->putSessionVars();
556
  }
557
 
558
+ if (isset($_POST['ezt-make'])) {
559
  $potArray = $this->mkPotStr($POs, $_POST);
560
  $pot = '';
561
  foreach ($potArray as $p) {
562
  $pot .= htmlspecialchars($p, ENT_QUOTES);
563
  }
564
  $this->updatePot($POs, $_POST);
565
+
566
+ // cache the POs
567
+ $this->POs = $POs;
568
+ $this->putSessionVars();
569
  }
570
  else {
571
  global $current_user;
587
  get_bloginfo('url') . '" />' . "\n<br />";
588
  $pot .= '<div style="width: 15%; float:left">Your Locale:</div>' .
589
  '<input type="text" style="width: 30%" name="locale" value="' .
590
+ $locale . '" readonly /><br />' . "\n";
591
+ $tip = "Enter the language code for your translation (used for machine translation seed by Google). It should be of the form <code>fr_FR</code>, for instance. The first two letters are for the language (and needed for Google translation), the last two are for the country, and not used by this translator.";
592
  $pot .= '<div style="width: 15%; float:left">Your Language:</div>' .
593
+ '<input type="text" style="width: 30%" name="ezt-target" value="' .
594
+ $this->target . '" onmouseover = "Tip(\'' . $tip . '\',WIDTH, 300)"'
595
+ . ' onmouseout="UnTip()" /><br />' . "\n";
596
  $pot .= '<div style="width: 15%; float:left">Character Set:</div>' .
597
  '<input type="text" style="width: 30%" name="charset" value="' .
598
  get_bloginfo('charset') . '" />' . "\n<br /><br />";
618
  $pot .= "<div class='error'>No translatable strings found for the plugin {$this->plgName}. Although the translation interface is ready, the plugin author has not yet internationalized this plugin.</div>";
619
  }
620
  }
621
+ $tip = "This plugin caches your inputs so that you restart from where you left off. If you would like to discard the cache and start from scratch, please click this button.";
622
  $makeStr = '<div class="submit">
623
  <input type="submit" name="ezt-make" value="Display &amp; Save POT File" title="Make a POT file with the translation strings below and display it" />&nbsp;
624
+ <input type="submit" name="ezt-clear" value="Reload Translation" title="Discard your changes and reload the translation" onmouseover = "Tip(\'' . $tip . '\',WIDTH, 300)" onmouseout="UnTip()" onclick="return confirm(\'Are you sure you want to discard your changes?\nThe page will take a few minutes to reload because we will be querying Google for translations for each translatable string in the plugin files.\nPlease be patient.\');" />&nbsp;
625
  </div>' . $this->status . $this->error;
626
  $saveStr = '<div class="submit">
627
  <input type="submit" name="ezt-savePot" value="Save POT file" title="Saves the strings shown below to your PC as a POT file" />&nbsp;
628
  <input type="submit" name="ezt-mailPot" value="Mail POT file" title="Email the translation to the plugin autor" onClick="return confirm(\'Are you sure you want to email the author?\');" />&nbsp;
629
  <input type="submit" name="ezt-editMore" value="Edit More" title="If you are not happy with the strings, edit it further"/>
630
  </div>' . $this->status . $this->error;
631
+ if (isset($_POST['ezt-make'])) {
632
  echo "<div style='background-color:#eef;border: solid 1px #005;padding:5px'>If you are happy with the POT file as below, please save it or email it to the author. If not, edit it further. $backButton</div>";
633
  $this->status = '<div class="updated">Ready to email the POT file to the author. Click on "Mail POT file" to send it.</div> ';
634
  $b64 = base64_encode(gzdeflate(serialize($potArray)));
668
  $invite = "<span style='color:red'> Would you like to see <b>$plgName</b> in your langugage (<b>$locale</b>)?&nbsp; <input type='submit' name='ezt-translate' onmouseover=\"Tip('$tip', WIDTH, 350, TITLE, 'How to Translate?', STICKY, 1, CLOSEBTN, true, CLICKCLOSE, true, FIX, [this, 0, 5])\" onmouseout=\"UnTip()\" value ='Please help translate ' /></span>";
669
  }
670
  else if ($this->state == "English") {
671
+ $tip = htmlentities("If you would like to translate this plugin into a language you know or speak, please use the translation interface. It picks up the translatable strings in <b>$plgName</b> and presents them and their existing translations in your chosen language in an easy-to-edit form. You can then generate a translation file and email it to the author all from the same form. $patience");
672
+ $langs = array('af_AF' => 'Afrikaans',
673
+ 'sq_SQ' => 'Albanian',
674
+ 'ar_AR' => 'Arabic',
675
+ 'hy_HY' => 'Armenian',
676
+ 'az_AZ' => 'Azerbaijani',
677
+ 'eu_EU' => 'Basque',
678
+ 'be_BE' => 'Belarusian',
679
+ 'bn_BN' => 'Bengali',
680
+ 'bs_BS' => 'Bosnian',
681
+ 'bg_BG' => 'Bulgarian',
682
+ 'ca_CA' => 'Catalan',
683
+ 'zh-CN' => 'Chinese',
684
+ 'hr_HR' => 'Croatian',
685
+ 'cs_CS' => 'Czech',
686
+ 'da_DA' => 'Danish',
687
+ 'nl_NL' => 'Dutch',
688
+ 'eo_EO' => 'Esperanto',
689
+ 'et_ET' => 'Estonian',
690
+ 'tl_TL' => 'Filipino',
691
+ 'fi_FI' => 'Finnish',
692
+ 'fr_FR' => 'French',
693
+ 'gl_GL' => 'Galician',
694
+ 'ka_KA' => 'Georgian',
695
+ 'de_DE' => 'German',
696
+ 'el_EL' => 'Greek',
697
+ 'gu_GU' => 'Gujarati',
698
+ 'ht_HT' => 'Haitian Creole',
699
+ 'ha_HA' => 'Hausa',
700
+ 'iw_IW' => 'Hebrew',
701
+ 'hi_HI' => 'Hindi',
702
+ 'hu_HU' => 'Hungarian',
703
+ 'is_IS' => 'Icelandic',
704
+ 'ig_IG' => 'Igbo',
705
+ 'id_ID' => 'Indonesian',
706
+ 'ga_GA' => 'Irish',
707
+ 'it_IT' => 'Italian',
708
+ 'ja_JA' => 'Japanese',
709
+ 'jw_JW' => 'Javanese',
710
+ 'kn_KN' => 'Kannada',
711
+ 'km_KM' => 'Khmer',
712
+ 'ko_KO' => 'Korean',
713
+ 'lo_LO' => 'Lao',
714
+ 'la_LA' => 'Latin',
715
+ 'lv_LV' => 'Latvian',
716
+ 'lt_LT' => 'Lithuanian',
717
+ 'mk_MK' => 'Macedonian',
718
+ 'ms_MS' => 'Malay',
719
+ 'mt_MT' => 'Maltese',
720
+ 'mi_MI' => 'Maori',
721
+ 'mr_MR' => 'Marathi',
722
+ 'mn_MN' => 'Mongolian',
723
+ 'ne_NE' => 'Nepali',
724
+ 'no_NO' => 'Norwegian',
725
+ 'fa_FA' => 'Persian',
726
+ 'pl_PL' => 'Polish',
727
+ 'pt_PT' => 'Portuguese',
728
+ 'pa_PA' => 'Punjabi',
729
+ 'ro_RO' => 'Romanian',
730
+ 'ru_RU' => 'Russian',
731
+ 'sr_SR' => 'Serbian',
732
+ 'sk_SK' => 'Slovak',
733
+ 'sl_SL' => 'Slovenian',
734
+ 'so_SO' => 'Somali',
735
+ 'es_ES' => 'Spanish',
736
+ 'sw_SW' => 'Swahili',
737
+ 'sv_SV' => 'Swedish',
738
+ 'ta_TA' => 'Tamil',
739
+ 'te_TE' => 'Telugu',
740
+ 'th_TH' => 'Thai',
741
+ 'tr_TR' => 'Turkish',
742
+ 'uk_UK' => 'Ukrainian',
743
+ 'ur_UR' => 'Urdu',
744
+ 'vi_VI' => 'Vietnamese',
745
+ 'cy_CY' => 'Welsh',
746
+ 'yi_YI' => 'Yiddish',
747
+ 'yo_YO' => 'Yoruba',
748
+ 'zu_ZU' => 'Zulu');
749
+ $langOptions = '';
750
+ foreach ($langs as $k => $v) {
751
+ if ($this->target == $k) {
752
+ $selected = "selected='selected'";
753
+ }
754
+ else {
755
+ $selected = '';
756
+ }
757
+ $langOptions .= "<option value='$k' $selected>$v</option>\n";
758
+ }
759
+ $invite = "If you speak another language, please help translate this plugin. Select a language: <select name='ezt-createpo'>$langOptions</select>&nbsp; <input type='submit' name='ezt-translate' onmouseover=\"Tip('$tip', WIDTH, 350, TITLE, 'How to Translate?', STICKY, 1, CLOSEBTN, true, CLICKCLOSE, true, FIX, [this, 0, 5])\" onmouseout=\"UnTip()\" value ='Please help translate ' />";
760
  }
761
  else {
762
  $tip = htmlentities("If you would like to improve this translation, please use the translation interface. It picks up the translatable strings in <b>$plgName</b> and presents them and their existing translations in <b>$locale</b> in an easy-to-edit form. You can then generate a translation file and email it to the author all from the same form. Slick, isn\'t it? $patience");
765
  return $invite;
766
  }
767
 
768
+ function loadTran($target = '', $helper = '', $domain = '') {
769
  $locale = '';
770
+ if (empty($target)) {
771
+ $target = $this->target;
772
+ }
773
+ if (empty($target)) {
774
+ $target = $this->locale;
775
+ }
776
  if (empty($helper)) {
777
  $moDir = "{$this->plgDir}/lang";
778
  }
781
  }
782
  if (empty($domain)) {
783
  $domain = $this->domain;
784
+ $moFile = "$moDir/{$target}.mo";
785
  }
786
  else {
787
+ $moFile = "$moDir/{$target}_{$domain}.mo";
788
  }
789
+ $foundMO = false;
790
  if (file_exists($moFile) && is_readable($moFile)) {
791
+ $foundMO = true;
 
792
  }
793
  else {
794
  // look for any other similar locale with the same first two characters
795
+ $lo = substr($target, 0, 2);
796
+ $pattern = str_replace($target, "$lo*", $moFile);
797
  $moFiles = glob($pattern);
798
  if (!empty($moFiles)) {
799
  $moFile = $moFiles[0];
800
+ $foundMO = true;
801
+ }
802
+ }
803
+ if ($foundMO) {
804
+ load_textdomain($domain, $moFile);
805
+ if ($this->isEmbedded) {
806
+ $locale = substr(basename($moFile), 0, 5);
807
  }
808
  }
809
  return $locale;
810
  }
811
 
812
+ function setLang($target = '') {
813
+ if (empty($target)) {
814
+ $target = $this->target;
815
+ }
816
  $this->helpers = array('' => 'easy-common', 'easy-adsense' => 'easy-common');
817
+ $lo = substr($target, 0, 2);
818
  if ($lo != 'en') {
819
+ $locale = $this->loadTran($target);
820
  // Append translations in the helpers
821
  foreach ($this->helpers as $helper => $domain) {
822
+ $this->loadTran($target, $helper, $domain);
823
  }
824
  if (empty($locale)) {
825
  $this->state = "Not Translated";
829
  }
830
  else {
831
  $this->state = "Alternate MO";
832
+ $this->locale = $locale;
833
  }
834
  }
835
  else {
836
  // TODO: Ask English speakers to help translate to their second lang
837
  $this->state = "English";
838
  }
 
839
  }
840
 
841
  function renderTranslator() {
842
+ $this->getSessionVars();
 
 
843
  echo "<br />\n";
844
  echo "<br />\n";
845
  echo '<div style="background-color:#ddd;padding:5px;border: solid 1px;margin:5px;">';
admin.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  /*
4
  Copyright (C) 2008 www.ads-ez.com
5
 
@@ -22,291 +21,261 @@ echo '<script type="text/javascript" src="' . $this->plgURL . '/wz_tooltip.js"><
22
  $this->mkEzOptions();
23
  $this->setOptionValues();
24
  $this->mkHelpTags();
25
- echo <<<EOF1
26
- <div class="wrap" id="wrapper" style="width:1000px">
27
- <h2 title="{$this->options['info']}">Easy AdSense Setup</h2>
28
- EOF1;
29
  ?>
30
- <table class="form-table">
31
- <tr style="vertical-align:middle">
32
- <td style="width:40%">
33
- <h3>
34
- <?php
35
- _e('Instructions', 'easy-adsenser');
36
- echo "</h3>\n<ul style='padding-left:10px;list-style-type:circle; list-style-position:inside;'>\n";
37
- foreach ($this->helpTags as $help) {
38
- echo "<li>";
39
- $help->render();
40
- echo "</li>\n";
41
- }
42
- ?>
43
- </ul>
44
- </td>
45
- <?php
46
- include ($this->plgDir . '/head-text.php');
47
- ?>
48
- </tr></table>
49
- <form method='post' action='#'>
50
- <?php
51
- if (empty($this->options['kill_rating'])) {
52
- $ez->renderRating();
53
- }
54
- if (empty($this->options['kill_invites'])) {
55
- $ez->renderInvite();
56
- }
57
- wp_nonce_field('EzAdsenseSubmit', 'EzAdsenseNonce');
58
- ?>
59
- <br />
60
- <table>
61
- <tr><td><h3>
62
  <?php
63
- printf(__('Options (for the %s theme)', 'easy-adsenser'), get_option('stylesheet'));
 
 
 
 
 
 
64
  ?>
65
- </h3></td></tr>
66
- </table>
67
- <table style='width:100%'>
68
- <tr>
69
- <td style='width:50%;height:50px'>
70
- <table class='form-table'>
71
- <tr>
72
- <td style='width:50%;height:40px'>
73
- <?php
74
- echo "<b><u>";
75
- _e('Ad Blocks in Your Posts', 'easy-adsenser');
76
- echo "</u></b><br />";
77
- _e('[Appears in your posts and pages]', 'easy-adsenser');
78
- ?>
79
- </td>
80
- </tr>
81
- </table>
82
- </td>
83
- <td style='width:50%;height:50px'>
84
- <table class='form-table'>
85
- <tr>
86
- <td style='width:50%;height:40px'>
87
- <?php
88
- echo "<b><u>";
89
- _e('Widgets for Your Sidebars', 'easy-adsenser');
90
- ?>
91
- </u></b><br />
92
- <?php
93
- _e('[See <a href="widgets.php"> Appearance (or Design) &rarr; Widgets</a>]', 'easy-adsenser');
94
- ?>
95
- </td>
96
- </tr>
97
- </table>
98
  </td>
99
- </tr>
100
- </table>
101
-
102
- <table style='width:100%'>
103
- <tr style='vertical-align:top'>
104
- <td style='width:50%'>
105
- <table class='form-table'>
106
- <tr style='vertical-align:top'>
107
- <td style='width:50%;height:220px;vertical-align:middle'>
108
- <?php
109
- $this->ezOptions['text_leadin']->render();
110
- echo "<b><span style='display:inline-block;width:30%'>";
111
- _e('Ad Alignment', 'easy-adsenser');
112
- echo "</span></b>"
113
- . "<span style='display:inline-block;width:40%'>";
114
- $this->ezOptions['wc_leadin']->render();
115
- echo "</span>";
116
- $this->ezOptions['margin_leadin']->render();
117
- $this->ezOptions['header_leadin']->render();
118
- echo "&nbsp;";
119
- $this->ezOptions['show_leadin']->render();
120
- ?>
121
- <br />
122
- </td>
123
- </tr>
124
- <tr style='vertical-align:top'>
125
- <td style='width:50%;height:220px;vertical-align:middle'>
126
- <?php
127
- $this->ezOptions['text_midtext']->render();
128
- echo "<b><span style='display:inline-block;width:30%'>";
129
- _e('Ad Alignment', 'easy-adsenser');
130
- echo "</span></b>"
131
- . "<span style='display:inline-block;width:40%'>";
132
- $this->ezOptions['wc_midtext']->render();
133
- echo "</span>";
134
- $this->ezOptions['margin_midtext']->render();
135
- $this->ezOptions['force_midad']->render();
136
- echo "&nbsp;";
137
- $this->ezOptions['show_midtext']->render();
138
- ?>
139
- <br />
140
- </td>
141
- </tr>
142
- <tr style='vertical-align:top'>
143
- <td style='width:50%;height:250px;vertical-align:middle'>
144
- <?php
145
- $this->ezOptions['text_leadout']->render();
146
- echo "<b><span style='display:inline-block;width:30%'>";
147
- _e('Ad Alignment', 'easy-adsenser');
148
- echo "</span></b>"
149
- . "<span style='display:inline-block;width:40%'>";
150
- $this->ezOptions['wc_leadout']->render();
151
- echo "</span>";
152
- $this->ezOptions['margin_leadout']->render();
153
- $this->ezOptions['footer_leadout']->render();
154
- echo "&nbsp;";
155
- $this->ezOptions['show_leadout']->render();
156
- ?>
157
- </td>
158
- </tr>
159
- </table>
160
-
161
- <table class='form-table'>
162
- <tr style='vertical-align:top'>
163
- <td style='width:50%;height:250px;vertical-align:middle'>
164
- <?php
165
- $this->ezOptions['max_count']->render();
166
- echo "<br style='line-height: 5px;' /><b>";
167
- _e('Suppress AdSense Ad Blocks on:', 'easy-adsenser');
168
- echo "</b>";
169
- foreach ($this->kills as $k) {
170
- $this->ezOptions["kill_$k"]->render();
171
- }
172
- ?>
173
- <br style='line-height: 5px;' />
174
-
175
- <b><?php _e('Other Options', 'easy-adsenser'); ?></b><br />
176
 
177
- <?php
178
- $this->ezOptions['force_widget']->render();
179
- $this->ezOptions['show_borders']->render();
180
- $this->ezOptions['border_widget']->render();
181
- $this->ezOptions['border_lu']->render();
182
- echo "<span style='display:inline-block;width:20px'> </span>";
183
- $this->ezOptions['border_width']->render();
184
- $this->ezOptions['border_normal']->render();
185
- $this->ezOptions['border_color']->render();
186
- $this->ezOptions['kill_inline']->render();
187
- $this->ezOptions['kill_linebreaks']->render();
188
- ?>
189
- </td>
190
- </tr>
191
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
- </td>
194
- <td style='width:50%'>
 
 
 
 
 
 
 
 
 
 
 
195
 
196
- <table class='form-table'>
197
- <tr style='vertical-align:top'>
198
- <td style='width:50%;height:220px;vertical-align:middle'>
199
- <?php
200
- $this->ezOptions['text_widget']->render();
201
- ?>
202
- <span style='display:inline-block;width:70%'><b><?php _e('Ad Alignment', 'easy-adsenser'); ?></b>&nbsp;<?php _e('(Where to show?)', 'easy-adsenser'); ?></span>
203
- <?php
204
- $this->ezOptions['margin_widget']->render();
205
- $this->ezOptions['show_widget']->render();
206
- $this->ezOptions['title_widget']->render();
207
- $this->ezOptions['kill_widget_title']->render();
208
- ?>
209
- </td>
210
- </tr>
211
- <tr style='vertical-align:top'>
212
- <td style='width:50%;height:220px;vertical-align:middle'>
213
- <?php
214
- $this->ezOptions['text_lu']->render();
215
- ?>
216
- <span style='display:inline-block;width:70%'><b><?php _e('Ad Alignment', 'easy-adsenser'); ?></b>&nbsp;<?php _e('(Where to show?)', 'easy-adsenser'); ?></span>
217
- <?php
218
- $this->ezOptions['margin_lu']->render();
219
- $this->ezOptions['show_lu']->render();
220
- $this->ezOptions['title_lu']->render();
221
- $this->ezOptions['kill_lu_title']->render();
222
- ?>
223
- </td>
224
- </tr>
225
- <tr style='vertical-align:top'>
226
- <td style='width:50%;height:250px;vertical-align:middle'>
227
- <?php
228
- $this->ezOptions['text_gsearch']->render();
229
- ?>
230
- <span style='display:inline-block;width:70%'><b><?php _e('Search Title', 'easy-adsenser'); ?></b>&nbsp;<?php _e('(Title of the Google Search Widget)', 'easy-adsenser'); ?></span>
231
- <?php
232
- $this->ezOptions['margin_gsearch']->render();
233
- $this->ezOptions['title_gsearch']->render();
234
- $this->ezOptions['title_gsearch_custom']->render();
235
- $this->ezOptions['kill_gsearch_title']->render();
236
- ?>
237
- </td>
238
- </tr>
239
- </table>
240
 
241
- <table class='form-table'>
242
- <tr style='vertical-align:top'>
243
- <td style='width:50%;height:250px;vertical-align:middle'>
244
- <br style='line-height: 12px;' />
245
- <?php
246
- $this->ezOptions['max_link']->render();
247
- $this->ezOptions['kill_author']->render();
248
- $this->ezOptions['suppressBoxes']->render();
249
- $ez->renderWhyPro($short = true);
250
- ?>
251
- </td>
252
- </tr>
253
- </table>
 
 
254
 
255
- </td>
256
- </tr>
257
- </table>
258
 
259
- <div class="submit">
260
- <?php
261
- $update = new EzSubmit('saveChanges');
262
- $update->desc = __('Save Changes', 'easy-adsenser');
263
- $update->title = __('Save the changes as specified above', 'easy-adsenser');
264
- $update->tipTitle = $update->desc;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
 
266
- $reset = new EzSubmit('resetOptions');
267
- $reset->desc = __('Reset Options', 'easy-adsenser');
268
- $reset->title = __('This <b>Reset Options</b> button discards all your changes and loads the default options. This is your only warning!', 'easy-adsenser');
269
- $reset->tipWarning = true;
 
 
 
 
 
 
 
 
 
270
 
271
- $cleanDB = new EzSubmit('cleanDB');
272
- $cleanDB->desc = __('Clean Database', 'easy-adsenser');
273
- $cleanDB->title = __('The <b>Database Cleanup</b> button discards all your AdSense settings you have saved so far for <b>all</b> the themes, including the current one. Use it only if you know that you will not be using these themes. Please be careful with all database operations -- keep a backup.', 'easy-adsenser');
274
- $cleanDB->tipWarning = true;
275
 
276
- $uninstall = new EzSubmit('uninstall');
277
- $uninstall->desc = __('Uninstall', 'easy-adsenser');
278
- $uninstall->title = __('The <b>Uninstall</b> button really kills %s after cleaning up all the options it wrote in your database. This is your only warning! Please be careful with all database operations -- keep a backup.', 'easy-adsenser');
279
- $uninstall->tipWarning = true;
 
 
 
280
 
281
- $update->render();
282
- $reset->render();
283
- $cleanDB->render();
284
- $uninstall->render();
285
- $this->ezTran->renderTranslator();
 
 
 
 
 
 
 
 
 
 
286
  ?>
287
- </div>
288
- </form>
289
 
290
- <span id="help0" style='display:none'>
291
- <?php
292
- echo "1. ";
293
- _e('Generate AdSense code (from http://adsense.google.com &rarr; AdSense Setup &rarr; Get Ads).', 'easy-adsenser');
294
- echo "<br />\n2. ";
295
- _e('Cut and paste the AdSense code into the boxes below, deleting the existing text.', 'easy-adsenser');
296
- echo "<br />\n3. ";
297
- _e('Decide how to align and show the code in your blog posts.', 'easy-adsenser');
298
- echo "<br />\n4. ";
299
- _e('Take a look at the Google policy option, and other options. The defaults should work.', 'easy-adsenser');
300
- echo "<br />\n5. ";
301
- printf(__('If you want to use the widgets, drag and drop them at %s Appearance (or Design) &rarr; Widgets %s', 'easy-adsenser'), '<a href="widgets.php">', '</a>.');
302
- echo "<br />\n<b>";
303
- _e('Save the options, and you are done!', 'easy-adsenser');
304
- echo "</b>";
305
- ?>
306
- </span>
307
-
308
- <span id="help1" style='display:none'>
309
- <?php _e('If you want to suppress AdSense in a particular post or page, give the <b><em>comment </em></b> "&lt;!--noadsense--&gt;" somewhere in its text.
310
  <br />
311
  <br />
312
  Or, insert a <b><em>Custom Field</em></b> with a <b>key</b> "adsense" and give it a <b>value</b> "no".<br />
@@ -323,37 +292,37 @@ left,
323
  right,
324
  center,
325
  no', 'easy-adsenser'); ?>
326
- </span>
327
 
328
- <span id="help2" style='display:none'>
329
- <?php _e('<em>Easy AdSense</em> gives you widgets to embelish your sidebars. You can configure them here (on the right hand side of the Options table below) and place them on your page using <a href="widgets.php"> Appearance (or Design) &rarr; Widgets</a>.
330
  <br />
331
  <br />
332
  1. <b>AdSense Widget</b> is an ad block widget that you can place any where on the sidebar. Typically, you would put a skyscraper block (160x600px, for instance) on your sidebar, but you can put anything -- not necessarily AdSense code.<br />
333
  <br />
334
  2. <b>AdSense Link Units</b>, if enabled, give you multiple widgets to put <a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&amp;answer=15817" target="_blank">link units</a> on your sidebars. You can display three of them according to Google AdSense policy, and you can configure the number of widgets you need.<br /><br />
335
  3. <b>Google Search Widget</b> gives you another widget to place a <a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&amp;answer=17960" target="_blank">custom AdSense search box</a> on your sidebar. You can customize the look of the search box and its title by configuring them on this page.', 'easy-adsenser'); ?>
336
- </span>
337
 
338
- <?php
339
- if (!$this->isPro) {
340
- $ez->renderWhyPro();
341
- }
342
- $ez->renderSupport();
343
- include ($this->plgDir . '/tail-text.php');
344
- ?>
345
 
346
- <table class="form-table" >
347
- <tr><th scope="row"><b><?php _e('Credits', 'easy-adsenser'); ?></b></th></tr>
348
- <tr><td>
349
- <ul style="padding-left:10px;list-style-type:circle; list-style-position:inside;" >
350
- <li>
351
- <?php printf(__('%s uses the excellent Javascript/DHTML tooltips by %s', 'easy-adsenser'), '<b>Easy Adsense</b>', '<a href="http://www.walterzorn.com" target="_blank" title="Javascript, DTML Tooltips"> Walter Zorn</a>.');
352
- ?>
353
- </li>
354
- </ul>
355
- </td>
356
- </tr>
357
- </table>
358
 
359
  </div>
1
  <?php
 
2
  /*
3
  Copyright (C) 2008 www.ads-ez.com
4
 
21
  $this->mkEzOptions();
22
  $this->setOptionValues();
23
  $this->mkHelpTags();
 
 
 
 
24
  ?>
25
+ <div class="wrap" id="wrapper" style="width:1000px">
26
+ <h2>Easy AdSense Setup</h2>
27
+ <table class="form-table">
28
+ <tr style="vertical-align:middle">
29
+ <td style="width:40%">
30
+ <h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  <?php
32
+ _e('Instructions', 'easy-adsenser');
33
+ echo "</h3>\n<ul style='padding-left:10px;list-style-type:circle; list-style-position:inside;'>\n";
34
+ foreach ($this->helpTags as $help) {
35
+ echo "<li>";
36
+ $help->render();
37
+ echo "</li>\n";
38
+ }
39
  ?>
40
+ </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  </td>
42
+ <?php
43
+ include ($this->plgDir . '/head-text.php');
44
+ ?>
45
+ </tr></table>
46
+ <form method='post' action='#'>
47
+ <?php
48
+ $this->renderNonce();
49
+ $ez->renderNags($this->options);
50
+ ?>
51
+ <br />
52
+ <table>
53
+ <tr><td><h3>
54
+ <?php
55
+ printf(__('Options (for the %s theme)', 'easy-adsenser'), get_option('stylesheet'));
56
+ ?>
57
+ </h3></td></tr>
58
+ </table>
59
+ <table style='width:100%'>
60
+ <tr>
61
+ <td style='width:50%;height:50px'>
62
+ <table class='form-table'>
63
+ <tr>
64
+ <td style='width:50%;height:40px'>
65
+ <?php
66
+ echo "<b><u>";
67
+ _e('Ad Blocks in Your Posts', 'easy-adsenser');
68
+ echo "</u></b><br />";
69
+ _e('[Appears in your posts and pages]', 'easy-adsenser');
70
+ ?>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </td>
75
+ <td style='width:50%;height:50px'>
76
+ <table class='form-table'>
77
+ <tr>
78
+ <td style='width:50%;height:40px'>
79
+ <?php
80
+ echo "<b><u>";
81
+ _e('Widgets for Your Sidebars', 'easy-adsenser');
82
+ ?>
83
+ </u></b><br />
84
+ <?php
85
+ _e('[See <a href="widgets.php"> Appearance (or Design) &rarr; Widgets</a>]', 'easy-adsenser');
86
+ ?>
87
+ </td>
88
+ </tr>
89
+ </table>
90
+ </td>
91
+ </tr>
92
+ </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
+ <table style='width:100%'>
95
+ <tr style='vertical-align:top'>
96
+ <td style='width:50%'>
97
+ <table class='form-table'>
98
+ <tr style='vertical-align:top'>
99
+ <td style='width:50%;height:220px;vertical-align:middle'>
100
+ <?php
101
+ $this->ezOptions['text_leadin']->render();
102
+ echo "<b><span style='display:inline-block;width:30%'>";
103
+ _e('Ad Alignment', 'easy-adsenser');
104
+ echo "</span></b>"
105
+ . "<span style='display:inline-block;width:40%'>";
106
+ $this->ezOptions['wc_leadin']->render();
107
+ echo "</span>";
108
+ $this->ezOptions['margin_leadin']->render();
109
+ $this->ezOptions['header_leadin']->render();
110
+ echo "&nbsp;";
111
+ $this->ezOptions['show_leadin']->render();
112
+ ?>
113
+ <br />
114
+ </td>
115
+ </tr>
116
+ <tr style='vertical-align:top'>
117
+ <td style='width:50%;height:220px;vertical-align:middle'>
118
+ <?php
119
+ $this->ezOptions['text_midtext']->render();
120
+ echo "<b><span style='display:inline-block;width:30%'>";
121
+ _e('Ad Alignment', 'easy-adsenser');
122
+ echo "</span></b>"
123
+ . "<span style='display:inline-block;width:40%'>";
124
+ $this->ezOptions['wc_midtext']->render();
125
+ echo "</span>";
126
+ $this->ezOptions['margin_midtext']->render();
127
+ $this->ezOptions['force_midad']->render();
128
+ echo "&nbsp;";
129
+ $this->ezOptions['show_midtext']->render();
130
+ ?>
131
+ <br />
132
+ </td>
133
+ </tr>
134
+ <tr style='vertical-align:top'>
135
+ <td style='width:50%;height:250px;vertical-align:middle'>
136
+ <?php
137
+ $this->ezOptions['text_leadout']->render();
138
+ echo "<b><span style='display:inline-block;width:30%'>";
139
+ _e('Ad Alignment', 'easy-adsenser');
140
+ echo "</span></b>"
141
+ . "<span style='display:inline-block;width:40%'>";
142
+ $this->ezOptions['wc_leadout']->render();
143
+ echo "</span>";
144
+ $this->ezOptions['margin_leadout']->render();
145
+ $this->ezOptions['footer_leadout']->render();
146
+ echo "&nbsp;";
147
+ $this->ezOptions['show_leadout']->render();
148
+ ?>
149
+ </td>
150
+ </tr>
151
+ </table>
152
 
153
+ <table class='form-table'>
154
+ <tr style='vertical-align:top'>
155
+ <td style='width:50%;height:250px;vertical-align:middle'>
156
+ <?php
157
+ $this->ezOptions['max_count']->render();
158
+ echo "<br style='line-height: 5px;' /><b>";
159
+ _e('Suppress AdSense Ad Blocks on:', 'easy-adsenser');
160
+ echo "</b>";
161
+ foreach ($this->kills as $k) {
162
+ $this->ezOptions["kill_$k"]->render();
163
+ }
164
+ ?>
165
+ <br style='line-height: 5px;' />
166
 
167
+ <b><?php _e('Other Options', 'easy-adsenser'); ?></b><br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
 
169
+ <?php
170
+ $this->ezOptions['force_widget']->render();
171
+ $this->ezOptions['show_borders']->render();
172
+ $this->ezOptions['border_widget']->render();
173
+ $this->ezOptions['border_lu']->render();
174
+ echo "<span style='display:inline-block;width:20px'> </span>";
175
+ $this->ezOptions['border_width']->render();
176
+ $this->ezOptions['border_normal']->render();
177
+ $this->ezOptions['border_color']->render();
178
+ $this->ezOptions['kill_inline']->render();
179
+ $this->ezOptions['kill_linebreaks']->render();
180
+ ?>
181
+ </td>
182
+ </tr>
183
+ </table>
184
 
185
+ </td>
186
+ <td style='width:50%'>
 
187
 
188
+ <table class='form-table'>
189
+ <tr style='vertical-align:top'>
190
+ <td style='width:50%;height:220px;vertical-align:middle'>
191
+ <?php
192
+ $this->ezOptions['text_widget']->render();
193
+ ?>
194
+ <span style='display:inline-block;width:70%'><b><?php _e('Ad Alignment', 'easy-adsenser'); ?></b>&nbsp;<?php _e('(Where to show?)', 'easy-adsenser'); ?></span>
195
+ <?php
196
+ $this->ezOptions['margin_widget']->render();
197
+ $this->ezOptions['show_widget']->render();
198
+ $this->ezOptions['title_widget']->render();
199
+ $this->ezOptions['kill_widget_title']->render();
200
+ ?>
201
+ </td>
202
+ </tr>
203
+ <tr style='vertical-align:top'>
204
+ <td style='width:50%;height:220px;vertical-align:middle'>
205
+ <?php
206
+ $this->ezOptions['text_lu']->render();
207
+ ?>
208
+ <span style='display:inline-block;width:70%'><b><?php _e('Ad Alignment', 'easy-adsenser'); ?></b>&nbsp;<?php _e('(Where to show?)', 'easy-adsenser'); ?></span>
209
+ <?php
210
+ $this->ezOptions['margin_lu']->render();
211
+ $this->ezOptions['show_lu']->render();
212
+ $this->ezOptions['title_lu']->render();
213
+ $this->ezOptions['kill_lu_title']->render();
214
+ ?>
215
+ </td>
216
+ </tr>
217
+ <tr style='vertical-align:top'>
218
+ <td style='width:50%;height:250px;vertical-align:middle'>
219
+ <?php
220
+ $this->ezOptions['text_gsearch']->render();
221
+ ?>
222
+ <span style='display:inline-block;width:70%'><b><?php _e('Search Title', 'easy-adsenser'); ?></b>&nbsp;<?php _e('(Title of the Google Search Widget)', 'easy-adsenser'); ?></span>
223
+ <?php
224
+ $this->ezOptions['margin_gsearch']->render();
225
+ $this->ezOptions['title_gsearch']->render();
226
+ $this->ezOptions['title_gsearch_custom']->render();
227
+ $this->ezOptions['kill_gsearch_title']->render();
228
+ ?>
229
+ </td>
230
+ </tr>
231
+ </table>
232
 
233
+ <table class='form-table'>
234
+ <tr style='vertical-align:top'>
235
+ <td style='width:50%;height:250px;vertical-align:middle'>
236
+ <br style='line-height: 12px;' />
237
+ <?php
238
+ $this->ezOptions['max_link']->render();
239
+ $this->ezOptions['kill_author']->render();
240
+ $this->ezOptions['suppressBoxes']->render();
241
+ $ez->renderWhyPro($short = true);
242
+ ?>
243
+ </td>
244
+ </tr>
245
+ </table>
246
 
247
+ </td>
248
+ </tr>
249
+ </table>
 
250
 
251
+ <div class="submit">
252
+ <?php
253
+ $this->renderSubmitButtons();
254
+ $this->ezTran->renderTranslator();
255
+ ?>
256
+ </div>
257
+ </form>
258
 
259
+ <span id="help0" style='display:none'>
260
+ <?php
261
+ echo "1. ";
262
+ _e('Generate AdSense code (from http://adsense.google.com &rarr; AdSense Setup &rarr; Get Ads).', 'easy-adsenser');
263
+ echo "<br />\n2. ";
264
+ _e('Cut and paste the AdSense code into the boxes below, deleting the existing text.', 'easy-adsenser');
265
+ echo "<br />\n3. ";
266
+ _e('Decide how to align and show the code in your blog posts.', 'easy-adsenser');
267
+ echo "<br />\n4. ";
268
+ _e('Take a look at the Google policy option, and other options. The defaults should work.', 'easy-adsenser');
269
+ echo "<br />\n5. ";
270
+ printf(__('If you want to use the widgets, drag and drop them at %s Appearance (or Design) &rarr; Widgets %s', 'easy-adsenser'), '<a href="widgets.php">', '</a>.');
271
+ echo "<br />\n<b>";
272
+ _e('Save the options, and you are done!', 'easy-adsenser');
273
+ echo "</b>";
274
  ?>
275
+ </span>
 
276
 
277
+ <span id="help1" style='display:none'>
278
+ <?php _e('If you want to suppress AdSense in a particular post or page, give the <b><em>comment </em></b> "&lt;!--noadsense--&gt;" somewhere in its text.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  <br />
280
  <br />
281
  Or, insert a <b><em>Custom Field</em></b> with a <b>key</b> "adsense" and give it a <b>value</b> "no".<br />
292
  right,
293
  center,
294
  no', 'easy-adsenser'); ?>
295
+ </span>
296
 
297
+ <span id="help2" style='display:none'>
298
+ <?php _e('<em>Easy AdSense</em> gives you widgets to embelish your sidebars. You can configure them here (on the right hand side of the Options table below) and place them on your page using <a href="widgets.php"> Appearance (or Design) &rarr; Widgets</a>.
299
  <br />
300
  <br />
301
  1. <b>AdSense Widget</b> is an ad block widget that you can place any where on the sidebar. Typically, you would put a skyscraper block (160x600px, for instance) on your sidebar, but you can put anything -- not necessarily AdSense code.<br />
302
  <br />
303
  2. <b>AdSense Link Units</b>, if enabled, give you multiple widgets to put <a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&amp;answer=15817" target="_blank">link units</a> on your sidebars. You can display three of them according to Google AdSense policy, and you can configure the number of widgets you need.<br /><br />
304
  3. <b>Google Search Widget</b> gives you another widget to place a <a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&amp;answer=17960" target="_blank">custom AdSense search box</a> on your sidebar. You can customize the look of the search box and its title by configuring them on this page.', 'easy-adsenser'); ?>
305
+ </span>
306
 
307
+ <?php
308
+ if (!$this->isPro) {
309
+ $ez->renderWhyPro();
310
+ }
311
+ $ez->renderSupport();
312
+ include ($this->plgDir . '/tail-text.php');
313
+ ?>
314
 
315
+ <table class="form-table" >
316
+ <tr><th scope="row"><b><?php _e('Credits', 'easy-adsenser'); ?></b></th></tr>
317
+ <tr><td>
318
+ <ul style="padding-left:10px;list-style-type:circle; list-style-position:inside;" >
319
+ <li>
320
+ <?php printf(__('%s uses the excellent Javascript/DHTML tooltips by %s', 'easy-adsenser'), '<b>Easy Adsense</b>', '<a href="http://www.walterzorn.com" target="_blank" title="Javascript, DTML Tooltips"> Walter Zorn</a>.');
321
+ ?>
322
+ </li>
323
+ </ul>
324
+ </td>
325
+ </tr>
326
+ </table>
327
 
328
  </div>
easy-adsense-lite.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Easy 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 AdSense</a>.
7
- Version: 7.13
8
  Author: Manoj Thulasidas
9
  Author URI: http://www.thulasidas.com
10
  */
@@ -47,10 +47,11 @@ if (!class_exists("EzAdSense")) {
47
 
48
  function EzAdSense() {
49
  parent::__construct("easy-adsense", "Easy AdSense", __FILE__);
 
50
  $this->adminMsg = '';
51
  $this->defaults = array('defaultText' => 'Please generate and paste your ad code here. If left empty, the ad location will be highlighted on your blog pages with a reminder to enter your code.');
52
  $defaultOptions = $this->mkDefaultOptions();
53
- $this->optionName = "ezAdSense" . get_option('stylesheet');
54
  $this->options = get_option($this->optionName);
55
  if (empty($this->options)) {
56
  $this->options = $defaultOptions;
@@ -59,8 +60,8 @@ if (!class_exists("EzAdSense")) {
59
  $this->options = array_merge($defaultOptions, $this->options);
60
  }
61
  // Counts and limis
62
- $this->ezMax = 99;
63
- $this->urMax = 0;
64
  $this->urCount = 0;
65
  $this->ezCount = 0;
66
  $this->metaOptions = array();
@@ -108,10 +109,7 @@ if (!class_exists("EzAdSense")) {
108
  return;
109
  }
110
 
111
- $this->ezOptions['info'] = new EzBaseOption('', 'info');
112
- $this->ezOptions['policy'] = new EzBaseOption('', 'policy');
113
- $this->ezOptions['kill_invites'] = new EzBaseOption('', 'kill_invites');
114
- $this->ezOptions['kill_rating'] = new EzBaseOption('', 'kill_rating');
115
 
116
  $o = new EzTextArea('text_leadin');
117
  $o->before = "<b>" . __('Lead-in AdSense Text', 'easy-adsenser') .
@@ -431,13 +429,6 @@ if (!class_exists("EzAdSense")) {
431
  $o->addChoice('0', '0', __('Suppress links', 'easy-adsenser'))->after = "<br />";
432
  $this->ezOptions['max_link'] = clone $o;
433
 
434
- $o = new EzCheckBox('kill_author');
435
- $o->title = __('If you find the author links and ads on the plugin admin page distracting or annoying, you can suppress them by checking this box. Please remember to save your options after checking.', 'easy-adsenser');
436
- $o->desc = __('Kill author links on the admin page?', 'easy-adsenser');
437
- $o->before = "<br />";
438
- $o->after = "<br />";
439
- $this->ezOptions['kill_author'] = clone $o;
440
-
441
  $o = new EzCheckBox('suppressBoxes');
442
  $o->title = __('Easy AdSense displays a box with red borders to indicate where an ad would have been placed, but has been suppressed by one of the filters above. If you would like to suppress the boxes, check this option.', 'easy-adsenser');
443
  $o->desc = __('Suppress Placement Boxes?', 'easy-adsenser');
@@ -446,69 +437,12 @@ if (!class_exists("EzAdSense")) {
446
  $this->ezOptions['suppressBoxes'] = clone $o;
447
  }
448
 
449
- function setOptionValues() {
450
- $error = EzBaseOption::setValues($this->options, $this->ezOptions);
451
- if (WP_DEBUG && !empty($error)) {
452
- echo "<div class='error'>$error</div>";
453
- }
454
- }
455
-
456
- function handleSubmits() {
457
- if (empty($_POST)) {
458
- return;
459
- }
460
- if (!check_admin_referer('EzAdsenseSubmit', 'EzAdsenseNonce')) {
461
- return;
462
- }
463
- if (isset($_POST['saveChanges'])) {
464
- $this->mkEzOptions();
465
- $this->setOptionValues();
466
-
467
- foreach ($this->ezOptions as $k => $o) {
468
- if (isset($this->options[$k])) {
469
- $this->options[$k] = $o->get();
470
- }
471
- else {
472
- if (WP_DEBUG) {
473
- echo "<div class='error'>Warning: <code>option[$k]</code> is not defined, but <code>ezOption[$k]</code> exists!</div>";
474
- }
475
- }
476
- }
477
-
478
- update_option($this->optionName, $this->options);
479
-
480
- $this->adminMsg = "<div class='updated'><p><strong>" .
481
- __('Settings Updated.', 'easy-adsenser') .
482
- "</strong></p> </div>";
483
- }
484
- else if (isset($_POST['resetOptions'])) {
485
- $this->resetOptions();
486
- $this->adminMsg = "<div class='updated'><p><strong>" .
487
- __('Ok, all your settings have been discarded!', 'easy-adsenser') .
488
- "</strong></p> </div>";
489
- }
490
- else if (isset($_POST['cleanDB']) || isset($_POST['uninstall'])) {
491
- $this->resetOptions();
492
- $this->cleanDB('ezAdSense');
493
- $this->adminMsg = "<div class='updated'><p><strong>" .
494
- __('Database has been cleaned. All your options for this plugin (for all themes) have been removed.', 'easy-adsenser') .
495
- "</strong></p> </div>";
496
-
497
- if (isset($_POST['uninstall'])) {
498
- remove_action('admin_menu', 'ezAdSense_ap');
499
- $this->adminMsg = "<div class='updated'><p><strong>" .
500
- __('This plugin can be deactivated now. ', 'easy-adsenser') .
501
- "<a href='plugins.php'>" .
502
- __('Go to Plugins', 'easy-adsenser') .
503
- "</a>.</strong></p></div>";
504
- }
505
- }
506
- }
507
-
508
  function migrateOptions() {
509
  $update = false;
510
- $lookup = array('limit_lu' => '',
 
511
  'allow_exitjunction' => '',
 
512
  'kill_pages' => 'kill_page',
513
  'kill_attach' => 'kill_attachment',
514
  'kill_front' => 'kill_front_page',
@@ -528,12 +462,7 @@ if (!class_exists("EzAdSense")) {
528
  }
529
 
530
  function mkDefaultOptions() { // TODO: Merge this with mkEzOptions
531
- $defaultOptions = array('info' => $this->info(),
532
- 'kill_invites' => false,
533
- 'kill_rating' => false,
534
- 'kill_author' => false,
535
- 'policy' => 'unknown',
536
- 'show_leadin' => 'float:right',
537
  'wc_leadin' => 0,
538
  'margin_leadin' => 12,
539
  'text_leadin' => $this->defaults['defaultText'],
@@ -584,18 +513,11 @@ if (!class_exists("EzAdSense")) {
584
  'kill_search' => true,
585
  'kill_sticky' => false,
586
  'title_widget' => '',
587
- 'suppressBoxes' => false);
 
588
  return $defaultOptions;
589
  }
590
 
591
- // Reset all options to defaults
592
- function resetOptions() {
593
- $defaultOptions = $this->mkDefaultOptions();
594
- update_option($this->optionName, $defaultOptions);
595
- $this->options = $defaultOptions;
596
- unset($_POST);
597
- }
598
-
599
  function handleDefaultText($text, $key = '300x250') {
600
  $ret = $text;
601
  if ($ret == $this->defaults['defaultText'] || strlen(trim($ret)) == 0) {
@@ -643,24 +565,6 @@ if (!class_exists("EzAdSense")) {
643
  }
644
  }
645
 
646
- function info($hide = true) {
647
- if (!function_exists('get_plugin_data')) {
648
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
649
- }
650
- $plugin_data = get_plugin_data(__FILE__);
651
- $version = $plugin_data['Version'];
652
- $str = "Easy AdSense (WP) V$version";
653
- if ($hide) {
654
- $str = "<!-- $str -->";
655
- }
656
- return $str;
657
- }
658
-
659
- function cleanDB($prefix) {
660
- global $wpdb;
661
- $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '$prefix%'");
662
- }
663
-
664
  function plugin_action($links, $file) {
665
  if ($file == plugin_basename(__FILE__)) {
666
  $settings_link = "<a href='options-general.php?page=easy-adsense-lite.php'>" .
@@ -763,12 +667,13 @@ if (!class_exists("EzAdSense")) {
763
  $margin . 'px;' . $border . '"';
764
  }
765
  $unreal = self::showUnreal();
766
- $adBlock = stripslashes($linebreak . $this->info() .
767
- "<!-- [$slot: {$this->ezCount } urCount: {$this->urCount} urMax: {$this->urMax}] -->$linebreak" .
 
768
  '<div class="ezAdsense adsense adsense-' . $slot . '" ' . $inline . '>' .
769
  $this->options["text_$slot"] .
770
  ($this->urCount++ < $this->urMax ? $unreal : '') .
771
- "</div>$linebreak" . $this->options['info'] . "$linebreak");
772
  return $adBlock;
773
  }
774
 
@@ -791,7 +696,6 @@ if (!class_exists("EzAdSense")) {
791
  if ($this->options['force_widget']) {
792
  $this->ezMax--;
793
  }
794
- $this->urMax = $this->options['max_link'];
795
  if ($this->ezCount >= $this->ezMax) {
796
  return "$content <!-- Easy AdSense Unfiltered [count: {$this->ezCount} "
797
  . "is not less than {$this->ezMax}] -->";
4
  Plugin Name: Easy 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 AdSense</a>.
7
+ Version: 7.20
8
  Author: Manoj Thulasidas
9
  Author URI: http://www.thulasidas.com
10
  */
47
 
48
  function EzAdSense() {
49
  parent::__construct("easy-adsense", "Easy AdSense", __FILE__);
50
+ $this->prefix = 'ezAdSense';
51
  $this->adminMsg = '';
52
  $this->defaults = array('defaultText' => 'Please generate and paste your ad code here. If left empty, the ad location will be highlighted on your blog pages with a reminder to enter your code.');
53
  $defaultOptions = $this->mkDefaultOptions();
54
+ $this->optionName = $this->prefix . get_option('stylesheet');
55
  $this->options = get_option($this->optionName);
56
  if (empty($this->options)) {
57
  $this->options = $defaultOptions;
60
  $this->options = array_merge($defaultOptions, $this->options);
61
  }
62
  // Counts and limis
63
+ $this->ezMax = $this->options['max_count'];
64
+ $this->urMax = $this->options['max_link'];
65
  $this->urCount = 0;
66
  $this->ezCount = 0;
67
  $this->metaOptions = array();
109
  return;
110
  }
111
 
112
+ parent::mkEzOptions();
 
 
 
113
 
114
  $o = new EzTextArea('text_leadin');
115
  $o->before = "<b>" . __('Lead-in AdSense Text', 'easy-adsenser') .
429
  $o->addChoice('0', '0', __('Suppress links', 'easy-adsenser'))->after = "<br />";
430
  $this->ezOptions['max_link'] = clone $o;
431
 
 
 
 
 
 
 
 
432
  $o = new EzCheckBox('suppressBoxes');
433
  $o->title = __('Easy AdSense displays a box with red borders to indicate where an ad would have been placed, but has been suppressed by one of the filters above. If you would like to suppress the boxes, check this option.', 'easy-adsenser');
434
  $o->desc = __('Suppress Placement Boxes?', 'easy-adsenser');
437
  $this->ezOptions['suppressBoxes'] = clone $o;
438
  }
439
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  function migrateOptions() {
441
  $update = false;
442
+ $lookup = array('info' => '',
443
+ 'limit_lu' => '',
444
  'allow_exitjunction' => '',
445
+ 'policy' => '',
446
  'kill_pages' => 'kill_page',
447
  'kill_attach' => 'kill_attachment',
448
  'kill_front' => 'kill_front_page',
462
  }
463
 
464
  function mkDefaultOptions() { // TODO: Merge this with mkEzOptions
465
+ $defaultOptions = array('show_leadin' => 'float:right',
 
 
 
 
 
466
  'wc_leadin' => 0,
467
  'margin_leadin' => 12,
468
  'text_leadin' => $this->defaults['defaultText'],
513
  'kill_search' => true,
514
  'kill_sticky' => false,
515
  'title_widget' => '',
516
+ 'suppressBoxes' => false) +
517
+ parent::mkDefaultOptions();
518
  return $defaultOptions;
519
  }
520
 
 
 
 
 
 
 
 
 
521
  function handleDefaultText($text, $key = '300x250') {
522
  $ret = $text;
523
  if ($ret == $this->defaults['defaultText'] || strlen(trim($ret)) == 0) {
565
  }
566
  }
567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
  function plugin_action($links, $file) {
569
  if ($file == plugin_basename(__FILE__)) {
570
  $settings_link = "<a href='options-general.php?page=easy-adsense-lite.php'>" .
667
  $margin . 'px;' . $border . '"';
668
  }
669
  $unreal = self::showUnreal();
670
+ $info = $this->info();
671
+ $adBlock = stripslashes($linebreak . $info . $linebreak .
672
+ "<!-- [$slot: {$this->ezCount} urCount: {$this->urCount} urMax: {$this->urMax}] -->$linebreak" .
673
  '<div class="ezAdsense adsense adsense-' . $slot . '" ' . $inline . '>' .
674
  $this->options["text_$slot"] .
675
  ($this->urCount++ < $this->urMax ? $unreal : '') .
676
+ "</div>" . $linebreak . $info . $linebreak);
677
  return $adBlock;
678
  }
679
 
696
  if ($this->options['force_widget']) {
697
  $this->ezMax--;
698
  }
 
699
  if ($this->ezCount >= $this->ezMax) {
700
  return "$content <!-- Easy AdSense Unfiltered [count: {$this->ezCount} "
701
  . "is not less than {$this->ezMax}] -->";
lang/.DS_Store ADDED
Binary file
lang/ar_MA_easy-common.mo ADDED
Binary file
lang/by_BY_easy-common.mo ADDED
Binary file
lang/da_DK_easy-common.mo ADDED
Binary file
lang/de_DE_easy-common.mo ADDED
Binary file
lang/es_ES_easy-common.mo ADDED
Binary file
lang/fa_IR_easy-common.mo ADDED
Binary file
lang/fr_FR_easy-common.mo ADDED
Binary file
lang/id_ID_easy-common.mo ADDED
Binary file
lang/it_IT_easy-common.mo ADDED
Binary file
lang/ko_KR_easy-common.mo ADDED
Binary file
lang/nb_NO_easy-common.mo ADDED
Binary file
lang/nl_NL_easy-common.mo ADDED
Binary file
lang/pl_PL_easy-common.mo ADDED
Binary file
lang/pt_BR_easy-common.mo ADDED
Binary file
lang/pt_PT_easy-common.mo ADDED
Binary file
lang/ro_RO_easy-common.mo ADDED
Binary file
lang/ru_RU_easy-common.mo ADDED
Binary file
lang/th_TH_easy-common.mo ADDED
Binary file
lang/tr_TR_easy-common.mo ADDED
Binary file
lang/uk_UE_easy-common.mo ADDED
Binary file
lang/zh_CN_easy-common.mo ADDED
Binary file
lang/zh_TW_easy-common.mo ADDED
Binary file
myPlugins.php CHANGED
@@ -131,7 +131,9 @@ $myPlugins['easy-latex'] = array('value' => 'Easy WP LaTeX',
131
  'blurb' => '<em><strong>Easy WP LaTeX</strong></em> is a premium plugin that ',
132
  'desc' => 'provides a very easy way to display math and equations in your posts.',
133
  'title' => '<em><strong>Easy WP LaTeX</strong></em> provides a very easy way to display equations or mathematical formulas (typed in as TeX or LaTeX code) in your posts. It translates LaTeX formulas like this [math](a+b)^2 = a^2 + b^2 + 2ab[/math] into this:<br/>&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://l.wordpress.com/latex.php?latex=(a%2bb)^2%20=%20a^2%20%2b%20b^2%20%2b%202ab&amp;bg=E2E7FF&amp;s=1" style="vertical-align:-70%;" alt="(a+b)^2 = a^2 + b^2 + 2ab" />',
134
- 'pro' => 'The Lite version of the plugin is fully functional. The Pro version gives you options to cache the equation images so that your pages load faster.');
 
 
135
 
136
  $myPlugins['easy-translator'] = array('value' => 'Easy Translator',
137
  'price' => '3.95',
131
  'blurb' => '<em><strong>Easy WP LaTeX</strong></em> is a premium plugin that ',
132
  'desc' => 'provides a very easy way to display math and equations in your posts.',
133
  'title' => '<em><strong>Easy WP LaTeX</strong></em> provides a very easy way to display equations or mathematical formulas (typed in as TeX or LaTeX code) in your posts. It translates LaTeX formulas like this [math](a+b)^2 = a^2 + b^2 + 2ab[/math] into this:<br/>&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://l.wordpress.com/latex.php?latex=(a%2bb)^2%20=%20a^2%20%2b%20b^2%20%2b%202ab&amp;bg=E2E7FF&amp;s=1" style="vertical-align:-70%;" alt="(a+b)^2 = a^2 + b^2 + 2ab" />',
134
+ 'pro' => 'The Lite version of the plugin is fully functional. The Pro version gives you options to cache the equation images so that your pages load faster.',
135
+ 'benefits' => '<li>Pre-configured cache directory.</li>
136
+ <li>Ability to turn control links on formulas.</li>');
137
 
138
  $myPlugins['easy-translator'] = array('value' => 'Easy Translator',
139
  'price' => '3.95',
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: manojtd
3
  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: 3.8
7
- Stable tag: 7.13
8
  License: GPL2 or later
9
 
10
  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!
@@ -42,7 +42,7 @@ Easy AdSense is the freely distributed version of a premium plugin. The [Pro ver
42
 
43
  == Upgrade Notice ==
44
 
45
- Bug fix.
46
 
47
  == Screenshots ==
48
 
@@ -140,6 +140,7 @@ A big "Thank You" to all my translators. Easy AdSense V2.6+ sports an *Easy Tran
140
 
141
  == Change Log ==
142
 
 
143
  * V7.13: Bug fix. [Apr 10, 2014]
144
  * V7.12: Auto migrating options to current version if needed. [Apr 2, 2014]
145
  * V7.11: Minor fixes to the links on the widgets page. [Apr 2, 2014]
3
  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: 3.9
7
+ Stable tag: 7.20
8
  License: GPL2 or later
9
 
10
  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!
42
 
43
  == Upgrade Notice ==
44
 
45
+ Some refactoring changes.
46
 
47
  == Screenshots ==
48
 
140
 
141
  == Change Log ==
142
 
143
+ * V7.20: Some refactoring changes. [Apr 18, 2014]
144
  * V7.13: Bug fix. [Apr 10, 2014]
145
  * V7.12: Auto migrating options to current version if needed. [Apr 2, 2014]
146
  * V7.11: Minor fixes to the links on the widgets page. [Apr 2, 2014]