Easy Plugin for AdSense - Version 8.20

Version Description

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

Download this release

Release Info

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

Code changes from version 8.15 to 8.20

Files changed (95) hide show
  1. EZWP.php +0 -147
  2. EzAdmin.php +653 -0
  3. EzGA.php +0 -1017
  4. EzGAPro.php +0 -56
  5. EzOptions.php +745 -0
  6. EzTran.php +1 -1
  7. EzWidget.php +0 -67
  8. admin.php +328 -0
  9. admin/Migrator.php +0 -218
  10. admin/Updater.php +0 -146
  11. admin/ajax/categories.php +0 -28
  12. admin/ajax/options-suspend-ads.php +0 -16
  13. admin/ajax/options.php +0 -5
  14. admin/ajax/optionset.php +0 -15
  15. admin/ajax/pages.php +0 -32
  16. admin/ajax/posts.php +0 -28
  17. admin/ajax/success.php +0 -26
  18. admin/ajax/update.php +0 -114
  19. admin/box-ad-alignment-options.php +0 -38
  20. admin/box-ad-alignment.php +0 -27
  21. admin/box-more-info.php +0 -41
  22. admin/box-optionset.php +0 -14
  23. admin/box-suppressing-ads-options.php +0 -41
  24. admin/box-suppressing-ads.php +0 -45
  25. admin/css/bootstrap-cerulean.min.css +0 -7
  26. admin/css/bootstrap-colorpicker.min.css +0 -9
  27. admin/css/bootstrap-editable.css +0 -663
  28. admin/css/bootstrap-tour.min.css +0 -19
  29. admin/css/charisma-app.css +0 -658
  30. admin/css/ez-admin.css +0 -20
  31. admin/css/fileinput.min.css +0 -11
  32. admin/css/font-awesome.min.css +0 -4
  33. admin/easy-adsense-admin.php +0 -381
  34. admin/easy-adsense-intro.php +0 -87
  35. admin/easy-adsense-options.php +0 -225
  36. admin/fonts/fontawesome-webfont.eot +0 -0
  37. admin/fonts/fontawesome-webfont.svg +0 -520
  38. admin/fonts/fontawesome-webfont.ttf +0 -0
  39. admin/fonts/fontawesome-webfont.woff +0 -0
  40. admin/fonts/glyphicons-halflings-regular.eot +0 -0
  41. admin/fonts/glyphicons-halflings-regular.svg +0 -229
  42. admin/fonts/glyphicons-halflings-regular.ttf +0 -0
  43. admin/fonts/glyphicons-halflings-regular.woff +0 -0
  44. admin/footer.php +0 -44
  45. admin/header.php +0 -278
  46. admin/i18n.php +0 -22
  47. admin/img/ads-ez.png +0 -0
  48. admin/img/bootstrap-colorpicker/alpha-horizontal.png +0 -0
  49. admin/img/bootstrap-colorpicker/alpha.png +0 -0
  50. admin/img/bootstrap-colorpicker/hue-horizontal.png +0 -0
  51. admin/img/bootstrap-colorpicker/hue.png +0 -0
  52. admin/img/bootstrap-colorpicker/saturation.png +0 -0
  53. admin/img/install.png +0 -0
  54. admin/img/paypal-partner.png +0 -0
  55. admin/img/svcs/300x250-00.jpg +0 -0
  56. admin/img/svcs/300x250-01.jpg +0 -0
  57. admin/img/svcs/300x250-02.jpg +0 -0
  58. admin/img/svcs/300x250-03.jpg +0 -0
  59. admin/img/svcs/300x250-04.jpg +0 -0
  60. admin/index.php +0 -29
  61. admin/js/bootbox.min.js +0 -6
  62. admin/js/bootstrap-colorpicker.min.js +0 -1
  63. admin/js/bootstrap-editable.min.js +0 -7
  64. admin/js/bootstrap-tour.min.js +0 -19
  65. admin/js/bootstrap.min.js +0 -6
  66. admin/js/charisma.js +0 -418
  67. admin/js/ez-admin.js +0 -116
  68. admin/js/fileinput.min.js +0 -6
  69. admin/js/tooltip.js +0 -457
  70. admin/lock.php +0 -15
  71. admin/migrate.php +0 -28
  72. admin/no-ajax.php +0 -56
  73. admin/options.php +0 -39
  74. admin/pro-options.php +0 -0
  75. admin/promo.php +0 -70
  76. admin/support.php +0 -52
  77. admin/tour.php +0 -141
  78. admin/update.php +0 -212
  79. arvixe.gif +0 -0
  80. debug.php +0 -42
  81. easy-adsense-frontend.php +0 -272
  82. easy-adsense-lite.php +1072 -0
  83. easy-adsense-widget.php +0 -166
  84. easy-adsense.php +0 -30
  85. english.gif +0 -0
  86. ezDenyLite.php +40 -0
  87. ezKillLite.php +0 -120
  88. ezpaypal.png +0 -0
  89. ezsupport.png +0 -0
  90. admin/img/google-dark.gif → google-dark.gif +0 -0
  91. admin/img/google-light.gif → google-light.gif +0 -0
  92. head-text.php +30 -0
  93. invite.gif +0 -0
  94. lang/ar_MA.mo +0 -0
  95. lang/ar_MA.po +235 -0
EZWP.php DELETED
@@ -1,147 +0,0 @@
1
- <?php
2
-
3
- if (!class_exists('EZWP')) {
4
-
5
- require_once 'EzGAPro.php';
6
-
7
- class EZWP extends EzGAPro {
8
-
9
- static $isPro = false;
10
- static $strPro = 'Lite';
11
- static $pluginModes = array('adsense-now' => 'AdSense Now!',
12
- 'google-adsense' => 'Google AdSense',
13
- 'easy-adsense' => 'Easy AdSense');
14
-
15
- static function isPro() {
16
- $file = dirname(__FILE__) . "/admin/pro.php";
17
- self::$isPro = file_exists($file);
18
- return self::$isPro;
19
- }
20
-
21
- static function getPlgMode($dir = "") {
22
- $pluginModes = self::$pluginModes;
23
- foreach ($pluginModes as $p => $name) {
24
- if (strpos(__FILE__, $p) !== false) {
25
- $mode = $p;
26
- break;
27
- }
28
- }
29
- $required = array('../%s-frontend.php', '%s-admin.php', '%s-options.php');
30
- $pwd = getcwd();
31
- if (empty($dir)) {
32
- $dir = dirname(__FILE__) . "/admin";
33
- }
34
- chdir($dir);
35
- foreach ($required as $format) {
36
- $file = sprintf($format, $mode);
37
- if (!file_exists($file)) {
38
- trigger_error("stack trace");
39
- die("Required file <code>{$file}</code> not found in <code>$dir</code>.<br> Please reinstall the plugin.");
40
- }
41
- }
42
- if ($mode == 'google-adsense') {
43
- $ultra = true;
44
- foreach ($pluginModes as $p => $name) {
45
- foreach ($required as $format) {
46
- $file = sprintf($format, $p);
47
- if (!file_exists($file)) {
48
- $ultra = false;
49
- break 2;
50
- }
51
- }
52
- }
53
- }
54
- else {
55
- $ultra = false;
56
- }
57
- if ($ultra) {
58
- $mode = 'google-adsense-ultra';
59
- }
60
- chdir($pwd);
61
- return $mode;
62
- }
63
-
64
- static function getPlgName($dir = "") {
65
- $mode = self::getPlgMode($dir);
66
- if ($mode == 'google-adsense-ultra') {
67
- self::$strPro = 'Ultra';
68
- $name = 'Google AdSense Ultra';
69
- }
70
- else {
71
- $name = self::$pluginModes[$mode];
72
- if (self::isPro()) {
73
- self::$strPro = 'Pro';
74
- $name .= ' Pro';
75
- }
76
- else {
77
- self::$strPro = 'Lite';
78
- $name .= ' Lite';
79
- }
80
- }
81
- return $name;
82
- }
83
-
84
- static function getProName($dir = "") {
85
- $mode = self::getPlgMode($dir);
86
- $proNames = array('adsense-now' => 'AdSense Now! Pro',
87
- 'google-adsense' => 'Google AdSense Ultra',
88
- 'easy-adsense' => 'Easy AdSense Pro');
89
- if (!empty($proNames[$mode])) {
90
- return $proNames[$mode];
91
- }
92
- else {
93
- return 'Google AdSense Ultra';
94
- }
95
- }
96
-
97
- static function getGenOption($name) {
98
- global $wpdb;
99
- $table = $wpdb->prefix . "ez_adsense_options";
100
- $sql = "SELECT value FROM $table WHERE name='$name' AND plugin_slug='All' AND theme='All' AND provider='All' AND optionset='All'";
101
- $row = $wpdb->get_results($sql);
102
- if (!empty($row)) {
103
- $row = $row[0];
104
- $value = $row->value;
105
- }
106
- else {
107
- $value = '';
108
- }
109
- return $value;
110
- }
111
-
112
- static function getSlug($dir = "") {
113
- $plugin_slug = self::getPlgMode($dir);
114
- if ($plugin_slug == 'google-adsense-ultra') {
115
- $plugin_slug = self::getGenOption('plugin_slug');
116
- if (empty($plugin_slug)) {
117
- $candidates = array('google-adsense', 'easy-adsense', 'adsense-now');
118
- foreach ($candidates as $c) {
119
- if (stripos($dir, $c) !== false) {
120
- $plugin_slug = $c;
121
- break;
122
- }
123
- }
124
- }
125
- if (empty($plugin_slug)) {
126
- $plugin_slug = 'google-adsense';
127
- }
128
- self::putGenOption('plugin_slug', $plugin_slug);
129
- }
130
- return $plugin_slug;
131
- }
132
-
133
- static function putGenOption($name, $value) {
134
- global $wpdb;
135
- $table = $wpdb->prefix . "ez_adsense_options";
136
- $row['name'] = $name;
137
- $row['value'] = $value;
138
- foreach (array('plugin_slug', 'theme', 'provider', 'optionset') as $col) {
139
- $row[$col] = "All";
140
- }
141
- $status = $wpdb->replace($table, $row);
142
- return $status;
143
- }
144
-
145
- }
146
-
147
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
EzAdmin.php ADDED
@@ -0,0 +1,653 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Copyright (C) 2008 www.ads-ez.com
5
+
6
+ This program is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation; either version 3 of the License, or (at
9
+ your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful, but
12
+ WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+
20
+ if (!class_exists('EzAdmin')) {
21
+
22
+ class EzAdmin {
23
+
24
+ var $plgURL, $plgFile, $plg, $slug, $name;
25
+ var $killAuthor = false;
26
+ static $premia = array(array('key' => 'ads-ez',
27
+ 'name' => 'Ads EZ',
28
+ 'desc' => 'A Personal Ad Server'),
29
+ array('key' => 'ezpaypal',
30
+ 'name' => 'EZ PayPal',
31
+ 'desc' => 'Your own e-shop for Digital Goods'),
32
+ array('key' => 'easy-adsense',
33
+ 'name' => 'Easy AdSense Ultra',
34
+ 'desc' => 'Bootstrap/AJAX version of Easy AdSense'),
35
+ array('key' => 'google-adsense',
36
+ 'name' => 'Google AdSense Ultra',
37
+ 'desc' => 'The Ultimate AdSense plugin - Combines Easy AdSense, AdSense Now! and Google AdSense in one sleek, modern interface.'));
38
+
39
+ function __construct($plg, $slug, $plgURL) {
40
+ $this->plg = $plg;
41
+ $this->slug = $slug;
42
+ $this->plgURL = $plgURL;
43
+ }
44
+
45
+ function __destruct() {
46
+
47
+ }
48
+
49
+ function EzAdmin($plg, $slug, $plgURL) {
50
+ if (version_compare(PHP_VERSION, "5.0.0", "<")) {
51
+ $this->__construct($plg, $slug, $plgURL);
52
+ register_shutdown_function(array($this, "__destruct"));
53
+ }
54
+ }
55
+
56
+ function renderNags(&$options) {
57
+ if (empty($options['kill_rating'])) {
58
+ $this->renderRating();
59
+ }
60
+ else {
61
+ echo "<input type='hidden' name='kill_rating' value='true' />";
62
+ }
63
+ // if (empty($options['kill_invites'])) {
64
+ // $this->renderInvite();
65
+ // }
66
+ // else {
67
+ // echo "<input type='hidden' name='kill_invites' value='true' />";
68
+ // }
69
+ }
70
+
71
+ function renderInvite() {
72
+ if ($this->killAuthor) {
73
+ return;
74
+ }
75
+ $plg = $this->plg;
76
+ $slug = $this->slug;
77
+ $plgLongName = $plg['value'];
78
+ $plgPrice = $plg['price'];
79
+ $yesTip = sprintf(__('Buy %s Pro for $%s. PayPal payment. Instant download.', 'easy-common'), $plgLongName, $plgPrice);
80
+ $yesTitle = __('Get the Pro version now!', 'easy-common');
81
+ $noTip = __('Continue using the Lite version, and hide this message. After clicking this button, please remember to save your options to hide this box for good.', 'easy-common');
82
+ $noTitle = __('Stay Lite', 'easy-common');
83
+ $plgKey = $this->getPlgKey();
84
+ $onClick = addslashes("onclick=\"popupwindow('http://www.thulasidas.com/promo.php?key=$plgKey','Get Pro', 1024, 768);return false;\"");
85
+ $hideTip = htmlspecialchars(__('Click the link to hide this box. After clicking this link, please remember to save your options to hide this box for good.', 'easy-common') . "<br /><a style=\"color:red;font-weight:bold\" href=\"http://www.thulasidas.com/promo.php?key=$plgKey\" target=_blank $onClick>" . __("Limited Time Offer. Get the Pro version for less than a dollar!", 'easy-common') . "</a>");
86
+ if (empty($plg['benefits'])) {
87
+ return;
88
+ }
89
+ $benefits = $plg['benefits'];
90
+
91
+ $s1 = __("Want More Features?", 'easy-common');
92
+ $s2 = __("The Pro version of this plugin gives you more features and benefits.", 'easy-common');
93
+ $s3 = __("For instance", 'easy-common');
94
+ $s4 = __("And much more.", 'easy-common');
95
+ $s5 = __("New features and bug fixes will first appear in the Pro version before being ported to this freely distributed Lite edition.", 'easy-common');
96
+ $s6 = __("Go Pro!", 'easy-common');
97
+ $s7 = __("No thanks", 'easy-common');
98
+ $s8 = __("Do not show this anymore", 'easy-common');
99
+ $s9 = sprintf(__("Thank you for using %s!", 'easy-common'), $plgLongName);
100
+ $s10 = __("Please Save Options to hide this box forever", 'easy-common');
101
+
102
+ echo <<<ENDINVITE
103
+ <input type="hidden" id="kill_invites" name="kill_invites" value="" />
104
+ <div class="updated" id="tnc">
105
+ <p><h3>$s1 <a href="#" onmouseover="Tip('$yesTip', WIDTH, 200, CLICKCLOSE, true, TITLE, '$yesTitle')" onmouseout="UnTip()" onclick = "buttonwhich('Yes')">Go Pro!</a></h3>
106
+ $s2 $s3,
107
+ <ol>
108
+ $benefits
109
+ </ol>
110
+ $s4 $s5<br />
111
+ <input onmouseover="Tip('$yesTip', WIDTH, 200, CLICKCLOSE, true, TITLE, '$yesTitle')" onmouseout="UnTip()" type = "button" id = "ybutton" value = "$s6" onclick = "buttonwhich('Yes')" />
112
+ <input onmouseover="Tip('$noTip', WIDTH, 200, CLICKCLOSE, true, TITLE, '$noTitle')" onmouseout="UnTip()" type = "button" id = "nbutton" value = "$s7" onclick = "buttonwhich('No')" />
113
+ <small style='font-weight:normal;'><a id='hideInvite' href='#' style='float:right; display:block; border:none;' onmouseover="Tip('$hideTip', WIDTH, 200, CLOSEBTN, true, CLICKCLOSE, true, FIX, [this, 5, 5], TITLE, 'Hide this Box')" onclick = "buttonwhich('No')">
114
+ $s8</a></small>
115
+ <script type = "text/javascript">
116
+ function hideInvite() {
117
+ document.getElementById("tnc").style.display = 'none';
118
+ }
119
+ function buttonwhich(message) {
120
+ document.getElementById("ybutton").style.display = 'none';
121
+ document.getElementById("nbutton").disabled = 'true';
122
+ document.getElementById("kill_invites").value = 'true' ;
123
+ setTimeout('hideInvite()', 5000);
124
+ if (message == 'Yes') popupwindow('http://buy.thulasidas.com/$slug', '$s6', 1024, 768) ;
125
+ if (message == 'No') {
126
+ document.getElementById("nbutton").value = '$s9 $s10';
127
+ document.getElementById("hideInvite").innerHTML = '$s10';
128
+ }
129
+ }
130
+ </script>
131
+ </div>
132
+ ENDINVITE;
133
+ }
134
+
135
+ function getPlgKey($slug = '') {
136
+ if (empty($slug)) {
137
+ $plgKey = basename($this->plgFile, '.php');
138
+ }
139
+ else {
140
+ $plgKey = $slug;
141
+ if ($slug == 'ezpaypal') {
142
+ $plgKey = 'easy-paypal-lte';
143
+ }
144
+ }
145
+ if (in_array($plgKey, array('easy-ads', 'google-adsense', 'theme-tweaker', 'easy-adsense'))) {
146
+ $plgKey .= '-lite';
147
+ }
148
+ if ($plgKey == 'easy-paypal-lite') {
149
+ $plgKey = 'easy-paypal-lte';
150
+ }
151
+ return $plgKey;
152
+ }
153
+
154
+ function renderRating($killable = true) {
155
+ if ($this->killAuthor) {
156
+ return;
157
+ }
158
+ $plgFile = $this->plgFile;
159
+ $plg = $this->plg;
160
+ $plgCTime = filemtime($plgFile);
161
+ $plgLongName = $plg['value'];
162
+ $plgKey = $this->getPlgKey();
163
+ $hideTip = htmlspecialchars(__('Click the link to hide this box. After clicking this link, please remember to save your options to hide this box for good.', 'easy-common'));
164
+
165
+ if (time() > $plgCTime + (60 * 60 * 24 * 30)) {
166
+ $msg = __("You've installed this plugin over a month ago.", 'easy-common');
167
+ }
168
+ else {
169
+ $msg = __("You will find it feature-rich and robust.", 'easy-common');
170
+ }
171
+ $display = '';
172
+ if (!$killable) {
173
+ $display = "style='display:none'";
174
+ }
175
+
176
+ $s1 = __("If you are satisfied with how well it works, why not rate it and recommend it to others?", 'easy-common');
177
+ $s2 = __("Click here", 'easy-common');
178
+ $s3 = __("Do not show this anymore", 'easy-common');
179
+ $s4 = __("Please Save Options to hide this box forever", 'easy-common');
180
+
181
+ echo <<<ENDRATING
182
+ <div class='updated' id='rating'>
183
+ <p>Thanks for using <i><b>$plgLongName</b></i>! $msg <br />
184
+ $s1 <a href='http://wordpress.org/extend/plugins/$plgKey/' onclick="popupwindow('http://wordpress.org/extend/plugins/$plgKey/','$s2', 1024, 1024);return false;">$s2</a>
185
+ <small style='font-weight:normal;'><a id='hideRating' $display href='#' style='float:right; display:block; border:none;' onmouseover="Tip('$hideTip', WIDTH, 200, CLOSEBTN, true, CLICKCLOSE, true, FIX, [this, 5, 5], TITLE, 'Hide this Box')" onclick = "hideme()">
186
+ $s3</a></small></p></div>
187
+ <input type="hidden" id="kill_rating" name="kill_rating" value="" />
188
+ <script type = "text/javascript">
189
+ function hideRating() {
190
+ document.getElementById("rating").style.display = 'none';
191
+ }
192
+ function hideme() {
193
+ document.getElementById("kill_rating").value = 'true' ;
194
+ document.getElementById("hideRating").innerHTML = '$s4';
195
+ setTimeout('hideRating()', 4000);
196
+ }
197
+ </script>
198
+ ENDRATING;
199
+ }
200
+
201
+ function renderHeadText() {
202
+ $plgURL = $this->plgURL;
203
+ $plg = $this->plg;
204
+ $slug = $this->slug;
205
+ $value = '<em><strong>' . $plg['value'] . '</strong></em>';
206
+ $toolTip = $plg['title'];
207
+ $price = $plg['price'];
208
+ $onclick = "onclick=\"popupwindow('http://buy.thulasidas.com/$slug','Get Pro}', 1024, 768);return false;\"";
209
+
210
+ $s2 = __('Lite Version', 'easy-common');
211
+ $s3 = sprintf(__('Buy the Pro version of %s for $%.2f', 'easy-common'), $plg['value'], $price);
212
+ $s4 = __('Instant download link.', 'easy-common');
213
+ $s5 = __('Pro Version', 'easy-common');
214
+ $moreInfo = "$s2 and <b><a href='http://buy.thulasidas.com/$slug' title='$s3. $s4' $onclick>$s5</a></b>";
215
+ $toolTip .= addslashes('<br />' . $moreInfo);
216
+ $why = addslashes($plg['pro']);
217
+ $version = 'Lite';
218
+
219
+ $s6 = sprintf(__('You are using the %s version of %s, which is available in two versions:', 'easy-common'), $version, $value);
220
+ $s7 = sprintf(__('And it costs only $%.2f!', 'easy-common'), $price);
221
+ $s8 = __('Get the Pro version now!', 'easy-common');
222
+
223
+ echo "<b>$s8</b>
224
+ <a href='http://buy.thulasidas.com/$slug' title='$s3. $s4' $onclick><img src='$plgURL/ezpaypal.png' alt='ezPayPal' class='alignright'/></a>
225
+ <br />
226
+ $s6
227
+ <ul><li>
228
+ $moreInfo
229
+ </li>
230
+ <li>$why $s7</li>
231
+ </ul>";
232
+ }
233
+
234
+ function renderProText() {
235
+ echo "<div id='pro' style='display:none'>";
236
+ $this->renderHeadText();
237
+ echo "</div>";
238
+ if ($this->killAuthor) {
239
+ return;
240
+ }
241
+ $plg = $this->plg;
242
+ $slug = $this->slug;
243
+ $plgKey = $this->getPlgKey();
244
+ $value = '<em><strong>' . $plg['value'] . '</strong></em>';
245
+ $filter = '';
246
+ if (stripos($slug, 'adsense') !== FALSE) {
247
+ $filter = __("e.g., a filter to ensure AdSense policy compliance.", 'easy-common');
248
+ }
249
+ $toolTip = $plg['title'];
250
+ $price = $plg['price'];
251
+ $onclick = "onclick=\"popupwindow('http://buy.thulasidas.com/$slug','Get Pro', 1024, 768);return false;\"";
252
+
253
+ $s1 = sprintf(__('Download the Lite version of %s', 'easy-common'), $plg['value']);
254
+ $s2 = __('Lite Version', 'easy-common');
255
+ $s3 = sprintf(__('Buy the Pro version of %s for $%.2f', 'easy-common'), $plg['value'], $price);
256
+ $s4 = __('Pro Version', 'easy-common');
257
+ $s5 = __('Buy the Pro Version', 'easy-common');
258
+
259
+ $moreInfo = "&nbsp; <a href='http://wordpress.org/extend/plugins/$plgKey/' title='$s1'>$s2 </a>&nbsp; <a href='http://buy.thulasidas.com/$slug' title='$s3' $onclick>$s4</a>";
260
+ $toolTip .= addslashes('<br />' . $moreInfo);
261
+ echo "<div style='background-color:#ffcccc;padding:5px;border: solid 1px;'>
262
+ <div style='font-size:14px;color:#a48;font-variant: small-caps;text-decoration:underline;text-align:center;' $onclick onmouseover=\"TagToTip('pro', WIDTH, 300, TITLE, '$s5',STICKY, 1, CLOSEBTN, true, CLICKCLOSE, true, FIX, [this, 5, 5])\"><b>$s4</b></div>";
263
+
264
+ $s8 = sprintf(__('It costs only $%.2f!', 'easy-common'), $price);
265
+ $s9 = __('Instant download link.', 'easy-common');
266
+ $value .= '<b><i> Lite</i></b>';
267
+ $s10 = sprintf(__('Thank you for using %s. The "Pro" version gives you more options.', 'easy-common'), $value);
268
+ $s11 = __("Consider buying it.", 'easy-common');
269
+
270
+ echo "$s10 $filter $s11 <br /><a href='http://buy.thulasidas.com/$slug' title='$s3. $s9' $onclick>$s8</a>";
271
+ echo "</div>";
272
+ }
273
+
274
+ function renderPremiumText($slug) {
275
+ if ($this->killAuthor) {
276
+ return;
277
+ }
278
+ require(dirname(__FILE__) . '/myPlugins.php');
279
+ $plg = $this->myPlugins[$slug];
280
+
281
+ echo "<div id='premium-$slug' style='display:none'>";
282
+ $plgURL = $this->plgURL;
283
+ $value = '<em><strong>' . $plg['value'] . '</strong></em>';
284
+ $toolTip = $plg['title'];
285
+ $price = $plg['price'];
286
+ $onclick = "onclick=\"popupwindow('http://buy.thulasidas.com/$slug','Get Pro}', 1024, 768);return false;\"";
287
+
288
+ $s2 = __('Lite Version', 'easy-common');
289
+ $s3 = sprintf(__('Buy the Pro version of %s for $%.2f', 'easy-common'), $plg['value'], $price);
290
+ $s4 = __('Instant download link.', 'easy-common');
291
+ $s5 = __('Pro Version', 'easy-common');
292
+ $plgKey = $this->getPlgKey($slug);
293
+ $moreInfo = "<a href='http://wordpress.org/extend/plugins/$plgKey/'>$s2</a> and <b><a href='http://buy.thulasidas.com/$slug' title='$s3. $s4' $onclick>$s5</a></b>";
294
+ $toolTip .= addslashes('<br />' . $moreInfo);
295
+ $why = addslashes($plg['pro']);
296
+
297
+ $s6 = sprintf(__('%s is available in two versions:', 'easy-common'), $value);
298
+ $s7 = sprintf(__('And it costs only $%.2f!', 'easy-common'), $price);
299
+ $s8 = __('Get the Pro version now!', 'easy-common');
300
+
301
+ echo "{$plg['blurb']} {$plg['desc']}
302
+ <br>
303
+ <br>
304
+ <b style='color:red;font-size:1.1em'>$s8</b>
305
+ <a href='http://buy.thulasidas.com/$slug' title='$s3. $s4' $onclick><img src='$plgURL/ezpaypal.png' alt='ezPayPal' class='alignright'/></a>
306
+ $s6
307
+ <ul><li>
308
+ $moreInfo
309
+ </li>
310
+ <li>$why $s7</li>
311
+ </ul></div>";
312
+ }
313
+
314
+ function renderAffiliate() {
315
+ if ($this->killAuthor) {
316
+ return;
317
+ }
318
+ $plgURL = $this->plgURL;
319
+
320
+ $roll = rand(0, 4);
321
+ if ($roll > 3) {
322
+ $select = rand(0, 4);
323
+ echo "<div style='padding:0px;border:none;text-align:center' id='support' onmouseover=\"TagToTip('proservices', WIDTH, 295, TITLE, 'Professional Services', FIX, [this, 25, 0], CLICKCLOSE, true, CLOSEBTN, true)\" ><a href='http://www.thulasidas.com/professional-php-services/' target='_blank'><img src='$plgURL/300x250-0$select.jpg' border='0' alt='Professional Services from the Plugin Author' /></a></div>";
324
+ }
325
+ else {
326
+ extract(self::$premia[$roll]);
327
+ echo "<div style='padding:0px;border:none;text-align:center' id='support' onmouseover=\"TagToTip('premium-$key', WIDTH, 295, TITLE, '$desc', FIX, [this, 25, 0], CLICKCLOSE, true, CLOSEBTN, true)\" ><a href='http://www.thulasidas.com/$key' target='_blank' onclick=\"popupwindow('http://www.thulasidas.com/$key', 'DontCare', 1000, 1024);return false;\"><img src='$plgURL/plg-$key.jpg' style='border: solid 1px' alt='$name - Another Premium Plugin the this Author' /></a></div>";
328
+ }
329
+ }
330
+
331
+ function renderSupportText() {
332
+ if ($this->killAuthor) {
333
+ return;
334
+ }
335
+ $plg = $this->plg;
336
+ $slug = $this->slug;
337
+ $long = $plg['long'];
338
+ $value = '<em><strong>' . $plg['value'] . '</strong></em>';
339
+ $supportText = "<div style=\"background-color:#cff;padding:5px;border: solid 1px\" id=\"support\"><b>Support $value. <a href=\"http://buy.thulasidas.com/$slug\" title=\"Pro version of this plugin. Instant download link.\" onclick=\"popupwindow('http://buy.thulasidas.com/$slug','Get {$plg['value']}', 1024, 768);return false;\">Go Pro!</a></b>";
340
+ if ($long) {
341
+ $longText = "Speed up your blog: ";
342
+ }
343
+ else {
344
+ $longText = '';
345
+ }
346
+ $supportText .= "<br />$longText<span onmouseover=\"TagToTip('maxcdn', WIDTH, 300, TITLE, 'What is MaxCDN?',STICKY, 1, CLOSEBTN, true, FIX, [this, -150, 2])\"><a href='http://tracking.maxcdn.com/c/95082/3964/378' target='_blank'>Use MaxCDN!</a></span>";
347
+ if ($long) {
348
+ $longText = "WordPress Hosting for ";
349
+ }
350
+ else {
351
+ $longText = 'Hosting for ';
352
+ }
353
+ $supportText .= "<br />$longText<span onmouseover=\"TagToTip('arvixe', WIDTH, 300, TITLE, 'Arvixe - My favorite provider!',STICKY, 1, CLOSEBTN, true, FIX, [this, -200, 2])\"><a href='http://www.arvixe.com/1933.html' target='_blank'>just $4/month</a></span>. ";
354
+ if ($long) {
355
+ $longText = "My books on ";
356
+ }
357
+ else {
358
+ $longText = 'Books: ';
359
+ }
360
+ $supportText .= "<br />$longText<span style=\"text-decoration:underline\" onmouseover=\"TagToTip('unreal', WIDTH, 205, TITLE, 'Buy &lt;em&gt;The Unreal Universe&lt;/em&gt;',STICKY, 1, CLOSEBTN, true, FIX, [this, 5, 2])\"><b><a href='http://buy.thulasidas.com/unreal' target='_blank'>Physics &amp; Philosophy</a></b></span> or ";
361
+ $supportText .= "<span style=\"text-decoration:underline\" onmouseover=\"TagToTip('pqd', WIDTH, 205, TITLE, '&lt;em&gt;Principles of Quant. Devel.&lt;/em&gt;',STICKY, 1, CLOSEBTN, true, FIX, [this, 5, 2])\"><b><a href='http://buy.thulasidas.com/pqd' target='_blank'>Money &amp; Finance</a></b></span>.</div>";
362
+ echo $supportText;
363
+ }
364
+
365
+ function renderTipDivs() {
366
+ $plgURL = $this->plgURL;
367
+ echo <<<ENDDIVS
368
+ <div id="arvixe" style='display:none;'>
369
+ <a href="http://www.arvixe.com/1933-27-1-310.html" target="_blank"><b>Arvixe</b></a> is my favorite hosting provider. Friendly service, extremely competitive rates, and of course a great affiliate program. My own WordPress blog and a dozen websites are hosted on their VPS. If you are looking for a new hosting provider, do check them out!
370
+ </div>
371
+
372
+ <span id="proservices" style='display:none;'>
373
+ The author of this plugin may be able to help you with your WordPress or plugin customization needs and other PHP related development. <a href='http://www.thulasidas.com/professional-php-services/' target='_blank'>Contact me</a> if you find a plugin that almost, but not quite, does what you are looking for, or if you need any other professional services. If you would like to see my credentials, take a look at <a href='http://www.thulasidas.com/col/Manoj-CV.pdf' target='_blank'>my CV</a>.
374
+ </span>
375
+
376
+ <span id="superlinks" style='display:none;'>
377
+ <a href='http://superlinks.com' target='_blank'><b>Superlinks</b></a> is an advertising network that can give AdSense a run for its money. It gives you access to Google AdExchange program, normally reserved for very high volume publishers. I have partnered with Superlinks to give you access to their offerings. If your site qualifies for Google AdX, you stand to make significantly higher returns than AdSense. Give it a shot!
378
+ </span>
379
+
380
+ <span id="maxcdn" style='display:none;'>
381
+ <a href='http://tracking.maxcdn.com/c/95082/3964/378' target='_blank'><b>MaxCDN</b></a> is a professional content delivery network. Easiest and most effective way to optimize your blog performance. Compatible with caching plugins, 24x7 professional support. Faster than most CDN providers in the continental US. Cheaper and better than most. Check it out now!
382
+ </span>
383
+
384
+ <span id="dropbox" style='display:none;'>
385
+ Dropbox! gives you 2GB of network (cloud) storage for free, which I find quite adequate for any normal user. (That sounds like the famous last words by Bill Gates, doesn’t it? “64KB of memory should be enough for anyone!”) And, you can get 250MB extra for every successful referral you make. That brings me to my ulterior motive – please use this link to sign up. When you do, I get 500MB extra. Don’t worry, you get 500MB extra as well. So I can grow my online storage up to 18GB, which should keep me happy for a long time. Thank you!
386
+ </span>
387
+
388
+ <div id="unreal" style="margin-left:auto;margin-right:auto;width:200px;display:none;">
389
+ <div style="text-align:center;width:200px;padding:1px;background:#aad;margin:2px;">
390
+ <div style="text-align:center;width:192px;height:180px;padding:2px;border:solid 1px #000;background:#ccf;margin:1px;">
391
+ <a style="text-decoration:none;" href="http://buy.thulasidas.com/unreal-universe" title="Find out more about The Unreal Universe and buy it ($1.49 for eBook, $15.95 for paperback). It will change the way you view life and reality!">
392
+ <span style="font-size:14px;font-family:arial;color:#a48;font-variant: small-caps;"><b>The Unreal Universe</b></span><br />
393
+ <small style="font-size:12px;font-family:arial;color:#000;">
394
+ A Book on Physics and Philosophy
395
+ </small>
396
+ </a>
397
+ <hr />
398
+ <table style="border-width:0;padding:2px;width:100%;margin-left:auto;margin-right:auto;border-spacing:0;border-collapse:collapse;">
399
+ <tr><td style="width:65%">
400
+ <a style="text-decoration:none;" href="http://buy.thulasidas.com/unreal-universe" title="Find out more about The Unreal Universe and buy it ($1.49 for eBook or Kindle, $15.95 for paperback). It will change the way you view life and reality!">
401
+ <small style="font-size:10px;font-family:arial;color:#000;">
402
+ Pages: 292<br />
403
+ (282 in eBook)<br />
404
+ Trimsize: 6" x 9" <br />
405
+ Illustrations: 34<br />
406
+ (9 in color in eBook)<br />
407
+ Tables: 8 <br />
408
+ Bibliography: Yes<br />
409
+ Index: Yes<br />
410
+ ISBN: 9789810575946&nbsp;<br />
411
+ <span style="font-color=#ff0000;"><b>Only $1.49!</b></span>
412
+ </small>
413
+ </a>
414
+ </td>
415
+ <td>
416
+ <a style="text-decoration:none;" href="http://buy.thulasidas.com/unreal-universe" title="Find out more about The Unreal Universe and buy it ($1.49 for eBook or Kindle, $15.95 for paperback). It will change the way you view life and reality!">
417
+ <img class="alignright" src="$plgURL/unreal.gif" alt="TheUnrealUniverse" title="Read more about The Unreal Universe" />
418
+ </a>
419
+ </td>
420
+ </tr>
421
+ </table>
422
+ </div>
423
+ </div>
424
+ </div>
425
+
426
+ <div id="pqd" style="margin-left:auto;margin-right:auto;width:200px;display:none;">
427
+ <div style="text-align:center;width:200px;padding:1px;background:#000;margin:2px;">
428
+ <div style="text-align:center;width:190px;height:185px;padding:2px;padding-top:1px;padding-left:4px;border:solid 1px #fff;background:#411;margin:1px;">
429
+ <a style="text-decoration:none;" href="http://buy.thulasidas.com/pqd" title="Buy the companion eBook to Principles of Quantitative Development from the author (only $5.49)">
430
+ <span style="font-size:14px;font-family:arial;color:#fff;font-variant: small-caps;">A Remarkable Book from Wiley-Finance</span>
431
+ </a>
432
+ <hr />
433
+ <table style="border-width:0;padding:2px;width:100%;margin-left:auto;margin-right:auto;border-spacing:0;border-collapse:collapse;">
434
+ <tr><td style="padding:0px">
435
+ <div style="border:solid 1px #faa;height:126px;width:82px;">
436
+ <a style="text-decoration:none;" href="http://buy.thulasidas.com/pqd" title="Buy the companion eBook to Principles of Quantitative Development from the author (only $5.49)">
437
+ <img src="$plgURL/pqd-82x126.gif" alt="PQD" title="Buy the companion eBook to Principles of Quantitative Development from the author (only $5.49)" />
438
+ </a>
439
+ </div>
440
+ </td>
441
+ <td style="padding:3px">
442
+ <a style="text-decoration:none;" href="http://buy.thulasidas.com/pqd" title="Buy the companion eBook to Principles of Quantitative Development from the author (only $5.49)">
443
+ <em style="font-size:14px;font-family:arial;color:#fff;">"An excellent book!"</em><br />
444
+ <small style="font-size:13px;font-family:arial;color:#faa;">&nbsp;&nbsp;&#8212; Paul Wilmott</small>
445
+ <br />
446
+ <small style="font-size:11px;font-family:arial;color:#fff;">
447
+ Want to break into the lucrative world of trading and quantitative finance? You <b>need </b> this book!
448
+ </small>
449
+ </a>
450
+ </td>
451
+ </tr>
452
+ </table>
453
+ </div>
454
+ </div>
455
+ </div>
456
+ ENDDIVS;
457
+ foreach (self::$premia as $p) {
458
+ $this->renderPremiumText($p['key']);
459
+ }
460
+ }
461
+
462
+ static function makeTextWithTooltip($text, $tip, $title = '', $width = '') {
463
+ if (!empty($title)) {
464
+ $titleText = "TITLE, '$title',STICKY, 1, CLOSEBTN, true, CLICKCLOSE, true,";
465
+ }
466
+ if (!empty($width)) {
467
+ $widthText = "WIDTH, $width,";
468
+ }
469
+ $return = "<span style='text-decoration:none' " .
470
+ "onmouseover=\"Tip('" . htmlspecialchars($tip) . "', " .
471
+ "$widthText $titleText FIX, [this, 5, 5])\" " .
472
+ "onmouseout=\"UnTip()\">$text</span>";
473
+ return $return;
474
+ }
475
+
476
+ static function makeTextWithTooltipTag($plg, $text, $tip, $title = '', $width = '') {
477
+ if (!empty($title)) {
478
+ $titleText = "TITLE, '$title',STICKY, 1, CLOSEBTN, true, CLICKCLOSE, true,";
479
+ }
480
+ if (!empty($width)) {
481
+ $widthText = "WIDTH, $width,";
482
+ }
483
+ $return = "<span style='text-decoration:none' " .
484
+ "onmouseover=\"TagToTip('" . $plg . "', " .
485
+ "$widthText $titleText FIX, [this, 5, 5])\" " .
486
+ "onmouseout=\"UnTip()\">$text</span>";
487
+ return $return;
488
+ }
489
+
490
+ function renderPlg($slug, $plg) {
491
+ if ($this->killAuthor) {
492
+ return;
493
+ }
494
+ $plgURL = $this->plgURL;
495
+ if (!empty($plg['hide']) && $plg['hide']) {
496
+ return;
497
+ }
498
+ if (!empty($plg['kind']) && $plg['kind'] != 'plugin') {
499
+ return;
500
+ }
501
+ $value = '<em><strong>' . $plg['value'] . '</strong></em>';
502
+ $desc = $plg['desc'];
503
+ $title = $plg['title'];
504
+ $url = 'http://www.thulasidas.com/plugins/' . $slug;
505
+ $link = '<b><a href="' . $url . '" target="_blank">' . $value . '</a></b>&nbsp; ';
506
+ $text = $link . $desc;
507
+ $price = $plg['price'];
508
+ $onclick = "onclick=\"popupwindow('http://buy.thulasidas.com/$slug','Get {$plg['value']}', 1024, 768);return false;\"";
509
+ $moreInfo = "&nbsp;&nbsp;<a href='http://www.thulasidas.com/plugins/$slug' title='More info about $value at Unreal Blog'>More Info</a> ";
510
+ $liteVersion = "&nbsp;&nbsp; <a href='http://buy.thulasidas.com/lite/$slug.zip' title='Download the Lite version of $value'>Get Lite Version</a> ";
511
+ $proVersion = "&nbsp;&nbsp; <a href='http://buy.thulasidas.com/$slug' title='Buy the Pro version of $value for \$$price' $onclick>Get Pro Version</a><br />";
512
+ $why = "<a href='http://buy.thulasidas.com/$slug' title='Buy the Pro version of the $slug plugin' $onclick><img src='$plgURL/ezpaypal.png' alt='ezPayPal -- Instant PayPal Shop.' class='alignright' /></a>
513
+ <br />" . $plg['pro'];
514
+ echo "<li>" . self::makeTextWithTooltip($text, $title, $value, 350) .
515
+ "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" .
516
+ self::makeTextWithTooltip($moreInfo, "Read more about $value at its own page.<br />" . $title, "More Information about $value", 300) .
517
+ self::makeTextWithTooltip($liteVersion, $title, "Download $value - the Lite version", 300) .
518
+ self::makeTextWithTooltipTag($slug, $proVersion, $why, "Get $value Pro!", 300) .
519
+ "<span id=$slug> $why </span>" .
520
+ "</li>\n";
521
+ }
522
+
523
+ function renderBook($slug, $plg) {
524
+ if ($this->killAuthor) {
525
+ return;
526
+ }
527
+ $plgURL = $this->plgURL;
528
+ if (empty($plg['kind']) || $plg['kind'] != 'book') {
529
+ return;
530
+ }
531
+ $value = '<em><strong>' . $plg['value'] . '</strong></em>';
532
+ $desc = $plg['desc'];
533
+ $title = $plg['title'];
534
+ $url = $plg['url'];
535
+ $link = '<b><a href="' . $url . '" target="_blank">' . $value . '</a></b>&nbsp; ';
536
+ $text = $link . $desc;
537
+ $price = $plg['price'];
538
+ $onclick = "onclick=\"popupwindow('http://buy.thulasidas.com/$slug','Get {$plg['value']}', 1024, 768);return false;\"";
539
+ $moreInfo = "&nbsp;&nbsp; <a href='$url' title='More info about $value' target=_blank>More Info</a> ";
540
+ $amazon = $plg['amazon'];
541
+ if (!empty($amazon)) {
542
+ $buyAmazon = "&nbsp;&nbsp; <a href='$amazon' title='Get $value from Amazon.com' target=_blank>Get it at Amazon</a> ";
543
+ }
544
+ $buyNow = "&nbsp;&nbsp; <a href='http://buy.thulasidas.com/$slug' title='Buy and download $value for \$$price' target=_blank $onclick>Buy and Download now!</a><br />";
545
+ $why = "<a href='http://buy.thulasidas.com/$slug' title='$slug' $onclick><img src='$plgURL/ezpaypal.png' alt='ezPayPal -- Instant PayPal Shop.' class='alignright' /></a>
546
+ <br />" . $title . $desc . " $value costs only \$$price -- direct from the author.";
547
+ echo "<li>" . self::makeTextWithTooltip($text, $title, $value, 350) .
548
+ "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" .
549
+ self::makeTextWithTooltip($moreInfo, "Read all about $value at its own site.<br />", "$value", 300) .
550
+ self::makeTextWithTooltip($buyAmazon, $title, "Buy $value from Amazon", 350) .
551
+ self::makeTextWithTooltipTag("$slug-book", $buyNow, $why, "Buy $value!", 300) .
552
+ "<span id=$slug-book> $why </span>" .
553
+ "</li>\n";
554
+ }
555
+
556
+ function getPlgInfo() {
557
+ $me = $this->slug;
558
+ $plugins = get_plugins();
559
+ $ret = array('Version' => '', 'Info' => '');
560
+ $break = '';
561
+ foreach ($plugins as $k => $p) {
562
+ $baseDir = dirname($k);
563
+ $baseDirSmall = str_replace("-lite", "", $baseDir);
564
+ if ($baseDir == $me || $baseDirSmall == $me) {
565
+ $version = $p['Version'];
566
+ if (!empty($_SERVER['HTTP_REFERER'])) {
567
+ $referer = $_SERVER['HTTP_REFERER'];
568
+ }
569
+ else {
570
+ $referer = 'Unknown';
571
+ }
572
+ $info = "$break{$p['Title']} V{$p['Version']} (Referer: $referer)";
573
+ $ret[] = array('Version' => $version, 'Info' => $info);
574
+ }
575
+ }
576
+ return $ret;
577
+ }
578
+
579
+ function renderSupport() {
580
+ echo '<div style="background-color:#fcf;padding:5px;border: solid 1px;margin:5px;">
581
+ ';
582
+ $plgURL = $this->plgURL;
583
+ $plg = $this->plg;
584
+ $slug = $this->slug;
585
+ $value = $plg['value'];
586
+ $url = 'http://www.thulasidas.com/plugins/' . $slug . '#faq';
587
+ $link = '<a href="' . $url . '" target="_blank">' . $value . '</a>';
588
+ echo "&nbsp;<a href='http://support.thulasidas.com' onclick=\"popupwindow('http://support.thulasidas.com','ezSupport for $value', 1024, 768);return false;\" title='";
589
+ _e('Ask a support question (in English or French only) via ezSupport @ $0.95', 'easy-common');
590
+ echo "'><img src='$plgURL/ezsupport.png' class='alignright' alt='ezSupport Portal'/></a>";
591
+ printf(__("If you need help with %s, please read the FAQ section on the %s page. It may answer all your questions.", 'easy-common'), $value, $link);
592
+ echo "<br style='line-height: 20px;'/>";
593
+ _e("Or, if you still need help, you can raise a support ticket.", 'easy-common');
594
+ echo "&nbsp;<a href='http://support.thulasidas.com' onclick=\"popupwindow('http://support.thulasidas.com','ezSupport', 1024, 768);return false;\" title='";
595
+ _e('Ask a support question (in English or French only) via ezSupport @ $0.95', 'easy-common');
596
+ echo "'>";
597
+ _e("[Request Paid Support]", 'easy-common');
598
+ $info = $this->getPlgInfo();
599
+ echo "</a>&nbsp;<small><em>[";
600
+ _e('Using our ezSupport Ticket System.', 'easy-common');
601
+ echo "]</em></small>";
602
+ echo "<small style='float:right'><em>[";
603
+ printf(__('You are using %s (V%s)', 'easy-common'), $value, $info[0]['Version']);
604
+ echo "]</em></small>";
605
+ $_SESSION['ezSupport'] = $info[0]['Info'];
606
+ echo "</div>";
607
+ }
608
+
609
+ function renderWhyPro($short = false) {
610
+ if ($this->killAuthor && !$short) {
611
+ return;
612
+ }
613
+ $plgURL = $this->plgURL;
614
+ $plg = $this->plg;
615
+ $slug = $this->slug;
616
+ $value = $plg['value'];
617
+ $toolTip = $plg['title'];
618
+ $price = $plg['price'];
619
+ $buyURL = "http://buy.thulasidas.com/$slug";
620
+ $infoURL = "http://www.thulasidas.com/plugins/$slug";
621
+ $s1 = sprintf(__('Get %s', 'easy-common'), $value);
622
+ $s2 = sprintf(__('More info about %s', 'easy-common'), $value);
623
+ $s3 = sprintf(__('Buy the Pro version of %s for $%.2f', 'easy-common'), $value, $price);
624
+ $s4 = __('More Info', 'easy-common');
625
+
626
+ $onclick = "onclick=\"popupwindow('$buyURL','$s1', 1024, 768);return false;\"";
627
+ $moreInfo = " &nbsp; &nbsp; <a href='$infoURL' title='$s2' target=_blank> $s4 </a>&nbsp; <a href='$buyURL' $onclick title='$s3'>Get Pro Version</a>";
628
+ $toolTip .= addslashes('<br />' . $moreInfo);
629
+ $why = addslashes($plg['pro']);
630
+ echo '<div style="background-color:#cff;padding:5px;border: solid 1px;margin:5px;padding-bottom:15px;">';
631
+ if ($short) {
632
+ $s5 = __('Buy the Pro Version', 'easy-common');
633
+ $s6 = __('More features, more power!', 'easy-common');
634
+
635
+ echo "<span onmouseover=\"TagToTip('pro', WIDTH, 350, TITLE, 'Buy the Pro Version',STICKY, 1, CLOSEBTN, true, CLICKCLOSE, true, FIX, [this, 5, 5])\"><b><a href='$buyURL' $onclick target='_blank'>$s5</a></b>&nbsp; $s6</span>";
636
+ }
637
+ else {
638
+ $s7 = sprintf(__('You are using the Lite version of %s, which is available in two versions: <b>Lite</b> and <b>Pro</b>.', 'easy-common'), $value);
639
+ echo "<b>Get Pro Version!</b>
640
+ <a href='http://buy.thulasidas.com/$slug' title='$s3'><img src='$plgURL/ezpaypal.png' alt='ezPayPal' class='alignright' $onclick /></a>
641
+ <br />
642
+ $s7
643
+ <ul><li>
644
+ $moreInfo
645
+ <li>$why</li>
646
+ </ul>";
647
+ }
648
+ echo '</div>';
649
+ }
650
+
651
+ }
652
+
653
+ }
EzGA.php DELETED
@@ -1,1017 +0,0 @@
1
- <?php
2
-
3
- // Suppress errors on AJAX requests
4
- if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
5
- strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
6
- error_reporting(E_ERROR | E_PARSE);
7
- // CORS headers
8
- header("access-control-allow-origin: *", true);
9
- header("access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS", true);
10
- }
11
-
12
- if (!class_exists("EzGA")) {
13
-
14
- require_once 'EZWP.php';
15
-
16
- class EzGA extends EZWP {
17
-
18
- static $metaOptions = array();
19
- static $plgPrice = array('easy-adsense' => 7.95,
20
- 'adsense-now' => 6.95,
21
- 'google-adsense' => 9.45);
22
- static $border = '';
23
- static $kills = array('feed', 'page', 'sticky', 'home', 'front_page', 'category',
24
- 'tag', 'archive', 'search', 'single', 'attachment');
25
- static $unSettable = array('Phone', 'Tablet', 'All', 'Mobile');
26
- static $noAds = false;
27
- static $noAdsReason = '';
28
-
29
- static function isActive() {
30
- if (!function_exists('is_plugin_active')) {
31
- include_once ABSPATH . 'wp-admin/includes/plugin.php';
32
- }
33
- $plgSlug = self::getPlgMode();
34
- $plgSlug = str_replace("-ultra", "", $plgSlug);
35
- $plugin = basename(dirname(__FILE__)) . "/$plgSlug.php";
36
- return is_plugin_active($plugin);
37
- }
38
-
39
- static function isLoggedIn() {
40
- if (!defined('WP_USE_THEMES')) {
41
- define('WP_USE_THEMES', false);
42
- }
43
- if (!defined('WP_INSTALLING')) {
44
- define('WP_INSTALLING', true);
45
- }
46
- global $wpdb; // used within $wpHeader later for multisite. Do not remove!
47
- $isLoggedIn = false;
48
- // check from admin and ajax
49
- foreach (array("../../../..", "../../../../..") as $dir) {
50
- $wpHeader = "$dir/wp-blog-header.php";
51
- if (@file_exists($wpHeader)) {
52
- require_once $wpHeader;
53
- break;
54
- }
55
- }
56
- if (function_exists('current_user_can')) {
57
- if (current_user_can('manage_options')) {
58
- $isLoggedIn = true;
59
- }
60
- }
61
- return $isLoggedIn;
62
- }
63
-
64
- static function doPluginActions() {
65
- $suspend_ads = self::getGenOption('suspend_ads');
66
- if (!empty($suspend_ads)) {
67
- return;
68
- }
69
- $plugin_slug = self::getSlug();
70
- require_once plugin_dir_path(__FILE__) . $plugin_slug . '-frontend.php';
71
- }
72
-
73
- static function urlExists($url) {//se passar a URL existe
74
- $c = curl_init();
75
- curl_setopt($c, CURLOPT_URL, $url);
76
- curl_setopt($c, CURLOPT_HEADER, 1); //get the header
77
- curl_setopt($c, CURLOPT_NOBODY, 1); //and *only* get the header
78
- curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); //get the response as a string from curl_exec(), rather than echoing it
79
- curl_setopt($c, CURLOPT_FRESH_CONNECT, 1); //don't use a cached version of the url
80
- if (!curl_exec($c)) {
81
- return false;
82
- }
83
- else {
84
- return true;
85
- }
86
- //$httpcode=curl_getinfo($c,CURLINFO_HTTP_CODE);
87
- //return ($httpcode<400);
88
- }
89
-
90
- static function validate_url($url) {
91
- $format = "Use the format http[s]://[www].site.com[/file[?p=v]]";
92
- if (!filter_var($url, FILTER_VALIDATE_URL)) {
93
- $text = "$format";
94
- return $text;
95
- }
96
- $pattern = '#^(http(?:s)?\:\/\/[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,6}(?:\/?|(?:\/[\w\-]+)*)(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$#';
97
- if (!preg_match($pattern, $url)) {
98
- $text = "$format";
99
- return $text;
100
- }
101
- if (!self::urlExists($url)) {
102
- $text = "URL not accessible";
103
- return $text;
104
- }
105
- return true;
106
- }
107
-
108
- static function validate_email($s) {
109
- if (!filter_var($s, FILTER_VALIDATE_EMAIL)) {
110
- return "Bad email address";
111
- }
112
- return true;
113
- }
114
-
115
- static function validate_notNull($s) {
116
- $s = trim($s);
117
- if (empty($s)) {
118
- return "Null value not allowed";
119
- }
120
- return true;
121
- }
122
-
123
- static function validate_number($s) {
124
- if (!is_numeric($s)) {
125
- return "Need a number here";
126
- }
127
- return true;
128
- }
129
-
130
- static function validate_alnum($s) {
131
- $aValid = array('_', '-');
132
- $s = str_replace($aValid, '', $s);
133
- if (!ctype_alnum($s)) {
134
- return "Please use only letters, numbers, - and _";
135
- }
136
- return true;
137
- }
138
-
139
- // AJAX CRUD implementation. Create.
140
- static function create() { // creates a new DB record
141
- self::update();
142
- }
143
-
144
- // AJAX CRUD implementation. Delete.
145
- static function read() {
146
- // not implemented
147
- }
148
-
149
- // AJAX CRUD implementation. Update using wpdb->replace()
150
- static function update() {
151
- $posted_pk = $posted_name = $posted_value = $posted_validator = "";
152
- if (!EzGA::isLoggedIn()) {
153
- http_response_code(400);
154
- die("Please login before changing options!");
155
- }
156
- global $wpdb;
157
- if (empty($wpdb)) {
158
- http_response_code(400);
159
- die("Global variable wpdb not set!");
160
- }
161
- $table = $wpdb->prefix . "ez_adsense_options";
162
- $row = array();
163
- extract($_POST, EXTR_PREFIX_ALL, 'posted');
164
- if (empty($posted_pk)) {
165
- http_response_code(400);
166
- die("Empty primary key");
167
- }
168
- if (empty($posted_name)) {
169
- http_response_code(400);
170
- die("Empty name ($posted_name) in data");
171
- }
172
- if (!isset($posted_value)) { // Checkbox, unchecked
173
- $posted_value = 0;
174
- }
175
- if (is_array($posted_value)) { // Checkbox (from checklist), checked
176
- $posted_value = 1;
177
- }
178
- if (!empty($posted_validator)) { // a server-side validator is specified
179
- $fun = "validate_$posted_validator";
180
- if (method_exists('EzGA', $fun)) {
181
- $valid = self::$fun($posted_value);
182
- }
183
- else {
184
- http_response_code(400);
185
- die("Unknown validator ($posted_validator) specified");
186
- }
187
- if ($valid !== true) {
188
- http_response_code(400);
189
- die("$valid");
190
- }
191
- }
192
- $row['name'] = $posted_pk;
193
- $row['value'] = $posted_value;
194
- foreach (array('plugin_slug', 'theme', 'provider', 'optionset') as $col) {
195
- $posted = "posted_$col";
196
- if (!empty($$posted)) {
197
- $row[$col] = $$posted;
198
- }
199
- else {
200
- $row[$col] = "All";
201
- }
202
- }
203
- $status = $wpdb->replace($table, $row);
204
- if ($status === false) {
205
- http_response_code(400);
206
- die("Database Replace/Insert Error");
207
- }
208
- http_response_code(200);
209
- exit();
210
- }
211
-
212
- // AJAX CRUD implementation. Delete.
213
- static function delete() {
214
- // not implemented
215
- }
216
-
217
- static function isAssoc($options) {
218
- $isAssoc = count(array_filter(array_keys($options), 'is_string')) > 0;
219
- return $isAssoc;
220
- }
221
-
222
- static function mkSelectSource($options) {
223
- $isAssoc = self::isAssoc($options);
224
- $source = "[";
225
- foreach ($options as $k => $o) {
226
- if ($isAssoc) {
227
- $source .= "{value: '$k', text: '$o'},";
228
- }
229
- else {
230
- $source .= "{value: '$o', text: '$o'},";
231
- }
232
- }
233
- $source .= "]";
234
- return $source;
235
- }
236
-
237
- static function getThemes($killCurrent = true) {
238
- global $wpdb;
239
- $table = $wpdb->prefix . "ez_adsense_options";
240
- $sql = "SELECT DISTINCT theme FROM $table ";
241
- $themsDB = $wpdb->get_results($sql);
242
- $themes = array();
243
- foreach ($themsDB as $t) {
244
- if ($t->theme != 'All') {
245
- $themes[] = $t->theme;
246
- }
247
- }
248
- $theme = array(get_option('stylesheet'));
249
- if ($killCurrent) {
250
- $themes = array_diff($themes, $theme);
251
- }
252
- $themes = array_values($themes);
253
- return $themes;
254
- }
255
-
256
- static function getOptionSets($settableOnly = false) {
257
- global $wpdb;
258
- $table = $wpdb->prefix . "ez_adsense_options";
259
- $plugin_slug = self::getSlug();
260
- $sql = "SELECT DISTINCT optionset FROM $table WHERE plugin_slug = '$plugin_slug'";
261
- $optionSetsDB = $wpdb->get_results($sql);
262
- $optionSets = array();
263
- foreach ($optionSetsDB as $t) {
264
- if ($t->optionset != 'All') {
265
- $optionSets[] = $t->optionset;
266
- }
267
- }
268
- if ($settableOnly) {
269
- $unSettable = self::$unSettable;
270
- $unSettable[] = self::getGenOption('optionset');
271
- $optionSets = array_diff($optionSets, $unSettable);
272
- }
273
- $optionSets = array_values($optionSets);
274
- return $optionSets;
275
- }
276
-
277
- static function setOptionset($name) {
278
- self::$options = self::getOptions($name);
279
- self::putGenOption('editing', $name);
280
- if (!in_array($name, self::$unSettable)) {
281
- self::putGenOption('optionset', $name);
282
- }
283
- }
284
-
285
- static function getAllOptions() {
286
- global $wpdb;
287
- $table = $wpdb->prefix . "ez_adsense_options";
288
- $sql = "SELECT name, value FROM $table WHERE plugin_slug='All' AND theme='All' AND provider='All' AND optionset='All'";
289
- $row = $wpdb->get_results($sql);
290
- $options = array();
291
- if (!empty($row)) {
292
- foreach ($row as $r) {
293
- $options[$r->name] = $r->value;
294
- }
295
- }
296
- return $options;
297
- }
298
-
299
- static function getOptions($optionset = "", $provider = "AdSense") {
300
- $allOptions = self::getAllOptions();
301
- global $wpdb;
302
- $table = $wpdb->prefix . "ez_adsense_options";
303
- if (empty($optionset)) {
304
- if (is_admin()) {
305
- $optionset = self::getGenOption('editing');
306
- }
307
- else {
308
- $optionset = self::getGenOption('optionset');
309
- }
310
- }
311
- if (empty($optionset)) {
312
- $optionset = "Default";
313
- self::setOptionset($optionset);
314
- }
315
- $plugin_slug = self::getSlug();
316
- $lookup = array('google-adsense' => 'Google AdSense', 'easy-adsense' => 'Easy AdSense', 'adsense-now' => 'AdSense Now!');
317
- $plugin = $lookup[$plugin_slug];
318
- $theme = get_option('stylesheet');
319
- self::putGenOption('theme', $theme);
320
- $sql = "SELECT name,value FROM $table WHERE plugin_slug='$plugin_slug' AND theme='$theme' AND provider='$provider' AND optionset='$optionset'";
321
- $rows = $wpdb->get_results($sql);
322
- $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.';
323
- $options = compact('plugin', 'theme', 'provider', 'optionset', 'plugin_slug', 'defaultText');
324
- foreach ($rows as $row) {
325
- $options[$row->name] = $row->value;
326
- }
327
- self::$options = $options = array_merge($allOptions, $options);
328
- require "admin/$plugin_slug-options.php";
329
- $defaults = EzGA::getDefaults($ezOptions);
330
- self::$options = $options = array_merge($defaults, $options);
331
- return $options;
332
- }
333
-
334
- static function info($hide = true) {
335
- if (!function_exists('get_plugin_data')) {
336
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
337
- }
338
- $dir = plugin_dir_path(__FILE__);
339
- $slug = '';
340
- foreach (self::$plgPrice as $plg => $price) {
341
- if (strpos($dir, $plg) !== false) {
342
- $slug = $plg;
343
- break;
344
- }
345
- }
346
- $plugin_data = get_plugin_data("$dir$slug.php");
347
- $str = "{$plugin_data['Name']} V{$plugin_data['Version']}";
348
- if ($hide) {
349
- $str = "<!-- $str -->";
350
- }
351
- return $str;
352
- }
353
-
354
- static function getDefaults($ezOptions, $echo = false) {
355
- $defaults = array();
356
- $msg = '<pre>';
357
- foreach ($ezOptions as $k => $v) {
358
- if (isset($v['value'])) {
359
- $defaults[$k] = $v['value'];
360
- }
361
- else {
362
- $msg .= "No default for <code>$k</code>\n";
363
- }
364
- }
365
- $msg .= "</pre>";
366
- if ($echo) {
367
- echo $msg;
368
- }
369
- return $defaults;
370
- }
371
-
372
- static function putDefaults($ezOptions, $optionset = '', $force = false, $provider = "AdSense") {
373
- $row = array();
374
- foreach (array('plugin_slug', 'theme', 'provider', 'optionset') as $col) {
375
- $row[$col] = self::$options[$col];
376
- }
377
- if (!empty($optionset)) {
378
- $row['optionset'] = $optionset;
379
- }
380
- global $wpdb;
381
- $table = $wpdb->prefix . "ez_adsense_options";
382
- $defaults = self::getDefaults($ezOptions);
383
- foreach ($defaults as $name => $value) {
384
- if ($force || !isset(self::$options[$name])) {
385
- $row['name'] = $name;
386
- $row['value'] = $value;
387
- $wpdb->replace($table, $row);
388
- }
389
- }
390
- }
391
-
392
- static function renderOption($pk, $option) {
393
- $optionsDB = EzGA::$options;
394
- if (isset($optionsDB[$pk])) {
395
- $value = $optionsDB[$pk];
396
- $option['value'] = $value;
397
- if (!empty($option['options']) && is_array($option['options']) && self::isAssoc($option['options'])) {
398
- $option['value'] = $option['options'][$value];
399
- }
400
- }
401
- return self::renderRow($pk, $option);
402
- }
403
-
404
- static function renderOptionCell($pk, $option) {
405
- $optionsDB = EzGA::$options;
406
- if (isset($optionsDB[$pk])) {
407
- $value = $optionsDB[$pk];
408
- $option['value'] = $value;
409
- if (!empty($option['type']) && $option['type'] == 'select' &&
410
- !empty($option['options']) && is_array($option['options']) &&
411
- self::isAssoc($option['options'])
412
- ) {
413
- $option['key'] = $value;
414
- $option['value'] = $option['options'][$value];
415
- }
416
- }
417
- $name = $option['name'];
418
- if (!empty($option['type'])) {
419
- $type = $option['type'];
420
- }
421
- else {
422
- $type = 'text';
423
- }
424
- $helpAttr = self::renderHelpAttr($pk, $option);
425
- switch ($type) {
426
- case 'textarea':
427
- $value = self::renderOptionValue($pk, $option);
428
- $cell = "<div $helpAttr class='form-group ez-wide'><label>$name</label><span class='form-control' style='display:inline-block;height:120px;overflow-y:scroll'>$value</span></div>";
429
- break;
430
- case 'colorpicker': // render as a <div> with a colorpicker
431
- $value = self::renderOptionValue($pk, $option);
432
- $cell = "<div $helpAttr class='ez-row'><div class='col-lg-5' style='height:43px'><label class='ez-row' for='$pk-value'>$name</label></div><div class='col-lg-7'><div class='input-group colorpicker'>$value</div></div></div>";
433
- break;
434
- case 'colorpicker2': // render as a <div> with a wider colorpicker
435
- $option['type'] = 'colorpicker';
436
- $value = self::renderOptionValue($pk, $option);
437
- $cell = "<div $helpAttr class='ez-row'><div class='col-lg-3' style='height:43px'><label class='ez-row' for='$pk-value'>$name</label></div><div class='col-lg-9'><div class='input-group colorpicker'>$value</div></div></div>";
438
- break;
439
- case 'radio': // render as <tr>
440
- $value = self::renderOptionValue($pk, $option);
441
- $cell = "<tr $helpAttr><td>$name</td>";
442
- foreach ($option['options'] as $k => $o) {
443
- if (!empty($optionsDB[$pk]) && $optionsDB[$pk] !== 0 && $optionsDB[$pk] == $o) {
444
- $checked = "checked='checked'";
445
- }
446
- else {
447
- $checked = '';
448
- }
449
- $cell .= "<td class='center-text'><input $checked type='radio' name='$pk' id='$pk-$k' data-value='$o'></td>";
450
- }
451
- $cell .= "</tr>\n";
452
- break;
453
- case 'radio2': // render as a line
454
- if (empty($option['noCenter'])) {
455
- $class = "class='center-block'";
456
- }
457
- else {
458
- $class = "";
459
- }
460
- $cell = "<div $class $helpAttr><label>$name</label><div style='padding:10px;border: 1px solid #ccc;'>";
461
- foreach ($option['options'] as $o => $v) {
462
- if (!empty($optionsDB[$pk]) && $optionsDB[$pk] !== 0 && $optionsDB[$pk] == $o) {
463
- $checked = "checked='checked'";
464
- }
465
- else {
466
- $checked = '';
467
- }
468
- $cell .= "<span style='padding-right:10px;display:inline-block'><input $checked type='radio' name='$pk' id='$pk-$o' data-value='$o'> $v</span>";
469
- }
470
- $cell .= "</div></div>\n";
471
- break;
472
- case 'checkbox2': // render in two <td>s
473
- $option['type'] = 'checkbox';
474
- $value = self::renderOptionValue($pk, $option);
475
- $cell = "<td $helpAttr>$name</td><td class='center-text'>$value</td>";
476
- break;
477
- default:
478
- if (empty($option['noCenter'])) {
479
- $center = "center-block";
480
- }
481
- else {
482
- $center = "";
483
- }
484
- $value = self::renderOptionValue($pk, $option);
485
- $cell = "<div $helpAttr class='form-group $center'><label>$name</label><span class='form-control'>$value</span></div>";
486
- }
487
- return $cell;
488
- }
489
-
490
- static function renderHelpAttr($pk, $option, $tip = false) {
491
- $placement = $type = $dataMode = $name = $more_help = $help = "";
492
- extract($option);
493
- if (empty($placement)) {
494
- if ($dataMode == 'popup' || $type == 'checkbox') {
495
- $placement = 'bottom';
496
- }
497
- else {
498
- $placement = 'top';
499
- }
500
- }
501
- if (!empty($more_help)) {
502
- $clickHelp = "class='btn-help'";
503
- }
504
- else {
505
- $clickHelp = '';
506
- }
507
- if ($tip) {
508
- return "data-toggle='tooltip' data-placement='top' title='$name<br>$help'p";
509
- }
510
- else {
511
- return "data-content='$help' data-help='$more_help' data-toggle='popover' data-placement='$placement' data-trigger='hover' title='$name' $clickHelp";
512
- }
513
- }
514
-
515
- static function renderOptionHelp($pk, $option, $size = "1.5em") {
516
- $type = $name = $more_help = $help = "";
517
- extract($option);
518
- if ($type == 'hidden') {
519
- $tr = '';
520
- return $tr;
521
- }
522
- if (!empty($more_help)) {
523
- $clickHelp = "class='btn-help'";
524
- }
525
- else {
526
- $clickHelp = '';
527
- }
528
- $helpAttr = self::renderHelpAttr($pk, $option);
529
- $str = "<a style='font-size:$size' $helpAttr><i class='glyphicon glyphicon-question-sign blue'></i></a>\n";
530
- return $str;
531
- }
532
-
533
- static function renderRow($pk, $option) {
534
- $type = $name = "";
535
- extract($option);
536
- if ($type == 'hidden') {
537
- $str = '';
538
- return $str;
539
- }
540
- $str = "<tr><td>$name</td>";
541
- $str .= "<td>"
542
- . self::renderOptionValue($pk, $option)
543
- . "</td><td class='center-text'>"
544
- . self::renderOptionHelp($pk, $option)
545
- . "</td></tr>\n";
546
- return $str;
547
- }
548
-
549
- static function renderOptionValue($pk, $option, $dbValue = "") {
550
- $type = 'text';
551
- $dataMode = "data-mode='inline'";
552
- $options = array(); // for select and radio controls
553
- $value = $more_help = $dataValue = $dataTpl = $dataSource = $slug = $validator = $button = $reveal = "";
554
- extract($option);
555
- if ($dataMode == 'popup') {
556
- $dataMode = "data-mode='popup'";
557
- }
558
- else {
559
- $dataMode = "data-mode='inline'";
560
- }
561
- if (!empty($dbValue)) {
562
- $value = $dbValue;
563
- }
564
- if ($type == 'hidden') {
565
- $str = '';
566
- return $str;
567
- }
568
- $dataType = "data-type='$type'";
569
- if (!empty($more_help)) {
570
- $clickHelp = "class='btn-help'";
571
- }
572
- else {
573
- $clickHelp = '';
574
- }
575
- if (empty($slug)) {
576
- $slug = "$pk-value";
577
- }
578
- switch ($type) {
579
- case 'radio':
580
- return '';
581
- case 'no-edit':
582
- $class = "black";
583
- break;
584
- case 'checkbox' :
585
- $class = "xedit-checkbox";
586
- $dataType = "data-type='checklist'";
587
- $dataMode = '';
588
- $dataValue = "data-value='$value'";
589
- if ($value) {
590
- $class .= ' btn-sm btn-success';
591
- $value = "";
592
- }
593
- else {
594
- $class .= ' btn-sm btn-danger';
595
- $value = "";
596
- }
597
- break;
598
- case 'select':
599
- $class = "xedit";
600
- $dataType = "data-type='select'";
601
- if (!empty($key)) {
602
- $dataValue = "data-value='$key'";
603
- }
604
- else {
605
- $dataValue = "data-value='$value'";
606
- }
607
- $dataSource = 'data-source="' . self::mkSelectSource($options) . '"';
608
- break;
609
- case 'file': // special case, return from here
610
- $type = '';
611
- $class = 'red';
612
- $value = "<input data-pk='$pk' id='fileinput' type='file' class='file' multiple=true data-show-preview='false' data-show-upload='false'>";
613
- break;
614
- case 'colorpicker':
615
- $str = "<input id='$slug' class='form-control' type='text' value='$value' /><span class='input-group-addon' style='width:50%'><i style='width:80%'></i></span>";
616
- break;
617
- case 'submit':
618
- case 'button':
619
- $class = "btn btn-primary btn-ez";
620
- break;
621
- case 'textarea':
622
- $str = "<a href='#' class='xedit' data-type='textarea' $dataMode data-pk='$pk' data-name='value'>" . htmlspecialchars(stripslashes($value)) . "</a>";
623
- break;
624
- case 'dbselect':
625
- case 'dbeditableselect':
626
- case 'editableselect':
627
- case 'text':
628
- default :
629
- $class = "xedit";
630
- break;
631
- }
632
- if (!empty($validator)) {
633
- $valid = "data-validator='$validator'";
634
- }
635
- else {
636
- $valid = "";
637
- }
638
- if (!empty($button)) {
639
- $fun = "proc_$reveal";
640
- $options = self::$options;
641
- if (!empty($options[$reveal])) {
642
- $revealOption = $options[$reveal];
643
- }
644
- else {
645
- $revealOption = '';
646
- }
647
- if (method_exists("EzGA", $fun)) {
648
- $dataReveal = @self::$fun($revealOption);
649
- }
650
- else {
651
- $dataReveal = "data-value='$revealOption' class='btn-sm btn-success reveal'";
652
- }
653
- $reveal = "<a href='#' style='float:right' $dataReveal>$button</a>";
654
- }
655
- else {
656
- $reveal = '';
657
- }
658
- if (empty($str)) {
659
- $str = "<input id='$slug' style='display:none'><a class='$class' data-name='$slug' data-pk='$pk' $dataType $dataMode $dataValue $dataTpl $dataSource $valid>$value $reveal</a>\n";
660
- }
661
- return $str;
662
- }
663
-
664
- static function isUpdateAvailable() { // not ready yet
665
- return false;
666
- }
667
-
668
- static function randString($len = 32) {
669
- $chars = 'abcdefghijklmnopqrstuvwxyz';
670
- $chars .= strtoupper($chars) . '0123456789';
671
- $charLen = strlen($chars) - 1;
672
- $string = '';
673
- for ($i = 0; $i < $len; $i++) {
674
- $pos = rand(0, $charLen);
675
- $string .= $chars[$pos];
676
- }
677
- return $string;
678
- }
679
-
680
- static function flashMsg($msg, $class, $noflash = false, $noPre = false) {
681
- if ($noflash) {
682
- $fun = "show";
683
- }
684
- else {
685
- $fun = "flash";
686
- }
687
- $cleaned = str_replace(array("\n"), array('\n'), $msg);
688
- if (!empty($cleaned)) {
689
- $msg = htmlspecialchars($cleaned);
690
- if (!$noPre) {
691
- $msg = "<pre>$msg</pre>";
692
- }
693
- echo '<script>$(document).ready(function() {' .
694
- $fun . $class . '("' . $msg . '");
695
- });
696
- </script>';
697
- }
698
- }
699
-
700
- static function flashError($msg, $noPre = false) {
701
- self::flashMsg($msg, 'Error', false, $noPre);
702
- }
703
-
704
- static function showError($msg, $noPre = false) {
705
- self::flashMsg($msg, 'Error', true, $noPre);
706
- }
707
-
708
- static function flashWarning($msg, $noPre = false) {
709
- self::flashMsg($msg, 'Warning', false, $noPre);
710
- }
711
-
712
- static function showWarning($msg, $noPre = false) {
713
- self::flashMsg($msg, 'Warning', true, $noPre);
714
- }
715
-
716
- static function flashSuccess($msg, $noPre = false) {
717
- self::flashMsg($msg, 'Success', false, $noPre);
718
- }
719
-
720
- static function showSuccess($msg, $noPre = false) {
721
- self::flashMsg($msg, 'Success', true, $noPre);
722
- }
723
-
724
- static function flashInfo($msg, $noPre = false) {
725
- self::flashMsg($msg, 'Info', false, $noPre);
726
- }
727
-
728
- static function showInfo($msg, $noPre = false) {
729
- self::flashMsg($msg, 'Info', true, $noPre);
730
- }
731
-
732
- static function toggleMenu($header) {
733
- if (!empty($_SERVER["HTTP_REFERER"])) {
734
- $referer = $_SERVER["HTTP_REFERER"];
735
- }
736
- else {
737
- $referer = '';
738
- }
739
- $standAlone = (strpos($referer, 'wp-admin/options-general.php') === false) && !isset($_REQUEST['inframe']);
740
- if (!$standAlone) {
741
- $search = array('<div class="col-sm-2 col-lg-2">',
742
- '<div class="sidebar-nav">',
743
- '<div class="nav-canvas">',
744
- '<ul class="nav nav-pills nav-stacked main-menu">',
745
- '<li class="accordion">',
746
- '<ul class="nav nav-pills nav-stacked">',
747
- '<a href="#">',
748
- '<div id="content" class="col-lg-10 col-sm-10">');
749
- $replace = array('<div>',
750
- '<div>',
751
- '<div>',
752
- '<ul class="nav nav-pills main-menu">',
753
- '<li class="dropdown">',
754
- '<ul class="dropdown-menu">',
755
- '<a href="#" data-toggle="dropdown">',
756
- '<div id="content" class="col-lg-12 col-sm-12">');
757
- $header = str_replace($search, $replace, $header);
758
- }
759
- return $header;
760
- }
761
-
762
- static function showService() {
763
- $select = rand(0, 4);
764
- echo "<div class='center-block' style='margin-left:10px;'><a href='http://www.thulasidas.com/professional-php-services/' target='_blank' title='Professional Services' data-content='The author of this plugin may be able to help you with your WordPress or plugin customization needs and other PHP related development. Find a plugin that almost, but not quite, does what you are looking for? Need any other professional PHP/jQuery dev services? Click here!' data-toggle='popover' data-trigger='hover' data-placement='left'><img src='img/svcs/300x250-0$select.jpg' border='0' alt='Professional Services from the Plugin Author' /></a></div><div class='clearfix'></div>";
765
- }
766
-
767
- // Frontend functions
768
-
769
- static function preFilter($content, $isWidget = false) {
770
- $plgName = self::getPlgName();
771
- if (self::$noAds) {
772
- $reason = self::$noAdsReason;
773
- return $content . " <!-- $plgName: PreFiltered - NoAds [ $reason] -->\n";
774
- }
775
- $killed = self::isKilled();
776
- if (!empty($killed)) {
777
- $reason = "is Killed - $killed. ";
778
- self::$noAds = true;
779
- self::$noAdsReason .= $reason;
780
- return $content . " <!-- $plgName: $reason -->\n";
781
- }
782
- if (empty(self::$options['allow_feeds']) && is_feed()) {
783
- $reason = 'is Feed and not allowed. ';
784
- self::$noAds = true;
785
- self::$noAdsReason .= $reason;
786
- return $content . " <!-- $plgName: $reason -->\n";
787
- }
788
-
789
- $metaOptions = self::getMetaOptions();
790
- if (strpos($content, "<!--noadsense-->") !== false) {
791
- $reason = 'Unfiltered - suppressed by noadsense comment. ';
792
- self::$metaOptions['adsense'] = 'no';
793
- self::$noAds = true;
794
- self::$noAdsReason .= $reason;
795
- return $content . " <!-- $plgName: $reason -->\n";
796
- }
797
- if (isset($metaOptions['adsense']) && $metaOptions['adsense'] == 'no') {
798
- $reason = 'Unfiltered - suppressed by meta option adsense = no. ';
799
- self::$noAds = true;
800
- self::$noAdsReason .= $reason;
801
- return $content . " <!-- $plgName: $reason -->\n";
802
- }
803
- if (self::isBanned()) {
804
- $reason = 'IP is in Banned IP list. ';
805
- self::$noAds = true;
806
- self::$noAdsReason .= $reason;
807
- return $content . " <!-- $plgName: $reason -->\n";
808
- }
809
- if (!in_the_loop() && !$isWidget && !is_singular() && !is_front_page()) {
810
- $reason = 'WP is not in the loop. ';
811
- self::$noAds = true;
812
- self::$noAdsReason .= $reason;
813
- return $content . " <!-- $plgName: $reason -->\n";
814
- }
815
-
816
- self::cacheContent($content);
817
- if (!self::isSafe()) {
818
- self::$noAds = true;
819
- $reason = 'Unfiltered - Content is not Safe. ';
820
- self::$noAdsReason .= $reason;
821
- return $content . " <!-- $plgName: $reason -->\n";
822
- }
823
- return $content . " <!-- $plgName: Filtered -->\n";
824
- }
825
-
826
- static function showUnreal($print = true) {
827
- $unreal = "<div style='text-align:center;margin-left:auto;margin-right:auto;font-size:0.6em'><a href='http://www.thulasidas.com/adsense/' target='_blank' title='The simplest way to put AdSense to work for you!'> Easy Plugin for AdSense</a> by <a href='http://www.Thulasidas.com/' target='_blank' title='Unreal Blog proudly brings you Easy Plugin for AdSense'>Unreal</a></div>";
828
- if ($print) {
829
- echo $unreal;
830
- }
831
- else {
832
- return $unreal;
833
- }
834
- }
835
-
836
- static function mkRedBox($w, $h, $p) {
837
- if (!current_user_can('manage_options')) {
838
- return;
839
- }
840
- if (!empty(self::$options['suppressBoxes'])) {
841
- return;
842
- }
843
- $line1 = "Your ads will be inserted here by";
844
- $line2 = self::getPlgName() . ".";
845
- $option1 = "<u title='Go to your plugin admin page to paste your ad code from your provider or enter your account details'>Setup your Ads</u>";
846
- $option2 = "<u title='Use the options in the Ad Alignment panel to suppress this ad slot'>Suppress this ad slot</u>";
847
- $option3 = "<u title='Use the Pro option to suppress placement boxes'>Suppress Placement Boxes</u>";
848
- $line3 = "Please go to the plugin admin page to ";
849
- $area = $h * $w;
850
- if ($h > 400) {
851
- $or = "<br><br>OR<br><br>";
852
- $br = "<br><br>";
853
- }
854
- else if ($area > 300 * 250) {
855
- $or = "<br>OR<br>";
856
- $br = "<br><br>";
857
- }
858
- else if ($h > 240) {
859
- $or = " or ";
860
- $br = "<br>";
861
- }
862
- else {
863
- $or = " or ";
864
- $br = " ";
865
- }
866
- if ($area < 468 * 60) {
867
- $or = $line3 = $option1 = $option2 = $option3 = "";
868
- }
869
- else if ($area < 728 * 90) {
870
- $line3 = "";
871
- }
872
- if ($area == 300 * 250) { // default ads
873
- $line4 = "<br><br><b>This red box is shown only when logged on as Admin</b>";
874
- }
875
- else {
876
- $line4 = "";
877
- }
878
- $ret = "<div style='width:{$w}px;height:{$h}px;border:1px solid red;'><div style='padding:{$p}px;text-align:center;font-family:arial;font-size:8pt;'>$line1 $br $line2 <br> $br $line3 $br $option1 $or $option2 $or $option3.$line4</div></div>";
879
- return $ret;
880
- }
881
-
882
- static function handleDefaultText($text, $key = '300x250') {
883
- $ret = $text;
884
- if ($text == self::$options['defaultText'] || strlen(trim($text)) == 0) {
885
- $x = strpos($key, 'x');
886
- $w = substr($key, 0, $x);
887
- $h = substr($key, $x + 1);
888
- $p = (int) (min($w, $h) / 6);
889
- $ret = self::mkRedBox($w, $h, $p);
890
- }
891
- return $ret;
892
- }
893
-
894
- static function getMetaOptions() {
895
- if (empty(self::$metaOptions)) {
896
- global $post;
897
- if (is_object($post)) {
898
- $postID = $post->ID;
899
- }
900
- else {
901
- global $wp;
902
- $url = home_url(add_query_arg(array(), $wp->request));
903
- $postID = url_to_postid($url);
904
- }
905
- $metaOptions = array();
906
- if (!empty($postID)) {
907
- $postMeta = get_post_meta($postID);
908
- $lookup = array('adsense' => 'adsense',
909
- 'show_leadin' => 'adsense-top',
910
- 'show_top' => 'adsense-top',
911
- 'show_midtext' => 'adsense-middle',
912
- 'show_middle' => 'adsense-middle',
913
- 'show_leadout' => 'adsense-bottom',
914
- 'show_bottom' => 'adsense-bottom',
915
- 'show_widget' => 'adsense-widget',
916
- 'title_gsearch' => 'adsense-search',
917
- 'show_lu' => 'adsense-linkunits');
918
- foreach ($lookup as $optKey => $metaKey) {
919
- $metaStyle = $metaOptions[$optKey] = '';
920
- if (!empty(self::$options[$optKey])) {
921
- $metaStyle = self::$options[$optKey];
922
- }
923
- else if (!empty($postMeta[$metaKey])) {
924
- $metaStyle = strtolower($postMeta[$metaKey][0]);
925
- }
926
- $style = $metaStyle; // if the option contains CSS directive
927
- switch ($metaStyle) {
928
- case 'left';
929
- $style = 'text-align:left';
930
- break;
931
- case 'leftfloat';
932
- case 'floatleft';
933
- case 'leftfloat';
934
- $style = 'float:left;display:block';
935
- break;
936
- case 'center';
937
- $style = 'text-align:center';
938
- break;
939
- case 'right';
940
- $style = 'text-align:right';
941
- break;
942
- case 'rightfloat';
943
- case 'floatright';
944
- case 'rightfloat';
945
- $style = 'float:right;display:block';
946
- break;
947
- default:
948
- $style = $metaStyle;
949
- break;
950
- }
951
- $metaOptions[$optKey] = $style;
952
- }
953
- }
954
- self::$metaOptions = $metaOptions;
955
- }
956
- return self::$metaOptions;
957
- }
958
-
959
- static function findParas($content) {
960
- $content = strtolower($content); // not using stripos() for PHP4 compatibility
961
- $paras = array();
962
- $lastpos = -1;
963
- $paraMarker = "<p";
964
- if (strpos($content, "<p") === false) {
965
- $paraMarker = "<br";
966
- }
967
-
968
- while (strpos($content, $paraMarker, $lastpos + 1) !== false) {
969
- $lastpos = strpos($content, $paraMarker, $lastpos + 1);
970
- $paras[] = $lastpos;
971
- }
972
- return $paras;
973
- }
974
-
975
- static function mkBorder() {
976
- if (!empty(self::$options['show_borders']) && empty(self::$border)) {
977
- self::$border = 'border:#' . self::$options['border_normal'] .
978
- ' solid ' . self::$options['border_width'] . 'px;" ' .
979
- ' onmouseover="this.style.border=\'#' . self::$options['border_color'] .
980
- ' solid ' . self::$options['border_width'] . 'px\'" ' .
981
- 'onmouseout="this.style.border=\'#' . self::$options['border_normal'] .
982
- ' solid ' . self::$options['border_width'] . 'px\'';
983
- }
984
- return self::$border;
985
- }
986
-
987
- static function isKilled() {
988
- foreach (self::$kills as $k) {
989
- $fn = "is_$k";
990
- if (!empty(self::$options["kill_$k"]) && $fn()) {
991
- return $k;
992
- }
993
- }
994
- return EzGAPro::isKilled();
995
- }
996
-
997
- }
998
-
999
- }
1000
-
1001
- EzGA::$isPro = EzGA::isPro();
1002
-
1003
- // For 4.3.0 <= PHP <= 5.4.0
1004
- if (!function_exists('http_response_code')) {
1005
-
1006
- function http_response_code($newcode = NULL) {
1007
- static $code = 200;
1008
- if ($newcode !== NULL) {
1009
- header('X-PHP-Response-Code: ' . $newcode, true, $newcode);
1010
- if (!headers_sent()) {
1011
- $code = $newcode;
1012
- }
1013
- }
1014
- return $code;
1015
- }
1016
-
1017
- }