Version Description
Download this release
Release Info
Developer | namith.jawahar |
Plugin | Wp-Insert |
Version | 1.5.3 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.5.3
- includes/adsense.php +0 -398
- includes/adsenseperformance.php +0 -98
- includes/essentials.php +0 -1
- readme.txt +1 -1
- wp-insert.php +1 -1
includes/adsense.php
DELETED
@@ -1,398 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* PHP class that can retrieve data from AdSense account
|
5 |
-
* It's based on PHP AdSense account monitor class (http://www.webtoolkit.info/php-adsense-account-monitor.html)
|
6 |
-
* Copyright (C) 2009 Alex Polski
|
7 |
-
* This program is free software: you can redistribute it and/or modify
|
8 |
-
* it under the terms of the GNU General Public License as published by
|
9 |
-
* the Free Software Foundation, either version 3 of the License, or
|
10 |
-
* any later version.
|
11 |
-
*
|
12 |
-
* This program is distributed in the hope that it will be useful,
|
13 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
-
* GNU General Public License for more details.
|
16 |
-
*
|
17 |
-
* You should have received a copy of the GNU General Public License
|
18 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19 |
-
*/
|
20 |
-
|
21 |
-
|
22 |
-
/**
|
23 |
-
* sys_get_temp_dir function for the proper work in PHP4
|
24 |
-
* Based on http://www.php.net/sys_get_temp_dir
|
25 |
-
*/
|
26 |
-
if (!function_exists('sys_get_temp_dir')) {
|
27 |
-
function sys_get_temp_dir() {
|
28 |
-
if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); }
|
29 |
-
if (!empty($_ENV['TMPDIR'])) { return realpath( $_ENV['TMPDIR']); }
|
30 |
-
if (!empty($_ENV['TEMP'])) { return realpath( $_ENV['TEMP']); }
|
31 |
-
$tempfile = tempnam(uniqid(rand(), TRUE), '');
|
32 |
-
if (file_exists($tempfile)) {
|
33 |
-
unlink($tempfile);
|
34 |
-
return realpath(dirname($tempfile));
|
35 |
-
}
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* PHP class that can retrieve data from AdSense account
|
41 |
-
* @package AdSense
|
42 |
-
*/
|
43 |
-
class AdSense {
|
44 |
-
/**
|
45 |
-
* Stores curl connection handle
|
46 |
-
* @var resource
|
47 |
-
*/
|
48 |
-
var $curl = null;
|
49 |
-
|
50 |
-
|
51 |
-
/**
|
52 |
-
* AdSense::AdSense()
|
53 |
-
* AdSense class constructor
|
54 |
-
*/
|
55 |
-
function AdSense(){
|
56 |
-
$this->cookieFile = tempnam(sys_get_temp_dir(), 'cookie');
|
57 |
-
|
58 |
-
$this->curl = curl_init();
|
59 |
-
curl_setopt($this->curl, CURLOPT_HEADER, false);
|
60 |
-
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
|
61 |
-
curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);
|
62 |
-
curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);
|
63 |
-
curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
|
64 |
-
curl_setopt($this->curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7");
|
65 |
-
curl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookieFile);
|
66 |
-
curl_setopt($this->curl, CURLOPT_COOKIEJAR, $this->cookieFile);
|
67 |
-
|
68 |
-
register_shutdown_function(array(&$this, '__destructor'));
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
-
/**
|
73 |
-
* AdSense::__destructor()
|
74 |
-
* AdSense class destructor
|
75 |
-
*/
|
76 |
-
function __destructor(){
|
77 |
-
@curl_close($this->curl);
|
78 |
-
@unlink($this->cookieFile);
|
79 |
-
}
|
80 |
-
|
81 |
-
|
82 |
-
/**
|
83 |
-
* AdSense::connect()
|
84 |
-
* Connects to AdSense account using supplied credentials
|
85 |
-
* Returns true on unsuccessful connection, false otherwise
|
86 |
-
*
|
87 |
-
* @param string $username AdSense username
|
88 |
-
* @param string $password AdSense password
|
89 |
-
* @return boolean
|
90 |
-
*/
|
91 |
-
function connect($username, $password){
|
92 |
-
// /adsense/
|
93 |
-
curl_setopt($this->curl, CURLOPT_POST, false);
|
94 |
-
curl_setopt($this->curl, CURLOPT_URL, 'https://www.google.com/adsense/');
|
95 |
-
$content = curl_exec($this->curl);
|
96 |
-
|
97 |
-
// /adsense/login-box.js
|
98 |
-
curl_setopt($this->curl, CURLOPT_POST, false);
|
99 |
-
curl_setopt($this->curl, CURLOPT_URL, 'https://www.google.com/adsense/login-box.js');
|
100 |
-
$content = curl_exec($this->curl);
|
101 |
-
$content = preg_replace(
|
102 |
-
array("/\\\\75/", "/\\\\42/", "/\\\\46/", "/\\\\075/"),
|
103 |
-
array('=', '"', '&', '='),
|
104 |
-
$content);
|
105 |
-
preg_match('/src="([^"]+)"/', $content, $match);
|
106 |
-
$next_url = $match[1];
|
107 |
-
$next_url = str_replace('&', '&', $next_url);
|
108 |
-
|
109 |
-
// /accounts/ServiceLoginBox
|
110 |
-
curl_setopt($this->curl, CURLOPT_POST, false);
|
111 |
-
curl_setopt($this->curl, CURLOPT_URL, $next_url);
|
112 |
-
$content = curl_exec($this->curl);
|
113 |
-
preg_match_all('<input type="hidden" name="(.*?)" value="(.*?)">', curl_exec($this->curl), $out);
|
114 |
-
$params = array();
|
115 |
-
foreach($out[1] as $key=>$name) {
|
116 |
-
$params[] = $name . '=' . urlencode($out[2][$key]);
|
117 |
-
}
|
118 |
-
$params[] = 'Email=' . urlencode($username);
|
119 |
-
$params[] = 'Passwd=' . urlencode($password);
|
120 |
-
$params[] = 'null=' . urlencode('Sign in');
|
121 |
-
|
122 |
-
// /accounts/ServiceLoginBoxAuth
|
123 |
-
curl_setopt($this->curl, CURLOPT_POST, true);
|
124 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/accounts/ServiceLoginBoxAuth");
|
125 |
-
curl_setopt($this->curl, CURLOPT_POSTFIELDS, join('&', $params));
|
126 |
-
$content = curl_exec($this->curl);
|
127 |
-
preg_match("/<a href=\"([^\"]+)\"[^>]*>click here to continue<\/a>/", $content, $match);
|
128 |
-
$next_url = $match[1];
|
129 |
-
$next_url = str_replace('&', '&', $next_url);
|
130 |
-
|
131 |
-
// /accounts/CheckCookie
|
132 |
-
curl_setopt($this->curl, CURLOPT_POST, false);
|
133 |
-
curl_setopt($this->curl, CURLOPT_URL, $next_url);
|
134 |
-
$content = curl_exec($this->curl);
|
135 |
-
preg_match('/location\.replace\("(.+?)"\)/', $content, $match);
|
136 |
-
$next_url = $match[1];
|
137 |
-
$next_url = preg_replace_callback("/\\\\x(..)/i", create_function('$match', 'return chr(hexdec($match[1]));'), $next_url);
|
138 |
-
|
139 |
-
// /accounts/SetSID
|
140 |
-
curl_setopt($this->curl, CURLOPT_POST, false);
|
141 |
-
curl_setopt($this->curl, CURLOPT_URL, $next_url);
|
142 |
-
$content = curl_exec($this->curl);
|
143 |
-
|
144 |
-
// did we login ?
|
145 |
-
if (eregi("<a href=\"/adsense/signout\">", $content)) {
|
146 |
-
return true;
|
147 |
-
} else {
|
148 |
-
return false;
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Log out
|
154 |
-
*/
|
155 |
-
function log_out(){
|
156 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/signout");
|
157 |
-
curl_exec($this->curl);
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* AdSense::parse()
|
162 |
-
* Parses AdSense page and gets all stats
|
163 |
-
* Returns associative array with collected data
|
164 |
-
*
|
165 |
-
* @param string $content AdSense page content
|
166 |
-
* @return array
|
167 |
-
*/
|
168 |
-
function parse($content){
|
169 |
-
preg_match_all('/<td nowrap valign="top" style="text-align:right" class="">(.*?)<\/td>/', $content, $matches);
|
170 |
-
return array(
|
171 |
-
"impressions" => $matches[1][0],
|
172 |
-
"clicks" => $matches[1][1],
|
173 |
-
"ctr" => $matches[1][2],
|
174 |
-
"ecpm" => $matches[1][3],
|
175 |
-
"earnings" => $matches[1][4]
|
176 |
-
);
|
177 |
-
|
178 |
-
}
|
179 |
-
|
180 |
-
|
181 |
-
/**
|
182 |
-
* AdSense::today()
|
183 |
-
* Gets AdSense data for the period: today
|
184 |
-
* Returns associative array with collected data
|
185 |
-
*
|
186 |
-
* @return array
|
187 |
-
*/
|
188 |
-
function today(){
|
189 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/report/overview?timePeriod=today");
|
190 |
-
return $this->parse(curl_exec($this->curl));
|
191 |
-
}
|
192 |
-
|
193 |
-
|
194 |
-
/**
|
195 |
-
* AdSense::yesterday()
|
196 |
-
* Gets AdSense data for the period: yesterday
|
197 |
-
* Returns associative array with collected data
|
198 |
-
*
|
199 |
-
* @return array
|
200 |
-
*/
|
201 |
-
function yesterday(){
|
202 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/report/overview?timePeriod=yesterday");
|
203 |
-
return $this->parse(curl_exec($this->curl));
|
204 |
-
}
|
205 |
-
|
206 |
-
|
207 |
-
/**
|
208 |
-
* AdSense::last7days()
|
209 |
-
* Gets AdSense data for the period: last7days
|
210 |
-
* Returns associative array with collected data
|
211 |
-
*
|
212 |
-
* @return array
|
213 |
-
*/
|
214 |
-
function last7days(){
|
215 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/report/overview?timePeriod=last7days");
|
216 |
-
return $this->parse(curl_exec($this->curl));
|
217 |
-
}
|
218 |
-
|
219 |
-
|
220 |
-
/**
|
221 |
-
* AdSense::lastmonth()
|
222 |
-
* Gets AdSense data for the period: lastmonth
|
223 |
-
* Returns associative array with collected data
|
224 |
-
*
|
225 |
-
* @return array
|
226 |
-
*/
|
227 |
-
function lastmonth(){
|
228 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/report/overview?timePeriod=lastmonth");
|
229 |
-
return $this->parse(curl_exec($this->curl));
|
230 |
-
}
|
231 |
-
|
232 |
-
|
233 |
-
/**
|
234 |
-
* AdSense::thismonth()
|
235 |
-
* Gets AdSense data for the period: thismonth
|
236 |
-
* Returns associative array with collected data
|
237 |
-
*
|
238 |
-
* @return array
|
239 |
-
*/
|
240 |
-
function thismonth(){
|
241 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/report/overview?timePeriod=thismonth");
|
242 |
-
return $this->parse(curl_exec($this->curl));
|
243 |
-
}
|
244 |
-
|
245 |
-
|
246 |
-
/**
|
247 |
-
* AdSense::sincelastpayment()
|
248 |
-
* Gets AdSense data for the period: sincelastpayment
|
249 |
-
* Returns associative array with collected data
|
250 |
-
*
|
251 |
-
* @return array
|
252 |
-
*/
|
253 |
-
function sincelastpayment(){
|
254 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/report/overview?timePeriod=sincelastpayment");
|
255 |
-
return $this->parse(curl_exec($this->curl));
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Get current report id by report name.
|
260 |
-
* Helps to avoid problems with report editing and ids.
|
261 |
-
*
|
262 |
-
* @param string $name
|
263 |
-
* @return int
|
264 |
-
*/
|
265 |
-
function get_report_id_from_name($name){
|
266 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/report/overview");
|
267 |
-
$page = curl_exec($this->curl);
|
268 |
-
|
269 |
-
preg_match('~<a href=".*reportId=([0-9]+)">'.$name.'</a>~i', $page, $matches);
|
270 |
-
|
271 |
-
if(empty($matches[1])) return false;
|
272 |
-
|
273 |
-
return $matches[1];
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Get csv data from custom report
|
278 |
-
* Warning: if you will edit report at Google Adsense page, its id will change!
|
279 |
-
*
|
280 |
-
* @param int $id
|
281 |
-
* @param string $encoding
|
282 |
-
* @return string
|
283 |
-
*/
|
284 |
-
function get_report_as_csv($report_id, $encoding = 'UTF-8'){
|
285 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/report/view-custom.do?reportId=$report_id&outputFormat=TSV_EXCEL");
|
286 |
-
|
287 |
-
//By default report is in UTF-16LE
|
288 |
-
return iconv('UTF-16', $encoding, curl_exec($this->curl));
|
289 |
-
}
|
290 |
-
|
291 |
-
/**
|
292 |
-
* Get report data as array. Uses html parser. A bit slower than get_report_as_csv.
|
293 |
-
* Warning: if you will edit report at Google Adsense page, its id will change!
|
294 |
-
*
|
295 |
-
* @param int $report_id
|
296 |
-
* @return array
|
297 |
-
*/
|
298 |
-
function report($report_id){
|
299 |
-
$result = array();
|
300 |
-
curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/adsense/report/view-custom.do?reportId=$report_id");
|
301 |
-
$content = curl_exec($this->curl);
|
302 |
-
if (preg_match('/var\s+reportTable\s+=\s+new\s+AsyncReportTable\(([^\)]+)\);/si', $content, $matches)) {
|
303 |
-
$params = array();
|
304 |
-
foreach (explode(",\n", $matches[1]) as $v) {
|
305 |
-
$params[] = trim($v, " \t'\"\n\r");
|
306 |
-
}
|
307 |
-
curl_setopt($this->curl, CURLOPT_URL,
|
308 |
-
'https://www.google.com/adsense/report/online-stored-reporttable?storedReportId=' .
|
309 |
-
$params[0] . '&reportUri=' . str_replace('?', '%3F', str_replace('/', '%2F', str_replace('\x', '%', $params[2]))) .
|
310 |
-
'&formId=' . $params[3] . '&title=' . str_replace('+', '%20', urlencode($params[1])) . '&waitTime0');
|
311 |
-
do {
|
312 |
-
$content = curl_exec($this->curl);
|
313 |
-
if (empty($content)) {
|
314 |
-
sleep(1);
|
315 |
-
}
|
316 |
-
} while (empty($content));
|
317 |
-
if (preg_match_all('/<tr\s+class="(odd|even)\s+datarow">\s*' .
|
318 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
319 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
320 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
321 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
322 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
323 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
324 |
-
'<\/tr>/si', $content, $matches)) {
|
325 |
-
foreach ($matches[2] as $k => $v) {
|
326 |
-
$result[$k]['channel'] = preg_replace('/<.+>/', '', $v);
|
327 |
-
$result[$k]['impressions'] = $matches[3][$k];
|
328 |
-
$result[$k]['clicks'] = $matches[4][$k];
|
329 |
-
$result[$k]['ctr'] = $matches[5][$k];
|
330 |
-
$result[$k]['ecpm'] = $matches[6][$k];
|
331 |
-
$result[$k]['earnings'] = $matches[7][$k];
|
332 |
-
}
|
333 |
-
}
|
334 |
-
}
|
335 |
-
return $result;
|
336 |
-
}
|
337 |
-
|
338 |
-
function quick_report($url){
|
339 |
-
$result = array();
|
340 |
-
curl_setopt($this->curl, CURLOPT_URL, $url);
|
341 |
-
$content = curl_exec($this->curl);
|
342 |
-
if (preg_match('/var\s+reportTable\s+=\s+new\s+AsyncReportTable\(([^\)]+)\);/si', $content, $matches)) {
|
343 |
-
$params = array();
|
344 |
-
foreach (explode(",\n", $matches[1]) as $v) {
|
345 |
-
$params[] = trim($v, " \t'\"\n\r");
|
346 |
-
}
|
347 |
-
$reportUri = preg_replace(
|
348 |
-
array('/&/', '/=/', '/\?/', '/\//'),
|
349 |
-
array('%26', '%3D', '%3F', '%2F'),
|
350 |
-
$params[2]);
|
351 |
-
$reportUri = str_replace('\x', '%', $reportUri);
|
352 |
-
curl_setopt($this->curl, CURLOPT_URL,
|
353 |
-
'https://www.google.com/adsense/report/online-stored-reporttable?storedReportId=' .
|
354 |
-
$params[0] . '&reportUri=' . $reportUri .
|
355 |
-
'&formId=' . $params[3] . '&title=' . str_replace('+', '%20', urlencode($params[1])) . '&waitTime0');
|
356 |
-
$tr = 0;
|
357 |
-
do {
|
358 |
-
$content = curl_exec($this->curl);
|
359 |
-
if (empty($content) or $content === true) {
|
360 |
-
sleep(1);
|
361 |
-
if (++$tr > 10) {
|
362 |
-
echo "Can't get the report data!\n";
|
363 |
-
die;
|
364 |
-
}
|
365 |
-
}
|
366 |
-
} while (empty($content) or $content === true);
|
367 |
-
if (preg_match_all('/<tr\s+class="(odd|even)\s+datarow">\s*' .
|
368 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
369 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
370 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
371 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
372 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
373 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
374 |
-
'<td[^>]*>(.*?)<\/td>\s*' .
|
375 |
-
'<\/tr>/si', $content, $matches)) {
|
376 |
-
$day = 0;
|
377 |
-
$n = 0;
|
378 |
-
foreach ($matches[3] as $k => $v) {
|
379 |
-
if ($day === 0) {
|
380 |
-
$day = date('Y-m-d', strtotime($matches[2][$k]));
|
381 |
-
}
|
382 |
-
if (isset($matches[2][$k - 1]) && $matches[2][$k - 1] != $matches[2][$k]) {
|
383 |
-
$day = date('Y-m-d', strtotime($matches[2][$k]));
|
384 |
-
$n = 0;
|
385 |
-
}
|
386 |
-
$result[$day][$n]['channel'] = preg_replace('/\s*<[^>]+>\s*/', '', $v);
|
387 |
-
$result[$day][$n]['impressions'] = $matches[4][$k];
|
388 |
-
$result[$day][$n]['clicks'] = $matches[5][$k];
|
389 |
-
$result[$day][$n]['ctr'] = $matches[6][$k];
|
390 |
-
$result[$day][$n]['ecpm'] = $matches[7][$k];
|
391 |
-
$result[$day][$n]['earnings'] = $matches[8][$k];
|
392 |
-
$n++;
|
393 |
-
}
|
394 |
-
}
|
395 |
-
}
|
396 |
-
return $result;
|
397 |
-
}
|
398 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/adsenseperformance.php
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once (dirname(__FILE__) . '/adsense.php');
|
3 |
-
|
4 |
-
$adsense = new AdSense();
|
5 |
-
$adsenseStatus = false;
|
6 |
-
|
7 |
-
function wp_insert_adsense_page() {
|
8 |
-
global $screen_layout_columns;
|
9 |
-
|
10 |
-
add_meta_box('wp_insert_adsense_login_credentials', 'Adsense Username and Password', 'wp_insert_adsense_login_credentials_HTML', 'col_1');
|
11 |
-
|
12 |
-
global $adsense;
|
13 |
-
global $adsenseStatus;
|
14 |
-
if(get_option('wp_insert_adsense_username') != '') {
|
15 |
-
if ($adsense->connect(get_option('wp_insert_adsense_username'), get_option('wp_insert_adsense_password'))) {
|
16 |
-
$adsenseStatus = true;
|
17 |
-
add_meta_box('wp_insert_adsense_sincelastpayment', 'Adsense : Total Since Last Payment', 'wp_insert_adsense_sincelastpayment_HTML', 'col_1');
|
18 |
-
add_meta_box('wp_insert_adsense_today', 'Adsense : Today', 'wp_insert_adsense_today_HTML', 'col_1');
|
19 |
-
add_meta_box('wp_insert_adsense_yesterday', 'Adsense : Yesterday', 'wp_insert_adsense_yesterday_HTML', 'col_1');
|
20 |
-
add_meta_box('wp_insert_adsense_last7days', 'Adsense : Last 7 Days', 'wp_insert_adsense_last7days', 'col_1');
|
21 |
-
add_meta_box('wp_insert_adsense_thismonth', 'Adsense : This Month', 'wp_insert_adsense_thismonth_HTML', 'col_1');
|
22 |
-
add_meta_box('wp_insert_adsense_lastmonth', 'Adsense : Last Month', 'wp_insert_adsense_lastmonth_HTML', 'col_1');
|
23 |
-
} else {
|
24 |
-
$adsenseStatus = false;
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
$parameters = 'wp_insert_adsense_username, wp_insert_adsense_password';
|
29 |
-
wp_insert_settings_page_layout($parameters, 'WP-INSERT : Monitor Adsense', 'adsense');
|
30 |
-
}
|
31 |
-
|
32 |
-
function wp_insert_adsense_login_credentials_HTML() { ?>
|
33 |
-
<div>
|
34 |
-
<p>
|
35 |
-
<label for="wp_insert_adsense_username">Adsense Username :</label>
|
36 |
-
<input id="wp_insert_adsense_username" class="widefat" type="text" value="<?php echo get_option('wp_insert_adsense_username'); ?>" name="wp_insert_adsense_username"/>
|
37 |
-
</p>
|
38 |
-
<p>
|
39 |
-
<label for="wp_insert_adsense_password">Adsense Password:</label>
|
40 |
-
<input id="wp_insert_adsense_password" class="widefat" type="password" value="<?php echo get_option('wp_insert_adsense_password'); ?>" name="wp_insert_adsense_password"/>
|
41 |
-
</p>
|
42 |
-
<p>
|
43 |
-
<?php global $adsenseStatus; if($adsenseStatus == true) { echo "<span style='color:green'>Adsense - Remote Login : Successful</span>"; } else { echo "<span style='color:red'>Adsense - Remote Login : Failed</span>"; } ?>
|
44 |
-
</p>
|
45 |
-
<p>
|
46 |
-
<small>Data Retrieval Based on <a href="http://www.webtoolkit.info/php-adsense-account-monitor.html">PHP AdSense account monitor class</a></small><br/>
|
47 |
-
</p>
|
48 |
-
</div>
|
49 |
-
<?php }
|
50 |
-
|
51 |
-
function wp_insert_get_adsense_result_HTML($data) { ?>
|
52 |
-
<p>
|
53 |
-
<span class="earnings"><?php echo $data['earnings']; ?></span>
|
54 |
-
<span class="bigbold">Impressions : <?php echo $data['impressions']; ?></span><br/>
|
55 |
-
<span class="bigbold">Clicks : <?php echo $data['clicks']; ?></span><br/>
|
56 |
-
<span class="bigbold">CTR : <?php echo $data['ctr']; ?></span><br/>
|
57 |
-
<span class="bigbold">eCPM : <?php echo $data['ecpm']; ?></span>
|
58 |
-
</p>
|
59 |
-
<div class="clear"></div>
|
60 |
-
<?php }
|
61 |
-
|
62 |
-
function wp_insert_adsense_sincelastpayment_HTML() { ?>
|
63 |
-
<div>
|
64 |
-
<?php global $adsense; wp_insert_get_adsense_result_HTML($adsense->sincelastpayment()); ?>
|
65 |
-
</div>
|
66 |
-
<?php }
|
67 |
-
|
68 |
-
function wp_insert_adsense_today_HTML() { ?>
|
69 |
-
<div>
|
70 |
-
<?php global $adsense; wp_insert_get_adsense_result_HTML($adsense->today()); ?>
|
71 |
-
</div>
|
72 |
-
<?php }
|
73 |
-
|
74 |
-
function wp_insert_adsense_yesterday_HTML() { ?>
|
75 |
-
<div>
|
76 |
-
<?php global $adsense; wp_insert_get_adsense_result_HTML($adsense->yesterday()); ?>
|
77 |
-
</div>
|
78 |
-
<?php }
|
79 |
-
|
80 |
-
function wp_insert_adsense_last7days() { ?>
|
81 |
-
<div>
|
82 |
-
<?php global $adsense; wp_insert_get_adsense_result_HTML($adsense->last7days()); ?>
|
83 |
-
</div>
|
84 |
-
<?php }
|
85 |
-
|
86 |
-
function wp_insert_adsense_thismonth_HTML() { ?>
|
87 |
-
<div>
|
88 |
-
<?php global $adsense; wp_insert_get_adsense_result_HTML($adsense->thismonth()); ?>
|
89 |
-
</div>
|
90 |
-
<?php }
|
91 |
-
|
92 |
-
function wp_insert_adsense_lastmonth_HTML() { ?>
|
93 |
-
<div>
|
94 |
-
<?php global $adsense; wp_insert_get_adsense_result_HTML($adsense->lastmonth()); ?>
|
95 |
-
</div>
|
96 |
-
<?php $adsense->log_out();
|
97 |
-
}
|
98 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/essentials.php
CHANGED
@@ -126,6 +126,5 @@ require_once (dirname(__FILE__) . '/widgethook.php');
|
|
126 |
require_once (dirname(__FILE__) . '/contenthook.php');
|
127 |
require_once (dirname(__FILE__) . '/ads.php');
|
128 |
require_once (dirname(__FILE__) . '/adsadvanced.php');
|
129 |
-
require_once (dirname(__FILE__) . '/adsenseperformance.php');
|
130 |
require_once (dirname(__FILE__) . '/feeds.php');
|
131 |
?>
|
126 |
require_once (dirname(__FILE__) . '/contenthook.php');
|
127 |
require_once (dirname(__FILE__) . '/ads.php');
|
128 |
require_once (dirname(__FILE__) . '/adsadvanced.php');
|
|
|
129 |
require_once (dirname(__FILE__) . '/feeds.php');
|
130 |
?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:http://www.wp-insert.smartlogix.co.in/
|
|
4 |
Tags: adsense,google,widget,post,admin,plugin,rss,feedburner,ads,subscribe,fck editor,category description editor,excerpt,WYSIWYG,WYSIWYG editor,in post ads,feed logo,smartlogix,ads in feeds,analytics,google analytics,header,footer,ad management,advertisements,content,ad,advertising,blog,feed,feeds,formatting,html,javascript,manage,post,posts,seo,sidebar,widget,widgets,wordpress,tracking,syntex highlighter,highlighting,theme tools,plugin tools,developer tools,highlighting,theme editor,plugin editor,middle ad,ad filtration,pagewise ad filtration,template ads,ad tags,adbrite ads,adsense ready,easy adsense,adsense optimized
|
5 |
Requires at least: 2.7
|
6 |
Tested up to: 2.9
|
7 |
-
Stable tag: 1.5.
|
8 |
|
9 |
Wp-Insert is the most powerful yet easiest to use wordpress ad management plugin which does a lot more than ad management.
|
10 |
|
4 |
Tags: adsense,google,widget,post,admin,plugin,rss,feedburner,ads,subscribe,fck editor,category description editor,excerpt,WYSIWYG,WYSIWYG editor,in post ads,feed logo,smartlogix,ads in feeds,analytics,google analytics,header,footer,ad management,advertisements,content,ad,advertising,blog,feed,feeds,formatting,html,javascript,manage,post,posts,seo,sidebar,widget,widgets,wordpress,tracking,syntex highlighter,highlighting,theme tools,plugin tools,developer tools,highlighting,theme editor,plugin editor,middle ad,ad filtration,pagewise ad filtration,template ads,ad tags,adbrite ads,adsense ready,easy adsense,adsense optimized
|
5 |
Requires at least: 2.7
|
6 |
Tested up to: 2.9
|
7 |
+
Stable tag: 1.5.3
|
8 |
|
9 |
Wp-Insert is the most powerful yet easiest to use wordpress ad management plugin which does a lot more than ad management.
|
10 |
|
wp-insert.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: wp-insert
|
4 |
Plugin URI: http://www.wp-insert.smartlogix.co.in/
|
5 |
Description: The ultimate wordpress plugin
|
6 |
-
Version: 1.5.
|
7 |
Author: Namith Jawahar
|
8 |
Author URI: http://www.smartlogix.co.in/
|
9 |
WP-INSERT by SMARTLOGIX : The ultimate wordpress plugin
|
3 |
Plugin Name: wp-insert
|
4 |
Plugin URI: http://www.wp-insert.smartlogix.co.in/
|
5 |
Description: The ultimate wordpress plugin
|
6 |
+
Version: 1.5.3
|
7 |
Author: Namith Jawahar
|
8 |
Author URI: http://www.smartlogix.co.in/
|
9 |
WP-INSERT by SMARTLOGIX : The ultimate wordpress plugin
|