Version Description
- Add widget
Download this release
Release Info
Developer | MageNet |
Plugin | Website Monetization by MageNet |
Version | 1.0.22 |
Comparing to | |
See all releases |
Code changes from version 1.0.21 to 1.0.22
- MagenetLinkAutoinstall.php +230 -133
- css/admin-style.css +164 -0
- js/admin-scripts.js +59 -0
- monetization-by-magenet.php +192 -14
- readme.txt +11 -8
- uninstall.php +5 -5
- view-settings.php +81 -44
MagenetLinkAutoinstall.php
CHANGED
@@ -1,12 +1,14 @@
|
|
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']);
|
|
|
7 |
if (!class_exists('MagenetLinkAutoinstall')) {
|
8 |
-
|
9 |
-
|
|
|
10 |
private $cache_time = 3600;
|
11 |
private $api_host = "http://api.magenet.com";
|
12 |
private $api_get = "/wordpress/get";
|
@@ -15,151 +17,194 @@ if (!class_exists('MagenetLinkAutoinstall')) {
|
|
15 |
private $api_deactivate = "/wordpress/deactivate";
|
16 |
private $api_uninstall = "/wordpress/uninstall";
|
17 |
private $api_status = "/wordpress/status";
|
18 |
-
private $is_active_seo_plugin = false;
|
19 |
-
|
20 |
-
private $link_shown = 0;
|
21 |
private $lastError = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
public function MagenetLinkAutoinstall()
|
|
|
24 |
global $wpdb;
|
25 |
define('MagenetLinkAutoinstall', true);
|
26 |
$this->plugin_name = plugin_basename(plugin_file);
|
27 |
-
|
28 |
$this->tbl_magenet_links = $wpdb->prefix . 'magenet_links';
|
|
|
29 |
|
30 |
register_activation_hook($this->plugin_name, array(&$this, 'activate'));
|
31 |
register_deactivation_hook($this->plugin_name, array(&$this, 'deactivate'));
|
32 |
//register_uninstall_hook($this->plugin_name, array(&$this, 'uninstall'));
|
33 |
-
|
34 |
if (is_admin()) {
|
35 |
-
add_action('wp_print_scripts', array(&$this, 'admin_load_scripts'));
|
36 |
-
add_action('
|
37 |
-
add_action('
|
38 |
-
|
39 |
-
|
40 |
-
add_filter('the_content', array(&$this, 'add_magenet_links'));
|
41 |
-
add_filter('the_excerpt', array(&$this, 'add_magenet_links'));
|
42 |
-
}
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
-
|
46 |
-
public function getKey()
|
|
|
47 |
if (!$this->key) {
|
48 |
$this->key = get_option("magenet_links_autoinstall_key");
|
49 |
}
|
50 |
return $this->key;
|
51 |
-
}
|
52 |
-
|
|
|
|
|
53 |
update_option("magenet_links_autoinstall_key", $key);
|
54 |
$this->key = $key;
|
55 |
}
|
56 |
-
|
57 |
-
public function activate()
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
61 |
$table = $this->tbl_magenet_links;
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
if (!empty($wpdb->
|
66 |
-
$charset_collate
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
-
|
69 |
$sql_table_magenet_links = "
|
70 |
-
CREATE TABLE `"
|
71 |
`ID` INT(10) UNSIGNED NULL AUTO_INCREMENT,
|
72 |
`page_url` TEXT NOT NULL,
|
73 |
`link_html` TEXT NOT NULL,
|
74 |
PRIMARY KEY (`ID`)
|
75 |
-
)"
|
76 |
-
$sql_add_index = "CREATE INDEX page_url ON `"
|
77 |
-
|
78 |
-
if (
|
79 |
dbDelta($sql_table_magenet_links);
|
80 |
$wpdb->query($sql_add_index);
|
81 |
}
|
82 |
-
|
|
|
83 |
}
|
84 |
-
|
85 |
-
public function deactivate()
|
86 |
-
|
87 |
-
|
|
|
88 |
}
|
89 |
-
|
90 |
-
public function uninstall()
|
|
|
91 |
global $wpdb;
|
92 |
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}magenet_links");
|
93 |
-
|
94 |
}
|
95 |
-
|
96 |
-
public function admin_load_scripts()
|
97 |
-
|
|
|
98 |
wp_enqueue_script('magenetLinkAutoinstallAdminJs');
|
99 |
}
|
100 |
-
|
101 |
-
public function admin_load_styles()
|
102 |
-
|
|
|
103 |
wp_enqueue_style('magenetLinkAutoinstallAdminCss');
|
|
|
104 |
}
|
105 |
-
|
106 |
-
public function admin_generate_menu()
|
|
|
107 |
add_options_page('Website Monetization by MageNet', 'Website Monetization by MageNet', 'manage_options', 'magenet-links-settings', array(&$this, 'admin_magenet_settings'));
|
108 |
}
|
109 |
-
|
110 |
-
public function add_magenet_links($content)
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
130 |
$content .= $mads_block;
|
131 |
-
|
132 |
return $content;
|
133 |
}
|
134 |
-
|
135 |
-
public function admin_magenet_settings()
|
|
|
136 |
global $wpdb;
|
137 |
$magenet_key = $this->getKey();
|
138 |
-
|
139 |
if (isset($_POST['key']) && !empty($_POST['key'])) {
|
140 |
$magenet_key = $_POST['key'];
|
141 |
$test_key = $this->testKey($magenet_key);
|
142 |
if ($test_key) {
|
143 |
$this->setKey($magenet_key);
|
144 |
$result_text = "<span style=\"color: #009900;\">Key confirmed</span>";
|
145 |
-
if($this->status() == 2){
|
146 |
-
|
147 |
-
|
148 |
-
}
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
|
|
154 |
}
|
155 |
}
|
156 |
if (isset($_POST['update_data']) && $_POST['update_data'] == 1) {
|
157 |
-
$result = $this->sendRequest($this->api_host
|
158 |
if ($result) {
|
159 |
$wpdb->query("DELETE FROM {$this->tbl_magenet_links} WHERE 1");
|
160 |
$new_links = json_decode($result, TRUE);
|
161 |
-
if (count($new_links)>0)
|
162 |
-
foreach($new_links as $new_link) {
|
163 |
if (isset($new_link['page_url']) && isset($new_link['issue_html'])) {
|
164 |
$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']));
|
165 |
}
|
@@ -169,86 +214,138 @@ if (!class_exists('MagenetLinkAutoinstall')) {
|
|
169 |
$result_update_text = "<span style=\"color: #009900;\">Ads have been updated.</span>";
|
170 |
}
|
171 |
$link_data = $wpdb->get_results("SELECT * FROM `" . $this->tbl_magenet_links . "`", ARRAY_A);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
include_once('view-settings.php');
|
173 |
}
|
174 |
-
|
175 |
-
public function testKey($key)
|
176 |
-
|
|
|
177 |
return $result === "1";
|
178 |
}
|
179 |
-
|
180 |
-
public function getLinks()
|
|
|
181 |
global $wpdb;
|
182 |
$key = $this->getKey();
|
183 |
if ($key) {
|
184 |
$last_update_time = get_option("magenet_links_last_update");
|
185 |
if ($last_update_time + $this->cache_time < time()) {
|
186 |
-
$result = $this->sendRequest($this->api_host
|
187 |
if ($result) {
|
188 |
$wpdb->query("DELETE FROM {$this->tbl_magenet_links} WHERE 1");
|
189 |
$new_links = json_decode($result, TRUE);
|
190 |
-
if (count($new_links)>0)
|
191 |
-
foreach($new_links as $new_link) {
|
192 |
if (isset($new_link['page_url']) && isset($new_link['issue_html'])) {
|
193 |
$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']));
|
194 |
}
|
195 |
}
|
|
|
196 |
}
|
197 |
update_option("magenet_links_last_update", time());
|
198 |
}
|
199 |
-
|
200 |
-
$page_url = parse_url($site_url.str_replace("'", "\'", $_SERVER["REQUEST_URI"]));
|
201 |
-
|
202 |
-
|
|
|
203 |
$check_page_without_last_slash_query = "";
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
}
|
210 |
return false;
|
211 |
}
|
212 |
-
|
213 |
-
public function sendRequest($url, $key)
|
|
|
214 |
$siteurl = get_option("siteurl");
|
215 |
$params = http_build_query(array(
|
216 |
'url' => $siteurl,
|
217 |
'key' => $key,
|
218 |
-
|
219 |
));
|
220 |
if (function_exists('curl_init') && function_exists('curl_exec')) {
|
221 |
$ch = curl_init();
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
if (!$this
|
235 |
$result = $curl_result;
|
236 |
-
}
|
|
|
237 |
$result = false;
|
238 |
}
|
239 |
-
curl_close($ch);
|
240 |
-
}
|
241 |
-
|
|
|
242 |
$data = file_get_contents($url, false);
|
243 |
-
$result = $data;
|
244 |
}
|
245 |
return $result;
|
246 |
}
|
247 |
|
248 |
-
public function status()
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
}
|
253 |
}
|
254 |
-
|
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']);
|
7 |
+
|
8 |
if (!class_exists('MagenetLinkAutoinstall')) {
|
9 |
+
|
10 |
+
class MagenetLinkAutoinstall
|
11 |
+
{
|
12 |
private $cache_time = 3600;
|
13 |
private $api_host = "http://api.magenet.com";
|
14 |
private $api_get = "/wordpress/get";
|
17 |
private $api_deactivate = "/wordpress/deactivate";
|
18 |
private $api_uninstall = "/wordpress/uninstall";
|
19 |
private $api_status = "/wordpress/status";
|
20 |
+
//private $is_active_seo_plugin = false;
|
21 |
+
private $key = false;
|
22 |
+
//private $link_shown = 0;
|
23 |
private $lastError = 0;
|
24 |
+
private $the_content_log;
|
25 |
+
private $plugin_name;
|
26 |
+
private $plugin_url;
|
27 |
+
private $plugin_show_by;
|
28 |
+
private $tbl_magenet_links;
|
29 |
+
public static $shown;
|
30 |
+
public static $counter;
|
31 |
|
32 |
+
public function MagenetLinkAutoinstall()
|
33 |
+
{
|
34 |
global $wpdb;
|
35 |
define('MagenetLinkAutoinstall', true);
|
36 |
$this->plugin_name = plugin_basename(plugin_file);
|
37 |
+
$this->plugin_url = trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(plugin_file)));
|
38 |
$this->tbl_magenet_links = $wpdb->prefix . 'magenet_links';
|
39 |
+
$this->plugin_show_by = get_option("magenet_links_show_by");
|
40 |
|
41 |
register_activation_hook($this->plugin_name, array(&$this, 'activate'));
|
42 |
register_deactivation_hook($this->plugin_name, array(&$this, 'deactivate'));
|
43 |
//register_uninstall_hook($this->plugin_name, array(&$this, 'uninstall'));
|
44 |
+
|
45 |
if (is_admin()) {
|
46 |
+
//add_action('wp_print_scripts', array(&$this, 'admin_load_scripts'));
|
47 |
+
add_action('admin_enqueue_scripts', array(&$this, 'admin_load_scripts'));
|
48 |
+
//add_action('wp_print_styles', array(&$this, 'admin_load_styles'));
|
49 |
+
add_action('admin_enqueue_scripts', array(&$this, 'admin_load_styles'));
|
50 |
+
add_action('admin_menu', array(&$this, 'admin_generate_menu'));
|
|
|
|
|
|
|
51 |
}
|
52 |
+
else {
|
53 |
+
if (!has_filter('the_content', array(&$this, 'add_magenet_links'))) {
|
54 |
+
add_filter('the_content', array(&$this, 'add_magenet_links'));
|
55 |
+
add_filter('the_excerpt', array(&$this, 'add_magenet_links'));
|
56 |
+
}
|
57 |
+
|
58 |
+
add_action('get_footer', array(&$this, 'footerFilter'), 10000);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
public function footerFilter()
|
63 |
+
{
|
64 |
+
echo '<!-- wmm -->';
|
65 |
}
|
66 |
+
|
67 |
+
public function getKey()
|
68 |
+
{
|
69 |
if (!$this->key) {
|
70 |
$this->key = get_option("magenet_links_autoinstall_key");
|
71 |
}
|
72 |
return $this->key;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function setKey($key)
|
76 |
+
{
|
77 |
update_option("magenet_links_autoinstall_key", $key);
|
78 |
$this->key = $key;
|
79 |
}
|
80 |
+
|
81 |
+
public function activate()
|
82 |
+
{
|
83 |
+
global $wpdb;
|
84 |
+
//require_once(ABSPATH . 'wp-admin/upgrade-functions.php'); // depricated
|
85 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
86 |
+
|
87 |
$table = $this->tbl_magenet_links;
|
88 |
+
$charset_collate = '';
|
89 |
+
|
90 |
+
if (@version_compare(mysqli_get_server_info(), '4.1.0', '>=')) {
|
91 |
+
if (!empty($wpdb->charset)) {
|
92 |
+
$charset_collate = " DEFAULT CHARACTER SET {$wpdb->charset} ";
|
93 |
+
}
|
94 |
+
if (!empty($wpdb->collate)) {
|
95 |
+
$charset_collate .= " COLLATE {$wpdb->collate} ";
|
96 |
+
}
|
97 |
}
|
98 |
+
|
99 |
$sql_table_magenet_links = "
|
100 |
+
CREATE TABLE `" . $wpdb->prefix . "magenet_links` (
|
101 |
`ID` INT(10) UNSIGNED NULL AUTO_INCREMENT,
|
102 |
`page_url` TEXT NOT NULL,
|
103 |
`link_html` TEXT NOT NULL,
|
104 |
PRIMARY KEY (`ID`)
|
105 |
+
)" . $charset_collate . ";";
|
106 |
+
$sql_add_index = "CREATE INDEX page_url ON `" . $wpdb->prefix . "magenet_links` (page_url(100));";
|
107 |
+
|
108 |
+
if ($wpdb->get_var("show tables like '" . $table . "'") != $table) {
|
109 |
dbDelta($sql_table_magenet_links);
|
110 |
$wpdb->query($sql_add_index);
|
111 |
}
|
112 |
+
|
113 |
+
$result = $this->sendRequest($this->api_host . $this->api_activate, $this->getKey());
|
114 |
}
|
115 |
+
|
116 |
+
public function deactivate()
|
117 |
+
{
|
118 |
+
$result = $this->sendRequest($this->api_host . $this->api_deactivate, $this->getKey());
|
119 |
+
return true;
|
120 |
}
|
121 |
+
|
122 |
+
public function uninstall()
|
123 |
+
{
|
124 |
global $wpdb;
|
125 |
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}magenet_links");
|
126 |
+
$result = $this->sendRequest($this->api_host . $this->api_uninstall, $this->getKey());
|
127 |
}
|
128 |
+
|
129 |
+
public function admin_load_scripts()
|
130 |
+
{
|
131 |
+
wp_register_script('magenetLinkAutoinstallAdminJs', $this->plugin_url . 'js/admin-scripts.js', array('jquery-ui-dialog'));
|
132 |
wp_enqueue_script('magenetLinkAutoinstallAdminJs');
|
133 |
}
|
134 |
+
|
135 |
+
public function admin_load_styles()
|
136 |
+
{
|
137 |
+
wp_register_style('magenetLinkAutoinstallAdminCss', $this->plugin_url . 'css/admin-style.css');
|
138 |
wp_enqueue_style('magenetLinkAutoinstallAdminCss');
|
139 |
+
wp_enqueue_style('wp-jquery-ui-dialog');
|
140 |
}
|
141 |
+
|
142 |
+
public function admin_generate_menu()
|
143 |
+
{
|
144 |
add_options_page('Website Monetization by MageNet', 'Website Monetization by MageNet', 'manage_options', 'magenet-links-settings', array(&$this, 'admin_magenet_settings'));
|
145 |
}
|
146 |
+
|
147 |
+
public function add_magenet_links($content)
|
148 |
+
{
|
149 |
+
if ($this->plugin_show_by == 1) {
|
150 |
+
return $content;
|
151 |
+
}
|
152 |
+
|
153 |
+
//global $post;
|
154 |
+
|
155 |
+
$uniq_post_id = md5(substr($content, 0, 100));
|
156 |
+
if (strlen($content) > 0)
|
157 |
+
empty($this->the_content_log[$uniq_post_id]) ? $this->the_content_log[$uniq_post_id] = 1 : $this->the_content_log[$uniq_post_id] ++;
|
158 |
+
|
159 |
+
$mads_block = '';
|
160 |
+
if (count($this->the_content_log) == 1) {
|
161 |
+
//global $wpdb;
|
162 |
+
$link_data = $this->getLinks();
|
163 |
+
$mads_block = '<div class="mads-block">';
|
164 |
+
if (is_array($link_data) && count($link_data) > 0) {
|
165 |
+
foreach ($link_data as $link) {
|
166 |
+
$mads_block .= "\n" . $link['link_html'];
|
167 |
+
}
|
168 |
+
}
|
169 |
+
$mads_block .= '</div>';
|
170 |
+
}
|
171 |
+
|
172 |
$content .= $mads_block;
|
173 |
+
|
174 |
return $content;
|
175 |
}
|
176 |
+
|
177 |
+
public function admin_magenet_settings()
|
178 |
+
{
|
179 |
global $wpdb;
|
180 |
$magenet_key = $this->getKey();
|
181 |
+
|
182 |
if (isset($_POST['key']) && !empty($_POST['key'])) {
|
183 |
$magenet_key = $_POST['key'];
|
184 |
$test_key = $this->testKey($magenet_key);
|
185 |
if ($test_key) {
|
186 |
$this->setKey($magenet_key);
|
187 |
$result_text = "<span style=\"color: #009900;\">Key confirmed</span>";
|
188 |
+
if ($this->status() == 2) {
|
189 |
+
$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>';
|
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 |
+
$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>";
|
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 |
}
|
214 |
$result_update_text = "<span style=\"color: #009900;\">Ads have been updated.</span>";
|
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>';
|
221 |
+
}
|
222 |
+
|
223 |
+
$this->plugin_show_by = get_option("magenet_links_show_by");
|
224 |
+
|
225 |
include_once('view-settings.php');
|
226 |
}
|
227 |
+
|
228 |
+
public function testKey($key)
|
229 |
+
{
|
230 |
+
$result = $this->sendRequest($this->api_host . $this->api_test, $key);
|
231 |
return $result === "1";
|
232 |
}
|
233 |
+
|
234 |
+
public function getLinks()
|
235 |
+
{
|
236 |
global $wpdb;
|
237 |
$key = $this->getKey();
|
238 |
if ($key) {
|
239 |
$last_update_time = get_option("magenet_links_last_update");
|
240 |
if ($last_update_time + $this->cache_time < time()) {
|
241 |
+
$result = $this->sendRequest($this->api_host . $this->api_get, $key);
|
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 |
$check_page_without_last_slash_query = "";
|
261 |
+
if ($url_for_check[strlen($url_for_check) - 1] == "/") {
|
262 |
+
$check_page_without_last_slash_query = " OR page_url='" . substr($url_for_check, 0, -1) . "'";
|
263 |
+
}
|
264 |
+
$link_data = $wpdb->get_results("SELECT * FROM `" . $this->tbl_magenet_links . "` WHERE page_url='" . $url_for_check . "'" . $check_page_without_last_slash_query, ARRAY_A);
|
265 |
+
return $link_data;
|
266 |
}
|
267 |
return false;
|
268 |
}
|
269 |
+
|
270 |
+
public function sendRequest($url, $key)
|
271 |
+
{
|
272 |
$siteurl = get_option("siteurl");
|
273 |
$params = http_build_query(array(
|
274 |
'url' => $siteurl,
|
275 |
'key' => $key,
|
276 |
+
'version' => magenet_plugin_version
|
277 |
));
|
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);
|
285 |
+
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
|
286 |
+
curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
|
287 |
+
curl_setopt($ch, CURLOPT_POST, TRUE);
|
288 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
289 |
+
$curl_result = curl_exec($ch);
|
290 |
+
|
291 |
+
$this->lastError = curl_errno($ch);
|
292 |
+
if (!$this->lastError) {
|
293 |
$result = $curl_result;
|
294 |
+
}
|
295 |
+
else {
|
296 |
$result = false;
|
297 |
}
|
298 |
+
curl_close($ch);
|
299 |
+
}
|
300 |
+
else {
|
301 |
+
$url = $url . "?" . $params;
|
302 |
$data = file_get_contents($url, false);
|
303 |
+
$result = $data;
|
304 |
}
|
305 |
return $result;
|
306 |
}
|
307 |
|
308 |
+
public function status()
|
309 |
+
{
|
310 |
+
$result = $this->sendRequest($this->api_host . $this->api_status, $this->getKey());
|
311 |
+
return intval($result);
|
312 |
+
}
|
313 |
+
|
314 |
+
public function showLinksWidget($show = 0)
|
315 |
+
{
|
316 |
+
$show = abs((int) $show);
|
317 |
+
|
318 |
+
$link_data = $this->getLinks();
|
319 |
+
|
320 |
+
$mads_block = '<div class="mads-block">';
|
321 |
+
|
322 |
+
$counter_loop = 0;
|
323 |
+
$counter_show = 0;
|
324 |
+
if (is_array($link_data) && count($link_data) > 0) {
|
325 |
+
foreach ($link_data as $link) {
|
326 |
+
$counter_loop++;
|
327 |
+
|
328 |
+
if (self::$counter > 0 && self::$counter >= $counter_loop) {
|
329 |
+
continue;
|
330 |
+
}
|
331 |
+
|
332 |
+
self::$counter++;
|
333 |
+
$counter_show++;
|
334 |
+
|
335 |
+
$mads_block .= "\n" . $link['link_html'];
|
336 |
+
|
337 |
+
if ($show == $counter_show) {
|
338 |
+
break;
|
339 |
+
}
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
$mads_block .= '</div>';
|
344 |
+
|
345 |
+
self::$shown = true;
|
346 |
+
|
347 |
+
return $mads_block;
|
348 |
}
|
349 |
}
|
350 |
}
|
351 |
+
|
css/admin-style.css
CHANGED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.magenet-dialog {
|
2 |
+
background-color: #ffffcc;
|
3 |
+
}
|
4 |
+
|
5 |
+
.magenet-dialog *:focus{
|
6 |
+
outline: none !important;
|
7 |
+
}
|
8 |
+
|
9 |
+
.magenet-tutorial-popup {
|
10 |
+
position: relative;
|
11 |
+
}
|
12 |
+
|
13 |
+
.magenet-dialog .ui-dialog-titlebar {
|
14 |
+
background-color: #ffffcc;
|
15 |
+
border-bottom: none;
|
16 |
+
}
|
17 |
+
|
18 |
+
.magenet-dialog .btn_prev {
|
19 |
+
-webkit-border-radius: 8;
|
20 |
+
-moz-border-radius: 8;
|
21 |
+
border-radius: 8px;
|
22 |
+
color: #ffffff;
|
23 |
+
font-size: 16px;
|
24 |
+
background: #BCBCBC;
|
25 |
+
padding: 10px 20px 10px 20px;
|
26 |
+
border: solid #c0c0c0 1px;
|
27 |
+
text-decoration: none;
|
28 |
+
}
|
29 |
+
|
30 |
+
.magenet-dialog .btn_prev:hover {
|
31 |
+
background: #9c9a9c;
|
32 |
+
text-decoration: none;
|
33 |
+
cursor: pointer;
|
34 |
+
}
|
35 |
+
|
36 |
+
.magenet-dialog .btn_next, .magenet-dialog .btn_again {
|
37 |
+
-webkit-border-radius: 8;
|
38 |
+
-moz-border-radius: 8;
|
39 |
+
border-radius: 8px;
|
40 |
+
color: #ffffff;
|
41 |
+
font-size: 16px;
|
42 |
+
background: #FF9900;
|
43 |
+
padding: 10px 20px;
|
44 |
+
border: solid #FFCC00 1px;
|
45 |
+
text-decoration: none;
|
46 |
+
}
|
47 |
+
|
48 |
+
.magenet-dialog .btn_next:hover, .magenet-dialog .btn_again:hover {
|
49 |
+
background: #eb8d00;
|
50 |
+
text-decoration: none;
|
51 |
+
cursor: pointer;
|
52 |
+
}
|
53 |
+
|
54 |
+
.magenet-dialog .switch-to-automatic,
|
55 |
+
.magenet-dialog .activate {
|
56 |
+
-webkit-border-radius: 3;
|
57 |
+
-moz-border-radius: 3;
|
58 |
+
border-radius: 3px;
|
59 |
+
font-size: 14px;
|
60 |
+
padding: 7px 15px;
|
61 |
+
text-decoration: none;
|
62 |
+
}
|
63 |
+
|
64 |
+
.magenet-dialog .switch-to-automatic {
|
65 |
+
color: #000;
|
66 |
+
background: #fff;
|
67 |
+
border: solid #ccc 1px;
|
68 |
+
}
|
69 |
+
|
70 |
+
.magenet-dialog .activate {
|
71 |
+
color: #fff;
|
72 |
+
background: #c9302c;
|
73 |
+
border: solid #ac2925 1px;
|
74 |
+
}
|
75 |
+
|
76 |
+
.triangle-border {
|
77 |
+
position: relative;
|
78 |
+
padding: 15px;
|
79 |
+
margin: 1em 0 3em;
|
80 |
+
border: 5px solid #5a8f00;
|
81 |
+
color: #333;
|
82 |
+
background: #fff;
|
83 |
+
-webkit-border-radius: 10px;
|
84 |
+
-moz-border-radius: 10px;
|
85 |
+
border-radius: 10px;
|
86 |
+
}
|
87 |
+
.triangle-border.top::before {
|
88 |
+
top: -20px;
|
89 |
+
bottom: auto;
|
90 |
+
left: auto;
|
91 |
+
right: 40px;
|
92 |
+
border-width: 0 20px 20px;
|
93 |
+
}
|
94 |
+
.triangle-border::before {
|
95 |
+
content: "";
|
96 |
+
position: absolute;
|
97 |
+
bottom: -20px;
|
98 |
+
left: 40px;
|
99 |
+
border-width: 20px 20px 0;
|
100 |
+
border-style: solid;
|
101 |
+
border-color: #5a8f00 transparent;
|
102 |
+
display: block;
|
103 |
+
width: 0;
|
104 |
+
}
|
105 |
+
|
106 |
+
.triangle-border.top::after {
|
107 |
+
top: -13px;
|
108 |
+
bottom: auto;
|
109 |
+
/*left: auto;
|
110 |
+
right: 47px;*/
|
111 |
+
border-width: 0 13px 13px;
|
112 |
+
}
|
113 |
+
.triangle-border::after {
|
114 |
+
content: "";
|
115 |
+
position: absolute;
|
116 |
+
bottom: -13px;
|
117 |
+
left: 47px;
|
118 |
+
border-width: 13px 13px 0;
|
119 |
+
border-style: solid;
|
120 |
+
border-color: #fff transparent;
|
121 |
+
display: block;
|
122 |
+
width: 0;
|
123 |
+
}
|
124 |
+
|
125 |
+
.bubble
|
126 |
+
{
|
127 |
+
position: relative;
|
128 |
+
width: 500px;
|
129 |
+
/*height: 120px;*/
|
130 |
+
padding: 10px;
|
131 |
+
background: #E8FCDB;
|
132 |
+
-webkit-border-radius: 10px;
|
133 |
+
-moz-border-radius: 10px;
|
134 |
+
border-radius: 10px;
|
135 |
+
border: #7F7F7F solid 1px;
|
136 |
+
}
|
137 |
+
|
138 |
+
.bubble:after
|
139 |
+
{
|
140 |
+
content: '';
|
141 |
+
position: absolute;
|
142 |
+
border-style: solid;
|
143 |
+
border-width: 0 10px 10px;
|
144 |
+
border-color: #E8FCDB transparent;
|
145 |
+
display: block;
|
146 |
+
width: 0;
|
147 |
+
z-index: 1;
|
148 |
+
top: -10px;
|
149 |
+
left: 15px;
|
150 |
+
}
|
151 |
+
|
152 |
+
.bubble:before
|
153 |
+
{
|
154 |
+
content: '';
|
155 |
+
position: absolute;
|
156 |
+
border-style: solid;
|
157 |
+
border-width: 0 10px 10px;
|
158 |
+
border-color: #7F7F7F transparent;
|
159 |
+
display: block;
|
160 |
+
width: 0;
|
161 |
+
z-index: 0;
|
162 |
+
top: -11px;
|
163 |
+
left: 15px;
|
164 |
+
}
|
js/admin-scripts.js
CHANGED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
$(function () {
|
3 |
+
|
4 |
+
$('#mn-0, #mn-1, #mn-2, #mn-3, #mn-4, #mn-5, #mn-6').dialog({
|
5 |
+
autoOpen: false,
|
6 |
+
width: 500,
|
7 |
+
height: 250,
|
8 |
+
draggable: false,
|
9 |
+
dialogClass: 'magenet-dialog',
|
10 |
+
show: {effect: "fade", duration: 300},
|
11 |
+
hide: {effect: "fade", duration: 300}
|
12 |
+
});
|
13 |
+
|
14 |
+
$('.btn_prev').click(function () {
|
15 |
+
close_all_tutorial();
|
16 |
+
next_prev_popup_open(this, 'prev');
|
17 |
+
});
|
18 |
+
|
19 |
+
$('.btn_next').click(function () {
|
20 |
+
close_all_tutorial();
|
21 |
+
next_prev_popup_open(this, 'next');
|
22 |
+
});
|
23 |
+
|
24 |
+
$('.show-magenet-tutorial').click(function () {
|
25 |
+
close_all_tutorial();
|
26 |
+
$('#mn-1').dialog('open');
|
27 |
+
$('#mn-1').find('a').blur();
|
28 |
+
});
|
29 |
+
|
30 |
+
jQuery.post(ajaxurl, {'action': 'magenet_action'}, function (response) {
|
31 |
+
if (response == 1)
|
32 |
+
$('#mn-0').dialog('open');
|
33 |
+
});
|
34 |
+
|
35 |
+
var close_all_tutorial = function () {
|
36 |
+
$('#mn-0, #mn-1, #mn-2, #mn-3, #mn-4, #mn-5, #mn-6').dialog('close');
|
37 |
+
return false;
|
38 |
+
};
|
39 |
+
|
40 |
+
var next_prev_popup_open = function (button, direction)
|
41 |
+
{
|
42 |
+
var id_popup = $(button).closest('.magenet-tutorial-popup').attr('id');
|
43 |
+
|
44 |
+
if (id_popup) {
|
45 |
+
var where = 1;
|
46 |
+
if (direction == 'prev')
|
47 |
+
where = -1;
|
48 |
+
var ids_array = id_popup.split('-');
|
49 |
+
|
50 |
+
var id_other_number = parseInt(ids_array[1]) + 1 * where;
|
51 |
+
var id_other_str = '#' + ids_array[0] + '-' + id_other_number;
|
52 |
+
|
53 |
+
$(id_other_str).dialog('open');
|
54 |
+
$(id_other_str).find('a').blur();
|
55 |
+
}
|
56 |
+
};
|
57 |
+
|
58 |
+
});
|
59 |
+
})(jQuery);
|
monetization-by-magenet.php
CHANGED
@@ -1,29 +1,207 @@
|
|
1 |
<?php
|
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.
|
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'])) {
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
if (!function_exists('json_decode')) {
|
17 |
-
function json_decode($json, $assoc)
|
|
|
18 |
include_once('JSON.php');
|
19 |
$use = $assoc ? SERVICES_JSON_LOOSE_TYPE : 0;
|
20 |
-
|
21 |
-
|
22 |
}
|
23 |
}
|
24 |
|
25 |
-
require_once( plugin_dir_path(
|
26 |
global $magenetLinkAutoinstall;
|
27 |
$magenetLinkAutoinstall = new MagenetLinkAutoinstall();
|
28 |
ini_set('display_errors', $error_param);
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
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.22
|
6 |
+
Author: MageNet.com
|
7 |
+
Author URI: http://www.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 |
+
|
14 |
// Stop direct call
|
15 |
+
if (preg_match('#' . basename(plugin_file) . '#', $_SERVER['PHP_SELF'])) {
|
16 |
+
if (isset($_GET['check']) && !empty($_GET['check']) && strlen($_GET['check']) >= 10)
|
17 |
+
die(md5('magenet.com'));
|
18 |
+
|
19 |
+
die('You are not allowed to call this page directly.');
|
20 |
+
}
|
21 |
|
22 |
if (!function_exists('json_decode')) {
|
23 |
+
function json_decode($json, $assoc)
|
24 |
+
{
|
25 |
include_once('JSON.php');
|
26 |
$use = $assoc ? SERVICES_JSON_LOOSE_TYPE : 0;
|
27 |
+
$jsonO = new Services_JSON($use);
|
28 |
+
return $jsonO->decode($json);
|
29 |
}
|
30 |
}
|
31 |
|
32 |
+
require_once( plugin_dir_path(plugin_file) . 'MagenetLinkAutoinstall.php' );
|
33 |
global $magenetLinkAutoinstall;
|
34 |
$magenetLinkAutoinstall = new MagenetLinkAutoinstall();
|
35 |
ini_set('display_errors', $error_param);
|
36 |
+
|
37 |
+
add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'my_plugin_action_links');
|
38 |
+
|
39 |
+
function my_plugin_action_links($links)
|
40 |
+
{
|
41 |
+
$links[] = '<a href="http://www.magenet.com/magenet-services/#vip" target="_blank">Premium Support</a>';
|
42 |
+
$links[] = '<a href="javascript:void(0)" class="show-magenet-tutorial">?</a>';
|
43 |
+
return $links;
|
44 |
+
}
|
45 |
+
|
46 |
+
function magenet_notices()
|
47 |
+
{
|
48 |
+
if (strstr($_SERVER['SCRIPT_NAME'], 'plugins.php')) {
|
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 your are about to start earning with your site automatically.<br><br>
|
53 |
+
Press “Start tutorial” to set the plugin up in the most efficient way.
|
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 a MageNet</a> if you are new to <strong>MageNet</strong> to connect the plugin to ads 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 and confirm</a> your site to your <strong>MageNet</strong> account<br><br>
|
66 |
+
then<br><br>
|
67 |
+
find it in the list of Your Sites and click <span class="switch-to-automatic">Switch to Automatic</span>
|
68 |
+
<?php magenet_tutorial_buttons(); ?>
|
69 |
+
</div>
|
70 |
+
|
71 |
+
<div id="mn-3" class="magenet-tutorial-popup" style="display: none" title="Step 3">
|
72 |
+
... and then click <span class="activate">Activate</span><br><br>
|
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 |
+
Go to <strong>Settings</strong> section in the WordPress admin menu to the left and click "Website Monetization by MageNet" in the list below
|
79 |
+
<?php magenet_tutorial_buttons(); ?>
|
80 |
+
</div>
|
81 |
+
|
82 |
+
<div id="mn-5" class="magenet-tutorial-popup" style="display: none" title="Step 5">
|
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); ?>
|
91 |
+
</div>
|
92 |
+
|
93 |
+
<?php
|
94 |
+
}
|
95 |
+
}
|
96 |
+
add_action('admin_notices', 'magenet_notices');
|
97 |
+
|
98 |
+
function magenet_tutorial_buttons($direction = 0)
|
99 |
+
{
|
100 |
+
?>
|
101 |
+
<div style="position: absolute; bottom: 0; height: 48px; width: 468px;">
|
102 |
+
<div>
|
103 |
+
<div style="width: 40%; float: left; text-align: left;">
|
104 |
+
<?php if ($direction >= 0) { ?><span class="btn_prev tutorial-stop"><< Prev</span><?php } ?>
|
105 |
+
</div>
|
106 |
+
<div style="width: 40%; float: right; text-align: right;">
|
107 |
+
<?php if ($direction <= 0) { ?>
|
108 |
+
<?php if ($direction == -2) { ?>
|
109 |
+
<span class="btn_next tutorial-next">Start tutorial</span>
|
110 |
+
<?php
|
111 |
+
}
|
112 |
+
else {
|
113 |
+
?>
|
114 |
+
<span class="btn_next tutorial-next">Next >></span>
|
115 |
+
<?php } ?>
|
116 |
+
<?php
|
117 |
+
}
|
118 |
+
else {
|
119 |
+
?>
|
120 |
+
<span class="btn_again show-magenet-tutorial">Watch Again</span>
|
121 |
+
<?php } ?>
|
122 |
+
</div>
|
123 |
+
</div>
|
124 |
+
</div>
|
125 |
+
<?php
|
126 |
+
}
|
127 |
+
|
128 |
+
function magenet_action_callback()
|
129 |
+
{
|
130 |
+
echo (!get_option("magenet_links_autoinstall_key") ? 1 : 2);
|
131 |
+
wp_die();
|
132 |
+
}
|
133 |
+
add_action('wp_ajax_magenet_action', 'magenet_action_callback');
|
134 |
+
|
135 |
+
// widget
|
136 |
+
class Magenet_Widget extends WP_Widget
|
137 |
+
{
|
138 |
+
|
139 |
+
// constructor
|
140 |
+
function __construct()
|
141 |
+
{
|
142 |
+
parent::__construct(false, $name = 'Magenet Widget');
|
143 |
+
}
|
144 |
+
|
145 |
+
// widget form creation
|
146 |
+
function form($instance)
|
147 |
+
{
|
148 |
+
// Check values
|
149 |
+
if ($instance)
|
150 |
+
$select = esc_attr($instance['select']);
|
151 |
+
else
|
152 |
+
$select = 0;
|
153 |
+
?>
|
154 |
+
<?php /*
|
155 |
+
<p>You can set up as many widgets and locations as you wish and adjust the widgets to show as many ads as affordable.</p>
|
156 |
+
<p>Exapmle:</p>
|
157 |
+
<p>1st widget adjusted to place 2 ads - the first 2 sold ads will be placed at the location of the 1st widget then.</p>
|
158 |
+
<p>2nd widget adjusted to place 1 ad - the 3rd sold ad will be placed at the location of 2nd widget.</p>
|
159 |
+
<p>3rd widget adjusted to place the rest of ads (All ads chosen) - all the ads after 3rd will be placed in the 3rd widget.</p> */
|
160 |
+
?>
|
161 |
+
<p>
|
162 |
+
<label for="<?php echo $this->get_field_id('select'); ?>">Select the number ads to place in current widget</label>
|
163 |
+
<select name="<?php echo $this->get_field_name('select'); ?>" id="<?php echo $this->get_field_id('select'); ?>" class="widefat">
|
164 |
+
<?php
|
165 |
+
for ($i = 0; $i <= 10; $i++) {
|
166 |
+
$text = ($i == 0 ? 'All ads (default)' : $i . ' ad' . ($i == 1 ? '' : 's'));
|
167 |
+
echo '<option value="', $i, '"', $select == $i ? ' selected="selected"' : '', '>', $text, '</option>';
|
168 |
+
}
|
169 |
+
?>
|
170 |
+
</select>
|
171 |
+
</p>
|
172 |
+
<?php
|
173 |
+
}
|
174 |
+
|
175 |
+
// widget update
|
176 |
+
function update($new_instance, $old_instance)
|
177 |
+
{
|
178 |
+
$instance = $old_instance;
|
179 |
+
|
180 |
+
// Fields
|
181 |
+
$instance['select'] = strip_tags($new_instance['select']);
|
182 |
+
|
183 |
+
return $instance;
|
184 |
+
}
|
185 |
+
|
186 |
+
// widget display
|
187 |
+
function widget($args, $instance)
|
188 |
+
{
|
189 |
+
extract($args);
|
190 |
+
|
191 |
+
// these are the widget options
|
192 |
+
$select = (int) $instance['select'];
|
193 |
+
|
194 |
+
// Display the widget
|
195 |
+
echo $before_widget;
|
196 |
+
echo '<aside class="widget magenet_widget_box">';
|
197 |
+
|
198 |
+
global $magenetLinkAutoinstall;
|
199 |
+
echo $magenetLinkAutoinstall->showLinksWidget($select);
|
200 |
+
|
201 |
+
echo '</aside>';
|
202 |
+
echo $after_widget;
|
203 |
+
}
|
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");'));
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== Website Monetization by MageNet ===
|
2 |
Contributors: MageNet
|
3 |
-
Tags: website monetization, advertising, contextual ads,
|
4 |
Requires at least: 3.0.1
|
5 |
-
Tested up to:
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
-
Get additional income from your website or blog
|
11 |
|
12 |
== Description ==
|
13 |
|
@@ -18,13 +18,13 @@ To get started [sign up](http://www.magenet.com/) for a MageNet Key.
|
|
18 |
http://www.youtube.com/watch?v=DZAPP1LdlSI
|
19 |
|
20 |
**Hassle free**<br />
|
21 |
-
We deal with the advertisers and offer
|
22 |
|
23 |
**Regular payouts**<br />
|
24 |
-
Withdraw your earnings with ease. Transfers are made
|
25 |
|
26 |
**Full control**<br />
|
27 |
-
|
28 |
|
29 |
**Safe and secure**<br />
|
30 |
All your personal data is safe. Your websites will only be available to our trusted advertisers.
|
@@ -59,7 +59,7 @@ Once we sell at least 1 ad and you place it on your site, you will start to rece
|
|
59 |
|
60 |
= How will MageNet sell ads from my sites? =
|
61 |
|
62 |
-
Once you signup MageNet will index the content of your websites. We've got hundreds of advertisers, who want to purchase ads
|
63 |
|
64 |
= Can I exclude specific pages from ad sales? =
|
65 |
|
@@ -84,6 +84,9 @@ 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.21 =
|
88 |
* Refactored to remove deprecated code patterns.
|
89 |
|
@@ -159,4 +162,4 @@ MageNet crawler will index your sites the same way Google does. It will “read
|
|
159 |
Basic functionality. Requires MageNet Key
|
160 |
|
161 |
|
162 |
-
`<?php code(); // goes in backticks ?>`
|
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: 3.0.1
|
5 |
+
Tested up to: 4.7.1
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
+
Get additional income from your website or blog by placing text ads automatically.
|
11 |
|
12 |
== Description ==
|
13 |
|
18 |
http://www.youtube.com/watch?v=DZAPP1LdlSI
|
19 |
|
20 |
**Hassle free**<br />
|
21 |
+
We deal with the advertisers and offer relevant contextual ads to place. It's free and easy to use.
|
22 |
|
23 |
**Regular payouts**<br />
|
24 |
+
Withdraw your earnings with ease. Transfers are made via PayPal and WebMoney.
|
25 |
|
26 |
**Full control**<br />
|
27 |
+
We crawl all the pages of your site and list them for sales. You can set up the pages available or forbidden for advertising and set up the desired prices for your ads.
|
28 |
|
29 |
**Safe and secure**<br />
|
30 |
All your personal data is safe. Your websites will only be available to our trusted advertisers.
|
59 |
|
60 |
= How will MageNet sell ads from my sites? =
|
61 |
|
62 |
+
Once you signup MageNet will index the content of your websites. We've got hundreds of advertisers, who want to purchase ads matching your content. Once MageNet finds proper content on your websites, these pages will be offered for placement to our advertisers.
|
63 |
|
64 |
= Can I exclude specific pages from ad sales? =
|
65 |
|
84 |
3. "Pages options" menu
|
85 |
|
86 |
== Changelog ==
|
87 |
+
= 1.0.22 =
|
88 |
+
* Add widget
|
89 |
+
|
90 |
= 1.0.21 =
|
91 |
* Refactored to remove deprecated code patterns.
|
92 |
|
162 |
Basic functionality. Requires MageNet Key
|
163 |
|
164 |
|
165 |
+
`<?php code(); // goes in backticks ?>`
|
uninstall.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
//if uninstall not called from WordPress exit
|
3 |
-
if (
|
4 |
-
exit
|
5 |
-
|
6 |
-
|
|
|
7 |
global $magenetLinkAutoinstall;
|
8 |
$magenetLinkAutoinstall = new MagenetLinkAutoinstall();
|
9 |
$magenetLinkAutoinstall->uninstall();
|
10 |
-
?>
|
1 |
<?php
|
2 |
//if uninstall not called from WordPress exit
|
3 |
+
if (!defined('WP_UNINSTALL_PLUGIN')) {
|
4 |
+
exit();
|
5 |
+
}
|
6 |
+
define("plugin_file", __FILE__);
|
7 |
+
require_once( plugin_dir_path(plugin_file) . 'MagenetLinkAutoinstall.php' );
|
8 |
global $magenetLinkAutoinstall;
|
9 |
$magenetLinkAutoinstall = new MagenetLinkAutoinstall();
|
10 |
$magenetLinkAutoinstall->uninstall();
|
|
view-settings.php
CHANGED
@@ -1,51 +1,88 @@
|
|
1 |
<div class="wrap">
|
2 |
<h2>Website Monetization by MageNet</h2>
|
3 |
-
<p>
|
4 |
-
|
|
|
|
|
|
|
|
|
5 |
<div class="tool-box">
|
6 |
<h2 class="title">MageNet Key:</h2>
|
7 |
<form method="post" action="">
|
8 |
-
<input type="text" name="key" value="<?php echo $magenet_key
|
9 |
-
<input type="submit" name="
|
10 |
-
<?php echo $result_text; ?>
|
11 |
</form>
|
12 |
</div>
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
<
|
17 |
-
<
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
<
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
<
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div class="wrap">
|
2 |
<h2>Website Monetization by MageNet</h2>
|
3 |
+
<p>
|
4 |
+
By installing WordPress plugin, you allow MageNet to display paid contextual ads on pages where you grant permission via Pages options.<br>
|
5 |
+
Ad placement and removal process takes 3 hours. Please be patient.
|
6 |
+
</p>
|
7 |
+
<hr style="margin-bottom: 20px">
|
8 |
+
|
9 |
<div class="tool-box">
|
10 |
<h2 class="title">MageNet Key:</h2>
|
11 |
<form method="post" action="">
|
12 |
+
<input type="text" name="key" value="<?php echo (!empty($magenet_key) ? $magenet_key : ''); ?>" style="width: 325px" /><br> <br>
|
13 |
+
<input type="submit" name="submit_key" value="Save" style="width: 110px; margin-right: 12px;" />
|
14 |
+
<?php echo (!empty($result_text) ? $result_text : ''); ?>
|
15 |
</form>
|
16 |
</div>
|
17 |
+
<hr style="margin-bottom: 20px">
|
18 |
+
|
19 |
+
<?php if (!empty($magenet_key) && $magenet_key): ?>
|
20 |
+
<div class="tool-box">
|
21 |
+
<h2 class="title">Specify the ads location and placement method:</h2>
|
22 |
+
<form method="post" action="">
|
23 |
+
<?php $ch = 'checked="checked"'; ?>
|
24 |
+
<div style="margin-bottom: 4px"><input type="radio" name="links_show_by" value="0" <?php echo $this->plugin_show_by != 1 ? $ch : ''; ?> />
|
25 |
+
<b>Default Mode</b> - Automatic Ads Placement (Recommended)
|
26 |
+
<blockquote class="bubble">
|
27 |
+
This standard mode is suitable for most of WordPress themes on the websites.<br>
|
28 |
+
Ads appear as one block under an article or below the first article on the page with a list of articles.
|
29 |
+
</blockquote>
|
30 |
+
</div>
|
31 |
+
<div><input type="radio" name="links_show_by" value="1" <?php echo $this->plugin_show_by == 1 ? $ch : ''; ?> />
|
32 |
+
<b>Widget Mode</b> - Requires Manual Adjustments (For Experienced Users only)
|
33 |
+
<blockquote class="bubble">For correct operation, this mode should be additionally set. <br>
|
34 |
+
<b>Step 1</b> – activate the mode and click "Save" button,<br>
|
35 |
+
<b>Step 2</b> – switch to Appearance/Widgets section,<br>
|
36 |
+
<b>Step 3</b> – drag and drop "MageNet Widget" to a proper sidebar area,<br>
|
37 |
+
<b>Step 4</b> - in the opened widget click "Save" button.
|
38 |
+
</blockquote>
|
39 |
+
</div> <br>
|
40 |
+
<input type="submit" name="submit_links_show_by" value="Save" style="width: 110px; margin-right: 12px;" />
|
41 |
+
<?php echo (!empty($result_showBy_text) ? $result_showBy_text : ''); ?>
|
42 |
+
</form>
|
43 |
+
</div>
|
44 |
+
<hr style="margin-bottom: 20px">
|
45 |
+
|
46 |
+
|
47 |
+
<div class="tool-box">
|
48 |
+
<h2 class="title">Active Ads:</h2>
|
49 |
+
<table class="widefat">
|
50 |
+
<thead>
|
51 |
+
<tr class="table-header">
|
52 |
+
<th>Page URL</th>
|
53 |
+
<th>Ads content</th>
|
54 |
+
</tr>
|
55 |
+
</thead>
|
56 |
+
<tbody>
|
57 |
+
<?php if (is_array($link_data) && count($link_data) > 0): ?>
|
58 |
+
<?php foreach ($link_data as $key => $record): ?>
|
59 |
+
<tr>
|
60 |
+
<td class="url">
|
61 |
+
<?php echo $record['page_url'] ?>
|
62 |
+
</td>
|
63 |
+
<td class="link">
|
64 |
+
<?php echo $record['link_html'] ?>
|
65 |
+
</td>
|
66 |
+
</tr>
|
67 |
+
<?php endforeach; ?>
|
68 |
+
<?php else: ?>
|
69 |
+
<tr>
|
70 |
+
<td colspan="2" style="text-align:center">No Ads</td>
|
71 |
+
</tr>
|
72 |
+
<?php endif; ?>
|
73 |
+
</tbody>
|
74 |
+
</table>
|
75 |
+
</div>
|
76 |
+
|
77 |
+
<br />
|
78 |
+
|
79 |
+
<div class="tool-box">
|
80 |
+
<form method="post" action="">
|
81 |
+
<input type="hidden" name="update_data" value="1" />
|
82 |
+
<input type="submit" name="submit" value="Refresh Ads" style="width: 110px; margin-right: 12px;" />
|
83 |
+
<?php echo (!empty($result_update_text) ? $result_update_text : ''); ?>
|
84 |
+
</form>
|
85 |
+
</div>
|
86 |
+
<hr style="margin-bottom: 20px">
|
87 |
+
<?php endif; ?>
|
88 |
+
</div>
|