Website Monetization by MageNet - Version 1.0.8

Version Description

  • Fix some bugs and problems
  • Plugin optimization
Download this release

Release Info

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

Code changes from version 1.0.7 to 1.0.8

Files changed (2) hide show
  1. monetization-by-magenet.php +27 -14
  2. readme.txt +4 -0
monetization-by-magenet.php CHANGED
@@ -2,7 +2,7 @@
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.7
6
  Author: MageNet.com
7
  Author URI: http://magenet.com
8
  */
@@ -26,7 +26,9 @@ if (!class_exists('MagenetLinkAutoinstall')) {
26
  private $api_get = "/wordpress/get";
27
  private $api_test = "/wordpress/test";
28
  private $key = false;
29
-
 
 
30
  public function MagenetLinkAutoinstall() {
31
  global $wpdb;
32
  define('MagenetLinkAutoinstall', true);
@@ -43,8 +45,9 @@ if (!class_exists('MagenetLinkAutoinstall')) {
43
  add_action('wp_print_styles', array(&$this, 'admin_load_styles'));
44
  add_action('admin_menu', array(&$this, 'admin_generate_menu'));
45
  } else {
46
- if (!has_filter('the_content', array(&$this, 'add_magenet_links')))
47
- add_filter('the_content', array(&$this, 'add_magenet_links'));
 
48
  }
49
  }
50
 
@@ -112,15 +115,19 @@ if (!class_exists('MagenetLinkAutoinstall')) {
112
  }
113
 
114
  public function add_magenet_links($content) {
115
- global $wpdb;
116
- $link_data = $this->getLinks();
117
- $content .= '<div class="mads-block">';
118
- if (count($link_data) > 0) {
119
- foreach($link_data as $link) {
120
- $content .= "\n".$link['link_html'];
 
 
 
121
  }
122
- }
123
- $content .='</div>';
 
124
  return $content;
125
  }
126
 
@@ -134,7 +141,11 @@ if (!class_exists('MagenetLinkAutoinstall')) {
134
  $this->setKey($magenet_key);
135
  $result_text = "<span style=\"color: #009900;\">Key confirmed</span>";
136
  } else {
137
- $result_text = "<span style=\"color: #ca2222;\">Incorrect Key. Please try again</span>";
 
 
 
 
138
  }
139
  }
140
  if (isset($_POST['update_data']) && $_POST['update_data'] == 1) {
@@ -201,12 +212,14 @@ if (!class_exists('MagenetLinkAutoinstall')) {
201
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
202
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
203
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 
204
  curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
205
  curl_setopt($ch, CURLOPT_POST, TRUE);
206
  curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
207
  $curl_result = curl_exec($ch);
208
 
209
- if (!curl_errno($ch)) {
 
210
  $result = $curl_result;
211
  } else {
212
  $result = false;
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.8
6
  Author: MageNet.com
7
  Author URI: http://magenet.com
8
  */
26
  private $api_get = "/wordpress/get";
27
  private $api_test = "/wordpress/test";
28
  private $key = false;
29
+ private $link_shown = false;
30
+ private $lastError = 0;
31
+
32
  public function MagenetLinkAutoinstall() {
33
  global $wpdb;
34
  define('MagenetLinkAutoinstall', true);
45
  add_action('wp_print_styles', array(&$this, 'admin_load_styles'));
46
  add_action('admin_menu', array(&$this, 'admin_generate_menu'));
47
  } else {
48
+ if (!has_filter('the_content', array(&$this, 'add_magenet_links'))) {
49
+ add_filter('the_content', array(&$this, 'add_magenet_links'));
50
+ }
51
  }
52
  }
53
 
115
  }
116
 
117
  public function add_magenet_links($content) {
118
+ if(!$this->link_shown) {
119
+ //$this->link_shown = true;
120
+ global $wpdb;
121
+ $link_data = $this->getLinks();
122
+ $content .= '<div class="mads-block">';
123
+ if (count($link_data) > 0) {
124
+ foreach($link_data as $link) {
125
+ $content .= "\n".$link['link_html'];
126
+ }
127
  }
128
+ $content .='</div>';
129
+ }
130
+
131
  return $content;
132
  }
133
 
141
  $this->setKey($magenet_key);
142
  $result_text = "<span style=\"color: #009900;\">Key confirmed</span>";
143
  } else {
144
+ if($this -> lastError == 0) {
145
+ $result_text = "<span style=\"color: #ca2222;\">Incorrect Key. Please try again</span>";
146
+ } else {
147
+ $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>";
148
+ }
149
  }
150
  }
151
  if (isset($_POST['update_data']) && $_POST['update_data'] == 1) {
212
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
213
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
214
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
215
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
216
  curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
217
  curl_setopt($ch, CURLOPT_POST, TRUE);
218
  curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
219
  $curl_result = curl_exec($ch);
220
 
221
+ $this -> lastError = curl_errno($ch);
222
+ if (!$this -> lastError) {
223
  $result = $curl_result;
224
  } else {
225
  $result = false;
readme.txt CHANGED
@@ -84,6 +84,10 @@ 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.7 =
88
  * Fix some bugs and problems
89
 
84
  3. "Pages options" menu
85
 
86
  == Changelog ==
87
+ = 1.0.8 =
88
+ * Fix some bugs and problems
89
+ * Plugin optimization
90
+
91
  = 1.0.7 =
92
  * Fix some bugs and problems
93