Website Monetization by MageNet - Version 1.0.19

Version Description

  • Plugin security has been improved
  • Fixed problems with compatibility with other plugin's
  • Plugin stabilization was increased
Download this release

Release Info

Developer MageNet
Plugin Icon 128x128 Website Monetization by MageNet
Version 1.0.19
Comparing to
See all releases

Code changes from version 1.0.18 to 1.0.19

MagenetLinkAutoinstall.php CHANGED
@@ -35,24 +35,14 @@ if (!class_exists('MagenetLinkAutoinstall')) {
35
  add_action('wp_print_styles', array(&$this, 'admin_load_styles'));
36
  add_action('admin_menu', array(&$this, 'admin_generate_menu'));
37
  } else {
38
- if (!has_filter('the_content', array(&$this, 'add_magenet_links'))) {
39
- add_filter('the_content', array(&$this, 'add_magenet_links'));
40
- }
 
41
  }
42
  }
43
 
44
- public function getSeoPluginParam() {
45
- if (!$this->is_active_seo_plugin) {
46
- $this->is_active_seo_plugin = get_option("magenet_is_active_seo_plugin");
47
- }
48
- return $this->is_active_seo_plugin;
49
- }
50
- public function setSeoPluginParam($seoparam) {
51
- update_option("magenet_is_active_seo_plugin", $seoparam);
52
- $this->is_active_seo_plugin = $seoparam;
53
- }
54
-
55
- public function getKey() {
56
  if (!$this->key) {
57
  $this->key = get_option("magenet_links_autoinstall_key");
58
  }
@@ -118,40 +108,33 @@ if (!class_exists('MagenetLinkAutoinstall')) {
118
 
119
  public function add_magenet_links($content) {
120
  global $post;
121
- $link_count = 1;
122
- $is_active_plugin = $this->getSeoPluginParam();
123
- if($is_active_plugin=='on' && ($post->post_type == 'page' OR $post->post_type == 'post')) $link_count = 2;
124
 
125
- $this->link_shown++;
126
- if($this->link_shown <= $link_count) {
127
- global $wpdb;
128
- $link_data = $this->getLinks();
129
- $content .= '<div class="mads-block">';
130
- if (is_array($link_data) && count($link_data) > 0) {
131
- foreach($link_data as $link) {
132
- $content .= "\n".$link['link_html'];
 
 
 
 
133
  }
134
- }
135
- $content .='</div>';
136
- }
137
-
 
 
138
  return $content;
139
  }
140
 
141
  public function admin_magenet_settings() {
142
  global $wpdb;
143
  $magenet_key = $this->getKey();
144
- $is_active_seo_plugin = $this->getSeoPluginParam();
145
- $plugin_result_text = '';
146
- if(isset($_POST['seoplugin']) && !empty($_POST['seoplugin'])) {
147
- if (isset($_POST['seoparam']) && !empty($_POST['seoparam'])) {
148
- $this->setSeoPluginParam($_POST['seoparam']);
149
- } else {
150
- $this->setSeoPluginParam('off');
151
- }
152
- $is_active_seo_plugin = $this->getSeoPluginParam();
153
- $plugin_result_text = "<span style=\"color: #009900;\">Saved</span>";
154
- }
155
  if (isset($_POST['key']) && !empty($_POST['key'])) {
156
  $magenet_key = $_POST['key'];
157
  $test_key = $this->testKey($magenet_key);
@@ -160,9 +143,9 @@ if (!class_exists('MagenetLinkAutoinstall')) {
160
  $result_text = "<span style=\"color: #009900;\">Key confirmed</span>";
161
  } else {
162
  if($this -> lastError == 0) {
163
- $result_text = "<span style=\"color: #ca2222;\">Incorrect Key. Please try again</span>";
164
  } else {
165
- $result_text = "<span style=\"color: #ca2222;\">Temporary Error (".$this -> lastError."). Please try again later. If you continue to see this error over an extended period of time, <a href=\"http://www.magenet.com/contact-us/\" target=\"_blank\">please let us know</a> so we can look into the issue.</span>";
166
  }
167
  }
168
  }
@@ -211,7 +194,7 @@ if (!class_exists('MagenetLinkAutoinstall')) {
211
  }
212
  $site_url = str_replace("'", "\'", get_option("siteurl"));
213
  $page_url = parse_url($site_url.str_replace("'", "\'", $_SERVER["REQUEST_URI"]));
214
- $url_for_check = $page_url['scheme'] . "://" . (isset($page_url['host']) ? $page_url['host'] : '') . (isset($page_url['path']) ? $page_url['path'] : '');
215
 
216
  $check_page_without_last_slash_query = "";
217
  if($url_for_check[strlen($url_for_check)-1] == "/") {
@@ -259,4 +242,4 @@ if (!class_exists('MagenetLinkAutoinstall')) {
259
  }
260
  }
261
  }
262
- ?>
35
  add_action('wp_print_styles', array(&$this, 'admin_load_styles'));
36
  add_action('admin_menu', array(&$this, 'admin_generate_menu'));
37
  } else {
38
+ if (!has_filter('the_content', array(&$this, 'add_magenet_links'))) {
39
+ add_filter('the_content', array(&$this, 'add_magenet_links'));
40
+ add_filter('the_excerpt', array(&$this, 'add_magenet_links'));
41
+ }
42
  }
43
  }
44
 
45
+ public function getKey() {
 
 
 
 
 
 
 
 
 
 
 
46
  if (!$this->key) {
47
  $this->key = get_option("magenet_links_autoinstall_key");
48
  }
108
 
109
  public function add_magenet_links($content) {
110
  global $post;
 
 
 
111
 
112
+ $uniq_post_id = md5(substr($content, 0, 100));
113
+ if(strlen($content) > 0)
114
+ empty($this->the_content_log[$uniq_post_id]) ? $this->the_content_log[$uniq_post_id] = 1 : $this->the_content_log[$uniq_post_id]++;
115
+
116
+ if(count($this->the_content_log) == 1)
117
+ {
118
+ global $wpdb;
119
+ $link_data = $this->getLinks();
120
+ $mads_block = '<div class="mads-block">';
121
+ if (is_array($link_data) && count($link_data) > 0) {
122
+ foreach($link_data as $link) {
123
+ $mads_block .= "\n".$link['link_html'];
124
  }
125
+ }
126
+ $mads_block .= '</div>';
127
+ }
128
+
129
+ $content .= $mads_block;
130
+
131
  return $content;
132
  }
133
 
134
  public function admin_magenet_settings() {
135
  global $wpdb;
136
  $magenet_key = $this->getKey();
137
+
 
 
 
 
 
 
 
 
 
 
138
  if (isset($_POST['key']) && !empty($_POST['key'])) {
139
  $magenet_key = $_POST['key'];
140
  $test_key = $this->testKey($magenet_key);
143
  $result_text = "<span style=\"color: #009900;\">Key confirmed</span>";
144
  } else {
145
  if($this -> lastError == 0) {
146
+ $result_text = "<span style=\"color: #ca2222;\">Incorrect Key. Please try again</span>";
147
  } else {
148
+ $result_text = "<span style=\"color: #ca2222;\">Temporary Error (".$this -> lastError."). Please try again later. If you continue to see this error over an extended period of time, <a href=\"http://www.magenet.com/contact-us/\" target=\"_blank\">please let us know</a> so we can look into the issue.</span>";
149
  }
150
  }
151
  }
194
  }
195
  $site_url = str_replace("'", "\'", get_option("siteurl"));
196
  $page_url = parse_url($site_url.str_replace("'", "\'", $_SERVER["REQUEST_URI"]));
197
+ $url_for_check = $page_url['scheme'] . "://" . (isset($page_url['host']) ? $page_url['host'] : '') . (isset($page_url['path']) ? $page_url['path'] : '') . (isset($page_url['query']) ? '?'.$page_url['query'] : '');
198
 
199
  $check_page_without_last_slash_query = "";
200
  if($url_for_check[strlen($url_for_check)-1] == "/") {
242
  }
243
  }
244
  }
245
+ ?>
monetization-by-magenet.php CHANGED
@@ -2,11 +2,14 @@
2
  /*
3
  Plugin Name: Website Monetization by MageNet
4
  Description: Website Monetization by MageNet allows you to sell contextual ads from your pages automatically and receive payments with PayPal. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://magenet.com" target="_blank">Sign up for a MageNet Key</a>, and 3) Go to Settings > "Website Monetization by MageNet" configuration page, and save your MageNet Key.
5
- Version: 1.0.18
6
  Author: MageNet.com
7
  Author URI: http://magenet.com
 
8
  */
9
  define("plugin_file",__FILE__);
 
 
10
  // Stop direct call
11
  if(preg_match('#' . basename(plugin_file) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
12
 
@@ -22,4 +25,5 @@ if (!function_exists('json_decode')) {
22
  require_once( plugin_dir_path( plugin_file ).'MagenetLinkAutoinstall.php' );
23
  global $magenetLinkAutoinstall;
24
  $magenetLinkAutoinstall = new MagenetLinkAutoinstall();
 
25
  ?>
2
  /*
3
  Plugin Name: Website Monetization by MageNet
4
  Description: Website Monetization by MageNet allows you to sell contextual ads from your pages automatically and receive payments with PayPal. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://magenet.com" target="_blank">Sign up for a MageNet Key</a>, and 3) Go to Settings > "Website Monetization by MageNet" configuration page, and save your MageNet Key.
5
+ Version: 1.0.19
6
  Author: MageNet.com
7
  Author URI: http://magenet.com
8
+ Text Domain: website-monetization-by-magenet
9
  */
10
  define("plugin_file",__FILE__);
11
+ $error_param = ini_get('display_errors');
12
+ ini_set('display_errors', 0);
13
  // Stop direct call
14
  if(preg_match('#' . basename(plugin_file) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
15
 
25
  require_once( plugin_dir_path( plugin_file ).'MagenetLinkAutoinstall.php' );
26
  global $magenetLinkAutoinstall;
27
  $magenetLinkAutoinstall = new MagenetLinkAutoinstall();
28
+ ini_set('display_errors', $error_param);
29
  ?>
readme.txt CHANGED
@@ -84,6 +84,11 @@ MageNet crawler will index your sites the same way Google does. It will “read
84
  3. "Pages options" menu
85
 
86
  == Changelog ==
 
 
 
 
 
87
  = 1.0.18 =
88
  * The bug, which show warning on site fixed
89
 
84
  3. "Pages options" menu
85
 
86
  == Changelog ==
87
+ = 1.0.19 =
88
+ * Plugin security has been improved
89
+ * Fixed problems with compatibility with other plugin's
90
+ * Plugin stabilization was increased
91
+
92
  = 1.0.18 =
93
  * The bug, which show warning on site fixed
94
 
view-settings.php CHANGED
@@ -2,13 +2,6 @@
2
  <h2>Website Monetization by MageNet</h2>
3
  <p>By installing WordPress plugin, you allow MageNet to display paid contextual ads on pages where where you grant permission via Pages options.</p>
4
  <p>Ad placement and removal process takes 3 hours. Please be patient.</p>
5
- <div class="tool-box">
6
- <form id="form-id" method="post" action="">
7
- <input type="hidden" name="seoplugin" id="seoplugin" value="1">
8
- <input type="checkbox" name="seoparam" id="seoparam" onClick="document.getElementById('form-id').submit();" <?php if ($is_active_seo_plugin=='on') echo "CHECKED"; ?> ><span>I have "Wordpress SEO" plugin by Yoast activated on my website. Note: check this box to avoid errors of MageNet Monetization plugin caused by this SEO plugin.</span>
9
- <?php echo $plugin_result_text; ?>
10
- </form>
11
- </div>
12
  <div class="tool-box">
13
  <h2 class="title">MageNet Key:</h2>
14
  <form method="post" action="">
2
  <h2>Website Monetization by MageNet</h2>
3
  <p>By installing WordPress plugin, you allow MageNet to display paid contextual ads on pages where where you grant permission via Pages options.</p>
4
  <p>Ad placement and removal process takes 3 hours. Please be patient.</p>
 
 
 
 
 
 
 
5
  <div class="tool-box">
6
  <h2 class="title">MageNet Key:</h2>
7
  <form method="post" action="">