Version Description
- 05/08/2017 =
- Made the Sitemap Compatible with more Wordpress Themes
- Update the validation link for Twitter
- Fixed broken links in SEO Audit
Download this release
Release Info
Developer | cifi |
Plugin | SEO SQUIRRLY™ |
Version | 8.0.1 |
Comparing to | |
See all releases |
Code changes from version 6.3.1 to 8.0.1
- classes/SQ_Action.php +3 -2
- classes/SQ_DisplayController.php +15 -1
- classes/SQ_ObjController.php +45 -8
- classes/SQ_Ranking.php +1 -7
- config/config.php +5 -1
- config/paths.php +2 -1
- controllers/SQ_Frontend.php +51 -38
- controllers/SQ_Menu.php +41 -3
- controllers/SQ_Post.php +8 -8
- controllers/SQ_PostsList.php +1 -1
- controllers/SQ_Sitemaps.php +49 -15
- core/SQ_BlockAudit/SQ_BlockAudit.php +19 -0
- core/SQ_BlockCopyright/SQ_BlockCopyright.php +11 -0
- core/SQ_BlockCustomerService/SQ_BlockCustomerService.php +11 -0
- core/SQ_BlockKeywordResearch/SQ_BlockKeywordResearch.php +11 -0
- core/SQ_BlockLiveAssistant/SQ_BlockLiveAssistant.php +11 -0
- core/SQ_Blockresearch/SQ_Blockresearch.php +0 -1
- core/SQ_Blocksearch/SQ_Blocksearch.php +0 -3
- core/SQ_Loading/SQ_Loading.php +27 -6
- models/SQ_BlockPostsAnalytics.php +35 -52
- models/SQ_BlockSettingsSeo.php +1 -0
- models/SQ_Frontend.php +148 -155
- models/SQ_Menu.php +1 -5
- models/SQ_Sitemaps.php +1 -0
- models/services/JsonLD.php +444 -0
- readme.txt +62 -245
- squirrly.php +6 -5
- themes/default/SQ_BlockAccount.php +1 -0
- themes/default/SQ_BlockAudit.php +63 -0
- themes/default/SQ_BlockCopyright.php +31 -0
- themes/default/SQ_BlockCustomerService.php +71 -0
- themes/default/SQ_BlockDashboard.php +83 -70
- themes/default/SQ_BlockKeywordResearch.php +37 -0
- themes/default/SQ_BlockLiveAssistant.php +36 -0
- themes/default/SQ_BlockPostsAnalytics.php +0 -7
- themes/default/SQ_BlockSettings.php +67 -21
- themes/default/SQ_BlockSettingsSeo.php +305 -172
- themes/default/SQ_BlockSupport.php +11 -6
- themes/default/css/sq_blockaudit.css +50 -0
- themes/default/css/sq_blockcopyright.css +26 -0
- themes/default/css/sq_blockdashboard.css +54 -18
- themes/default/css/sq_blockkeywordresearch.css +31 -0
- themes/default/css/sq_blockliveassistant.css +49 -0
- themes/default/css/sq_blocksettingsseo.css +2 -1
- themes/default/css/sq_global.css +155 -65
- themes/default/css/sq_menu.css +235 -133
- themes/default/css/sq_post.css +3 -3
- themes/default/img/help/copyright_options1.png +0 -0
- themes/default/img/help/copyright_options2.png +0 -0
- themes/default/img/help/copyright_options3.png +0 -0
- themes/default/img/help/live_assistant1.png +0 -0
- themes/default/img/help/live_assistant2.png +0 -0
- themes/default/img/help/live_assistant3.png +0 -0
- themes/default/img/help/live_assistant4.png +0 -0
- themes/default/img/settings/audit.png +0 -0
- themes/default/img/settings/sq_badge_g17.png +0 -0
- themes/default/img/settings/team.png +0 -0
- themes/default/js/sq_blockkeywordresearch.js +35 -0
- themes/default/js/sq_blocksupport.js +0 -10
classes/SQ_Action.php
CHANGED
@@ -14,7 +14,7 @@ class SQ_Action extends SQ_FrontController {
|
|
14 |
|
15 |
private function _isAjax() {
|
16 |
$url = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false);
|
17 |
-
if ($url && (strpos($url,
|
18 |
return true;
|
19 |
}
|
20 |
|
@@ -136,7 +136,7 @@ class SQ_Action extends SQ_FrontController {
|
|
136 |
return false;
|
137 |
}
|
138 |
|
139 |
-
$extra = array('user_url' => get_bloginfo('
|
140 |
'lang' => (defined('WPLANG') ? WPLANG : 'en_US'),
|
141 |
'versq' => SQ_VERSION_ID,
|
142 |
'verwp' => WP_VERSION_ID,
|
@@ -168,6 +168,7 @@ class SQ_Action extends SQ_FrontController {
|
|
168 |
}
|
169 |
//call it with http to prevent curl issues with ssls
|
170 |
$url = self::cleanUrl($scheme . _SQ_API_URL_ . $module . "?" . $parameters);
|
|
|
171 |
return SQ_Tools::sq_remote_get($url, array(), array('timeout' => $timeout));
|
172 |
}
|
173 |
|
14 |
|
15 |
private function _isAjax() {
|
16 |
$url = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false);
|
17 |
+
if ($url && (strpos($url, str_replace(get_bloginfo('url'),'',admin_url('admin-ajax.php', 'relative'))) !== false )) {
|
18 |
return true;
|
19 |
}
|
20 |
|
136 |
return false;
|
137 |
}
|
138 |
|
139 |
+
$extra = array('user_url' => get_bloginfo('url'),
|
140 |
'lang' => (defined('WPLANG') ? WPLANG : 'en_US'),
|
141 |
'versq' => SQ_VERSION_ID,
|
142 |
'verwp' => WP_VERSION_ID,
|
168 |
}
|
169 |
//call it with http to prevent curl issues with ssls
|
170 |
$url = self::cleanUrl($scheme . _SQ_API_URL_ . $module . "?" . $parameters);
|
171 |
+
//update_option('sq_seopost_log', $url);
|
172 |
return SQ_Tools::sq_remote_get($url, array(), array('timeout' => $timeout));
|
173 |
}
|
174 |
|
classes/SQ_DisplayController.php
CHANGED
@@ -13,6 +13,19 @@ class SQ_DisplayController {
|
|
13 |
self::loadMedia('sq_global');
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* echo the css link from theme css directory
|
18 |
*
|
@@ -22,8 +35,9 @@ class SQ_DisplayController {
|
|
22 |
* @return string
|
23 |
*/
|
24 |
public static function loadMedia($uri = '', $params = array('trigger' => true, 'media' => 'all')) {
|
25 |
-
if (
|
26 |
return;
|
|
|
27 |
|
28 |
$css_uri = '';
|
29 |
$js_uri = '';
|
13 |
self::loadMedia('sq_global');
|
14 |
}
|
15 |
|
16 |
+
/**
|
17 |
+
* Check if ajax
|
18 |
+
* @return bool
|
19 |
+
*/
|
20 |
+
private static function _isAjax() {
|
21 |
+
$url = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false);
|
22 |
+
if ($url && (strpos($url, str_replace(get_bloginfo('url'),'',admin_url('admin-ajax.php', 'relative'))) !== false )) {
|
23 |
+
return true;
|
24 |
+
}
|
25 |
+
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
|
29 |
/**
|
30 |
* echo the css link from theme css directory
|
31 |
*
|
35 |
* @return string
|
36 |
*/
|
37 |
public static function loadMedia($uri = '', $params = array('trigger' => true, 'media' => 'all')) {
|
38 |
+
if (self::_isAjax()) {
|
39 |
return;
|
40 |
+
}
|
41 |
|
42 |
$css_uri = '';
|
43 |
$js_uri = '';
|
classes/SQ_ObjController.php
CHANGED
@@ -14,7 +14,7 @@ class SQ_ObjController {
|
|
14 |
private static function includeController($className, $core) {
|
15 |
/* check if class is already defined */
|
16 |
if (!class_exists($className, false))
|
17 |
-
|
18 |
try {
|
19 |
if (file_exists(($core ? _SQ_CONTROLLER_DIR_ : _SQ_CLASSES_DIR_) . $className . '.php'))
|
20 |
include_once(($core ? _SQ_CONTROLLER_DIR_ : _SQ_CLASSES_DIR_) . $className . '.php');
|
@@ -29,7 +29,7 @@ class SQ_ObjController {
|
|
29 |
* @param string $className
|
30 |
* @param bool $core TRUE is the class is a core class or FALSE if it is from classes directory
|
31 |
*
|
32 |
-
* @return object of the class
|
33 |
*/
|
34 |
public static function getController($className, $core = true) {
|
35 |
if (!isset(self::$instances[$className])) {
|
@@ -62,7 +62,7 @@ class SQ_ObjController {
|
|
62 |
*
|
63 |
* @param string $className
|
64 |
*
|
65 |
-
* @return object of the class
|
66 |
*/
|
67 |
public static function getModel($className) {
|
68 |
/* add Model prefix */
|
@@ -81,7 +81,45 @@ class SQ_ObjController {
|
|
81 |
} else
|
82 |
return self::$instances[$prefix . $className];
|
83 |
|
84 |
-
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
|
87 |
private static function includeBlock($className) {
|
@@ -99,7 +137,7 @@ class SQ_ObjController {
|
|
99 |
*
|
100 |
* @param string $className
|
101 |
*
|
102 |
-
* @return object of the class
|
103 |
*/
|
104 |
public static function getBlock($className) {
|
105 |
|
@@ -116,7 +154,7 @@ class SQ_ObjController {
|
|
116 |
} else
|
117 |
return self::$instances[$className];
|
118 |
|
119 |
-
return;
|
120 |
}
|
121 |
|
122 |
/**
|
@@ -133,8 +171,7 @@ class SQ_ObjController {
|
|
133 |
|
134 |
/* load configuration blocks data from core config files */
|
135 |
$data = file_get_contents($config_file);
|
136 |
-
self::$config = json_decode(json_encode((array)
|
137 |
-
;
|
138 |
}
|
139 |
//print_r(self::$config);
|
140 |
if (is_array(self::$config))
|
14 |
private static function includeController($className, $core) {
|
15 |
/* check if class is already defined */
|
16 |
if (!class_exists($className, false))
|
17 |
+
/* if $core == true then call the class from core directory */
|
18 |
try {
|
19 |
if (file_exists(($core ? _SQ_CONTROLLER_DIR_ : _SQ_CLASSES_DIR_) . $className . '.php'))
|
20 |
include_once(($core ? _SQ_CONTROLLER_DIR_ : _SQ_CLASSES_DIR_) . $className . '.php');
|
29 |
* @param string $className
|
30 |
* @param bool $core TRUE is the class is a core class or FALSE if it is from classes directory
|
31 |
*
|
32 |
+
* @return bool|object of the class
|
33 |
*/
|
34 |
public static function getController($className, $core = true) {
|
35 |
if (!isset(self::$instances[$className])) {
|
62 |
*
|
63 |
* @param string $className
|
64 |
*
|
65 |
+
* @return bool|object of the class
|
66 |
*/
|
67 |
public static function getModel($className) {
|
68 |
/* add Model prefix */
|
81 |
} else
|
82 |
return self::$instances[$prefix . $className];
|
83 |
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
private static function includeModelService($className) {
|
88 |
+
|
89 |
+
/* check if class is already defined */
|
90 |
+
if (file_exists(_SQ_SERVICE_DIR_ . $className . '.php'))
|
91 |
+
try {
|
92 |
+
include_once(_SQ_SERVICE_DIR_ . $className . '.php');
|
93 |
+
} catch (Exception $e) {
|
94 |
+
echo 'Model Service Error: ' . $e->getMessage();
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Get the instance of the specified model service class
|
100 |
+
*
|
101 |
+
* @param string $className
|
102 |
+
*
|
103 |
+
* @return bool|object of the class
|
104 |
+
*/
|
105 |
+
public static function getModelService($className) {
|
106 |
+
/* add Model_Service prefix */
|
107 |
+
$prefix = 'Model_Service_';
|
108 |
+
|
109 |
+
if (!isset(self::$instances[$prefix . $className])) {
|
110 |
+
/* if $core == true then call the class from core directory */
|
111 |
+
self::includeModelService($className);
|
112 |
+
|
113 |
+
//echo $className . '<br />';
|
114 |
+
if (class_exists($prefix . $className)) {
|
115 |
+
$classModel = $prefix . $className;
|
116 |
+
self::$instances[$prefix . $className] = new $classModel;
|
117 |
+
return self::$instances[$prefix . $className];
|
118 |
+
}
|
119 |
+
} else
|
120 |
+
return self::$instances[$prefix . $className];
|
121 |
+
|
122 |
+
return false;
|
123 |
}
|
124 |
|
125 |
private static function includeBlock($className) {
|
137 |
*
|
138 |
* @param string $className
|
139 |
*
|
140 |
+
* @return bool|object of the class
|
141 |
*/
|
142 |
public static function getBlock($className) {
|
143 |
|
154 |
} else
|
155 |
return self::$instances[$className];
|
156 |
|
157 |
+
return false;
|
158 |
}
|
159 |
|
160 |
/**
|
171 |
|
172 |
/* load configuration blocks data from core config files */
|
173 |
$data = file_get_contents($config_file);
|
174 |
+
self::$config = json_decode(json_encode((array)simplexml_load_string($data)), 1);;
|
|
|
175 |
}
|
176 |
//print_r(self::$config);
|
177 |
if (is_array(self::$config))
|
classes/SQ_Ranking.php
CHANGED
@@ -5,7 +5,6 @@
|
|
5 |
*/
|
6 |
class SQ_Ranking extends SQ_FrontController
|
7 |
{
|
8 |
-
|
9 |
private $keyword;
|
10 |
private $post_id;
|
11 |
private $error;
|
@@ -31,7 +30,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
31 |
|
32 |
/**
|
33 |
* Get the google language from settings
|
34 |
-
* @return
|
35 |
*/
|
36 |
public function getLanguage()
|
37 |
{
|
@@ -256,11 +255,6 @@ class SQ_Ranking extends SQ_FrontController
|
|
256 |
return;
|
257 |
}
|
258 |
|
259 |
-
if (isset($_SERVER['SERVER_ADDR'])){
|
260 |
-
if (strpos($_SERVER['SERVER_ADDR'], '192.') === 0){
|
261 |
-
return;
|
262 |
-
}
|
263 |
-
}
|
264 |
set_time_limit(3000);
|
265 |
/* Load the Submit Actions Handler */
|
266 |
SQ_ObjController::getController('SQ_Tools', false);
|
5 |
*/
|
6 |
class SQ_Ranking extends SQ_FrontController
|
7 |
{
|
|
|
8 |
private $keyword;
|
9 |
private $post_id;
|
10 |
private $error;
|
30 |
|
31 |
/**
|
32 |
* Get the google language from settings
|
33 |
+
* @return string
|
34 |
*/
|
35 |
public function getLanguage()
|
36 |
{
|
255 |
return;
|
256 |
}
|
257 |
|
|
|
|
|
|
|
|
|
|
|
258 |
set_time_limit(3000);
|
259 |
/* Load the Submit Actions Handler */
|
260 |
SQ_ObjController::getController('SQ_Tools', false);
|
config/config.php
CHANGED
@@ -4,7 +4,11 @@
|
|
4 |
* The configuration file
|
5 |
*/
|
6 |
define('_SQ_SUPPORT_EMAIL_', 'support@squirrly.co');
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
define('_SQ_MOBILE_ICON_SIZES', '76,120,152');
|
9 |
define('REQUEST_TIME', microtime(true));
|
10 |
|
4 |
* The configuration file
|
5 |
*/
|
6 |
define('_SQ_SUPPORT_EMAIL_', 'support@squirrly.co');
|
7 |
+
if (defined('NONCE_KEY')){
|
8 |
+
define('_SQ_NONCE_ID_', NONCE_KEY);
|
9 |
+
}else{
|
10 |
+
define('_SQ_NONCE_ID_', md5(date('Y-d')));
|
11 |
+
}
|
12 |
define('_SQ_MOBILE_ICON_SIZES', '76,120,152');
|
13 |
define('REQUEST_TIME', microtime(true));
|
14 |
|
config/paths.php
CHANGED
@@ -8,7 +8,7 @@ define('_THEME_NAME_', 'default'); //THIS LINE WILL BE CHANGED WITH THE USER SET
|
|
8 |
|
9 |
$scheme = (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") || (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN)) ? 'https:' : 'http:'); //CHECK IF SCURE
|
10 |
defined('_SQ_DASH_URL_') || define('_SQ_DASH_URL_', 'https://my.squirrly.co/');
|
11 |
-
defined('SQ_URI') || define('SQ_URI', (WP_VERSION_ID >=
|
12 |
defined('_SQ_API_URL_') || define('_SQ_API_URL_', '//api.squirrly.co/');
|
13 |
|
14 |
defined('_SQ_STATIC_API_URL_') || define('_SQ_STATIC_API_URL_', '//storage.googleapis.com/squirrly/');
|
@@ -22,6 +22,7 @@ define('_SQ_ROOT_DIR_', realpath(dirname($currentDir)));
|
|
22 |
define('_SQ_CLASSES_DIR_', _SQ_ROOT_DIR_ . '/classes/');
|
23 |
define('_SQ_CONTROLLER_DIR_', _SQ_ROOT_DIR_ . '/controllers/');
|
24 |
define('_SQ_MODEL_DIR_', _SQ_ROOT_DIR_ . '/models/');
|
|
|
25 |
define('_SQ_TRANSLATIONS_DIR_', _SQ_ROOT_DIR_ . '/translations/');
|
26 |
define('_SQ_CORE_DIR_', _SQ_ROOT_DIR_ . '/core/');
|
27 |
define('_SQ_ALL_THEMES_DIR_', _SQ_ROOT_DIR_ . '/themes/');
|
8 |
|
9 |
$scheme = (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") || (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN)) ? 'https:' : 'http:'); //CHECK IF SCURE
|
10 |
defined('_SQ_DASH_URL_') || define('_SQ_DASH_URL_', 'https://my.squirrly.co/');
|
11 |
+
defined('SQ_URI') || define('SQ_URI', (WP_VERSION_ID >= 4700) ? 'wp470' : 'wp350');
|
12 |
defined('_SQ_API_URL_') || define('_SQ_API_URL_', '//api.squirrly.co/');
|
13 |
|
14 |
defined('_SQ_STATIC_API_URL_') || define('_SQ_STATIC_API_URL_', '//storage.googleapis.com/squirrly/');
|
22 |
define('_SQ_CLASSES_DIR_', _SQ_ROOT_DIR_ . '/classes/');
|
23 |
define('_SQ_CONTROLLER_DIR_', _SQ_ROOT_DIR_ . '/controllers/');
|
24 |
define('_SQ_MODEL_DIR_', _SQ_ROOT_DIR_ . '/models/');
|
25 |
+
define('_SQ_SERVICE_DIR_', _SQ_MODEL_DIR_ . '/services/');
|
26 |
define('_SQ_TRANSLATIONS_DIR_', _SQ_ROOT_DIR_ . '/translations/');
|
27 |
define('_SQ_CORE_DIR_', _SQ_ROOT_DIR_ . '/core/');
|
28 |
define('_SQ_ALL_THEMES_DIR_', _SQ_ROOT_DIR_ . '/themes/');
|
controllers/SQ_Frontend.php
CHANGED
@@ -12,38 +12,34 @@ class SQ_Frontend extends SQ_FrontController {
|
|
12 |
|
13 |
parent::__construct();
|
14 |
|
15 |
-
if
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
}
|
22 |
-
|
23 |
-
if (SQ_Tools::$options['sq_auto_feed'] == 1) {
|
24 |
-
/* Load the Feed Style */
|
25 |
-
SQ_ObjController::getController('SQ_Feed');
|
26 |
-
}
|
27 |
-
|
28 |
-
//validate custom arguments for favicon and sitemap
|
29 |
-
add_filter('query_vars', array($this, 'validateParams'), 1, 1);
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
//flush the header with the title and removing duplicates
|
38 |
-
add_action('wp_head', array($this->model, 'flushHeader'),99);
|
39 |
-
add_action('shutdown', array($this->model, 'flushHeader'));
|
40 |
-
}
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
|
|
47 |
}
|
48 |
|
49 |
public function rewrite_rules($wp_rewrite) {
|
@@ -57,7 +53,7 @@ class SQ_Frontend extends SQ_FrontController {
|
|
57 |
|
58 |
private function _isAjax() {
|
59 |
$url = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false);
|
60 |
-
if ($url && (strpos($url,
|
61 |
return true;
|
62 |
}
|
63 |
|
@@ -70,12 +66,16 @@ class SQ_Frontend extends SQ_FrontController {
|
|
70 |
public function hookFronthead() {
|
71 |
|
72 |
if (!$this->_isAjax()) {
|
73 |
-
if (
|
74 |
-
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
78 |
-
|
79 |
}
|
80 |
}
|
81 |
|
@@ -84,20 +84,27 @@ class SQ_Frontend extends SQ_FrontController {
|
|
84 |
*/
|
85 |
public function hookPreload() {
|
86 |
//Check for sitemap and robots
|
87 |
-
if (
|
88 |
-
if (isset($_SERVER['REQUEST_URI'])
|
89 |
-
if (
|
90 |
-
$
|
|
|
|
|
91 |
}
|
92 |
}
|
93 |
|
94 |
//check the action call
|
95 |
$this->action();
|
96 |
}
|
|
|
|
|
97 |
}
|
98 |
|
99 |
/**
|
100 |
* Change the image path to absolute when in feed
|
|
|
|
|
|
|
101 |
*/
|
102 |
public function fixFeedLinks($content) {
|
103 |
if (is_feed()) {
|
@@ -178,7 +185,7 @@ class SQ_Frontend extends SQ_FrontController {
|
|
178 |
}
|
179 |
break;
|
180 |
case 'touchicon':
|
181 |
-
$size = (int)
|
182 |
if (SQ_Tools::$options['favicon'] <> '') {
|
183 |
//show the favico file
|
184 |
SQ_Tools::setHeader('png');
|
@@ -199,7 +206,13 @@ class SQ_Frontend extends SQ_FrontController {
|
|
199 |
}
|
200 |
}
|
201 |
|
202 |
-
public function hookFrontfooter(){
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
}
|
205 |
}
|
12 |
|
13 |
parent::__construct();
|
14 |
|
15 |
+
/* Check if sitemap is on */
|
16 |
+
if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
|
17 |
+
/* Load the Sitemap */
|
18 |
+
add_filter('rewrite_rules_array', array($this, 'rewrite_rules'), 1, 1);
|
19 |
+
SQ_ObjController::getController('SQ_Sitemaps');
|
20 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
if (SQ_Tools::$options['sq_auto_feed'] == 1) {
|
23 |
+
/* Load the Feed Style */
|
24 |
+
SQ_ObjController::getController('SQ_Feed');
|
25 |
+
}
|
26 |
|
27 |
+
//validate custom arguments for favicon and sitemap
|
28 |
+
add_filter('query_vars', array($this, 'validateParams'), 1, 1);
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
if ($this->isSquirrlySeoEnabled()) {
|
31 |
+
add_filter('sq_title', array($this->model, 'clearTitle'));
|
32 |
+
add_filter('sq_description', array($this->model, 'clearDescription'));
|
33 |
|
34 |
+
add_action('plugins_loaded', array($this->model, 'startBuffer'));
|
35 |
+
add_action('template_redirect', array($this->model, 'checkHandles'));
|
36 |
+
//flush the header with the title and removing duplicates
|
37 |
+
add_action('shutdown', array($this->model, 'getBuffer'));
|
38 |
+
}
|
39 |
+
if (SQ_Tools::$options['sq_url_fix'] == 1) {
|
40 |
+
add_action('the_content', array($this, 'fixFeedLinks'), 11);
|
41 |
}
|
42 |
+
|
43 |
}
|
44 |
|
45 |
public function rewrite_rules($wp_rewrite) {
|
53 |
|
54 |
private function _isAjax() {
|
55 |
$url = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false);
|
56 |
+
if ($url && (strpos($url, str_replace(get_bloginfo('url'), '', admin_url('admin-ajax.php', 'relative'))) !== false)) {
|
57 |
return true;
|
58 |
}
|
59 |
|
66 |
public function hookFronthead() {
|
67 |
|
68 |
if (!$this->_isAjax()) {
|
69 |
+
if ($this->isSquirrlySeoEnabled()) {
|
70 |
+
if (SQ_Tools::$options['sq_auto_jsonld'] == 1) {
|
71 |
+
//load the hooks for JsonLD
|
72 |
+
SQ_ObjController::getModelService('JsonLD');
|
73 |
+
}
|
74 |
+
|
75 |
}
|
76 |
|
77 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
78 |
+
->loadMedia(_SQ_THEME_URL_ . 'css/sq_frontend.css');
|
79 |
}
|
80 |
}
|
81 |
|
84 |
*/
|
85 |
public function hookPreload() {
|
86 |
//Check for sitemap and robots
|
87 |
+
if ($this->isSquirrlySeoEnabled()) {
|
88 |
+
if (isset($_SERVER['REQUEST_URI'])) {
|
89 |
+
if (SQ_Tools::$options['sq_auto_robots'] == 1) {
|
90 |
+
if (substr(strrchr($_SERVER['REQUEST_URI'], "/"), 1) == "robots.txt" || $_SERVER['REQUEST_URI'] == "/robots.txt") {
|
91 |
+
$this->model->robots();
|
92 |
+
}
|
93 |
}
|
94 |
}
|
95 |
|
96 |
//check the action call
|
97 |
$this->action();
|
98 |
}
|
99 |
+
|
100 |
+
|
101 |
}
|
102 |
|
103 |
/**
|
104 |
* Change the image path to absolute when in feed
|
105 |
+
* @param string $content
|
106 |
+
*
|
107 |
+
* @return string
|
108 |
*/
|
109 |
public function fixFeedLinks($content) {
|
110 |
if (is_feed()) {
|
185 |
}
|
186 |
break;
|
187 |
case 'touchicon':
|
188 |
+
$size = (int)get_query_var('sq_size');
|
189 |
if (SQ_Tools::$options['favicon'] <> '') {
|
190 |
//show the favico file
|
191 |
SQ_Tools::setHeader('png');
|
206 |
}
|
207 |
}
|
208 |
|
209 |
+
public function hookFrontfooter() {
|
210 |
+
if ($this->isSquirrlySeoEnabled()) {
|
211 |
+
echo $this->model->getGoogleAnalyticsAMPBody();
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
public function isSquirrlySeoEnabled() {
|
216 |
+
return (apply_filters('sq_use', SQ_Tools::$options['sq_use']) == 1);
|
217 |
}
|
218 |
}
|
controllers/SQ_Menu.php
CHANGED
@@ -123,7 +123,36 @@ class SQ_Menu extends SQ_FrontController {
|
|
123 |
));
|
124 |
}
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
$this->model->addSubmenu(array('sq_dashboard',
|
129 |
ucfirst(_SQ_NAME_) . __(' SEO Settings', _SQ_PLUGIN_NAME_),
|
@@ -133,9 +162,10 @@ class SQ_Menu extends SQ_FrontController {
|
|
133 |
array(SQ_ObjController::getBlock('SQ_BlockSettingsSeo'), 'init')
|
134 |
));
|
135 |
|
|
|
136 |
$this->model->addSubmenu(array('sq_dashboard',
|
137 |
ucfirst(_SQ_NAME_) . __(' Advanced Settings', _SQ_PLUGIN_NAME_),
|
138 |
-
__('Advanced', _SQ_PLUGIN_NAME_),
|
139 |
'manage_options',
|
140 |
'sq_settings',
|
141 |
array(SQ_ObjController::getBlock('SQ_BlockSettings'), 'init')
|
@@ -150,10 +180,18 @@ class SQ_Menu extends SQ_FrontController {
|
|
150 |
));
|
151 |
}
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
$this->model->addSubmenu(array('sq_dashboard',
|
154 |
__('Become an Affiliate with ', _SQ_PLUGIN_NAME_) . ucfirst(_SQ_NAME_),
|
155 |
-
__('Affiliate', _SQ_PLUGIN_NAME_),
|
156 |
-
'
|
157 |
'sq_affiliate',
|
158 |
array(SQ_ObjController::getBlock('SQ_BlockAffiliate'), 'init')
|
159 |
));
|
123 |
));
|
124 |
}
|
125 |
|
126 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
127 |
+
ucfirst(_SQ_NAME_) . __(' Keyword Research', _SQ_PLUGIN_NAME_),
|
128 |
+
__('Keyword Research', _SQ_PLUGIN_NAME_),
|
129 |
+
'edit_posts',
|
130 |
+
'sq_keywordresearch',
|
131 |
+
array(SQ_ObjController::getBlock('SQ_BlockKeywordResearch'), 'init')
|
132 |
+
));
|
133 |
|
134 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
135 |
+
ucfirst(_SQ_NAME_) . __(' Live Assistant', _SQ_PLUGIN_NAME_),
|
136 |
+
__('Live Assistant', _SQ_PLUGIN_NAME_),
|
137 |
+
'edit_posts',
|
138 |
+
'sq_liveassistant',
|
139 |
+
array(SQ_ObjController::getBlock('SQ_BlockLiveAssistant'), 'init')
|
140 |
+
));
|
141 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
142 |
+
ucfirst(_SQ_NAME_) . __(' Copywriting Options', _SQ_PLUGIN_NAME_),
|
143 |
+
__('Copywriting Options', _SQ_PLUGIN_NAME_),
|
144 |
+
'edit_posts',
|
145 |
+
'sq_copyright',
|
146 |
+
array(SQ_ObjController::getBlock('SQ_BlockCopyright'), 'init')
|
147 |
+
));
|
148 |
+
|
149 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
150 |
+
ucfirst(_SQ_NAME_) . __(' SEO Audit', _SQ_PLUGIN_NAME_),
|
151 |
+
__('Audit Site', _SQ_PLUGIN_NAME_),
|
152 |
+
'edit_posts',
|
153 |
+
'sq_seoaudit',
|
154 |
+
array(SQ_ObjController::getBlock('SQ_BlockAudit'), 'init')
|
155 |
+
));
|
156 |
|
157 |
$this->model->addSubmenu(array('sq_dashboard',
|
158 |
ucfirst(_SQ_NAME_) . __(' SEO Settings', _SQ_PLUGIN_NAME_),
|
162 |
array(SQ_ObjController::getBlock('SQ_BlockSettingsSeo'), 'init')
|
163 |
));
|
164 |
|
165 |
+
|
166 |
$this->model->addSubmenu(array('sq_dashboard',
|
167 |
ucfirst(_SQ_NAME_) . __(' Advanced Settings', _SQ_PLUGIN_NAME_),
|
168 |
+
__('Advanced Settings', _SQ_PLUGIN_NAME_),
|
169 |
'manage_options',
|
170 |
'sq_settings',
|
171 |
array(SQ_ObjController::getBlock('SQ_BlockSettings'), 'init')
|
180 |
));
|
181 |
}
|
182 |
|
183 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
184 |
+
ucfirst(_SQ_NAME_) . __(' Customer Service', _SQ_PLUGIN_NAME_),
|
185 |
+
__('Customer Service', _SQ_PLUGIN_NAME_),
|
186 |
+
'edit_posts',
|
187 |
+
'sq_customerservice',
|
188 |
+
array(SQ_ObjController::getBlock('SQ_BlockCustomerService'), 'init')
|
189 |
+
));
|
190 |
+
|
191 |
$this->model->addSubmenu(array('sq_dashboard',
|
192 |
__('Become an Affiliate with ', _SQ_PLUGIN_NAME_) . ucfirst(_SQ_NAME_),
|
193 |
+
__('Become an Affiliate', _SQ_PLUGIN_NAME_),
|
194 |
+
'edit_posts',
|
195 |
'sq_affiliate',
|
196 |
array(SQ_ObjController::getBlock('SQ_BlockAffiliate'), 'init')
|
197 |
));
|
controllers/SQ_Post.php
CHANGED
@@ -19,8 +19,9 @@ class SQ_Post extends SQ_FrontController {
|
|
19 |
if (SQ_Tools::$options['sq_api'] == '')
|
20 |
return;
|
21 |
|
22 |
-
add_action('save_post', array($this, 'hookSavePost'), 99);
|
23 |
-
add_action('shopp_product_saved', array($this, 'hookShopp'), 11);
|
|
|
24 |
|
25 |
if (SQ_Tools::$options['sq_use'] == 1 && SQ_Tools::$options['sq_auto_sitemap'] == 1) {
|
26 |
add_action('transition_post_status', array(SQ_ObjController::getController('SQ_Sitemaps'), 'refreshSitemap'), 9999, 3);
|
@@ -56,8 +57,8 @@ class SQ_Post extends SQ_FrontController {
|
|
56 |
/**
|
57 |
* Hook the Shopp plugin save product
|
58 |
*/
|
59 |
-
public function hookShopp($
|
60 |
-
$this->checkSeo($
|
61 |
}
|
62 |
|
63 |
/**
|
@@ -66,13 +67,13 @@ class SQ_Post extends SQ_FrontController {
|
|
66 |
*/
|
67 |
public function hookSavePost($post_id) {
|
68 |
|
69 |
-
|
70 |
if (!isset($this->saved[$post_id])) {
|
71 |
$this->saved[$post_id] = false;
|
72 |
}
|
73 |
|
74 |
// unhook this function so it doesn't loop infinitely
|
75 |
remove_action('save_post', array($this, 'hookSavePost'), 99);
|
|
|
76 |
//If the post is a new or edited post
|
77 |
if ((SQ_Tools::getValue('action')) == 'editpost' &&
|
78 |
wp_is_post_autosave($post_id) == '' &&
|
@@ -200,7 +201,6 @@ class SQ_Post extends SQ_FrontController {
|
|
200 |
$args['status'] = $status;
|
201 |
$args['permalink'] = get_permalink($post_id);
|
202 |
$args['permalink'] = $this->getPaged($args['permalink']);
|
203 |
-
$args['permalink'] = $args['permalink'];
|
204 |
$args['author'] = (int)SQ_Tools::getUserID();
|
205 |
$args['post_id'] = $post_id;
|
206 |
|
@@ -344,7 +344,7 @@ class SQ_Post extends SQ_FrontController {
|
|
344 |
$process = json_decode(get_option('sq_seopost'), true);
|
345 |
foreach ($process as $key => $call) {
|
346 |
|
347 |
-
if(!$response = json_decode(SQ_Action::apiCall('sq/seo/post', $call, 10))){
|
348 |
break;
|
349 |
}
|
350 |
|
@@ -353,7 +353,7 @@ class SQ_Post extends SQ_FrontController {
|
|
353 |
}
|
354 |
}
|
355 |
update_option('sq_seopost', json_encode($process));
|
356 |
-
|
357 |
}
|
358 |
|
359 |
}
|
19 |
if (SQ_Tools::$options['sq_api'] == '')
|
20 |
return;
|
21 |
|
22 |
+
add_action('save_post', array($this, 'hookSavePost'), 99, 1);
|
23 |
+
add_action('shopp_product_saved', array($this, 'hookShopp'), 11, 1);
|
24 |
+
add_action('edit_attachment', array($this, 'checkSeo'), 99, 1);
|
25 |
|
26 |
if (SQ_Tools::$options['sq_use'] == 1 && SQ_Tools::$options['sq_auto_sitemap'] == 1) {
|
27 |
add_action('transition_post_status', array(SQ_ObjController::getController('SQ_Sitemaps'), 'refreshSitemap'), 9999, 3);
|
57 |
/**
|
58 |
* Hook the Shopp plugin save product
|
59 |
*/
|
60 |
+
public function hookShopp($product) {
|
61 |
+
$this->checkSeo($product->id);
|
62 |
}
|
63 |
|
64 |
/**
|
67 |
*/
|
68 |
public function hookSavePost($post_id) {
|
69 |
|
|
|
70 |
if (!isset($this->saved[$post_id])) {
|
71 |
$this->saved[$post_id] = false;
|
72 |
}
|
73 |
|
74 |
// unhook this function so it doesn't loop infinitely
|
75 |
remove_action('save_post', array($this, 'hookSavePost'), 99);
|
76 |
+
|
77 |
//If the post is a new or edited post
|
78 |
if ((SQ_Tools::getValue('action')) == 'editpost' &&
|
79 |
wp_is_post_autosave($post_id) == '' &&
|
201 |
$args['status'] = $status;
|
202 |
$args['permalink'] = get_permalink($post_id);
|
203 |
$args['permalink'] = $this->getPaged($args['permalink']);
|
|
|
204 |
$args['author'] = (int)SQ_Tools::getUserID();
|
205 |
$args['post_id'] = $post_id;
|
206 |
|
344 |
$process = json_decode(get_option('sq_seopost'), true);
|
345 |
foreach ($process as $key => $call) {
|
346 |
|
347 |
+
if (!$response = json_decode(SQ_Action::apiCall('sq/seo/post', $call, 10))) {
|
348 |
break;
|
349 |
}
|
350 |
|
353 |
}
|
354 |
}
|
355 |
update_option('sq_seopost', json_encode($process));
|
356 |
+
}
|
357 |
}
|
358 |
|
359 |
}
|
controllers/SQ_PostsList.php
CHANGED
@@ -136,7 +136,7 @@ class SQ_PostsList extends SQ_FrontController
|
|
136 |
$description = SQ_Tools::$options['sq_fp_description'];
|
137 |
}
|
138 |
echo '<script type="text/javascript">
|
139 |
-
jQuery(\'#post-' . $post_id . '\').find(\'.row-title\').before(\'' . (($description <> '') ? '<span class="sq_rank_custom_meta sq_rank_customdescription sq_rank_sprite" title="' . __('Custom description: ', _SQ_PLUGIN_NAME_) . ' ' . addslashes($description) . '"></span>' : '') . ' ' . (($title <> '') ? '<span class="sq_rank_custom_meta sq_rank_customtitle sq_rank_sprite" title="' . __('Custom title: ', _SQ_PLUGIN_NAME_) . ' ' . $title . '"></span>' : '') . '\');
|
140 |
</script>';
|
141 |
}
|
142 |
}
|
136 |
$description = SQ_Tools::$options['sq_fp_description'];
|
137 |
}
|
138 |
echo '<script type="text/javascript">
|
139 |
+
jQuery(\'#post-' . $post_id . '\').find(\'.row-title\').before(\'' . (($description <> '') ? '<span class="sq_rank_custom_meta sq_rank_customdescription sq_rank_sprite" title="' . __('Custom description: ', _SQ_PLUGIN_NAME_) . ' ' . addslashes($description) . '"></span>' : '') . ' ' . (($title <> '') ? '<span class="sq_rank_custom_meta sq_rank_customtitle sq_rank_sprite" title="' . __('Custom title: ', _SQ_PLUGIN_NAME_) . ' ' . addslashes($title) . '"></span>' : '') . '\');
|
140 |
</script>';
|
141 |
}
|
142 |
}
|
controllers/SQ_Sitemaps.php
CHANGED
@@ -13,19 +13,21 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
13 |
|
14 |
public function __construct() {
|
15 |
parent::__construct();
|
16 |
-
add_filter('template_redirect', array($this, 'hookPreventRedirect'), 1
|
17 |
add_filter('user_trailingslashit', array($this, 'untrailingslashit'));
|
18 |
add_action('sq_processPing', array($this, 'processCron'));
|
19 |
}
|
20 |
|
21 |
public function hookPreventRedirect() {
|
22 |
-
global $wp_query;
|
23 |
if (!empty($wp_query->query_vars["sq_feed"])) {
|
24 |
$wp_query->is_404 = false;
|
25 |
$wp_query->is_feed = true;
|
|
|
|
|
26 |
$this->feedRequest($wp_query->query_vars);
|
27 |
$this->showSitemap();
|
28 |
-
|
29 |
}
|
30 |
}
|
31 |
|
@@ -44,6 +46,7 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
44 |
*/
|
45 |
public function feedRequest($request) {
|
46 |
global $wp_query;
|
|
|
47 |
|
48 |
if (!empty($request['feed'])) {
|
49 |
$request['sq_feed'] = $request['feed'];
|
@@ -53,6 +56,13 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
53 |
@ini_set('memory_limit', '512M');
|
54 |
|
55 |
$this->model->type = $request['sq_feed'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
//show products
|
58 |
if ($this->model->type == 'sitemap-product') {
|
@@ -71,27 +81,47 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
71 |
if ($this->model->type == 'sitemap-news') {
|
72 |
$this->posts_limit = $this->news_limit;
|
73 |
}
|
|
|
|
|
74 |
case 'sitemap-category':
|
75 |
case 'sitemap-post_tag':
|
76 |
case 'sitemap-custom-tax':
|
77 |
remove_all_filters('terms_clauses'); //prevent language filters
|
78 |
add_filter('get_terms_fields', array($this, 'customTaxFilter'), 5, 2);
|
79 |
-
|
80 |
-
break;
|
81 |
-
case 'sitemap-post':
|
82 |
-
add_action('parse_query', array($this, 'postFilter'), 99);
|
83 |
break;
|
84 |
case 'sitemap-page':
|
85 |
-
|
86 |
break;
|
87 |
case 'sitemap-author':
|
88 |
add_filter('sq-sitemap-authors', array($this, 'authorFilter'), 5);
|
89 |
break;
|
90 |
case 'sitemap-custom-post':
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
break;
|
93 |
case 'sitemap-product':
|
94 |
-
|
|
|
|
|
|
|
95 |
break;
|
96 |
case 'sitemap-archive':
|
97 |
add_filter('sq-sitemap-archive', array($this, 'archiveFilter'), 5);
|
@@ -102,6 +132,9 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
102 |
}
|
103 |
}
|
104 |
|
|
|
|
|
|
|
105 |
return $request;
|
106 |
}
|
107 |
|
@@ -136,8 +169,8 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
136 |
switch ($this->model->type) {
|
137 |
case 'sitemap':
|
138 |
echo '<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
|
139 |
-
|
140 |
-
|
141 |
foreach ($include as $value) {
|
142 |
echo ' ' . $schema[$value] . "\n";
|
143 |
}
|
@@ -148,8 +181,8 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
148 |
$include = array_unique($include);
|
149 |
default:
|
150 |
echo '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
|
151 |
-
|
152 |
-
|
153 |
if (!empty($include))
|
154 |
foreach ($include as $value) {
|
155 |
echo " " . $schema[$value] . " ";
|
@@ -267,7 +300,7 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
267 |
}
|
268 |
}
|
269 |
}
|
270 |
-
$cnt
|
271 |
}
|
272 |
}
|
273 |
return $str;
|
@@ -436,6 +469,7 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
436 |
}
|
437 |
|
438 |
public function productFilter(&$query) {
|
|
|
439 |
if (!$types = SQ_ObjController::getModel('SQ_BlockSettingsSeo')->isEcommerce()) {
|
440 |
$types = array('custom-post');
|
441 |
}
|
13 |
|
14 |
public function __construct() {
|
15 |
parent::__construct();
|
16 |
+
add_filter('template_redirect', array($this, 'hookPreventRedirect'), 1);
|
17 |
add_filter('user_trailingslashit', array($this, 'untrailingslashit'));
|
18 |
add_action('sq_processPing', array($this, 'processCron'));
|
19 |
}
|
20 |
|
21 |
public function hookPreventRedirect() {
|
22 |
+
global $wp_query, $sq_is_sitemap;
|
23 |
if (!empty($wp_query->query_vars["sq_feed"])) {
|
24 |
$wp_query->is_404 = false;
|
25 |
$wp_query->is_feed = true;
|
26 |
+
$sq_is_sitemap = true;
|
27 |
+
|
28 |
$this->feedRequest($wp_query->query_vars);
|
29 |
$this->showSitemap();
|
30 |
+
die();
|
31 |
}
|
32 |
}
|
33 |
|
46 |
*/
|
47 |
public function feedRequest($request) {
|
48 |
global $wp_query;
|
49 |
+
$query = array();
|
50 |
|
51 |
if (!empty($request['feed'])) {
|
52 |
$request['sq_feed'] = $request['feed'];
|
56 |
@ini_set('memory_limit', '512M');
|
57 |
|
58 |
$this->model->type = $request['sq_feed'];
|
59 |
+
//init the query
|
60 |
+
$query = array(
|
61 |
+
'sq_feed' => $this->model->type,
|
62 |
+
'post_type' => array('post'),
|
63 |
+
'tax_query' => array(),
|
64 |
+
'post_status' => 'publish',
|
65 |
+
);
|
66 |
|
67 |
//show products
|
68 |
if ($this->model->type == 'sitemap-product') {
|
81 |
if ($this->model->type == 'sitemap-news') {
|
82 |
$this->posts_limit = $this->news_limit;
|
83 |
}
|
84 |
+
case 'sitemap-post':
|
85 |
+
break;
|
86 |
case 'sitemap-category':
|
87 |
case 'sitemap-post_tag':
|
88 |
case 'sitemap-custom-tax':
|
89 |
remove_all_filters('terms_clauses'); //prevent language filters
|
90 |
add_filter('get_terms_fields', array($this, 'customTaxFilter'), 5, 2);
|
|
|
|
|
|
|
|
|
91 |
break;
|
92 |
case 'sitemap-page':
|
93 |
+
$query['post_type'] = array('page');
|
94 |
break;
|
95 |
case 'sitemap-author':
|
96 |
add_filter('sq-sitemap-authors', array($this, 'authorFilter'), 5);
|
97 |
break;
|
98 |
case 'sitemap-custom-post':
|
99 |
+
$types = get_post_types();
|
100 |
+
foreach (array('post', 'page', 'attachment', 'revision', 'nav_menu_item', 'product', 'wpsc-product') as $exclude) {
|
101 |
+
if (in_array($exclude, $types)) {
|
102 |
+
unset($types[$exclude]);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
foreach ($types as $type) {
|
107 |
+
$type_data = get_post_type_object($type);
|
108 |
+
if ((isset($type_data->rewrite['feeds']) && $type_data->rewrite['feeds'] == 1) || (isset($type_data->feeds) && $type_data->feeds == 1)) {
|
109 |
+
continue;
|
110 |
+
}
|
111 |
+
unset($types[$type]);
|
112 |
+
}
|
113 |
+
|
114 |
+
if (empty($types)) {
|
115 |
+
array_push($types, 'custom-post');
|
116 |
+
}
|
117 |
+
|
118 |
+
$query['post_type'] = $types;
|
119 |
break;
|
120 |
case 'sitemap-product':
|
121 |
+
if (!$types = SQ_ObjController::getModel('SQ_BlockSettingsSeo')->isEcommerce()) {
|
122 |
+
$types = array('custom-post');
|
123 |
+
}
|
124 |
+
$query['post_type'] = $types;
|
125 |
break;
|
126 |
case 'sitemap-archive':
|
127 |
add_filter('sq-sitemap-archive', array($this, 'archiveFilter'), 5);
|
132 |
}
|
133 |
}
|
134 |
|
135 |
+
if (method_exists($wp_query, 'parse_query')) {
|
136 |
+
$wp_query = new WP_Query($query);
|
137 |
+
}
|
138 |
return $request;
|
139 |
}
|
140 |
|
169 |
switch ($this->model->type) {
|
170 |
case 'sitemap':
|
171 |
echo '<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
|
172 |
+
. 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" '
|
173 |
+
. 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
|
174 |
foreach ($include as $value) {
|
175 |
echo ' ' . $schema[$value] . "\n";
|
176 |
}
|
181 |
$include = array_unique($include);
|
182 |
default:
|
183 |
echo '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
|
184 |
+
. 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" '
|
185 |
+
. 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
|
186 |
if (!empty($include))
|
187 |
foreach ($include as $value) {
|
188 |
echo " " . $schema[$value] . " ";
|
300 |
}
|
301 |
}
|
302 |
}
|
303 |
+
$cnt++;
|
304 |
}
|
305 |
}
|
306 |
return $str;
|
469 |
}
|
470 |
|
471 |
public function productFilter(&$query) {
|
472 |
+
|
473 |
if (!$types = SQ_ObjController::getModel('SQ_BlockSettingsSeo')->isEcommerce()) {
|
474 |
$types = array('custom-post');
|
475 |
}
|
core/SQ_BlockAudit/SQ_BlockAudit.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Audit Page
|
5 |
+
*/
|
6 |
+
class SQ_BlockAudit extends SQ_BlockController {
|
7 |
+
public $blog;
|
8 |
+
|
9 |
+
function hookGetContent() {
|
10 |
+
$blogs = json_decode(SQ_Action::apiCall('sq/audit/blog-list'));
|
11 |
+
if (!empty($blogs)) {
|
12 |
+
foreach ($blogs as $blog) {
|
13 |
+
if (get_bloginfo('url') == $blog->domain){
|
14 |
+
$this->blog = $blog;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
}
|
18 |
+
}
|
19 |
+
}
|
core/SQ_BlockCopyright/SQ_BlockCopyright.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Live Assistant settings
|
5 |
+
*/
|
6 |
+
class SQ_BlockCopyright extends SQ_BlockController {
|
7 |
+
|
8 |
+
function hookGetContent() {
|
9 |
+
parent::preloadSettings();
|
10 |
+
}
|
11 |
+
}
|
core/SQ_BlockCustomerService/SQ_BlockCustomerService.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Customer Service Page
|
5 |
+
*/
|
6 |
+
class SQ_BlockCustomerService extends SQ_BlockController {
|
7 |
+
|
8 |
+
function hookGetContent() {
|
9 |
+
SQ_ObjController::getController('SQ_DisplayController', false)->loadMedia('sq_blocksupport');
|
10 |
+
}
|
11 |
+
}
|
core/SQ_BlockKeywordResearch/SQ_BlockKeywordResearch.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Keyword Research settings
|
5 |
+
*/
|
6 |
+
class SQ_BlockKeywordResearch extends SQ_BlockController {
|
7 |
+
|
8 |
+
function hookGetContent() {
|
9 |
+
parent::preloadSettings();
|
10 |
+
}
|
11 |
+
}
|
core/SQ_BlockLiveAssistant/SQ_BlockLiveAssistant.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Live Assistant settings
|
5 |
+
*/
|
6 |
+
class SQ_BlockLiveAssistant extends SQ_BlockController {
|
7 |
+
|
8 |
+
function hookGetContent() {
|
9 |
+
parent::preloadSettings();
|
10 |
+
}
|
11 |
+
}
|
core/SQ_Blockresearch/SQ_Blockresearch.php
CHANGED
@@ -11,7 +11,6 @@ class SQ_Blockresearch extends SQ_BlockController {
|
|
11 |
|
12 |
echo '<script type="text/javascript">
|
13 |
var __infotext = ["' . __('Recent discussions:', _SQ_PLUGIN_NAME_) . '", "' . __('Exact search:', _SQ_PLUGIN_NAME_) . '", "' . __('Competition:', _SQ_PLUGIN_NAME_) . '", "' . __('Trend:', _SQ_PLUGIN_NAME_) . '"];
|
14 |
-
|
15 |
</script>';
|
16 |
}
|
17 |
|
11 |
|
12 |
echo '<script type="text/javascript">
|
13 |
var __infotext = ["' . __('Recent discussions:', _SQ_PLUGIN_NAME_) . '", "' . __('Exact search:', _SQ_PLUGIN_NAME_) . '", "' . __('Competition:', _SQ_PLUGIN_NAME_) . '", "' . __('Trend:', _SQ_PLUGIN_NAME_) . '"];
|
|
|
14 |
</script>';
|
15 |
}
|
16 |
|
core/SQ_Blocksearch/SQ_Blocksearch.php
CHANGED
@@ -36,9 +36,6 @@ class SQ_Blocksearch extends SQ_BlockController {
|
|
36 |
|
37 |
public function hookHead() {
|
38 |
parent::hookHead();
|
39 |
-
echo '<script type="text/javascript">
|
40 |
-
var __date = "' . __('date', _SQ_PLUGIN_NAME_) . '"; var __readit = "' . __('Read it!', _SQ_PLUGIN_NAME_) . '"; var __insertit = "' . __('Insert it!', _SQ_PLUGIN_NAME_) . '"; var __reference = "' . __('Reference', _SQ_PLUGIN_NAME_) . '"; var __insertasbox = "' . __('Insert as box', _SQ_PLUGIN_NAME_) . '"; var __notrelevant = "' . __('Not relevant?', _SQ_PLUGIN_NAME_) . '"; var __insertparagraph = "' . __('Insert in your article', _SQ_PLUGIN_NAME_) . '"; var __tinymceerror = "' . __('For Squirrly to work, you have to have tinymce editor installed!', _SQ_PLUGIN_NAME_) . '"; var __ajaxerror = "' . __(':( I lost my squirrel. Please reload the page.', _SQ_PLUGIN_NAME_) . '"; var __nofound = "' . __('No results found!', _SQ_PLUGIN_NAME_) . '"; var __tinymceinactive = "' . __('Switch to Visual editor!', _SQ_PLUGIN_NAME_) . '"; var __morewords = "' . __('Enter one more word to find relevant results', _SQ_PLUGIN_NAME_) . '"; var __toolong = "' . __('Takes too long to check this keyword ...', _SQ_PLUGIN_NAME_) . '"; var __doresearch = "' . __('Do a research!', _SQ_PLUGIN_NAME_) . '"; var __morekeywords = "' . __('Do more research!', _SQ_PLUGIN_NAME_) . '"; var __sq_photo_copyright = "' . __('[ ATTRIBUTE: Please check: %s to find out how to attribute this image ]', _SQ_PLUGIN_NAME_) . '"; var __has_attributes = "' . __('Has creative commons attributes', _SQ_PLUGIN_NAME_) . '"; var __no_attributes = "' . __('No known copyright restrictions', _SQ_PLUGIN_NAME_) . '";
|
41 |
-
</script>';
|
42 |
}
|
43 |
|
44 |
}
|
36 |
|
37 |
public function hookHead() {
|
38 |
parent::hookHead();
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
}
|
core/SQ_Loading/SQ_Loading.php
CHANGED
@@ -3,16 +3,16 @@
|
|
3 |
class SQ_Loading extends SQ_BlockController {
|
4 |
|
5 |
public function hookHead() {
|
6 |
-
global $sq_postID;
|
7 |
-
|
8 |
parent::hookHead();
|
9 |
-
$
|
10 |
-
|
11 |
-
|
12 |
|
|
|
|
|
13 |
|
14 |
/* Check the squirrly.js file if exists */
|
15 |
$browser = SQ_Tools::getBrowserInfo();
|
|
|
16 |
|
17 |
if ((isset($browser) && $browser != false && is_array($browser) && $browser['name'] == 'IE' && (int) $browser['version'] < 9 && (int) $browser['version'] > 0)) {
|
18 |
echo '<script type="text/javascript">
|
@@ -23,7 +23,9 @@ class SQ_Loading extends SQ_BlockController {
|
|
23 |
jQuery("#sq_blocklogin").hide();
|
24 |
</script>';
|
25 |
} else {
|
26 |
-
|
|
|
|
|
27 |
echo '<script type="text/javascript">
|
28 |
var sq_use = "' . SQ_Tools::$options['sq_use'] . '";
|
29 |
var sq_baseurl = "' . _SQ_STATIC_API_URL_ . '";
|
@@ -36,6 +38,25 @@ class SQ_Loading extends SQ_BlockController {
|
|
36 |
var __noopt = "' . __('You haven`t used Squirrly SEO to optimize your article. Do you want to optimize for a keyword before publishing?', _SQ_PLUGIN_NAME_) . '";
|
37 |
var sq_keywordtag = "' . SQ_Tools::$options['sq_keywordtag'] . '";
|
38 |
var sq_frontend_css = "' . _SQ_THEME_URL_ . 'css/sq_frontend.css";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
' . (($keyword <> '') ? 'var sq_keyword_from_post = "' . $keyword . '";' : '') . '
|
40 |
if (typeof sq_script === "undefined"){
|
41 |
var sq_script = document.createElement(\'script\');
|
3 |
class SQ_Loading extends SQ_BlockController {
|
4 |
|
5 |
public function hookHead() {
|
|
|
|
|
6 |
parent::hookHead();
|
7 |
+
$this->loadJsVars();
|
8 |
+
}
|
|
|
9 |
|
10 |
+
public function loadJsVars(){
|
11 |
+
global $sq_postID;
|
12 |
|
13 |
/* Check the squirrly.js file if exists */
|
14 |
$browser = SQ_Tools::getBrowserInfo();
|
15 |
+
$keyword = '';
|
16 |
|
17 |
if ((isset($browser) && $browser != false && is_array($browser) && $browser['name'] == 'IE' && (int) $browser['version'] < 9 && (int) $browser['version'] > 0)) {
|
18 |
echo '<script type="text/javascript">
|
23 |
jQuery("#sq_blocklogin").hide();
|
24 |
</script>';
|
25 |
} else {
|
26 |
+
if (isset($sq_postID)) {
|
27 |
+
$keyword = SQ_ObjController::getModel('SQ_Post')->getKeywordsFromPost($sq_postID);
|
28 |
+
}
|
29 |
echo '<script type="text/javascript">
|
30 |
var sq_use = "' . SQ_Tools::$options['sq_use'] . '";
|
31 |
var sq_baseurl = "' . _SQ_STATIC_API_URL_ . '";
|
38 |
var __noopt = "' . __('You haven`t used Squirrly SEO to optimize your article. Do you want to optimize for a keyword before publishing?', _SQ_PLUGIN_NAME_) . '";
|
39 |
var sq_keywordtag = "' . SQ_Tools::$options['sq_keywordtag'] . '";
|
40 |
var sq_frontend_css = "' . _SQ_THEME_URL_ . 'css/sq_frontend.css";
|
41 |
+
var __date = "' . __('date', _SQ_PLUGIN_NAME_) . '";
|
42 |
+
var __readit = "' . __('Read it!', _SQ_PLUGIN_NAME_) . '";
|
43 |
+
var __insertit = "' . __('Insert it!', _SQ_PLUGIN_NAME_) . '";
|
44 |
+
var __reference = "' . __('Reference', _SQ_PLUGIN_NAME_) . '";
|
45 |
+
var __insertasbox = "' . __('Insert as box', _SQ_PLUGIN_NAME_) . '";
|
46 |
+
var __notrelevant = "' . __('Not relevant?', _SQ_PLUGIN_NAME_) . '";
|
47 |
+
var __insertparagraph = "' . __('Insert in your article', _SQ_PLUGIN_NAME_) . '";
|
48 |
+
var __tinymceerror = "' . __('For Squirrly to work, you have to have tinymce editor installed!', _SQ_PLUGIN_NAME_) . '";
|
49 |
+
var __ajaxerror = "' . __(':( I lost my squirrel. Please reload the page.', _SQ_PLUGIN_NAME_) . '";
|
50 |
+
var __nofound = "' . __('No results found!', _SQ_PLUGIN_NAME_) . '";
|
51 |
+
var __tinymceinactive = "' . __('Switch to Visual editor!', _SQ_PLUGIN_NAME_) . '";
|
52 |
+
var __morewords = "' . __('Enter one more word to find relevant results', _SQ_PLUGIN_NAME_) . '";
|
53 |
+
var __toolong = "' . __('Takes too long to check this keyword ...', _SQ_PLUGIN_NAME_) . '";
|
54 |
+
var __doresearch = "' . __('Do a research!', _SQ_PLUGIN_NAME_) . '";
|
55 |
+
var __morekeywords = "' . __('Do more research!', _SQ_PLUGIN_NAME_) . '";
|
56 |
+
var __sq_photo_copyright = "' . __('[ ATTRIBUTE: Please check: %s to find out how to attribute this image ]', _SQ_PLUGIN_NAME_) . '";
|
57 |
+
var __has_attributes = "' . __('Has creative commons attributes', _SQ_PLUGIN_NAME_) . '";
|
58 |
+
var __no_attributes = "' . __('No known copyright restrictions', _SQ_PLUGIN_NAME_) . '";
|
59 |
+
|
60 |
' . (($keyword <> '') ? 'var sq_keyword_from_post = "' . $keyword . '";' : '') . '
|
61 |
if (typeof sq_script === "undefined"){
|
62 |
var sq_script = document.createElement(\'script\');
|
models/SQ_BlockPostsAnalytics.php
CHANGED
@@ -1,21 +1,18 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
4 |
-
{
|
5 |
|
6 |
public $_column_headers;
|
7 |
public $posts; //save post list for Squirrly call
|
8 |
private $order_posts;
|
9 |
|
10 |
-
function __construct()
|
11 |
-
{
|
12 |
parent::__construct();
|
13 |
$this->posts = array();
|
14 |
$this->order_posts = array();
|
15 |
}
|
16 |
|
17 |
-
function wp_edit_posts_query($q = false)
|
18 |
-
{
|
19 |
global $current_user;
|
20 |
$post__in = array(0);
|
21 |
if (false === $q)
|
@@ -146,8 +143,7 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
146 |
return $avail_post_stati;
|
147 |
}
|
148 |
|
149 |
-
function order_by_type($query)
|
150 |
-
{
|
151 |
global $wpdb;
|
152 |
if (strpos($query, 'ORDER BY') !== false) {
|
153 |
$query = str_replace("ORDER BY {$wpdb->posts}.post_date", "ORDER BY {$wpdb->posts}.post_type", $query);
|
@@ -157,8 +153,7 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
157 |
return $query;
|
158 |
}
|
159 |
|
160 |
-
function order_by_rank($query)
|
161 |
-
{
|
162 |
global $wpdb;
|
163 |
if (!empty($this->order_posts)) {
|
164 |
if (strpos($query, 'ORDER BY') !== false) {
|
@@ -171,8 +166,7 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
171 |
return $query;
|
172 |
}
|
173 |
|
174 |
-
function prepare_items()
|
175 |
-
{
|
176 |
global $avail_post_stati, $wp_query, $per_page, $mode;
|
177 |
|
178 |
$avail_post_stati = $this->wp_edit_posts_query();
|
@@ -193,8 +187,7 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
193 |
));
|
194 |
}
|
195 |
|
196 |
-
function get_column_info()
|
197 |
-
{
|
198 |
if (isset($this->_column_headers))
|
199 |
return $this->_column_headers;
|
200 |
|
@@ -218,14 +211,13 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
218 |
return $this->_column_headers;
|
219 |
}
|
220 |
|
221 |
-
function get_sortable_columns()
|
222 |
-
{
|
223 |
$columns = array(
|
224 |
'title' => 'title',
|
225 |
'type' => 'type',
|
226 |
'author' => 'author',
|
227 |
);
|
228 |
-
if(SQ_Tools::$options['sq_google_ranksperhour'] > 0){
|
229 |
$columns['rank'] = 'rank';
|
230 |
}
|
231 |
|
@@ -234,8 +226,7 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
234 |
return $columns;
|
235 |
}
|
236 |
|
237 |
-
function print_column_headers($with_id = true)
|
238 |
-
{
|
239 |
$strcolumn = '';
|
240 |
|
241 |
list($columns, $sortable) = $this->get_column_info();
|
@@ -290,8 +281,7 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
290 |
return $strcolumn;
|
291 |
}
|
292 |
|
293 |
-
function get_columns()
|
294 |
-
{
|
295 |
$post_type = 'post';
|
296 |
|
297 |
$posts_columns = array();
|
@@ -307,21 +297,14 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
307 |
if (empty($post_type) || is_object_in_taxonomy($post_type, 'post_tag'))
|
308 |
$posts_columns['keywords'] = __('Keywords');
|
309 |
|
310 |
-
|
311 |
-
|
312 |
-
if (isset($blog_ip)) {
|
313 |
-
if (strpos($blog_ip, '192.') === false) {
|
314 |
-
$posts_columns['rank'] = sprintf(__('Google.%s Position'), SQ_Tools::$options['sq_google_country']);
|
315 |
-
}
|
316 |
-
}
|
317 |
-
}
|
318 |
$posts_columns['traffic'] = '';
|
319 |
$posts_columns['date'] = __('Date');
|
320 |
return $posts_columns;
|
321 |
}
|
322 |
|
323 |
-
function display_tablenav($which)
|
324 |
-
{
|
325 |
if ('top' == $which)
|
326 |
wp_nonce_field('bulk-' . $this->_args['plural']);
|
327 |
|
@@ -360,8 +343,7 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
360 |
return $strnav;
|
361 |
}
|
362 |
|
363 |
-
function display_rows()
|
364 |
-
{
|
365 |
global $wp_query, $post;
|
366 |
static $alternate;
|
367 |
$strrow = '';
|
@@ -382,8 +364,7 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
382 |
return $strrow;
|
383 |
}
|
384 |
|
385 |
-
public function single_row($a_post)
|
386 |
-
{
|
387 |
global $post;
|
388 |
|
389 |
$strcolumn = '';
|
@@ -444,21 +425,25 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
444 |
|
445 |
case 'rank':
|
446 |
$value = '';
|
447 |
-
if
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
}
|
457 |
-
|
458 |
-
|
459 |
-
$value = sprintf('<a id="sq_rank_value' . $post->ID . '" href="%s" style="display:block; width: 120px; margin: 0 auto; text-align:right;">%s</a><span class="sq_rank_column_button_recheck sq_rank_column_button" onclick="sq_recheckRank(' . $post->ID . ')">%s</span>', esc_url(add_query_arg(array('page' => 'sq_posts', 'rank' => false), 'admin.php')), __('Not yet verified'), __('Check now', _SQ_PLUGIN_NAME_));
|
460 |
}
|
461 |
-
|
462 |
break;
|
463 |
case 'traffic':
|
464 |
$value = '<div class="sq_rank_column_row sq_minloading" ref="' . $post->ID . '"></div>';
|
@@ -512,14 +497,12 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
|
|
512 |
return $strcolumn;
|
513 |
}
|
514 |
|
515 |
-
public function hookFooter()
|
516 |
-
{
|
517 |
$this->postlist->setPosts($this->posts);
|
518 |
$this->postlist->hookFooter();
|
519 |
}
|
520 |
|
521 |
-
public function getScripts()
|
522 |
-
{
|
523 |
return $this->postlist->getScripts();
|
524 |
}
|
525 |
|
1 |
<?php
|
2 |
|
3 |
+
class Model_SQ_BlockPostsAnalytics extends WP_List_Table {
|
|
|
4 |
|
5 |
public $_column_headers;
|
6 |
public $posts; //save post list for Squirrly call
|
7 |
private $order_posts;
|
8 |
|
9 |
+
function __construct() {
|
|
|
10 |
parent::__construct();
|
11 |
$this->posts = array();
|
12 |
$this->order_posts = array();
|
13 |
}
|
14 |
|
15 |
+
function wp_edit_posts_query($q = false) {
|
|
|
16 |
global $current_user;
|
17 |
$post__in = array(0);
|
18 |
if (false === $q)
|
143 |
return $avail_post_stati;
|
144 |
}
|
145 |
|
146 |
+
function order_by_type($query) {
|
|
|
147 |
global $wpdb;
|
148 |
if (strpos($query, 'ORDER BY') !== false) {
|
149 |
$query = str_replace("ORDER BY {$wpdb->posts}.post_date", "ORDER BY {$wpdb->posts}.post_type", $query);
|
153 |
return $query;
|
154 |
}
|
155 |
|
156 |
+
function order_by_rank($query) {
|
|
|
157 |
global $wpdb;
|
158 |
if (!empty($this->order_posts)) {
|
159 |
if (strpos($query, 'ORDER BY') !== false) {
|
166 |
return $query;
|
167 |
}
|
168 |
|
169 |
+
function prepare_items() {
|
|
|
170 |
global $avail_post_stati, $wp_query, $per_page, $mode;
|
171 |
|
172 |
$avail_post_stati = $this->wp_edit_posts_query();
|
187 |
));
|
188 |
}
|
189 |
|
190 |
+
function get_column_info() {
|
|
|
191 |
if (isset($this->_column_headers))
|
192 |
return $this->_column_headers;
|
193 |
|
211 |
return $this->_column_headers;
|
212 |
}
|
213 |
|
214 |
+
function get_sortable_columns() {
|
|
|
215 |
$columns = array(
|
216 |
'title' => 'title',
|
217 |
'type' => 'type',
|
218 |
'author' => 'author',
|
219 |
);
|
220 |
+
if (SQ_Tools::$options['sq_google_ranksperhour'] > 0) {
|
221 |
$columns['rank'] = 'rank';
|
222 |
}
|
223 |
|
226 |
return $columns;
|
227 |
}
|
228 |
|
229 |
+
function print_column_headers($with_id = true) {
|
|
|
230 |
$strcolumn = '';
|
231 |
|
232 |
list($columns, $sortable) = $this->get_column_info();
|
281 |
return $strcolumn;
|
282 |
}
|
283 |
|
284 |
+
function get_columns() {
|
|
|
285 |
$post_type = 'post';
|
286 |
|
287 |
$posts_columns = array();
|
297 |
if (empty($post_type) || is_object_in_taxonomy($post_type, 'post_tag'))
|
298 |
$posts_columns['keywords'] = __('Keywords');
|
299 |
|
300 |
+
$posts_columns['rank'] = sprintf(__('Google.%s Position'), SQ_Tools::$options['sq_google_country']);
|
301 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
$posts_columns['traffic'] = '';
|
303 |
$posts_columns['date'] = __('Date');
|
304 |
return $posts_columns;
|
305 |
}
|
306 |
|
307 |
+
function display_tablenav($which) {
|
|
|
308 |
if ('top' == $which)
|
309 |
wp_nonce_field('bulk-' . $this->_args['plural']);
|
310 |
|
343 |
return $strnav;
|
344 |
}
|
345 |
|
346 |
+
function display_rows() {
|
|
|
347 |
global $wp_query, $post;
|
348 |
static $alternate;
|
349 |
$strrow = '';
|
364 |
return $strrow;
|
365 |
}
|
366 |
|
367 |
+
public function single_row($a_post) {
|
|
|
368 |
global $post;
|
369 |
|
370 |
$strcolumn = '';
|
425 |
|
426 |
case 'rank':
|
427 |
$value = '';
|
428 |
+
if(SQ_Tools::$options['sq_google_ranksperhour'] > 0) {
|
429 |
+
|
430 |
+
if (isset($json->rank)) {
|
431 |
+
if ($json->rank == -2) {
|
432 |
+
$value = __('Could not receive data from google (Err: blocked IP)');
|
433 |
+
} elseif ($json->rank == -1) {
|
434 |
+
$value = __('Not in top 100 for: <br /> "' . $json->keyword . '"');
|
435 |
+
} elseif ($json->rank == 0) {
|
436 |
+
$value = __('The URL is indexed');
|
437 |
+
} elseif ($json->rank > 0) {
|
438 |
+
$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 . ')' : '');
|
439 |
+
}
|
440 |
+
$value = sprintf('<a id="sq_rank_value' . $post->ID . '" href="%s" style="display:block; width: 120px; margin: 0 auto; text-align:right;">%s</a><span class="sq_rank_column_button_recheck sq_rank_column_button" onclick="sq_recheckRank(' . $post->ID . ')">%s</span>', esc_url(add_query_arg(array('page' => 'sq_posts', 'rank' => $json->rank), 'admin.php')), $value, __('Force recheck', _SQ_PLUGIN_NAME_));
|
441 |
+
} else {
|
442 |
+
$value = sprintf('<a id="sq_rank_value' . $post->ID . '" href="%s" style="display:block; width: 120px; margin: 0 auto; text-align:right;">%s</a><span class="sq_rank_column_button_recheck sq_rank_column_button" onclick="sq_recheckRank(' . $post->ID . ')">%s</span>', esc_url(add_query_arg(array('page' => 'sq_posts', 'rank' => false), 'admin.php')), __('Not yet verified'), __('Check now', _SQ_PLUGIN_NAME_));
|
443 |
}
|
444 |
+
}else{
|
445 |
+
$value = sprintf(__('Enable Ranking in %sAdvanced Settings%s'),'<br /><a href="'.admin_url('admin.php?page=sq_settings').'">','</a>');
|
|
|
446 |
}
|
|
|
447 |
break;
|
448 |
case 'traffic':
|
449 |
$value = '<div class="sq_rank_column_row sq_minloading" ref="' . $post->ID . '"></div>';
|
497 |
return $strcolumn;
|
498 |
}
|
499 |
|
500 |
+
public function hookFooter() {
|
|
|
501 |
$this->postlist->setPosts($this->posts);
|
502 |
$this->postlist->hookFooter();
|
503 |
}
|
504 |
|
505 |
+
public function getScripts() {
|
|
|
506 |
return $this->postlist->getScripts();
|
507 |
}
|
508 |
|
models/SQ_BlockSettingsSeo.php
CHANGED
@@ -89,6 +89,7 @@ class Model_SQ_BlockSettingsSeo {
|
|
89 |
public function checkFavebookInsightsCode($code) {
|
90 |
$id = '';
|
91 |
if ($code <> '') {
|
|
|
92 |
if (strpos($code, '"') !== false) {
|
93 |
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
94 |
if (isset($result[1]) && !empty($result[1])) {
|
89 |
public function checkFavebookInsightsCode($code) {
|
90 |
$id = '';
|
91 |
if ($code <> '') {
|
92 |
+
$code = trim($code);
|
93 |
if (strpos($code, '"') !== false) {
|
94 |
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
95 |
if (isset($result[1]) && !empty($result[1])) {
|
models/SQ_Frontend.php
CHANGED
@@ -10,7 +10,7 @@ class Model_SQ_Frontend {
|
|
10 |
private $post_type;
|
11 |
private $post_types;
|
12 |
|
13 |
-
/** @var
|
14 |
private $url;
|
15 |
private $author;
|
16 |
|
@@ -29,10 +29,10 @@ class Model_SQ_Frontend {
|
|
29 |
private $custom_og_image = false;
|
30 |
|
31 |
/** @var integer */
|
32 |
-
private $min_title_length =
|
33 |
|
34 |
/** @var integer */
|
35 |
-
private $max_title_length =
|
36 |
|
37 |
/** @var integer */
|
38 |
private $max_description_length = 170;
|
@@ -60,18 +60,6 @@ class Model_SQ_Frontend {
|
|
60 |
return "\n\n<!-- Squirrly SEO Plugin " . SQ_VERSION . ", visit: http://plugin.squirrly.co/ -->\n";
|
61 |
}
|
62 |
|
63 |
-
/**
|
64 |
-
* Set the line where Squirrly will start the code
|
65 |
-
* @return string
|
66 |
-
*/
|
67 |
-
public function setStartTag() {
|
68 |
-
$this->setPost();
|
69 |
-
if ($this->is_squirrly()) {
|
70 |
-
SQ_Tools::dump('Show Squirrly', 'isHomePage: ' . $this->isHomePage(), 'is_single: ' . is_single(), 'is_preview: ' . is_preview(), 'is_page: ' . is_page(), 'is_archive: ' . is_archive(), 'is_author: ' . is_author(), 'is_category: ' . is_category(), 'is_tag: ' . is_tag(), 'is_search: ' . is_search(), 'in_array: ' . (!empty($this->post_types) && in_array($this->post_type, $this->post_types)));
|
71 |
-
return "<squirrly />";
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
/**
|
76 |
* Set the post
|
77 |
*
|
@@ -129,7 +117,7 @@ class Model_SQ_Frontend {
|
|
129 |
|
130 |
/**
|
131 |
* Start the buffer record
|
132 |
-
* @return
|
133 |
*/
|
134 |
public function startBuffer() {
|
135 |
ob_start(array($this, 'getBuffer'));
|
@@ -138,8 +126,8 @@ class Model_SQ_Frontend {
|
|
138 |
/**
|
139 |
* Get the loaded buffer and change it
|
140 |
*
|
141 |
-
* @param
|
142 |
-
* @return
|
143 |
*/
|
144 |
public function getBuffer($buffer) {
|
145 |
if (isset($this->buffer)) {
|
@@ -167,30 +155,9 @@ class Model_SQ_Frontend {
|
|
167 |
}
|
168 |
|
169 |
/**
|
170 |
-
*
|
171 |
-
*
|
172 |
-
* @return string
|
173 |
-
*
|
174 |
*/
|
175 |
-
public function flushHeader() {
|
176 |
-
try {
|
177 |
-
if (function_exists('ob_list_handlers')) {
|
178 |
-
$buffers = @ob_list_handlers();
|
179 |
-
|
180 |
-
if (sizeof($buffers) > 0) {
|
181 |
-
if (is_string($buffers[sizeof($buffers) - 1])) {
|
182 |
-
if (strtolower($buffers[sizeof($buffers) - 1]) == strtolower(get_class($this) . '::getBuffer')) {
|
183 |
-
@ob_end_flush();
|
184 |
-
$buffers = @ob_list_handlers();
|
185 |
-
}
|
186 |
-
}
|
187 |
-
}
|
188 |
-
}
|
189 |
-
} catch (Exception $ex) {
|
190 |
-
//error
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
public function is_squirrly() {
|
195 |
if (SQ_Tools::getValue('sq_use') == 'off') {
|
196 |
return false;
|
@@ -200,6 +167,10 @@ class Model_SQ_Frontend {
|
|
200 |
return false;
|
201 |
}
|
202 |
|
|
|
|
|
|
|
|
|
203 |
if ($this->isHomePage() || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search() || (!empty($this->post_types) && in_array($this->post_type, $this->post_types))) {
|
204 |
return true;
|
205 |
}
|
@@ -224,7 +195,6 @@ class Model_SQ_Frontend {
|
|
224 |
}
|
225 |
|
226 |
if ($this->is_squirrly()) {
|
227 |
-
|
228 |
//update ... please monitor
|
229 |
if (is_single() || is_page()) {
|
230 |
if (!isset($this->post->ID)) {
|
@@ -232,17 +202,23 @@ class Model_SQ_Frontend {
|
|
232 |
}
|
233 |
}
|
234 |
|
235 |
-
|
236 |
-
if (!empty($out)) {
|
237 |
$this->meta['blogname'] = get_bloginfo('name');
|
238 |
//Get the url
|
239 |
$this->url = $this->getCanonicalUrl();
|
240 |
//Get the title
|
241 |
$this->title = $this->getCustomTitle();
|
|
|
|
|
|
|
|
|
242 |
/* Get the thumb image from post */
|
243 |
$this->thumb_images = $this->getImagesFromContent();
|
244 |
|
245 |
-
if (
|
|
|
|
|
|
|
246 |
//clear the existing description and keywords
|
247 |
$buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](description|keywords)["\'][^>]*content=["\'][^"\'>]*["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
|
248 |
}
|
@@ -264,31 +240,20 @@ class Model_SQ_Frontend {
|
|
264 |
$buffer = @preg_replace('/<script[^>]*type=["\']application\/ld\+json["\'][^>]*>[^>]*<\/script>[\n\r]*/si', '', $buffer, -1);
|
265 |
}
|
266 |
|
267 |
-
|
268 |
-
if ((SQ_Tools::$options['sq_auto_title'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
|
269 |
-
if (isset($this->title) && $this->title <> '') {
|
270 |
-
//replace the existing title
|
271 |
-
$buffer = @preg_replace('/<title[^<>]*>([^<>]*)<\/title>/si', '', $buffer, -1);
|
272 |
-
$buffer = @preg_replace('/(<head[^>]*>)/si', sprintf("$1\n<title>%s</title>", $this->title) . "\n", $buffer, -1);
|
273 |
-
}
|
274 |
-
}
|
275 |
-
|
276 |
-
if (strpos($buffer, '<squirrly />') !== false) {
|
277 |
-
$buffer = @preg_replace('/(<squirrly[^>]*>)/si', sprintf("%s", $this->getHeader()) . "\n", $buffer, 1);
|
278 |
-
} elseif (strpos($buffer, '</title>') !== false) {
|
279 |
-
$buffer = @preg_replace('/(<\/title>)/si', sprintf("$1\n%s", $this->getHeader()) . "\n", $buffer, 1);
|
280 |
-
} else {
|
281 |
-
$buffer = @preg_replace('/(<head[^>]*>)/si', sprintf("$1\n%s", $this->getHeader()) . "\n", $buffer, 1);
|
282 |
-
}
|
283 |
|
284 |
return $buffer;
|
285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
}
|
287 |
}
|
288 |
|
289 |
-
|
290 |
-
$buffer = str_replace("<squirrly />", "", $buffer);
|
291 |
-
}
|
292 |
return $buffer;
|
293 |
}
|
294 |
|
@@ -301,8 +266,12 @@ class Model_SQ_Frontend {
|
|
301 |
*/
|
302 |
public function getHeader() {
|
303 |
$ret = '';
|
304 |
-
$ret .= $this->setStart();
|
305 |
|
|
|
|
|
|
|
|
|
|
|
306 |
//Add description in homepage if is set or add description in other pages if is not home page
|
307 |
if ((SQ_Tools::$options['sq_auto_description'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
|
308 |
$ret .= $this->getCustomDescription() . "\n";
|
@@ -417,6 +386,11 @@ class Model_SQ_Frontend {
|
|
417 |
$meta = "\n";
|
418 |
$image = '';
|
419 |
|
|
|
|
|
|
|
|
|
|
|
420 |
if (!isset($this->thumb_video) || $this->thumb_video == '') {
|
421 |
$videos = $this->getVideosFromContent();
|
422 |
if (isset($videos[0])) {
|
@@ -512,7 +486,9 @@ class Model_SQ_Frontend {
|
|
512 |
|
513 |
$meta .= sprintf('<meta property="og:type" content="%s" />', 'article') . "\n";
|
514 |
$meta .= sprintf('<meta property="article:published_time" content="%s" />', get_the_time('c', $this->post->ID)) . "\n";
|
515 |
-
|
|
|
|
|
516 |
$category = get_the_category($this->post->ID);
|
517 |
if (!empty($category) && $category[0]->cat_name <> 'Uncategorized') {
|
518 |
$meta .= sprintf('<meta property="article:section" content="%s" />', $category[0]->cat_name) . "\n";
|
@@ -643,10 +619,6 @@ class Model_SQ_Frontend {
|
|
643 |
}
|
644 |
}
|
645 |
|
646 |
-
//If title then clear it and truncate it
|
647 |
-
if ($this->title <> '') {
|
648 |
-
$this->title = $this->truncate($this->title, $this->min_title_length, $this->max_title_length);
|
649 |
-
}
|
650 |
} elseif (SQ_Tools::$options ['sq_auto_title'] == 1) { /* Check if is a predefined Title for home page */
|
651 |
|
652 |
//If the home page is a static page that has custom snippet
|
@@ -664,6 +636,8 @@ class Model_SQ_Frontend {
|
|
664 |
$this->title = get_the_title();
|
665 |
}
|
666 |
}
|
|
|
|
|
667 |
}
|
668 |
return apply_filters('sq_title', $this->title);
|
669 |
}
|
@@ -678,19 +652,20 @@ class Model_SQ_Frontend {
|
|
678 |
|
679 |
/**
|
680 |
* Get the image from content
|
681 |
-
* @global
|
682 |
* @param integer $id Post ID
|
683 |
-
* @return
|
684 |
*/
|
685 |
public function getImagesFromContent($id = null, $all = false) {
|
686 |
$images = array();
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
}
|
692 |
|
693 |
-
if
|
|
|
694 |
if (($this->isHomePage() && SQ_Tools::$options['sq_fp_ogimage'] <> '')) {
|
695 |
$images[] = array(
|
696 |
'src' => esc_url(SQ_Tools::$options['sq_fp_ogimage']),
|
@@ -909,20 +884,19 @@ class Model_SQ_Frontend {
|
|
909 |
}
|
910 |
}
|
911 |
}
|
912 |
-
}
|
913 |
-
|
914 |
/* Check if is a predefined TitleIn Snippet */
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
} else {
|
923 |
-
$description = $this->grabDescriptionFromPost();
|
924 |
-
}
|
925 |
}
|
|
|
|
|
|
|
926 |
|
927 |
$description = (($description <> '') ? $description : $this->title);
|
928 |
if ($description <> '') {
|
@@ -1400,98 +1374,125 @@ class Model_SQ_Frontend {
|
|
1400 |
public function getJsonLD() {
|
1401 |
$meta = '';
|
1402 |
$sep = ",\n";
|
|
|
|
|
1403 |
if ($this->isHomePage()) {
|
1404 |
if (isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']])) {
|
1405 |
-
$
|
1406 |
-
$
|
|
|
|
|
1407 |
foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']] as $key => $value) {
|
1408 |
if ($value <> '') {
|
1409 |
if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'contactType') {
|
1410 |
continue;
|
1411 |
}
|
1412 |
if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'telephone') {
|
1413 |
-
$
|
|
|
|
|
|
|
|
|
|
|
1414 |
}
|
1415 |
|
1416 |
if ($key == 'logo') {
|
1417 |
if (SQ_Tools::$options['sq_jsonld_type'] == 'Person') {
|
1418 |
$key = 'image';
|
1419 |
}
|
1420 |
-
$
|
|
|
|
|
|
|
1421 |
} else {
|
1422 |
-
$
|
1423 |
}
|
1424 |
-
|
1425 |
}
|
1426 |
}
|
1427 |
}
|
1428 |
-
|
1429 |
-
|
1430 |
-
$social = '';
|
1431 |
if (SQ_Tools::$options['sq_twitter_account'] <> '') {
|
1432 |
-
$
|
1433 |
}
|
1434 |
if (SQ_Tools::$options['sq_facebook_account'] <> '') {
|
1435 |
-
$
|
1436 |
}
|
1437 |
if (SQ_Tools::$options['sq_google_plus'] <> '') {
|
1438 |
-
$
|
1439 |
}
|
1440 |
if (SQ_Tools::$options['sq_linkedin_account'] <> '') {
|
1441 |
-
$
|
1442 |
}
|
1443 |
if (SQ_Tools::$options['sq_pinterest_account'] <> '') {
|
1444 |
-
$
|
1445 |
}
|
1446 |
if (SQ_Tools::$options['sq_instagram_account'] <> '') {
|
1447 |
-
$
|
1448 |
}
|
1449 |
|
1450 |
-
$
|
|
|
|
|
|
|
|
|
1451 |
|
1452 |
-
if ($
|
1453 |
-
$
|
1454 |
}
|
1455 |
-
|
1456 |
-
$meta = '{ "@context": "http://schema.org"' . $sep . $meta . $search . $social . '}';
|
1457 |
}
|
1458 |
-
|
1459 |
-
$
|
|
|
|
|
|
|
|
|
1460 |
if (isset($this->title)) {
|
1461 |
-
$
|
1462 |
}
|
1463 |
if (isset($this->description)) {
|
1464 |
-
$
|
1465 |
}
|
1466 |
-
$
|
1467 |
-
|
|
|
|
|
1468 |
|
1469 |
if (!empty($this->thumb_images)) {
|
1470 |
-
$
|
1471 |
}
|
1472 |
if (isset($this->post->post_date)) {
|
1473 |
-
$
|
1474 |
}
|
1475 |
if (isset($this->post->post_modified)) {
|
1476 |
-
$
|
1477 |
}
|
1478 |
if (!empty($this->thumb_images)) {
|
1479 |
foreach ($this->thumb_images as $image) {
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
}' . $sep;
|
1487 |
break;
|
1488 |
}
|
1489 |
}
|
1490 |
-
$
|
|
|
|
|
|
|
|
|
|
|
1491 |
if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']])) {
|
1492 |
-
|
1493 |
-
$
|
1494 |
-
|
|
|
|
|
|
|
|
|
1495 |
foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']] as $key => $value) {
|
1496 |
if ($value <> '') {
|
1497 |
if ($key == 'contactType' || $key == 'telephone') {
|
@@ -1499,31 +1500,32 @@ class Model_SQ_Frontend {
|
|
1499 |
}
|
1500 |
|
1501 |
if ($key == 'logo') {
|
1502 |
-
$
|
|
|
|
|
|
|
|
|
1503 |
} else {
|
1504 |
-
$
|
1505 |
}
|
1506 |
-
$meta .= ($meta <> '' ? $sep : '') . '"' . $key . '":' . $value . '';
|
1507 |
}
|
1508 |
}
|
1509 |
-
$meta .= '}' . $sep;
|
1510 |
}
|
1511 |
-
$
|
1512 |
|
1513 |
-
|
|
|
1514 |
} elseif (is_author()) {
|
1515 |
-
$
|
1516 |
-
$
|
1517 |
-
$
|
|
|
1518 |
|
1519 |
-
|
|
|
1520 |
}
|
1521 |
|
1522 |
-
|
1523 |
-
$meta = "\n" . '<script type="application/ld+json">' . "\n" . $meta . "\n" . '</script>';
|
1524 |
-
}
|
1525 |
-
|
1526 |
-
return apply_filters('sq_sjon_ld_meta', $meta);
|
1527 |
}
|
1528 |
|
1529 |
/**
|
@@ -1598,7 +1600,7 @@ class Model_SQ_Frontend {
|
|
1598 |
|
1599 |
if ($post) {
|
1600 |
if (!$this->isHomePage()) {
|
1601 |
-
$description = $this->
|
1602 |
if (!$description) {
|
1603 |
$description = $this->truncate(SQ_Tools::i18n($post->post_content), $this->min_description_length, $this->max_description_length);
|
1604 |
}
|
@@ -1928,15 +1930,6 @@ class Model_SQ_Frontend {
|
|
1928 |
return trim(stripcslashes($text));
|
1929 |
}
|
1930 |
|
1931 |
-
public function _truncate($text) {
|
1932 |
-
if (function_exists('strip_tags'))
|
1933 |
-
$text = strip_tags($text);
|
1934 |
-
$text = str_replace(']]>', ']]>', $text);
|
1935 |
-
$text = @preg_replace('|\[(.+?)\](.+?\[/\\1\])?|s', '', $text);
|
1936 |
-
$text = strip_tags($text);
|
1937 |
-
|
1938 |
-
return trim(stripcslashes($text));
|
1939 |
-
}
|
1940 |
|
1941 |
/**
|
1942 |
* Show just distinct keywords
|
10 |
private $post_type;
|
11 |
private $post_types;
|
12 |
|
13 |
+
/** @var string url */
|
14 |
private $url;
|
15 |
private $author;
|
16 |
|
29 |
private $custom_og_image = false;
|
30 |
|
31 |
/** @var integer */
|
32 |
+
private $min_title_length = 20;
|
33 |
|
34 |
/** @var integer */
|
35 |
+
private $max_title_length = 75;
|
36 |
|
37 |
/** @var integer */
|
38 |
private $max_description_length = 170;
|
60 |
return "\n\n<!-- Squirrly SEO Plugin " . SQ_VERSION . ", visit: http://plugin.squirrly.co/ -->\n";
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
/**
|
64 |
* Set the post
|
65 |
*
|
117 |
|
118 |
/**
|
119 |
* Start the buffer record
|
120 |
+
* @return string
|
121 |
*/
|
122 |
public function startBuffer() {
|
123 |
ob_start(array($this, 'getBuffer'));
|
126 |
/**
|
127 |
* Get the loaded buffer and change it
|
128 |
*
|
129 |
+
* @param string $buffer
|
130 |
+
* @return string
|
131 |
*/
|
132 |
public function getBuffer($buffer) {
|
133 |
if (isset($this->buffer)) {
|
155 |
}
|
156 |
|
157 |
/**
|
158 |
+
* Should Squirrly Load for this page?
|
159 |
+
* @return bool
|
|
|
|
|
160 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
public function is_squirrly() {
|
162 |
if (SQ_Tools::getValue('sq_use') == 'off') {
|
163 |
return false;
|
167 |
return false;
|
168 |
}
|
169 |
|
170 |
+
if (is_404()){
|
171 |
+
return false;
|
172 |
+
}
|
173 |
+
|
174 |
if ($this->isHomePage() || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search() || (!empty($this->post_types) && in_array($this->post_type, $this->post_types))) {
|
175 |
return true;
|
176 |
}
|
195 |
}
|
196 |
|
197 |
if ($this->is_squirrly()) {
|
|
|
198 |
//update ... please monitor
|
199 |
if (is_single() || is_page()) {
|
200 |
if (!isset($this->post->ID)) {
|
202 |
}
|
203 |
}
|
204 |
|
205 |
+
if (strpos($buffer, '<head') !== false) {
|
|
|
206 |
$this->meta['blogname'] = get_bloginfo('name');
|
207 |
//Get the url
|
208 |
$this->url = $this->getCanonicalUrl();
|
209 |
//Get the title
|
210 |
$this->title = $this->getCustomTitle();
|
211 |
+
//Set the description and Keywords in case of default
|
212 |
+
$this->getCustomDescription();
|
213 |
+
$this->getCustomKeyword();
|
214 |
+
|
215 |
/* Get the thumb image from post */
|
216 |
$this->thumb_images = $this->getImagesFromContent();
|
217 |
|
218 |
+
if (SQ_Tools::$options['sq_auto_title'] == 1 && isset($this->title) && $this->title <> '') {
|
219 |
+
$buffer = @preg_replace('/<title[^<>]*>([^<>]*)<\/title>/si', '', $buffer, -1);
|
220 |
+
}
|
221 |
+
if (SQ_Tools::$options['sq_auto_description'] == 1) {
|
222 |
//clear the existing description and keywords
|
223 |
$buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](description|keywords)["\'][^>]*content=["\'][^"\'>]*["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
|
224 |
}
|
240 |
$buffer = @preg_replace('/<script[^>]*type=["\']application\/ld\+json["\'][^>]*>[^>]*<\/script>[\n\r]*/si', '', $buffer, -1);
|
241 |
}
|
242 |
|
243 |
+
$buffer = @preg_replace('/(<head(\s[^>]*|)>)/si', sprintf("$1\n%s", $this->getHeader()) . "\n", $buffer, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
return $buffer;
|
246 |
+
}
|
247 |
+
} else {
|
248 |
+
global $sq_is_sitemap;
|
249 |
+
if (isset($sq_is_sitemap) && $sq_is_sitemap) {
|
250 |
+
$buffer = @preg_replace('/<\/sitemapindex>(.*)?/si', "</sitemapindex>", $buffer);
|
251 |
+
$buffer = @preg_replace('/<\/urlset>(.*)?/si', "</urlset>", $buffer);
|
252 |
+
$buffer = trim($buffer);
|
253 |
}
|
254 |
}
|
255 |
|
256 |
+
|
|
|
|
|
257 |
return $buffer;
|
258 |
}
|
259 |
|
266 |
*/
|
267 |
public function getHeader() {
|
268 |
$ret = '';
|
|
|
269 |
|
270 |
+
if (SQ_Tools::$options['sq_auto_title'] == 1 && isset($this->title) && $this->title <> '') {
|
271 |
+
$ret .= sprintf("<title>%s</title>", $this->title) . "\n";
|
272 |
+
}
|
273 |
+
|
274 |
+
$ret .= $this->setStart();
|
275 |
//Add description in homepage if is set or add description in other pages if is not home page
|
276 |
if ((SQ_Tools::$options['sq_auto_description'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
|
277 |
$ret .= $this->getCustomDescription() . "\n";
|
386 |
$meta = "\n";
|
387 |
$image = '';
|
388 |
|
389 |
+
//Title and Description is required
|
390 |
+
if ($this->title == '' || $this->description == '') {
|
391 |
+
return;
|
392 |
+
}
|
393 |
+
|
394 |
if (!isset($this->thumb_video) || $this->thumb_video == '') {
|
395 |
$videos = $this->getVideosFromContent();
|
396 |
if (isset($videos[0])) {
|
486 |
|
487 |
$meta .= sprintf('<meta property="og:type" content="%s" />', 'article') . "\n";
|
488 |
$meta .= sprintf('<meta property="article:published_time" content="%s" />', get_the_time('c', $this->post->ID)) . "\n";
|
489 |
+
if (SQ_Tools::$options['sq_facebook_account'] <> '') {
|
490 |
+
$meta .= sprintf('<meta property="article:publisher" content="%s" />', SQ_Tools::$options['sq_facebook_account']) . "\n";
|
491 |
+
}
|
492 |
$category = get_the_category($this->post->ID);
|
493 |
if (!empty($category) && $category[0]->cat_name <> 'Uncategorized') {
|
494 |
$meta .= sprintf('<meta property="article:section" content="%s" />', $category[0]->cat_name) . "\n";
|
619 |
}
|
620 |
}
|
621 |
|
|
|
|
|
|
|
|
|
622 |
} elseif (SQ_Tools::$options ['sq_auto_title'] == 1) { /* Check if is a predefined Title for home page */
|
623 |
|
624 |
//If the home page is a static page that has custom snippet
|
636 |
$this->title = get_the_title();
|
637 |
}
|
638 |
}
|
639 |
+
} else {
|
640 |
+
$this->title = get_the_title();
|
641 |
}
|
642 |
return apply_filters('sq_title', $this->title);
|
643 |
}
|
652 |
|
653 |
/**
|
654 |
* Get the image from content
|
655 |
+
* @global WP_Query $wp_query
|
656 |
* @param integer $id Post ID
|
657 |
+
* @return array
|
658 |
*/
|
659 |
public function getImagesFromContent($id = null, $all = false) {
|
660 |
$images = array();
|
661 |
+
$post = $this->post;
|
662 |
+
|
663 |
+
if (isset($id) && !$post = get_post($id)) {
|
664 |
+
return $images;
|
665 |
}
|
666 |
|
667 |
+
//if not a specific post and description is sqitched on
|
668 |
+
if (!isset($id) && SQ_Tools::$options['sq_auto_description'] == 1) { //
|
669 |
if (($this->isHomePage() && SQ_Tools::$options['sq_fp_ogimage'] <> '')) {
|
670 |
$images[] = array(
|
671 |
'src' => esc_url(SQ_Tools::$options['sq_fp_ogimage']),
|
884 |
}
|
885 |
}
|
886 |
}
|
887 |
+
} elseif (SQ_Tools::$options['sq_auto_description'] == 1) {
|
|
|
888 |
/* Check if is a predefined TitleIn Snippet */
|
889 |
+
//If the home page is a static page that has custom snippet
|
890 |
+
if (is_page() && isset($this->post) && isset($this->post->ID) && $this->getAdvancedMeta($this->post->ID, 'description') <> '') {
|
891 |
+
$description = $this->getAdvancedMeta($this->post->ID, 'description');
|
892 |
+
} elseif (SQ_Tools::$options ['sq_fp_description'] <> '') {
|
893 |
+
$description = strip_tags(SQ_Tools::$options['sq_fp_description']);
|
894 |
+
} else {
|
895 |
+
$description = $this->grabDescriptionFromPost();
|
|
|
|
|
|
|
896 |
}
|
897 |
+
} else {
|
898 |
+
$description = get_bloginfo('description');
|
899 |
+
}
|
900 |
|
901 |
$description = (($description <> '') ? $description : $this->title);
|
902 |
if ($description <> '') {
|
1374 |
public function getJsonLD() {
|
1375 |
$meta = '';
|
1376 |
$sep = ",\n";
|
1377 |
+
$jsonld = SQ_ObjController::getModelService('JsonLD');
|
1378 |
+
$markup = array();
|
1379 |
if ($this->isHomePage()) {
|
1380 |
if (isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']])) {
|
1381 |
+
$markup['@type'] = SQ_Tools::$options['sq_jsonld_type'];
|
1382 |
+
$markup['@id'] = $this->url;
|
1383 |
+
$markup['url'] = $this->url;
|
1384 |
+
|
1385 |
foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']] as $key => $value) {
|
1386 |
if ($value <> '') {
|
1387 |
if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'contactType') {
|
1388 |
continue;
|
1389 |
}
|
1390 |
if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'telephone') {
|
1391 |
+
$markup['contactPoint'] = array(
|
1392 |
+
'@type' => 'ContactPoint',
|
1393 |
+
'telephone' => $value,
|
1394 |
+
'contactType' => SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']]['contactType'],
|
1395 |
+
|
1396 |
+
);
|
1397 |
}
|
1398 |
|
1399 |
if ($key == 'logo') {
|
1400 |
if (SQ_Tools::$options['sq_jsonld_type'] == 'Person') {
|
1401 |
$key = 'image';
|
1402 |
}
|
1403 |
+
$markup[$key] = array(
|
1404 |
+
'@type' => 'ImageObject',
|
1405 |
+
'url' => $value,
|
1406 |
+
);
|
1407 |
} else {
|
1408 |
+
$markup[$key] = $value;
|
1409 |
}
|
1410 |
+
|
1411 |
}
|
1412 |
}
|
1413 |
}
|
1414 |
+
if (!empty($markup)) {
|
1415 |
+
$socials = array();
|
|
|
1416 |
if (SQ_Tools::$options['sq_twitter_account'] <> '') {
|
1417 |
+
$socials[] = SQ_Tools::$options['sq_twitter_account'];
|
1418 |
}
|
1419 |
if (SQ_Tools::$options['sq_facebook_account'] <> '') {
|
1420 |
+
$socials[] = SQ_Tools::$options['sq_facebook_account'];
|
1421 |
}
|
1422 |
if (SQ_Tools::$options['sq_google_plus'] <> '') {
|
1423 |
+
$socials[] = SQ_Tools::$options['sq_google_plus'];
|
1424 |
}
|
1425 |
if (SQ_Tools::$options['sq_linkedin_account'] <> '') {
|
1426 |
+
$socials[] = SQ_Tools::$options['sq_linkedin_account'];
|
1427 |
}
|
1428 |
if (SQ_Tools::$options['sq_pinterest_account'] <> '') {
|
1429 |
+
$socials[] = SQ_Tools::$options['sq_pinterest_account'];
|
1430 |
}
|
1431 |
if (SQ_Tools::$options['sq_instagram_account'] <> '') {
|
1432 |
+
$socials[] = SQ_Tools::$options['sq_instagram_account'];
|
1433 |
}
|
1434 |
|
1435 |
+
$markup['potentialAction'] = array(
|
1436 |
+
'@type' => 'SearchAction',
|
1437 |
+
'target' => get_bloginfo('url') . '?s={search_string}',
|
1438 |
+
'query-input' => 'required name=search_string',
|
1439 |
+
);
|
1440 |
|
1441 |
+
if (!empty($socials)) {
|
1442 |
+
$markup['sameAs'] = $socials;
|
1443 |
}
|
|
|
|
|
1444 |
}
|
1445 |
+
//add current markup
|
1446 |
+
$jsonld->set_data($markup);
|
1447 |
+
} elseif ($this->post_type == 'post') {
|
1448 |
+
$markup['@type'] = 'Article';
|
1449 |
+
$markup['@id'] = $this->url;
|
1450 |
+
$markup['url'] = $this->url;
|
1451 |
if (isset($this->title)) {
|
1452 |
+
$markup['name'] = $this->truncate($this->title, $this->min_title_length, $this->max_title_length);
|
1453 |
}
|
1454 |
if (isset($this->description)) {
|
1455 |
+
$markup['headline'] = $this->truncate($this->description, $this->min_description_length, 110);
|
1456 |
}
|
1457 |
+
$markup['mainEntityOfPage'] = array(
|
1458 |
+
'@type' => 'WebPage',
|
1459 |
+
'url' => $this->url
|
1460 |
+
);
|
1461 |
|
1462 |
if (!empty($this->thumb_images)) {
|
1463 |
+
$markup['thumbnailUrl'] = $this->thumb_images[0]['src'];
|
1464 |
}
|
1465 |
if (isset($this->post->post_date)) {
|
1466 |
+
$markup['datePublished'] = date('c', strtotime($this->post->post_date));
|
1467 |
}
|
1468 |
if (isset($this->post->post_modified)) {
|
1469 |
+
$markup['dateModified'] = date('c', strtotime($this->post->post_modified));
|
1470 |
}
|
1471 |
if (!empty($this->thumb_images)) {
|
1472 |
foreach ($this->thumb_images as $image) {
|
1473 |
+
$markup['image'] = array(
|
1474 |
+
"@type" => "ImageObject",
|
1475 |
+
"url" => $image['src'],
|
1476 |
+
"height" => ((isset($image['height']) && $image['height'] <> '') ? (int)$image['height'] : 500),
|
1477 |
+
"width" => ((isset($image['width']) && $image['width'] <> '') ? (int)$image['width'] : 700),
|
1478 |
+
);
|
|
|
1479 |
break;
|
1480 |
}
|
1481 |
}
|
1482 |
+
$markup['author'] = array(
|
1483 |
+
"@type" => "Person",
|
1484 |
+
"url" => $this->getAuthor('user_url'),
|
1485 |
+
"name" => $this->getAuthor('display_name'),
|
1486 |
+
);
|
1487 |
+
|
1488 |
if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']])) {
|
1489 |
+
|
1490 |
+
$markup['publisher'] = array(
|
1491 |
+
"@type" => SQ_Tools::$options['sq_jsonld_type'],
|
1492 |
+
"url" => $this->url,
|
1493 |
+
"name" => $this->getAuthor('display_name'),
|
1494 |
+
);
|
1495 |
+
|
1496 |
foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']] as $key => $value) {
|
1497 |
if ($value <> '') {
|
1498 |
if ($key == 'contactType' || $key == 'telephone') {
|
1500 |
}
|
1501 |
|
1502 |
if ($key == 'logo') {
|
1503 |
+
$markup['publisher']['logo'] = array(
|
1504 |
+
"@type" => "ImageObject",
|
1505 |
+
"url" => $value
|
1506 |
+
);
|
1507 |
+
|
1508 |
} else {
|
1509 |
+
$markup['publisher'][$key] = $value;
|
1510 |
}
|
|
|
1511 |
}
|
1512 |
}
|
|
|
1513 |
}
|
1514 |
+
$markup['keywords'] = str_replace(',', '","', $this->grabKeywordsFromPost());
|
1515 |
|
1516 |
+
//add current markup
|
1517 |
+
$jsonld->set_data($markup);
|
1518 |
} elseif (is_author()) {
|
1519 |
+
$markup['@type'] = 'Person';
|
1520 |
+
$markup['@id'] = $this->getAuthor('user_url');
|
1521 |
+
$markup['url'] = $this->getAuthor('user_url');
|
1522 |
+
$markup['name'] = $this->getAuthor('display_name');
|
1523 |
|
1524 |
+
//add current markup
|
1525 |
+
$jsonld->set_data($markup);
|
1526 |
}
|
1527 |
|
1528 |
+
return apply_filters('sq_json_ld_meta', $jsonld->getStructuredData());
|
|
|
|
|
|
|
|
|
1529 |
}
|
1530 |
|
1531 |
/**
|
1600 |
|
1601 |
if ($post) {
|
1602 |
if (!$this->isHomePage()) {
|
1603 |
+
$description = $this->truncate(SQ_Tools::i18n($post->post_excerpt), $this->min_description_length, $this->max_description_length);
|
1604 |
if (!$description) {
|
1605 |
$description = $this->truncate(SQ_Tools::i18n($post->post_content), $this->min_description_length, $this->max_description_length);
|
1606 |
}
|
1930 |
return trim(stripcslashes($text));
|
1931 |
}
|
1932 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1933 |
|
1934 |
/**
|
1935 |
* Show just distinct keywords
|
models/SQ_Menu.php
CHANGED
@@ -82,13 +82,9 @@ class Model_SQ_Menu {
|
|
82 |
|
83 |
if (!isset($this->menu[5]))
|
84 |
$this->menu[5] = null;
|
85 |
-
if (!isset($this->menu[6]))
|
86 |
-
$this->menu[6] = null;
|
87 |
-
if (!isset($this->menu[7]))
|
88 |
-
$this->menu[7] = null;
|
89 |
|
90 |
/* add the menu with WP */
|
91 |
-
add_submenu_page($this->menu[0], $this->menu[1], $this->menu[2], $this->menu[3], $this->menu[4], $this->menu[5]
|
92 |
}
|
93 |
}
|
94 |
}
|
82 |
|
83 |
if (!isset($this->menu[5]))
|
84 |
$this->menu[5] = null;
|
|
|
|
|
|
|
|
|
85 |
|
86 |
/* add the menu with WP */
|
87 |
+
add_submenu_page($this->menu[0], $this->menu[1], $this->menu[2], $this->menu[3], $this->menu[4], $this->menu[5]);
|
88 |
}
|
89 |
}
|
90 |
}
|
models/SQ_Sitemaps.php
CHANGED
@@ -104,6 +104,7 @@ class Model_SQ_Sitemaps {
|
|
104 |
|
105 |
if (SQ_Tools::$options['sq_sitemap_show']['images'] == 1) {
|
106 |
if ($images = SQ_ObjController::getModel('SQ_Frontend')->getImagesFromContent($post->ID, true)) {
|
|
|
107 |
array_push($posts['contains'], 'image');
|
108 |
$xml['image:image'] = array();
|
109 |
foreach ($images as $image) {
|
104 |
|
105 |
if (SQ_Tools::$options['sq_sitemap_show']['images'] == 1) {
|
106 |
if ($images = SQ_ObjController::getModel('SQ_Frontend')->getImagesFromContent($post->ID, true)) {
|
107 |
+
|
108 |
array_push($posts['contains'], 'image');
|
109 |
$xml['image:image'] = array();
|
110 |
foreach ($images as $image) {
|
models/services/JsonLD.php
ADDED
@@ -0,0 +1,444 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|