Version Description
- Fixed Canonical link for facebook Open Graph
- Don't show the Canonical Link if Squirrly SEO is off
- Fixed keyword saving on post update
- Happy New Year!
Download this release
Release Info
Developer | cifi |
Plugin | SEO SQUIRRLY™ |
Version | 6.2.6 |
Comparing to | |
See all releases |
Code changes from version 6.1.0 to 6.2.6
- classes/SQ_HookController.php +2 -2
- classes/SQ_Ranking.php +100 -59
- classes/SQ_Tools.php +74 -86
- config/paths.php +2 -2
- controllers/SQ_Frontend.php +5 -2
- controllers/SQ_Menu.php +11 -7
- controllers/SQ_Post.php +41 -33
- controllers/SQ_PostsList.php +68 -35
- controllers/SQ_Sitemaps.php +1 -1
- core/SQ_BlockSettings/SQ_BlockSettings.php +5 -0
- core/SQ_BlockSettingsSeo/SQ_BlockSettingsSeo.php +82 -13
- core/SQ_Blocksearch/SQ_Blocksearch.php +0 -10
- core/SQ_Loading/SQ_Loading.php +2 -2
- core/config.xml +0 -1
- languages/squirrly-seo-de_DE.mo +0 -0
- languages/squirrly-seo-de_DE.po +2186 -428
- models/SQ_BlockPostsAnalytics.php +72 -32
- models/SQ_BlockSettingsSeo.php +18 -1
- models/SQ_Blocksearch.php +0 -64
- models/SQ_Frontend.php +219 -83
- models/SQ_Post.php +2 -1
- models/SQ_PostsList.php +3 -1
- readme.txt +81 -151
- squirrly.php +6 -6
- themes/default/SQ_BlockAffiliate.php +1 -1
- themes/default/SQ_BlockPostsAnalytics.php +27 -11
- themes/default/SQ_BlockSettings.php +71 -45
- themes/default/SQ_BlockSettingsSeo.php +62 -19
- themes/default/SQ_Blocksearch.php +0 -1
- themes/default/SQ_Blockseo.php +3 -1
- themes/default/css/sq_blockresearch.css +1 -0
- themes/default/css/sq_blocksearch.css +6 -4
- themes/default/css/sq_blockseo.css +2 -0
- themes/default/css/sq_blocksettingsseo.css +25 -0
- themes/default/css/sq_feed.css +0 -5
- themes/default/css/sq_menu.css +31 -8
- themes/default/img/sprite.png +0 -0
- themes/default/js/sq_blocksettingsseo.js +106 -42
- themes/default/js/sq_menu.js +1 -1
classes/SQ_HookController.php
CHANGED
@@ -25,7 +25,7 @@ class SQ_HookController {
|
|
25 |
|
26 |
/**
|
27 |
* Calls the specified action in WP
|
28 |
-
* @param
|
29 |
*
|
30 |
* @return void
|
31 |
*/
|
@@ -56,7 +56,7 @@ class SQ_HookController {
|
|
56 |
|
57 |
/**
|
58 |
* Calls the specified action in WP
|
59 |
-
* @param
|
60 |
*
|
61 |
* @return void
|
62 |
*/
|
25 |
|
26 |
/**
|
27 |
* Calls the specified action in WP
|
28 |
+
* @param object $instance The parent class instance
|
29 |
*
|
30 |
* @return void
|
31 |
*/
|
56 |
|
57 |
/**
|
58 |
* Calls the specified action in WP
|
59 |
+
* @param object $instance The parent class instance
|
60 |
*
|
61 |
* @return void
|
62 |
*/
|
classes/SQ_Ranking.php
CHANGED
@@ -3,21 +3,24 @@
|
|
3 |
/**
|
4 |
* Class for Google Ranking Record
|
5 |
*/
|
6 |
-
class SQ_Ranking extends SQ_FrontController
|
|
|
7 |
|
8 |
private $keyword;
|
9 |
private $post_id;
|
10 |
private $error;
|
11 |
|
12 |
//--
|
13 |
-
public function getCountry()
|
|
|
14 |
if (isset(SQ_Tools::$options['sq_google_country']) && SQ_Tools::$options['sq_google_country'] <> '') {
|
15 |
return SQ_Tools::$options['sq_google_country'];
|
16 |
}
|
17 |
return 'com';
|
18 |
}
|
19 |
|
20 |
-
public function getRefererCountry()
|
|
|
21 |
$convert_refc = array('com' => 'us', '.off.ai' => 'ai', 'com.ag' => 'ag', 'com.ar' => 'ar', 'com.au' => 'au', 'com.br' => 'br', 'com.co' => 'co', 'co.cr' => 'cr', 'com.cu' => 'cu', 'com.do' => 'do', 'com.ec' => 'ec', 'com.sv' => 'sv', 'com.fj' => 'fj', 'com.gi' => 'gi', 'com.gr' => 'gr', 'com.hk' => 'hk', 'co.hu' => 'hu', 'co.in' => 'in', 'co.im' => 'im', 'co.il' => 'il', 'com.jm' => 'jm', 'co.jp' => 'jp', 'co.je' => 'je', 'co.kr' => 'kr', 'co.ls' => 'ls', 'com.my' => 'my', 'com.mt' => 'mt', 'com.mx' => 'mx', 'com.na' => 'na', 'com.np' => 'np', 'com.ni' => 'ni', 'com.nf' => 'nf', 'com.pk' => 'pk', 'com.pa' => 'pa', 'com.py' => 'py', 'com.pe' => 'pe', 'com.ph' => 'ph', 'com.pr' => 'pr', 'com.sg' => 'sg', 'co.za' => 'za', 'com.tw' => 'tw', 'com.th' => 'th', 'com.tr' => 'tr', 'com.ua' => 'ua', 'com.uk' => 'uk', 'com.uy' => 'uy',);
|
22 |
$country = $this->getCountry();
|
23 |
if (array_key_exists($country, $convert_refc)) {
|
@@ -30,7 +33,8 @@ class SQ_Ranking extends SQ_FrontController {
|
|
30 |
* Get the google language from settings
|
31 |
* @return type
|
32 |
*/
|
33 |
-
public function getLanguage()
|
|
|
34 |
if (isset(SQ_Tools::$options['sq_google_language']) && SQ_Tools::$options['sq_google_language'] <> '') {
|
35 |
return SQ_Tools::$options['sq_google_language'];
|
36 |
}
|
@@ -41,7 +45,8 @@ class SQ_Ranking extends SQ_FrontController {
|
|
41 |
* Set the Post id
|
42 |
* @return type
|
43 |
*/
|
44 |
-
public function setPost($post_id)
|
|
|
45 |
$this->post_id = $post_id;
|
46 |
}
|
47 |
|
@@ -49,7 +54,8 @@ class SQ_Ranking extends SQ_FrontController {
|
|
49 |
* Get the current keyword
|
50 |
* @param type $keyword
|
51 |
*/
|
52 |
-
public function setKeyword($keyword)
|
|
|
53 |
$this->keyword = str_replace(" ", "+", urlencode(strtolower($keyword)));
|
54 |
}
|
55 |
|
@@ -57,7 +63,8 @@ class SQ_Ranking extends SQ_FrontController {
|
|
57 |
* Process Ranking on brief request
|
58 |
* @param type $return
|
59 |
*/
|
60 |
-
public function processRanking($post_id, $keyword)
|
|
|
61 |
$this->setPost($post_id);
|
62 |
$this->setKeyword(trim($keyword));
|
63 |
|
@@ -72,11 +79,12 @@ class SQ_Ranking extends SQ_FrontController {
|
|
72 |
*
|
73 |
* @param integer $post_id
|
74 |
* @param string $keyword
|
75 |
-
* @param string $country: com | country extension
|
76 |
-
* @param string $language: en | local language
|
77 |
* @return boolean|int
|
78 |
*/
|
79 |
-
public function getGoogleRank()
|
|
|
80 |
global $wpdb;
|
81 |
$this->error = '';
|
82 |
|
@@ -121,45 +129,83 @@ class SQ_Ranking extends SQ_FrontController {
|
|
121 |
}
|
122 |
|
123 |
$user_agents = array(
|
124 |
-
'Mozilla/5.0 (Windows NT 6.1
|
125 |
-
'Mozilla/5.0 (
|
126 |
-
'Mozilla/5.0 (
|
127 |
-
'Mozilla/5.0 (
|
128 |
-
'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
129 |
-
'Mozilla/5.0 (
|
130 |
-
'Mozilla/5.0 (Windows NT 6.
|
131 |
-
'Mozilla/5.0 (
|
132 |
-
'Mozilla/5.0 (
|
133 |
-
'Mozilla/5.0 (
|
134 |
-
'Mozilla/5.0 (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
'Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko ) Version/5.1 Mobile/9B176 Safari/7534.48.3',
|
136 |
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1',
|
137 |
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; da-dk) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1',
|
138 |
'Mozilla/5.0 (Windows; U; Windows NT 6.1; tr-TR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27',
|
139 |
-
'Mozilla/5.0 (Windows; U; Windows NT 6.1;
|
140 |
-
'Mozilla/5.0 (Windows; U; Windows NT 6.1;
|
141 |
-
'Mozilla/5.0 (
|
142 |
-
'Mozilla/5.0 (Windows; U; Windows NT
|
143 |
-
'
|
144 |
-
'
|
145 |
-
'Mozilla/5.0 (
|
146 |
-
'Mozilla/5.0 (
|
147 |
-
'
|
148 |
-
'
|
149 |
-
'
|
150 |
-
'Mozilla/5.0 (Windows NT 6.
|
151 |
-
'Mozilla/5.0 (Windows
|
152 |
-
'Mozilla/5.0 (
|
153 |
-
'Mozilla/5.0 (
|
154 |
-
'Mozilla/5.0 (Macintosh; Intel Mac OS X
|
155 |
-
'Mozilla/5.0 (Windows NT 6.1
|
156 |
-
'Mozilla/5.0 (Windows NT 6.3;
|
157 |
-
'Mozilla/5.0 (
|
158 |
-
'Mozilla/5.0 (
|
159 |
-
'Mozilla/5.0 (
|
160 |
-
'Mozilla/5.0 (Windows NT 6.
|
161 |
-
'Mozilla/5.0 (
|
162 |
-
'Mozilla/5.0 (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
);
|
164 |
|
165 |
$option = array();
|
@@ -170,7 +216,7 @@ class SQ_Ranking extends SQ_FrontController {
|
|
170 |
|
171 |
//Check the values for block IP
|
172 |
if (strpos($response, "</h3>") === false) {
|
173 |
-
set_transient('google_blocked',
|
174 |
return -2; //return error
|
175 |
}
|
176 |
|
@@ -202,7 +248,8 @@ class SQ_Ranking extends SQ_FrontController {
|
|
202 |
* Do google rank with cron
|
203 |
* @global type $wpdb
|
204 |
*/
|
205 |
-
public function processCron()
|
|
|
206 |
global $wpdb;
|
207 |
if (get_transient('google_blocked') !== false) {
|
208 |
return;
|
@@ -228,20 +275,13 @@ class SQ_Ranking extends SQ_FrontController {
|
|
228 |
$json = json_decode($row->meta_value);
|
229 |
//If keyword is set and no rank or last check is 2 days ago
|
230 |
if (isset($json->keyword) && $json->keyword <> '' &&
|
231 |
-
|
232 |
(isset($json->update) && (time() - $json->update > (60 * 60 * 24 * 2))) || //if indexed then check every 2 days
|
233 |
(isset($json->update) && isset($json->rank) && $json->rank == -1 && (time() - $json->update > (60 * 60 * 24))) //if not indexed than check often
|
234 |
-
|
|
|
235 |
|
236 |
$rank = $this->processRanking($row->post_id, $json->keyword);
|
237 |
-
if ($rank == -1) {
|
238 |
-
$count++;
|
239 |
-
sleep(mt_rand(20, 40));
|
240 |
-
//if not indexed with the keyword then find the url
|
241 |
-
if ($this->processRanking($row->post_id, get_permalink($row->post_id)) > 0) {
|
242 |
-
$rank = 0; //for permalink index set 0
|
243 |
-
}
|
244 |
-
}
|
245 |
|
246 |
//if there is a success response than save it
|
247 |
if (isset($rank) && $rank >= -1) {
|
@@ -255,7 +295,7 @@ class SQ_Ranking extends SQ_FrontController {
|
|
255 |
|
256 |
$args = array();
|
257 |
$args['post_id'] = $row->post_id;
|
258 |
-
$args['rank'] = (string)
|
259 |
$args['error'] = $this->error;
|
260 |
$args['country'] = $this->getCountry();
|
261 |
$args['language'] = $this->getLanguage();
|
@@ -274,7 +314,8 @@ class SQ_Ranking extends SQ_FrontController {
|
|
274 |
* Get keyword from earlier version
|
275 |
*
|
276 |
*/
|
277 |
-
public function getKeywordHistory()
|
|
|
278 |
global $wpdb;
|
279 |
//Check if ranks is saved in database
|
280 |
$sql = "SELECT a.`global_rank`, a.`keyword`, a.`post_id`
|
3 |
/**
|
4 |
* Class for Google Ranking Record
|
5 |
*/
|
6 |
+
class SQ_Ranking extends SQ_FrontController
|
7 |
+
{
|
8 |
|
9 |
private $keyword;
|
10 |
private $post_id;
|
11 |
private $error;
|
12 |
|
13 |
//--
|
14 |
+
public function getCountry()
|
15 |
+
{
|
16 |
if (isset(SQ_Tools::$options['sq_google_country']) && SQ_Tools::$options['sq_google_country'] <> '') {
|
17 |
return SQ_Tools::$options['sq_google_country'];
|
18 |
}
|
19 |
return 'com';
|
20 |
}
|
21 |
|
22 |
+
public function getRefererCountry()
|
23 |
+
{
|
24 |
$convert_refc = array('com' => 'us', '.off.ai' => 'ai', 'com.ag' => 'ag', 'com.ar' => 'ar', 'com.au' => 'au', 'com.br' => 'br', 'com.co' => 'co', 'co.cr' => 'cr', 'com.cu' => 'cu', 'com.do' => 'do', 'com.ec' => 'ec', 'com.sv' => 'sv', 'com.fj' => 'fj', 'com.gi' => 'gi', 'com.gr' => 'gr', 'com.hk' => 'hk', 'co.hu' => 'hu', 'co.in' => 'in', 'co.im' => 'im', 'co.il' => 'il', 'com.jm' => 'jm', 'co.jp' => 'jp', 'co.je' => 'je', 'co.kr' => 'kr', 'co.ls' => 'ls', 'com.my' => 'my', 'com.mt' => 'mt', 'com.mx' => 'mx', 'com.na' => 'na', 'com.np' => 'np', 'com.ni' => 'ni', 'com.nf' => 'nf', 'com.pk' => 'pk', 'com.pa' => 'pa', 'com.py' => 'py', 'com.pe' => 'pe', 'com.ph' => 'ph', 'com.pr' => 'pr', 'com.sg' => 'sg', 'co.za' => 'za', 'com.tw' => 'tw', 'com.th' => 'th', 'com.tr' => 'tr', 'com.ua' => 'ua', 'com.uk' => 'uk', 'com.uy' => 'uy',);
|
25 |
$country = $this->getCountry();
|
26 |
if (array_key_exists($country, $convert_refc)) {
|
33 |
* Get the google language from settings
|
34 |
* @return type
|
35 |
*/
|
36 |
+
public function getLanguage()
|
37 |
+
{
|
38 |
if (isset(SQ_Tools::$options['sq_google_language']) && SQ_Tools::$options['sq_google_language'] <> '') {
|
39 |
return SQ_Tools::$options['sq_google_language'];
|
40 |
}
|
45 |
* Set the Post id
|
46 |
* @return type
|
47 |
*/
|
48 |
+
public function setPost($post_id)
|
49 |
+
{
|
50 |
$this->post_id = $post_id;
|
51 |
}
|
52 |
|
54 |
* Get the current keyword
|
55 |
* @param type $keyword
|
56 |
*/
|
57 |
+
public function setKeyword($keyword)
|
58 |
+
{
|
59 |
$this->keyword = str_replace(" ", "+", urlencode(strtolower($keyword)));
|
60 |
}
|
61 |
|
63 |
* Process Ranking on brief request
|
64 |
* @param type $return
|
65 |
*/
|
66 |
+
public function processRanking($post_id, $keyword)
|
67 |
+
{
|
68 |
$this->setPost($post_id);
|
69 |
$this->setKeyword(trim($keyword));
|
70 |
|
79 |
*
|
80 |
* @param integer $post_id
|
81 |
* @param string $keyword
|
82 |
+
* @param string $country : com | country extension
|
83 |
+
* @param string $language : en | local language
|
84 |
* @return boolean|int
|
85 |
*/
|
86 |
+
public function getGoogleRank()
|
87 |
+
{
|
88 |
global $wpdb;
|
89 |
$this->error = '';
|
90 |
|
129 |
}
|
130 |
|
131 |
$user_agents = array(
|
132 |
+
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',
|
133 |
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36',
|
134 |
+
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36',
|
135 |
+
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36',
|
136 |
+
'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2226.0 Safari/537.36',
|
137 |
+
'Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36',
|
138 |
+
'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36',
|
139 |
+
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2224.3 Safari/537.36',
|
140 |
+
'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36',
|
141 |
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36',
|
142 |
+
'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36',
|
143 |
+
'Mozilla/5.0 (Windows NT 4.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36',
|
144 |
+
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36',
|
145 |
+
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36',
|
146 |
+
'Mozilla/5.0 (X11; OpenBSD i386) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36',
|
147 |
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36',
|
148 |
+
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.3319.102 Safari/537.36',
|
149 |
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A',
|
150 |
+
'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25',
|
151 |
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2',
|
152 |
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10',
|
153 |
'Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko ) Version/5.1 Mobile/9B176 Safari/7534.48.3',
|
154 |
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1',
|
155 |
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; da-dk) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1',
|
156 |
'Mozilla/5.0 (Windows; U; Windows NT 6.1; tr-TR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27',
|
157 |
+
'Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201',
|
158 |
+
'Mozilla/5.0 (Windows; U; Windows NT 6.1; it; rv:2.0b4) Gecko/20100818',
|
159 |
+
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a3pre) Gecko/20070330',
|
160 |
+
'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko',
|
161 |
+
'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.2.3) Gecko/20100401 Lightningquail/3.6.3',
|
162 |
+
'Mozilla/5.0 (X11; ; Linux i686; rv:1.9.2.20) Gecko/20110805',
|
163 |
+
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13; ) Gecko/20101203',
|
164 |
+
'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b3) Gecko/20090305',
|
165 |
+
'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9.0.9) Gecko/2009040821',
|
166 |
+
'Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.0.8) Gecko/2009032711',
|
167 |
+
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) Gecko/2009032803',
|
168 |
+
'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.7) Gecko/2009021910 MEGAUPLOAD 1.0',
|
169 |
+
'Mozilla/5.0 (Windows; U; BeOS; en-US; rv:1.9.0.7) Gecko/2009021910',
|
170 |
+
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070321',
|
171 |
+
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Mozilla/4.8 [en] (Windows NT 5.1; U)',
|
172 |
+
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; nl-NL; rv:1.8.1.3) Gecko/20080722',
|
173 |
+
'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko',
|
174 |
+
'Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko',
|
175 |
+
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 7.0; InfoPath.3; .NET CLR 3.1.40767; Trident/6.0; en-IN)',
|
176 |
+
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)',
|
177 |
+
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)',
|
178 |
+
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)',
|
179 |
+
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)',
|
180 |
+
'Mozilla/5.0 (compatible; MSIE 10.0; Macintosh; Intel Mac OS X 10_7_3; Trident/6.0)',
|
181 |
+
'Mozilla/4.0 (Compatible; MSIE 8.0; Windows NT 5.2; Trident/6.0)',
|
182 |
+
'Mozilla/4.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)',
|
183 |
+
'Mozilla/1.22 (compatible; MSIE 10.0; Windows 3.1)',
|
184 |
+
'Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))',
|
185 |
+
'Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)',
|
186 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)',
|
187 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7)',
|
188 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7',
|
189 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; chromeframe/12.0.742.112)',
|
190 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0',
|
191 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; yie8)',
|
192 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; chromeframe/13.0.782.215)',
|
193 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; chromeframe/11.0.696.57)',
|
194 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) chromeframe/10.0.648.205',
|
195 |
+
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; chromeframe/11.0.696.57)',
|
196 |
+
'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
|
197 |
+
'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; SLCC1; .NET CLR 1.1.4322)',
|
198 |
+
'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.0; Trident/4.0; InfoPath.1; SV1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 3.0.04506.30)',
|
199 |
+
'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.0; Trident/4.0; FBSMTWB; .NET CLR 2.0.34861; .NET CLR 3.0.3746.3218; .NET CLR 3.5.33652; msn OptimizedIE8;ENUS)',
|
200 |
+
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)',
|
201 |
+
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)',
|
202 |
+
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8',
|
203 |
+
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; Media Center PC 6.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C)',
|
204 |
+
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.3; .NET4.0C; .NET4.0E; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MS-RTC LM 8)',
|
205 |
+
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)',
|
206 |
+
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 3.0)',
|
207 |
+
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; msn OptimizedIE8;ZHCN)',
|
208 |
+
|
209 |
);
|
210 |
|
211 |
$option = array();
|
216 |
|
217 |
//Check the values for block IP
|
218 |
if (strpos($response, "</h3>") === false) {
|
219 |
+
set_transient('google_blocked', time(), 3600);
|
220 |
return -2; //return error
|
221 |
}
|
222 |
|
248 |
* Do google rank with cron
|
249 |
* @global type $wpdb
|
250 |
*/
|
251 |
+
public function processCron()
|
252 |
+
{
|
253 |
global $wpdb;
|
254 |
if (get_transient('google_blocked') !== false) {
|
255 |
return;
|
275 |
$json = json_decode($row->meta_value);
|
276 |
//If keyword is set and no rank or last check is 2 days ago
|
277 |
if (isset($json->keyword) && $json->keyword <> '' &&
|
278 |
+
(!isset($json->rank) ||
|
279 |
(isset($json->update) && (time() - $json->update > (60 * 60 * 24 * 2))) || //if indexed then check every 2 days
|
280 |
(isset($json->update) && isset($json->rank) && $json->rank == -1 && (time() - $json->update > (60 * 60 * 24))) //if not indexed than check often
|
281 |
+
)
|
282 |
+
) {
|
283 |
|
284 |
$rank = $this->processRanking($row->post_id, $json->keyword);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
//if there is a success response than save it
|
287 |
if (isset($rank) && $rank >= -1) {
|
295 |
|
296 |
$args = array();
|
297 |
$args['post_id'] = $row->post_id;
|
298 |
+
$args['rank'] = (string)$rank;
|
299 |
$args['error'] = $this->error;
|
300 |
$args['country'] = $this->getCountry();
|
301 |
$args['language'] = $this->getLanguage();
|
314 |
* Get keyword from earlier version
|
315 |
*
|
316 |
*/
|
317 |
+
public function getKeywordHistory()
|
318 |
+
{
|
319 |
global $wpdb;
|
320 |
//Check if ranks is saved in database
|
321 |
$sql = "SELECT a.`global_rank`, a.`keyword`, a.`post_id`
|
classes/SQ_Tools.php
CHANGED
@@ -5,8 +5,7 @@
|
|
5 |
*
|
6 |
* @author Squirrly
|
7 |
*/
|
8 |
-
class SQ_Tools extends SQ_FrontController
|
9 |
-
{
|
10 |
|
11 |
/** @var array Saved options in database */
|
12 |
public static $options = array();
|
@@ -18,8 +17,7 @@ class SQ_Tools extends SQ_FrontController
|
|
18 |
private static $debug;
|
19 |
private static $source_code;
|
20 |
|
21 |
-
public function __construct()
|
22 |
-
{
|
23 |
parent::__construct();
|
24 |
|
25 |
self::$options = $this->getOptions();
|
@@ -27,8 +25,7 @@ class SQ_Tools extends SQ_FrontController
|
|
27 |
$this->checkDebug(); //dev mode
|
28 |
}
|
29 |
|
30 |
-
public static function getUserID()
|
31 |
-
{
|
32 |
global $current_user;
|
33 |
return $current_user->ID;
|
34 |
}
|
@@ -38,8 +35,7 @@ class SQ_Tools extends SQ_FrontController
|
|
38 |
*
|
39 |
* @return void
|
40 |
*/
|
41 |
-
function hookInit()
|
42 |
-
{
|
43 |
//TinyMCE editor required
|
44 |
//set_user_setting('editor', 'tinymce');
|
45 |
|
@@ -56,8 +52,7 @@ class SQ_Tools extends SQ_FrontController
|
|
56 |
* @param type $file
|
57 |
* @return array
|
58 |
*/
|
59 |
-
public function hookActionlink($links, $file)
|
60 |
-
{
|
61 |
if ($file == _SQ_PLUGIN_NAME_ . '/squirrly.php') {
|
62 |
$link = '<a href="' . admin_url('admin.php?page=sq_dashboard') . '">' . __('Getting started', _SQ_PLUGIN_NAME_) . '</a>';
|
63 |
array_unshift($links, $link);
|
@@ -71,8 +66,7 @@ class SQ_Tools extends SQ_FrontController
|
|
71 |
*
|
72 |
* @return void
|
73 |
*/
|
74 |
-
public static function getOptions()
|
75 |
-
{
|
76 |
$default = array(
|
77 |
'sq_ver' => 0,
|
78 |
'sq_api' => '',
|
@@ -87,6 +81,7 @@ class SQ_Tools extends SQ_FrontController
|
|
87 |
'sq_auto_sitemap' => 0,
|
88 |
'sq_auto_feed' => 0,
|
89 |
'sq_auto_jsonld' => 0,
|
|
|
90 |
'sq_jsonld_type' => 'Organization',
|
91 |
'sq_jsonld' => array(
|
92 |
'Organization' => array(
|
@@ -143,6 +138,8 @@ class SQ_Tools extends SQ_FrontController
|
|
143 |
'sq_facebook_account' => '',
|
144 |
'sq_google_plus' => '',
|
145 |
'sq_linkedin_account' => '',
|
|
|
|
|
146 |
// --
|
147 |
'sq_auto_seo' => 1,
|
148 |
'sq_auto_title' => 1,
|
@@ -150,9 +147,11 @@ class SQ_Tools extends SQ_FrontController
|
|
150 |
'sq_fp_title' => '',
|
151 |
'sq_fp_description' => '',
|
152 |
'sq_fp_keywords' => '',
|
|
|
153 |
// --
|
154 |
'sq_google_wt' => '',
|
155 |
'sq_google_analytics' => '',
|
|
|
156 |
'sq_facebook_insights' => '',
|
157 |
'sq_bing_wt' => '',
|
158 |
'sq_pinterest' => '',
|
@@ -167,12 +166,13 @@ class SQ_Tools extends SQ_FrontController
|
|
167 |
'sq_google_country' => 'com',
|
168 |
'sq_google_language' => 'en',
|
169 |
'sq_google_country_strict' => 0,
|
170 |
-
'sq_google_ranksperhour' =>
|
171 |
// --
|
172 |
'sq_affiliate_link' => '',
|
173 |
'sq_sla' => 1,
|
174 |
'sq_keywordtag' => 1,
|
175 |
'sq_local_images' => 1,
|
|
|
176 |
//--
|
177 |
'sq_dashboard' => 0,
|
178 |
'sq_analytics' => 0,
|
@@ -187,8 +187,7 @@ class SQ_Tools extends SQ_FrontController
|
|
187 |
return $default;
|
188 |
}
|
189 |
|
190 |
-
public static function getBriefOptions()
|
191 |
-
{
|
192 |
if ($pageId = get_option('page_on_front')) {
|
193 |
$title = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'title');
|
194 |
$description = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'description');
|
@@ -233,8 +232,7 @@ class SQ_Tools extends SQ_FrontController
|
|
233 |
*
|
234 |
* @return void
|
235 |
*/
|
236 |
-
public static function saveOptions($key = null, $value = '')
|
237 |
-
{
|
238 |
if (isset($key)) {
|
239 |
self::$options[$key] = $value;
|
240 |
}
|
@@ -246,8 +244,7 @@ class SQ_Tools extends SQ_FrontController
|
|
246 |
* Set the header type
|
247 |
* @param type $type
|
248 |
*/
|
249 |
-
public static function setHeader($type)
|
250 |
-
{
|
251 |
if (SQ_Tools::getValue('sq_debug') == 'on')
|
252 |
return;
|
253 |
|
@@ -275,8 +272,7 @@ class SQ_Tools extends SQ_FrontController
|
|
275 |
* @param mixed $defaultValue (optional)
|
276 |
* @return mixed Value
|
277 |
*/
|
278 |
-
public static function getValue($key, $defaultValue = false, $withcode = false)
|
279 |
-
{
|
280 |
if (!isset($key) OR empty($key) OR !is_string($key))
|
281 |
return false;
|
282 |
$ret = (isset($_POST[$key]) ? (is_string($_POST[$key]) ? urldecode($_POST[$key]) : $_POST[$key]) : (isset($_GET[$key]) ? (is_string($_GET[$key]) ? urldecode($_GET[$key]) : $_GET[$key]) : $defaultValue));
|
@@ -294,8 +290,7 @@ class SQ_Tools extends SQ_FrontController
|
|
294 |
* @param string $key
|
295 |
* @return boolean
|
296 |
*/
|
297 |
-
public static function getIsset($key)
|
298 |
-
{
|
299 |
if (!isset($key) OR empty($key) OR !is_string($key))
|
300 |
return false;
|
301 |
return isset($_POST[$key]) ? true : (isset($_GET[$key]) ? true : false);
|
@@ -306,8 +301,7 @@ class SQ_Tools extends SQ_FrontController
|
|
306 |
*
|
307 |
* @return void
|
308 |
*/
|
309 |
-
public static function showNotices($message, $type = 'sq_notices')
|
310 |
-
{
|
311 |
if (file_exists(_SQ_THEME_DIR_ . 'SQ_notices.php')) {
|
312 |
ob_start();
|
313 |
include(_SQ_THEME_DIR_ . 'SQ_notices.php');
|
@@ -321,8 +315,7 @@ class SQ_Tools extends SQ_FrontController
|
|
321 |
/**
|
322 |
* Load the multilanguage support from .mo
|
323 |
*/
|
324 |
-
private function loadMultilanguage()
|
325 |
-
{
|
326 |
if (!defined('WP_PLUGIN_DIR')) {
|
327 |
load_plugin_textdomain(_SQ_PLUGIN_NAME_, _SQ_PLUGIN_NAME_ . '/languages/');
|
328 |
} else {
|
@@ -333,8 +326,7 @@ class SQ_Tools extends SQ_FrontController
|
|
333 |
/**
|
334 |
* Connect remote with CURL if exists
|
335 |
*/
|
336 |
-
public static function sq_remote_get($url, $param = array(), $options = array())
|
337 |
-
{
|
338 |
$parameters = '';
|
339 |
$cookies = array();
|
340 |
$cookie_string = '';
|
@@ -382,10 +374,11 @@ class SQ_Tools extends SQ_FrontController
|
|
382 |
}
|
383 |
$options['sslverify'] = false;
|
384 |
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
|
|
389 |
return false;
|
390 |
}
|
391 |
}
|
@@ -396,8 +389,7 @@ class SQ_Tools extends SQ_FrontController
|
|
396 |
/**
|
397 |
* Connect remote with CURL if exists
|
398 |
*/
|
399 |
-
public static function sq_remote_post($url, $param = array(), $options = array())
|
400 |
-
{
|
401 |
$parameters = '';
|
402 |
$cookies = array();
|
403 |
$cookie_string = '';
|
@@ -443,14 +435,15 @@ class SQ_Tools extends SQ_FrontController
|
|
443 |
}
|
444 |
$options['sslverify'] = false;
|
445 |
|
446 |
-
if (
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
return false;
|
451 |
}
|
452 |
}
|
453 |
|
|
|
454 |
return $response;
|
455 |
}
|
456 |
|
@@ -460,8 +453,7 @@ class SQ_Tools extends SQ_FrontController
|
|
460 |
* @param array $param
|
461 |
* @return string
|
462 |
*/
|
463 |
-
private static function sq_curl($url, $options, $method = 'get')
|
464 |
-
{
|
465 |
|
466 |
$ch = curl_init();
|
467 |
curl_setopt($ch, CURLOPT_URL, $url);
|
@@ -519,8 +511,7 @@ class SQ_Tools extends SQ_FrontController
|
|
519 |
* @param array $param
|
520 |
* @return string
|
521 |
*/
|
522 |
-
private static function sq_wpcall($url, $options, $method = 'get')
|
523 |
-
{
|
524 |
if ($method == 'post') {
|
525 |
$response = wp_remote_post($url, $options);
|
526 |
} else {
|
@@ -539,8 +530,7 @@ class SQ_Tools extends SQ_FrontController
|
|
539 |
/**
|
540 |
* Connect remote with CURL if exists
|
541 |
*/
|
542 |
-
public static function sq_remote_head($url)
|
543 |
-
{
|
544 |
$response = array();
|
545 |
|
546 |
if (function_exists('curl_exec')) {
|
@@ -566,8 +556,7 @@ class SQ_Tools extends SQ_FrontController
|
|
566 |
* @param string $response
|
567 |
* @return string
|
568 |
*/
|
569 |
-
private static function cleanResponce($response)
|
570 |
-
{
|
571 |
|
572 |
if (function_exists('substr_count'))
|
573 |
if (substr_count($response, '(') > 1)
|
@@ -582,8 +571,7 @@ class SQ_Tools extends SQ_FrontController
|
|
582 |
/**
|
583 |
* Check for SEO blog bad settings
|
584 |
*/
|
585 |
-
public static function checkErrorSettings($count_only = false)
|
586 |
-
{
|
587 |
if (current_user_can('manage_options')) {
|
588 |
|
589 |
$fixit = "<a href=\"javascript:void(0);\" onclick=\"%s jQuery(this).closest('div').fadeOut('slow'); if(parseInt(jQuery('.sq_count').html())>0) { var notif = (parseInt(jQuery('.sq_count').html()) - 1); if (notif > 0) {jQuery('.sq_count').html(notif); }else{ jQuery('.sq_count').html(notif); jQuery('.sq_count').hide(); } } jQuery.post(ajaxurl, { action: '%s', nonce: '" . wp_create_nonce(_SQ_NONCE_ID_) . "'});\" >" . __("Fix it for me!", _SQ_PLUGIN_NAME_) . "</a>";
|
@@ -660,8 +648,7 @@ class SQ_Tools extends SQ_FrontController
|
|
660 |
* Check if the automatically seo si active
|
661 |
* @return bool
|
662 |
*/
|
663 |
-
private static function getAutoSeoSquirrly()
|
664 |
-
{
|
665 |
if (isset(self::$options['sq_use']))
|
666 |
return ((int)self::$options['sq_use'] == 0);
|
667 |
|
@@ -672,8 +659,7 @@ class SQ_Tools extends SQ_FrontController
|
|
672 |
* Check for META duplicates
|
673 |
* @return boolean
|
674 |
*/
|
675 |
-
private static function getDuplicateOG()
|
676 |
-
{
|
677 |
if (!function_exists('preg_match_all')) {
|
678 |
return false;
|
679 |
}
|
@@ -695,8 +681,7 @@ class SQ_Tools extends SQ_FrontController
|
|
695 |
* Check for META duplicates
|
696 |
* @return boolean
|
697 |
*/
|
698 |
-
private static function getDuplicateTC()
|
699 |
-
{
|
700 |
if (!function_exists('preg_match_all')) {
|
701 |
return false;
|
702 |
}
|
@@ -718,8 +703,7 @@ class SQ_Tools extends SQ_FrontController
|
|
718 |
* Check for META duplicates
|
719 |
* @return boolean
|
720 |
*/
|
721 |
-
private static function getDuplicateDescription()
|
722 |
-
{
|
723 |
if (!function_exists('preg_match_all')) {
|
724 |
return false;
|
725 |
}
|
@@ -745,8 +729,7 @@ class SQ_Tools extends SQ_FrontController
|
|
745 |
* Check for META duplicates
|
746 |
* @return boolean
|
747 |
*/
|
748 |
-
private static function getDuplicateTitle()
|
749 |
-
{
|
750 |
if (!function_exists('preg_match_all')) {
|
751 |
return false;
|
752 |
}
|
@@ -755,6 +738,7 @@ class SQ_Tools extends SQ_FrontController
|
|
755 |
if (self::$options['sq_use'] == 1 && self::$options['sq_auto_title'] == 1) {
|
756 |
if (self::$source_code <> '') {
|
757 |
preg_match_all("/<title[^>]*>(.*)?<\/title>/i", self::$source_code, $out);
|
|
|
758 |
if (!empty($out) && isset($out[0]) && is_array($out[0])) {
|
759 |
$total += sizeof($out[0]);
|
760 |
}
|
@@ -772,8 +756,7 @@ class SQ_Tools extends SQ_FrontController
|
|
772 |
* Check if the blog is in private mode
|
773 |
* @return bool
|
774 |
*/
|
775 |
-
public static function getPrivateBlog()
|
776 |
-
{
|
777 |
return ((int)get_option('blog_public') == 0);
|
778 |
}
|
779 |
|
@@ -781,8 +764,7 @@ class SQ_Tools extends SQ_FrontController
|
|
781 |
* Check if the blog has a bad link structure
|
782 |
* @return bool
|
783 |
*/
|
784 |
-
private static function getBadLinkStructure()
|
785 |
-
{
|
786 |
global $wp_rewrite;
|
787 |
if (function_exists('apache_get_modules')) {
|
788 |
//Check if mod_rewrite is installed in apache
|
@@ -806,8 +788,7 @@ class SQ_Tools extends SQ_FrontController
|
|
806 |
* @param string $in
|
807 |
* @return string $in localized
|
808 |
*/
|
809 |
-
public static function i18n($in)
|
810 |
-
{
|
811 |
if (function_exists('langswitch_filter_langs_with_message')) {
|
812 |
$in = langswitch_filter_langs_with_message($in);
|
813 |
}
|
@@ -828,15 +809,13 @@ class SQ_Tools extends SQ_FrontController
|
|
828 |
* @param int $decimals Precision of the number of decimal places.
|
829 |
* @return string Converted number in string format.
|
830 |
*/
|
831 |
-
public static function i18n_number_format($number, $decimals = 0)
|
832 |
-
{
|
833 |
global $wp_locale;
|
834 |
$formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
|
835 |
return apply_filters('number_format_i18n', $formatted);
|
836 |
}
|
837 |
|
838 |
-
public static function getBrowserInfo()
|
839 |
-
{
|
840 |
$ub = '';
|
841 |
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
842 |
$bname = 'Unknown';
|
@@ -901,20 +880,36 @@ class SQ_Tools extends SQ_FrontController
|
|
901 |
* @param string $url
|
902 |
* @return array
|
903 |
*/
|
904 |
-
public static function getSnippet($url)
|
905 |
-
{
|
906 |
if ($url == '' || !function_exists('preg_match')) {
|
907 |
return;
|
908 |
}
|
909 |
|
|
|
910 |
$snippet = array();
|
911 |
$frontend = SQ_ObjController::getModel('SQ_Frontend');
|
912 |
|
913 |
-
$postid
|
|
|
|
|
|
|
914 |
if ($postid > 0) {
|
|
|
915 |
$frontend->setPost(get_post($postid));
|
916 |
$snippet['title'] = $frontend->getTitle();
|
917 |
$snippet['description'] = $frontend->getDescription();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
918 |
$snippet['url'] = $url;
|
919 |
self::dump($snippet);
|
920 |
} else {
|
@@ -954,8 +949,7 @@ class SQ_Tools extends SQ_FrontController
|
|
954 |
/**
|
955 |
* Check if debug is called
|
956 |
*/
|
957 |
-
private function checkDebug()
|
958 |
-
{
|
959 |
//if debug is called
|
960 |
if (self::getIsset('sq_debug')) {
|
961 |
if (self::getValue('sq_debug') == self::$options['sq_api']) {
|
@@ -975,8 +969,7 @@ class SQ_Tools extends SQ_FrontController
|
|
975 |
/**
|
976 |
* Store the debug for a later view
|
977 |
*/
|
978 |
-
public static function dump()
|
979 |
-
{
|
980 |
if (self::getValue('sq_debug') !== 'on') {
|
981 |
return;
|
982 |
}
|
@@ -1022,8 +1015,7 @@ class SQ_Tools extends SQ_FrontController
|
|
1022 |
/**
|
1023 |
* Show the debug dump
|
1024 |
*/
|
1025 |
-
public static function showDebug()
|
1026 |
-
{
|
1027 |
global $wp_query;
|
1028 |
echo "Debug result: <br />" . '<div id="wpcontent">' . @implode('<br />', self::$debug) . '</div>';
|
1029 |
|
@@ -1038,14 +1030,12 @@ class SQ_Tools extends SQ_FrontController
|
|
1038 |
echo "<pre>" . print_r($wp_query, true) . "</pre>";
|
1039 |
}
|
1040 |
|
1041 |
-
public function sq_activate()
|
1042 |
-
{
|
1043 |
set_transient('sq_activate', true);
|
1044 |
set_transient('sq_rewrite', true);
|
1045 |
}
|
1046 |
|
1047 |
-
public function sq_deactivate()
|
1048 |
-
{
|
1049 |
//clear the cron job
|
1050 |
wp_clear_scheduled_hook('sq_processCron');
|
1051 |
|
@@ -1058,8 +1048,7 @@ class SQ_Tools extends SQ_FrontController
|
|
1058 |
$wp_rewrite->flush_rules();
|
1059 |
}
|
1060 |
|
1061 |
-
public static function emptyCache($post_id = null)
|
1062 |
-
{
|
1063 |
if (function_exists('w3tc_pgcache_flush')) {
|
1064 |
w3tc_pgcache_flush();
|
1065 |
}
|
@@ -1076,8 +1065,7 @@ class SQ_Tools extends SQ_FrontController
|
|
1076 |
}
|
1077 |
}
|
1078 |
|
1079 |
-
public static function checkUpgrade()
|
1080 |
-
{
|
1081 |
if (self::$options['sq_ver'] == 0 || self::$options['sq_ver'] < SQ_VERSION_ID) {
|
1082 |
//Delete the old versions table
|
1083 |
global $wpdb;
|
5 |
*
|
6 |
* @author Squirrly
|
7 |
*/
|
8 |
+
class SQ_Tools extends SQ_FrontController {
|
|
|
9 |
|
10 |
/** @var array Saved options in database */
|
11 |
public static $options = array();
|
17 |
private static $debug;
|
18 |
private static $source_code;
|
19 |
|
20 |
+
public function __construct() {
|
|
|
21 |
parent::__construct();
|
22 |
|
23 |
self::$options = $this->getOptions();
|
25 |
$this->checkDebug(); //dev mode
|
26 |
}
|
27 |
|
28 |
+
public static function getUserID() {
|
|
|
29 |
global $current_user;
|
30 |
return $current_user->ID;
|
31 |
}
|
35 |
*
|
36 |
* @return void
|
37 |
*/
|
38 |
+
function hookInit() {
|
|
|
39 |
//TinyMCE editor required
|
40 |
//set_user_setting('editor', 'tinymce');
|
41 |
|
52 |
* @param type $file
|
53 |
* @return array
|
54 |
*/
|
55 |
+
public function hookActionlink($links, $file) {
|
|
|
56 |
if ($file == _SQ_PLUGIN_NAME_ . '/squirrly.php') {
|
57 |
$link = '<a href="' . admin_url('admin.php?page=sq_dashboard') . '">' . __('Getting started', _SQ_PLUGIN_NAME_) . '</a>';
|
58 |
array_unshift($links, $link);
|
66 |
*
|
67 |
* @return void
|
68 |
*/
|
69 |
+
public static function getOptions() {
|
|
|
70 |
$default = array(
|
71 |
'sq_ver' => 0,
|
72 |
'sq_api' => '',
|
81 |
'sq_auto_sitemap' => 0,
|
82 |
'sq_auto_feed' => 0,
|
83 |
'sq_auto_jsonld' => 0,
|
84 |
+
'sq_auto_amp' => 0,
|
85 |
'sq_jsonld_type' => 'Organization',
|
86 |
'sq_jsonld' => array(
|
87 |
'Organization' => array(
|
138 |
'sq_facebook_account' => '',
|
139 |
'sq_google_plus' => '',
|
140 |
'sq_linkedin_account' => '',
|
141 |
+
'sq_pinterest_account' => '',
|
142 |
+
'sq_instagram_account' => '',
|
143 |
// --
|
144 |
'sq_auto_seo' => 1,
|
145 |
'sq_auto_title' => 1,
|
147 |
'sq_fp_title' => '',
|
148 |
'sq_fp_description' => '',
|
149 |
'sq_fp_keywords' => '',
|
150 |
+
'sq_fp_ogimage' => '',
|
151 |
// --
|
152 |
'sq_google_wt' => '',
|
153 |
'sq_google_analytics' => '',
|
154 |
+
'sq_facebook_analytics' => '',
|
155 |
'sq_facebook_insights' => '',
|
156 |
'sq_bing_wt' => '',
|
157 |
'sq_pinterest' => '',
|
166 |
'sq_google_country' => 'com',
|
167 |
'sq_google_language' => 'en',
|
168 |
'sq_google_country_strict' => 0,
|
169 |
+
'sq_google_ranksperhour' => 0,
|
170 |
// --
|
171 |
'sq_affiliate_link' => '',
|
172 |
'sq_sla' => 1,
|
173 |
'sq_keywordtag' => 1,
|
174 |
'sq_local_images' => 1,
|
175 |
+
'sq_force_savepost' => 0,
|
176 |
//--
|
177 |
'sq_dashboard' => 0,
|
178 |
'sq_analytics' => 0,
|
187 |
return $default;
|
188 |
}
|
189 |
|
190 |
+
public static function getBriefOptions() {
|
|
|
191 |
if ($pageId = get_option('page_on_front')) {
|
192 |
$title = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'title');
|
193 |
$description = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'description');
|
232 |
*
|
233 |
* @return void
|
234 |
*/
|
235 |
+
public static function saveOptions($key = null, $value = '') {
|
|
|
236 |
if (isset($key)) {
|
237 |
self::$options[$key] = $value;
|
238 |
}
|
244 |
* Set the header type
|
245 |
* @param type $type
|
246 |
*/
|
247 |
+
public static function setHeader($type) {
|
|
|
248 |
if (SQ_Tools::getValue('sq_debug') == 'on')
|
249 |
return;
|
250 |
|
272 |
* @param mixed $defaultValue (optional)
|
273 |
* @return mixed Value
|
274 |
*/
|
275 |
+
public static function getValue($key, $defaultValue = false, $withcode = false) {
|
|
|
276 |
if (!isset($key) OR empty($key) OR !is_string($key))
|
277 |
return false;
|
278 |
$ret = (isset($_POST[$key]) ? (is_string($_POST[$key]) ? urldecode($_POST[$key]) : $_POST[$key]) : (isset($_GET[$key]) ? (is_string($_GET[$key]) ? urldecode($_GET[$key]) : $_GET[$key]) : $defaultValue));
|
290 |
* @param string $key
|
291 |
* @return boolean
|
292 |
*/
|
293 |
+
public static function getIsset($key) {
|
|
|
294 |
if (!isset($key) OR empty($key) OR !is_string($key))
|
295 |
return false;
|
296 |
return isset($_POST[$key]) ? true : (isset($_GET[$key]) ? true : false);
|
301 |
*
|
302 |
* @return void
|
303 |
*/
|
304 |
+
public static function showNotices($message, $type = 'sq_notices') {
|
|
|
305 |
if (file_exists(_SQ_THEME_DIR_ . 'SQ_notices.php')) {
|
306 |
ob_start();
|
307 |
include(_SQ_THEME_DIR_ . 'SQ_notices.php');
|
315 |
/**
|
316 |
* Load the multilanguage support from .mo
|
317 |
*/
|
318 |
+
private function loadMultilanguage() {
|
|
|
319 |
if (!defined('WP_PLUGIN_DIR')) {
|
320 |
load_plugin_textdomain(_SQ_PLUGIN_NAME_, _SQ_PLUGIN_NAME_ . '/languages/');
|
321 |
} else {
|
326 |
/**
|
327 |
* Connect remote with CURL if exists
|
328 |
*/
|
329 |
+
public static function sq_remote_get($url, $param = array(), $options = array()) {
|
|
|
330 |
$parameters = '';
|
331 |
$cookies = array();
|
332 |
$cookie_string = '';
|
374 |
}
|
375 |
$options['sslverify'] = false;
|
376 |
|
377 |
+
|
378 |
+
if (function_exists('curl_init') && !ini_get('open_basedir')) {
|
379 |
+
$response = self::sq_curl($url, $options, 'get');
|
380 |
+
} else {
|
381 |
+
if (!$response = self::sq_wpcall($url, $options, 'get')) {
|
382 |
return false;
|
383 |
}
|
384 |
}
|
389 |
/**
|
390 |
* Connect remote with CURL if exists
|
391 |
*/
|
392 |
+
public static function sq_remote_post($url, $param = array(), $options = array()) {
|
|
|
393 |
$parameters = '';
|
394 |
$cookies = array();
|
395 |
$cookie_string = '';
|
435 |
}
|
436 |
$options['sslverify'] = false;
|
437 |
|
438 |
+
if (function_exists('curl_init') && !ini_get('open_basedir')) {
|
439 |
+
$response = self::sq_curl($url, $options, 'post');
|
440 |
+
} else {
|
441 |
+
if (!$response = self::sq_wpcall($url, $options, 'post')) {
|
442 |
return false;
|
443 |
}
|
444 |
}
|
445 |
|
446 |
+
|
447 |
return $response;
|
448 |
}
|
449 |
|
453 |
* @param array $param
|
454 |
* @return string
|
455 |
*/
|
456 |
+
private static function sq_curl($url, $options, $method = 'get') {
|
|
|
457 |
|
458 |
$ch = curl_init();
|
459 |
curl_setopt($ch, CURLOPT_URL, $url);
|
511 |
* @param array $param
|
512 |
* @return string
|
513 |
*/
|
514 |
+
private static function sq_wpcall($url, $options, $method = 'get') {
|
|
|
515 |
if ($method == 'post') {
|
516 |
$response = wp_remote_post($url, $options);
|
517 |
} else {
|
530 |
/**
|
531 |
* Connect remote with CURL if exists
|
532 |
*/
|
533 |
+
public static function sq_remote_head($url) {
|
|
|
534 |
$response = array();
|
535 |
|
536 |
if (function_exists('curl_exec')) {
|
556 |
* @param string $response
|
557 |
* @return string
|
558 |
*/
|
559 |
+
private static function cleanResponce($response) {
|
|
|
560 |
|
561 |
if (function_exists('substr_count'))
|
562 |
if (substr_count($response, '(') > 1)
|
571 |
/**
|
572 |
* Check for SEO blog bad settings
|
573 |
*/
|
574 |
+
public static function checkErrorSettings($count_only = false) {
|
|
|
575 |
if (current_user_can('manage_options')) {
|
576 |
|
577 |
$fixit = "<a href=\"javascript:void(0);\" onclick=\"%s jQuery(this).closest('div').fadeOut('slow'); if(parseInt(jQuery('.sq_count').html())>0) { var notif = (parseInt(jQuery('.sq_count').html()) - 1); if (notif > 0) {jQuery('.sq_count').html(notif); }else{ jQuery('.sq_count').html(notif); jQuery('.sq_count').hide(); } } jQuery.post(ajaxurl, { action: '%s', nonce: '" . wp_create_nonce(_SQ_NONCE_ID_) . "'});\" >" . __("Fix it for me!", _SQ_PLUGIN_NAME_) . "</a>";
|
648 |
* Check if the automatically seo si active
|
649 |
* @return bool
|
650 |
*/
|
651 |
+
private static function getAutoSeoSquirrly() {
|
|
|
652 |
if (isset(self::$options['sq_use']))
|
653 |
return ((int)self::$options['sq_use'] == 0);
|
654 |
|
659 |
* Check for META duplicates
|
660 |
* @return boolean
|
661 |
*/
|
662 |
+
private static function getDuplicateOG() {
|
|
|
663 |
if (!function_exists('preg_match_all')) {
|
664 |
return false;
|
665 |
}
|
681 |
* Check for META duplicates
|
682 |
* @return boolean
|
683 |
*/
|
684 |
+
private static function getDuplicateTC() {
|
|
|
685 |
if (!function_exists('preg_match_all')) {
|
686 |
return false;
|
687 |
}
|
703 |
* Check for META duplicates
|
704 |
* @return boolean
|
705 |
*/
|
706 |
+
private static function getDuplicateDescription() {
|
|
|
707 |
if (!function_exists('preg_match_all')) {
|
708 |
return false;
|
709 |
}
|
729 |
* Check for META duplicates
|
730 |
* @return boolean
|
731 |
*/
|
732 |
+
private static function getDuplicateTitle() {
|
|
|
733 |
if (!function_exists('preg_match_all')) {
|
734 |
return false;
|
735 |
}
|
738 |
if (self::$options['sq_use'] == 1 && self::$options['sq_auto_title'] == 1) {
|
739 |
if (self::$source_code <> '') {
|
740 |
preg_match_all("/<title[^>]*>(.*)?<\/title>/i", self::$source_code, $out);
|
741 |
+
|
742 |
if (!empty($out) && isset($out[0]) && is_array($out[0])) {
|
743 |
$total += sizeof($out[0]);
|
744 |
}
|
756 |
* Check if the blog is in private mode
|
757 |
* @return bool
|
758 |
*/
|
759 |
+
public static function getPrivateBlog() {
|
|
|
760 |
return ((int)get_option('blog_public') == 0);
|
761 |
}
|
762 |
|
764 |
* Check if the blog has a bad link structure
|
765 |
* @return bool
|
766 |
*/
|
767 |
+
private static function getBadLinkStructure() {
|
|
|
768 |
global $wp_rewrite;
|
769 |
if (function_exists('apache_get_modules')) {
|
770 |
//Check if mod_rewrite is installed in apache
|
788 |
* @param string $in
|
789 |
* @return string $in localized
|
790 |
*/
|
791 |
+
public static function i18n($in) {
|
|
|
792 |
if (function_exists('langswitch_filter_langs_with_message')) {
|
793 |
$in = langswitch_filter_langs_with_message($in);
|
794 |
}
|
809 |
* @param int $decimals Precision of the number of decimal places.
|
810 |
* @return string Converted number in string format.
|
811 |
*/
|
812 |
+
public static function i18n_number_format($number, $decimals = 0) {
|
|
|
813 |
global $wp_locale;
|
814 |
$formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
|
815 |
return apply_filters('number_format_i18n', $formatted);
|
816 |
}
|
817 |
|
818 |
+
public static function getBrowserInfo() {
|
|
|
819 |
$ub = '';
|
820 |
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
821 |
$bname = 'Unknown';
|
880 |
* @param string $url
|
881 |
* @return array
|
882 |
*/
|
883 |
+
public static function getSnippet($url) {
|
|
|
884 |
if ($url == '' || !function_exists('preg_match')) {
|
885 |
return;
|
886 |
}
|
887 |
|
888 |
+
$postid = 0;
|
889 |
$snippet = array();
|
890 |
$frontend = SQ_ObjController::getModel('SQ_Frontend');
|
891 |
|
892 |
+
if ($postid == 0) {
|
893 |
+
$postid = url_to_postid($url);
|
894 |
+
}
|
895 |
+
|
896 |
if ($postid > 0) {
|
897 |
+
self::dump("it's a post", $url, $postid);
|
898 |
$frontend->setPost(get_post($postid));
|
899 |
$snippet['title'] = $frontend->getTitle();
|
900 |
$snippet['description'] = $frontend->getDescription();
|
901 |
+
$snippet['url'] = $url;
|
902 |
+
self::dump($snippet);
|
903 |
+
} elseif ($url == get_bloginfo('url')) {
|
904 |
+
self::dump("it's main page", $url, get_bloginfo('url'));
|
905 |
+
|
906 |
+
if (self::$options ['sq_auto_title'] == 1) {
|
907 |
+
$snippet['title'] = self::$options['sq_fp_title'];
|
908 |
+
}
|
909 |
+
if (self::$options['sq_auto_description'] == 1) {
|
910 |
+
$snippet['description'] = self::$options['sq_fp_description'];
|
911 |
+
}
|
912 |
+
|
913 |
$snippet['url'] = $url;
|
914 |
self::dump($snippet);
|
915 |
} else {
|
949 |
/**
|
950 |
* Check if debug is called
|
951 |
*/
|
952 |
+
private function checkDebug() {
|
|
|
953 |
//if debug is called
|
954 |
if (self::getIsset('sq_debug')) {
|
955 |
if (self::getValue('sq_debug') == self::$options['sq_api']) {
|
969 |
/**
|
970 |
* Store the debug for a later view
|
971 |
*/
|
972 |
+
public static function dump() {
|
|
|
973 |
if (self::getValue('sq_debug') !== 'on') {
|
974 |
return;
|
975 |
}
|
1015 |
/**
|
1016 |
* Show the debug dump
|
1017 |
*/
|
1018 |
+
public static function showDebug() {
|
|
|
1019 |
global $wp_query;
|
1020 |
echo "Debug result: <br />" . '<div id="wpcontent">' . @implode('<br />', self::$debug) . '</div>';
|
1021 |
|
1030 |
echo "<pre>" . print_r($wp_query, true) . "</pre>";
|
1031 |
}
|
1032 |
|
1033 |
+
public function sq_activate() {
|
|
|
1034 |
set_transient('sq_activate', true);
|
1035 |
set_transient('sq_rewrite', true);
|
1036 |
}
|
1037 |
|
1038 |
+
public function sq_deactivate() {
|
|
|
1039 |
//clear the cron job
|
1040 |
wp_clear_scheduled_hook('sq_processCron');
|
1041 |
|
1048 |
$wp_rewrite->flush_rules();
|
1049 |
}
|
1050 |
|
1051 |
+
public static function emptyCache($post_id = null) {
|
|
|
1052 |
if (function_exists('w3tc_pgcache_flush')) {
|
1053 |
w3tc_pgcache_flush();
|
1054 |
}
|
1065 |
}
|
1066 |
}
|
1067 |
|
1068 |
+
public static function checkUpgrade() {
|
|
|
1069 |
if (self::$options['sq_ver'] == 0 || self::$options['sq_ver'] < SQ_VERSION_ID) {
|
1070 |
//Delete the old versions table
|
1071 |
global $wpdb;
|
config/paths.php
CHANGED
@@ -6,13 +6,13 @@ define('_SQ_NAME_', 'squirrly');
|
|
6 |
define('_SQ_PLUGIN_NAME_', 'squirrly-seo'); //THIS LINE WILL BE CHANGED WITH THE USER SETTINGS
|
7 |
define('_THEME_NAME_', 'default'); //THIS LINE WILL BE CHANGED WITH THE USER SETTINGS
|
8 |
|
9 |
-
define('_SQ_DASH_URL_', 'https://my.squirrly.co/');
|
10 |
$scheme = (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") || (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN)) ? 'https:' : 'http:'); //CHECK IF SCURE
|
11 |
|
12 |
defined('SQ_URI') || define('SQ_URI', (WP_VERSION_ID >= 3000) ? 'wp350' : 'wp2');
|
13 |
defined('_SQ_API_URL_') || define('_SQ_API_URL_', $scheme . '//api.squirrly.co/');
|
14 |
|
15 |
-
defined('_SQ_STATIC_API_URL_') || define('_SQ_STATIC_API_URL_', $scheme . '//
|
16 |
defined('_SQ_SUPPORT_URL_') || define('_SQ_SUPPORT_URL_', 'https://plus.google.com/u/0/communities/104196720668136264985');
|
17 |
|
18 |
/* Directories */
|
6 |
define('_SQ_PLUGIN_NAME_', 'squirrly-seo'); //THIS LINE WILL BE CHANGED WITH THE USER SETTINGS
|
7 |
define('_THEME_NAME_', 'default'); //THIS LINE WILL BE CHANGED WITH THE USER SETTINGS
|
8 |
|
9 |
+
defined('_SQ_DASH_URL_') || define('_SQ_DASH_URL_', 'https://my.squirrly.co/');
|
10 |
$scheme = (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") || (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN)) ? 'https:' : 'http:'); //CHECK IF SCURE
|
11 |
|
12 |
defined('SQ_URI') || define('SQ_URI', (WP_VERSION_ID >= 3000) ? 'wp350' : 'wp2');
|
13 |
defined('_SQ_API_URL_') || define('_SQ_API_URL_', $scheme . '//api.squirrly.co/');
|
14 |
|
15 |
+
defined('_SQ_STATIC_API_URL_') || define('_SQ_STATIC_API_URL_', $scheme . '//storage.googleapis.com/squirrly/');
|
16 |
defined('_SQ_SUPPORT_URL_') || define('_SQ_SUPPORT_URL_', 'https://plus.google.com/u/0/communities/104196720668136264985');
|
17 |
|
18 |
/* Directories */
|
controllers/SQ_Frontend.php
CHANGED
@@ -11,7 +11,6 @@ class SQ_Frontend extends SQ_FrontController {
|
|
11 |
}
|
12 |
|
13 |
parent::__construct();
|
14 |
-
SQ_ObjController::getController('SQ_Tools', false);
|
15 |
|
16 |
if (SQ_Tools::$options['sq_use'] == 1) {
|
17 |
/* Check if sitemap is on */
|
@@ -42,6 +41,7 @@ class SQ_Frontend extends SQ_FrontController {
|
|
42 |
if (SQ_Tools::$options['sq_url_fix'] == 1) {
|
43 |
add_action('the_content', array($this, 'fixFeedLinks'), 11);
|
44 |
}
|
|
|
45 |
}
|
46 |
}
|
47 |
|
@@ -175,7 +175,7 @@ class SQ_Frontend extends SQ_FrontController {
|
|
175 |
}
|
176 |
break;
|
177 |
case 'touchicon':
|
178 |
-
$size = get_query_var('sq_size');
|
179 |
if (SQ_Tools::$options['favicon'] <> '') {
|
180 |
//show the favico file
|
181 |
SQ_Tools::setHeader('png');
|
@@ -196,4 +196,7 @@ class SQ_Frontend extends SQ_FrontController {
|
|
196 |
}
|
197 |
}
|
198 |
|
|
|
|
|
|
|
199 |
}
|
11 |
}
|
12 |
|
13 |
parent::__construct();
|
|
|
14 |
|
15 |
if (SQ_Tools::$options['sq_use'] == 1) {
|
16 |
/* Check if sitemap is on */
|
41 |
if (SQ_Tools::$options['sq_url_fix'] == 1) {
|
42 |
add_action('the_content', array($this, 'fixFeedLinks'), 11);
|
43 |
}
|
44 |
+
|
45 |
}
|
46 |
}
|
47 |
|
175 |
}
|
176 |
break;
|
177 |
case 'touchicon':
|
178 |
+
$size = (int) get_query_var('sq_size');
|
179 |
if (SQ_Tools::$options['favicon'] <> '') {
|
180 |
//show the favico file
|
181 |
SQ_Tools::setHeader('png');
|
196 |
}
|
197 |
}
|
198 |
|
199 |
+
public function hookFrontfooter(){
|
200 |
+
echo $this->model->getGoogleAnalyticsAMPBody();
|
201 |
+
}
|
202 |
}
|
controllers/SQ_Menu.php
CHANGED
@@ -111,13 +111,17 @@ class SQ_Menu extends SQ_FrontController {
|
|
111 |
array(SQ_ObjController::getBlock('SQ_BlockDashboard'), 'init')
|
112 |
));
|
113 |
if (SQ_Tools::$options['sq_api'] <> '') {
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
'
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
121 |
|
122 |
|
123 |
|
111 |
array(SQ_ObjController::getBlock('SQ_BlockDashboard'), 'init')
|
112 |
));
|
113 |
if (SQ_Tools::$options['sq_api'] <> '') {
|
114 |
+
|
115 |
+
//IF SERP PLUGIN IS NOT INSTALLED
|
116 |
+
if (!class_exists('SRC_Classes_ObjController')){
|
117 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
118 |
+
ucfirst(_SQ_NAME_) . __(' post list', _SQ_PLUGIN_NAME_),
|
119 |
+
__('Performance <br />Analytics', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices($analytics_alert, 'errors_count'),
|
120 |
+
'edit_posts',
|
121 |
+
'sq_posts',
|
122 |
+
array(SQ_ObjController::getBlock('SQ_BlockPostsAnalytics'), 'init')
|
123 |
+
));
|
124 |
+
}
|
125 |
|
126 |
|
127 |
|
controllers/SQ_Post.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class SQ_Post extends SQ_FrontController
|
4 |
-
{
|
5 |
|
6 |
public $saved;
|
7 |
|
@@ -10,8 +9,7 @@ class SQ_Post extends SQ_FrontController
|
|
10 |
*
|
11 |
* @return void
|
12 |
*/
|
13 |
-
public function hookInit()
|
14 |
-
{
|
15 |
$this->saved = array();
|
16 |
|
17 |
add_filter('tiny_mce_before_init', array($this->model, 'setCallback'));
|
@@ -34,8 +32,7 @@ class SQ_Post extends SQ_FrontController
|
|
34 |
*
|
35 |
* @global integer $post_ID
|
36 |
*/
|
37 |
-
public function hookHead()
|
38 |
-
{
|
39 |
global $post_ID;
|
40 |
parent::hookHead();
|
41 |
|
@@ -59,8 +56,7 @@ class SQ_Post extends SQ_FrontController
|
|
59 |
/**
|
60 |
* Hook the Shopp plugin save product
|
61 |
*/
|
62 |
-
public function hookShopp($Product)
|
63 |
-
{
|
64 |
$this->checkSeo($Product->id);
|
65 |
}
|
66 |
|
@@ -68,8 +64,7 @@ class SQ_Post extends SQ_FrontController
|
|
68 |
* Hook the post save/update
|
69 |
* @param type $post_id
|
70 |
*/
|
71 |
-
public function hookSavePost($post_id)
|
72 |
-
{
|
73 |
|
74 |
|
75 |
if (!isset($this->saved[$post_id])) {
|
@@ -107,8 +102,7 @@ class SQ_Post extends SQ_FrontController
|
|
107 |
* @param integer $post_id
|
108 |
* @return false|void
|
109 |
*/
|
110 |
-
public function checkImage($post_id)
|
111 |
-
{
|
112 |
|
113 |
//if the option to save the images locally is set on
|
114 |
if (SQ_Tools::$options['sq_local_images'] == 1) {
|
@@ -193,8 +187,7 @@ class SQ_Post extends SQ_FrontController
|
|
193 |
* @param integer $post_id
|
194 |
* @param void
|
195 |
*/
|
196 |
-
public function checkSeo($post_id, $status = '')
|
197 |
-
{
|
198 |
$args = array();
|
199 |
|
200 |
$seo = SQ_Tools::getValue('sq_seo');
|
@@ -211,14 +204,32 @@ class SQ_Post extends SQ_FrontController
|
|
211 |
$args['author'] = (int)SQ_Tools::getUserID();
|
212 |
$args['post_id'] = $post_id;
|
213 |
|
214 |
-
|
215 |
-
if (
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
}
|
218 |
-
$process[] = $args;
|
219 |
-
//save for later send to api
|
220 |
-
set_transient('sq_seopost', json_encode($process));
|
221 |
-
wp_schedule_single_event(time(), 'sq_processApi');
|
222 |
|
223 |
//Save the keyword for this post
|
224 |
if ($json = $this->model->getKeyword($post_id)) {
|
@@ -231,9 +242,8 @@ class SQ_Post extends SQ_FrontController
|
|
231 |
}
|
232 |
}
|
233 |
|
234 |
-
public function getPaged($link)
|
235 |
-
|
236 |
-
$page = get_query_var('paged');
|
237 |
if ($page && $page > 1) {
|
238 |
$link = trailingslashit($link) . "page/" . "$page" . '/';
|
239 |
}
|
@@ -245,8 +255,7 @@ class SQ_Post extends SQ_FrontController
|
|
245 |
*
|
246 |
* @return void
|
247 |
*/
|
248 |
-
public function action()
|
249 |
-
{
|
250 |
parent::action();
|
251 |
|
252 |
switch (SQ_Tools::getValue('action')) {
|
@@ -298,8 +307,7 @@ class SQ_Post extends SQ_FrontController
|
|
298 |
* @return array | false
|
299 |
*
|
300 |
*/
|
301 |
-
private function _checkAdvMeta($post_id)
|
302 |
-
{
|
303 |
|
304 |
$meta = array();
|
305 |
if (SQ_Tools::getIsset('sq_canonical') || SQ_Tools::getIsset('sq_fp_title') || SQ_Tools::getIsset('sq_fp_description') || SQ_Tools::getIsset('sq_fp_keywords')) {
|
@@ -323,7 +331,7 @@ class SQ_Post extends SQ_FrontController
|
|
323 |
$meta[] = array('key' => '_sq_canonical',
|
324 |
'value' => SQ_Tools::getValue('sq_canonical'));
|
325 |
|
326 |
-
|
327 |
$this->model->saveAdvMeta($post_id, $meta);
|
328 |
|
329 |
return $meta;
|
@@ -331,8 +339,7 @@ class SQ_Post extends SQ_FrontController
|
|
331 |
return false;
|
332 |
}
|
333 |
|
334 |
-
public function hookFooter()
|
335 |
-
{
|
336 |
if (!defined('DISABLE_WP_CRON') || DISABLE_WP_CRON == true) {
|
337 |
global $pagenow;
|
338 |
if (in_array($pagenow, array('post.php', 'post-new.php'))) {
|
@@ -341,15 +348,16 @@ class SQ_Post extends SQ_FrontController
|
|
341 |
}
|
342 |
}
|
343 |
|
344 |
-
public function processCron()
|
345 |
-
{
|
346 |
SQ_ObjController::getController('SQ_Tools', false);
|
347 |
SQ_ObjController::getController('SQ_Action', false);
|
348 |
|
349 |
if (get_transient('sq_seopost') !== false) {
|
350 |
$process = json_decode(get_transient('sq_seopost'), true);
|
351 |
foreach ($process as $key => $call) {
|
|
|
352 |
$response = json_decode(SQ_Action::apiCall('sq/seo/post', $call, 60));
|
|
|
353 |
if (isset($response->saved) && $response->saved == true) {
|
354 |
unset($process[$key]);
|
355 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class SQ_Post extends SQ_FrontController {
|
|
|
4 |
|
5 |
public $saved;
|
6 |
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
+
public function hookInit() {
|
|
|
13 |
$this->saved = array();
|
14 |
|
15 |
add_filter('tiny_mce_before_init', array($this->model, 'setCallback'));
|
32 |
*
|
33 |
* @global integer $post_ID
|
34 |
*/
|
35 |
+
public function hookHead() {
|
|
|
36 |
global $post_ID;
|
37 |
parent::hookHead();
|
38 |
|
56 |
/**
|
57 |
* Hook the Shopp plugin save product
|
58 |
*/
|
59 |
+
public function hookShopp($Product) {
|
|
|
60 |
$this->checkSeo($Product->id);
|
61 |
}
|
62 |
|
64 |
* Hook the post save/update
|
65 |
* @param type $post_id
|
66 |
*/
|
67 |
+
public function hookSavePost($post_id) {
|
|
|
68 |
|
69 |
|
70 |
if (!isset($this->saved[$post_id])) {
|
102 |
* @param integer $post_id
|
103 |
* @return false|void
|
104 |
*/
|
105 |
+
public function checkImage($post_id) {
|
|
|
106 |
|
107 |
//if the option to save the images locally is set on
|
108 |
if (SQ_Tools::$options['sq_local_images'] == 1) {
|
187 |
* @param integer $post_id
|
188 |
* @param void
|
189 |
*/
|
190 |
+
public function checkSeo($post_id, $status = '') {
|
|
|
191 |
$args = array();
|
192 |
|
193 |
$seo = SQ_Tools::getValue('sq_seo');
|
204 |
$args['author'] = (int)SQ_Tools::getUserID();
|
205 |
$args['post_id'] = $post_id;
|
206 |
|
207 |
+
|
208 |
+
if (SQ_Tools::$options['sq_force_savepost'] == 1) {
|
209 |
+
SQ_Action::apiCall('sq/seo/post', $args, 10);
|
210 |
+
} else {
|
211 |
+
$process = array();
|
212 |
+
if (get_transient('sq_seopost') !== false) {
|
213 |
+
$process = json_decode(get_transient('sq_seopost'), true);
|
214 |
+
}
|
215 |
+
//Add args at the beginning of the process
|
216 |
+
array_unshift($process, $args);
|
217 |
+
|
218 |
+
//save for later send to api
|
219 |
+
set_transient('sq_seopost', json_encode($process));
|
220 |
+
|
221 |
+
//prevent lost posts if there are not processed
|
222 |
+
if (count($process) > 5){
|
223 |
+
SQ_Tools::saveOptions('sq_force_savepost', 1);
|
224 |
+
SQ_Action::apiCall('sq/seo/post', $args, 10);
|
225 |
+
}
|
226 |
+
|
227 |
+
if (get_transient('sq_seopost') !== false) {
|
228 |
+
wp_schedule_single_event(time(), 'sq_processApi');
|
229 |
+
} else {
|
230 |
+
SQ_Action::apiCall('sq/seo/post', $args, 1);
|
231 |
+
}
|
232 |
}
|
|
|
|
|
|
|
|
|
233 |
|
234 |
//Save the keyword for this post
|
235 |
if ($json = $this->model->getKeyword($post_id)) {
|
242 |
}
|
243 |
}
|
244 |
|
245 |
+
public function getPaged($link) {
|
246 |
+
$page = (int)get_query_var('paged');
|
|
|
247 |
if ($page && $page > 1) {
|
248 |
$link = trailingslashit($link) . "page/" . "$page" . '/';
|
249 |
}
|
255 |
*
|
256 |
* @return void
|
257 |
*/
|
258 |
+
public function action() {
|
|
|
259 |
parent::action();
|
260 |
|
261 |
switch (SQ_Tools::getValue('action')) {
|
307 |
* @return array | false
|
308 |
*
|
309 |
*/
|
310 |
+
private function _checkAdvMeta($post_id) {
|
|
|
311 |
|
312 |
$meta = array();
|
313 |
if (SQ_Tools::getIsset('sq_canonical') || SQ_Tools::getIsset('sq_fp_title') || SQ_Tools::getIsset('sq_fp_description') || SQ_Tools::getIsset('sq_fp_keywords')) {
|
331 |
$meta[] = array('key' => '_sq_canonical',
|
332 |
'value' => SQ_Tools::getValue('sq_canonical'));
|
333 |
|
334 |
+
SQ_Tools::dump($meta);
|
335 |
$this->model->saveAdvMeta($post_id, $meta);
|
336 |
|
337 |
return $meta;
|
339 |
return false;
|
340 |
}
|
341 |
|
342 |
+
public function hookFooter() {
|
|
|
343 |
if (!defined('DISABLE_WP_CRON') || DISABLE_WP_CRON == true) {
|
344 |
global $pagenow;
|
345 |
if (in_array($pagenow, array('post.php', 'post-new.php'))) {
|
348 |
}
|
349 |
}
|
350 |
|
351 |
+
public function processCron() {
|
|
|
352 |
SQ_ObjController::getController('SQ_Tools', false);
|
353 |
SQ_ObjController::getController('SQ_Action', false);
|
354 |
|
355 |
if (get_transient('sq_seopost') !== false) {
|
356 |
$process = json_decode(get_transient('sq_seopost'), true);
|
357 |
foreach ($process as $key => $call) {
|
358 |
+
|
359 |
$response = json_decode(SQ_Action::apiCall('sq/seo/post', $call, 60));
|
360 |
+
|
361 |
if (isset($response->saved) && $response->saved == true) {
|
362 |
unset($process[$key]);
|
363 |
}
|
controllers/SQ_PostsList.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class SQ_PostsList extends SQ_FrontController
|
|
|
4 |
|
5 |
/** @var array Posts types in */
|
6 |
private $types = array();
|
@@ -18,15 +19,18 @@ class SQ_PostsList extends SQ_FrontController {
|
|
18 |
/**
|
19 |
* Called in SQ_Menu > hookMenu
|
20 |
*/
|
21 |
-
public function init()
|
|
|
22 |
$this->types = array_map(array($this, '_addPostsType'), SQ_Tools::$options['sq_post_types']);
|
23 |
}
|
24 |
|
25 |
-
protected function _addPostsType($type)
|
|
|
26 |
return $type . '_posts';
|
27 |
}
|
28 |
|
29 |
-
public function setPosts($posts)
|
|
|
30 |
if (!empty($posts)) {
|
31 |
$this->posts = $posts;
|
32 |
$this->is_list = true;
|
@@ -38,10 +42,11 @@ class SQ_PostsList extends SQ_FrontController {
|
|
38 |
* Create the column and filter for the Posts List
|
39 |
*
|
40 |
*/
|
41 |
-
public function hookInit()
|
|
|
42 |
$browser = SQ_Tools::getBrowserInfo();
|
43 |
|
44 |
-
if ($browser['name'] == 'IE' && (int)
|
45 |
return;
|
46 |
|
47 |
if (isset(SQ_Tools::$options['sq_api']) && SQ_Tools::$options['sq_api'] <> '') {
|
@@ -62,12 +67,13 @@ class SQ_PostsList extends SQ_FrontController {
|
|
62 |
* @param string $where
|
63 |
* @return string
|
64 |
*/
|
65 |
-
public function filterPosts($where)
|
|
|
66 |
if (!is_admin())
|
67 |
return;
|
68 |
|
69 |
if (SQ_Tools::getIsset('sq_post_id')) {
|
70 |
-
$where .= " AND ID = " . (int)
|
71 |
}
|
72 |
|
73 |
return $where;
|
@@ -76,10 +82,11 @@ class SQ_PostsList extends SQ_FrontController {
|
|
76 |
/**
|
77 |
* Hook the Wordpress header
|
78 |
*/
|
79 |
-
public function loadHead()
|
|
|
80 |
parent::hookHead();
|
81 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
82 |
-
|
83 |
}
|
84 |
|
85 |
/**
|
@@ -88,7 +95,8 @@ class SQ_PostsList extends SQ_FrontController {
|
|
88 |
* @param array $columns
|
89 |
* @return array
|
90 |
*/
|
91 |
-
public function add_column($columns)
|
|
|
92 |
$this->loadHead(); //load the js only for post list
|
93 |
$this->is_list = true;
|
94 |
|
@@ -101,7 +109,8 @@ class SQ_PostsList extends SQ_FrontController {
|
|
101 |
* @param object $column
|
102 |
* @param integer $post_id
|
103 |
*/
|
104 |
-
public function add_row($column, $post_id)
|
|
|
105 |
$title = '';
|
106 |
$description = '';
|
107 |
$frontend = null;
|
@@ -115,7 +124,7 @@ class SQ_PostsList extends SQ_FrontController {
|
|
115 |
array_push($this->posts, $post_id);
|
116 |
}
|
117 |
|
118 |
-
echo '<div class="' . $this->column_id . '_row
|
119 |
|
120 |
if ($frontend = SQ_ObjController::getModel('SQ_Frontend')) {
|
121 |
$title = $frontend->getAdvancedMeta($post_id, 'title');
|
@@ -137,7 +146,8 @@ class SQ_PostsList extends SQ_FrontController {
|
|
137 |
* Hook the Footer
|
138 |
*
|
139 |
*/
|
140 |
-
public function hookFooter()
|
|
|
141 |
if (!$this->is_list)
|
142 |
return;
|
143 |
|
@@ -161,7 +171,8 @@ class SQ_PostsList extends SQ_FrontController {
|
|
161 |
/**
|
162 |
* Set the javascript variables
|
163 |
*/
|
164 |
-
public function setVars()
|
|
|
165 |
echo '<script type="text/javascript">
|
166 |
var __sq_article_rank = "' . __('SEO Analytics, by Squirrly', _SQ_PLUGIN_NAME_) . '";
|
167 |
var __sq_refresh = "' . __('Update', _SQ_PLUGIN_NAME_) . '"
|
@@ -173,7 +184,8 @@ class SQ_PostsList extends SQ_FrontController {
|
|
173 |
</script>';
|
174 |
}
|
175 |
|
176 |
-
public function getScripts()
|
|
|
177 |
return '<script type="text/javascript">
|
178 |
//load the rank from squirrly
|
179 |
if (typeof sq_script === "undefined"){
|
@@ -224,7 +236,8 @@ class SQ_PostsList extends SQ_FrontController {
|
|
224 |
* @param integer $pos
|
225 |
* @return array
|
226 |
*/
|
227 |
-
public function insert($src, $in, $pos)
|
|
|
228 |
$array = array();
|
229 |
if (is_int($pos))
|
230 |
$array = array_merge(array_slice($src, 0, $pos), $in, array_slice($src, $pos));
|
@@ -242,7 +255,8 @@ class SQ_PostsList extends SQ_FrontController {
|
|
242 |
* Hook Get/Post action
|
243 |
* @return string
|
244 |
*/
|
245 |
-
public function action()
|
|
|
246 |
parent::action();
|
247 |
switch (SQ_Tools::getValue('action')) {
|
248 |
case 'sq_posts_rank':
|
@@ -265,7 +279,7 @@ class SQ_PostsList extends SQ_FrontController {
|
|
265 |
SQ_Tools::setHeader('json');
|
266 |
$args = array();
|
267 |
$rank = null;
|
268 |
-
$this->model->post_id = (int)
|
269 |
$args['post_id'] = $this->model->post_id;
|
270 |
|
271 |
if ($json = SQ_ObjController::getModel('SQ_Post')->getKeyword($this->model->post_id)) {
|
@@ -277,35 +291,37 @@ class SQ_PostsList extends SQ_FrontController {
|
|
277 |
|
278 |
if (isset($rank) && $rank !== false) {
|
279 |
$ranking = SQ_ObjController::getController('SQ_Ranking', false);
|
280 |
-
$args['rank'] = (string)
|
281 |
$args['country'] = $ranking->getCountry();
|
282 |
$args['language'] = $ranking->getLanguage();
|
283 |
}
|
284 |
}
|
285 |
|
286 |
$response = json_decode(SQ_Action::apiCall('sq/user-analytics/detail', $args, 30));
|
287 |
-
|
288 |
-
exit();
|
289 |
-
}
|
290 |
if (!is_object($response)) {
|
291 |
exit(json_encode(array('error' => $response)));
|
292 |
} else {
|
293 |
-
|
294 |
$analytics = SQ_ObjController::getBlock('SQ_BlockAnalytics');
|
295 |
$analytics->flush = false;
|
296 |
$analytics->post_id = $this->model->post_id;
|
297 |
$analytics->audit = $this->model->getAnalytics($response, $this->model->post_id);
|
298 |
-
$response = $analytics->init();
|
299 |
-
|
300 |
|
|
|
|
|
|
|
|
|
|
|
301 |
exit(json_encode($response));
|
302 |
}
|
303 |
break;
|
304 |
case 'sq_recheck':
|
305 |
SQ_Tools::setHeader('json');
|
306 |
-
if (get_transient('google_blocked') === false) {
|
307 |
-
$this->model->post_id = (int)
|
308 |
if ($json = SQ_ObjController::getModel('SQ_Post')->getKeyword($this->model->post_id)) {
|
|
|
309 |
if (get_transient('sq_rank' . $this->model->post_id) !== false) {
|
310 |
delete_transient('sq_rank' . $this->model->post_id);
|
311 |
}
|
@@ -316,11 +332,13 @@ class SQ_PostsList extends SQ_FrontController {
|
|
316 |
exit(json_encode(array('error' => true)));
|
317 |
} else {
|
318 |
if ($json->rank == -2) {
|
319 |
-
$
|
320 |
-
}
|
321 |
-
|
|
|
|
|
322 |
} elseif ($json->rank == 0) {
|
323 |
-
$value = __('URL Indexed');
|
324 |
} elseif ($json->rank > 0) {
|
325 |
$value = '<strong style="display:block; font-size: 120%; width: 100px; margin: 0 auto; text-align:right;">' . sprintf(__('%s'), $json->rank) . '</strong>' . ((isset($json->country)) ? ' (' . $json->country . ')' : '');
|
326 |
}
|
@@ -330,7 +348,21 @@ class SQ_PostsList extends SQ_FrontController {
|
|
330 |
|
331 |
exit(json_encode(array('error' => true)));
|
332 |
} else {
|
333 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
exit(json_encode(array('rank' => $rank)));
|
335 |
}
|
336 |
break;
|
@@ -343,7 +375,8 @@ class SQ_PostsList extends SQ_FrontController {
|
|
343 |
* @param type $keyword
|
344 |
* @return type
|
345 |
*/
|
346 |
-
private function checkKeyword($keyword, $force = false)
|
|
|
347 |
$rank = null;
|
348 |
|
349 |
if ($keyword == '')
|
@@ -387,7 +420,7 @@ class SQ_PostsList extends SQ_FrontController {
|
|
387 |
if ($rank !== false && $rank >= -1) {
|
388 |
$args = array();
|
389 |
$args['post_id'] = $this->model->post_id;
|
390 |
-
$args['rank'] = (string)
|
391 |
$args['country'] = $ranking->getCountry();
|
392 |
$args['language'] = $ranking->getLanguage();
|
393 |
SQ_Action::apiCall('sq/user-analytics/saveserp', $args);
|
1 |
<?php
|
2 |
|
3 |
+
class SQ_PostsList extends SQ_FrontController
|
4 |
+
{
|
5 |
|
6 |
/** @var array Posts types in */
|
7 |
private $types = array();
|
19 |
/**
|
20 |
* Called in SQ_Menu > hookMenu
|
21 |
*/
|
22 |
+
public function init()
|
23 |
+
{
|
24 |
$this->types = array_map(array($this, '_addPostsType'), SQ_Tools::$options['sq_post_types']);
|
25 |
}
|
26 |
|
27 |
+
protected function _addPostsType($type)
|
28 |
+
{
|
29 |
return $type . '_posts';
|
30 |
}
|
31 |
|
32 |
+
public function setPosts($posts)
|
33 |
+
{
|
34 |
if (!empty($posts)) {
|
35 |
$this->posts = $posts;
|
36 |
$this->is_list = true;
|
42 |
* Create the column and filter for the Posts List
|
43 |
*
|
44 |
*/
|
45 |
+
public function hookInit()
|
46 |
+
{
|
47 |
$browser = SQ_Tools::getBrowserInfo();
|
48 |
|
49 |
+
if ($browser['name'] == 'IE' && (int)$browser['version'] < 9 && (int)$browser['version'] > 0)
|
50 |
return;
|
51 |
|
52 |
if (isset(SQ_Tools::$options['sq_api']) && SQ_Tools::$options['sq_api'] <> '') {
|
67 |
* @param string $where
|
68 |
* @return string
|
69 |
*/
|
70 |
+
public function filterPosts($where)
|
71 |
+
{
|
72 |
if (!is_admin())
|
73 |
return;
|
74 |
|
75 |
if (SQ_Tools::getIsset('sq_post_id')) {
|
76 |
+
$where .= " AND ID = " . (int)SQ_Tools::getValue('sq_post_id');
|
77 |
}
|
78 |
|
79 |
return $where;
|
82 |
/**
|
83 |
* Hook the Wordpress header
|
84 |
*/
|
85 |
+
public function loadHead()
|
86 |
+
{
|
87 |
parent::hookHead();
|
88 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
89 |
+
->loadMedia(_SQ_THEME_URL_ . '/css/sq_postslist.css');
|
90 |
}
|
91 |
|
92 |
/**
|
95 |
* @param array $columns
|
96 |
* @return array
|
97 |
*/
|
98 |
+
public function add_column($columns)
|
99 |
+
{
|
100 |
$this->loadHead(); //load the js only for post list
|
101 |
$this->is_list = true;
|
102 |
|
109 |
* @param object $column
|
110 |
* @param integer $post_id
|
111 |
*/
|
112 |
+
public function add_row($column, $post_id)
|
113 |
+
{
|
114 |
$title = '';
|
115 |
$description = '';
|
116 |
$frontend = null;
|
124 |
array_push($this->posts, $post_id);
|
125 |
}
|
126 |
|
127 |
+
echo '<div class="' . $this->column_id . '_row" ref="' . $post_id . '">' . (($cached) ? $_COOKIE[$this->column_id . $post_id] : 'loading ...') . '</div>';
|
128 |
|
129 |
if ($frontend = SQ_ObjController::getModel('SQ_Frontend')) {
|
130 |
$title = $frontend->getAdvancedMeta($post_id, 'title');
|
146 |
* Hook the Footer
|
147 |
*
|
148 |
*/
|
149 |
+
public function hookFooter()
|
150 |
+
{
|
151 |
if (!$this->is_list)
|
152 |
return;
|
153 |
|
171 |
/**
|
172 |
* Set the javascript variables
|
173 |
*/
|
174 |
+
public function setVars()
|
175 |
+
{
|
176 |
echo '<script type="text/javascript">
|
177 |
var __sq_article_rank = "' . __('SEO Analytics, by Squirrly', _SQ_PLUGIN_NAME_) . '";
|
178 |
var __sq_refresh = "' . __('Update', _SQ_PLUGIN_NAME_) . '"
|
184 |
</script>';
|
185 |
}
|
186 |
|
187 |
+
public function getScripts()
|
188 |
+
{
|
189 |
return '<script type="text/javascript">
|
190 |
//load the rank from squirrly
|
191 |
if (typeof sq_script === "undefined"){
|
236 |
* @param integer $pos
|
237 |
* @return array
|
238 |
*/
|
239 |
+
public function insert($src, $in, $pos)
|
240 |
+
{
|
241 |
$array = array();
|
242 |
if (is_int($pos))
|
243 |
$array = array_merge(array_slice($src, 0, $pos), $in, array_slice($src, $pos));
|
255 |
* Hook Get/Post action
|
256 |
* @return string
|
257 |
*/
|
258 |
+
public function action()
|
259 |
+
{
|
260 |
parent::action();
|
261 |
switch (SQ_Tools::getValue('action')) {
|
262 |
case 'sq_posts_rank':
|
279 |
SQ_Tools::setHeader('json');
|
280 |
$args = array();
|
281 |
$rank = null;
|
282 |
+
$this->model->post_id = (int)SQ_Tools::getValue('post');
|
283 |
$args['post_id'] = $this->model->post_id;
|
284 |
|
285 |
if ($json = SQ_ObjController::getModel('SQ_Post')->getKeyword($this->model->post_id)) {
|
291 |
|
292 |
if (isset($rank) && $rank !== false) {
|
293 |
$ranking = SQ_ObjController::getController('SQ_Ranking', false);
|
294 |
+
$args['rank'] = (string)$rank;
|
295 |
$args['country'] = $ranking->getCountry();
|
296 |
$args['language'] = $ranking->getLanguage();
|
297 |
}
|
298 |
}
|
299 |
|
300 |
$response = json_decode(SQ_Action::apiCall('sq/user-analytics/detail', $args, 30));
|
301 |
+
|
|
|
|
|
302 |
if (!is_object($response)) {
|
303 |
exit(json_encode(array('error' => $response)));
|
304 |
} else {
|
305 |
+
//SQ_Tools::dump($response);
|
306 |
$analytics = SQ_ObjController::getBlock('SQ_BlockAnalytics');
|
307 |
$analytics->flush = false;
|
308 |
$analytics->post_id = $this->model->post_id;
|
309 |
$analytics->audit = $this->model->getAnalytics($response, $this->model->post_id);
|
|
|
|
|
310 |
|
311 |
+
$response = $analytics->init();
|
312 |
+
SQ_Tools::dump($response);
|
313 |
+
if (SQ_Tools::getValue('sq_debug') === 'on') {
|
314 |
+
exit();
|
315 |
+
}
|
316 |
exit(json_encode($response));
|
317 |
}
|
318 |
break;
|
319 |
case 'sq_recheck':
|
320 |
SQ_Tools::setHeader('json');
|
321 |
+
if (SQ_Tools::getValue('sq_debug') === 'on' || get_transient('google_blocked') === false) {
|
322 |
+
$this->model->post_id = (int)SQ_Tools::getValue('post_id');
|
323 |
if ($json = SQ_ObjController::getModel('SQ_Post')->getKeyword($this->model->post_id)) {
|
324 |
+
$oldrank = (isset($json->rank) ? $json->rank : -1);
|
325 |
if (get_transient('sq_rank' . $this->model->post_id) !== false) {
|
326 |
delete_transient('sq_rank' . $this->model->post_id);
|
327 |
}
|
332 |
exit(json_encode(array('error' => true)));
|
333 |
} else {
|
334 |
if ($json->rank == -2) {
|
335 |
+
$json->rank = $oldrank;
|
336 |
+
}
|
337 |
+
|
338 |
+
if ($json->rank == -1) {
|
339 |
+
$value = sprintf(__('Not in top 100 for: %s'), '<br />' .$json->keyword);
|
340 |
} elseif ($json->rank == 0) {
|
341 |
+
$value = __('The URL is Indexed', _SQ_PLUGIN_NAME_);
|
342 |
} elseif ($json->rank > 0) {
|
343 |
$value = '<strong style="display:block; font-size: 120%; width: 100px; margin: 0 auto; text-align:right;">' . sprintf(__('%s'), $json->rank) . '</strong>' . ((isset($json->country)) ? ' (' . $json->country . ')' : '');
|
344 |
}
|
348 |
|
349 |
exit(json_encode(array('error' => true)));
|
350 |
} else {
|
351 |
+
$this->model->post_id = (int)SQ_Tools::getValue('post_id');
|
352 |
+
if ($json = SQ_ObjController::getModel('SQ_Post')->getKeyword($this->model->post_id)) {
|
353 |
+
if ($json->rank === false) {
|
354 |
+
exit(json_encode(array('error' => true)));
|
355 |
+
} else {
|
356 |
+
if ($json->rank == -1) {
|
357 |
+
$value = sprintf(__('Not in top 100 for: %s'), '<br />' .$json->keyword);
|
358 |
+
} elseif ($json->rank == 0) {
|
359 |
+
$value = __('The URL is Indexed', _SQ_PLUGIN_NAME_);
|
360 |
+
} elseif ($json->rank > 0) {
|
361 |
+
$value = '<strong style="display:block; font-size: 120%; width: 100px; margin: 0 auto; text-align:right;">' . sprintf(__('%s'), $json->rank) . '</strong>' . ((isset($json->country)) ? ' (' . $json->country . ')' : '');
|
362 |
+
}
|
363 |
+
exit(json_encode(array('rank' => $value)));
|
364 |
+
}
|
365 |
+
}
|
366 |
exit(json_encode(array('rank' => $rank)));
|
367 |
}
|
368 |
break;
|
375 |
* @param type $keyword
|
376 |
* @return type
|
377 |
*/
|
378 |
+
private function checkKeyword($keyword, $force = false)
|
379 |
+
{
|
380 |
$rank = null;
|
381 |
|
382 |
if ($keyword == '')
|
420 |
if ($rank !== false && $rank >= -1) {
|
421 |
$args = array();
|
422 |
$args['post_id'] = $this->model->post_id;
|
423 |
+
$args['rank'] = (string)$rank;
|
424 |
$args['country'] = $ranking->getCountry();
|
425 |
$args['language'] = $ranking->getLanguage();
|
426 |
SQ_Action::apiCall('sq/user-analytics/saveserp', $args);
|
controllers/SQ_Sitemaps.php
CHANGED
@@ -8,7 +8,7 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
8 |
|
9 |
var $root = 'sitemap';
|
10 |
/* @var string post limit */
|
11 |
-
var $posts_limit =
|
12 |
var $news_limit = 50;
|
13 |
|
14 |
public function __construct() {
|
8 |
|
9 |
var $root = 'sitemap';
|
10 |
/* @var string post limit */
|
11 |
+
var $posts_limit = 1000;
|
12 |
var $news_limit = 50;
|
13 |
|
14 |
public function __construct() {
|
core/SQ_BlockSettings/SQ_BlockSettings.php
CHANGED
@@ -24,9 +24,14 @@ class SQ_BlockSettings extends SQ_BlockController {
|
|
24 |
parent::action();
|
25 |
|
26 |
|
|
|
27 |
switch (SQ_Tools::getValue('action')) {
|
28 |
|
29 |
case 'sq_settings_update':
|
|
|
|
|
|
|
|
|
30 |
if (SQ_Tools::getIsset('sq_post_types')) {
|
31 |
SQ_Tools::$options['sq_post_types'] = array();
|
32 |
foreach (SQ_Tools::getValue('sq_post_types') as $key) {
|
24 |
parent::action();
|
25 |
|
26 |
|
27 |
+
|
28 |
switch (SQ_Tools::getValue('action')) {
|
29 |
|
30 |
case 'sq_settings_update':
|
31 |
+
if (!current_user_can('manage_options')){
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
if (SQ_Tools::getIsset('sq_post_types')) {
|
36 |
SQ_Tools::$options['sq_post_types'] = array();
|
37 |
foreach (SQ_Tools::getValue('sq_post_types') as $key) {
|
core/SQ_BlockSettingsSeo/SQ_BlockSettingsSeo.php
CHANGED
@@ -33,25 +33,31 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
33 |
public function action() {
|
34 |
parent::action();
|
35 |
|
|
|
36 |
switch (SQ_Tools::getValue('action')) {
|
37 |
|
38 |
case 'sq_settingsseo_update':
|
|
|
|
|
|
|
|
|
39 |
if (!SQ_Tools::getIsset('sq_use')) {
|
40 |
return;
|
41 |
}
|
42 |
|
43 |
-
SQ_Tools::saveOptions('sq_use', (int)
|
44 |
-
SQ_Tools::saveOptions('sq_auto_title', (int)
|
45 |
-
SQ_Tools::saveOptions('sq_auto_description', (int)
|
46 |
-
SQ_Tools::saveOptions('sq_auto_canonical', (int)
|
|
|
47 |
|
48 |
-
SQ_Tools::saveOptions('sq_auto_meta', (int)
|
49 |
-
SQ_Tools::saveOptions('sq_auto_favicon', (int)
|
50 |
|
51 |
///////////////////////////////////////////
|
52 |
/////////////////////////////SOCIAL OPTION
|
53 |
-
SQ_Tools::saveOptions('sq_auto_facebook', (int)
|
54 |
-
SQ_Tools::saveOptions('sq_auto_twitter', (int)
|
55 |
SQ_Tools::saveOptions('sq_auto_twittersize', SQ_Tools::getValue('sq_auto_twittersize'));
|
56 |
SQ_Tools::saveOptions('sq_og_locale', SQ_Tools::getValue('sq_og_locale'));
|
57 |
|
@@ -59,6 +65,8 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
59 |
SQ_Tools::saveOptions('sq_facebook_account', $this->model->checkFacebookAccount(SQ_Tools::getValue('sq_facebook_account')));
|
60 |
SQ_Tools::saveOptions('sq_google_plus', $this->model->checkGoogleAccount(SQ_Tools::getValue('sq_google_plus')));
|
61 |
SQ_Tools::saveOptions('sq_linkedin_account', $this->model->checkLinkeinAccount(SQ_Tools::getValue('sq_linkedin_account')));
|
|
|
|
|
62 |
|
63 |
///////////////////////////////////////////
|
64 |
/////////////////////////////FIRST PAGE OPTIMIZATION
|
@@ -75,7 +83,7 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
75 |
$meta[] = array('key' => '_sq_fp_keywords', 'value' => SQ_Tools::getValue('sq_fp_keywords'));
|
76 |
|
77 |
if (SQ_Tools::getIsset('sq_fp_ogimage'))
|
78 |
-
$meta[] = array('key' => '_sq_fp_ogimage', 'value' =>
|
79 |
|
80 |
if (!empty($meta))
|
81 |
SQ_ObjController::getModel('SQ_Post')->saveAdvMeta($pageId, $meta);
|
@@ -84,14 +92,15 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
84 |
SQ_Tools::saveOptions('sq_fp_title', SQ_Tools::getValue('sq_fp_title'));
|
85 |
SQ_Tools::saveOptions('sq_fp_description', SQ_Tools::getValue('sq_fp_description'));
|
86 |
SQ_Tools::saveOptions('sq_fp_keywords', SQ_Tools::getValue('sq_fp_keywords'));
|
|
|
87 |
|
88 |
|
89 |
///////////////////////////////////////////
|
90 |
/////////////////////////////SITEMAP OPTION
|
91 |
-
SQ_Tools::saveOptions('sq_auto_sitemap', (int)
|
92 |
-
SQ_Tools::saveOptions('sq_auto_feed', (int)
|
93 |
SQ_Tools::saveOptions('sq_sitemap_frequency', SQ_Tools::getValue('sq_sitemap_frequency'));
|
94 |
-
SQ_Tools::saveOptions('sq_sitemap_ping', (int)
|
95 |
|
96 |
foreach (SQ_Tools::$options['sq_sitemap'] as $key => $value) {
|
97 |
if ($key == 'sitemap') {
|
@@ -125,11 +134,13 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
125 |
|
126 |
SQ_Tools::saveOptions('sq_google_analytics', $this->model->checkGoogleAnalyticsCode(SQ_Tools::getValue('sq_google_analytics', '', true)));
|
127 |
SQ_Tools::saveOptions('sq_facebook_insights', $this->model->checkFavebookInsightsCode(SQ_Tools::getValue('sq_facebook_insights', '', true)));
|
|
|
128 |
SQ_Tools::saveOptions('sq_pinterest', $this->model->checkPinterestCode(SQ_Tools::getValue('sq_pinterest', '', true)));
|
129 |
|
130 |
///////////////////////////////////////////JSONLD
|
131 |
|
132 |
-
|
|
|
133 |
if (SQ_Tools::getIsset('sq_jsonld_type') && isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')])) {
|
134 |
|
135 |
foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')] as $key => $value) {
|
@@ -137,6 +148,11 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
137 |
SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')][$key] = SQ_Tools::getValue('sq_jsonld_' . $key);
|
138 |
}
|
139 |
}
|
|
|
|
|
|
|
|
|
|
|
140 |
}
|
141 |
SQ_Tools::saveOptions('sq_jsonld_type', SQ_Tools::getValue('sq_jsonld_type'));
|
142 |
|
@@ -167,6 +183,10 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
167 |
SQ_Tools::emptyCache();
|
168 |
break;
|
169 |
case 'sq_checkissues':
|
|
|
|
|
|
|
|
|
170 |
SQ_Tools::saveOptions('sq_checkedissues', 1);
|
171 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
172 |
|
@@ -175,21 +195,37 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
175 |
|
176 |
break;
|
177 |
case 'sq_fixautoseo':
|
|
|
|
|
|
|
|
|
178 |
SQ_Tools::saveOptions('sq_use', 1);
|
179 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
180 |
|
181 |
break;
|
182 |
case 'sq_fixprivate':
|
|
|
|
|
|
|
|
|
183 |
update_option('blog_public', 1);
|
184 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
185 |
|
186 |
break;
|
187 |
case 'sq_fixcomments':
|
|
|
|
|
|
|
|
|
188 |
update_option('comments_notify', 1);
|
189 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
190 |
|
191 |
break;
|
192 |
case 'sq_fixpermalink':
|
|
|
|
|
|
|
|
|
193 |
$GLOBALS['wp_rewrite'] = new WP_Rewrite();
|
194 |
global $wp_rewrite;
|
195 |
$permalink_structure = ((get_option('permalink_structure') <> '') ? get_option('permalink_structure') : '/') . "%postname%/";
|
@@ -199,31 +235,55 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
199 |
flush_rewrite_rules();
|
200 |
break;
|
201 |
case 'sq_fix_ogduplicate':
|
|
|
|
|
|
|
|
|
202 |
SQ_Tools::saveOptions('sq_auto_facebook', 0);
|
203 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
204 |
|
205 |
break;
|
206 |
case 'sq_fix_tcduplicate':
|
|
|
|
|
|
|
|
|
207 |
SQ_Tools::saveOptions('sq_auto_twitter', 0);
|
208 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
209 |
|
210 |
break;
|
211 |
case 'sq_fix_titleduplicate':
|
|
|
|
|
|
|
|
|
212 |
SQ_Tools::saveOptions('sq_auto_title', 0);
|
213 |
SQ_Tools::saveOptions('sq_auto_seo', 1);
|
214 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
215 |
|
216 |
break;
|
217 |
case 'sq_fix_descduplicate':
|
|
|
|
|
|
|
|
|
218 |
SQ_Tools::saveOptions('sq_auto_description', 0);
|
219 |
SQ_Tools::saveOptions('sq_auto_seo', 1);
|
220 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
221 |
|
222 |
break;
|
223 |
case 'sq_active_help' :
|
|
|
|
|
|
|
|
|
224 |
SQ_Tools::saveOptions('active_help', SQ_Tools::getValue('active_help'));
|
225 |
break;
|
226 |
case 'sq_warnings_off':
|
|
|
|
|
|
|
|
|
227 |
SQ_Tools::saveOptions('ignore_warn', 1);
|
228 |
break;
|
229 |
case 'sq_get_snippet':
|
@@ -239,6 +299,10 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
239 |
echo json_encode($snippet);
|
240 |
exit();
|
241 |
case 'sq_backup':
|
|
|
|
|
|
|
|
|
242 |
SQ_Tools::setHeader('text');
|
243 |
header("Content-Disposition: attachment; filename=squirrly.txt");
|
244 |
|
@@ -250,6 +314,10 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
250 |
exit();
|
251 |
break;
|
252 |
case 'sq_restore':
|
|
|
|
|
|
|
|
|
253 |
if (!empty($_FILES['sq_options']) && $_FILES['sq_options']['tmp_name'] <> '') {
|
254 |
$options = file_get_contents($_FILES['sq_options']['tmp_name']);
|
255 |
try {
|
@@ -291,6 +359,7 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
|
|
291 |
$rules['favicon\.icon$'] = 'index.php?sq_get=favicon';
|
292 |
$rules['touch-icon\.png$'] = 'index.php?sq_get=touchicon';
|
293 |
foreach ($this->model->appleSizes as $size) {
|
|
|
294 |
$rules['touch-icon' . $size . '\.png$'] = 'index.php?sq_get=touchicon&sq_size=' . $size;
|
295 |
}
|
296 |
}
|
33 |
public function action() {
|
34 |
parent::action();
|
35 |
|
36 |
+
|
37 |
switch (SQ_Tools::getValue('action')) {
|
38 |
|
39 |
case 'sq_settingsseo_update':
|
40 |
+
if (!current_user_can('manage_options')) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
if (!SQ_Tools::getIsset('sq_use')) {
|
45 |
return;
|
46 |
}
|
47 |
|
48 |
+
SQ_Tools::saveOptions('sq_use', (int)SQ_Tools::getValue('sq_use'));
|
49 |
+
SQ_Tools::saveOptions('sq_auto_title', (int)SQ_Tools::getValue('sq_auto_title'));
|
50 |
+
SQ_Tools::saveOptions('sq_auto_description', (int)SQ_Tools::getValue('sq_auto_description'));
|
51 |
+
SQ_Tools::saveOptions('sq_auto_canonical', (int)SQ_Tools::getValue('sq_auto_canonical'));
|
52 |
+
SQ_Tools::saveOptions('sq_auto_amp', (int)SQ_Tools::getValue('sq_auto_amp'));
|
53 |
|
54 |
+
SQ_Tools::saveOptions('sq_auto_meta', (int)SQ_Tools::getValue('sq_auto_meta'));
|
55 |
+
SQ_Tools::saveOptions('sq_auto_favicon', (int)SQ_Tools::getValue('sq_auto_favicon'));
|
56 |
|
57 |
///////////////////////////////////////////
|
58 |
/////////////////////////////SOCIAL OPTION
|
59 |
+
SQ_Tools::saveOptions('sq_auto_facebook', (int)SQ_Tools::getValue('sq_auto_facebook'));
|
60 |
+
SQ_Tools::saveOptions('sq_auto_twitter', (int)SQ_Tools::getValue('sq_auto_twitter'));
|
61 |
SQ_Tools::saveOptions('sq_auto_twittersize', SQ_Tools::getValue('sq_auto_twittersize'));
|
62 |
SQ_Tools::saveOptions('sq_og_locale', SQ_Tools::getValue('sq_og_locale'));
|
63 |
|
65 |
SQ_Tools::saveOptions('sq_facebook_account', $this->model->checkFacebookAccount(SQ_Tools::getValue('sq_facebook_account')));
|
66 |
SQ_Tools::saveOptions('sq_google_plus', $this->model->checkGoogleAccount(SQ_Tools::getValue('sq_google_plus')));
|
67 |
SQ_Tools::saveOptions('sq_linkedin_account', $this->model->checkLinkeinAccount(SQ_Tools::getValue('sq_linkedin_account')));
|
68 |
+
SQ_Tools::saveOptions('sq_pinterest_account', $this->model->checkPinterestAccount(SQ_Tools::getValue('sq_pinterest_account')));
|
69 |
+
SQ_Tools::saveOptions('sq_instagram_account', $this->model->checkInstagramAccount(SQ_Tools::getValue('sq_instagram_account')));
|
70 |
|
71 |
///////////////////////////////////////////
|
72 |
/////////////////////////////FIRST PAGE OPTIMIZATION
|
83 |
$meta[] = array('key' => '_sq_fp_keywords', 'value' => SQ_Tools::getValue('sq_fp_keywords'));
|
84 |
|
85 |
if (SQ_Tools::getIsset('sq_fp_ogimage'))
|
86 |
+
$meta[] = array('key' => '_sq_fp_ogimage', 'value' => SQ_Tools::getValue('sq_fp_ogimage'));
|
87 |
|
88 |
if (!empty($meta))
|
89 |
SQ_ObjController::getModel('SQ_Post')->saveAdvMeta($pageId, $meta);
|
92 |
SQ_Tools::saveOptions('sq_fp_title', SQ_Tools::getValue('sq_fp_title'));
|
93 |
SQ_Tools::saveOptions('sq_fp_description', SQ_Tools::getValue('sq_fp_description'));
|
94 |
SQ_Tools::saveOptions('sq_fp_keywords', SQ_Tools::getValue('sq_fp_keywords'));
|
95 |
+
SQ_Tools::saveOptions('sq_fp_ogimage', SQ_Tools::getValue('sq_fp_ogimage'));
|
96 |
|
97 |
|
98 |
///////////////////////////////////////////
|
99 |
/////////////////////////////SITEMAP OPTION
|
100 |
+
SQ_Tools::saveOptions('sq_auto_sitemap', (int)SQ_Tools::getValue('sq_auto_sitemap'));
|
101 |
+
SQ_Tools::saveOptions('sq_auto_feed', (int)SQ_Tools::getValue('sq_auto_feed'));
|
102 |
SQ_Tools::saveOptions('sq_sitemap_frequency', SQ_Tools::getValue('sq_sitemap_frequency'));
|
103 |
+
SQ_Tools::saveOptions('sq_sitemap_ping', (int)SQ_Tools::getValue('sq_sitemap_ping'));
|
104 |
|
105 |
foreach (SQ_Tools::$options['sq_sitemap'] as $key => $value) {
|
106 |
if ($key == 'sitemap') {
|
134 |
|
135 |
SQ_Tools::saveOptions('sq_google_analytics', $this->model->checkGoogleAnalyticsCode(SQ_Tools::getValue('sq_google_analytics', '', true)));
|
136 |
SQ_Tools::saveOptions('sq_facebook_insights', $this->model->checkFavebookInsightsCode(SQ_Tools::getValue('sq_facebook_insights', '', true)));
|
137 |
+
SQ_Tools::saveOptions('sq_facebook_analytics', SQ_Tools::getValue('sq_facebook_analytics', ''));
|
138 |
SQ_Tools::saveOptions('sq_pinterest', $this->model->checkPinterestCode(SQ_Tools::getValue('sq_pinterest', '', true)));
|
139 |
|
140 |
///////////////////////////////////////////JSONLD
|
141 |
|
142 |
+
|
143 |
+
SQ_Tools::saveOptions('sq_auto_jsonld', (int)SQ_Tools::getValue('sq_auto_jsonld'));
|
144 |
if (SQ_Tools::getIsset('sq_jsonld_type') && isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')])) {
|
145 |
|
146 |
foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')] as $key => $value) {
|
148 |
SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')][$key] = SQ_Tools::getValue('sq_jsonld_' . $key);
|
149 |
}
|
150 |
}
|
151 |
+
if (isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')]['telephone']) &&
|
152 |
+
SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')]['telephone'] <> ''
|
153 |
+
) {
|
154 |
+
SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')]['telephone'] = '+' . SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')]['telephone'];
|
155 |
+
}
|
156 |
}
|
157 |
SQ_Tools::saveOptions('sq_jsonld_type', SQ_Tools::getValue('sq_jsonld_type'));
|
158 |
|
183 |
SQ_Tools::emptyCache();
|
184 |
break;
|
185 |
case 'sq_checkissues':
|
186 |
+
if (!current_user_can('manage_options')) {
|
187 |
+
return;
|
188 |
+
}
|
189 |
+
|
190 |
SQ_Tools::saveOptions('sq_checkedissues', 1);
|
191 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
192 |
|
195 |
|
196 |
break;
|
197 |
case 'sq_fixautoseo':
|
198 |
+
if (!current_user_can('manage_options')) {
|
199 |
+
return;
|
200 |
+
}
|
201 |
+
|
202 |
SQ_Tools::saveOptions('sq_use', 1);
|
203 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
204 |
|
205 |
break;
|
206 |
case 'sq_fixprivate':
|
207 |
+
if (!current_user_can('manage_options')) {
|
208 |
+
return;
|
209 |
+
}
|
210 |
+
|
211 |
update_option('blog_public', 1);
|
212 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
213 |
|
214 |
break;
|
215 |
case 'sq_fixcomments':
|
216 |
+
if (!current_user_can('manage_options')) {
|
217 |
+
return;
|
218 |
+
}
|
219 |
+
|
220 |
update_option('comments_notify', 1);
|
221 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
222 |
|
223 |
break;
|
224 |
case 'sq_fixpermalink':
|
225 |
+
if (!current_user_can('manage_options')) {
|
226 |
+
return;
|
227 |
+
}
|
228 |
+
|
229 |
$GLOBALS['wp_rewrite'] = new WP_Rewrite();
|
230 |
global $wp_rewrite;
|
231 |
$permalink_structure = ((get_option('permalink_structure') <> '') ? get_option('permalink_structure') : '/') . "%postname%/";
|
235 |
flush_rewrite_rules();
|
236 |
break;
|
237 |
case 'sq_fix_ogduplicate':
|
238 |
+
if (!current_user_can('manage_options')) {
|
239 |
+
return;
|
240 |
+
}
|
241 |
+
|
242 |
SQ_Tools::saveOptions('sq_auto_facebook', 0);
|
243 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
244 |
|
245 |
break;
|
246 |
case 'sq_fix_tcduplicate':
|
247 |
+
if (!current_user_can('manage_options')) {
|
248 |
+
return;
|
249 |
+
}
|
250 |
+
|
251 |
SQ_Tools::saveOptions('sq_auto_twitter', 0);
|
252 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
253 |
|
254 |
break;
|
255 |
case 'sq_fix_titleduplicate':
|
256 |
+
if (!current_user_can('manage_options')) {
|
257 |
+
return;
|
258 |
+
}
|
259 |
+
|
260 |
SQ_Tools::saveOptions('sq_auto_title', 0);
|
261 |
SQ_Tools::saveOptions('sq_auto_seo', 1);
|
262 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
263 |
|
264 |
break;
|
265 |
case 'sq_fix_descduplicate':
|
266 |
+
if (!current_user_can('manage_options')) {
|
267 |
+
return;
|
268 |
+
}
|
269 |
+
|
270 |
SQ_Tools::saveOptions('sq_auto_description', 0);
|
271 |
SQ_Tools::saveOptions('sq_auto_seo', 1);
|
272 |
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
273 |
|
274 |
break;
|
275 |
case 'sq_active_help' :
|
276 |
+
if (!current_user_can('manage_options')) {
|
277 |
+
return;
|
278 |
+
}
|
279 |
+
|
280 |
SQ_Tools::saveOptions('active_help', SQ_Tools::getValue('active_help'));
|
281 |
break;
|
282 |
case 'sq_warnings_off':
|
283 |
+
if (!current_user_can('manage_options')) {
|
284 |
+
return;
|
285 |
+
}
|
286 |
+
|
287 |
SQ_Tools::saveOptions('ignore_warn', 1);
|
288 |
break;
|
289 |
case 'sq_get_snippet':
|
299 |
echo json_encode($snippet);
|
300 |
exit();
|
301 |
case 'sq_backup':
|
302 |
+
if (!current_user_can('manage_options')) {
|
303 |
+
return;
|
304 |
+
}
|
305 |
+
|
306 |
SQ_Tools::setHeader('text');
|
307 |
header("Content-Disposition: attachment; filename=squirrly.txt");
|
308 |
|
314 |
exit();
|
315 |
break;
|
316 |
case 'sq_restore':
|
317 |
+
if (!current_user_can('manage_options')) {
|
318 |
+
return;
|
319 |
+
}
|
320 |
+
|
321 |
if (!empty($_FILES['sq_options']) && $_FILES['sq_options']['tmp_name'] <> '') {
|
322 |
$options = file_get_contents($_FILES['sq_options']['tmp_name']);
|
323 |
try {
|
359 |
$rules['favicon\.icon$'] = 'index.php?sq_get=favicon';
|
360 |
$rules['touch-icon\.png$'] = 'index.php?sq_get=touchicon';
|
361 |
foreach ($this->model->appleSizes as $size) {
|
362 |
+
$size = (int)$size;
|
363 |
$rules['touch-icon' . $size . '\.png$'] = 'index.php?sq_get=touchicon&sq_size=' . $size;
|
364 |
}
|
365 |
}
|
core/SQ_Blocksearch/SQ_Blocksearch.php
CHANGED
@@ -16,16 +16,6 @@ class SQ_Blocksearch extends SQ_BlockController {
|
|
16 |
SQ_Tools::saveOptions('sq_img_licence', SQ_Tools::getValue('licence'));
|
17 |
exit();
|
18 |
break;
|
19 |
-
case 'sq_search_img':
|
20 |
-
|
21 |
-
$get = array('q' => SQ_Tools::getValue('q'),
|
22 |
-
'lang' => SQ_Tools::getValue('lang'),
|
23 |
-
'start' => SQ_Tools::getValue('start'),
|
24 |
-
'page' => SQ_Tools::getValue('page'),
|
25 |
-
'nrb' => SQ_Tools::getValue('nrb')
|
26 |
-
);
|
27 |
-
echo $this->model->searchImage($get);
|
28 |
-
break;
|
29 |
case 'sq_search_blog':
|
30 |
if (SQ_Tools::getValue('exclude') && SQ_Tools::getValue('exclude') <> 'undefined')
|
31 |
$exclude = array((int) SQ_Tools::getValue('exclude'));
|
16 |
SQ_Tools::saveOptions('sq_img_licence', SQ_Tools::getValue('licence'));
|
17 |
exit();
|
18 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
case 'sq_search_blog':
|
20 |
if (SQ_Tools::getValue('exclude') && SQ_Tools::getValue('exclude') <> 'undefined')
|
21 |
$exclude = array((int) SQ_Tools::getValue('exclude'));
|
core/SQ_Loading/SQ_Loading.php
CHANGED
@@ -39,12 +39,12 @@ class SQ_Loading extends SQ_BlockController {
|
|
39 |
' . (($keyword <> '') ? 'var sq_keyword_from_post = "' . $keyword . '";' : '') . '
|
40 |
if (typeof sq_script === "undefined"){
|
41 |
var sq_script = document.createElement(\'script\');
|
42 |
-
sq_script.src = "' . _SQ_STATIC_API_URL_ . SQ_URI . '/js/squirrly.js?ver=' . SQ_VERSION_ID . '";
|
43 |
var site_head = document.getElementsByTagName ("head")[0] || document.documentElement;
|
44 |
site_head.insertBefore(sq_script, site_head.firstChild);
|
45 |
}
|
46 |
jQuery(document).ready(function() {
|
47 |
-
jQuery("#sq_preloading").
|
48 |
});
|
49 |
</script>';
|
50 |
}
|
39 |
' . (($keyword <> '') ? 'var sq_keyword_from_post = "' . $keyword . '";' : '') . '
|
40 |
if (typeof sq_script === "undefined"){
|
41 |
var sq_script = document.createElement(\'script\');
|
42 |
+
sq_script.src = "' . _SQ_STATIC_API_URL_ . SQ_URI . '/js/squirrly.js?ver=' . SQ_VERSION_ID . '2";
|
43 |
var site_head = document.getElementsByTagName ("head")[0] || document.documentElement;
|
44 |
site_head.insertBefore(sq_script, site_head.firstChild);
|
45 |
}
|
46 |
jQuery(document).ready(function() {
|
47 |
+
jQuery("#sq_preloading").html("");
|
48 |
});
|
49 |
</script>';
|
50 |
}
|
core/config.xml
CHANGED
@@ -89,7 +89,6 @@
|
|
89 |
<controller>SQ_Post</controller>
|
90 |
</controllers>
|
91 |
<actions>
|
92 |
-
<action>sq_search_img</action>
|
93 |
<action>sq_search_blog</action>
|
94 |
<action>sq_type_click</action>
|
95 |
</actions>
|
89 |
<controller>SQ_Post</controller>
|
90 |
</controllers>
|
91 |
<actions>
|
|
|
92 |
<action>sq_search_blog</action>
|
93 |
<action>sq_type_click</action>
|
94 |
</actions>
|
languages/squirrly-seo-de_DE.mo
CHANGED
Binary file
|
languages/squirrly-seo-de_DE.po
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Squirrly SEO Plugin v1.0.8\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date:
|
6 |
-
"PO-Revision-Date:
|
7 |
"Last-Translator: Squirrly <contact@squirrly.co>\n"
|
8 |
"Language-Team: \n"
|
9 |
"Language: de_DE\n"
|
@@ -14,21 +14,13 @@ msgstr ""
|
|
14 |
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
16 |
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
-
"X-Poedit-Basepath:
|
18 |
"X-Textdomain-Support: yes\n"
|
19 |
-
"X-Generator: Poedit 1.
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
|
22 |
# @ squirrly-seo
|
23 |
-
#:
|
24 |
-
msgid ""
|
25 |
-
"For Squirrly to work, the PHP version has to be equal or greater then 5.1"
|
26 |
-
msgstr ""
|
27 |
-
"Damit Squirrly funktioniert, muss die PHP-Version gleich oder größer als 5.1 "
|
28 |
-
"sein"
|
29 |
-
|
30 |
-
# @ squirrly-seo
|
31 |
-
#: classes/SQ_Error.php:17
|
32 |
msgid ""
|
33 |
"Function get_class does not exists! Is required for Squirrly to work "
|
34 |
"properly."
|
@@ -37,7 +29,7 @@ msgstr ""
|
|
37 |
"richtig zu arbeiten."
|
38 |
|
39 |
# @ squirrly-seo
|
40 |
-
#: classes/SQ_Error.php:
|
41 |
msgid ""
|
42 |
"Function file_exists does not exists! Is required for Squirrly to work "
|
43 |
"properly."
|
@@ -46,91 +38,250 @@ msgstr ""
|
|
46 |
"richtig zu arbeiten."
|
47 |
|
48 |
# @ squirrly-seo
|
49 |
-
#: classes/SQ_Error.php:
|
50 |
msgid "The home directory is not set!"
|
51 |
msgstr "Das Home-Verzeichnis wurde nicht gesetzt!"
|
52 |
|
53 |
# @ squirrly-seo
|
54 |
-
#: classes/SQ_Error.php:
|
55 |
msgid "The PHP version has to be greater then 4.0"
|
56 |
msgstr "Die PHP-Version muß größer als 4.0 sein"
|
57 |
|
58 |
# @ squirrly-seo
|
59 |
-
#: classes/SQ_Error.php:
|
60 |
msgid "Turn off warnings!"
|
61 |
msgstr "Warnungen ausschalten!"
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
msgstr "Hinweis: "
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
msgstr "Notiz: "
|
72 |
|
73 |
# @ squirrly-seo
|
74 |
-
#: classes/SQ_Tools.php:
|
75 |
msgid "Fix it for me!"
|
76 |
msgstr "Beheben Sie es für mich!"
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
# @ squirrly-seo
|
84 |
-
#: classes/SQ_Tools.php:
|
85 |
msgid "You're blocking google from indexing your site!"
|
86 |
msgstr "Sie blockieren Google zum Indizieren Ihrer Website!"
|
87 |
|
88 |
-
|
89 |
-
#: classes/SQ_Tools.php:217
|
90 |
msgid ""
|
91 |
"It is highly recommended that you include the %postname% variable in the "
|
92 |
-
"permalink structure."
|
|
|
93 |
msgstr ""
|
94 |
-
"Es wird stark empfohlen, dass Sie die %postname% Variable in der Permalink-"
|
95 |
-
"Struktur einschließen."
|
96 |
|
97 |
-
|
98 |
-
|