Version Description
- Add dashboard widget
Download this release
Release Info
Developer | MageNet |
Plugin | Website Monetization by MageNet |
Version | 1.0.23 |
Comparing to | |
See all releases |
Code changes from version 1.0.22 to 1.0.23
- MagenetLinkAutoinstall.php +85 -39
- css/admin-style.css +5 -5
- monetization-by-magenet.php +76 -19
- readme.txt +14 -15
MagenetLinkAutoinstall.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
if (!function_exists('get_plugin_data'))
|
3 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
|
|
4 |
$plugin_data = get_plugin_data(plugin_file);
|
5 |
|
6 |
define("magenet_plugin_version", $plugin_data['Version']);
|
@@ -61,7 +62,7 @@ if (!class_exists('MagenetLinkAutoinstall')) {
|
|
61 |
|
62 |
public function footerFilter()
|
63 |
{
|
64 |
-
echo '<!-- wmm -->';
|
65 |
}
|
66 |
|
67 |
public function getKey()
|
@@ -178,43 +179,49 @@ if (!class_exists('MagenetLinkAutoinstall')) {
|
|
178 |
{
|
179 |
global $wpdb;
|
180 |
$magenet_key = $this->getKey();
|
181 |
-
|
182 |
-
if (isset($_POST['key'])
|
183 |
-
$
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
}
|
192 |
-
else {
|
193 |
-
if ($this->lastError == 0) {
|
194 |
-
$result_text = "<span style=\"color: #ca2222;\">Incorrect Key. Please try again</span>";
|
195 |
}
|
196 |
else {
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
198 |
}
|
|
|
|
|
|
|
199 |
}
|
200 |
}
|
|
|
201 |
if (isset($_POST['update_data']) && $_POST['update_data'] == 1) {
|
202 |
$result = $this->sendRequest($this->api_host . $this->api_get, $magenet_key);
|
203 |
if ($result) {
|
204 |
$wpdb->query("DELETE FROM {$this->tbl_magenet_links} WHERE 1");
|
205 |
$new_links = json_decode($result, TRUE);
|
206 |
-
if (count($new_links) > 0)
|
207 |
foreach ($new_links as $new_link) {
|
208 |
if (isset($new_link['page_url']) && isset($new_link['issue_html'])) {
|
209 |
$wpdb->query($wpdb->prepare("INSERT INTO {$this->tbl_magenet_links}(page_url, link_html) VALUES (%s, %s)", $new_link['page_url'], $new_link['issue_html']));
|
210 |
}
|
211 |
}
|
|
|
212 |
}
|
213 |
update_option("magenet_links_last_update", time());
|
214 |
-
$result_update_text =
|
215 |
}
|
216 |
$link_data = $wpdb->get_results("SELECT * FROM `" . $this->tbl_magenet_links . "`", ARRAY_A);
|
217 |
-
|
218 |
if (isset($_POST['links_show_by'])) {
|
219 |
update_option('magenet_links_show_by', $_POST['links_show_by']);
|
220 |
$result_showBy_text = '<span style="color: #009900;">Ads location and placement method has been updated.</span>';
|
@@ -238,34 +245,68 @@ if (!class_exists('MagenetLinkAutoinstall')) {
|
|
238 |
if ($key) {
|
239 |
$last_update_time = get_option("magenet_links_last_update");
|
240 |
if ($last_update_time + $this->cache_time < time()) {
|
241 |
-
$
|
242 |
-
if ($result) {
|
243 |
-
$wpdb->query("DELETE FROM {$this->tbl_magenet_links} WHERE 1");
|
244 |
-
$new_links = json_decode($result, TRUE);
|
245 |
-
if (count($new_links) > 0) {
|
246 |
-
foreach ($new_links as $new_link) {
|
247 |
-
if (isset($new_link['page_url']) && isset($new_link['issue_html'])) {
|
248 |
-
$wpdb->query($wpdb->prepare("INSERT INTO {$this->tbl_magenet_links}(page_url, link_html) VALUES (%s, %s)", $new_link['page_url'], $new_link['issue_html']));
|
249 |
-
}
|
250 |
-
}
|
251 |
-
}
|
252 |
-
}
|
253 |
-
update_option("magenet_links_last_update", time());
|
254 |
}
|
|
|
255 |
$site_url = str_replace("'", "\'", get_option("siteurl"));
|
256 |
$page_url = parse_url($site_url . str_replace("'", "\'", $_SERVER["REQUEST_URI"]));
|
|
|
257 |
$url_for_check = $page_url['scheme'] . "://" . (isset($page_url['host']) ? $page_url['host'] : '') . (isset($page_url['path']) ? $page_url['path'] : '') . (isset($page_url['query'])
|
258 |
? '?' . $page_url['query'] : '');
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
return $link_data;
|
266 |
}
|
267 |
return false;
|
268 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
|
270 |
public function sendRequest($url, $key)
|
271 |
{
|
@@ -278,7 +319,7 @@ if (!class_exists('MagenetLinkAutoinstall')) {
|
|
278 |
if (function_exists('curl_init') && function_exists('curl_exec')) {
|
279 |
$ch = curl_init();
|
280 |
curl_setopt($ch, CURLOPT_URL, $url);
|
281 |
-
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
|
282 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
283 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
284 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
@@ -346,6 +387,11 @@ if (!class_exists('MagenetLinkAutoinstall')) {
|
|
346 |
|
347 |
return $mads_block;
|
348 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
}
|
350 |
}
|
351 |
-
|
1 |
<?php
|
2 |
if (!function_exists('get_plugin_data'))
|
3 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
4 |
+
|
5 |
$plugin_data = get_plugin_data(plugin_file);
|
6 |
|
7 |
define("magenet_plugin_version", $plugin_data['Version']);
|
62 |
|
63 |
public function footerFilter()
|
64 |
{
|
65 |
+
echo '<!-- wmm ' . (get_option("magenet_links_show_by") == 1 ? 'w' : 'd') . ' -->';
|
66 |
}
|
67 |
|
68 |
public function getKey()
|
179 |
{
|
180 |
global $wpdb;
|
181 |
$magenet_key = $this->getKey();
|
182 |
+
// set or update magenet key
|
183 |
+
if (isset($_POST['key'])) {
|
184 |
+
if(!empty($_POST['key'])) {
|
185 |
+
if ($this->testKey($_POST['key'])) {
|
186 |
+
$magenet_key = $_POST['key'];
|
187 |
+
$this->setKey($magenet_key);
|
188 |
+
$result_text = '<span style="color: #009900;">Key confirmed</span>';
|
189 |
+
if ($this->status() == 2) {
|
190 |
+
$result_text .= '<br><span style="color: #ff3838;">Check the box "Switch to Automatic" in "Your Sites" interface to start selling backlinks from your website in automatic mode.</span>';
|
191 |
+
}
|
|
|
|
|
|
|
|
|
192 |
}
|
193 |
else {
|
194 |
+
if ($this->lastError == 0) {
|
195 |
+
$result_text = '<span style="color: #ca2222;">Incorrect Key. Please try again.</span>';
|
196 |
+
}
|
197 |
+
else {
|
198 |
+
$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>';
|
199 |
+
}
|
200 |
}
|
201 |
+
}
|
202 |
+
else {
|
203 |
+
$result_text = '<span style="color: #ca2222;">The field can\'t be empty. Please try again.</span>';
|
204 |
}
|
205 |
}
|
206 |
+
// update links data
|
207 |
if (isset($_POST['update_data']) && $_POST['update_data'] == 1) {
|
208 |
$result = $this->sendRequest($this->api_host . $this->api_get, $magenet_key);
|
209 |
if ($result) {
|
210 |
$wpdb->query("DELETE FROM {$this->tbl_magenet_links} WHERE 1");
|
211 |
$new_links = json_decode($result, TRUE);
|
212 |
+
if (count($new_links) > 0) {
|
213 |
foreach ($new_links as $new_link) {
|
214 |
if (isset($new_link['page_url']) && isset($new_link['issue_html'])) {
|
215 |
$wpdb->query($wpdb->prepare("INSERT INTO {$this->tbl_magenet_links}(page_url, link_html) VALUES (%s, %s)", $new_link['page_url'], $new_link['issue_html']));
|
216 |
}
|
217 |
}
|
218 |
+
}
|
219 |
}
|
220 |
update_option("magenet_links_last_update", time());
|
221 |
+
$result_update_text = '<span style="color: #009900;">Ads have been updated.</span>';
|
222 |
}
|
223 |
$link_data = $wpdb->get_results("SELECT * FROM `" . $this->tbl_magenet_links . "`", ARRAY_A);
|
224 |
+
// update placement method
|
225 |
if (isset($_POST['links_show_by'])) {
|
226 |
update_option('magenet_links_show_by', $_POST['links_show_by']);
|
227 |
$result_showBy_text = '<span style="color: #009900;">Ads location and placement method has been updated.</span>';
|
245 |
if ($key) {
|
246 |
$last_update_time = get_option("magenet_links_last_update");
|
247 |
if ($last_update_time + $this->cache_time < time()) {
|
248 |
+
$this->updateLinks($key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
}
|
250 |
+
|
251 |
$site_url = str_replace("'", "\'", get_option("siteurl"));
|
252 |
$page_url = parse_url($site_url . str_replace("'", "\'", $_SERVER["REQUEST_URI"]));
|
253 |
+
|
254 |
$url_for_check = $page_url['scheme'] . "://" . (isset($page_url['host']) ? $page_url['host'] : '') . (isset($page_url['path']) ? $page_url['path'] : '') . (isset($page_url['query'])
|
255 |
? '?' . $page_url['query'] : '');
|
256 |
|
257 |
+
// ? trailing slash
|
258 |
+
$url_for_check_slash = (substr($url_for_check, -1) == '/' ? substr($url_for_check, 0, -1) : $url_for_check . '/' );
|
259 |
+
|
260 |
+
// ? www
|
261 |
+
$url_for_check_www = (strpos($url_for_check, "://www.") > 0 ? $this->str_replace_first("www.", "", $url_for_check) : str_replace("://", "://www.", $url_for_check) );
|
262 |
+
|
263 |
+
// ? www +++ ? trailing slash
|
264 |
+
$url_for_check_www_slash = (substr($url_for_check_www, -1) == '/' ? substr($url_for_check_www, 0, -1) : $url_for_check_www . '/' );
|
265 |
+
|
266 |
+
// http or https
|
267 |
+
$url_for_check_http = (substr($url_for_check, 0, 5) == 'https' ? $this->str_replace_first("https", "http", $url_for_check) : $this->str_replace_first("http", "https",
|
268 |
+
$url_for_check) );
|
269 |
+
|
270 |
+
// http or https +++ ? trailing slash
|
271 |
+
$url_for_check_http_slash = (substr($url_for_check_slash, 0, 5) == 'https' ? $this->str_replace_first("https", "http", $url_for_check_slash) : $this->str_replace_first("http",
|
272 |
+
"https", $url_for_check_slash) );
|
273 |
+
|
274 |
+
// http or https +++ ? www
|
275 |
+
$url_for_check_http_www = (substr($url_for_check_www, 0, 5) == 'https' ? $this->str_replace_first("https", "http", $url_for_check_www) : $this->str_replace_first("http",
|
276 |
+
"https", $url_for_check_www) );
|
277 |
+
|
278 |
+
// http or https +++ ? www +++ ? trailing slash
|
279 |
+
$url_for_check_http_www_slash = (substr($url_for_check_www_slash, 0, 5) == 'https' ? $this->str_replace_first("https", "http", $url_for_check_www_slash) : $this->str_replace_first("http",
|
280 |
+
"https", $url_for_check_www_slash) );
|
281 |
+
|
282 |
+
$link_sql = $wpdb->prepare("SELECT * FROM {$this->tbl_magenet_links} WHERE page_url = '%s' or page_url = '%s' or page_url = '%s' or page_url = '%s' or page_url = '%s' or page_url = '%s' or page_url = '%s' or page_url = '%s' ",
|
283 |
+
$url_for_check, $url_for_check_slash, $url_for_check_www, $url_for_check_www_slash, $url_for_check_http, $url_for_check_http_slash, $url_for_check_http_www,
|
284 |
+
$url_for_check_http_www_slash);
|
285 |
+
|
286 |
+
$link_data = $wpdb->get_results($link_sql, ARRAY_A);
|
287 |
return $link_data;
|
288 |
}
|
289 |
return false;
|
290 |
}
|
291 |
+
|
292 |
+
public function updateLinks($key)
|
293 |
+
{
|
294 |
+
global $wpdb;
|
295 |
+
$result = $this->sendRequest($this->api_host . $this->api_get, $key);
|
296 |
+
if ($result) {
|
297 |
+
$wpdb->query("DELETE FROM {$this->tbl_magenet_links} WHERE 1");
|
298 |
+
$new_links = json_decode($result, TRUE);
|
299 |
+
if (count($new_links) > 0) {
|
300 |
+
foreach ($new_links as $new_link) {
|
301 |
+
if (isset($new_link['page_url']) && isset($new_link['issue_html'])) {
|
302 |
+
$wpdb->query($wpdb->prepare("INSERT INTO {$this->tbl_magenet_links}(page_url, link_html) VALUES (%s, %s)",
|
303 |
+
$new_link['page_url'], $new_link['issue_html']));
|
304 |
+
}
|
305 |
+
}
|
306 |
+
}
|
307 |
+
}
|
308 |
+
update_option("magenet_links_last_update", time());
|
309 |
+
}
|
310 |
|
311 |
public function sendRequest($url, $key)
|
312 |
{
|
319 |
if (function_exists('curl_init') && function_exists('curl_exec')) {
|
320 |
$ch = curl_init();
|
321 |
curl_setopt($ch, CURLOPT_URL, $url);
|
322 |
+
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
|
323 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
324 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
325 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
387 |
|
388 |
return $mads_block;
|
389 |
}
|
390 |
+
|
391 |
+
public function str_replace_first($search, $replace, $subject)
|
392 |
+
{
|
393 |
+
$search = '/' . preg_quote($search, '/') . '/';
|
394 |
+
return preg_replace($search, $replace, $subject, 1);
|
395 |
+
}
|
396 |
}
|
397 |
}
|
|
css/admin-style.css
CHANGED
@@ -51,7 +51,7 @@
|
|
51 |
cursor: pointer;
|
52 |
}
|
53 |
|
54 |
-
.magenet-dialog .
|
55 |
.magenet-dialog .activate {
|
56 |
-webkit-border-radius: 3;
|
57 |
-moz-border-radius: 3;
|
@@ -61,10 +61,10 @@
|
|
61 |
text-decoration: none;
|
62 |
}
|
63 |
|
64 |
-
.magenet-dialog .
|
65 |
-
color: #
|
66 |
-
background: #
|
67 |
-
border: solid #
|
68 |
}
|
69 |
|
70 |
.magenet-dialog .activate {
|
51 |
cursor: pointer;
|
52 |
}
|
53 |
|
54 |
+
.magenet-dialog .confirm-website,
|
55 |
.magenet-dialog .activate {
|
56 |
-webkit-border-radius: 3;
|
57 |
-moz-border-radius: 3;
|
61 |
text-decoration: none;
|
62 |
}
|
63 |
|
64 |
+
.magenet-dialog .confirm-website {
|
65 |
+
color: #fff;
|
66 |
+
background: #337ab7;
|
67 |
+
border: solid #2e6da4 1px;
|
68 |
}
|
69 |
|
70 |
.magenet-dialog .activate {
|
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://www.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.
|
6 |
Author: MageNet.com
|
7 |
Author URI: http://www.magenet.com
|
8 |
Text Domain: website-monetization-by-magenet
|
@@ -49,42 +49,36 @@ function magenet_notices()
|
|
49 |
?>
|
50 |
<div id="mn-0" class="magenet-tutorial-popup" style="display: none;" title="Congratulations!">
|
51 |
Monetizing Plugin is installed successfully!<br><br>
|
52 |
-
Now
|
53 |
-
|
54 |
<?php magenet_tutorial_buttons(-2); ?>
|
55 |
</div>
|
56 |
|
57 |
<div id="mn-1" class="magenet-tutorial-popup" style="display: none" title="Step 1">
|
58 |
-
<a href="http://cp.magenet.com/" target="_blank">Log in to MageNet</a
|
59 |
or<br><br>
|
60 |
-
<a href="http://www.magenet.com/#sign_up" target="_blank">Sign up for
|
61 |
<?php magenet_tutorial_buttons(-1); ?>
|
62 |
</div>
|
63 |
|
64 |
<div id="mn-2" class="magenet-tutorial-popup" style="display: none" title="Step 2">
|
65 |
-
<a href="http://cp.magenet.com/sites/sites/add" target="_blank">Add
|
66 |
-
then<br><br>
|
67 |
-
|
68 |
<?php magenet_tutorial_buttons(); ?>
|
69 |
</div>
|
70 |
|
71 |
<div id="mn-3" class="magenet-tutorial-popup" style="display: none" title="Step 3">
|
72 |
-
|
73 |
-
At the appeared window find the MageNet Key field and copy its entry
|
74 |
<?php magenet_tutorial_buttons(); ?>
|
75 |
</div>
|
76 |
|
77 |
<div id="mn-4" class="magenet-tutorial-popup" style="display: none" title="Step 4">
|
78 |
-
|
79 |
<?php magenet_tutorial_buttons(); ?>
|
80 |
</div>
|
81 |
|
82 |
-
<div id="mn-5" class="magenet-tutorial-popup" style="display: none" title="
|
83 |
-
Paste the copied code to the MageNet Key field and press "Save" button
|
84 |
-
<?php magenet_tutorial_buttons(); ?>
|
85 |
-
</div>
|
86 |
-
|
87 |
-
<div id="mn-6" class="magenet-tutorial-popup" style="display: none" title="Success!">
|
88 |
<br>
|
89 |
<h3 style="text-align: center">Plugin is activated</h3>
|
90 |
<?php magenet_tutorial_buttons(1); ?>
|
@@ -135,7 +129,6 @@ add_action('wp_ajax_magenet_action', 'magenet_action_callback');
|
|
135 |
// widget
|
136 |
class Magenet_Widget extends WP_Widget
|
137 |
{
|
138 |
-
|
139 |
// constructor
|
140 |
function __construct()
|
141 |
{
|
@@ -204,4 +197,68 @@ class Magenet_Widget extends WP_Widget
|
|
204 |
}
|
205 |
// register widget
|
206 |
if (get_option("magenet_links_show_by") == 1)
|
207 |
-
add_action('widgets_init', create_function('', 'return register_widget("Magenet_Widget");'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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://www.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.23
|
6 |
Author: MageNet.com
|
7 |
Author URI: http://www.magenet.com
|
8 |
Text Domain: website-monetization-by-magenet
|
49 |
?>
|
50 |
<div id="mn-0" class="magenet-tutorial-popup" style="display: none;" title="Congratulations!">
|
51 |
Monetizing Plugin is installed successfully!<br><br>
|
52 |
+
Now you are ready to make profit from your site automatically!<br><br>
|
53 |
+
Click "Start tutorial" to set up the plugin efficiently.
|
54 |
<?php magenet_tutorial_buttons(-2); ?>
|
55 |
</div>
|
56 |
|
57 |
<div id="mn-1" class="magenet-tutorial-popup" style="display: none" title="Step 1">
|
58 |
+
<a href="http://cp.magenet.com/" target="_blank">Log in to MageNet</a> if you already have <strong>MageNet</strong> account<br><br>
|
59 |
or<br><br>
|
60 |
+
<a href="http://www.magenet.com/#sign_up" target="_blank">Sign up for MageNet</a> to provide plugin with ads from our marketplace
|
61 |
<?php magenet_tutorial_buttons(-1); ?>
|
62 |
</div>
|
63 |
|
64 |
<div id="mn-2" class="magenet-tutorial-popup" style="display: none" title="Step 2">
|
65 |
+
<a href="http://cp.magenet.com/sites/sites/add" target="_blank">Add</a> your site to your <strong>MageNet</strong> account<br><br>
|
66 |
+
then click <span class="confirm-website">Confirm Website</span><br><br>
|
67 |
+
in the opened pop-up copy of <b>Magenet Key</b><br>situated under "Install Wordpress Plugin" link
|
68 |
<?php magenet_tutorial_buttons(); ?>
|
69 |
</div>
|
70 |
|
71 |
<div id="mn-3" class="magenet-tutorial-popup" style="display: none" title="Step 3">
|
72 |
+
Go to <strong>Settings</strong> section in the WordPress admin menu at the left and click "Website Monetization by MageNet" in the list below
|
|
|
73 |
<?php magenet_tutorial_buttons(); ?>
|
74 |
</div>
|
75 |
|
76 |
<div id="mn-4" class="magenet-tutorial-popup" style="display: none" title="Step 4">
|
77 |
+
Paste the copied code to the MageNet Key field and click "Save" button
|
78 |
<?php magenet_tutorial_buttons(); ?>
|
79 |
</div>
|
80 |
|
81 |
+
<div id="mn-5" class="magenet-tutorial-popup" style="display: none" title="Success!">
|
|
|
|
|
|
|
|
|
|
|
82 |
<br>
|
83 |
<h3 style="text-align: center">Plugin is activated</h3>
|
84 |
<?php magenet_tutorial_buttons(1); ?>
|
129 |
// widget
|
130 |
class Magenet_Widget extends WP_Widget
|
131 |
{
|
|
|
132 |
// constructor
|
133 |
function __construct()
|
134 |
{
|
197 |
}
|
198 |
// register widget
|
199 |
if (get_option("magenet_links_show_by") == 1)
|
200 |
+
add_action('widgets_init', create_function('', 'return register_widget("Magenet_Widget");'));
|
201 |
+
|
202 |
+
// dashboard widget
|
203 |
+
function magenet_dashboard_widget() {
|
204 |
+
?>
|
205 |
+
<script type="text/javascript">
|
206 |
+
jQuery.ajax(ajaxurl, {
|
207 |
+
dataType: 'html',
|
208 |
+
type: 'GET',
|
209 |
+
data: { action: 'magenet_dashboard_action' },
|
210 |
+
success: function(response, status, xhr) {
|
211 |
+
jQuery("#magenet_dw").html(response);
|
212 |
+
}
|
213 |
+
});
|
214 |
+
</script>
|
215 |
+
<div class="rss-widget" id="magenet_dw">Loading data ...</div>
|
216 |
+
<?php
|
217 |
+
}
|
218 |
+
|
219 |
+
// register dashboard widget function
|
220 |
+
function add_dashboard_widgets() {
|
221 |
+
wp_add_dashboard_widget('dashboard_widget', 'Magenet Info', 'magenet_dashboard_widget');
|
222 |
+
}
|
223 |
+
|
224 |
+
// register dashboard widget hook
|
225 |
+
add_action('wp_dashboard_setup', 'add_dashboard_widgets' );
|
226 |
+
|
227 |
+
function magenet_dashboard_action_callback()
|
228 |
+
{
|
229 |
+
$key = get_option("magenet_links_autoinstall_key");
|
230 |
+
if ($key) {
|
231 |
+
$mn_api_url = 'https://cp.magenet.com/mn-api/?k=' . $key . '&s=' . base64_encode(get_option("siteurl"));
|
232 |
+
$mn_api_data = file_get_contents($mn_api_url);
|
233 |
+
$mn_api_str = '';
|
234 |
+
|
235 |
+
if (strlen($mn_api_data) > 0) {
|
236 |
+
$response = base64_decode($mn_api_data);
|
237 |
+
|
238 |
+
if ($response['ok'] == "-1") {
|
239 |
+
$mn_api_str = 'Wrong key';
|
240 |
+
}
|
241 |
+
else if ($response['ok'] == "0") {
|
242 |
+
$mn_api_str = 'Can\t find site';
|
243 |
+
}
|
244 |
+
else {
|
245 |
+
$mn_api_str = $response;
|
246 |
+
|
247 |
+
$rss = fetch_feed( 'http://www.magenet.com/feed/' );
|
248 |
+
if ( ! is_wp_error( $rss ) ) :
|
249 |
+
$maxitems = $rss->get_item_quantity( 1 );
|
250 |
+
$rss_items = $rss->get_items( 0, $maxitems );
|
251 |
+
$mn_api_str .= '<hr><b>Recent blog post:</b> ';
|
252 |
+
$mn_api_str .= '<a href="' . $rss_items[0]->get_permalink() . '" target="_blank">' . $rss_items[0]->get_title() . '</a>';
|
253 |
+
endif;
|
254 |
+
|
255 |
+
}
|
256 |
+
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
echo $mn_api_str;
|
261 |
+
wp_die();
|
262 |
+
}
|
263 |
+
|
264 |
+
add_action('wp_ajax_magenet_dashboard_action', 'magenet_dashboard_action_callback');
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== Website Monetization by MageNet ===
|
2 |
Contributors: MageNet
|
3 |
Tags: website monetization, advertising, contextual ads, earn money online, contextual advertising, text ads, sell ads
|
4 |
-
Requires at least:
|
5 |
-
Tested up to: 4.
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -37,17 +37,16 @@ You will have access to awesome affiliate program available to our publishers.
|
|
37 |
|
38 |
== Installation ==
|
39 |
|
40 |
-
1.
|
41 |
-
2.
|
42 |
-
3.
|
43 |
-
4.
|
44 |
-
5. Return to WP Dashboard, go to Settings > "Website Monetization by MageNet" configuration page, and save your MageNet Key.
|
45 |
|
46 |
== Frequently Asked Questions ==
|
47 |
|
48 |
= What should I do after plugin installation? =
|
49 |
|
50 |
-
Sing up at
|
51 |
|
52 |
= How much can I earn? =
|
53 |
|
@@ -65,10 +64,6 @@ Once you signup MageNet will index the content of your websites. We've got hundr
|
|
65 |
|
66 |
Yes, you can forbid sales from any page of your site.
|
67 |
|
68 |
-
= Can I control what kind of ads to sell and not to sell from my sites? =
|
69 |
-
|
70 |
-
Yes, you'll be able to block sites, for which you don't want to place ads.
|
71 |
-
|
72 |
= What kind of sites can I submit? =
|
73 |
|
74 |
You can any site into MageNet. However please note that MagNet doesn't allow the promotion of escort services, pornography, adult, or other mature content.
|
@@ -79,11 +74,15 @@ MageNet crawler will index your sites the same way Google does. It will “read
|
|
79 |
|
80 |
== Screenshots ==
|
81 |
|
82 |
-
1. Plugin
|
83 |
-
2.
|
84 |
-
3. "
|
|
|
85 |
|
86 |
== Changelog ==
|
|
|
|
|
|
|
87 |
= 1.0.22 =
|
88 |
* Add widget
|
89 |
|
1 |
=== Website Monetization by MageNet ===
|
2 |
Contributors: MageNet
|
3 |
Tags: website monetization, advertising, contextual ads, earn money online, contextual advertising, text ads, sell ads
|
4 |
+
Requires at least: 4.0
|
5 |
+
Tested up to: 4.8.1
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
37 |
|
38 |
== Installation ==
|
39 |
|
40 |
+
1. Install and activate the plugin using the "Plugins" menu
|
41 |
+
2. Log in to [cp.magenet.com](https://cp.magenet.com) or [create](https://www.magenet.com) an account
|
42 |
+
3. Add your website, press "Confirm" and copy MageNet Key
|
43 |
+
4. Come back to your Dashboard, go to Settings > "Website Monetization by MageNet", paste and save your MageNet Key there.
|
|
|
44 |
|
45 |
== Frequently Asked Questions ==
|
46 |
|
47 |
= What should I do after plugin installation? =
|
48 |
|
49 |
+
Sing up at [https://www.magenet.com](https://www.magenet.com) and add your website to get MageNet Key
|
50 |
|
51 |
= How much can I earn? =
|
52 |
|
64 |
|
65 |
Yes, you can forbid sales from any page of your site.
|
66 |
|
|
|
|
|
|
|
|
|
67 |
= What kind of sites can I submit? =
|
68 |
|
69 |
You can any site into MageNet. However please note that MagNet doesn't allow the promotion of escort services, pornography, adult, or other mature content.
|
74 |
|
75 |
== Screenshots ==
|
76 |
|
77 |
+
1. Plugin settings
|
78 |
+
2. Widget settings
|
79 |
+
3. "Your sites" menu
|
80 |
+
4. "Pages options" menu
|
81 |
|
82 |
== Changelog ==
|
83 |
+
= 1.0.23 =
|
84 |
+
* Add dashboard widget
|
85 |
+
|
86 |
= 1.0.22 =
|
87 |
* Add widget
|
88 |
|