Version Description
- 11/07/2017 =
- Fixed the SEO METAs in frontend for some theme
- Fixed the SEO METAs for Wp Super cache and other cache plugins
- Update Squirrly SEO Snippet Frontend is optional in Squirrly > SEO Settings Advanced
- Fixed the Sitemap to load for all subdirectories
- Fixed compatibility issues with other plugins
Download this release
Release Info
| Developer | cifi |
| Plugin | |
| Version | 8.2.23 |
| Comparing to | |
| See all releases | |
Code changes from version 8.0.5 to 8.2.23
- classes/{SQ_Action.php → Action.php} +43 -28
- classes/BlockController.php +114 -0
- classes/{SQ_DisplayController.php → DisplayController.php} +31 -41
- classes/{SQ_Error.php → Error.php} +11 -5
- classes/FrontController.php +152 -0
- classes/{SQ_HookController.php → HookController.php} +42 -3
- classes/ObjController.php +200 -0
- classes/{SQ_Ranking.php → Ranking.php} +25 -35
- classes/SQ_BlockController.php +0 -95
- classes/SQ_FrontController.php +0 -123
- classes/SQ_ObjController.php +0 -197
- classes/SQ_Traffic.php +0 -8
- classes/{SQ_Tools.php → Tools.php} +533 -111
- config/config.php +54 -8
- config/paths.php +5 -6
- controllers/Api.php +76 -0
- controllers/Cron.php +29 -0
- controllers/{SQ_Feed.php → Feed.php} +10 -8
- controllers/FrontMenu.php +100 -0
- controllers/Frontend.php +193 -0
- controllers/Menu.php +548 -0
- controllers/{SQ_Post.php → Post.php} +88 -99
- controllers/{SQ_PostsList.php → PostsList.php} +33 -62
- controllers/SQ_Frontend.php +0 -218
- controllers/SQ_Menu.php +0 -247
- controllers/{SQ_Sitemaps.php → Sitemaps.php} +149 -67
- core/{SQ_BlockAccount/SQ_BlockAccount.php → BlockAccount.php} +1 -1
- core/{SQ_BlockAffiliate/SQ_BlockAffiliate.php → BlockAffiliate.php} +4 -4
- core/BlockAnalytics.php +9 -0
- core/{SQ_BlockAudit/SQ_BlockAudit.php → BlockAudit.php} +2 -2
- core/{SQ_BlockLiveAssistant/SQ_BlockLiveAssistant.php → BlockCopyright.php} +1 -1
- core/BlockCustomerService.php +11 -0
- core/{SQ_BlockDashboard/SQ_BlockDashboard.php → BlockDashboard.php} +1 -1
- core/BlockHelp.php +8 -0
- core/BlockImport.php +67 -0
- core/BlockKeywordResearch.php +12 -0
- core/{SQ_BlockCopyright/SQ_BlockCopyright.php → BlockLiveAssistant.php} +1 -1
- core/BlockPatterns.php +49 -0
- core/{SQ_BlockPostsAnalytics/SQ_BlockPostsAnalytics.php → BlockPostsAnalytics.php} +7 -6
- core/BlockSettings.php +76 -0
- core/BlockSettingsSeo.php +538 -0
- core/{SQ_BlockSupport/SQ_BlockSupport.php → BlockSupport.php} +8 -8
- core/BlockToolbar.php +4 -0
- core/{SQ_Blocklogin/SQ_Blocklogin.php → Blocklogin.php} +16 -16
- core/Blockresearch.php +8 -0
- core/Blocksearch.php +41 -0
- core/Blockseo.php +20 -0
- core/Loading.php +105 -0
- core/SQ_BlockAnalytics/SQ_BlockAnalytics.php +0 -9
- core/SQ_BlockCustomerService/SQ_BlockCustomerService.php +0 -11
- core/SQ_BlockHelp/SQ_BlockHelp.php +0 -8
- core/SQ_BlockKeywordResearch/SQ_BlockKeywordResearch.php +0 -11
- core/SQ_BlockSettings/SQ_BlockSettings.php +0 -72
- core/SQ_BlockSettingsSeo/SQ_BlockSettingsSeo.php +0 -382
- core/SQ_Blockresearch/SQ_Blockresearch.php +0 -17
- core/SQ_Blocksearch/SQ_Blocksearch.php +0 -41
- core/SQ_Blockseo/SQ_Blockseo.php +0 -40
- core/SQ_Loading/SQ_Loading.php +0 -74
- core/config.xml +73 -32
- languages/squirrly-seo-de_DE.mo +0 -0
- languages/squirrly-seo-de_DE.po +2186 -915
- languages/squirrly-seo-ro_RO.mo +0 -0
- languages/squirrly-seo-ro_RO.po +2896 -1061
- models/{SQ_BlockPostsAnalytics.php → BlockPostsAnalytics.php} +10 -10
- models/BlockSettingsSeo.php +1026 -0
- models/Blocksearch.php +10 -0
- models/Blockseo.php +29 -0
- models/Frontend.php +812 -0
- models/{SQ_Ico.php → Ico.php} +1 -1
- models/{SQ_Menu.php → Menu.php} +1 -1
- models/{SQ_Post.php → Post.php} +13 -7
- models/{SQ_PostsList.php → PostsList.php} +2 -2
- models/SQ_BlockSettingsSeo.php +0 -355
- models/SQ_Blocksearch.php +0 -10
- models/SQ_Blockseo.php +0 -41
- models/SQ_Frontend.php +0 -2136
- models/SQ_Sitemaps.php +0 -453
- models/Sitemaps.php +495 -0
- models/abstract/Domain.php +457 -0
- models/abstract/Seo.php +194 -0
- models/domain/Patterns.php +366 -0
- models/domain/Post.php +151 -0
- models/domain/Sq.php +146 -0
- models/services/Analytics.php +64 -0
- models/services/Canonical.php +33 -0
- models/services/Description.php +33 -0
- models/services/DublinCore.php +99 -0
- models/services/Favicon.php +71 -0
- models/services/JsonLD.php +264 -50
- models/services/Keywords.php +42 -0
- models/services/Noindex.php +36 -0
- models/services/OpenGraph.php +232 -0
- models/services/Pixel.php +210 -0
- models/services/PrevNext.php +43 -0
- models/services/Publisher.php +84 -0
- models/services/Robots.php +54 -0
- models/services/Sitemap.php +40 -0
- models/services/Title.php +38 -0
- models/services/TwitterCard.php +104 -0
- models/services/Verify.php +49 -0
- readme.txt +68 -3
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- screenshot-5.png +0 -0
- screenshot-6.png +0 -0
- screenshot-7.png +0 -0
- squirrly.php +19 -17
- themes/default/SQ_BlockAccount.php +0 -35
- themes/default/SQ_BlockAffiliate.php +0 -103
- themes/default/SQ_BlockAudit.php +0 -63
- themes/default/SQ_BlockCopyright.php +0 -31
- themes/default/SQ_BlockDashboard.php +0 -111
- themes/default/SQ_BlockKeywordResearch.php +0 -37
- themes/default/SQ_BlockLiveAssistant.php +0 -36
- themes/default/SQ_BlockPostsAnalytics.php +0 -56
- themes/default/SQ_BlockSettings.php +0 -416
- themes/default/SQ_BlockSettingsSeo.php +0 -869
classes/{SQ_Action.php → Action.php}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
/**
|
| 4 |
* Set the ajax action and call for wordpress
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
|
| 8 |
/** @var array with all form and ajax actions */
|
| 9 |
var $actions = array();
|
|
@@ -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, str_replace(get_bloginfo('url'),'',admin_url('admin-ajax.php', 'relative'))) !== false
|
| 18 |
return true;
|
| 19 |
}
|
| 20 |
|
|
@@ -59,6 +59,7 @@ class SQ_Action extends SQ_FrontController {
|
|
| 59 |
echo '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
| 60 |
<script type="text/javascript">
|
| 61 |
var sqQuery = {
|
|
|
|
| 62 |
"ajaxurl": "' . admin_url('admin-ajax.php') . '",
|
| 63 |
"adminposturl": "' . admin_url('post.php') . '",
|
| 64 |
"adminlisturl": "' . admin_url('edit.php') . '",
|
|
@@ -67,6 +68,18 @@ class SQ_Action extends SQ_FrontController {
|
|
| 67 |
</script>';
|
| 68 |
}
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
/**
|
| 71 |
* Get all actions from config.xml in core directory and add them in the WP
|
| 72 |
*
|
|
@@ -87,37 +100,37 @@ class SQ_Action extends SQ_FrontController {
|
|
| 87 |
self::$config = json_decode(json_encode((array)simplexml_load_string($data)), 1);
|
| 88 |
}
|
| 89 |
|
| 90 |
-
if (is_array(self::$config))
|
| 91 |
foreach (self::$config['block'] as $block) {
|
| 92 |
-
if ($block['active'] == 1) {
|
| 93 |
/* if there is a single action */
|
| 94 |
-
if (isset($block['actions']['action']))
|
| 95 |
-
if (
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
}
|
| 100 |
-
} else {
|
| 101 |
/* if there are more actions for the current block */
|
| 102 |
-
|
| 103 |
-
/* add the
|
| 104 |
-
if ($action == $cur_action)
|
| 105 |
-
$this->actions[] = array('class' => $block['name']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
}
|
| 108 |
}
|
| 109 |
-
|
| 110 |
}
|
| 111 |
}
|
| 112 |
-
|
| 113 |
|
| 114 |
/* add the actions in WP */
|
| 115 |
foreach ($this->actions as $actions) {
|
| 116 |
-
|
| 117 |
-
SQ_ObjController::getBlock($actions['class'])->action();
|
| 118 |
-
} elseif ($actions['path'] == 'controllers') {
|
| 119 |
-
SQ_ObjController::getController($actions['class'])->action();
|
| 120 |
-
}
|
| 121 |
}
|
| 122 |
}
|
| 123 |
}
|
|
@@ -128,20 +141,21 @@ class SQ_Action extends SQ_FrontController {
|
|
| 128 |
* @param array $args
|
| 129 |
* @return json | string
|
| 130 |
*/
|
| 131 |
-
public
|
|
|
|
| 132 |
$parameters = "";
|
| 133 |
$scheme = "http:";
|
| 134 |
|
| 135 |
-
if (
|
| 136 |
return false;
|
| 137 |
}
|
| 138 |
|
| 139 |
-
$extra = array('user_url' =>
|
| 140 |
'lang' => (defined('WPLANG') ? WPLANG : 'en_US'),
|
| 141 |
'versq' => SQ_VERSION_ID,
|
| 142 |
'verwp' => WP_VERSION_ID,
|
| 143 |
'verphp' => PHP_VERSION_ID,
|
| 144 |
-
'token' =>
|
| 145 |
|
| 146 |
|
| 147 |
if (is_array($args)) {
|
|
@@ -169,7 +183,7 @@ class SQ_Action extends SQ_FrontController {
|
|
| 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
|
| 173 |
}
|
| 174 |
|
| 175 |
/**
|
|
@@ -177,7 +191,8 @@ class SQ_Action extends SQ_FrontController {
|
|
| 177 |
* @param string $url
|
| 178 |
* @return string
|
| 179 |
*/
|
| 180 |
-
private
|
|
|
|
| 181 |
return str_replace(array(' '), array('+'), $url);
|
| 182 |
}
|
| 183 |
|
| 3 |
/**
|
| 4 |
* Set the ajax action and call for wordpress
|
| 5 |
*/
|
| 6 |
+
class SQ_Classes_Action extends SQ_Classes_FrontController {
|
| 7 |
|
| 8 |
/** @var array with all form and ajax actions */
|
| 9 |
var $actions = array();
|
| 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 |
|
| 59 |
echo '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
| 60 |
<script type="text/javascript">
|
| 61 |
var sqQuery = {
|
| 62 |
+
"adminurl": "' . admin_url() . '",
|
| 63 |
"ajaxurl": "' . admin_url('admin-ajax.php') . '",
|
| 64 |
"adminposturl": "' . admin_url('post.php') . '",
|
| 65 |
"adminlisturl": "' . admin_url('edit.php') . '",
|
| 68 |
</script>';
|
| 69 |
}
|
| 70 |
|
| 71 |
+
public function hookFronthead() {
|
| 72 |
+
if (is_user_logged_in()) {
|
| 73 |
+
echo '<script type="text/javascript">
|
| 74 |
+
var sqQuery = {
|
| 75 |
+
"adminurl": "' . admin_url() . '",
|
| 76 |
+
"ajaxurl": "' . admin_url('admin-ajax.php') . '",
|
| 77 |
+
"nonce": "' . wp_create_nonce(_SQ_NONCE_ID_) . '"
|
| 78 |
+
}
|
| 79 |
+
</script>';
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
/**
|
| 84 |
* Get all actions from config.xml in core directory and add them in the WP
|
| 85 |
*
|
| 100 |
self::$config = json_decode(json_encode((array)simplexml_load_string($data)), 1);
|
| 101 |
}
|
| 102 |
|
| 103 |
+
if (is_array(self::$config))
|
| 104 |
foreach (self::$config['block'] as $block) {
|
| 105 |
+
if (isset($block['active']) && $block['active'] == 1) {
|
| 106 |
/* if there is a single action */
|
| 107 |
+
if (isset($block['actions']['action']))
|
| 108 |
+
if (isset($block['admin']) &&
|
| 109 |
+
(($block['admin'] == 1 && is_user_logged_in()) ||
|
| 110 |
+
$block['admin'] == 0)
|
| 111 |
+
) {
|
|
|
|
|
|
|
| 112 |
/* if there are more actions for the current block */
|
| 113 |
+
if (!is_array($block['actions']['action'])) {
|
| 114 |
+
/* add the action in the actions array */
|
| 115 |
+
if ($block['actions']['action'] == $cur_action)
|
| 116 |
+
$this->actions[] = array('class' => $block['name']);
|
| 117 |
+
} else {
|
| 118 |
+
/* if there are more actions for the current block */
|
| 119 |
+
foreach ($block['actions']['action'] as $action) {
|
| 120 |
+
/* add the actions in the actions array */
|
| 121 |
+
if ($action == $cur_action)
|
| 122 |
+
$this->actions[] = array('class' => $block['name']);
|
| 123 |
}
|
| 124 |
}
|
| 125 |
}
|
| 126 |
+
|
| 127 |
}
|
| 128 |
}
|
| 129 |
+
|
| 130 |
|
| 131 |
/* add the actions in WP */
|
| 132 |
foreach ($this->actions as $actions) {
|
| 133 |
+
SQ_Classes_ObjController::getClass($actions['class'])->action();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
}
|
| 135 |
}
|
| 136 |
}
|
| 141 |
* @param array $args
|
| 142 |
* @return json | string
|
| 143 |
*/
|
| 144 |
+
public
|
| 145 |
+
static function apiCall($module, $args = array(), $timeout = 10) {
|
| 146 |
$parameters = "";
|
| 147 |
$scheme = "http:";
|
| 148 |
|
| 149 |
+
if (SQ_Classes_Tools::getOption('sq_api') == '' && $module <> 'sq/login' && $module <> 'sq/register') {
|
| 150 |
return false;
|
| 151 |
}
|
| 152 |
|
| 153 |
+
$extra = array('user_url' => home_url(),
|
| 154 |
'lang' => (defined('WPLANG') ? WPLANG : 'en_US'),
|
| 155 |
'versq' => SQ_VERSION_ID,
|
| 156 |
'verwp' => WP_VERSION_ID,
|
| 157 |
'verphp' => PHP_VERSION_ID,
|
| 158 |
+
'token' => SQ_Classes_Tools::getOption('sq_api'));
|
| 159 |
|
| 160 |
|
| 161 |
if (is_array($args)) {
|
| 183 |
//call it with http to prevent curl issues with ssls
|
| 184 |
$url = self::cleanUrl($scheme . _SQ_API_URL_ . $module . "?" . $parameters);
|
| 185 |
//update_option('sq_seopost_log', $url);
|
| 186 |
+
return SQ_Classes_Tools::sq_remote_get($url, array(), array('timeout' => $timeout));
|
| 187 |
}
|
| 188 |
|
| 189 |
/**
|
| 191 |
* @param string $url
|
| 192 |
* @return string
|
| 193 |
*/
|
| 194 |
+
private
|
| 195 |
+
static function cleanUrl($url) {
|
| 196 |
return str_replace(array(' '), array('+'), $url);
|
| 197 |
}
|
| 198 |
|
classes/BlockController.php
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* The main class for core blocks
|
| 5 |
+
*
|
| 6 |
+
*/
|
| 7 |
+
class SQ_Classes_BlockController {
|
| 8 |
+
|
| 9 |
+
/** @var object of the model class */
|
| 10 |
+
protected $model;
|
| 11 |
+
|
| 12 |
+
/** @var boolean */
|
| 13 |
+
public $flush = true;
|
| 14 |
+
|
| 15 |
+
/** @var object of the view class */
|
| 16 |
+
protected $view;
|
| 17 |
+
|
| 18 |
+
/** @var name of the class */
|
| 19 |
+
private $name;
|
| 20 |
+
|
| 21 |
+
public function __construct() {
|
| 22 |
+
/* get the name of the current class */
|
| 23 |
+
$this->name = get_class($this);
|
| 24 |
+
|
| 25 |
+
/* create the model and view instances */
|
| 26 |
+
$this->model = SQ_Classes_ObjController::getClass(str_replace('Core', 'Models', $this->name));
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* load sequence of classes
|
| 31 |
+
*
|
| 32 |
+
* @return mixed
|
| 33 |
+
*/
|
| 34 |
+
public function init() {
|
| 35 |
+
/* check if there is a hook defined in the block class */
|
| 36 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_HookController')->setBlockHooks($this);
|
| 37 |
+
|
| 38 |
+
if ($this->flush) {
|
| 39 |
+
$this->hookHead();
|
| 40 |
+
echo $this->getView();
|
| 41 |
+
} else {
|
| 42 |
+
return $this->getView();
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Get the block view
|
| 49 |
+
*
|
| 50 |
+
* @param null $view
|
| 51 |
+
* @return mixed
|
| 52 |
+
*/
|
| 53 |
+
public function getView($view = null) {
|
| 54 |
+
if (!isset($view)) {
|
| 55 |
+
if ($class = SQ_Classes_ObjController::getClassPath($this->name)) {
|
| 56 |
+
$view = $class['name'];
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
if (isset($view)) {
|
| 61 |
+
$this->view = SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController');
|
| 62 |
+
return $this->view->getView($view, $this);
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
return '';
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Called as menu callback to show the block
|
| 71 |
+
*
|
| 72 |
+
*/
|
| 73 |
+
public function show() {
|
| 74 |
+
$this->flush = true;
|
| 75 |
+
echo $this->init();
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
public function preloadSettings() {
|
| 80 |
+
echo '<script type="text/javascript">
|
| 81 |
+
var __blog_url = "' . get_bloginfo('url') . '";
|
| 82 |
+
var __token = "' . SQ_Classes_Tools::getOption('sq_api') . '";
|
| 83 |
+
var __language = "' . get_bloginfo('language') . '";
|
| 84 |
+
var __api_url = "' . _SQ_API_URL_ . '";
|
| 85 |
+
jQuery(document).ready(function () {
|
| 86 |
+
jQuery.sq_getHelp("' . str_replace(array("sq_core_block", "sq_controller_block_"), "", strtolower($this->name)) . '", "content");
|
| 87 |
+
});
|
| 88 |
+
</script>';
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* This function is called from Ajax class as a wp_ajax_action
|
| 93 |
+
*
|
| 94 |
+
*/
|
| 95 |
+
protected function action() {
|
| 96 |
+
// check to see if the submitted nonce matches with the
|
| 97 |
+
// generated nonce we created
|
| 98 |
+
if (function_exists('wp_verify_nonce'))
|
| 99 |
+
if (!wp_verify_nonce(SQ_Classes_Tools::getValue('nonce'), _SQ_NONCE_ID_))
|
| 100 |
+
die('Invalid request!');
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* This function will load the media in the header for each class
|
| 105 |
+
*
|
| 106 |
+
* @return void
|
| 107 |
+
*/
|
| 108 |
+
protected function hookHead() {
|
| 109 |
+
if ($class = SQ_Classes_ObjController::getClassPath($this->name)) {
|
| 110 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia($class['name']);
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
}
|
classes/{SQ_DisplayController.php → DisplayController.php}
RENAMED
|
@@ -3,14 +3,13 @@
|
|
| 3 |
/**
|
| 4 |
* The class handles the theme part in WP
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
|
| 8 |
-
private static $name;
|
| 9 |
private static $cache;
|
| 10 |
|
| 11 |
public function init() {
|
| 12 |
/* Load the global CSS file */
|
| 13 |
-
self::loadMedia('
|
| 14 |
}
|
| 15 |
|
| 16 |
/**
|
|
@@ -19,7 +18,7 @@ class SQ_DisplayController {
|
|
| 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 |
|
|
@@ -41,7 +40,7 @@ class SQ_DisplayController {
|
|
| 41 |
|
| 42 |
$css_uri = '';
|
| 43 |
$js_uri = '';
|
| 44 |
-
|
| 45 |
if (!isset($params['media'])) {
|
| 46 |
$params['media'] = 'all';
|
| 47 |
}
|
|
@@ -51,13 +50,24 @@ class SQ_DisplayController {
|
|
| 51 |
self::$cache[$uri] = true;
|
| 52 |
|
| 53 |
/* if is a custom css file */
|
| 54 |
-
if (strpos($uri, '
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
}
|
| 59 |
-
if (file_exists(_SQ_THEME_DIR_ . 'js/' . $
|
| 60 |
-
$js_uri = _SQ_THEME_URL_ . 'js/' . $
|
| 61 |
}
|
| 62 |
} else {
|
| 63 |
$name = strtolower(basename($uri));
|
|
@@ -66,11 +76,9 @@ class SQ_DisplayController {
|
|
| 66 |
elseif (strpos($uri, '.js') !== FALSE) {
|
| 67 |
$js_uri = $uri;
|
| 68 |
}
|
| 69 |
-
$local = false;
|
| 70 |
}
|
| 71 |
|
| 72 |
|
| 73 |
-
|
| 74 |
if ($css_uri <> '') {
|
| 75 |
if (!wp_style_is($name)) {
|
| 76 |
wp_enqueue_style($name, $css_uri, null, SQ_VERSION_ID, $params['media']);
|
|
@@ -83,7 +91,7 @@ class SQ_DisplayController {
|
|
| 83 |
|
| 84 |
if ($js_uri <> '') {
|
| 85 |
if (!wp_script_is($name)) {
|
| 86 |
-
wp_enqueue_script($name, $js_uri,
|
| 87 |
}
|
| 88 |
if (isset($params['trigger']) && $params['trigger'] === true) {
|
| 89 |
wp_print_scripts(array($name));
|
|
@@ -91,39 +99,21 @@ class SQ_DisplayController {
|
|
| 91 |
}
|
| 92 |
}
|
| 93 |
|
| 94 |
-
public function setBlock($block) {
|
| 95 |
-
self::$name = $block;
|
| 96 |
-
}
|
| 97 |
|
| 98 |
/**
|
| 99 |
-
*
|
| 100 |
*
|
| 101 |
-
* @
|
|
|
|
|
|
|
| 102 |
*/
|
| 103 |
-
public
|
| 104 |
-
|
| 105 |
-
if (file_exists(_SQ_THEME_DIR_ . self::$name . '.php')) {
|
| 106 |
ob_start();
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
include(_SQ_THEME_DIR_ . self::$name . '.php');
|
| 110 |
-
$block_content = ob_get_contents();
|
| 111 |
-
ob_end_clean();
|
| 112 |
-
|
| 113 |
-
return $block_content;
|
| 114 |
}
|
| 115 |
-
}
|
| 116 |
|
| 117 |
-
|
| 118 |
-
* Called for any class to show the block content
|
| 119 |
-
*
|
| 120 |
-
* @param string $block the name of the block file in theme directory (class name by default)
|
| 121 |
-
*
|
| 122 |
-
* @return string of the current class view
|
| 123 |
-
*/
|
| 124 |
-
public function output($block, $obj) {
|
| 125 |
-
self::$name = $block;
|
| 126 |
-
echo $this->echoBlock($obj);
|
| 127 |
}
|
| 128 |
-
|
| 129 |
}
|
| 3 |
/**
|
| 4 |
* The class handles the theme part in WP
|
| 5 |
*/
|
| 6 |
+
class SQ_Classes_DisplayController {
|
| 7 |
|
|
|
|
| 8 |
private static $cache;
|
| 9 |
|
| 10 |
public function init() {
|
| 11 |
/* Load the global CSS file */
|
| 12 |
+
self::loadMedia('global');
|
| 13 |
}
|
| 14 |
|
| 15 |
/**
|
| 18 |
*/
|
| 19 |
private static function _isAjax() {
|
| 20 |
$url = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false);
|
| 21 |
+
if ($url && (strpos($url, str_replace(get_bloginfo('url'), '', admin_url('admin-ajax.php', 'relative'))) !== false)) {
|
| 22 |
return true;
|
| 23 |
}
|
| 24 |
|
| 40 |
|
| 41 |
$css_uri = '';
|
| 42 |
$js_uri = '';
|
| 43 |
+
|
| 44 |
if (!isset($params['media'])) {
|
| 45 |
$params['media'] = 'all';
|
| 46 |
}
|
| 50 |
self::$cache[$uri] = true;
|
| 51 |
|
| 52 |
/* if is a custom css file */
|
| 53 |
+
if (strpos($uri, '//') === false) {
|
| 54 |
+
if (strpos($uri, '.') !== false) {
|
| 55 |
+
$name = strtolower(_SQ_NAMESPACE_ . substr($uri, 0, strpos($uri, '.')));
|
| 56 |
+
} else {
|
| 57 |
+
$name = strtolower(_SQ_NAMESPACE_ . $uri);
|
| 58 |
+
}
|
| 59 |
+
if (strpos($uri,'.css') !== false && file_exists(_SQ_THEME_DIR_ . 'css/' . strtolower($uri))) {
|
| 60 |
+
$css_uri = _SQ_THEME_URL_ . 'css/' . strtolower($uri);
|
| 61 |
+
}
|
| 62 |
+
if (strpos($uri,'.js') !== false && file_exists(_SQ_THEME_DIR_ . 'js/' . strtolower($uri))) {
|
| 63 |
+
$js_uri = _SQ_THEME_URL_ . 'js/' . strtolower($uri);
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
if (file_exists(_SQ_THEME_DIR_ . 'css/' . strtolower($uri) . '.css')) {
|
| 67 |
+
$css_uri = _SQ_THEME_URL_ . 'css/' . strtolower($uri) . '.css';
|
| 68 |
}
|
| 69 |
+
if (file_exists(_SQ_THEME_DIR_ . 'js/' . strtolower($uri) . '.js')) {
|
| 70 |
+
$js_uri = _SQ_THEME_URL_ . 'js/' . strtolower($uri) . '.js';
|
| 71 |
}
|
| 72 |
} else {
|
| 73 |
$name = strtolower(basename($uri));
|
| 76 |
elseif (strpos($uri, '.js') !== FALSE) {
|
| 77 |
$js_uri = $uri;
|
| 78 |
}
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
|
|
|
|
| 82 |
if ($css_uri <> '') {
|
| 83 |
if (!wp_style_is($name)) {
|
| 84 |
wp_enqueue_style($name, $css_uri, null, SQ_VERSION_ID, $params['media']);
|
| 91 |
|
| 92 |
if ($js_uri <> '') {
|
| 93 |
if (!wp_script_is($name)) {
|
| 94 |
+
wp_enqueue_script($name, $js_uri, array('jquery'), SQ_VERSION_ID);
|
| 95 |
}
|
| 96 |
if (isset($params['trigger']) && $params['trigger'] === true) {
|
| 97 |
wp_print_scripts(array($name));
|
| 99 |
}
|
| 100 |
}
|
| 101 |
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
/**
|
| 104 |
+
* return the block content from theme directory
|
| 105 |
*
|
| 106 |
+
* @param $block
|
| 107 |
+
* @param $view
|
| 108 |
+
* @return bool|string
|
| 109 |
*/
|
| 110 |
+
public function getView($block, $view) {
|
| 111 |
+
if (file_exists(_SQ_THEME_DIR_ . $block . '.php')) {
|
|
|
|
| 112 |
ob_start();
|
| 113 |
+
include(_SQ_THEME_DIR_ . $block . '.php');
|
| 114 |
+
return ob_get_clean();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
}
|
|
|
|
| 116 |
|
| 117 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
}
|
|
|
|
| 119 |
}
|
classes/{SQ_Error.php → Error.php}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class
|
| 4 |
|
| 5 |
/** @var array */
|
| 6 |
private static $errors, $switch_off;
|
|
@@ -42,6 +42,12 @@ class SQ_Error extends SQ_FrontController {
|
|
| 42 |
'text' => $error);
|
| 43 |
}
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
/**
|
| 46 |
* This hook will show the error in WP header
|
| 47 |
*/
|
|
@@ -61,7 +67,7 @@ class SQ_Error extends SQ_FrontController {
|
|
| 61 |
break;
|
| 62 |
|
| 63 |
case 'helpnotice':
|
| 64 |
-
if (
|
| 65 |
break;
|
| 66 |
}
|
| 67 |
self::$switch_off = "<a href=\"javascript:void(0);\" onclick=\"jQuery.post( ajaxurl, {action: 'sq_warnings_off', nonce: '" . wp_create_nonce(_SQ_NONCE_ID_) . "'}, function(data) { if (data) { jQuery('#sq_ignore_warn').attr('checked', true); jQuery('.sq_message').hide(); jQuery('#toplevel_page_squirrly .awaiting-mod').fadeOut('slow'); } });\" >" . __("Don't bother me!", _SQ_PLUGIN_NAME_) . "</a>";
|
|
@@ -81,12 +87,12 @@ class SQ_Error extends SQ_FrontController {
|
|
| 81 |
/**
|
| 82 |
* Show the notices to WP
|
| 83 |
*
|
| 84 |
-
* @return
|
| 85 |
*/
|
| 86 |
public static function showError($message, $id = '', $type = 'sq_error') {
|
| 87 |
|
| 88 |
-
if (file_exists(_SQ_THEME_DIR_ . '
|
| 89 |
-
include
|
| 90 |
} else {
|
| 91 |
echo $message;
|
| 92 |
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class SQ_Classes_Error extends SQ_Classes_FrontController {
|
| 4 |
|
| 5 |
/** @var array */
|
| 6 |
private static $errors, $switch_off;
|
| 42 |
'text' => $error);
|
| 43 |
}
|
| 44 |
|
| 45 |
+
public static function setMessage($message = '', $id = '') {
|
| 46 |
+
self::$errors[] = array('id' => $id,
|
| 47 |
+
'type' => 'success',
|
| 48 |
+
'text' => $message);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
/**
|
| 52 |
* This hook will show the error in WP header
|
| 53 |
*/
|
| 67 |
break;
|
| 68 |
|
| 69 |
case 'helpnotice':
|
| 70 |
+
if (SQ_Classes_Tools::getOption('ignore_warn')) {
|
| 71 |
break;
|
| 72 |
}
|
| 73 |
self::$switch_off = "<a href=\"javascript:void(0);\" onclick=\"jQuery.post( ajaxurl, {action: 'sq_warnings_off', nonce: '" . wp_create_nonce(_SQ_NONCE_ID_) . "'}, function(data) { if (data) { jQuery('#sq_ignore_warn').attr('checked', true); jQuery('.sq_message').hide(); jQuery('#toplevel_page_squirrly .awaiting-mod').fadeOut('slow'); } });\" >" . __("Don't bother me!", _SQ_PLUGIN_NAME_) . "</a>";
|
| 87 |
/**
|
| 88 |
* Show the notices to WP
|
| 89 |
*
|
| 90 |
+
* @return string
|
| 91 |
*/
|
| 92 |
public static function showError($message, $id = '', $type = 'sq_error') {
|
| 93 |
|
| 94 |
+
if (file_exists(_SQ_THEME_DIR_ . 'Notices.php')) {
|
| 95 |
+
include(_SQ_THEME_DIR_ . 'Notices.php');
|
| 96 |
} else {
|
| 97 |
echo $message;
|
| 98 |
}
|
classes/FrontController.php
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* The main class for controllers
|
| 5 |
+
*
|
| 6 |
+
*/
|
| 7 |
+
class SQ_Classes_FrontController {
|
| 8 |
+
|
| 9 |
+
/** @var object of the model class */
|
| 10 |
+
public $model;
|
| 11 |
+
|
| 12 |
+
/** @var boolean */
|
| 13 |
+
public $flush = true;
|
| 14 |
+
|
| 15 |
+
/** @var object of the view class */
|
| 16 |
+
public $view;
|
| 17 |
+
|
| 18 |
+
/** @var name of the class */
|
| 19 |
+
private $name;
|
| 20 |
+
|
| 21 |
+
public function __construct() {
|
| 22 |
+
|
| 23 |
+
/* Load error class */
|
| 24 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Error');
|
| 25 |
+
/* Load Tools */
|
| 26 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Tools');
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
/* get the name of the current class */
|
| 30 |
+
$this->name = get_class($this);
|
| 31 |
+
|
| 32 |
+
/* load the model and hooks here for wordpress actions to take efect */
|
| 33 |
+
/* create the model and view instances */
|
| 34 |
+
$this->model = SQ_Classes_ObjController::getClass(str_replace('Controllers', 'Models', $this->name));
|
| 35 |
+
|
| 36 |
+
//IMPORTANT TO LOAD HOOKS HERE
|
| 37 |
+
/* check if there is a hook defined in the controller clients class */
|
| 38 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_HookController')->setHooks($this);
|
| 39 |
+
|
| 40 |
+
/* Load the Submit Actions Handler */
|
| 41 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Action');
|
| 42 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController');
|
| 43 |
+
|
| 44 |
+
//abstract classes
|
| 45 |
+
SQ_Classes_ObjController::getClass('SQ_Models_Abstract_Domain');
|
| 46 |
+
SQ_Classes_ObjController::getClass('SQ_Models_Abstract_Models');
|
| 47 |
+
SQ_Classes_ObjController::getClass('SQ_Models_Abstract_Seo');
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* load sequence of classes
|
| 52 |
+
* Function called usualy when the controller is loaded in WP
|
| 53 |
+
*
|
| 54 |
+
* @return mixed
|
| 55 |
+
*/
|
| 56 |
+
public function init() {
|
| 57 |
+
/* load the blocks for this controller */
|
| 58 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_ObjController')->getBlocks($this->name);
|
| 59 |
+
|
| 60 |
+
if ($this->flush) {
|
| 61 |
+
echo $this->getView();
|
| 62 |
+
} else {
|
| 63 |
+
return $this->getView();
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Get the block view
|
| 69 |
+
*
|
| 70 |
+
* @param null $view
|
| 71 |
+
* @return mixed
|
| 72 |
+
*/
|
| 73 |
+
public function getView($view = null) {
|
| 74 |
+
if (!isset($view)) {
|
| 75 |
+
if ($class = SQ_Classes_ObjController::getClassPath($this->name)) {
|
| 76 |
+
$view = $class['name'];
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
if (isset($view)) {
|
| 81 |
+
$this->view = SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController');
|
| 82 |
+
return $this->view->getView($view, $this);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
return '';
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Called as menu callback to show the block
|
| 90 |
+
*
|
| 91 |
+
*/
|
| 92 |
+
public function show() {
|
| 93 |
+
$this->flush = true;
|
| 94 |
+
echo $this->init();
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* initialize settings
|
| 99 |
+
* Called from index
|
| 100 |
+
*
|
| 101 |
+
* @return void
|
| 102 |
+
*/
|
| 103 |
+
public function runAdmin() {
|
| 104 |
+
/* show the admin menu and post actions */
|
| 105 |
+
SQ_Classes_ObjController::getClass('SQ_Controllers_Menu');
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/**
|
| 109 |
+
* Run fron frontend
|
| 110 |
+
*/
|
| 111 |
+
public function runFrontend() {
|
| 112 |
+
//Load Frontend only if Squirrly SEO is enabled
|
| 113 |
+
SQ_Classes_ObjController::getClass('SQ_Controllers_Frontend');
|
| 114 |
+
|
| 115 |
+
/* show the topbar admin menu and post actions */
|
| 116 |
+
SQ_Classes_ObjController::getClass('SQ_Controllers_Menu');
|
| 117 |
+
|
| 118 |
+
/* call the API for save posts */
|
| 119 |
+
SQ_Classes_ObjController::getClass('SQ_Controllers_Api');
|
| 120 |
+
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
/**
|
| 124 |
+
* first function call for any class
|
| 125 |
+
*
|
| 126 |
+
*/
|
| 127 |
+
protected function action() {
|
| 128 |
+
|
| 129 |
+
// check to see if the submitted nonce matches with the
|
| 130 |
+
// generated nonce we created
|
| 131 |
+
if (function_exists('wp_verify_nonce'))
|
| 132 |
+
if (!wp_verify_nonce(SQ_Classes_Tools::getValue('nonce'), _SQ_NONCE_ID_))
|
| 133 |
+
die('Invalid request!');
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
* This function will load the media in the header for each class
|
| 138 |
+
*
|
| 139 |
+
* @return void
|
| 140 |
+
*/
|
| 141 |
+
public function hookHead() {
|
| 142 |
+
if (!is_admin()) {
|
| 143 |
+
return;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->init();
|
| 147 |
+
if ($class = SQ_Classes_ObjController::getClassPath($this->name)) {
|
| 148 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia($class['name']);
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
}
|
classes/{SQ_HookController.php → HookController.php}
RENAMED
|
@@ -3,26 +3,49 @@
|
|
| 3 |
/**
|
| 4 |
* The class handles the actions in WP
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
|
| 8 |
/** @var array the WP actions list from admin */
|
| 9 |
private $admin_hooks = array();
|
|
|
|
| 10 |
private $block_hooks = array();
|
| 11 |
|
| 12 |
public function __construct() {
|
| 13 |
-
$this->admin_hooks = array(
|
|
|
|
| 14 |
'head' => 'admin_head',
|
| 15 |
'footer' => 'admin_footer',
|
| 16 |
'menu' => 'admin_menu',
|
| 17 |
-
'preload' => 'template_redirect',
|
| 18 |
'notices' => 'admin_notices',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
'frontinit' => 'init',
|
| 20 |
'fronthead' => 'wp_head',
|
| 21 |
'frontfooter' => 'wp_footer',
|
| 22 |
);
|
|
|
|
| 23 |
$this->block_hooks = array('getContent' => 'getContent');
|
| 24 |
}
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
/**
|
| 27 |
* Calls the specified action in WP
|
| 28 |
* @param object $instance The parent class instance
|
|
@@ -41,6 +64,22 @@ class SQ_HookController {
|
|
| 41 |
}
|
| 42 |
}
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
/**
|
| 45 |
* Calls the specified action in WP
|
| 46 |
* @param string $action
|
| 3 |
/**
|
| 4 |
* The class handles the actions in WP
|
| 5 |
*/
|
| 6 |
+
class SQ_Classes_HookController {
|
| 7 |
|
| 8 |
/** @var array the WP actions list from admin */
|
| 9 |
private $admin_hooks = array();
|
| 10 |
+
private $front_hooks = array();
|
| 11 |
private $block_hooks = array();
|
| 12 |
|
| 13 |
public function __construct() {
|
| 14 |
+
$this->admin_hooks = array(
|
| 15 |
+
'init' => 'admin_init',
|
| 16 |
'head' => 'admin_head',
|
| 17 |
'footer' => 'admin_footer',
|
| 18 |
'menu' => 'admin_menu',
|
|
|
|
| 19 |
'notices' => 'admin_notices',
|
| 20 |
+
);
|
| 21 |
+
|
| 22 |
+
//called in frontend
|
| 23 |
+
$this->front_hooks = array(
|
| 24 |
+
// --
|
| 25 |
+
'init' => 'init',
|
| 26 |
+
'preload' => 'template_redirect',
|
| 27 |
'frontinit' => 'init',
|
| 28 |
'fronthead' => 'wp_head',
|
| 29 |
'frontfooter' => 'wp_footer',
|
| 30 |
);
|
| 31 |
+
|
| 32 |
$this->block_hooks = array('getContent' => 'getContent');
|
| 33 |
}
|
| 34 |
|
| 35 |
+
/**
|
| 36 |
+
* Calls the specified action in WP
|
| 37 |
+
* @param object $instance The parent class instance
|
| 38 |
+
*
|
| 39 |
+
* @return void
|
| 40 |
+
*/
|
| 41 |
+
public function setHooks($instance) {
|
| 42 |
+
if (is_admin() || is_network_admin()) {
|
| 43 |
+
$this->setAdminHooks($instance);
|
| 44 |
+
} else {
|
| 45 |
+
$this->setFrontHooks($instance);
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
/**
|
| 50 |
* Calls the specified action in WP
|
| 51 |
* @param object $instance The parent class instance
|
| 64 |
}
|
| 65 |
}
|
| 66 |
|
| 67 |
+
/**
|
| 68 |
+
* Calls the specified action in WP
|
| 69 |
+
* @param object $instance The parent class instance
|
| 70 |
+
*
|
| 71 |
+
* @return void
|
| 72 |
+
*/
|
| 73 |
+
public function setFrontHooks($instance) {
|
| 74 |
+
/* for each admin action check if is defined in class and call it */
|
| 75 |
+
foreach ($this->front_hooks as $hook => $value) {
|
| 76 |
+
if (is_callable(array($instance, 'hook' . ucfirst($hook)))) {
|
| 77 |
+
//call the WP add_action function
|
| 78 |
+
add_action($value, array($instance, 'hook' . ucfirst($hook)), 5);
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
/**
|
| 84 |
* Calls the specified action in WP
|
| 85 |
* @param string $action
|
classes/ObjController.php
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* The class creates object for plugin classes
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Classes_ObjController {
|
| 7 |
+
|
| 8 |
+
/** @var array of instances */
|
| 9 |
+
public static $instances;
|
| 10 |
+
|
| 11 |
+
/** @var array from core config */
|
| 12 |
+
private static $config;
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
public static function getClass($className, $args = array()) {
|
| 16 |
+
|
| 17 |
+
if ($class = self::getClassPath($className)) {
|
| 18 |
+
if (!isset(self::$instances[$className])) {
|
| 19 |
+
/* check if class is already defined */
|
| 20 |
+
if (!class_exists($className) || $className == get_class()) {
|
| 21 |
+
self::includeClass($class['dir'], $class['name']);
|
| 22 |
+
|
| 23 |
+
//check if abstract
|
| 24 |
+
$check = new ReflectionClass($className);
|
| 25 |
+
$abstract = $check->isAbstract();
|
| 26 |
+
if (!$abstract) {
|
| 27 |
+
self::$instances[$className] = new $className();
|
| 28 |
+
if (!empty($args)) {
|
| 29 |
+
call_user_func_array(array(self::$instances[$className], '__construct'), $args);
|
| 30 |
+
}
|
| 31 |
+
return self::$instances[$className];
|
| 32 |
+
} else {
|
| 33 |
+
self::$instances[$className] = true;
|
| 34 |
+
}
|
| 35 |
+
} else {
|
| 36 |
+
|
| 37 |
+
}
|
| 38 |
+
} else
|
| 39 |
+
return self::$instances[$className];
|
| 40 |
+
}
|
| 41 |
+
return false;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
private static function includeClass($classDir, $className) {
|
| 45 |
+
|
| 46 |
+
if (file_exists($classDir . $className . '.php'))
|
| 47 |
+
try {
|
| 48 |
+
include_once($classDir . $className . '.php');
|
| 49 |
+
} catch (Exception $e) {
|
| 50 |
+
throw new Exception('Controller Error: ' . $e->getMessage());
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
public static function getDomain($className, $args = array()) {
|
| 55 |
+
if ($class = self::getClassPath($className)) {
|
| 56 |
+
|
| 57 |
+
/* check if class is already defined */
|
| 58 |
+
// if (!isset(self::$instances[$className])) {
|
| 59 |
+
//
|
| 60 |
+
// self::$instances[$className] = new $className($args);
|
| 61 |
+
// return self::$instances[$className];
|
| 62 |
+
// }else
|
| 63 |
+
// return self::$instances[$className];
|
| 64 |
+
self::includeClass($class['dir'], $class['name']);
|
| 65 |
+
return new $className($args);
|
| 66 |
+
}
|
| 67 |
+
throw new Exception('Could not create domain: ' . $className);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Check if the class is correctly set
|
| 73 |
+
*
|
| 74 |
+
* @param string $className
|
| 75 |
+
* @return boolean
|
| 76 |
+
*/
|
| 77 |
+
private static function checkClassPath($className) {
|
| 78 |
+
$path = preg_split('/[_]+/', $className);
|
| 79 |
+
if (is_array($path) && count($path) > 1) {
|
| 80 |
+
if (in_array(_SQ_NAMESPACE_, $path)) {
|
| 81 |
+
return true;
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
return false;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Get the path of the class and name of the class
|
| 90 |
+
*
|
| 91 |
+
* @param string $className
|
| 92 |
+
* @return array | boolean
|
| 93 |
+
* array(
|
| 94 |
+
* dir - absolute path of the class
|
| 95 |
+
* name - the name of the file
|
| 96 |
+
* }
|
| 97 |
+
*/
|
| 98 |
+
public static function getClassPath($className) {
|
| 99 |
+
$dir = '';
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
if (self::checkClassPath($className)) {
|
| 103 |
+
$path = preg_split('/[_]+/', $className);
|
| 104 |
+
for ($i = 1; $i < sizeof($path) - 1; $i++)
|
| 105 |
+
$dir .= strtolower($path[$i]) . '/';
|
| 106 |
+
|
| 107 |
+
$class = array('dir' => _SQ_ROOT_DIR_ . '/' . $dir,
|
| 108 |
+
'name' => $path[sizeof($path) - 1]);
|
| 109 |
+
|
| 110 |
+
if (file_exists($class['dir'] . $class['name'] . '.php')) {
|
| 111 |
+
return $class;
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
return false;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Deprecated since 8.0.2
|
| 120 |
+
* Get the instance of the specified class
|
| 121 |
+
*
|
| 122 |
+
* @param string $className
|
| 123 |
+
* @param bool $core TRUE is the class is a core class or FALSE if it is from classes directory
|
| 124 |
+
*
|
| 125 |
+
* @return bool|object of the class
|
| 126 |
+
*/
|
| 127 |
+
public static function getController($className, $core = true) {
|
| 128 |
+
if (strpos($className, 'Controllers') === false) {
|
| 129 |
+
$className = _SQ_NAMESPACE_ . '_Controllers_' . str_replace(_SQ_NAMESPACE_ . '_', '', $className);
|
| 130 |
+
}
|
| 131 |
+
return self::getClass($className);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
/**
|
| 135 |
+
* Deprecated since 8.0.2
|
| 136 |
+
* Get the instance of the specified model class
|
| 137 |
+
*
|
| 138 |
+
* @param string $className
|
| 139 |
+
*
|
| 140 |
+
* @return bool|object of the class
|
| 141 |
+
*/
|
| 142 |
+
public static function getModel($className) {
|
| 143 |
+
if (strpos($className, 'Model') === false) {
|
| 144 |
+
$className = _SQ_NAMESPACE_ . '_Models_' . str_replace(_SQ_NAMESPACE_ . '_', '', $className);
|
| 145 |
+
}
|
| 146 |
+
return self::getClass($className);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Get the instance of the specified block from core directory
|
| 151 |
+
*
|
| 152 |
+
* @param string $className
|
| 153 |
+
*
|
| 154 |
+
* @return bool|object of the class
|
| 155 |
+
*/
|
| 156 |
+
public static function getBlock($className) {
|
| 157 |
+
if (strpos($className, 'Core') === false) {
|
| 158 |
+
$className = _SQ_NAMESPACE_ . '_Core_' . str_replace(_SQ_NAMESPACE_ . '_', '', $className);
|
| 159 |
+
}
|
| 160 |
+
return self::getClass($className);
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
/**
|
| 164 |
+
* Get all core classes from config.xml in core directory
|
| 165 |
+
* eg.SQ_Controllers_Post
|
| 166 |
+
* @param string $for
|
| 167 |
+
*/
|
| 168 |
+
public function getBlocks($for) {
|
| 169 |
+
/* if config allready in cache */
|
| 170 |
+
if (!isset(self::$config)) {
|
| 171 |
+
$config_file = _SQ_CORE_DIR_ . 'config.xml';
|
| 172 |
+
if (!file_exists($config_file))
|
| 173 |
+
return;
|
| 174 |
+
|
| 175 |
+
/* load configuration blocks data from core config files */
|
| 176 |
+
$data = file_get_contents($config_file);
|
| 177 |
+
self::$config = json_decode(json_encode((array)simplexml_load_string($data)), 1);;
|
| 178 |
+
}
|
| 179 |
+
//print_r(self::$config);
|
| 180 |
+
if (is_array(self::$config))
|
| 181 |
+
foreach (self::$config['block'] as $block) {
|
| 182 |
+
if ($block['active'] == 1)
|
| 183 |
+
if (isset($block['controllers']['controller']))
|
| 184 |
+
if (!is_array($block['controllers']['controller'])) {
|
| 185 |
+
/* if the block should load for the current controller */
|
| 186 |
+
if ($for == $block['controllers']['controller']) {
|
| 187 |
+
SQ_Classes_ObjController::getClass($block['name'])->init();
|
| 188 |
+
}
|
| 189 |
+
} else {
|
| 190 |
+
foreach ($block['controllers']['controller'] as $controller) {
|
| 191 |
+
/* if the block should load for the current controller */
|
| 192 |
+
if ($for == $controller) {
|
| 193 |
+
SQ_Classes_ObjController::getClass($block['name'])->init();
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
}
|
classes/{SQ_Ranking.php → Ranking.php}
RENAMED
|
@@ -3,23 +3,20 @@
|
|
| 3 |
/**
|
| 4 |
* Class for Google Ranking Record
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
-
{
|
| 8 |
private $keyword;
|
| 9 |
private $post_id;
|
| 10 |
private $error;
|
| 11 |
|
| 12 |
//--
|
| 13 |
-
public function getCountry()
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
return SQ_Tools::$options['sq_google_country'];
|
| 17 |
}
|
| 18 |
return 'com';
|
| 19 |
}
|
| 20 |
|
| 21 |
-
public function getRefererCountry()
|
| 22 |
-
{
|
| 23 |
$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',);
|
| 24 |
$country = $this->getCountry();
|
| 25 |
if (array_key_exists($country, $convert_refc)) {
|
|
@@ -32,10 +29,9 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 32 |
* Get the google language from settings
|
| 33 |
* @return string
|
| 34 |
*/
|
| 35 |
-
public function getLanguage()
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
return SQ_Tools::$options['sq_google_language'];
|
| 39 |
}
|
| 40 |
return 'en';
|
| 41 |
}
|
|
@@ -44,8 +40,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 44 |
* Set the Post id
|
| 45 |
* @return type
|
| 46 |
*/
|
| 47 |
-
public function setPost($post_id)
|
| 48 |
-
{
|
| 49 |
$this->post_id = $post_id;
|
| 50 |
}
|
| 51 |
|
|
@@ -53,8 +48,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 53 |
* Get the current keyword
|
| 54 |
* @param type $keyword
|
| 55 |
*/
|
| 56 |
-
public function setKeyword($keyword)
|
| 57 |
-
{
|
| 58 |
$this->keyword = str_replace(" ", "+", urlencode(strtolower($keyword)));
|
| 59 |
}
|
| 60 |
|
|
@@ -62,8 +56,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 62 |
* Process Ranking on brief request
|
| 63 |
* @param type $return
|
| 64 |
*/
|
| 65 |
-
public function processRanking($post_id, $keyword)
|
| 66 |
-
{
|
| 67 |
$this->setPost($post_id);
|
| 68 |
$this->setKeyword(trim($keyword));
|
| 69 |
|
|
@@ -82,8 +75,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 82 |
* @param string $language : en | local language
|
| 83 |
* @return boolean|int
|
| 84 |
*/
|
| 85 |
-
public function getGoogleRank()
|
| 86 |
-
{
|
| 87 |
|
| 88 |
@ini_set('open_basedir', null);
|
| 89 |
$this->error = '';
|
|
@@ -102,7 +94,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 102 |
$arg['hl'] = $this->getLanguage();
|
| 103 |
//$arg['gl'] = $this->getRefererCountry();
|
| 104 |
|
| 105 |
-
if (
|
| 106 |
$arg['cr'] = 'country' . strtoupper($this->getRefererCountry());
|
| 107 |
}
|
| 108 |
$arg['start'] = '0';
|
|
@@ -212,7 +204,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 212 |
$option['User-Agent'] = $user_agents[mt_rand(0, count($user_agents) - 1)];
|
| 213 |
$option['followlocation'] = true;
|
| 214 |
//Grab the remote informations from google
|
| 215 |
-
$response = utf8_decode(
|
| 216 |
|
| 217 |
//Check the values for block IP
|
| 218 |
if (strpos($response, "</h3>") === false) {
|
|
@@ -247,18 +239,17 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 247 |
* Do google rank with cron
|
| 248 |
* @global type $wpdb
|
| 249 |
*/
|
| 250 |
-
public function processCron()
|
| 251 |
-
{
|
| 252 |
global $wpdb;
|
| 253 |
|
| 254 |
-
if (get_transient('google_blocked') !== false ||
|
| 255 |
return;
|
| 256 |
}
|
| 257 |
|
| 258 |
set_time_limit(3000);
|
| 259 |
/* Load the Submit Actions Handler */
|
| 260 |
-
|
| 261 |
-
|
| 262 |
|
| 263 |
//check 20 keyword at one time
|
| 264 |
$sql = "SELECT `post_id`, `meta_value`
|
|
@@ -269,7 +260,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 269 |
if ($rows = $wpdb->get_results($sql)) {
|
| 270 |
$count = 0;
|
| 271 |
foreach ($rows as $row) {
|
| 272 |
-
if ($count >
|
| 273 |
break; //check only 10 keywords at the time
|
| 274 |
}
|
| 275 |
if ($row->meta_value <> '') {
|
|
@@ -289,7 +280,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 289 |
$json->rank = $rank;
|
| 290 |
$json->country = $this->getCountry();
|
| 291 |
$json->language = $this->getLanguage();
|
| 292 |
-
|
| 293 |
}
|
| 294 |
set_transient('sq_rank' . $row->post_id, $rank, (60 * 60 * 24));
|
| 295 |
//if rank proccess has no error
|
|
@@ -301,7 +292,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 301 |
$args['country'] = $this->getCountry();
|
| 302 |
$args['language'] = $this->getLanguage();
|
| 303 |
|
| 304 |
-
|
| 305 |
|
| 306 |
$count++;
|
| 307 |
sleep(mt_rand(20, 40));
|
|
@@ -315,8 +306,7 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 315 |
* Get keyword from earlier version
|
| 316 |
*
|
| 317 |
*/
|
| 318 |
-
public function getKeywordHistory()
|
| 319 |
-
{
|
| 320 |
global $wpdb;
|
| 321 |
//Check if ranks is saved in database
|
| 322 |
$sql = "SELECT a.`global_rank`, a.`keyword`, a.`post_id`
|
|
@@ -325,19 +315,19 @@ class SQ_Ranking extends SQ_FrontController
|
|
| 325 |
|
| 326 |
if ($rows = $wpdb->get_results($sql)) {
|
| 327 |
foreach ($rows as $values) {
|
| 328 |
-
if ($json =
|
| 329 |
$json->keyword = urldecode($values->keyword);
|
| 330 |
if ($values->global_rank > 0) {
|
| 331 |
$json->rank = $values->global_rank;
|
| 332 |
}
|
| 333 |
-
|
| 334 |
} else {
|
| 335 |
$args = array();
|
| 336 |
$args['keyword'] = urldecode($values->keyword);
|
| 337 |
if ($values->global_rank > 0) {
|
| 338 |
$json->rank = $values->global_rank;
|
| 339 |
}
|
| 340 |
-
|
| 341 |
}
|
| 342 |
}
|
| 343 |
}
|
| 3 |
/**
|
| 4 |
* Class for Google Ranking Record
|
| 5 |
*/
|
| 6 |
+
class SQ_Classes_Ranking extends SQ_Classes_FrontController {
|
|
|
|
| 7 |
private $keyword;
|
| 8 |
private $post_id;
|
| 9 |
private $error;
|
| 10 |
|
| 11 |
//--
|
| 12 |
+
public function getCountry() {
|
| 13 |
+
if (SQ_Classes_Tools::getOption('sq_google_country') <> '') {
|
| 14 |
+
return SQ_Classes_Tools::getOption('sq_google_country');
|
|
|
|
| 15 |
}
|
| 16 |
return 'com';
|
| 17 |
}
|
| 18 |
|
| 19 |
+
public function getRefererCountry() {
|
|
|
|
| 20 |
$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',);
|
| 21 |
$country = $this->getCountry();
|
| 22 |
if (array_key_exists($country, $convert_refc)) {
|
| 29 |
* Get the google language from settings
|
| 30 |
* @return string
|
| 31 |
*/
|
| 32 |
+
public function getLanguage() {
|
| 33 |
+
if (SQ_Classes_Tools::getOption('sq_google_language') <> '') {
|
| 34 |
+
return SQ_Classes_Tools::getOption('sq_google_language');
|
|
|
|
| 35 |
}
|
| 36 |
return 'en';
|
| 37 |
}
|
| 40 |
* Set the Post id
|
| 41 |
* @return type
|
| 42 |
*/
|
| 43 |
+
public function setPost($post_id) {
|
|
|
|
| 44 |
$this->post_id = $post_id;
|
| 45 |
}
|
| 46 |
|
| 48 |
* Get the current keyword
|
| 49 |
* @param type $keyword
|
| 50 |
*/
|
| 51 |
+
public function setKeyword($keyword) {
|
|
|
|
| 52 |
$this->keyword = str_replace(" ", "+", urlencode(strtolower($keyword)));
|
| 53 |
}
|
| 54 |
|
| 56 |
* Process Ranking on brief request
|
| 57 |
* @param type $return
|
| 58 |
*/
|
| 59 |
+
public function processRanking($post_id, $keyword) {
|
|
|
|
| 60 |
$this->setPost($post_id);
|
| 61 |
$this->setKeyword(trim($keyword));
|
| 62 |
|
| 75 |
* @param string $language : en | local language
|
| 76 |
* @return boolean|int
|
| 77 |
*/
|
| 78 |
+
public function getGoogleRank() {
|
|
|
|
| 79 |
|
| 80 |
@ini_set('open_basedir', null);
|
| 81 |
$this->error = '';
|
| 94 |
$arg['hl'] = $this->getLanguage();
|
| 95 |
//$arg['gl'] = $this->getRefererCountry();
|
| 96 |
|
| 97 |
+
if (SQ_Classes_Tools::getOption('sq_google_country_strict')) {
|
| 98 |
$arg['cr'] = 'country' . strtoupper($this->getRefererCountry());
|
| 99 |
}
|
| 100 |
$arg['start'] = '0';
|
| 204 |
$option['User-Agent'] = $user_agents[mt_rand(0, count($user_agents) - 1)];
|
| 205 |
$option['followlocation'] = true;
|
| 206 |
//Grab the remote informations from google
|
| 207 |
+
$response = utf8_decode(SQ_Classes_Tools::sq_remote_get("https://www.google.$country/search", $arg, $option));
|
| 208 |
|
| 209 |
//Check the values for block IP
|
| 210 |
if (strpos($response, "</h3>") === false) {
|
| 239 |
* Do google rank with cron
|
| 240 |
* @global type $wpdb
|
| 241 |
*/
|
| 242 |
+
public function processCron() {
|
|
|
|
| 243 |
global $wpdb;
|
| 244 |
|
| 245 |
+
if (get_transient('google_blocked') !== false || SQ_Classes_Tools::getOption('sq_google_ranksperhour') == 0) {
|
| 246 |
return;
|
| 247 |
}
|
| 248 |
|
| 249 |
set_time_limit(3000);
|
| 250 |
/* Load the Submit Actions Handler */
|
| 251 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Tools');
|
| 252 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Action');
|
| 253 |
|
| 254 |
//check 20 keyword at one time
|
| 255 |
$sql = "SELECT `post_id`, `meta_value`
|
| 260 |
if ($rows = $wpdb->get_results($sql)) {
|
| 261 |
$count = 0;
|
| 262 |
foreach ($rows as $row) {
|
| 263 |
+
if ($count > SQ_Classes_Tools::getOption('sq_google_ranksperhour')) {
|
| 264 |
break; //check only 10 keywords at the time
|
| 265 |
}
|
| 266 |
if ($row->meta_value <> '') {
|
| 280 |
$json->rank = $rank;
|
| 281 |
$json->country = $this->getCountry();
|
| 282 |
$json->language = $this->getLanguage();
|
| 283 |
+
SQ_Classes_ObjController::getClass('SQ_Models_Post')->saveKeyword($row->post_id, $json);
|
| 284 |
}
|
| 285 |
set_transient('sq_rank' . $row->post_id, $rank, (60 * 60 * 24));
|
| 286 |
//if rank proccess has no error
|
| 292 |
$args['country'] = $this->getCountry();
|
| 293 |
$args['language'] = $this->getLanguage();
|
| 294 |
|
| 295 |
+
SQ_Classes_Action::apiCall('sq/user-analytics/saveserp', $args);
|
| 296 |
|
| 297 |
$count++;
|
| 298 |
sleep(mt_rand(20, 40));
|
| 306 |
* Get keyword from earlier version
|
| 307 |
*
|
| 308 |
*/
|
| 309 |
+
public function getKeywordHistory() {
|
|
|
|
| 310 |
global $wpdb;
|
| 311 |
//Check if ranks is saved in database
|
| 312 |
$sql = "SELECT a.`global_rank`, a.`keyword`, a.`post_id`
|
| 315 |
|
| 316 |
if ($rows = $wpdb->get_results($sql)) {
|
| 317 |
foreach ($rows as $values) {
|
| 318 |
+
if ($json = SQ_Classes_ObjController::getClass('SQ_Models_Post')->getKeyword($values->post_id)) {
|
| 319 |
$json->keyword = urldecode($values->keyword);
|
| 320 |
if ($values->global_rank > 0) {
|
| 321 |
$json->rank = $values->global_rank;
|
| 322 |
}
|
| 323 |
+
SQ_Classes_ObjController::getClass('SQ_Models_Post')->saveKeyword($values->post_id, $json);
|
| 324 |
} else {
|
| 325 |
$args = array();
|
| 326 |
$args['keyword'] = urldecode($values->keyword);
|
| 327 |
if ($values->global_rank > 0) {
|
| 328 |
$json->rank = $values->global_rank;
|
| 329 |
}
|
| 330 |
+
SQ_Classes_ObjController::getClass('SQ_Models_Post')->saveKeyword($values->post_id, json_decode(json_encode($args)));
|
| 331 |
}
|
| 332 |
}
|
| 333 |
}
|
classes/SQ_BlockController.php
DELETED
|
@@ -1,95 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* The main class for core blocks
|
| 5 |
-
*
|
| 6 |
-
*/
|
| 7 |
-
class SQ_BlockController {
|
| 8 |
-
|
| 9 |
-
/** @var object of the model class */
|
| 10 |
-
protected $model;
|
| 11 |
-
|
| 12 |
-
/** @var boolean */
|
| 13 |
-
public $flush = true;
|
| 14 |
-
|
| 15 |
-
/** @var object of the view class */
|
| 16 |
-
protected $view;
|
| 17 |
-
|
| 18 |
-
/** @var name of the class */
|
| 19 |
-
private $name;
|
| 20 |
-
|
| 21 |
-
public function __construct() {
|
| 22 |
-
/** check the admin condition */
|
| 23 |
-
if (!is_admin())
|
| 24 |
-
return;
|
| 25 |
-
|
| 26 |
-
/* get the name of the current class */
|
| 27 |
-
$this->name = get_class($this);
|
| 28 |
-
|
| 29 |
-
/* create the model and view instances */
|
| 30 |
-
$this->model = SQ_ObjController::getModel($this->name);
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
/**
|
| 34 |
-
* load sequence of classes
|
| 35 |
-
*
|
| 36 |
-
* @return void
|
| 37 |
-
*/
|
| 38 |
-
public function init() {
|
| 39 |
-
|
| 40 |
-
$this->view = SQ_ObjController::getController('SQ_DisplayController', false);
|
| 41 |
-
$this->view->setBlock($this->name);
|
| 42 |
-
|
| 43 |
-
/* check if there is a hook defined in the block class */
|
| 44 |
-
SQ_ObjController::getController('SQ_HookController', false)
|
| 45 |
-
->setBlockHooks($this);
|
| 46 |
-
|
| 47 |
-
if ($this->flush) {
|
| 48 |
-
echo $this->output();
|
| 49 |
-
} else {
|
| 50 |
-
return $this->output();
|
| 51 |
-
}
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
protected function output() {
|
| 55 |
-
$this->hookHead();
|
| 56 |
-
return $this->view->echoBlock($this);
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
public function preloadSettings() {
|
| 60 |
-
|
| 61 |
-
echo '<script type="text/javascript">
|
| 62 |
-
var __blog_url = "' . get_bloginfo('url') . '";
|
| 63 |
-
var __token = "' . SQ_Tools::$options['sq_api'] . '";
|
| 64 |
-
var __api_url = "' . _SQ_API_URL_ . '";
|
| 65 |
-
jQuery(document).ready(function () {
|
| 66 |
-
sq_getHelp("' . str_replace("sq_block", "", strtolower($this->name)) . '", "content");
|
| 67 |
-
});
|
| 68 |
-
</script>';
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
/**
|
| 72 |
-
* This function is called from Ajax class as a wp_ajax_action
|
| 73 |
-
*
|
| 74 |
-
*/
|
| 75 |
-
protected function action() {
|
| 76 |
-
// check to see if the submitted nonce matches with the
|
| 77 |
-
// generated nonce we created
|
| 78 |
-
if (function_exists('wp_verify_nonce'))
|
| 79 |
-
if (!wp_verify_nonce(SQ_Tools::getValue('nonce'), _SQ_NONCE_ID_))
|
| 80 |
-
die('Invalid request!');
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
/**
|
| 84 |
-
* This function will load the media in the header for each class
|
| 85 |
-
*
|
| 86 |
-
* @return void
|
| 87 |
-
*/
|
| 88 |
-
protected function hookHead() {
|
| 89 |
-
if (!is_admin())
|
| 90 |
-
return;
|
| 91 |
-
SQ_ObjController::getController('SQ_DisplayController', false)
|
| 92 |
-
->loadMedia($this->name);
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/SQ_FrontController.php
DELETED
|
@@ -1,123 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* The main class for controllers
|
| 5 |
-
*
|
| 6 |
-
*/
|
| 7 |
-
class SQ_FrontController {
|
| 8 |
-
|
| 9 |
-
/** @var object of the model class */
|
| 10 |
-
public $model;
|
| 11 |
-
|
| 12 |
-
/** @var boolean */
|
| 13 |
-
public $flush = true;
|
| 14 |
-
|
| 15 |
-
/** @var object of the view class */
|
| 16 |
-
public $view;
|
| 17 |
-
|
| 18 |
-
/** @var name of the class */
|
| 19 |
-
private $name;
|
| 20 |
-
|
| 21 |
-
public function __construct() {
|
| 22 |
-
|
| 23 |
-
/* get the name of the current class */
|
| 24 |
-
$this->name = get_class($this);
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
/* load the model and hooks here for wordpress actions to take efect */
|
| 28 |
-
/* create the model and view instances */
|
| 29 |
-
$this->model = SQ_ObjController::getModel($this->name);
|
| 30 |
-
|
| 31 |
-
//IMPORTANT TO LOAD HOOKS HERE
|
| 32 |
-
/* check if there is a hook defined in the controller clients class */
|
| 33 |
-
SQ_ObjController::getController('SQ_HookController', false)->setAdminHooks($this);
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
/**
|
| 37 |
-
* load sequence of classes
|
| 38 |
-
* Function called usualy when the controller is loaded in WP
|
| 39 |
-
*
|
| 40 |
-
* @return void
|
| 41 |
-
*/
|
| 42 |
-
public function init() {
|
| 43 |
-
|
| 44 |
-
$this->view = SQ_ObjController::getController('SQ_DisplayController', false);
|
| 45 |
-
$this->view->setBlock($this->name);
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
/* load the blocks for this controller */
|
| 49 |
-
SQ_ObjController::getController('SQ_ObjController', false)->getBlocks($this->name);
|
| 50 |
-
|
| 51 |
-
if ($this->flush) {
|
| 52 |
-
echo $this->output();
|
| 53 |
-
} else {
|
| 54 |
-
return $this->output();
|
| 55 |
-
}
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
protected function output() {
|
| 59 |
-
$this->hookHead();
|
| 60 |
-
return $this->view->echoBlock($this);
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
/**
|
| 64 |
-
* initialize settings
|
| 65 |
-
* Called from index
|
| 66 |
-
*
|
| 67 |
-
* @return void
|
| 68 |
-
*/
|
| 69 |
-
public function run() {
|
| 70 |
-
|
| 71 |
-
/* Load error class */
|
| 72 |
-
SQ_ObjController::getController('SQ_Error', false);
|
| 73 |
-
/* Load Tools */
|
| 74 |
-
SQ_ObjController::getController('SQ_Tools', false);
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
/* Load the Submit Actions Handler */
|
| 79 |
-
SQ_ObjController::getController('SQ_Action', false);
|
| 80 |
-
|
| 81 |
-
SQ_ObjController::getController('SQ_DisplayController', false);
|
| 82 |
-
|
| 83 |
-
/* show the admin menu and post actions */
|
| 84 |
-
$this->loadMenu();
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
/**
|
| 88 |
-
* initialize menu
|
| 89 |
-
*
|
| 90 |
-
* @return void
|
| 91 |
-
*/
|
| 92 |
-
private function loadMenu() {
|
| 93 |
-
/* get the menu from controller */
|
| 94 |
-
SQ_ObjController::getController('SQ_Menu');
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
/**
|
| 98 |
-
* first function call for any class
|
| 99 |
-
*
|
| 100 |
-
*/
|
| 101 |
-
protected function action() {
|
| 102 |
-
|
| 103 |
-
// check to see if the submitted nonce matches with the
|
| 104 |
-
// generated nonce we created
|
| 105 |
-
if (function_exists('wp_verify_nonce'))
|
| 106 |
-
if (!wp_verify_nonce(SQ_Tools::getValue('nonce'), _SQ_NONCE_ID_))
|
| 107 |
-
die('Invalid request!');
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
/**
|
| 111 |
-
* This function will load the media in the header for each class
|
| 112 |
-
*
|
| 113 |
-
* @return void
|
| 114 |
-
*/
|
| 115 |
-
public function hookHead() {
|
| 116 |
-
if (!is_admin())
|
| 117 |
-
return;
|
| 118 |
-
SQ_ObjController::getController('SQ_DisplayController', false)->init();
|
| 119 |
-
SQ_ObjController::getController('SQ_DisplayController', false)
|
| 120 |
-
->loadMedia($this->name);
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/SQ_ObjController.php
DELETED
|
@@ -1,197 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* The class creates object for plugin classes
|
| 5 |
-
*/
|
| 6 |
-
class SQ_ObjController {
|
| 7 |
-
|
| 8 |
-
/** @var array of instances */
|
| 9 |
-
public static $instances;
|
| 10 |
-
|
| 11 |
-
/** @var array from core config */
|
| 12 |
-
private static $config;
|
| 13 |
-
|
| 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');
|
| 21 |
-
} catch (Exception $e) {
|
| 22 |
-
echo 'Controller Error: ' . $e->getMessage();
|
| 23 |
-
}
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
/**
|
| 27 |
-
* Get the instance of the specified class
|
| 28 |
-
*
|
| 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])) {
|
| 36 |
-
/* if $core == true then call the class from core directory */
|
| 37 |
-
self::includeController($className, $core);
|
| 38 |
-
|
| 39 |
-
if (class_exists($className)) {
|
| 40 |
-
self::$instances[$className] = new $className;
|
| 41 |
-
return self::$instances[$className];
|
| 42 |
-
}
|
| 43 |
-
} else
|
| 44 |
-
return self::$instances[$className];
|
| 45 |
-
|
| 46 |
-
return false;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
private static function includeModel($className) {
|
| 50 |
-
|
| 51 |
-
/* check if class is already defined */
|
| 52 |
-
if (file_exists(_SQ_MODEL_DIR_ . $className . '.php'))
|
| 53 |
-
try {
|
| 54 |
-
include_once(_SQ_MODEL_DIR_ . $className . '.php');
|
| 55 |
-
} catch (Exception $e) {
|
| 56 |
-
echo 'Model Error: ' . $e->getMessage();
|
| 57 |
-
}
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
/**
|
| 61 |
-
* Get the instance of the specified model class
|
| 62 |
-
*
|
| 63 |
-
* @param string $className
|
| 64 |
-
*
|
| 65 |
-
* @return bool|object of the class
|
| 66 |
-
*/
|
| 67 |
-
public static function getModel($className) {
|
| 68 |
-
/* add Model prefix */
|
| 69 |
-
$prefix = 'Model_';
|
| 70 |
-
|
| 71 |
-
if (!isset(self::$instances[$prefix . $className])) {
|
| 72 |
-
/* if $core == true then call the class from core directory */
|
| 73 |
-
self::includeModel($className);
|
| 74 |
-
|
| 75 |
-
//echo $className . '<br />';
|
| 76 |
-
if (class_exists($prefix . $className)) {
|
| 77 |
-
$classModel = $prefix . $className;
|
| 78 |
-
self::$instances[$prefix . $className] = new $classModel;
|
| 79 |
-
return self::$instances[$prefix . $className];
|
| 80 |
-
}
|
| 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) {
|
| 126 |
-
|
| 127 |
-
/* check if class is already defined */
|
| 128 |
-
try {
|
| 129 |
-
require_once(_SQ_CORE_DIR_ . $className . '/' . $className . '.php');
|
| 130 |
-
} catch (Exception $e) {
|
| 131 |
-
echo 'Model Error: ' . $e->getMessage();
|
| 132 |
-
}
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
/**
|
| 136 |
-
* Get the instance of the specified block from core directory
|
| 137 |
-
*
|
| 138 |
-
* @param string $className
|
| 139 |
-
*
|
| 140 |
-
* @return bool|object of the class
|
| 141 |
-
*/
|
| 142 |
-
public static function getBlock($className) {
|
| 143 |
-
|
| 144 |
-
if (!isset(self::$instances[$className])) {
|
| 145 |
-
/* if $core == true then call the class from core directory */
|
| 146 |
-
self::includeBlock($className);
|
| 147 |
-
|
| 148 |
-
//echo $className . '<br />';
|
| 149 |
-
if (class_exists($className)) {
|
| 150 |
-
self::$instances[$className] = new $className;
|
| 151 |
-
return self::$instances[$className];
|
| 152 |
-
} else
|
| 153 |
-
exit("Block error: Can't call $className class");
|
| 154 |
-
} else
|
| 155 |
-
return self::$instances[$className];
|
| 156 |
-
|
| 157 |
-
return false;
|
| 158 |
-
}
|
| 159 |
-
|
| 160 |
-
/**
|
| 161 |
-
* Get all core classes from config.xml in core directory
|
| 162 |
-
*
|
| 163 |
-
* @param string $for
|
| 164 |
-
*/
|
| 165 |
-
public function getBlocks($for) {
|
| 166 |
-
/* if config allready in cache */
|
| 167 |
-
if (!isset(self::$config)) {
|
| 168 |
-
$config_file = _SQ_CORE_DIR_ . 'config.xml';
|
| 169 |
-
if (!file_exists($config_file))
|
| 170 |
-
return;
|
| 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))
|
| 178 |
-
foreach (self::$config['block'] as $block) {
|
| 179 |
-
if ($block['active'] == 1)
|
| 180 |
-
if (isset($block['controllers']['controller']))
|
| 181 |
-
if (!is_array($block['controllers']['controller'])) {
|
| 182 |
-
/* if the block should load for the current controller */
|
| 183 |
-
if ($for == $block['controllers']['controller']) {
|
| 184 |
-
SQ_ObjController::getBlock($block['name'])->init();
|
| 185 |
-
}
|
| 186 |
-
} else {
|
| 187 |
-
foreach ($block['controllers']['controller'] as $controller) {
|
| 188 |
-
/* if the block should load for the current controller */
|
| 189 |
-
if ($for == $controller) {
|
| 190 |
-
SQ_ObjController::getBlock($block['name'])->init();
|
| 191 |
-
}
|
| 192 |
-
}
|
| 193 |
-
}
|
| 194 |
-
}
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/SQ_Traffic.php
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* Class for Traffic Record
|
| 5 |
-
*/
|
| 6 |
-
class SQ_Traffic extends SQ_FrontController {
|
| 7 |
-
|
| 8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/{SQ_Tools.php → Tools.php}
RENAMED
|
@@ -5,10 +5,11 @@
|
|
| 5 |
*
|
| 6 |
* @author Squirrly
|
| 7 |
*/
|
| 8 |
-
class
|
| 9 |
|
| 10 |
/** @var array Saved options in database */
|
| 11 |
public static $options = array();
|
|
|
|
| 12 |
|
| 13 |
/** @var integer Count the errors in site */
|
| 14 |
static $errors_count;
|
|
@@ -16,13 +17,14 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 16 |
/** @var array */
|
| 17 |
private static $debug;
|
| 18 |
private static $source_code;
|
|
|
|
| 19 |
|
| 20 |
public function __construct() {
|
| 21 |
parent::__construct();
|
| 22 |
|
| 23 |
self::$options = $this->getOptions();
|
| 24 |
|
| 25 |
-
|
| 26 |
}
|
| 27 |
|
| 28 |
public static function getUserID() {
|
|
@@ -66,13 +68,16 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 66 |
*
|
| 67 |
* @return array
|
| 68 |
*/
|
| 69 |
-
public static function getOptions() {
|
| 70 |
$default = array(
|
| 71 |
'sq_ver' => 0,
|
|
|
|
| 72 |
'sq_api' => '',
|
| 73 |
'sq_checkedissues' => 0,
|
| 74 |
'sq_areissues' => 0,
|
| 75 |
'sq_use' => 1,
|
|
|
|
|
|
|
| 76 |
'sq_post_types' => array(
|
| 77 |
'post', 'page', 'product', 'shopp_page_shopp-products'
|
| 78 |
),
|
|
@@ -80,6 +85,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 80 |
'sq_auto_canonical' => 1,
|
| 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',
|
|
@@ -103,6 +109,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 103 |
'images' => 1,
|
| 104 |
'videos' => 0,
|
| 105 |
),
|
|
|
|
| 106 |
'sq_sitemap_frequency' => 'weekly',
|
| 107 |
'sq_sitemap' => array(
|
| 108 |
'sitemap' => array('sitemap.xml', 1),
|
|
@@ -131,38 +138,20 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 131 |
'sq_auto_favicon' => 0,
|
| 132 |
'favicon' => '',
|
| 133 |
'sq_auto_twitter' => 0,
|
| 134 |
-
'sq_auto_twittersize' => 'summary',
|
| 135 |
'sq_auto_facebook' => 0,
|
| 136 |
'sq_og_locale' => 'en_US',
|
| 137 |
-
'sq_twitter_account' => '',
|
| 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,
|
| 146 |
'sq_auto_description' => 1,
|
| 147 |
-
'
|
| 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' => '',
|
| 158 |
-
'sq_alexa' => '',
|
| 159 |
// --
|
| 160 |
'active_help' => '',
|
| 161 |
'ignore_warn' => 0,
|
|
|
|
| 162 |
'sq_keyword_help' => 1,
|
| 163 |
'sq_keyword_information' => 0,
|
| 164 |
'sq_url_fix' => 1,
|
| 165 |
-
//
|
| 166 |
'sq_google_country' => 'com',
|
| 167 |
'sq_google_language' => 'en',
|
| 168 |
'sq_google_country_strict' => 0,
|
|
@@ -176,9 +165,198 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 176 |
//--
|
| 177 |
'sq_dashboard' => 0,
|
| 178 |
'sq_analytics' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
);
|
| 180 |
$options = json_decode(get_option(SQ_OPTION), true);
|
| 181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
if (is_array($options)) {
|
| 183 |
$options = @array_merge($default, $options);
|
| 184 |
return $options;
|
|
@@ -187,48 +365,139 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 187 |
return $default;
|
| 188 |
}
|
| 189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
/**
|
| 191 |
* Send completed tasks from tutorial
|
| 192 |
* @return array
|
| 193 |
*/
|
| 194 |
public static function getBriefOptions() {
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
$title = SQ_Tools::$options['sq_fp_title'];
|
| 200 |
-
$description = SQ_Tools::$options['sq_fp_description'];
|
| 201 |
-
}
|
| 202 |
return array(
|
| 203 |
'sq_version' => SQ_VERSION_ID,
|
| 204 |
-
'sq_use' =>
|
| 205 |
-
'
|
| 206 |
-
'
|
| 207 |
-
'
|
| 208 |
-
'
|
| 209 |
-
'
|
| 210 |
-
'
|
| 211 |
-
'
|
| 212 |
-
'
|
| 213 |
-
'
|
| 214 |
-
'
|
| 215 |
-
'
|
| 216 |
-
'
|
| 217 |
-
'
|
| 218 |
-
'
|
| 219 |
-
'
|
| 220 |
-
'
|
| 221 |
-
'
|
| 222 |
-
'
|
| 223 |
-
'
|
| 224 |
-
'
|
| 225 |
-
'
|
| 226 |
-
'
|
| 227 |
-
'
|
| 228 |
-
'
|
| 229 |
-
'
|
| 230 |
-
'
|
|
|
|
|
|
|
|
|
|
| 231 |
);
|
|
|
|
| 232 |
}
|
| 233 |
|
| 234 |
/**
|
|
@@ -246,11 +515,15 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 246 |
|
| 247 |
/**
|
| 248 |
* Set the header type
|
| 249 |
-
* @param
|
| 250 |
*/
|
| 251 |
public static function setHeader($type) {
|
| 252 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 253 |
return;
|
|
|
|
| 254 |
|
| 255 |
switch ($type) {
|
| 256 |
case 'json':
|
|
@@ -265,6 +538,9 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 265 |
case'text':
|
| 266 |
header("Content-type: text/plain");
|
| 267 |
break;
|
|
|
|
|
|
|
|
|
|
| 268 |
}
|
| 269 |
}
|
| 270 |
|
|
@@ -303,12 +579,12 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 303 |
/**
|
| 304 |
* Show the notices to WP
|
| 305 |
*
|
| 306 |
-
* @return
|
| 307 |
*/
|
| 308 |
public static function showNotices($message, $type = 'sq_notices') {
|
| 309 |
-
if (file_exists(_SQ_THEME_DIR_ . '
|
| 310 |
ob_start();
|
| 311 |
-
include(_SQ_THEME_DIR_ . '
|
| 312 |
$message = ob_get_contents();
|
| 313 |
ob_end_clean();
|
| 314 |
}
|
|
@@ -540,7 +816,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 540 |
if (function_exists('curl_exec')) {
|
| 541 |
$ch = curl_init($url);
|
| 542 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 543 |
-
curl_setopt($ch, CURLOPT_TIMEOUT,
|
| 544 |
curl_exec($ch);
|
| 545 |
|
| 546 |
$response['headers']['content-type'] = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
|
|
@@ -578,13 +854,13 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 578 |
public static function checkErrorSettings($count_only = false) {
|
| 579 |
if (current_user_can('manage_options')) {
|
| 580 |
|
| 581 |
-
$fixit = "<a href=\"javascript:void(0);\" onclick=\"%
|
| 582 |
|
| 583 |
/* IF SEO INDEX IS OFF */
|
| 584 |
if (self::getAutoSeoSquirrly()) {
|
| 585 |
self::$errors_count++;
|
| 586 |
if (!$count_only) {
|
| 587 |
-
|
| 588 |
}
|
| 589 |
}
|
| 590 |
|
|
@@ -595,7 +871,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 595 |
if (self::getDuplicateTitle()) {
|
| 596 |
self::$errors_count++;
|
| 597 |
if (!$count_only) {
|
| 598 |
-
|
| 599 |
}
|
| 600 |
}
|
| 601 |
|
|
@@ -603,7 +879,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 603 |
if (self::getDuplicateDescription()) {
|
| 604 |
self::$errors_count++;
|
| 605 |
if (!$count_only) {
|
| 606 |
-
|
| 607 |
}
|
| 608 |
}
|
| 609 |
|
|
@@ -611,7 +887,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 611 |
if (self::getDuplicateOG()) {
|
| 612 |
self::$errors_count++;
|
| 613 |
if (!$count_only) {
|
| 614 |
-
|
| 615 |
}
|
| 616 |
}
|
| 617 |
|
|
@@ -619,7 +895,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 619 |
if (self::getDuplicateTC()) {
|
| 620 |
self::$errors_count++;
|
| 621 |
if (!$count_only) {
|
| 622 |
-
|
| 623 |
}
|
| 624 |
}
|
| 625 |
}
|
|
@@ -628,20 +904,27 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 628 |
if (self::getPrivateBlog()) {
|
| 629 |
self::$errors_count++;
|
| 630 |
if (!$count_only) {
|
| 631 |
-
|
| 632 |
}
|
| 633 |
}
|
| 634 |
|
| 635 |
if (self::getBadLinkStructure()) {
|
| 636 |
self::$errors_count++;
|
| 637 |
if (!$count_only) {
|
| 638 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 639 |
}
|
| 640 |
}
|
| 641 |
|
| 642 |
if (self::$errors_count == 0) {
|
| 643 |
self::saveOptions('sq_areissues', 0);
|
| 644 |
-
|
| 645 |
} else {
|
| 646 |
self::saveOptions('sq_areissues', 1);
|
| 647 |
}
|
|
@@ -653,10 +936,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 653 |
* @return bool
|
| 654 |
*/
|
| 655 |
private static function getAutoSeoSquirrly() {
|
| 656 |
-
|
| 657 |
-
return ((int)self::$options['sq_use'] == 0);
|
| 658 |
-
|
| 659 |
-
return true;
|
| 660 |
}
|
| 661 |
|
| 662 |
/**
|
|
@@ -668,7 +948,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 668 |
return false;
|
| 669 |
}
|
| 670 |
|
| 671 |
-
if (self
|
| 672 |
|
| 673 |
if (self::$source_code <> '') {
|
| 674 |
preg_match_all("/<meta[\s+]property=[\"|\']og:url[\"|\'][\s+](content|value)=[\"|\']([^>]*)[\"|\'][^>]*>/i", self::$source_code, $out);
|
|
@@ -690,7 +970,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 690 |
return false;
|
| 691 |
}
|
| 692 |
|
| 693 |
-
if (self
|
| 694 |
|
| 695 |
if (self::$source_code <> '') {
|
| 696 |
preg_match_all("/<meta[\s+]name=[\"|\']twitter:card[\"|\'][\s+](content|value)=[\"|\']([^>]*)[\"|\'][^>]*>/i", self::$source_code, $out);
|
|
@@ -713,7 +993,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 713 |
}
|
| 714 |
$total = 0;
|
| 715 |
|
| 716 |
-
if (self
|
| 717 |
if (self::$source_code <> '') {
|
| 718 |
preg_match_all("/<meta[^>]*name=[\"|\']description[\"|\'][^>]*content=[\"]([^\"]*)[\"][^>]*>/i", self::$source_code, $out);
|
| 719 |
if (!empty($out) && isset($out[0]) && is_array($out[0])) {
|
|
@@ -739,7 +1019,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 739 |
}
|
| 740 |
$total = 0;
|
| 741 |
|
| 742 |
-
if (self
|
| 743 |
if (self::$source_code <> '') {
|
| 744 |
preg_match_all("/<title[^>]*>(.*)?<\/title>/i", self::$source_code, $out);
|
| 745 |
|
|
@@ -786,6 +1066,13 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 786 |
}
|
| 787 |
}
|
| 788 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 789 |
/**
|
| 790 |
* Support for i18n with wpml, polyglot or qtrans
|
| 791 |
*
|
|
@@ -819,6 +1106,47 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 819 |
return apply_filters('number_format_i18n', $formatted);
|
| 820 |
}
|
| 821 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 822 |
public static function getBrowserInfo() {
|
| 823 |
$ub = '';
|
| 824 |
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
|
@@ -882,34 +1210,41 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 882 |
/**
|
| 883 |
*
|
| 884 |
* @param string $url
|
| 885 |
-
* @return array
|
| 886 |
*/
|
| 887 |
public static function getSnippet($url) {
|
| 888 |
if ($url == '' || !function_exists('preg_match')) {
|
| 889 |
-
return;
|
| 890 |
}
|
| 891 |
|
| 892 |
-
|
|
|
|
| 893 |
$snippet = array();
|
| 894 |
-
$frontend = SQ_ObjController::getModel('SQ_Frontend');
|
| 895 |
|
| 896 |
-
if ($
|
| 897 |
-
$
|
|
|
|
|
|
|
|
|
|
| 898 |
}
|
| 899 |
|
| 900 |
-
if ($postid > 0) {
|
| 901 |
-
$frontend->setPost(get_post($postid));
|
| 902 |
-
$snippet['title'] = $frontend->getTitle();
|
| 903 |
-
$snippet['description'] = $frontend->getDescription();
|
| 904 |
-
$snippet['url'] = $url;
|
| 905 |
-
} elseif ($url == get_bloginfo('url')) {
|
| 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 |
} else {
|
| 915 |
$length = array('title' => 66,
|
|
@@ -935,7 +1270,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 935 |
$snippet['description'] = substr($snippet['description'], 0, ($length['description'] - 1)) . '...';
|
| 936 |
}
|
| 937 |
|
| 938 |
-
$snippet['url'] = $url;
|
| 939 |
if (strlen($snippet['url']) > $length['url'])
|
| 940 |
$snippet['url'] = substr($snippet['url'], 0, ($length['url'] - 1)) . '...';
|
| 941 |
|
|
@@ -950,13 +1285,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 950 |
*/
|
| 951 |
private function checkDebug() {
|
| 952 |
//if debug is called
|
| 953 |
-
if (self::getIsset('sq_debug')) {
|
| 954 |
-
if (self::getValue('sq_debug') == self::$options['sq_api']) {
|
| 955 |
-
$_GET['sq_debug'] = 'on';
|
| 956 |
-
} else {
|
| 957 |
-
$_GET['sq_debug'] = 'off';
|
| 958 |
-
}
|
| 959 |
-
|
| 960 |
if (self::getValue('sq_debug') === 'on') {
|
| 961 |
if (function_exists('register_shutdown_function')) {
|
| 962 |
register_shutdown_function(array($this, 'showDebug'));
|
|
@@ -1015,7 +1344,6 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 1015 |
* Show the debug dump
|
| 1016 |
*/
|
| 1017 |
public static function showDebug() {
|
| 1018 |
-
global $wp_query;
|
| 1019 |
echo "Debug result: <br />" . '<div id="wpcontent">' . @implode('<br />', self::$debug) . '</div>';
|
| 1020 |
|
| 1021 |
$run_time = number_format(microtime(true) - REQUEST_TIME, 3);
|
|
@@ -1031,6 +1359,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 1031 |
public function sq_activate() {
|
| 1032 |
set_transient('sq_activate', true);
|
| 1033 |
set_transient('sq_rewrite', true);
|
|
|
|
| 1034 |
}
|
| 1035 |
|
| 1036 |
public function sq_deactivate() {
|
|
@@ -1039,9 +1368,9 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 1039 |
|
| 1040 |
$args = array();
|
| 1041 |
$args['type'] = 'deact';
|
| 1042 |
-
|
| 1043 |
|
| 1044 |
-
remove_filter('rewrite_rules_array', array(
|
| 1045 |
global $wp_rewrite;
|
| 1046 |
$wp_rewrite->flush_rules();
|
| 1047 |
}
|
|
@@ -1064,7 +1393,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 1064 |
}
|
| 1065 |
|
| 1066 |
public static function checkUpgrade() {
|
| 1067 |
-
if (self
|
| 1068 |
//Delete the old versions table
|
| 1069 |
global $wpdb;
|
| 1070 |
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_fp_title' WHERE `meta_key` = 'sq_fp_title'");
|
|
@@ -1073,11 +1402,104 @@ class SQ_Tools extends SQ_FrontController {
|
|
| 1073 |
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_fp_keywords' WHERE `meta_key` = 'sq_fp_keywords'");
|
| 1074 |
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_post_keyword' WHERE `meta_key` = 'sq_post_keyword'");
|
| 1075 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1076 |
self::saveOptions('sq_ver', SQ_VERSION_ID);
|
| 1077 |
|
|
|
|
|
|
|
|
|
|
| 1078 |
global $wp_rewrite;
|
| 1079 |
$wp_rewrite->flush_rules();
|
| 1080 |
}
|
|
|
|
|
|
|
| 1081 |
}
|
| 1082 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1083 |
}
|
| 5 |
*
|
| 6 |
* @author Squirrly
|
| 7 |
*/
|
| 8 |
+
class SQ_Classes_Tools extends SQ_Classes_FrontController {
|
| 9 |
|
| 10 |
/** @var array Saved options in database */
|
| 11 |
public static $options = array();
|
| 12 |
+
public static $usermeta = array();
|
| 13 |
|
| 14 |
/** @var integer Count the errors in site */
|
| 15 |
static $errors_count;
|
| 17 |
/** @var array */
|
| 18 |
private static $debug;
|
| 19 |
private static $source_code;
|
| 20 |
+
public static $is_ajax = null;
|
| 21 |
|
| 22 |
public function __construct() {
|
| 23 |
parent::__construct();
|
| 24 |
|
| 25 |
self::$options = $this->getOptions();
|
| 26 |
|
| 27 |
+
$this->checkDebug(); //dev mode
|
| 28 |
}
|
| 29 |
|
| 30 |
public static function getUserID() {
|
| 68 |
*
|
| 69 |
* @return array
|
| 70 |
*/
|
| 71 |
+
public static function getOptions($action = '') {
|
| 72 |
$default = array(
|
| 73 |
'sq_ver' => 0,
|
| 74 |
+
'sq_token' => md5(home_url() . date('d')), //daily token
|
| 75 |
'sq_api' => '',
|
| 76 |
'sq_checkedissues' => 0,
|
| 77 |
'sq_areissues' => 0,
|
| 78 |
'sq_use' => 1,
|
| 79 |
+
'sq_use_frontend' => 1,
|
| 80 |
+
'sq_laterload' => 0,
|
| 81 |
'sq_post_types' => array(
|
| 82 |
'post', 'page', 'product', 'shopp_page_shopp-products'
|
| 83 |
),
|
| 85 |
'sq_auto_canonical' => 1,
|
| 86 |
'sq_auto_sitemap' => 0,
|
| 87 |
'sq_auto_feed' => 0,
|
| 88 |
+
'sq_auto_noindex' => 1,
|
| 89 |
'sq_auto_jsonld' => 0,
|
| 90 |
'sq_auto_amp' => 0,
|
| 91 |
'sq_jsonld_type' => 'Organization',
|
| 109 |
'images' => 1,
|
| 110 |
'videos' => 0,
|
| 111 |
),
|
| 112 |
+
'sq_sitemap_perpage' => 200,
|
| 113 |
'sq_sitemap_frequency' => 'weekly',
|
| 114 |
'sq_sitemap' => array(
|
| 115 |
'sitemap' => array('sitemap.xml', 1),
|
| 138 |
'sq_auto_favicon' => 0,
|
| 139 |
'favicon' => '',
|
| 140 |
'sq_auto_twitter' => 0,
|
|
|
|
| 141 |
'sq_auto_facebook' => 0,
|
| 142 |
'sq_og_locale' => 'en_US',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
// --
|
|
|
|
| 144 |
'sq_auto_title' => 1,
|
| 145 |
'sq_auto_description' => 1,
|
| 146 |
+
'sq_auto_keywords' => 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
// --
|
| 148 |
'active_help' => '',
|
| 149 |
'ignore_warn' => 0,
|
| 150 |
+
'sq_copyright_agreement' => 0,
|
| 151 |
'sq_keyword_help' => 1,
|
| 152 |
'sq_keyword_information' => 0,
|
| 153 |
'sq_url_fix' => 1,
|
| 154 |
+
//Ranking Option
|
| 155 |
'sq_google_country' => 'com',
|
| 156 |
'sq_google_language' => 'en',
|
| 157 |
'sq_google_country_strict' => 0,
|
| 165 |
//--
|
| 166 |
'sq_dashboard' => 0,
|
| 167 |
'sq_analytics' => 0,
|
| 168 |
+
|
| 169 |
+
'socials' => array(
|
| 170 |
+
'fb_admins' => array(),
|
| 171 |
+
'fbconnectkey' => "",
|
| 172 |
+
'fbadminapp' => "",
|
| 173 |
+
|
| 174 |
+
'facebook_site' => "",
|
| 175 |
+
'twitter_site' => "",
|
| 176 |
+
'twitter' => "",
|
| 177 |
+
'instagram_url' => "",
|
| 178 |
+
'linkedin_url' => "",
|
| 179 |
+
'myspace_url' => "",
|
| 180 |
+
'pinterest_url' => "",
|
| 181 |
+
'youtube_url' => "",
|
| 182 |
+
'google_plus_url' => "",
|
| 183 |
+
'twitter_card_type' => "summary",
|
| 184 |
+
'plus_publisher' => ""
|
| 185 |
+
),
|
| 186 |
+
|
| 187 |
+
'codes' => array(
|
| 188 |
+
'google_wt' => "",
|
| 189 |
+
'google_analytics' => "",
|
| 190 |
+
'facebook_pixel' => "",
|
| 191 |
+
|
| 192 |
+
'bing_wt' => "",
|
| 193 |
+
'pinterest_verify' => "",
|
| 194 |
+
'alexa_verify' => "",
|
| 195 |
+
),
|
| 196 |
+
|
| 197 |
+
'patterns' => array(
|
| 198 |
+
'home' => array(
|
| 199 |
+
'sep' => '|',
|
| 200 |
+
'title' => '{{sitename}} {{page}} {{sep}} {{sitedesc}}',
|
| 201 |
+
'description' => '{{excerpt}} {{page}} {{sep}} {{sitename}}',
|
| 202 |
+
'noindex' => 0,
|
| 203 |
+
'nofollow' => 0,
|
| 204 |
+
'disable' => 0,
|
| 205 |
+
),
|
| 206 |
+
'post' => array(
|
| 207 |
+
'sep' => '|',
|
| 208 |
+
'title' => '{{title}} {{page}}',
|
| 209 |
+
'description' => '{{excerpt}}',
|
| 210 |
+
'noindex' => 0,
|
| 211 |
+
'nofollow' => 0,
|
| 212 |
+
'disable' => 0,
|
| 213 |
+
),
|
| 214 |
+
'page' => array(
|
| 215 |
+
'sep' => '|',
|
| 216 |
+
'title' => '{{title}} {{page}} {{sep}} {{sitename}}',
|
| 217 |
+
'description' => '{{excerpt}}',
|
| 218 |
+
'noindex' => 0,
|
| 219 |
+
'nofollow' => 0,
|
| 220 |
+
'disable' => 0,
|
| 221 |
+
),
|
| 222 |
+
'category' => array(
|
| 223 |
+
'sep' => '|',
|
| 224 |
+
'title' => '{{category}} {{page}} {{sep}} {{sitename}}',
|
| 225 |
+
'description' => '{{category_description}}',
|
| 226 |
+
'noindex' => 0,
|
| 227 |
+
'nofollow' => 0,
|
| 228 |
+
'disable' => 0,
|
| 229 |
+
),
|
| 230 |
+
'tag' => array(
|
| 231 |
+
'sep' => '|',
|
| 232 |
+
'title' => '{{tag}} {{page}} {{sep}} {{sitename}}',
|
| 233 |
+
'description' => '{{excerpt}}',
|
| 234 |
+
'noindex' => 0,
|
| 235 |
+
'nofollow' => 0,
|
| 236 |
+
'disable' => 0,
|
| 237 |
+
),
|
| 238 |
+
'tax-post_format' => array(
|
| 239 |
+
'sep' => '|',
|
| 240 |
+
'title' => '{{term_title}} ' . __('Format', _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
|
| 241 |
+
'description' => '{{excerpt}}',
|
| 242 |
+
'noindex' => 0,
|
| 243 |
+
'nofollow' => 0,
|
| 244 |
+
'disable' => 0,
|
| 245 |
+
),
|
| 246 |
+
'tax-category' => array(
|
| 247 |
+
'sep' => '|',
|
| 248 |
+
'title' => '{{term_title}} ' . __('Category', _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
|
| 249 |
+
'description' => '{{excerpt}}',
|
| 250 |
+
'noindex' => 0,
|
| 251 |
+
'nofollow' => 0,
|
| 252 |
+
'disable' => 0,
|
| 253 |
+
),
|
| 254 |
+
'tax-post_tag' => array(
|
| 255 |
+
'sep' => '|',
|
| 256 |
+
'title' => '{{term_title}} ' . __('Tag', _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
|
| 257 |
+
'description' => '{{excerpt}}',
|
| 258 |
+
'noindex' => 0,
|
| 259 |
+
'nofollow' => 0,
|
| 260 |
+
'disable' => 0,
|
| 261 |
+
),
|
| 262 |
+
'tax-product_cat' => array(
|
| 263 |
+
'sep' => '|',
|
| 264 |
+
'title' => '{{term_title}} ' . __('Category', _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
|
| 265 |
+
'description' => '{{excerpt}}',
|
| 266 |
+
'noindex' => 0,
|
| 267 |
+
'nofollow' => 0,
|
| 268 |
+
'disable' => 0,
|
| 269 |
+
),
|
| 270 |
+
'tax-product_tag' => array(
|
| 271 |
+
'sep' => '|',
|
| 272 |
+
'title' => '{{term_title}} ' . __('Tag', _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
|
| 273 |
+
'description' => '{{excerpt}}',
|
| 274 |
+
'noindex' => 0,
|
| 275 |
+
'nofollow' => 0,
|
| 276 |
+
'disable' => 0,
|
| 277 |
+
),
|
| 278 |
+
'tax-product_shipping_class' => array(
|
| 279 |
+
'sep' => '|',
|
| 280 |
+
'title' => '{{term_title}} ' . __('Shipping Option', _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
|
| 281 |
+
'description' => '{{excerpt}}',
|
| 282 |
+
'noindex' => 0,
|
| 283 |
+
'nofollow' => 0,
|
| 284 |
+
'disable' => 0,
|
| 285 |
+
),
|
| 286 |
+
'profile' => array(
|
| 287 |
+
'sep' => '|',
|
| 288 |
+
'title' => '{{name}}, ' . __('Author at', _SQ_PLUGIN_NAME_) . ' {{sitename}} {{page}}',
|
| 289 |
+
'description' => '{{excerpt}}',
|
| 290 |
+
'noindex' => 0,
|
| 291 |
+
'nofollow' => 0,
|
| 292 |
+
'disable' => 0,
|
| 293 |
+
),
|
| 294 |
+
'shop' => array(
|
| 295 |
+
'sep' => '|',
|
| 296 |
+
'title' => '{{title}} {{page}} {{sep}} {{sitename}}',
|
| 297 |
+
'description' => '{{excerpt}}',
|
| 298 |
+
'noindex' => 0,
|
| 299 |
+
'nofollow' => 0,
|
| 300 |
+
'disable' => 0,
|
| 301 |
+
),
|
| 302 |
+
'product' => array(
|
| 303 |
+
'sep' => '|',
|
| 304 |
+
'title' => '{{title}} {{page}} {{sep}} {{sitename}}',
|
| 305 |
+
'description' => '{{excerpt}}',
|
| 306 |
+
'noindex' => 0,
|
| 307 |
+
'nofollow' => 0,
|
| 308 |
+
'disable' => 0,
|
| 309 |
+
),
|
| 310 |
+
'archive' => array(
|
| 311 |
+
'sep' => '|',
|
| 312 |
+
'title' => '{{date}} {{page}} {{sep}} {{sitename}}',
|
| 313 |
+
'description' => '{{excerpt}}',
|
| 314 |
+
'noindex' => 0,
|
| 315 |
+
'nofollow' => 0,
|
| 316 |
+
'disable' => 0,
|
| 317 |
+
),
|
| 318 |
+
'search' => array(
|
| 319 |
+
'sep' => '|',
|
| 320 |
+
'title' => __('You searched for', _SQ_PLUGIN_NAME_) . ' {{searchphrase}} {{page}} {{sep}} {{sitename}}',
|
| 321 |
+
'description' => '{{excerpt}}',
|
| 322 |
+
'noindex' => 1,
|
| 323 |
+
'nofollow' => 0,
|
| 324 |
+
'disable' => 0,
|
| 325 |
+
),
|
| 326 |
+
'attachment' => array(
|
| 327 |
+
'sep' => '|',
|
| 328 |
+
'title' => '{{title}} {{page}} {{sep}} {{sitename}}',
|
| 329 |
+
'description' => '{{excerpt}}',
|
| 330 |
+
'noindex' => 0,
|
| 331 |
+
'nofollow' => 0,
|
| 332 |
+
'disable' => 0,
|
| 333 |
+
),
|
| 334 |
+
'404' => array(
|
| 335 |
+
'sep' => '|',
|
| 336 |
+
'title' => __('Page not found', _SQ_PLUGIN_NAME_) . ' {{sep}} {{sitename}}',
|
| 337 |
+
'description' => '{{excerpt}}',
|
| 338 |
+
'noindex' => 1,
|
| 339 |
+
'nofollow' => 1,
|
| 340 |
+
'disable' => 0,
|
| 341 |
+
),
|
| 342 |
+
'custom' => array(
|
| 343 |
+
'sep' => '|',
|
| 344 |
+
'title' => '{{title}} {{page}} {{sep}} {{sitename}}',
|
| 345 |
+
'description' => '{{excerpt}}',
|
| 346 |
+
'noindex' => 0,
|
| 347 |
+
'nofollow' => 0,
|
| 348 |
+
'disable' => 0,
|
| 349 |
+
),
|
| 350 |
+
)
|
| 351 |
);
|
| 352 |
$options = json_decode(get_option(SQ_OPTION), true);
|
| 353 |
|
| 354 |
+
if ($action == 'reset') {
|
| 355 |
+
$init['sq_ver'] = $options['sq_ver'];
|
| 356 |
+
$init['sq_api'] = $options['sq_api'];
|
| 357 |
+
return $init;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
if (is_array($options)) {
|
| 361 |
$options = @array_merge($default, $options);
|
| 362 |
return $options;
|
| 365 |
return $default;
|
| 366 |
}
|
| 367 |
|
| 368 |
+
/**
|
| 369 |
+
* Get the option from database
|
| 370 |
+
* @param $key
|
| 371 |
+
* @return mixed
|
| 372 |
+
*/
|
| 373 |
+
public static function getOption($key) {
|
| 374 |
+
if (!isset(self::$options[$key])) {
|
| 375 |
+
self::$options = self::getOptions();
|
| 376 |
+
|
| 377 |
+
if (!isset(self::$options[$key])) {
|
| 378 |
+
self::$options[$key] = false;
|
| 379 |
+
}
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
return self::$options[$key];
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
/**
|
| 387 |
+
* Get user metas
|
| 388 |
+
* @param null $user_id
|
| 389 |
+
* @return array|mixed
|
| 390 |
+
*/
|
| 391 |
+
public static function getUserMetas($user_id = null) {
|
| 392 |
+
if (!isset($user_id)) {
|
| 393 |
+
$user_id = get_current_user_id();
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
$default = array('sq_auto_sticky' => 0,);
|
| 397 |
+
|
| 398 |
+
$usermeta = get_user_meta($user_id);
|
| 399 |
+
$usermetatmp = array();
|
| 400 |
+
if (is_array($usermeta)) foreach ($usermeta as $key => $values) {
|
| 401 |
+
$usermetatmp[$key] = $values[0];
|
| 402 |
+
}
|
| 403 |
+
$usermeta = $usermetatmp;
|
| 404 |
+
|
| 405 |
+
if (is_array($usermeta)) {
|
| 406 |
+
$usermeta = @array_merge($default, $usermeta);
|
| 407 |
+
} else {
|
| 408 |
+
$usermeta = $default;
|
| 409 |
+
}
|
| 410 |
+
self::$usermeta = $usermeta;
|
| 411 |
+
return $usermeta;
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
/**
|
| 415 |
+
* Get use meta
|
| 416 |
+
* @param $value
|
| 417 |
+
* @return bool
|
| 418 |
+
*/
|
| 419 |
+
public static function getUserMeta($value) {
|
| 420 |
+
if (!isset(self::$usermeta[$value])) {
|
| 421 |
+
self::getUserMetas();
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
if (isset(self::$usermeta[$value])) {
|
| 425 |
+
return self::$usermeta[$value];
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
return false;
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
/**
|
| 432 |
+
* Save user meta
|
| 433 |
+
* @param $key
|
| 434 |
+
* @param $value
|
| 435 |
+
* @param null $user_id
|
| 436 |
+
*/
|
| 437 |
+
public static function saveUserMeta($key, $value, $user_id = null) {
|
| 438 |
+
if (!isset($user_id)) {
|
| 439 |
+
$user_id = get_current_user_id();
|
| 440 |
+
}
|
| 441 |
+
self::$usermeta[$key] = $value;
|
| 442 |
+
update_user_meta($user_id, $key, $value);
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
/**
|
| 446 |
+
* Delete User meta
|
| 447 |
+
* @param $key
|
| 448 |
+
* @param null $user_id
|
| 449 |
+
*/
|
| 450 |
+
public static function deleteUserMeta($key, $user_id = null) {
|
| 451 |
+
if (!isset($user_id)) {
|
| 452 |
+
$user_id = get_current_user_id();
|
| 453 |
+
}
|
| 454 |
+
unset(self::$usermeta[$key]);
|
| 455 |
+
delete_user_meta($user_id, $key);
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
/**
|
| 459 |
* Send completed tasks from tutorial
|
| 460 |
* @return array
|
| 461 |
*/
|
| 462 |
public static function getBriefOptions() {
|
| 463 |
+
$jsonld = self::getOption('sq_jsonld');
|
| 464 |
+
$socials = self::getOption('socials');
|
| 465 |
+
$codes = self::getOption('codes');
|
| 466 |
+
|
|
|
|
|
|
|
|
|
|
| 467 |
return array(
|
| 468 |
'sq_version' => SQ_VERSION_ID,
|
| 469 |
+
'sq_use' => self::getOption('sq_use'),
|
| 470 |
+
'sq_token' => self::getOption('sq_token'),
|
| 471 |
+
'sq_checkedissues' => self::getOption('sq_checkedissues'),
|
| 472 |
+
'sq_areissues' => self::getOption('sq_areissues'),
|
| 473 |
+
'sq_auto_canonical' => self::getOption('sq_auto_canonical'),
|
| 474 |
+
'sq_auto_meta' => self::getOption('sq_auto_meta'),
|
| 475 |
+
'sq_auto_sitemap' => self::getOption('sq_auto_sitemap'),
|
| 476 |
+
'sq_auto_jsonld' => (self::getOption('sq_auto_jsonld') && ($jsonld['Organization']['name'] <> '' || $jsonld['Person']['name'] <> '')),
|
| 477 |
+
'sq_sitemap_ping' => SQ_Classes_Tools::getOption('sq_sitemap_ping'),
|
| 478 |
+
'sq_auto_robots' => SQ_Classes_Tools::getOption('sq_auto_robots'),
|
| 479 |
+
'sq_auto_favicon' => (SQ_Classes_Tools::getOption('sq_auto_favicon') && SQ_Classes_Tools::getOption('favicon') <> ''),
|
| 480 |
+
'sq_auto_twitter' => SQ_Classes_Tools::getOption('sq_auto_twitter'),
|
| 481 |
+
'sq_auto_facebook' => SQ_Classes_Tools::getOption('sq_auto_facebook'),
|
| 482 |
+
'sq_auto_seo' => 1,
|
| 483 |
+
'sq_auto_title' => (int)(SQ_Classes_Tools::getOption('sq_auto_title') == 1),
|
| 484 |
+
'sq_auto_description' => (int)(SQ_Classes_Tools::getOption('sq_auto_description') == 1),
|
| 485 |
+
'sq_auto_keywords' => (int)(SQ_Classes_Tools::getOption('sq_auto_keywords') == 1),
|
| 486 |
+
'sq_auto_noindex' => (int)(SQ_Classes_Tools::getOption('sq_auto_noindex') == 1),
|
| 487 |
+
'sq_google_plus' => (int)($socials['google_plus_url'] <> ''),
|
| 488 |
+
'sq_google_wt' => (int)($codes['google_wt'] <> ''),
|
| 489 |
+
'sq_google_analytics' => (int)($codes['google_analytics'] <> ''),
|
| 490 |
+
'sq_facebook_insights' => (int)(!empty($socials['sq_facebook_insights'])),
|
| 491 |
+
'sq_bing_wt' => (int)($codes['bing_wt'] <> ''),
|
| 492 |
+
'sq_pinterest' => (int)($codes['pinterest_verify'] <> ''),
|
| 493 |
+
'sq_alexa' => (int)($codes['alexa_verify'] <> ''),
|
| 494 |
+
'sq_keyword_help' => SQ_Classes_Tools::getOption('sq_keyword_help'),
|
| 495 |
+
'sq_keyword_information' => SQ_Classes_Tools::getOption('sq_keyword_information'),
|
| 496 |
+
'sq_google_country_strict' => SQ_Classes_Tools::getOption('sq_google_country_strict'),
|
| 497 |
+
'sq_keywordtag' => SQ_Classes_Tools::getOption('sq_keywordtag'),
|
| 498 |
+
'sq_local_images' => SQ_Classes_Tools::getOption('sq_local_images'),
|
| 499 |
);
|
| 500 |
+
|
| 501 |
}
|
| 502 |
|
| 503 |
/**
|
| 515 |
|
| 516 |
/**
|
| 517 |
* Set the header type
|
| 518 |
+
* @param string $type
|
| 519 |
*/
|
| 520 |
public static function setHeader($type) {
|
| 521 |
+
if (SQ_Classes_Tools::getValue('sq_debug') == 'on') {
|
| 522 |
+
if (self::isAjax()) {
|
| 523 |
+
header("Content-type: text/html");
|
| 524 |
+
}
|
| 525 |
return;
|
| 526 |
+
}
|
| 527 |
|
| 528 |
switch ($type) {
|
| 529 |
case 'json':
|
| 538 |
case'text':
|
| 539 |
header("Content-type: text/plain");
|
| 540 |
break;
|
| 541 |
+
case'html':
|
| 542 |
+
header("Content-type: text/html");
|
| 543 |
+
break;
|
| 544 |
}
|
| 545 |
}
|
| 546 |
|
| 579 |
/**
|
| 580 |
* Show the notices to WP
|
| 581 |
*
|
| 582 |
+
* @return string
|
| 583 |
*/
|
| 584 |
public static function showNotices($message, $type = 'sq_notices') {
|
| 585 |
+
if (file_exists(_SQ_THEME_DIR_ . 'Notices.php')) {
|
| 586 |
ob_start();
|
| 587 |
+
include(_SQ_THEME_DIR_ . 'Notices.php');
|
| 588 |
$message = ob_get_contents();
|
| 589 |
ob_end_clean();
|
| 590 |
}
|
| 816 |
if (function_exists('curl_exec')) {
|
| 817 |
$ch = curl_init($url);
|
| 818 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 819 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
| 820 |
curl_exec($ch);
|
| 821 |
|
| 822 |
$response['headers']['content-type'] = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
|
| 854 |
public static function checkErrorSettings($count_only = false) {
|
| 855 |
if (current_user_can('manage_options')) {
|
| 856 |
|
| 857 |
+
$fixit = "<a href=\"javascript:void(0);\" onclick=\"%sjQuery(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>";
|
| 858 |
|
| 859 |
/* IF SEO INDEX IS OFF */
|
| 860 |
if (self::getAutoSeoSquirrly()) {
|
| 861 |
self::$errors_count++;
|
| 862 |
if (!$count_only) {
|
| 863 |
+
SQ_Classes_Error::setError(__('Activate the Squirrly SEO for your blog (recommended)', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_use_on').trigger('click');", "sq_fixautoseo") . "", 'settings', 'sq_fix_auto');
|
| 864 |
}
|
| 865 |
}
|
| 866 |
|
| 871 |
if (self::getDuplicateTitle()) {
|
| 872 |
self::$errors_count++;
|
| 873 |
if (!$count_only) {
|
| 874 |
+
SQ_Classes_Error::setError(__('You have META Title Duplicates. Disable the Squirrly Title Optimization or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_title0').attr('checked', true); jQuery('#sq_automatically').attr('checked', true);", "sq_fix_titleduplicate") . "", 'settings', 'sq_fix_descduplicate');
|
| 875 |
}
|
| 876 |
}
|
| 877 |
|
| 879 |
if (self::getDuplicateDescription()) {
|
| 880 |
self::$errors_count++;
|
| 881 |
if (!$count_only) {
|
| 882 |
+
SQ_Classes_Error::setError(__('You have META Description Duplicates. Disable the Squirrly Description Optimization or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_description0').attr('checked', true); jQuery('#sq_automatically').attr('checked', true);", "sq_fix_descduplicate") . "", 'settings', 'sq_fix_descduplicate');
|
| 883 |
}
|
| 884 |
}
|
| 885 |
|
| 887 |
if (self::getDuplicateOG()) {
|
| 888 |
self::$errors_count++;
|
| 889 |
if (!$count_only) {
|
| 890 |
+
SQ_Classes_Error::setError(__('You have Open Graph META Duplicates. Disable the Squirrly SEO Open Graph or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_facebook0').attr('checked', true);", "sq_fix_ogduplicate") . "", 'settings', 'sq_fix_ogduplicate');
|
| 891 |
}
|
| 892 |
}
|
| 893 |
|
| 895 |
if (self::getDuplicateTC()) {
|
| 896 |
self::$errors_count++;
|
| 897 |
if (!$count_only) {
|
| 898 |
+
SQ_Classes_Error::setError(__('You have Twitter Card META Duplicates. Disable the Squirrly SEO Twitter Card or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_twitter0').attr('checked', true);", "sq_fix_tcduplicate") . "", 'settings', 'sq_fix_tcduplicate');
|
| 899 |
}
|
| 900 |
}
|
| 901 |
}
|
| 904 |
if (self::getPrivateBlog()) {
|
| 905 |
self::$errors_count++;
|
| 906 |
if (!$count_only) {
|
| 907 |
+
SQ_Classes_Error::setError(__('You\'re blocking google from indexing your site!', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_google_index1').attr('checked',true);", "sq_fixprivate") . "", 'settings', 'sq_fix_private');
|
| 908 |
}
|
| 909 |
}
|
| 910 |
|
| 911 |
if (self::getBadLinkStructure()) {
|
| 912 |
self::$errors_count++;
|
| 913 |
if (!$count_only) {
|
| 914 |
+
SQ_Classes_Error::setError(__('It is highly recommended that you include the %postname% variable in the permalink structure. <br />Go to Settings > Permalinks and add /%postname%/ in Custom Structure', _SQ_PLUGIN_NAME_) . " <br /> ", 'settings');
|
| 915 |
+
}
|
| 916 |
+
}
|
| 917 |
+
|
| 918 |
+
if (self::getDefaultTagline()) {
|
| 919 |
+
self::$errors_count++;
|
| 920 |
+
if (!$count_only) {
|
| 921 |
+
SQ_Classes_Error::setError(__('It is highly recommended to change or remove the default Wordpress Tagline. <br />Go to Settings > General > Tagline', _SQ_PLUGIN_NAME_) . " <br /> ", 'settings');
|
| 922 |
}
|
| 923 |
}
|
| 924 |
|
| 925 |
if (self::$errors_count == 0) {
|
| 926 |
self::saveOptions('sq_areissues', 0);
|
| 927 |
+
SQ_Classes_Error::setError(__('Great! We didn\'t find any issue in your site.', _SQ_PLUGIN_NAME_) . " <br /> ", 'success');
|
| 928 |
} else {
|
| 929 |
self::saveOptions('sq_areissues', 1);
|
| 930 |
}
|
| 936 |
* @return bool
|
| 937 |
*/
|
| 938 |
private static function getAutoSeoSquirrly() {
|
| 939 |
+
return (!self::getOption('sq_use'));
|
|
|
|
|
|
|
|
|
|
| 940 |
}
|
| 941 |
|
| 942 |
/**
|
| 948 |
return false;
|
| 949 |
}
|
| 950 |
|
| 951 |
+
if (self::getOption('sq_use') && self::getOption('sq_auto_facebook')) {
|
| 952 |
|
| 953 |
if (self::$source_code <> '') {
|
| 954 |
preg_match_all("/<meta[\s+]property=[\"|\']og:url[\"|\'][\s+](content|value)=[\"|\']([^>]*)[\"|\'][^>]*>/i", self::$source_code, $out);
|
| 970 |
return false;
|
| 971 |
}
|
| 972 |
|
| 973 |
+
if (self::getOption('sq_use') && self::getOption('sq_auto_twitter')) {
|
| 974 |
|
| 975 |
if (self::$source_code <> '') {
|
| 976 |
preg_match_all("/<meta[\s+]name=[\"|\']twitter:card[\"|\'][\s+](content|value)=[\"|\']([^>]*)[\"|\'][^>]*>/i", self::$source_code, $out);
|
| 993 |
}
|
| 994 |
$total = 0;
|
| 995 |
|
| 996 |
+
if (self::getOption('sq_use') && self::$options['sq_auto_description'] == 1) {
|
| 997 |
if (self::$source_code <> '') {
|
| 998 |
preg_match_all("/<meta[^>]*name=[\"|\']description[\"|\'][^>]*content=[\"]([^\"]*)[\"][^>]*>/i", self::$source_code, $out);
|
| 999 |
if (!empty($out) && isset($out[0]) && is_array($out[0])) {
|
| 1019 |
}
|
| 1020 |
$total = 0;
|
| 1021 |
|
| 1022 |
+
if (self::getOption('sq_use') && self::$options['sq_auto_title'] == 1) {
|
| 1023 |
if (self::$source_code <> '') {
|
| 1024 |
preg_match_all("/<title[^>]*>(.*)?<\/title>/i", self::$source_code, $out);
|
| 1025 |
|
| 1066 |
}
|
| 1067 |
}
|
| 1068 |
|
| 1069 |
+
private static function getDefaultTagline() {
|
| 1070 |
+
$blog_description = get_bloginfo('description');
|
| 1071 |
+
$default_blog_description = 'Just another WordPress site';
|
| 1072 |
+
$translated_blog_description = __('Just another WordPress site');
|
| 1073 |
+
return $translated_blog_description === $blog_description || $default_blog_description === $blog_description;
|
| 1074 |
+
}
|
| 1075 |
+
|
| 1076 |
/**
|
| 1077 |
* Support for i18n with wpml, polyglot or qtrans
|
| 1078 |
*
|
| 1106 |
return apply_filters('number_format_i18n', $formatted);
|
| 1107 |
}
|
| 1108 |
|
| 1109 |
+
public static function clearTitle($title) {
|
| 1110 |
+
if ($title <> '') {
|
| 1111 |
+
$title = str_replace(array("\n", " "), " ", $title);
|
| 1112 |
+
|
| 1113 |
+
$title = self::i18n(trim(esc_html(ent2ncr(strip_tags($title)))));
|
| 1114 |
+
$title = addcslashes($title, '$');
|
| 1115 |
+
|
| 1116 |
+
$title = preg_replace('/\s{2,}/', ' ', $title);
|
| 1117 |
+
}
|
| 1118 |
+
return $title;
|
| 1119 |
+
}
|
| 1120 |
+
|
| 1121 |
+
public static function clearDescription($description) {
|
| 1122 |
+
if ($description <> '') {
|
| 1123 |
+
|
| 1124 |
+
|
| 1125 |
+
if (function_exists('preg_replace')) {
|
| 1126 |
+
$search = array("'<script[^>]*?>.*?<\/script>'si", // strip out javascript
|
| 1127 |
+
"/<form.*?<\/form>/si",
|
| 1128 |
+
"/<iframe.*?<\/iframe>/si",
|
| 1129 |
+
);
|
| 1130 |
+
$description = preg_replace($search, "", $description);
|
| 1131 |
+
$search = array(
|
| 1132 |
+
"/[\n\r]/si",
|
| 1133 |
+
"/ /si",
|
| 1134 |
+
"/\s{2,}/",
|
| 1135 |
+
);
|
| 1136 |
+
$description = preg_replace($search, " ", $description);
|
| 1137 |
+
}
|
| 1138 |
+
|
| 1139 |
+
$description = self::i18n(trim(esc_html(ent2ncr(strip_tags($description)))));
|
| 1140 |
+
$description = addcslashes($description, '$');
|
| 1141 |
+
}
|
| 1142 |
+
|
| 1143 |
+
return $description;
|
| 1144 |
+
}
|
| 1145 |
+
|
| 1146 |
+
public static function clearKeywords($keywords) {
|
| 1147 |
+
return self::clearTitle($keywords);
|
| 1148 |
+
}
|
| 1149 |
+
|
| 1150 |
public static function getBrowserInfo() {
|
| 1151 |
$ub = '';
|
| 1152 |
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
| 1210 |
/**
|
| 1211 |
*
|
| 1212 |
* @param string $url
|
| 1213 |
+
* @return array | false
|
| 1214 |
*/
|
| 1215 |
public static function getSnippet($url) {
|
| 1216 |
if ($url == '' || !function_exists('preg_match')) {
|
| 1217 |
+
return false;
|
| 1218 |
}
|
| 1219 |
|
| 1220 |
+
|
| 1221 |
+
$post_id = 0;
|
| 1222 |
$snippet = array();
|
|
|
|
| 1223 |
|
| 1224 |
+
if ($post_id == 0) {
|
| 1225 |
+
$post_id = url_to_postid($url);
|
| 1226 |
+
} elseif ($url == get_bloginfo('url')) {
|
| 1227 |
+
if (!$post_id = get_option('page_on_front'))
|
| 1228 |
+
($post_id = get_option('page_for_posts'));
|
| 1229 |
}
|
| 1230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1231 |
|
| 1232 |
+
if ($post_id > 0) {
|
| 1233 |
+
if ($post = SQ_Classes_ObjController::getClass('SQ_Controllers_Menu')->setPostByID($post_id)) {
|
| 1234 |
+
$snippet['title'] = (self::getOption('sq_auto_title') ? $post->sq->title : $post->post_title);
|
| 1235 |
+
$snippet['description'] = (self::getOption('sq_auto_description') ? $post->sq->description : $post->post_excerpt);
|
| 1236 |
+
$snippet['url'] = $url;
|
| 1237 |
+
}
|
| 1238 |
+
} elseif ($url == home_url()) {
|
| 1239 |
+
$post = SQ_Classes_ObjController::getDomain('SQ_Models_Domain_Post');
|
| 1240 |
+
$post->debug = 'isHomePage';
|
| 1241 |
+
$post->post_type = 'home';
|
| 1242 |
+
$post->hash = md5('wp_homepage');
|
| 1243 |
+
$post->url = home_url();
|
| 1244 |
+
|
| 1245 |
+
$post = SQ_Classes_ObjController::getClass('SQ_Models_Frontend')->setPost($post)->getPost();
|
| 1246 |
+
$snippet['title'] = (self::getOption('sq_auto_title') ? $post->sq->title : get_bloginfo('name'));
|
| 1247 |
+
$snippet['description'] = (self::getOption('sq_auto_description') ? $post->sq->description : get_bloginfo('description'));
|
| 1248 |
$snippet['url'] = $url;
|
| 1249 |
} else {
|
| 1250 |
$length = array('title' => 66,
|
| 1270 |
$snippet['description'] = substr($snippet['description'], 0, ($length['description'] - 1)) . '...';
|
| 1271 |
}
|
| 1272 |
|
| 1273 |
+
$snippet['url'] = urldecode($url);
|
| 1274 |
if (strlen($snippet['url']) > $length['url'])
|
| 1275 |
$snippet['url'] = substr($snippet['url'], 0, ($length['url'] - 1)) . '...';
|
| 1276 |
|
| 1285 |
*/
|
| 1286 |
private function checkDebug() {
|
| 1287 |
//if debug is called
|
| 1288 |
+
if (SQ_DEBUG && self::getIsset('sq_debug')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1289 |
if (self::getValue('sq_debug') === 'on') {
|
| 1290 |
if (function_exists('register_shutdown_function')) {
|
| 1291 |
register_shutdown_function(array($this, 'showDebug'));
|
| 1344 |
* Show the debug dump
|
| 1345 |
*/
|
| 1346 |
public static function showDebug() {
|
|
|
|
| 1347 |
echo "Debug result: <br />" . '<div id="wpcontent">' . @implode('<br />', self::$debug) . '</div>';
|
| 1348 |
|
| 1349 |
$run_time = number_format(microtime(true) - REQUEST_TIME, 3);
|
| 1359 |
public function sq_activate() {
|
| 1360 |
set_transient('sq_activate', true);
|
| 1361 |
set_transient('sq_rewrite', true);
|
| 1362 |
+
set_transient('sq_import', true);
|
| 1363 |
}
|
| 1364 |
|
| 1365 |
public function sq_deactivate() {
|
| 1368 |
|
| 1369 |
$args = array();
|
| 1370 |
$args['type'] = 'deact';
|
| 1371 |
+
SQ_Classes_Action::apiCall('sq/user/log', $args, 5);
|
| 1372 |
|
| 1373 |
+
remove_filter('rewrite_rules_array', array(SQ_Classes_ObjController::getClass('SQ_Core_BlockSettingsSeo'), 'rewrite_rules'));
|
| 1374 |
global $wp_rewrite;
|
| 1375 |
$wp_rewrite->flush_rules();
|
| 1376 |
}
|
| 1393 |
}
|
| 1394 |
|
| 1395 |
public static function checkUpgrade() {
|
| 1396 |
+
if (self::getOption('sq_ver') == 0 || self::getOption('sq_ver') < SQ_VERSION_ID) {
|
| 1397 |
//Delete the old versions table
|
| 1398 |
global $wpdb;
|
| 1399 |
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_fp_title' WHERE `meta_key` = 'sq_fp_title'");
|
| 1402 |
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_fp_keywords' WHERE `meta_key` = 'sq_fp_keywords'");
|
| 1403 |
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_post_keyword' WHERE `meta_key` = 'sq_post_keyword'");
|
| 1404 |
|
| 1405 |
+
if (self::getOption('sq_ver') < 8200) {
|
| 1406 |
+
self::createTable();
|
| 1407 |
+
|
| 1408 |
+
//Import the SEO from the old format to the new format
|
| 1409 |
+
$seo = SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->importDBSeo('squirrly-seo');
|
| 1410 |
+
if (!empty($seo)) {
|
| 1411 |
+
foreach ($seo as $sq_hash => $metas) {
|
| 1412 |
+
SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->db_insert(
|
| 1413 |
+
(isset($metas['url']) ? $metas['url'] : ''),
|
| 1414 |
+
$sq_hash,
|
| 1415 |
+
(int)$metas['post_id'],
|
| 1416 |
+
maybe_serialize($metas),
|
| 1417 |
+
gmdate('Y-m-d H:i:s'));
|
| 1418 |
+
}
|
| 1419 |
+
}
|
| 1420 |
+
|
| 1421 |
+
//Import the settings from the old format to the new format
|
| 1422 |
+
SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->importDBSettings('squirrly-seo');
|
| 1423 |
+
}
|
| 1424 |
+
|
| 1425 |
+
|
| 1426 |
self::saveOptions('sq_ver', SQ_VERSION_ID);
|
| 1427 |
|
| 1428 |
+
self::getOptions();
|
| 1429 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(self::getBriefOptions())), 10);
|
| 1430 |
+
|
| 1431 |
global $wp_rewrite;
|
| 1432 |
$wp_rewrite->flush_rules();
|
| 1433 |
}
|
| 1434 |
+
|
| 1435 |
+
|
| 1436 |
}
|
| 1437 |
|
| 1438 |
+
public static function isAjax() {
|
| 1439 |
+
if (isset(self::$is_ajax)) {
|
| 1440 |
+
return self::$is_ajax;
|
| 1441 |
+
}
|
| 1442 |
+
|
| 1443 |
+
self::$is_ajax = false;
|
| 1444 |
+
|
| 1445 |
+
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
| 1446 |
+
self::$is_ajax = true;
|
| 1447 |
+
} else {
|
| 1448 |
+
$url = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false);
|
| 1449 |
+
if ($url && (strpos($url, str_replace(get_bloginfo('url'), '', admin_url('admin-ajax.php', 'relative'))) !== false)) {
|
| 1450 |
+
self::$is_ajax = true;
|
| 1451 |
+
}
|
| 1452 |
+
}
|
| 1453 |
+
return self::$is_ajax;
|
| 1454 |
+
}
|
| 1455 |
+
|
| 1456 |
+
public static function isPluginInstalled($name) {
|
| 1457 |
+
switch ($name) {
|
| 1458 |
+
case 'instapage':
|
| 1459 |
+
return defined('INSTAPAGE_PLUGIN_PATH');
|
| 1460 |
+
break;
|
| 1461 |
+
case 'quick-seo':
|
| 1462 |
+
return defined('QSS_VERSION') && defined('_QSS_ROOT_DIR_');
|
| 1463 |
+
break;
|
| 1464 |
+
case 'premium-seo-pack':
|
| 1465 |
+
return defined('PSP_VERSION') && defined('_PSP_ROOT_DIR_');
|
| 1466 |
+
break;
|
| 1467 |
+
}
|
| 1468 |
+
}
|
| 1469 |
+
|
| 1470 |
+
public static function isFrontAdmin() {
|
| 1471 |
+
return (!is_admin() && is_user_logged_in());
|
| 1472 |
+
}
|
| 1473 |
+
|
| 1474 |
+
public static function createTable() {
|
| 1475 |
+
global $wpdb, $charset_collate;
|
| 1476 |
+
$sq_table_query = 'CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . strtolower(_SQ_DB_) . ' (
|
| 1477 |
+
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
| 1478 |
+
`blog_id` INT(10) NOT NULL,
|
| 1479 |
+
`post_id` bigint(20) NOT NULL DEFAULT 0 ,
|
| 1480 |
+
`URL` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
| 1481 |
+
`url_hash` VARCHAR(32) NOT NULL,
|
| 1482 |
+
`seo` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
| 1483 |
+
`date_time` DATETIME NOT NULL,
|
| 1484 |
+
PRIMARY KEY(id),
|
| 1485 |
+
UNIQUE url_hash(url_hash) USING BTREE,
|
| 1486 |
+
INDEX post_id(post_id) USING BTREE,
|
| 1487 |
+
INDEX blog_id_url_hash(blog_id, url_hash) USING BTREE
|
| 1488 |
+
) CHARACTER SET utf8 COLLATE utf8_general_ci';
|
| 1489 |
+
|
| 1490 |
+
if (file_exists(ABSPATH . 'wp-admin/includes/upgrade.php')) {
|
| 1491 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
| 1492 |
+
if (function_exists('dbDelta')) {
|
| 1493 |
+
dbDelta($sq_table_query, true);
|
| 1494 |
+
$count = $wpdb->get_row("SELECT count(*) as count
|
| 1495 |
+
FROM information_schema.columns
|
| 1496 |
+
WHERE table_name = '" . $wpdb->prefix . strtolower(_SQ_DB_) . "'
|
| 1497 |
+
AND column_name = 'post_id';");
|
| 1498 |
+
|
| 1499 |
+
if ($count->count == 0) {
|
| 1500 |
+
$wpdb->query("ALTER TABLE " . $wpdb->prefix . strtolower(_SQ_DB_) . " ADD COLUMN `post_id` bigint(20) NOT NULL DEFAULT 0");
|
| 1501 |
+
}
|
| 1502 |
+
}
|
| 1503 |
+
}
|
| 1504 |
+
}
|
| 1505 |
}
|
config/config.php
CHANGED
|
@@ -4,33 +4,79 @@
|
|
| 4 |
* The configuration file
|
| 5 |
*/
|
| 6 |
define('_SQ_SUPPORT_EMAIL_', 'support@squirrly.co');
|
| 7 |
-
if (defined('
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
}
|
|
|
|
| 12 |
define('_SQ_MOBILE_ICON_SIZES', '76,120,152');
|
| 13 |
define('REQUEST_TIME', microtime(true));
|
| 14 |
|
| 15 |
|
| 16 |
if (!defined('PHP_VERSION_ID')) {
|
| 17 |
$version = explode('.', PHP_VERSION);
|
| 18 |
-
define('PHP_VERSION_ID', ((int)
|
| 19 |
}
|
| 20 |
if (!defined('WP_VERSION_ID') && isset($wp_version)) {
|
| 21 |
$version = explode('.', $wp_version);
|
| 22 |
-
define('WP_VERSION_ID', ((int)
|
| 23 |
}
|
| 24 |
if (!defined('WP_VERSION_ID'))
|
| 25 |
define('WP_VERSION_ID', '3000');
|
| 26 |
|
| 27 |
if (!defined('SQ_VERSION_ID')) {
|
| 28 |
-
|
| 29 |
-
define('SQ_VERSION_ID', ((int) @$version[0] * 1000 + (int) @$version[1] * 100 + ((isset($version[2])) ? ((int) $version[2] * 10) : 0)));
|
| 30 |
}
|
| 31 |
|
|
|
|
| 32 |
/* No path file? error ... */
|
| 33 |
require_once(dirname(__FILE__) . '/paths.php');
|
| 34 |
|
| 35 |
/* Define the record name in the Option and UserMeta tables */
|
| 36 |
define('SQ_OPTION', 'sq_options');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
* The configuration file
|
| 5 |
*/
|
| 6 |
define('_SQ_SUPPORT_EMAIL_', 'support@squirrly.co');
|
| 7 |
+
if (!defined('_SQ_NONCE_ID_')) {
|
| 8 |
+
if (defined('NONCE_KEY')) {
|
| 9 |
+
define('_SQ_NONCE_ID_', NONCE_KEY);
|
| 10 |
+
} else {
|
| 11 |
+
define('_SQ_NONCE_ID_', md5(date('Y-d')));
|
| 12 |
+
}
|
| 13 |
}
|
| 14 |
+
defined('SQ_DEBUG') || define('SQ_DEBUG', 0);
|
| 15 |
define('_SQ_MOBILE_ICON_SIZES', '76,120,152');
|
| 16 |
define('REQUEST_TIME', microtime(true));
|
| 17 |
|
| 18 |
|
| 19 |
if (!defined('PHP_VERSION_ID')) {
|
| 20 |
$version = explode('.', PHP_VERSION);
|
| 21 |
+
define('PHP_VERSION_ID', ((int)@$version[0] * 1000 + (int)@$version[1] * 100 + ((isset($version[2])) ? ((int)$version[2] * 10) : 0)));
|
| 22 |
}
|
| 23 |
if (!defined('WP_VERSION_ID') && isset($wp_version)) {
|
| 24 |
$version = explode('.', $wp_version);
|
| 25 |
+
define('WP_VERSION_ID', ((int)@$version[0] * 1000 + (int)@$version[1] * 100 + ((isset($version[2])) ? ((int)$version[2] * 10) : 0)));
|
| 26 |
}
|
| 27 |
if (!defined('WP_VERSION_ID'))
|
| 28 |
define('WP_VERSION_ID', '3000');
|
| 29 |
|
| 30 |
if (!defined('SQ_VERSION_ID')) {
|
| 31 |
+
define('SQ_VERSION_ID', (int)number_format(str_replace('.', '', SQ_VERSION), 0, '', ''));
|
|
|
|
| 32 |
}
|
| 33 |
|
| 34 |
+
|
| 35 |
/* No path file? error ... */
|
| 36 |
require_once(dirname(__FILE__) . '/paths.php');
|
| 37 |
|
| 38 |
/* Define the record name in the Option and UserMeta tables */
|
| 39 |
define('SQ_OPTION', 'sq_options');
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
define('SQ_ALL_PATTERNS', json_encode(array(
|
| 43 |
+
'{{date}}' => __("Displays the date of the post/page once it's published", _SQ_PLUGIN_NAME_),
|
| 44 |
+
'{{title}}' => __("Adds the title of the post/page once it’s published", _SQ_PLUGIN_NAME_),
|
| 45 |
+
'{{page}}' => __("Displays the number of the current page (i.e. 1 of 6)", _SQ_PLUGIN_NAME_),
|
| 46 |
+
'{{parent_title}}' => __('Adds the title of a page\'s parent page', _SQ_PLUGIN_NAME_),
|
| 47 |
+
'{{sitename}}' => __("Adds the site's name to the post description", _SQ_PLUGIN_NAME_),
|
| 48 |
+
'{{sitedesc}}' => __("Adds the tagline/description of your site", _SQ_PLUGIN_NAME_),
|
| 49 |
+
'{{excerpt}}' => __("Will display an excerpt from the post/page (if not customized, the excerpt will be auto-generated)", _SQ_PLUGIN_NAME_),
|
| 50 |
+
'{{excerpt_only}}' => __("Will display an excerpt from the post/page (no auto-generation)", _SQ_PLUGIN_NAME_),
|
| 51 |
+
'{{tag}}' => __("Adds the current tag(s) to the post description", _SQ_PLUGIN_NAME_),
|
| 52 |
+
'{{category}}' => __("Adds the post category (several categories will be comma-separated)", _SQ_PLUGIN_NAME_),
|
| 53 |
+
'{{primary_category}}' => __("Adds the primary category of the post/page", _SQ_PLUGIN_NAME_),
|
| 54 |
+
'{{category_description}}' => __("Adds the category description to the post description", _SQ_PLUGIN_NAME_),
|
| 55 |
+
'{{tag_description}}' => __("Adds the tag description", _SQ_PLUGIN_NAME_),
|
| 56 |
+
'{{term_description}}' => __("Adds the term description", _SQ_PLUGIN_NAME_),
|
| 57 |
+
'{{term_title}}' => __("Adds the term name", _SQ_PLUGIN_NAME_),
|
| 58 |
+
'{{searchphrase}}' => __("Displays the search phrase (if it appears in the post)", _SQ_PLUGIN_NAME_),
|
| 59 |
+
'{{sep}}' => __("Places a separator between the elements of the post description", _SQ_PLUGIN_NAME_),
|
| 60 |
+
'{{modified}}' => __("Replaces the publication date of a post/page with the modified one", _SQ_PLUGIN_NAME_),
|
| 61 |
+
'{{name}}' => __("Displays the author's nicename", _SQ_PLUGIN_NAME_),
|
| 62 |
+
'{{user_description}}' => __("Adds the author's biographical info to the post description", _SQ_PLUGIN_NAME_),
|
| 63 |
+
'{{currentdate}}' => __("Displays the current date of a post/page", _SQ_PLUGIN_NAME_),
|
| 64 |
+
'{{keyword}}' => __("Adds the post's keyword to the post description", _SQ_PLUGIN_NAME_),
|
| 65 |
+
)));
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
define('SQ_ALL_SEP', json_encode(array(
|
| 69 |
+
'sc-dash' => '-',
|
| 70 |
+
'sc-ndash' => '–',
|
| 71 |
+
'sc-mdash' => '—',
|
| 72 |
+
'sc-middot' => '·',
|
| 73 |
+
'sc-bull' => '•',
|
| 74 |
+
'sc-star' => '*',
|
| 75 |
+
'sc-smstar' => '⋆',
|
| 76 |
+
'sc-pipe' => '|',
|
| 77 |
+
'sc-tilde' => '~',
|
| 78 |
+
'sc-laquo' => '«',
|
| 79 |
+
'sc-raquo' => '»',
|
| 80 |
+
'sc-lt' => '<',
|
| 81 |
+
'sc-gt' => '>',
|
| 82 |
+
)));
|
config/paths.php
CHANGED
|
@@ -3,12 +3,13 @@
|
|
| 3 |
$currentDir = dirname(__FILE__);
|
| 4 |
|
| 5 |
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 |
$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',
|
| 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/');
|
|
@@ -25,13 +26,11 @@ 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('
|
| 29 |
-
define('_SQ_THEME_DIR_', _SQ_ROOT_DIR_ . '/themes/' . _THEME_NAME_ . '/');
|
| 30 |
|
| 31 |
/* URLS */
|
| 32 |
define('_SQ_URL_', plugins_url('', $currentDir));
|
| 33 |
-
define('
|
| 34 |
-
define('_SQ_THEME_URL_', _SQ_URL_ . '/themes/' . _THEME_NAME_ . '/');
|
| 35 |
|
| 36 |
|
| 37 |
$upload_dir = wp_upload_dir();
|
| 3 |
$currentDir = dirname(__FILE__);
|
| 4 |
|
| 5 |
define('_SQ_NAME_', 'squirrly');
|
| 6 |
+
define('_SQ_NAMESPACE_', 'SQ');
|
| 7 |
+
define('_SQ_DB_', 'QSS');
|
| 8 |
define('_SQ_PLUGIN_NAME_', 'squirrly-seo'); //THIS LINE WILL BE CHANGED WITH THE USER SETTINGS
|
|
|
|
| 9 |
|
| 10 |
$scheme = (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") || (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN)) ? 'https:' : 'http:'); //CHECK IF SCURE
|
| 11 |
defined('_SQ_DASH_URL_') || define('_SQ_DASH_URL_', 'https://my.squirrly.co/');
|
| 12 |
+
defined('SQ_URI') || define('SQ_URI', 'wp480');
|
| 13 |
defined('_SQ_API_URL_') || define('_SQ_API_URL_', '//api.squirrly.co/');
|
| 14 |
|
| 15 |
defined('_SQ_STATIC_API_URL_') || define('_SQ_STATIC_API_URL_', '//storage.googleapis.com/squirrly/');
|
| 26 |
define('_SQ_SERVICE_DIR_', _SQ_MODEL_DIR_ . '/services/');
|
| 27 |
define('_SQ_TRANSLATIONS_DIR_', _SQ_ROOT_DIR_ . '/translations/');
|
| 28 |
define('_SQ_CORE_DIR_', _SQ_ROOT_DIR_ . '/core/');
|
| 29 |
+
define('_SQ_THEME_DIR_', _SQ_ROOT_DIR_ . '/view/');
|
|
|
|
| 30 |
|
| 31 |
/* URLS */
|
| 32 |
define('_SQ_URL_', plugins_url('', $currentDir));
|
| 33 |
+
define('_SQ_THEME_URL_', _SQ_URL_ . '/view/');
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
$upload_dir = wp_upload_dir();
|
controllers/Api.php
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class SQ_Controllers_Api extends SQ_Classes_FrontController {
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* Initialize the TinyMCE editor for the current use
|
| 8 |
+
*
|
| 9 |
+
* @return void
|
| 10 |
+
*/
|
| 11 |
+
public function hookInit() {
|
| 12 |
+
|
| 13 |
+
if (SQ_Classes_Tools::getOption('sq_api') == '')
|
| 14 |
+
return;
|
| 15 |
+
|
| 16 |
+
//Change the rest api if needed
|
| 17 |
+
add_action('rest_api_init', array($this, 'sqApiCall'));
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
function sqApiCall() {
|
| 22 |
+
if (function_exists('register_rest_route')) {
|
| 23 |
+
register_rest_route('save', '/post/', array(
|
| 24 |
+
'methods' => WP_REST_Server::EDITABLE,
|
| 25 |
+
'callback' => array($this, 'savePost'),
|
| 26 |
+
));
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
public function savePost($request) {
|
| 32 |
+
SQ_Classes_Tools::setHeader('json');
|
| 33 |
+
$token = $request->get_param('token');
|
| 34 |
+
if ($token <> '') {
|
| 35 |
+
$token = sanitize_text_field($token);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
if (SQ_Classes_Tools::getOption('sq_token') <> $token) {
|
| 39 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 40 |
+
exit(json_encode(array('error' => __('Connection expired. Please try again', _SQ_PLUGIN_NAME_))));
|
| 41 |
+
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
$post = $request->get_param('post');
|
| 45 |
+
if ($post = json_decode($post)) {
|
| 46 |
+
if (isset($post->ID) && $post->ID > 0) {
|
| 47 |
+
$post = new WP_Post($post);
|
| 48 |
+
$post->ID = 0;
|
| 49 |
+
if (isset($post->post_author)) {
|
| 50 |
+
if (is_email($post->post_author)) {
|
| 51 |
+
if ($user = get_user_by('email', $post->post_author)) {
|
| 52 |
+
$post->post_author = $user->ID;
|
| 53 |
+
} else {
|
| 54 |
+
exit(json_encode(array('error' => __('Author not found', _SQ_PLUGIN_NAME_))));
|
| 55 |
+
}
|
| 56 |
+
} else {
|
| 57 |
+
exit(json_encode(array('error' => __('Author not found', _SQ_PLUGIN_NAME_))));
|
| 58 |
+
}
|
| 59 |
+
} else {
|
| 60 |
+
exit(json_encode(array('error' => __('Author not found', _SQ_PLUGIN_NAME_))));
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
$post_ID = wp_insert_post($post->to_array());
|
| 64 |
+
if (is_wp_error($post_ID)) {
|
| 65 |
+
echo json_encode(array('error' => $post_ID->get_error_message()));
|
| 66 |
+
} else {
|
| 67 |
+
echo json_encode(array('saved' => true, 'post_ID' => $post_ID, 'permalink' => get_permalink($post_ID)));
|
| 68 |
+
}
|
| 69 |
+
exit();
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
echo json_encode(array('error' => true));
|
| 73 |
+
exit();
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
}
|
controllers/Cron.php
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class SQ_Controllers_Cron extends SQ_Classes_FrontController {
|
| 4 |
+
|
| 5 |
+
public function processSEOPostCron() {
|
| 6 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Tools');
|
| 7 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Action');
|
| 8 |
+
|
| 9 |
+
if (get_option('sq_seopost') !== false) {
|
| 10 |
+
$process = json_decode(get_option('sq_seopost'), true);
|
| 11 |
+
foreach ($process as $key => $call) {
|
| 12 |
+
|
| 13 |
+
if (!$response = json_decode(SQ_Classes_Action::apiCall('sq/seo/post', $call, 10))) {
|
| 14 |
+
break;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
if (isset($response->saved) && $response->saved == true) {
|
| 18 |
+
unset($process[$key]);
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
update_option('sq_seopost', json_encode($process));
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function processRankingCron() {
|
| 26 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Ranking')->processCron();
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
}
|
controllers/{SQ_Feed.php → Feed.php}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
/**
|
| 4 |
* Class for Sitemap Generator
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
/* @var string post limit */
|
| 8 |
|
| 9 |
var $posts_limit = 10000;
|
|
@@ -15,7 +15,7 @@ class SQ_Feed extends SQ_FrontController {
|
|
| 15 |
|
| 16 |
public function hookPreventRedirect() {
|
| 17 |
global $wp_query;
|
| 18 |
-
if (
|
| 19 |
$wp_query->is_404 = false;
|
| 20 |
$wp_query->is_feed = true;
|
| 21 |
|
|
@@ -27,11 +27,11 @@ class SQ_Feed extends SQ_FrontController {
|
|
| 27 |
}
|
| 28 |
|
| 29 |
public function feedCss() {
|
| 30 |
-
echo "\t" . '<feedcss>' . _SQ_THEME_URL_ . 'css/' . '
|
| 31 |
}
|
| 32 |
|
| 33 |
public function feedStyle() {
|
| 34 |
-
echo '<?xml-stylesheet type="text/xsl" href="' . _SQ_THEME_URL_ . 'css/' . '
|
| 35 |
}
|
| 36 |
|
| 37 |
public function feedHeader($content_type, $type) {
|
|
@@ -43,7 +43,7 @@ class SQ_Feed extends SQ_FrontController {
|
|
| 43 |
'rss' => ' text/xml',
|
| 44 |
'rss2' => ' text/xml'
|
| 45 |
);
|
| 46 |
-
$content_type = (!empty($types[$type])
|
| 47 |
|
| 48 |
return $content_type;
|
| 49 |
}
|
|
@@ -52,12 +52,14 @@ class SQ_Feed extends SQ_FrontController {
|
|
| 52 |
global $post;
|
| 53 |
if (has_post_thumbnail($post->ID)) {
|
| 54 |
$attachment = get_post(get_post_thumbnail_id($post->ID));
|
| 55 |
-
|
| 56 |
-
|
|
|
|
| 57 |
<a href="' . get_permalink($post->ID) . '">
|
| 58 |
<img src="' . esc_url($thumb[0]) . '" alt="' . get_the_title($post->ID) . '">
|
| 59 |
</a>
|
| 60 |
</div>' . $content;
|
|
|
|
| 61 |
}
|
| 62 |
return $content;
|
| 63 |
}
|
|
@@ -72,7 +74,7 @@ class SQ_Feed extends SQ_FrontController {
|
|
| 72 |
|
| 73 |
public function refreshSitemap($new_status, $old_status, $post) {
|
| 74 |
if ($old_status <> $new_status && $new_status = 'publish') {
|
| 75 |
-
if (
|
| 76 |
wp_schedule_single_event(time() + 5, 'sq_processPing');
|
| 77 |
}
|
| 78 |
}
|
| 3 |
/**
|
| 4 |
* Class for Sitemap Generator
|
| 5 |
*/
|
| 6 |
+
class SQ_Controllers_Feed extends SQ_Classes_FrontController {
|
| 7 |
/* @var string post limit */
|
| 8 |
|
| 9 |
var $posts_limit = 10000;
|
| 15 |
|
| 16 |
public function hookPreventRedirect() {
|
| 17 |
global $wp_query;
|
| 18 |
+
if (get_query_var('feed')) {
|
| 19 |
$wp_query->is_404 = false;
|
| 20 |
$wp_query->is_feed = true;
|
| 21 |
|
| 27 |
}
|
| 28 |
|
| 29 |
public function feedCss() {
|
| 30 |
+
echo "\t" . '<feedcss>' . _SQ_THEME_URL_ . 'css/' . 'feed.css</feedcss>' . "\n";
|
| 31 |
}
|
| 32 |
|
| 33 |
public function feedStyle() {
|
| 34 |
+
echo '<?xml-stylesheet type="text/xsl" href="' . _SQ_THEME_URL_ . 'css/' . 'feed.xsl' . '"?>';
|
| 35 |
}
|
| 36 |
|
| 37 |
public function feedHeader($content_type, $type) {
|
| 43 |
'rss' => ' text/xml',
|
| 44 |
'rss2' => ' text/xml'
|
| 45 |
);
|
| 46 |
+
$content_type = (!empty($types[$type])) ? $types[$type] : $content_type;
|
| 47 |
|
| 48 |
return $content_type;
|
| 49 |
}
|
| 52 |
global $post;
|
| 53 |
if (has_post_thumbnail($post->ID)) {
|
| 54 |
$attachment = get_post(get_post_thumbnail_id($post->ID));
|
| 55 |
+
if (isset($attachment->ID)) {
|
| 56 |
+
$thumb = wp_get_attachment_image_src($attachment->ID, 'large');
|
| 57 |
+
$content = '<div class="thumbnail">
|
| 58 |
<a href="' . get_permalink($post->ID) . '">
|
| 59 |
<img src="' . esc_url($thumb[0]) . '" alt="' . get_the_title($post->ID) . '">
|
| 60 |
</a>
|
| 61 |
</div>' . $content;
|
| 62 |
+
}
|
| 63 |
}
|
| 64 |
return $content;
|
| 65 |
}
|
| 74 |
|
| 75 |
public function refreshSitemap($new_status, $old_status, $post) {
|
| 76 |
if ($old_status <> $new_status && $new_status = 'publish') {
|
| 77 |
+
if (SQ_Classes_Tools::getOption('sq_sitemap_ping')) {
|
| 78 |
wp_schedule_single_event(time() + 5, 'sq_processPing');
|
| 79 |
}
|
| 80 |
}
|
controllers/FrontMenu.php
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class SQ_Controllers_FrontMenu extends SQ_Classes_FrontController {
|
| 4 |
+
|
| 5 |
+
public function action() {
|
| 6 |
+
parent::action();
|
| 7 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 8 |
+
case 'sq_saveseo':
|
| 9 |
+
//Save the SEO settings
|
| 10 |
+
$json = $this->saveSEO();
|
| 11 |
+
|
| 12 |
+
if (SQ_Classes_Tools::isAjax()) {
|
| 13 |
+
SQ_Classes_Tools::setHeader('json');
|
| 14 |
+
echo json_encode($json);
|
| 15 |
+
exit();
|
| 16 |
+
}
|
| 17 |
+
break;
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
public function saveSEO(){
|
| 22 |
+
$json = array();
|
| 23 |
+
if (SQ_Classes_Tools::getIsset('sq_hash')) {
|
| 24 |
+
$sq_hash = SQ_Classes_Tools::getValue('sq_hash', false);
|
| 25 |
+
$post_id = SQ_Classes_Tools::getValue('post_id', 0);
|
| 26 |
+
$term_taxonomy_id = SQ_Classes_Tools::getValue('term_taxonomy_id', 0);
|
| 27 |
+
$taxonomy = SQ_Classes_Tools::getValue('taxonomy', 'category');
|
| 28 |
+
|
| 29 |
+
if (!current_user_can('manage_options')) {
|
| 30 |
+
if (!current_user_can('edit_post', $post_id)) {
|
| 31 |
+
$json['error'] = 1;
|
| 32 |
+
$json['error_message'] = __("You don't have enough pemission to edit this article", _SQ_PLUGIN_NAME_);
|
| 33 |
+
exit();
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
$url = SQ_Classes_Tools::getValue('sq_url', false);
|
| 38 |
+
|
| 39 |
+
$sq = SQ_Classes_ObjController::getClass('SQ_Models_Frontend')->getSqSeo($sq_hash);
|
| 40 |
+
|
| 41 |
+
$sq->doseo = SQ_Classes_Tools::getValue('sq_doseo', 0);
|
| 42 |
+
|
| 43 |
+
$sq->title = SQ_Classes_Tools::getValue('sq_title', false);
|
| 44 |
+
$sq->description = SQ_Classes_Tools::getValue('sq_description', false);
|
| 45 |
+
$sq->keywords = SQ_Classes_Tools::getValue('sq_keywords', array());
|
| 46 |
+
$sq->canonical = SQ_Classes_Tools::getValue('sq_canonical', false);
|
| 47 |
+
$sq->noindex = SQ_Classes_Tools::getValue('sq_noindex', 0);
|
| 48 |
+
$sq->nofollow = SQ_Classes_Tools::getValue('sq_nofollow', 0);
|
| 49 |
+
$sq->nositemap = SQ_Classes_Tools::getValue('sq_nositemap', 0);
|
| 50 |
+
|
| 51 |
+
$sq->og_title = SQ_Classes_Tools::getValue('sq_og_title', false);
|
| 52 |
+
$sq->og_description = SQ_Classes_Tools::getValue('sq_og_description', false);
|
| 53 |
+
$sq->og_author = SQ_Classes_Tools::getValue('sq_og_author', false);
|
| 54 |
+
$sq->og_type = SQ_Classes_Tools::getValue('sq_og_type', 'website');
|
| 55 |
+
$sq->og_media = SQ_Classes_Tools::getValue('sq_og_media', false);
|
| 56 |
+
|
| 57 |
+
$sq->tw_title = SQ_Classes_Tools::getValue('sq_tw_title', false);
|
| 58 |
+
$sq->tw_description = SQ_Classes_Tools::getValue('sq_tw_description', false);
|
| 59 |
+
$sq->tw_media = SQ_Classes_Tools::getValue('sq_tw_media', false);
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
//empty the cache from cache plugins
|
| 63 |
+
//SQ_Classes_Tools::emptyCache();
|
| 64 |
+
|
| 65 |
+
if (SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->db_insert(
|
| 66 |
+
$url,
|
| 67 |
+
$sq_hash,
|
| 68 |
+
(int)$post_id,
|
| 69 |
+
maybe_serialize($sq->toArray()),
|
| 70 |
+
gmdate('Y-m-d H:i:s')
|
| 71 |
+
)
|
| 72 |
+
) {
|
| 73 |
+
$json['saved'] = $sq_hash;
|
| 74 |
+
|
| 75 |
+
if (SQ_Classes_Tools::isAjax()) {
|
| 76 |
+
if ($post_id > 0) {
|
| 77 |
+
if (SQ_Classes_ObjController::getClass("SQ_Controllers_Menu")->setPostByID($post_id)) {
|
| 78 |
+
$json['html'] = SQ_Classes_ObjController::getClass("SQ_Controllers_Menu")->getView('FrontMenu');
|
| 79 |
+
}
|
| 80 |
+
} elseif ($term_taxonomy_id > 0) {
|
| 81 |
+
if (SQ_Classes_ObjController::getClass("SQ_Controllers_Menu")->setPostByTaxID($term_taxonomy_id, $taxonomy)) {
|
| 82 |
+
$json['html'] = SQ_Classes_ObjController::getClass("SQ_Controllers_Menu")->getView('FrontMenu');
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
} else {
|
| 87 |
+
$json['error'] = 1;
|
| 88 |
+
$json['error_message'] = 'Could not Insert the information';
|
| 89 |
+
SQ_Classes_Tools::createTable();
|
| 90 |
+
};
|
| 91 |
+
|
| 92 |
+
} else {
|
| 93 |
+
$json['error'] = 1;
|
| 94 |
+
$json['error_message'] = 'Wrong number of parameters';
|
| 95 |
+
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
return $json;
|
| 99 |
+
}
|
| 100 |
+
}
|
controllers/Frontend.php
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class SQ_Controllers_Frontend extends SQ_Classes_FrontController {
|
| 4 |
+
|
| 5 |
+
public function __construct() {
|
| 6 |
+
if (SQ_Classes_Tools::isAjax()) return;
|
| 7 |
+
parent::__construct();
|
| 8 |
+
|
| 9 |
+
//For favicon and Robots
|
| 10 |
+
$this->hookCheckFiles();
|
| 11 |
+
|
| 12 |
+
add_action('plugins_loaded', array($this, 'hookBuffer'));
|
| 13 |
+
add_action('template_redirect', array($this, 'hookBuffer'));
|
| 14 |
+
|
| 15 |
+
//SET THE POST FROM THE BEGINING
|
| 16 |
+
add_action('template_redirect', array($this->model, 'setPost'), 0);
|
| 17 |
+
|
| 18 |
+
/* Check if sitemap is on and Load the Sitemap */
|
| 19 |
+
if (SQ_Classes_Tools::getOption('sq_auto_sitemap')) SQ_Classes_ObjController::getClass('SQ_Controllers_Sitemaps');
|
| 20 |
+
|
| 21 |
+
/* Load the Feed Style */
|
| 22 |
+
if (SQ_Classes_Tools::getOption('sq_auto_feed')) SQ_Classes_ObjController::getClass('SQ_Controllers_Feed');
|
| 23 |
+
|
| 24 |
+
/* Fix the Links for feed*/
|
| 25 |
+
if (SQ_Classes_Tools::getOption('sq_url_fix')) add_action('the_content', array($this, 'fixFeedLinks'), 11);
|
| 26 |
+
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* HOOK THE BUFFER
|
| 31 |
+
*/
|
| 32 |
+
public function hookBuffer() {
|
| 33 |
+
remove_action('template_redirect', array($this, 'hookBuffer'));
|
| 34 |
+
|
| 35 |
+
if ($this->isSquirrlySeoEnabled()) {
|
| 36 |
+
global $wp_super_cache_late_init;
|
| 37 |
+
if (isset($wp_super_cache_late_init) && $wp_super_cache_late_init == 1 && !did_action('init')) {
|
| 38 |
+
//add an action after Super cache late login is started
|
| 39 |
+
add_action('init', array($this->model, 'startBuffer'), PHP_INT_MAX);
|
| 40 |
+
} elseif (SQ_Classes_Tools::getOption('sq_laterload') && !did_action('template_redirect')) {
|
| 41 |
+
add_action('template_redirect', array($this->model, 'startBuffer'), PHP_INT_MAX);
|
| 42 |
+
} else {
|
| 43 |
+
$this->model->startBuffer();
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
if (defined('WP_ROCKET_VERSION')) {
|
| 47 |
+
add_filter('rocket_buffer', array($this->model, 'getBuffer'), PHP_INT_MAX);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
add_action('shutdown', array($this->model, 'getBuffer'));
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Called after plugins are loaded
|
| 57 |
+
*/
|
| 58 |
+
public function hookCheckFiles() {
|
| 59 |
+
//Check for sitemap and robots
|
| 60 |
+
if ($basename = $this->isFile($_SERVER['REQUEST_URI'])) {
|
| 61 |
+
if (SQ_Classes_Tools::getOption('sq_auto_robots') == 1) {
|
| 62 |
+
if ($basename == "robots.txt") {
|
| 63 |
+
SQ_Classes_ObjController::getClass('SQ_Models_Services_Robots');
|
| 64 |
+
apply_filters('sq_robots', false);
|
| 65 |
+
exit();
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
if (SQ_Classes_Tools::getOption('favicon') <> '') {
|
| 70 |
+
if ($basename == "favicon.icon") {
|
| 71 |
+
SQ_Classes_Tools::setHeader('ico');
|
| 72 |
+
@readfile(_SQ_CACHE_DIR_ . SQ_Classes_Tools::getOption('favicon'));
|
| 73 |
+
exit();
|
| 74 |
+
} elseif ($basename == "touch-icon.png") {
|
| 75 |
+
SQ_Classes_Tools::setHeader('png');
|
| 76 |
+
@readfile(_SQ_CACHE_DIR_ . SQ_Classes_Tools::getOption('favicon'));
|
| 77 |
+
exit();
|
| 78 |
+
} else {
|
| 79 |
+
$appleSizes = preg_split('/[,]+/', _SQ_MOBILE_ICON_SIZES);
|
| 80 |
+
foreach ($appleSizes as $appleSize) {
|
| 81 |
+
if ($basename == "touch-icon$appleSize.png") {
|
| 82 |
+
SQ_Classes_Tools::setHeader('png');
|
| 83 |
+
@readfile(_SQ_CACHE_DIR_ . SQ_Classes_Tools::getOption('favicon') . $appleSize);
|
| 84 |
+
exit();
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* Hook the Header load
|
| 97 |
+
*/
|
| 98 |
+
public function hookFronthead() {
|
| 99 |
+
if (!SQ_Classes_Tools::isAjax()) {
|
| 100 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia(_SQ_THEME_URL_ . 'css/frontend' . (SQ_DEBUG ? '' : '.min') . '.css');
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* Change the image path to absolute when in feed
|
| 106 |
+
* @param string $content
|
| 107 |
+
*
|
| 108 |
+
* @return string
|
| 109 |
+
*/
|
| 110 |
+
public function fixFeedLinks($content) {
|
| 111 |
+
if (is_feed()) {
|
| 112 |
+
$find = $replace = $urls = array();
|
| 113 |
+
|
| 114 |
+
@preg_match_all('/<img[^>]*src=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $out);
|
| 115 |
+
if (is_array($out)) {
|
| 116 |
+
if (!is_array($out[1]) || empty($out[1]))
|
| 117 |
+
return $content;
|
| 118 |
+
|
| 119 |
+
foreach ($out[1] as $row) {
|
| 120 |
+
if (strpos($row, '//') === false) {
|
| 121 |
+
if (!in_array($row, $urls)) {
|
| 122 |
+
$urls[] = $row;
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
@preg_match_all('/<a[^>]*href=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $out);
|
| 129 |
+
if (is_array($out)) {
|
| 130 |
+
if (!is_array($out[1]) || empty($out[1]))
|
| 131 |
+
return $content;
|
| 132 |
+
|
| 133 |
+
foreach ($out[1] as $row) {
|
| 134 |
+
if (strpos($row, '//') === false) {
|
| 135 |
+
if (!in_array($row, $urls)) {
|
| 136 |
+
$urls[] = $row;
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
if (!is_array($urls) || (is_array($urls) && empty($urls))) {
|
| 142 |
+
return $content;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
$urls = array_unique($urls);
|
| 146 |
+
foreach ($urls as $url) {
|
| 147 |
+
$find[] = "'" . $url . "'";
|
| 148 |
+
$replace[] = "'" . esc_url(home_url() . $url) . "'";
|
| 149 |
+
$find[] = '"' . $url . '"';
|
| 150 |
+
$replace[] = '"' . esc_url(home_url() . $url) . '"';
|
| 151 |
+
}
|
| 152 |
+
if (!empty($find) && !empty($replace)) {
|
| 153 |
+
$content = str_replace($find, $replace, $content);
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
return $content;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
public function hookFrontfooter() {
|
| 160 |
+
if ($this->isSquirrlySeoEnabled()) {
|
| 161 |
+
echo $this->model->getFooter();
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
public function isSquirrlySeoEnabled() {
|
| 166 |
+
return (apply_filters('sq_use', SQ_Classes_Tools::getOption('sq_use')) == 1);
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
public function isFile($url = null) {
|
| 170 |
+
if (isset($url) && $url <> '') {
|
| 171 |
+
$url = basename($url);
|
| 172 |
+
if (strpos($url, '?') <> '') {
|
| 173 |
+
$url = substr($url, 0, strpos($url, '?'));
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
$files = array('ico', 'icon', 'txt', 'jpg', 'jpeg', 'png', 'bmp', 'gif',
|
| 177 |
+
'css', 'scss', 'js',
|
| 178 |
+
'pdf', 'doc', 'docx', 'csv', 'xls', 'xslx',
|
| 179 |
+
'mp4', 'mpeg',
|
| 180 |
+
'zip', 'rar');
|
| 181 |
+
|
| 182 |
+
if (strrpos($url, '.') !== false) {
|
| 183 |
+
$ext = substr($url, strrpos($url, '.') + 1);
|
| 184 |
+
if (in_array($ext, $files)) {
|
| 185 |
+
return $url;
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
return false;
|
| 191 |
+
|
| 192 |
+
}
|
| 193 |
+
}
|
controllers/Menu.php
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class SQ_Controllers_Menu extends SQ_Classes_FrontController {
|
| 4 |
+
|
| 5 |
+
/** @var array snippet */
|
| 6 |
+
private $post_type;
|
| 7 |
+
public $post;
|
| 8 |
+
/** @var array snippet */
|
| 9 |
+
var $options = array();
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
public function __construct() {
|
| 13 |
+
parent::__construct();
|
| 14 |
+
add_action('admin_bar_menu', array($this, 'hookTopmenu'), 999);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Hook the Admin load
|
| 19 |
+
*/
|
| 20 |
+
public function hookInit() {
|
| 21 |
+
/* add the plugin menu in admin */
|
| 22 |
+
if (current_user_can('manage_options')) {
|
| 23 |
+
//check if activated
|
| 24 |
+
if (get_transient('sq_activate') == 1) {
|
| 25 |
+
//create the table
|
| 26 |
+
SQ_Classes_Tools::createTable();
|
| 27 |
+
//Check if there are expected upgrades
|
| 28 |
+
SQ_Classes_Tools::checkUpgrade();
|
| 29 |
+
|
| 30 |
+
// Delete the redirect transient
|
| 31 |
+
delete_transient('sq_activate');
|
| 32 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 33 |
+
|
| 34 |
+
wp_safe_redirect(admin_url('admin.php?page=sq_dashboard'));
|
| 35 |
+
exit();
|
| 36 |
+
} else {
|
| 37 |
+
//Deactivate the QuickSEO plugin
|
| 38 |
+
if (SQ_Classes_Tools::isPluginInstalled('quick-seo')) {
|
| 39 |
+
$quickSEO = _QSS_ROOT_DIR_ . '/index.php';
|
| 40 |
+
if (is_plugin_active(plugin_basename($quickSEO))) {
|
| 41 |
+
delete_transient('qss_activate');
|
| 42 |
+
|
| 43 |
+
deactivate_plugins(plugin_basename($quickSEO), true);
|
| 44 |
+
SQ_Classes_Error::setMessage(sprintf(__("Good news, %s is integrated in Squirrly SEO now and you don't have to run 2 plugins anymore", _SQ_PLUGIN_NAME_), _QSS_PLUGIN_NAME_));
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
//Deactivate the Premium SEO Pack plugin
|
| 50 |
+
if (SQ_Classes_Tools::isPluginInstalled('premium-seo-pack')) {
|
| 51 |
+
$phpSEO = _PSP_ROOT_DIR_ . '/index.php';
|
| 52 |
+
if (is_plugin_active(plugin_basename($phpSEO))) {
|
| 53 |
+
delete_transient('psp_activate');
|
| 54 |
+
deactivate_plugins(plugin_basename($phpSEO), true);
|
| 55 |
+
SQ_Classes_Error::setMessage(sprintf(__("Good news, %s is integrated in Squirrly SEO now and you don't have to run 2 plugins anymore", _SQ_PLUGIN_NAME_), _PSP_PLUGIN_NAME_));
|
| 56 |
+
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
//Make sure Squirrly upgrades the settings and seo
|
| 61 |
+
if (SQ_Classes_Tools::getOption('sq_ver') < 8200 && SQ_Classes_Tools::getOption('sq_api') <> '') {
|
| 62 |
+
wp_redirect('admin.php?page=sq_dashboard&action=sq_dataupgrade&nonce=' . wp_create_nonce(_SQ_NONCE_ID_));
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
if (get_transient('sq_rewrite') == 1) {
|
| 67 |
+
// Delete the redirect transient
|
| 68 |
+
delete_transient('sq_rewrite');
|
| 69 |
+
global $wp_rewrite;
|
| 70 |
+
$wp_rewrite->flush_rules();
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
}
|
| 75 |
+
//activate the cron job if not exists
|
| 76 |
+
if (!wp_get_schedule('sq_processCron')) {
|
| 77 |
+
wp_schedule_event(time(), 'hourly', 'sq_processCron');
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
add_filter('rewrite_rules_array', array(SQ_Classes_ObjController::getClass('SQ_Core_BlockSettingsSeo'), 'rewrite_rules'), 999, 1);
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* Add a menu in Admin Bar
|
| 87 |
+
*
|
| 88 |
+
* @param WP_Admin_Bar $wp_admin_bar
|
| 89 |
+
*/
|
| 90 |
+
public function hookTopmenu($wp_admin_bar) {
|
| 91 |
+
global $tag, $wp_the_query;
|
| 92 |
+
|
| 93 |
+
if (!is_user_logged_in()) {
|
| 94 |
+
return;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
$wp_admin_bar->add_node(array(
|
| 98 |
+
'id' => 'sq_posts',
|
| 99 |
+
'title' => __('See Your Rank on Google', _SQ_PLUGIN_NAME_),
|
| 100 |
+
'href' => admin_url('admin.php?page=sq_posts'),
|
| 101 |
+
'parent' => false
|
| 102 |
+
));
|
| 103 |
+
|
| 104 |
+
if (is_admin()) {
|
| 105 |
+
$current_screen = get_current_screen();
|
| 106 |
+
SQ_Classes_Tools::dump($current_screen);
|
| 107 |
+
|
| 108 |
+
$post = get_post();
|
| 109 |
+
if ('post' == $current_screen->base
|
| 110 |
+
&& ($post_type_object = get_post_type_object($post->post_type))
|
| 111 |
+
&& current_user_can('edit_post', $post->ID)
|
| 112 |
+
&& ($post_type_object->public)) {
|
| 113 |
+
} elseif ('edit' == $current_screen->base
|
| 114 |
+
&& ($post_type_object = get_post_type_object($current_screen->post_type))
|
| 115 |
+
&& ($post_type_object->show_in_admin_bar)
|
| 116 |
+
&& !('edit-' . $current_screen->post_type === $current_screen->id)) {
|
| 117 |
+
} elseif ('term' == $current_screen->base
|
| 118 |
+
&& isset($tag) && is_object($tag) && !is_wp_error($tag)
|
| 119 |
+
&& ($tax = get_taxonomy($tag->taxonomy))
|
| 120 |
+
&& $tax->public) {
|
| 121 |
+
} else {
|
| 122 |
+
return;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
//Add the snippet in all post types
|
| 126 |
+
$this->addMetabox();
|
| 127 |
+
} else {
|
| 128 |
+
//If user set not to load Squirrly in frontend
|
| 129 |
+
if (!SQ_Classes_Tools::getOption('sq_use_frontend')) {
|
| 130 |
+
return;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
if (!current_user_can('manage_options')) {
|
| 134 |
+
$current_object = $wp_the_query->get_queried_object();
|
| 135 |
+
|
| 136 |
+
if (empty($current_object))
|
| 137 |
+
return;
|
| 138 |
+
|
| 139 |
+
if (!empty($current_object->post_type)
|
| 140 |
+
&& ($post_type_object = get_post_type_object($current_object->post_type))
|
| 141 |
+
&& current_user_can('edit_post', $current_object->ID)
|
| 142 |
+
&& $post_type_object->show_in_admin_bar
|
| 143 |
+
&& $edit_post_link = get_edit_post_link($current_object->ID)) {
|
| 144 |
+
} elseif (!empty($current_object->taxonomy)
|
| 145 |
+
&& ($tax = get_taxonomy($current_object->taxonomy))
|
| 146 |
+
&& current_user_can('edit_term', $current_object->term_id)
|
| 147 |
+
&& $edit_term_link = get_edit_term_link($current_object->term_id, $current_object->taxonomy)) {
|
| 148 |
+
} else {
|
| 149 |
+
return;
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
$wp_admin_bar->add_node(array(
|
| 156 |
+
'id' => 'sq_bar_menu',
|
| 157 |
+
'title' => '<span class="dashicons-sqlogo"></span> ' . __('Custom SEO', _SQ_PLUGIN_NAME_),
|
| 158 |
+
'parent' => 'top-secondary',
|
| 159 |
+
));
|
| 160 |
+
|
| 161 |
+
$wp_admin_bar->add_menu(array(
|
| 162 |
+
'id' => 'sq_bar_submenu',
|
| 163 |
+
'parent' => 'sq_bar_menu',
|
| 164 |
+
'meta' => array(
|
| 165 |
+
'html' => $this->getView('FrontMenu'),
|
| 166 |
+
'tabindex' => PHP_INT_MAX,
|
| 167 |
+
),
|
| 168 |
+
));
|
| 169 |
+
|
| 170 |
+
if (is_admin()) {
|
| 171 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('frontmenu');
|
| 172 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('patterns');
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
/**
|
| 178 |
+
* Creates the Setting menu in Wordpress
|
| 179 |
+
*/
|
| 180 |
+
public function hookMenu() {
|
| 181 |
+
|
| 182 |
+
$this->post_type = SQ_Classes_Tools::getOption('sq_post_types');
|
| 183 |
+
|
| 184 |
+
//Push the Analytics Check
|
| 185 |
+
if (strpos($_SERVER['REQUEST_URI'], '?page=sq_dashboard') !== false) {
|
| 186 |
+
SQ_Classes_Tools::saveOptions('sq_dashboard', 1);
|
| 187 |
+
}
|
| 188 |
+
if (strpos($_SERVER['REQUEST_URI'], '?page=sq_analytics') !== false) {
|
| 189 |
+
SQ_Classes_Tools::saveOptions('sq_analytics', 1);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
$analytics_alert = 0;
|
| 193 |
+
if (SQ_Classes_ObjController::getClass('SQ_Models_Post')->countKeywords() > 0 && !SQ_Classes_Tools::getOption('sq_analytics')) {
|
| 194 |
+
$analytics_alert = 1;
|
| 195 |
+
if (!get_transient('sq_analytics')) {
|
| 196 |
+
set_transient('sq_analytics', time(), (60 * 60 * 24 * 7));
|
| 197 |
+
} else {
|
| 198 |
+
$time_loaded = get_transient('sq_analytics');
|
| 199 |
+
if (time() - $time_loaded > (60 * 60 * 24 * 3) && time() - $time_loaded < (60 * 60 * 24 * 14)) {
|
| 200 |
+
SQ_Classes_Error::setError(__('Check out the Squirrly Analytics section. <a href="admin.php?page=sq_posts" title="Squirrly Analytics">Click here</a>', _SQ_PLUGIN_NAME_));
|
| 201 |
+
}
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
$dashboard_alert = (int)(SQ_Classes_Tools::getOption('sq_dashboard') == 0);
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
///////////////
|
| 209 |
+
|
| 210 |
+
$this->model->addMenu(array(ucfirst(_SQ_NAME_),
|
| 211 |
+
'Squirrly' . SQ_Classes_Tools::showNotices(SQ_Classes_Tools::$errors_count, 'errors_count'),
|
| 212 |
+
'edit_posts',
|
| 213 |
+
'sq_dashboard',
|
| 214 |
+
null,
|
| 215 |
+
_SQ_THEME_URL_ . 'img/settings/menu_icon_16.png'
|
| 216 |
+
));
|
| 217 |
+
|
| 218 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 219 |
+
ucfirst(_SQ_NAME_) . __(' Dashboard', _SQ_PLUGIN_NAME_),
|
| 220 |
+
((SQ_Classes_Tools::getOption('sq_api') == '') ? __('First Step', _SQ_PLUGIN_NAME_) : __('Dashboard', _SQ_PLUGIN_NAME_)) . SQ_Classes_Tools::showNotices($dashboard_alert, 'errors_count'),
|
| 221 |
+
'edit_posts',
|
| 222 |
+
'sq_dashboard',
|
| 223 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockDashboard'), 'init')
|
| 224 |
+
));
|
| 225 |
+
|
| 226 |
+
//IF SERP PLUGIN IS NOT INSTALLED
|
| 227 |
+
if (!class_exists('SRC_Classes_ObjController')) {
|
| 228 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 229 |
+
ucfirst(_SQ_NAME_) . __(' Performance Analytics', _SQ_PLUGIN_NAME_),
|
| 230 |
+
__('Performance <br />Analytics', _SQ_PLUGIN_NAME_) . SQ_Classes_Tools::showNotices($analytics_alert, 'errors_count'),
|
| 231 |
+
'edit_posts',
|
| 232 |
+
'sq_posts',
|
| 233 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockPostsAnalytics'), 'init')
|
| 234 |
+
));
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 238 |
+
ucfirst(_SQ_NAME_) . __(' Keyword Research', _SQ_PLUGIN_NAME_),
|
| 239 |
+
__('Keyword Research', _SQ_PLUGIN_NAME_),
|
| 240 |
+
'edit_posts',
|
| 241 |
+
'sq_keywordresearch',
|
| 242 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockKeywordResearch'), 'init')
|
| 243 |
+
));
|
| 244 |
+
|
| 245 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 246 |
+
ucfirst(_SQ_NAME_) . __(' Live Assistant', _SQ_PLUGIN_NAME_),
|
| 247 |
+
__('Live Assistant', _SQ_PLUGIN_NAME_),
|
| 248 |
+
'edit_posts',
|
| 249 |
+
'sq_liveassistant',
|
| 250 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockLiveAssistant'), 'init')
|
| 251 |
+
));
|
| 252 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 253 |
+
__(' Copywriting', _SQ_PLUGIN_NAME_),
|
| 254 |
+
__('Copywriting', _SQ_PLUGIN_NAME_),
|
| 255 |
+
'edit_posts',
|
| 256 |
+
'sq_copyright',
|
| 257 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockCopyright'), 'init')
|
| 258 |
+
));
|
| 259 |
+
|
| 260 |
+
if (current_user_can('manage_options')) {
|
| 261 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 262 |
+
ucfirst(_SQ_NAME_) . __(' SEO Audit', _SQ_PLUGIN_NAME_),
|
| 263 |
+
__('Site Audit', _SQ_PLUGIN_NAME_),
|
| 264 |
+
'edit_posts',
|
| 265 |
+
'sq_seoaudit',
|
| 266 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockAudit'), 'init')
|
| 267 |
+
));
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 271 |
+
ucfirst(_SQ_NAME_) . __(' SEO Settings', _SQ_PLUGIN_NAME_),
|
| 272 |
+
__('SEO Settings', _SQ_PLUGIN_NAME_) . SQ_Classes_Tools::showNotices(SQ_Classes_Tools::$errors_count, 'errors_count'),
|
| 273 |
+
'manage_options',
|
| 274 |
+
'sq_seo',
|
| 275 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockSettingsSeo'), 'init')
|
| 276 |
+
));
|
| 277 |
+
|
| 278 |
+
|
| 279 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 280 |
+
ucfirst(_SQ_NAME_) . __(' Advanced Settings', _SQ_PLUGIN_NAME_),
|
| 281 |
+
__('Advanced Settings', _SQ_PLUGIN_NAME_),
|
| 282 |
+
'manage_options',
|
| 283 |
+
'sq_settings',
|
| 284 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockSettings'), 'init')
|
| 285 |
+
));
|
| 286 |
+
|
| 287 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 288 |
+
ucfirst(_SQ_NAME_) . __(' SEO Patterns', _SQ_PLUGIN_NAME_),
|
| 289 |
+
__('Patterns', _SQ_PLUGIN_NAME_),
|
| 290 |
+
'manage_options',
|
| 291 |
+
'sq_patterns',
|
| 292 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockPatterns'), 'init')
|
| 293 |
+
));
|
| 294 |
+
|
| 295 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 296 |
+
ucfirst(_SQ_NAME_) . __(' Account Info', _SQ_PLUGIN_NAME_),
|
| 297 |
+
__('Account Info', _SQ_PLUGIN_NAME_),
|
| 298 |
+
'manage_options',
|
| 299 |
+
'sq_account',
|
| 300 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockAccount'), 'init')
|
| 301 |
+
));
|
| 302 |
+
|
| 303 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 304 |
+
ucfirst(_SQ_NAME_) . __(' Support', _SQ_PLUGIN_NAME_),
|
| 305 |
+
__('Support', _SQ_PLUGIN_NAME_),
|
| 306 |
+
'edit_posts',
|
| 307 |
+
'sq_customerservice',
|
| 308 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockCustomerService'), 'init')
|
| 309 |
+
));
|
| 310 |
+
|
| 311 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 312 |
+
__('Become an Affiliate with ', _SQ_PLUGIN_NAME_) . ucfirst(_SQ_NAME_),
|
| 313 |
+
__('Become an Affiliate', _SQ_PLUGIN_NAME_),
|
| 314 |
+
'edit_posts',
|
| 315 |
+
'sq_affiliate',
|
| 316 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockAffiliate'), 'init')
|
| 317 |
+
));
|
| 318 |
+
|
| 319 |
+
if (current_user_can('manage_options')) {
|
| 320 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
| 321 |
+
__('Import SEO ', _SQ_PLUGIN_NAME_),
|
| 322 |
+
__('Import SEO', _SQ_PLUGIN_NAME_),
|
| 323 |
+
'edit_posts',
|
| 324 |
+
'sq_import',
|
| 325 |
+
array(SQ_Classes_ObjController::getClass('SQ_Core_BlockImport'), 'init')
|
| 326 |
+
));
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
foreach ($this->post_type as $type) {
|
| 330 |
+
$this->model->addMeta(array('post' . _SQ_NAME_,
|
| 331 |
+
ucfirst(_SQ_NAME_),
|
| 332 |
+
array(SQ_Classes_ObjController::getClass('SQ_Controllers_Post'), 'init'),
|
| 333 |
+
$type,
|
| 334 |
+
'side',
|
| 335 |
+
'high'
|
| 336 |
+
));
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
//Add the Rank in the Posts list
|
| 341 |
+
$postlist = SQ_Classes_ObjController::getClass('SQ_Controllers_PostsList');
|
| 342 |
+
if (is_object($postlist)) {
|
| 343 |
+
$postlist->init();
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
//Show bar to go back and finish the help
|
| 347 |
+
if (current_user_can('manage_options') && ($this->is_page('edit') || strpos($_SERVER['REQUEST_URI'], 'sq_posts') !== false)) {
|
| 348 |
+
if (SQ_Classes_Tools::getOption('active_help') <> '' && !SQ_Classes_Tools::getOption('ignore_warn')) {
|
| 349 |
+
SQ_Classes_Error::setError(sprintf(__('Go back and complete the Squirrly Tasks for today %sContinue%s', _SQ_PLUGIN_NAME_), '<a href="admin.php?page=sq_' . SQ_Classes_Tools::getOption('active_help') . '" class="sq_button" title="Continue the Help">', '</a>'), 'helpnotice');
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
/**
|
| 357 |
+
* Add Post Editor Meta Box
|
| 358 |
+
*/
|
| 359 |
+
public function addMetabox() {
|
| 360 |
+
$this->model->addMeta(array('sq_blocksnippet',
|
| 361 |
+
ucfirst(_SQ_NAME_) . ' ' . __('SEO Snippet', _SQ_PLUGIN_NAME_),
|
| 362 |
+
array(SQ_Classes_ObjController::getClass('SQ_Controllers_FrontMenu'), 'show'),
|
| 363 |
+
null,
|
| 364 |
+
'normal',
|
| 365 |
+
'high'
|
| 366 |
+
));
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
/**
|
| 370 |
+
* Hook the Head sequence in frontend when user is logged in
|
| 371 |
+
*/
|
| 372 |
+
public function hookFronthead() {
|
| 373 |
+
if (current_user_can('edit_posts')) {
|
| 374 |
+
//prevent some compatibility errors with other plugins
|
| 375 |
+
remove_all_actions('print_media_templates');
|
| 376 |
+
|
| 377 |
+
//loade the media library
|
| 378 |
+
wp_enqueue_media();
|
| 379 |
+
|
| 380 |
+
//Set the current post domain with all the data
|
| 381 |
+
$this->post = SQ_Classes_ObjController::getClass('SQ_Models_Frontend')->getPost();
|
| 382 |
+
}
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
/**
|
| 386 |
+
* Called when Post action is triggered
|
| 387 |
+
*
|
| 388 |
+
* @return void
|
| 389 |
+
*/
|
| 390 |
+
public function action() {
|
| 391 |
+
parent::action();
|
| 392 |
+
|
| 393 |
+
if (!current_user_can('edit_posts')) {
|
| 394 |
+
return;
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
SQ_Classes_Tools::setHeader('json');
|
| 398 |
+
|
| 399 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 400 |
+
case 'sq_getfrontmenu':
|
| 401 |
+
$json = array();
|
| 402 |
+
$post_id = (int)SQ_Classes_Tools::getValue('post_id', 0);
|
| 403 |
+
$term_taxonomy_id = (int)SQ_Classes_Tools::getValue('term_taxonomy_id', 0);
|
| 404 |
+
$taxonomy = SQ_Classes_Tools::getValue('taxonomy', 'category');
|
| 405 |
+
|
| 406 |
+
if ($post_id > 0) {
|
| 407 |
+
if ($this->setPostByID($post_id)) {
|
| 408 |
+
$json['html'] = $this->getView('FrontMenu');
|
| 409 |
+
}
|
| 410 |
+
} elseif ($term_taxonomy_id > 0) {
|
| 411 |
+
if ($this->setPostByTaxID($term_taxonomy_id, $taxonomy)) {
|
| 412 |
+
if (get_term_link($term_taxonomy_id) == $this->post->url) {
|
| 413 |
+
$json['html'] = $this->getView('FrontMenu');
|
| 414 |
+
}
|
| 415 |
+
}
|
| 416 |
+
}
|
| 417 |
+
echo json_encode($json);
|
| 418 |
+
exit();
|
| 419 |
+
}
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
public function getPostType($for, $post_type = null) {
|
| 423 |
+
switch ($for) {
|
| 424 |
+
case 'og:type':
|
| 425 |
+
if (isset($this->post->sq) && $this->post->sq->og_type <> '') {
|
| 426 |
+
if ($this->post->sq->og_type == $post_type) return 'selected="selected"';
|
| 427 |
+
} else {
|
| 428 |
+
switch ($post_type) {
|
| 429 |
+
case 'website':
|
| 430 |
+
if ($this->post->post_type == 'home') return 'selected="selected"';
|
| 431 |
+
break;
|
| 432 |
+
default:
|
| 433 |
+
if ($this->post->post_type == $post_type) return 'selected="selected"';
|
| 434 |
+
}
|
| 435 |
+
}
|
| 436 |
+
break;
|
| 437 |
+
}
|
| 438 |
+
return false;
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
public function getImportList() {
|
| 442 |
+
return apply_filters('sq_importList', false);
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
public function setPostByURL($url) {
|
| 446 |
+
$post_id = url_to_postid($url);
|
| 447 |
+
$this->post = get_post($post_id);
|
| 448 |
+
|
| 449 |
+
if ($post_id > 0) {
|
| 450 |
+
add_filter('sq_current_post', array($this, 'setCurrentPost'), 10);
|
| 451 |
+
SQ_Classes_ObjController::getClass('SQ_Models_Frontend')->setPost();
|
| 452 |
+
$this->post = SQ_Classes_ObjController::getClass('SQ_Models_Frontend')->getPost();
|
| 453 |
+
return $this->post;
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
return false;
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
public function setPostByID($post = 0, $taxonomy = 'post') {
|
| 460 |
+
if ($post instanceof WP_Post) {
|
| 461 |
+
$this->post = $post;
|
| 462 |
+
} else {
|
| 463 |
+
$post_id = (int)$post;
|
| 464 |
+
if ($post_id > 0) {
|
| 465 |
+
$this->post = get_post($post_id);
|
| 466 |
+
}
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
if ($this->post) {
|
| 470 |
+
set_query_var('post_type', $this->post->post_type);
|
| 471 |
+
$this->post = SQ_Classes_ObjController::getClass('SQ_Models_Frontend')->setPost($this->post)->getPost();
|
| 472 |
+
|
| 473 |
+
SQ_Classes_Tools::dump($this->post);
|
| 474 |
+
return $this->post;
|
| 475 |
+
}
|
| 476 |
+
return false;
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
public function setPostByTaxID($term_taxonomy_id = 0, $taxonomy = 'category') {
|
| 480 |
+
if ($term_taxonomy_id > 0) {
|
| 481 |
+
global $wp_query;
|
| 482 |
+
|
| 483 |
+
$term = get_term($term_taxonomy_id, $taxonomy);
|
| 484 |
+
if ($taxonomy == 'category') {
|
| 485 |
+
$args = array('posts_per_page' => '1', 'cat' => $term_taxonomy_id);
|
| 486 |
+
} elseif ($taxonomy == 'post_tag') {
|
| 487 |
+
$args = array('posts_per_page' => 1, 'tag_id' => $term_taxonomy_id);
|
| 488 |
+
} else {
|
| 489 |
+
$args = array('posts_per_page' => 1, $taxonomy => $term->slug, 'term_id' => $term_taxonomy_id);
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
$tax_query = array(
|
| 493 |
+
array(
|
| 494 |
+
'taxonomy' => $taxonomy,
|
| 495 |
+
'terms' => $term->slug,
|
| 496 |
+
'field' => 'slug',
|
| 497 |
+
'include_children' => true,
|
| 498 |
+
'operator' => 'IN'
|
| 499 |
+
),
|
| 500 |
+
array(
|
| 501 |
+
'taxonomy' => $taxonomy,
|
| 502 |
+
'terms' => $term->slug,
|
| 503 |
+
'field' => 'slug',
|
| 504 |
+
'include_children' => false,
|
| 505 |
+
)
|
| 506 |
+
);
|
| 507 |
+
|
| 508 |
+
$args['tax_query'] = $tax_query;
|
| 509 |
+
$wp_query->query($args);
|
| 510 |
+
set_query_var('post_type', $taxonomy);
|
| 511 |
+
|
| 512 |
+
if ($this->post = SQ_Classes_ObjController::getClass('SQ_Models_Frontend')->setPost($term)->getPost()) {
|
| 513 |
+
return $this->post;
|
| 514 |
+
}
|
| 515 |
+
}
|
| 516 |
+
return false;
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
public function setCurrentPost() {
|
| 520 |
+
return $this->post;
|
| 521 |
+
}
|
| 522 |
+
|
| 523 |
+
/**
|
| 524 |
+
* Is the user on page name? Default name = post edit page
|
| 525 |
+
* name = 'quirrly'
|
| 526 |
+
*
|
| 527 |
+
* @global array $pagenow
|
| 528 |
+
* @param string $name
|
| 529 |
+
* @return boolean
|
| 530 |
+
*/
|
| 531 |
+
public function is_page($name = '') {
|
| 532 |
+
global $pagenow;
|
| 533 |
+
$page = array();
|
| 534 |
+
//make sure we are on the backend
|
| 535 |
+
if (is_admin() && $name <> '') {
|
| 536 |
+
if ($name == 'edit') {
|
| 537 |
+
$page = array('post.php', 'post-new.php');
|
| 538 |
+
} else {
|
| 539 |
+
array_push($page, $name . '.php');
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
return in_array($pagenow, $page);
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
return false;
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
}
|
controllers/{SQ_Post.php → Post.php}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class
|
| 4 |
|
| 5 |
public $saved;
|
| 6 |
|
|
@@ -16,15 +16,15 @@ class SQ_Post extends SQ_FrontController {
|
|
| 16 |
add_filter('mce_external_plugins', array($this->model, 'addHeadingButton'));
|
| 17 |
add_filter('mce_buttons', array($this->model, 'registerButton'));
|
| 18 |
|
| 19 |
-
if (
|
| 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 (
|
| 27 |
-
add_action('transition_post_status', array(
|
| 28 |
}
|
| 29 |
}
|
| 30 |
|
|
@@ -44,14 +44,14 @@ class SQ_Post extends SQ_FrontController {
|
|
| 44 |
* Set the global variable $sq_postID for cookie and keyword record
|
| 45 |
*/
|
| 46 |
if ((int)$post_ID == 0) {
|
| 47 |
-
if (
|
| 48 |
-
$GLOBALS['sq_postID'] = (int)
|
| 49 |
} else {
|
| 50 |
$GLOBALS['sq_postID'] = $post_ID;
|
| 51 |
}
|
| 52 |
/* * ****************************** */
|
| 53 |
|
| 54 |
-
echo '<script type="text/javascript">(function() {
|
| 55 |
}
|
| 56 |
|
| 57 |
/**
|
|
@@ -75,20 +75,20 @@ class SQ_Post extends SQ_FrontController {
|
|
| 75 |
remove_action('save_post', array($this, 'hookSavePost'), 99);
|
| 76 |
|
| 77 |
//If the post is a new or edited post
|
| 78 |
-
if ((
|
| 79 |
wp_is_post_autosave($post_id) == '' &&
|
| 80 |
get_post_status($post_id) != 'auto-draft' &&
|
| 81 |
get_post_status($post_id) != 'inherit' &&
|
| 82 |
-
|
| 83 |
) {
|
| 84 |
|
| 85 |
if ($this->saved[$post_id] === false) {
|
| 86 |
-
//check for custom SEO
|
| 87 |
-
$this->_checkAdvMeta($post_id);
|
| 88 |
//check the SEO from Squirrly Live Assistant
|
| 89 |
$this->checkSeo($post_id, get_post_status($post_id));
|
| 90 |
//check the remote images
|
| 91 |
$this->checkImage($post_id);
|
|
|
|
|
|
|
| 92 |
}
|
| 93 |
$this->saved[$post_id] = true;
|
| 94 |
}
|
|
@@ -97,6 +97,22 @@ class SQ_Post extends SQ_FrontController {
|
|
| 97 |
add_action('save_post', array($this, 'hookSavePost'), 99);
|
| 98 |
}
|
| 99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
/**
|
| 101 |
* Check if the image is a remote image and save it locally
|
| 102 |
*
|
|
@@ -106,12 +122,12 @@ class SQ_Post extends SQ_FrontController {
|
|
| 106 |
public function checkImage($post_id) {
|
| 107 |
|
| 108 |
//if the option to save the images locally is set on
|
| 109 |
-
if (
|
| 110 |
|
| 111 |
@set_time_limit(90);
|
| 112 |
$local_file = false;
|
| 113 |
|
| 114 |
-
$content =
|
| 115 |
$tmpcontent = trim(html_entity_decode($content), "\n");
|
| 116 |
$urls = array();
|
| 117 |
|
|
@@ -147,7 +163,6 @@ class SQ_Post extends SQ_FrontController {
|
|
| 147 |
$time = microtime(true);
|
| 148 |
foreach ($urls as $url) {
|
| 149 |
if ($file = $this->model->upload_image($url)) {
|
| 150 |
-
|
| 151 |
if (!file_is_valid_image($file['file']))
|
| 152 |
continue;
|
| 153 |
|
|
@@ -155,21 +170,25 @@ class SQ_Post extends SQ_FrontController {
|
|
| 155 |
if ($local_file !== false) {
|
| 156 |
$content = str_replace($url, $local_file, $content);
|
| 157 |
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
| 168 |
}
|
| 169 |
}
|
|
|
|
| 170 |
if (microtime(true) - $time >= 20) {
|
| 171 |
break;
|
| 172 |
}
|
|
|
|
| 173 |
}
|
| 174 |
|
| 175 |
|
|
@@ -182,6 +201,7 @@ class SQ_Post extends SQ_FrontController {
|
|
| 182 |
}
|
| 183 |
}
|
| 184 |
|
|
|
|
| 185 |
/**
|
| 186 |
* Check the SEO from Squirrly Live Assistant
|
| 187 |
*
|
|
@@ -191,22 +211,22 @@ class SQ_Post extends SQ_FrontController {
|
|
| 191 |
public function checkSeo($post_id, $status = '') {
|
| 192 |
$args = array();
|
| 193 |
|
| 194 |
-
$seo =
|
| 195 |
|
| 196 |
if (is_array($seo) && count($seo) > 0)
|
| 197 |
$args['seo'] = implode(',', $seo);
|
| 198 |
|
| 199 |
-
$args['keyword'] =
|
| 200 |
|
| 201 |
$args['status'] = $status;
|
| 202 |
$args['permalink'] = get_permalink($post_id);
|
| 203 |
$args['permalink'] = $this->getPaged($args['permalink']);
|
| 204 |
-
$args['author'] = (int)
|
| 205 |
$args['post_id'] = $post_id;
|
| 206 |
|
| 207 |
|
| 208 |
-
if (
|
| 209 |
-
|
| 210 |
} else {
|
| 211 |
$process = array();
|
| 212 |
if (get_option('sq_seopost') !== false) {
|
|
@@ -222,13 +242,18 @@ class SQ_Post extends SQ_FrontController {
|
|
| 222 |
|
| 223 |
//Save the keyword for this post
|
| 224 |
if ($json = $this->model->getKeyword($post_id)) {
|
| 225 |
-
$json->keyword = addslashes(
|
| 226 |
$this->model->saveKeyword($post_id, $json);
|
| 227 |
} else {
|
| 228 |
$args = array();
|
| 229 |
-
$args['keyword'] = addslashes(
|
| 230 |
$this->model->saveKeyword($post_id, json_decode(json_encode($args)));
|
| 231 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
}
|
| 233 |
|
| 234 |
public function getPaged($link) {
|
|
@@ -247,13 +272,7 @@ class SQ_Post extends SQ_FrontController {
|
|
| 247 |
public function action() {
|
| 248 |
parent::action();
|
| 249 |
|
| 250 |
-
switch (
|
| 251 |
-
case 'sq_save_meta':
|
| 252 |
-
$return = $this->_checkAdvMeta(SQ_Tools::getValue('post_id'));
|
| 253 |
-
SQ_Tools::setHeader('json');
|
| 254 |
-
echo json_encode($return);
|
| 255 |
-
SQ_Tools::emptyCache();
|
| 256 |
-
break;
|
| 257 |
case 'sq_save_ogimage':
|
| 258 |
if (!empty($_FILES['ogimage'])) {
|
| 259 |
$return = $this->model->addImage($_FILES['ogimage']);
|
|
@@ -267,93 +286,63 @@ class SQ_Post extends SQ_FrontController {
|
|
| 267 |
'post_content' => '',
|
| 268 |
'post_status' => 'inherit',
|
| 269 |
'guid' => $local_file
|
| 270 |
-
), $return['file'],
|
| 271 |
|
| 272 |
$attach_data = wp_generate_attachment_metadata($attach_id, $return['file']);
|
| 273 |
wp_update_attachment_metadata($attach_id, $attach_data);
|
| 274 |
}
|
| 275 |
-
|
| 276 |
echo json_encode($return);
|
| 277 |
-
|
| 278 |
|
| 279 |
break;
|
| 280 |
case 'sq_get_keyword':
|
| 281 |
-
|
| 282 |
-
if (
|
| 283 |
-
echo json_encode($this->model->getKeywordsFromPost(
|
| 284 |
} else {
|
| 285 |
echo json_encode(array('error' => true));
|
| 286 |
}
|
| 287 |
-
|
| 288 |
break;
|
| 289 |
}
|
| 290 |
exit();
|
| 291 |
}
|
| 292 |
|
| 293 |
/**
|
| 294 |
-
*
|
| 295 |
-
* @param
|
| 296 |
-
* @return array | false
|
| 297 |
-
*
|
| 298 |
*/
|
| 299 |
-
private function
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
$
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
if (SQ_Tools::getIsset('sq_canonical'))
|
| 320 |
-
$meta[] = array('key' => '_sq_canonical',
|
| 321 |
-
'value' => SQ_Tools::getValue('sq_canonical'));
|
| 322 |
-
|
| 323 |
-
$this->model->saveAdvMeta($post_id, $meta);
|
| 324 |
-
|
| 325 |
-
return $meta;
|
| 326 |
}
|
| 327 |
-
return false;
|
| 328 |
}
|
| 329 |
|
| 330 |
public function hookFooter() {
|
| 331 |
-
if (!defined('DISABLE_WP_CRON') || DISABLE_WP_CRON
|
| 332 |
global $pagenow;
|
| 333 |
if (in_array($pagenow, array('post.php', 'post-new.php'))) {
|
| 334 |
-
|
| 335 |
}
|
| 336 |
}
|
| 337 |
}
|
| 338 |
|
| 339 |
-
public function processCron() {
|
| 340 |
-
SQ_ObjController::getController('SQ_Tools', false);
|
| 341 |
-
SQ_ObjController::getController('SQ_Action', false);
|
| 342 |
-
|
| 343 |
-
if (get_option('sq_seopost') !== false) {
|
| 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 |
-
|
| 351 |
-
if (isset($response->saved) && $response->saved == true) {
|
| 352 |
-
unset($process[$key]);
|
| 353 |
-
}
|
| 354 |
-
}
|
| 355 |
-
update_option('sq_seopost', json_encode($process));
|
| 356 |
-
}
|
| 357 |
-
}
|
| 358 |
-
|
| 359 |
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class SQ_Controllers_Post extends SQ_Classes_FrontController {
|
| 4 |
|
| 5 |
public $saved;
|
| 6 |
|
| 16 |
add_filter('mce_external_plugins', array($this->model, 'addHeadingButton'));
|
| 17 |
add_filter('mce_buttons', array($this->model, 'registerButton'));
|
| 18 |
|
| 19 |
+
if (SQ_Classes_Tools::getOption('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_Classes_Tools::getOption('sq_use') && SQ_Classes_Tools::getOption('sq_auto_sitemap')) {
|
| 27 |
+
add_action('transition_post_status', array(SQ_Classes_ObjController::getClass('SQ_Controllers_Sitemaps'), 'refreshSitemap'), 9999, 3);
|
| 28 |
}
|
| 29 |
}
|
| 30 |
|
| 44 |
* Set the global variable $sq_postID for cookie and keyword record
|
| 45 |
*/
|
| 46 |
if ((int)$post_ID == 0) {
|
| 47 |
+
if (SQ_Classes_Tools::getIsset('id'))
|
| 48 |
+
$GLOBALS['sq_postID'] = (int)SQ_Classes_Tools::getValue('id');
|
| 49 |
} else {
|
| 50 |
$GLOBALS['sq_postID'] = $post_ID;
|
| 51 |
}
|
| 52 |
/* * ****************************** */
|
| 53 |
|
| 54 |
+
echo '<script type="text/javascript">(function($) {$.sq_tinymce = { callback: function () {}, setup: function(ed){} } })(jQuery);</script>';
|
| 55 |
}
|
| 56 |
|
| 57 |
/**
|
| 75 |
remove_action('save_post', array($this, 'hookSavePost'), 99);
|
| 76 |
|
| 77 |
//If the post is a new or edited post
|
| 78 |
+
if ((SQ_Classes_Tools::getValue('action')) == 'editpost' &&
|
| 79 |
wp_is_post_autosave($post_id) == '' &&
|
| 80 |
get_post_status($post_id) != 'auto-draft' &&
|
| 81 |
get_post_status($post_id) != 'inherit' &&
|
| 82 |
+
SQ_Classes_Tools::getValue('autosave') == ''
|
| 83 |
) {
|
| 84 |
|
| 85 |
if ($this->saved[$post_id] === false) {
|
|
|
|
|
|
|
| 86 |
//check the SEO from Squirrly Live Assistant
|
| 87 |
$this->checkSeo($post_id, get_post_status($post_id));
|
| 88 |
//check the remote images
|
| 89 |
$this->checkImage($post_id);
|
| 90 |
+
//check sq mark remained
|
| 91 |
+
$this->removeHighlight($post_id);
|
| 92 |
}
|
| 93 |
$this->saved[$post_id] = true;
|
| 94 |
}
|
| 97 |
add_action('save_post', array($this, 'hookSavePost'), 99);
|
| 98 |
}
|
| 99 |
|
| 100 |
+
/**
|
| 101 |
+
* Remove the Squirrly Highlights in case there are some left
|
| 102 |
+
* @param $post_id
|
| 103 |
+
*/
|
| 104 |
+
public function removeHighlight($post_id) {
|
| 105 |
+
$content = SQ_Classes_Tools::getValue('post_content', '', true); //get the content in html format
|
| 106 |
+
|
| 107 |
+
if (strpos($content, '<mark') !== false) {
|
| 108 |
+
$content = preg_replace('/<mark[^>]*data-markjs="true"[^>]*>([^<]*)<\/mark>/i', '$1', $content);
|
| 109 |
+
wp_update_post(array(
|
| 110 |
+
'ID' => $post_id,
|
| 111 |
+
'post_content' => $content)
|
| 112 |
+
);
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
/**
|
| 117 |
* Check if the image is a remote image and save it locally
|
| 118 |
*
|
| 122 |
public function checkImage($post_id) {
|
| 123 |
|
| 124 |
//if the option to save the images locally is set on
|
| 125 |
+
if (SQ_Classes_Tools::getOption('sq_local_images')) {
|
| 126 |
|
| 127 |
@set_time_limit(90);
|
| 128 |
$local_file = false;
|
| 129 |
|
| 130 |
+
$content = SQ_Classes_Tools::getValue('post_content', '', true); //get the content in html format
|
| 131 |
$tmpcontent = trim(html_entity_decode($content), "\n");
|
| 132 |
$urls = array();
|
| 133 |
|
| 163 |
$time = microtime(true);
|
| 164 |
foreach ($urls as $url) {
|
| 165 |
if ($file = $this->model->upload_image($url)) {
|
|
|
|
| 166 |
if (!file_is_valid_image($file['file']))
|
| 167 |
continue;
|
| 168 |
|
| 170 |
if ($local_file !== false) {
|
| 171 |
$content = str_replace($url, $local_file, $content);
|
| 172 |
|
| 173 |
+
if (!$this->model->findAttachmentByUrl(basename($url))) {
|
| 174 |
+
$attach_id = wp_insert_attachment(array(
|
| 175 |
+
'post_mime_type' => $file['type'],
|
| 176 |
+
'post_title' => SQ_Classes_Tools::getValue('sq_keyword', preg_replace('/\.[^.]+$/', '', $file['filename'])),
|
| 177 |
+
'post_content' => '',
|
| 178 |
+
'post_status' => 'inherit',
|
| 179 |
+
'guid' => $local_file
|
| 180 |
+
), $file['file'], $post_id);
|
| 181 |
+
|
| 182 |
+
$attach_data = wp_generate_attachment_metadata($attach_id, $file['file']);
|
| 183 |
+
wp_update_attachment_metadata($attach_id, $attach_data);
|
| 184 |
+
}
|
| 185 |
}
|
| 186 |
}
|
| 187 |
+
|
| 188 |
if (microtime(true) - $time >= 20) {
|
| 189 |
break;
|
| 190 |
}
|
| 191 |
+
|
| 192 |
}
|
| 193 |
|
| 194 |
|
| 201 |
}
|
| 202 |
}
|
| 203 |
|
| 204 |
+
|
| 205 |
/**
|
| 206 |
* Check the SEO from Squirrly Live Assistant
|
| 207 |
*
|
| 211 |
public function checkSeo($post_id, $status = '') {
|
| 212 |
$args = array();
|
| 213 |
|
| 214 |
+
$seo = SQ_Classes_Tools::getValue('sq_seo');
|
| 215 |
|
| 216 |
if (is_array($seo) && count($seo) > 0)
|
| 217 |
$args['seo'] = implode(',', $seo);
|
| 218 |
|
| 219 |
+
$args['keyword'] = SQ_Classes_Tools::getValue('sq_keyword');
|
| 220 |
|
| 221 |
$args['status'] = $status;
|
| 222 |
$args['permalink'] = get_permalink($post_id);
|
| 223 |
$args['permalink'] = $this->getPaged($args['permalink']);
|
| 224 |
+
$args['author'] = (int)SQ_Classes_Tools::getUserID();
|
| 225 |
$args['post_id'] = $post_id;
|
| 226 |
|
| 227 |
|
| 228 |
+
if (SQ_Classes_Tools::getOption('sq_force_savepost')) {
|
| 229 |
+
SQ_Classes_Action::apiCall('sq/seo/post', $args, 10);
|
| 230 |
} else {
|
| 231 |
$process = array();
|
| 232 |
if (get_option('sq_seopost') !== false) {
|
| 242 |
|
| 243 |
//Save the keyword for this post
|
| 244 |
if ($json = $this->model->getKeyword($post_id)) {
|
| 245 |
+
$json->keyword = addslashes(SQ_Classes_Tools::getValue('sq_keyword'));
|
| 246 |
$this->model->saveKeyword($post_id, $json);
|
| 247 |
} else {
|
| 248 |
$args = array();
|
| 249 |
+
$args['keyword'] = addslashes(SQ_Classes_Tools::getValue('sq_keyword'));
|
| 250 |
$this->model->saveKeyword($post_id, json_decode(json_encode($args)));
|
| 251 |
}
|
| 252 |
+
|
| 253 |
+
//Save the snippet in case is edited in backend and not saved
|
| 254 |
+
SQ_Classes_ObjController::getClass('SQ_Controllers_FrontMenu')->saveSEO();
|
| 255 |
+
//check for custom SEO
|
| 256 |
+
$this->_checkBriefcaseKeywords($post_id);
|
| 257 |
}
|
| 258 |
|
| 259 |
public function getPaged($link) {
|
| 272 |
public function action() {
|
| 273 |
parent::action();
|
| 274 |
|
| 275 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
case 'sq_save_ogimage':
|
| 277 |
if (!empty($_FILES['ogimage'])) {
|
| 278 |
$return = $this->model->addImage($_FILES['ogimage']);
|
| 286 |
'post_content' => '',
|
| 287 |
'post_status' => 'inherit',
|
| 288 |
'guid' => $local_file
|
| 289 |
+
), $return['file'], SQ_Classes_Tools::getValue('post_id'));
|
| 290 |
|
| 291 |
$attach_data = wp_generate_attachment_metadata($attach_id, $return['file']);
|
| 292 |
wp_update_attachment_metadata($attach_id, $attach_data);
|
| 293 |
}
|
| 294 |
+
SQ_Classes_Tools::setHeader('json');
|
| 295 |
echo json_encode($return);
|
| 296 |
+
SQ_Classes_Tools::emptyCache();
|
| 297 |
|
| 298 |
break;
|
| 299 |
case 'sq_get_keyword':
|
| 300 |
+
SQ_Classes_Tools::setHeader('json');
|
| 301 |
+
if (SQ_Classes_Tools::getIsset('post_id')) {
|
| 302 |
+
echo json_encode($this->model->getKeywordsFromPost(SQ_Classes_Tools::getValue('post_id')));
|
| 303 |
} else {
|
| 304 |
echo json_encode(array('error' => true));
|
| 305 |
}
|
| 306 |
+
SQ_Classes_Tools::emptyCache();
|
| 307 |
break;
|
| 308 |
}
|
| 309 |
exit();
|
| 310 |
}
|
| 311 |
|
| 312 |
/**
|
| 313 |
+
* Save the keywords from briefcase into the meta keywords if there are no keywords saved
|
| 314 |
+
* @param $post_id
|
|
|
|
|
|
|
| 315 |
*/
|
| 316 |
+
private function _checkBriefcaseKeywords($post_id) {
|
| 317 |
+
if (SQ_Classes_Tools::getIsset('sq_hash')) {
|
| 318 |
+
$keywords = SQ_Classes_Tools::getValue('sq_briefcase_keyword', array());
|
| 319 |
+
if (!empty($keywords)) {
|
| 320 |
+
$sq_hash = SQ_Classes_Tools::getValue('sq_hash', md5($post_id));
|
| 321 |
+
$url = SQ_Classes_Tools::getValue('sq_url', get_permalink($post_id));
|
| 322 |
+
$sq = SQ_Classes_ObjController::getClass('SQ_Models_Frontend')->getSqSeo($sq_hash);
|
| 323 |
+
|
| 324 |
+
if ($sq->doseo && $sq->keywords == '') {
|
| 325 |
+
$sq->keywords = join(',', $keywords);
|
| 326 |
+
|
| 327 |
+
SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->db_insert(
|
| 328 |
+
$url,
|
| 329 |
+
$sq_hash,
|
| 330 |
+
(int)$post_id,
|
| 331 |
+
maybe_serialize($sq->toArray()),
|
| 332 |
+
gmdate('Y-m-d H:i:s')
|
| 333 |
+
);
|
| 334 |
+
}
|
| 335 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
}
|
|
|
|
| 337 |
}
|
| 338 |
|
| 339 |
public function hookFooter() {
|
| 340 |
+
if (!defined('DISABLE_WP_CRON') || DISABLE_WP_CRON) {
|
| 341 |
global $pagenow;
|
| 342 |
if (in_array($pagenow, array('post.php', 'post-new.php'))) {
|
| 343 |
+
SQ_Classes_ObjController::getClass('SQ_Controllers_Cron')->processSEOPostCron();
|
| 344 |
}
|
| 345 |
}
|
| 346 |
}
|
| 347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
}
|
controllers/{SQ_PostsList.php → PostsList.php}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class
|
| 4 |
{
|
| 5 |
|
| 6 |
/** @var array Posts types in */
|
|
@@ -17,11 +17,11 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 17 |
private $posts = array();
|
| 18 |
|
| 19 |
/**
|
| 20 |
-
* Called in
|
| 21 |
*/
|
| 22 |
public function init()
|
| 23 |
{
|
| 24 |
-
$this->types = array_map(array($this, '_addPostsType'),
|
| 25 |
}
|
| 26 |
|
| 27 |
protected function _addPostsType($type)
|
|
@@ -44,12 +44,12 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 44 |
*/
|
| 45 |
public function hookInit()
|
| 46 |
{
|
| 47 |
-
$browser =
|
| 48 |
|
| 49 |
if ($browser['name'] == 'IE' && (int)$browser['version'] < 9 && (int)$browser['version'] > 0)
|
| 50 |
return;
|
| 51 |
|
| 52 |
-
if (
|
| 53 |
foreach ($this->types as $type) {
|
| 54 |
|
| 55 |
if (isset($options['hideeditbox-post']) && $options['hideeditbox-post'])
|
|
@@ -57,36 +57,16 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 57 |
add_filter('manage_' . $type . '_columns', array($this, 'add_column'), 10, 1);
|
| 58 |
add_action('manage_' . $type . '_custom_column', array($this, 'add_row'), 10, 2);
|
| 59 |
}
|
| 60 |
-
add_filter('posts_where', array($this, 'filterPosts'));
|
| 61 |
}
|
| 62 |
}
|
| 63 |
|
| 64 |
-
/**
|
| 65 |
-
* Filter the Posts when sq_post_id is set
|
| 66 |
-
*
|
| 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;
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
/**
|
| 83 |
* Hook the Wordpress header
|
| 84 |
*/
|
| 85 |
public function loadHead()
|
| 86 |
{
|
| 87 |
parent::hookHead();
|
| 88 |
-
|
| 89 |
-
->loadMedia(_SQ_THEME_URL_ . '/css/sq_postslist.css');
|
| 90 |
}
|
| 91 |
|
| 92 |
/**
|
|
@@ -111,9 +91,6 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 111 |
*/
|
| 112 |
public function add_row($column, $post_id)
|
| 113 |
{
|
| 114 |
-
$title = '';
|
| 115 |
-
$description = '';
|
| 116 |
-
$frontend = null;
|
| 117 |
$cached = false;
|
| 118 |
|
| 119 |
if ($column == $this->column_id) {
|
|
@@ -126,15 +103,9 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 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 =
|
| 130 |
$title = $frontend->getAdvancedMeta($post_id, 'title');
|
| 131 |
$description = $frontend->getAdvancedMeta($post_id, 'description');
|
| 132 |
-
if ($post_id == get_option('page_on_front')) {
|
| 133 |
-
if (SQ_Tools::$options['sq_fp_title'] <> '' && !$title)
|
| 134 |
-
$title = SQ_Tools::$options['sq_fp_title'];
|
| 135 |
-
if (SQ_Tools::$options['sq_fp_description'] <> '' && !$description)
|
| 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>';
|
|
@@ -178,7 +149,7 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 178 |
var __sq_refresh = "' . __('Update', _SQ_PLUGIN_NAME_) . '"
|
| 179 |
|
| 180 |
var __sq_dashurl = "' . _SQ_STATIC_API_URL_ . '";
|
| 181 |
-
var __token = "' .
|
| 182 |
var __sq_ranknotpublic_text = "' . __('Not Public', _SQ_PLUGIN_NAME_) . '";
|
| 183 |
var __sq_couldnotprocess_text = "' . __('Could not process', _SQ_PLUGIN_NAME_) . '";
|
| 184 |
</script>';
|
|
@@ -190,7 +161,7 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 190 |
//load the rank from squirrly
|
| 191 |
if (typeof sq_script === "undefined"){
|
| 192 |
var sq_script = document.createElement(\'script\');
|
| 193 |
-
sq_script.src = "' . _SQ_STATIC_API_URL_ . SQ_URI . '/js/sq_rank.js?ver=' . SQ_VERSION_ID . '";
|
| 194 |
var site_head = document.getElementsByTagName ("head")[0] || document.documentElement;
|
| 195 |
site_head.insertBefore(sq_script, site_head.firstChild);
|
| 196 |
}
|
|
@@ -258,16 +229,16 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 258 |
public function action()
|
| 259 |
{
|
| 260 |
parent::action();
|
| 261 |
-
switch (
|
| 262 |
case 'sq_posts_rank':
|
| 263 |
-
|
| 264 |
$args = array();
|
| 265 |
-
$posts =
|
| 266 |
if (is_array($posts) && !empty($posts)) {
|
| 267 |
-
$posts =
|
| 268 |
$args['posts'] = join(',', $posts);
|
| 269 |
|
| 270 |
-
$response = json_decode(
|
| 271 |
}
|
| 272 |
if (isset($response) && is_object($response)) {
|
| 273 |
$response = $this->model->getTotal($response);
|
|
@@ -276,13 +247,13 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 276 |
exit(json_encode(array('posts' => array())));
|
| 277 |
break;
|
| 278 |
case 'sq_post_rank':
|
| 279 |
-
|
| 280 |
$args = array();
|
| 281 |
$rank = null;
|
| 282 |
-
$this->model->post_id = (int)
|
| 283 |
$args['post_id'] = $this->model->post_id;
|
| 284 |
|
| 285 |
-
if ($json =
|
| 286 |
if (isset($json->rank)) {
|
| 287 |
$rank = $json->rank;
|
| 288 |
} else {
|
|
@@ -290,43 +261,43 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 290 |
}
|
| 291 |
|
| 292 |
if (isset($rank) && $rank !== false) {
|
| 293 |
-
$ranking =
|
| 294 |
$args['rank'] = (string)$rank;
|
| 295 |
$args['country'] = $ranking->getCountry();
|
| 296 |
$args['language'] = $ranking->getLanguage();
|
| 297 |
}
|
| 298 |
}
|
| 299 |
|
| 300 |
-
$response = json_decode(
|
| 301 |
|
| 302 |
if (!is_object($response)) {
|
| 303 |
exit(json_encode(array('error' => $response)));
|
| 304 |
} else {
|
| 305 |
-
//
|
| 306 |
-
$analytics =
|
| 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 |
-
if (
|
| 313 |
exit();
|
| 314 |
}
|
| 315 |
exit(json_encode($response));
|
| 316 |
}
|
| 317 |
break;
|
| 318 |
case 'sq_recheck':
|
| 319 |
-
|
| 320 |
-
if (
|
| 321 |
-
$this->model->post_id = (int)
|
| 322 |
-
if ($json =
|
| 323 |
$oldrank = (isset($json->rank) ? $json->rank : -1);
|
| 324 |
if (get_transient('sq_rank' . $this->model->post_id) !== false) {
|
| 325 |
delete_transient('sq_rank' . $this->model->post_id);
|
| 326 |
}
|
| 327 |
|
| 328 |
$this->checkKeyword($json->keyword, true);
|
| 329 |
-
$json =
|
| 330 |
if ($json->rank === false) {
|
| 331 |
exit(json_encode(array('error' => true)));
|
| 332 |
} else {
|
|
@@ -347,8 +318,8 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 347 |
|
| 348 |
exit(json_encode(array('error' => true)));
|
| 349 |
} else {
|
| 350 |
-
$this->model->post_id = (int)
|
| 351 |
-
if ($json =
|
| 352 |
if ($json->rank === false) {
|
| 353 |
exit(json_encode(array('error' => true)));
|
| 354 |
} else {
|
|
@@ -381,13 +352,13 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 381 |
if ($keyword == '')
|
| 382 |
return;
|
| 383 |
|
| 384 |
-
$ranking =
|
| 385 |
if (is_object($ranking)) {
|
| 386 |
$rank = get_transient('sq_rank' . $this->model->post_id);
|
| 387 |
//if the rank is not in transient
|
| 388 |
if ($rank === false) {
|
| 389 |
//get the keyword from database
|
| 390 |
-
$json =
|
| 391 |
if ($force === false && isset($json->rank)) {
|
| 392 |
$rank = $json->rank;
|
| 393 |
//add it to transient
|
|
@@ -408,7 +379,7 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 408 |
$args['rank'] = $rank;
|
| 409 |
$args['country'] = $ranking->getCountry();
|
| 410 |
$args['language'] = $ranking->getLanguage();
|
| 411 |
-
|
| 412 |
}
|
| 413 |
//add it to transient
|
| 414 |
set_transient('sq_rank' . $this->model->post_id, $rank, (60 * 60 * 24 * 1));
|
|
@@ -422,7 +393,7 @@ class SQ_PostsList extends SQ_FrontController
|
|
| 422 |
$args['rank'] = (string)$rank;
|
| 423 |
$args['country'] = $ranking->getCountry();
|
| 424 |
$args['language'] = $ranking->getLanguage();
|
| 425 |
-
|
| 426 |
}
|
| 427 |
}
|
| 428 |
return $rank;
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class SQ_Controllers_PostsList extends SQ_Classes_FrontController
|
| 4 |
{
|
| 5 |
|
| 6 |
/** @var array Posts types in */
|
| 17 |
private $posts = array();
|
| 18 |
|
| 19 |
/**
|
| 20 |
+
* Called in SQ_Controllers_Menu > hookMenu
|
| 21 |
*/
|
| 22 |
public function init()
|
| 23 |
{
|
| 24 |
+
$this->types = array_map(array($this, '_addPostsType'), SQ_Classes_Tools::getOption('sq_post_types'));
|
| 25 |
}
|
| 26 |
|
| 27 |
protected function _addPostsType($type)
|
| 44 |
*/
|
| 45 |
public function hookInit()
|
| 46 |
{
|
| 47 |
+
$browser = SQ_Classes_Tools::getBrowserInfo();
|
| 48 |
|
| 49 |
if ($browser['name'] == 'IE' && (int)$browser['version'] < 9 && (int)$browser['version'] > 0)
|
| 50 |
return;
|
| 51 |
|
| 52 |
+
if (SQ_Classes_Tools::getOption('sq_api') <> '') {
|
| 53 |
foreach ($this->types as $type) {
|
| 54 |
|
| 55 |
if (isset($options['hideeditbox-post']) && $options['hideeditbox-post'])
|
| 57 |
add_filter('manage_' . $type . '_columns', array($this, 'add_column'), 10, 1);
|
| 58 |
add_action('manage_' . $type . '_custom_column', array($this, 'add_row'), 10, 2);
|
| 59 |
}
|
|
|
|
| 60 |
}
|
| 61 |
}
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
/**
|
| 64 |
* Hook the Wordpress header
|
| 65 |
*/
|
| 66 |
public function loadHead()
|
| 67 |
{
|
| 68 |
parent::hookHead();
|
| 69 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia(_SQ_THEME_URL_ . '/css/postslist.css');
|
|
|
|
| 70 |
}
|
| 71 |
|
| 72 |
/**
|
| 91 |
*/
|
| 92 |
public function add_row($column, $post_id)
|
| 93 |
{
|
|
|
|
|
|
|
|
|
|
| 94 |
$cached = false;
|
| 95 |
|
| 96 |
if ($column == $this->column_id) {
|
| 103 |
|
| 104 |
echo '<div class="' . $this->column_id . '_row" ref="' . $post_id . '">' . (($cached) ? $_COOKIE[$this->column_id . $post_id] : 'loading ...') . '</div>';
|
| 105 |
|
| 106 |
+
if ($frontend = SQ_Classes_ObjController::getClass('SQ_Models_Frontend')) {
|
| 107 |
$title = $frontend->getAdvancedMeta($post_id, 'title');
|
| 108 |
$description = $frontend->getAdvancedMeta($post_id, 'description');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
echo '<script type="text/javascript">
|
| 110 |
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>' : '') . '\');
|
| 111 |
</script>';
|
| 149 |
var __sq_refresh = "' . __('Update', _SQ_PLUGIN_NAME_) . '"
|
| 150 |
|
| 151 |
var __sq_dashurl = "' . _SQ_STATIC_API_URL_ . '";
|
| 152 |
+
var __token = "' . SQ_Classes_Tools::getOption('sq_api') . '";
|
| 153 |
var __sq_ranknotpublic_text = "' . __('Not Public', _SQ_PLUGIN_NAME_) . '";
|
| 154 |
var __sq_couldnotprocess_text = "' . __('Could not process', _SQ_PLUGIN_NAME_) . '";
|
| 155 |
</script>';
|
| 161 |
//load the rank from squirrly
|
| 162 |
if (typeof sq_script === "undefined"){
|
| 163 |
var sq_script = document.createElement(\'script\');
|
| 164 |
+
sq_script.src = "' . _SQ_STATIC_API_URL_ . SQ_URI . '/js/sq_rank' . (SQ_DEBUG ? '' : '.min') . '.js?ver=' . SQ_VERSION_ID . '";
|
| 165 |
var site_head = document.getElementsByTagName ("head")[0] || document.documentElement;
|
| 166 |
site_head.insertBefore(sq_script, site_head.firstChild);
|
| 167 |
}
|
| 229 |
public function action()
|
| 230 |
{
|
| 231 |
parent::action();
|
| 232 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 233 |
case 'sq_posts_rank':
|
| 234 |
+
SQ_Classes_Tools::setHeader('json');
|
| 235 |
$args = array();
|
| 236 |
+
$posts = SQ_Classes_Tools::getValue('posts');
|
| 237 |
if (is_array($posts) && !empty($posts)) {
|
| 238 |
+
$posts = SQ_Classes_Tools::getValue('posts');
|
| 239 |
$args['posts'] = join(',', $posts);
|
| 240 |
|
| 241 |
+
$response = json_decode(SQ_Classes_Action::apiCall('sq/user-analytics/total', $args, 20));
|
| 242 |
}
|
| 243 |
if (isset($response) && is_object($response)) {
|
| 244 |
$response = $this->model->getTotal($response);
|
| 247 |
exit(json_encode(array('posts' => array())));
|
| 248 |
break;
|
| 249 |
case 'sq_post_rank':
|
| 250 |
+
SQ_Classes_Tools::setHeader('json');
|
| 251 |
$args = array();
|
| 252 |
$rank = null;
|
| 253 |
+
$this->model->post_id = (int)SQ_Classes_Tools::getValue('post');
|
| 254 |
$args['post_id'] = $this->model->post_id;
|
| 255 |
|
| 256 |
+
if ($json = SQ_Classes_ObjController::getClass('SQ_Models_Post')->getKeyword($this->model->post_id)) {
|
| 257 |
if (isset($json->rank)) {
|
| 258 |
$rank = $json->rank;
|
| 259 |
} else {
|
| 261 |
}
|
| 262 |
|
| 263 |
if (isset($rank) && $rank !== false) {
|
| 264 |
+
$ranking = SQ_Classes_ObjController::getClass('SQ_Classes_Ranking');
|
| 265 |
$args['rank'] = (string)$rank;
|
| 266 |
$args['country'] = $ranking->getCountry();
|
| 267 |
$args['language'] = $ranking->getLanguage();
|
| 268 |
}
|
| 269 |
}
|
| 270 |
|
| 271 |
+
$response = json_decode(SQ_Classes_Action::apiCall('sq/user-analytics/detail', $args, 20));
|
| 272 |
|
| 273 |
if (!is_object($response)) {
|
| 274 |
exit(json_encode(array('error' => $response)));
|
| 275 |
} else {
|
| 276 |
+
//SQ_Classes_Tools::dump($response);
|
| 277 |
+
$analytics = SQ_Classes_ObjController::getClass('SQ_Core_BlockAnalytics');
|
| 278 |
$analytics->flush = false;
|
| 279 |
$analytics->post_id = $this->model->post_id;
|
| 280 |
$analytics->audit = $this->model->getAnalytics($response, $this->model->post_id);
|
| 281 |
|
| 282 |
$response = $analytics->init();
|
| 283 |
+
if (SQ_Classes_Tools::getValue('sq_debug') === 'on') {
|
| 284 |
exit();
|
| 285 |
}
|
| 286 |
exit(json_encode($response));
|
| 287 |
}
|
| 288 |
break;
|
| 289 |
case 'sq_recheck':
|
| 290 |
+
SQ_Classes_Tools::setHeader('json');
|
| 291 |
+
if (SQ_Classes_Tools::getValue('sq_debug') === 'on' || get_transient('google_blocked') === false) {
|
| 292 |
+
$this->model->post_id = (int)SQ_Classes_Tools::getValue('post_id');
|
| 293 |
+
if ($json = SQ_Classes_ObjController::getClass('SQ_Models_Post')->getKeyword($this->model->post_id)) {
|
| 294 |
$oldrank = (isset($json->rank) ? $json->rank : -1);
|
| 295 |
if (get_transient('sq_rank' . $this->model->post_id) !== false) {
|
| 296 |
delete_transient('sq_rank' . $this->model->post_id);
|
| 297 |
}
|
| 298 |
|
| 299 |
$this->checkKeyword($json->keyword, true);
|
| 300 |
+
$json = SQ_Classes_ObjController::getClass('SQ_Models_Post')->getKeyword($this->model->post_id);
|
| 301 |
if ($json->rank === false) {
|
| 302 |
exit(json_encode(array('error' => true)));
|
| 303 |
} else {
|
| 318 |
|
| 319 |
exit(json_encode(array('error' => true)));
|
| 320 |
} else {
|
| 321 |
+
$this->model->post_id = (int)SQ_Classes_Tools::getValue('post_id');
|
| 322 |
+
if ($json = SQ_Classes_ObjController::getClass('SQ_Models_Post')->getKeyword($this->model->post_id)) {
|
| 323 |
if ($json->rank === false) {
|
| 324 |
exit(json_encode(array('error' => true)));
|
| 325 |
} else {
|
| 352 |
if ($keyword == '')
|
| 353 |
return;
|
| 354 |
|
| 355 |
+
$ranking = SQ_Classes_ObjController::getClass('SQ_Classes_Ranking');
|
| 356 |
if (is_object($ranking)) {
|
| 357 |
$rank = get_transient('sq_rank' . $this->model->post_id);
|
| 358 |
//if the rank is not in transient
|
| 359 |
if ($rank === false) {
|
| 360 |
//get the keyword from database
|
| 361 |
+
$json = SQ_Classes_ObjController::getClass('SQ_Models_Post')->getKeyword($this->model->post_id);
|
| 362 |
if ($force === false && isset($json->rank)) {
|
| 363 |
$rank = $json->rank;
|
| 364 |
//add it to transient
|
| 379 |
$args['rank'] = $rank;
|
| 380 |
$args['country'] = $ranking->getCountry();
|
| 381 |
$args['language'] = $ranking->getLanguage();
|
| 382 |
+
SQ_Classes_ObjController::getClass('SQ_Models_Post')->saveKeyword($this->model->post_id, json_decode(json_encode($args)));
|
| 383 |
}
|
| 384 |
//add it to transient
|
| 385 |
set_transient('sq_rank' . $this->model->post_id, $rank, (60 * 60 * 24 * 1));
|
| 393 |
$args['rank'] = (string)$rank;
|
| 394 |
$args['country'] = $ranking->getCountry();
|
| 395 |
$args['language'] = $ranking->getLanguage();
|
| 396 |
+
SQ_Classes_Action::apiCall('sq/user-analytics/saveserp', $args);
|
| 397 |
}
|
| 398 |
}
|
| 399 |
return $rank;
|
controllers/SQ_Frontend.php
DELETED
|
@@ -1,218 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class SQ_Frontend extends SQ_FrontController {
|
| 4 |
-
|
| 5 |
-
public static $options;
|
| 6 |
-
|
| 7 |
-
public function __construct() {
|
| 8 |
-
|
| 9 |
-
if ($this->_isAjax()) {
|
| 10 |
-
return;
|
| 11 |
-
}
|
| 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) {
|
| 46 |
-
if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
|
| 47 |
-
foreach (SQ_Tools::$options['sq_sitemap'] as $name => $sitemap) {
|
| 48 |
-
$rules[preg_quote($sitemap[0]) . '$'] = 'index.php?sq_feed=' . $name;
|
| 49 |
-
}
|
| 50 |
-
}
|
| 51 |
-
return array_merge($rules, $wp_rewrite);
|
| 52 |
-
}
|
| 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 |
-
|
| 60 |
-
return false;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
/**
|
| 64 |
-
* Hook the Header load
|
| 65 |
-
*/
|
| 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 |
-
|
| 82 |
-
/**
|
| 83 |
-
* Called after plugins are loaded
|
| 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()) {
|
| 111 |
-
$find = $replace = $urls = array();
|
| 112 |
-
|
| 113 |
-
@preg_match_all('/<img[^>]*src=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $out);
|
| 114 |
-
if (is_array($out)) {
|
| 115 |
-
if (!is_array($out[1]) || empty($out[1]))
|
| 116 |
-
return $content;
|
| 117 |
-
|
| 118 |
-
foreach ($out[1] as $row) {
|
| 119 |
-
if (strpos($row, '//') === false) {
|
| 120 |
-
if (!in_array($row, $urls)) {
|
| 121 |
-
$urls[] = $row;
|
| 122 |
-
}
|
| 123 |
-
}
|
| 124 |
-
}
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
-
@preg_match_all('/<a[^>]*href=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $out);
|
| 128 |
-
if (is_array($out)) {
|
| 129 |
-
if (!is_array($out[1]) || empty($out[1]))
|
| 130 |
-
return $content;
|
| 131 |
-
|
| 132 |
-
foreach ($out[1] as $row) {
|
| 133 |
-
if (strpos($row, '//') === false) {
|
| 134 |
-
if (!in_array($row, $urls)) {
|
| 135 |
-
$urls[] = $row;
|
| 136 |
-
}
|
| 137 |
-
}
|
| 138 |
-
}
|
| 139 |
-
}
|
| 140 |
-
if (!is_array($urls) || (is_array($urls) && empty($urls))) {
|
| 141 |
-
return $content;
|
| 142 |
-
}
|
| 143 |
-
|
| 144 |
-
$urls = array_unique($urls);
|
| 145 |
-
foreach ($urls as $url) {
|
| 146 |
-
$find[] = "'" . $url . "'";
|
| 147 |
-
$replace[] = "'" . esc_url(get_bloginfo('url') . $url) . "'";
|
| 148 |
-
$find[] = '"' . $url . '"';
|
| 149 |
-
$replace[] = '"' . esc_url(get_bloginfo('url') . $url) . '"';
|
| 150 |
-
}
|
| 151 |
-
if (!empty($find) && !empty($replace)) {
|
| 152 |
-
$content = str_replace($find, $replace, $content);
|
| 153 |
-
}
|
| 154 |
-
}
|
| 155 |
-
return $content;
|
| 156 |
-
}
|
| 157 |
-
|
| 158 |
-
/**
|
| 159 |
-
* Validate the params for getting the basic info from the server
|
| 160 |
-
* eg favicon.ico
|
| 161 |
-
*
|
| 162 |
-
* @param array $vars
|
| 163 |
-
* @return $vars
|
| 164 |
-
*/
|
| 165 |
-
public function validateParams($vars) {
|
| 166 |
-
array_push($vars, 'sq_feed');
|
| 167 |
-
array_push($vars, 'sq_get');
|
| 168 |
-
array_push($vars, 'sq_size');
|
| 169 |
-
return $vars;
|
| 170 |
-
}
|
| 171 |
-
|
| 172 |
-
public function action() {
|
| 173 |
-
global $wp_query;
|
| 174 |
-
if (!empty($wp_query->query_vars["sq_get"])) {
|
| 175 |
-
$wp_query->is_404 = false;
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
switch (get_query_var('sq_get')) {
|
| 179 |
-
case 'favicon':
|
| 180 |
-
if (SQ_Tools::$options['favicon'] <> '') {
|
| 181 |
-
//show the favico file
|
| 182 |
-
SQ_Tools::setHeader('ico');
|
| 183 |
-
readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon']);
|
| 184 |
-
exit();
|
| 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');
|
| 192 |
-
if ($size <> '') {
|
| 193 |
-
readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon'] . get_query_var('sq_size'));
|
| 194 |
-
} else {
|
| 195 |
-
readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon']);
|
| 196 |
-
}
|
| 197 |
-
exit();
|
| 198 |
-
}
|
| 199 |
-
break;
|
| 200 |
-
|
| 201 |
-
case 'feedcss':
|
| 202 |
-
readfile(_SQ_THEME_DIR_ . 'css/' . 'sq_feed.css');
|
| 203 |
-
exit();
|
| 204 |
-
break;
|
| 205 |
-
}
|
| 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
DELETED
|
@@ -1,247 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class SQ_Menu extends SQ_FrontController {
|
| 4 |
-
|
| 5 |
-
/** @var array snippet */
|
| 6 |
-
private $post_type;
|
| 7 |
-
|
| 8 |
-
/** @var array snippet */
|
| 9 |
-
var $options = array();
|
| 10 |
-
|
| 11 |
-
public function __construct() {
|
| 12 |
-
parent::__construct();
|
| 13 |
-
add_filter('rewrite_rules_array', array(SQ_ObjController::getBlock('SQ_BlockSettingsSeo'), 'rewrite_rules'), 999, 1);
|
| 14 |
-
add_action('admin_bar_menu', array($this, 'hookTopmenu'), 999);
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
/**
|
| 18 |
-
* Hook the Admin load
|
| 19 |
-
*/
|
| 20 |
-
public function hookInit() {
|
| 21 |
-
|
| 22 |
-
/* add the plugin menu in admin */
|
| 23 |
-
if (current_user_can('manage_options')) {
|
| 24 |
-
//check if activated
|
| 25 |
-
if (get_transient('sq_activate') == 1) {
|
| 26 |
-
// Delete the redirect transient
|
| 27 |
-
delete_transient('sq_activate');
|
| 28 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 29 |
-
|
| 30 |
-
wp_safe_redirect(admin_url('admin.php?page=sq_dashboard'));
|
| 31 |
-
exit();
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
if (get_transient('sq_rewrite') == 1) {
|
| 35 |
-
// Delete the redirect transient
|
| 36 |
-
delete_transient('sq_rewrite');
|
| 37 |
-
global $wp_rewrite;
|
| 38 |
-
$wp_rewrite->flush_rules();
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
//Check if there are expected upgrades
|
| 42 |
-
SQ_Tools::checkUpgrade();
|
| 43 |
-
}
|
| 44 |
-
//activate the cron job if not exists
|
| 45 |
-
if (!wp_get_schedule('sq_processCron')) {
|
| 46 |
-
wp_schedule_event(time(), 'hourly', 'sq_processCron');
|
| 47 |
-
}
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
/**
|
| 51 |
-
* Add a menu in Admin Bar
|
| 52 |
-
*
|
| 53 |
-
* @param WP_Admin_Bar $wp_admin_bar
|
| 54 |
-
*/
|
| 55 |
-
public function hookTopmenu($wp_admin_bar) {
|
| 56 |
-
$wp_admin_bar->add_node(array(
|
| 57 |
-
'id' => 'sq_posts',
|
| 58 |
-
'title' => __('See Your Rank on Google', _SQ_PLUGIN_NAME_),
|
| 59 |
-
'href' => admin_url('admin.php?page=sq_posts'),
|
| 60 |
-
'parent' => false
|
| 61 |
-
));
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
/**
|
| 65 |
-
* Creates the Setting menu in Wordpress
|
| 66 |
-
*/
|
| 67 |
-
public function hookMenu() {
|
| 68 |
-
|
| 69 |
-
$this->post_type = SQ_Tools::$options['sq_post_types'];
|
| 70 |
-
|
| 71 |
-
//Push the Analytics Check
|
| 72 |
-
if (strpos($_SERVER['REQUEST_URI'], '?page=sq_dashboard') !== false) {
|
| 73 |
-
SQ_Tools::saveOptions('sq_dashboard', 1);
|
| 74 |
-
}
|
| 75 |
-
if (strpos($_SERVER['REQUEST_URI'], '?page=sq_analytics') !== false) {
|
| 76 |
-
SQ_Tools::saveOptions('sq_analytics', 1);
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
$analytics_alert = 0;
|
| 80 |
-
if (SQ_ObjController::getModel('SQ_Post')->countKeywords() > 0 && SQ_Tools::$options['sq_analytics'] == 0) {
|
| 81 |
-
$analytics_alert = 1;
|
| 82 |
-
if (!get_transient('sq_analytics')) {
|
| 83 |
-
set_transient('sq_analytics', time(), (60 * 60 * 24 * 7));
|
| 84 |
-
} else {
|
| 85 |
-
$time_loaded = get_transient('sq_analytics');
|
| 86 |
-
if (time() - $time_loaded > (60 * 60 * 24 * 3) && time() - $time_loaded < (60 * 60 * 24 * 14)) {
|
| 87 |
-
SQ_Error::setError(__('Check out the Squirrly Analytics section. <a href="admin.php?page=sq_posts" title="Squirrly Analytics">Click here</a>', _SQ_PLUGIN_NAME_));
|
| 88 |
-
}
|
| 89 |
-
}
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
$dashboard_alert = (int) (SQ_Tools::$options['sq_dashboard'] == 0);
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
///////////////
|
| 97 |
-
|
| 98 |
-
$this->model->addMenu(array(ucfirst(_SQ_NAME_),
|
| 99 |
-
'Squirrly' . SQ_Tools::showNotices(SQ_Tools::$errors_count, 'errors_count'),
|
| 100 |
-
'edit_posts',
|
| 101 |
-
'sq_dashboard',
|
| 102 |
-
null,
|
| 103 |
-
_SQ_THEME_URL_ . 'img/settings/menu_icon_16.png'
|
| 104 |
-
));
|
| 105 |
-
|
| 106 |
-
$this->model->addSubmenu(array('sq_dashboard',
|
| 107 |
-
ucfirst(_SQ_NAME_) . __(' Dashboard', _SQ_PLUGIN_NAME_),
|
| 108 |
-
( (SQ_Tools::$options['sq_api'] == '') ? __('First Step', _SQ_PLUGIN_NAME_) : __('Dashboard', _SQ_PLUGIN_NAME_)) . SQ_Tools::showNotices($dashboard_alert, 'errors_count'),
|
| 109 |
-
'edit_posts',
|
| 110 |
-
'sq_dashboard',
|
| 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_) . __(' Performance Analytics', _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 |
-
$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_),
|
| 159 |
-
__('SEO Settings', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices(SQ_Tools::$errors_count, 'errors_count'),
|
| 160 |
-
'manage_options',
|
| 161 |
-
'sq_seo',
|
| 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')
|
| 172 |
-
));
|
| 173 |
-
|
| 174 |
-
$this->model->addSubmenu(array('sq_dashboard',
|
| 175 |
-
ucfirst(_SQ_NAME_) . __(' Account Info', _SQ_PLUGIN_NAME_),
|
| 176 |
-
__('Account Info', _SQ_PLUGIN_NAME_),
|
| 177 |
-
'manage_options',
|
| 178 |
-
'sq_account',
|
| 179 |
-
array(SQ_ObjController::getBlock('SQ_BlockAccount'), '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 |
-
));
|
| 198 |
-
|
| 199 |
-
foreach ($this->post_type as $type)
|
| 200 |
-
$this->model->addMeta(array('post' . _SQ_NAME_,
|
| 201 |
-
ucfirst(_SQ_NAME_),
|
| 202 |
-
array(SQ_ObjController::getController('SQ_Post'), 'init'),
|
| 203 |
-
$type,
|
| 204 |
-
'side',
|
| 205 |
-
'high'
|
| 206 |
-
));
|
| 207 |
-
|
| 208 |
-
//Add the Rank in the Posts list
|
| 209 |
-
$postlist = SQ_ObjController::getController('SQ_PostsList');
|
| 210 |
-
if (is_object($postlist)) {
|
| 211 |
-
$postlist->init();
|
| 212 |
-
}
|
| 213 |
-
|
| 214 |
-
//Show bar to go back and finish the help
|
| 215 |
-
if ($this->is_page('edit') || strpos($_SERVER['REQUEST_URI'], 'sq_posts') !== false) {
|
| 216 |
-
if (SQ_Tools::$options['active_help'] <> '' && SQ_Tools::$options['ignore_warn'] == 0) {
|
| 217 |
-
SQ_Error::setError('Go back and complete the Squirrly Tasks for today <a href="admin.php?page=sq_' . SQ_Tools::$options['active_help'] . '" class="sq_button" title="Continue the Help">Continue</a>', 'helpnotice');
|
| 218 |
-
}
|
| 219 |
-
}
|
| 220 |
-
}
|
| 221 |
-
|
| 222 |
-
/**
|
| 223 |
-
* Is the user on page name? Default name = post edit page
|
| 224 |
-
* name = 'quirrly'
|
| 225 |
-
*
|
| 226 |
-
* @global array $pagenow
|
| 227 |
-
* @param string $name
|
| 228 |
-
* @return boolean
|
| 229 |
-
*/
|
| 230 |
-
public function is_page($name = '') {
|
| 231 |
-
global $pagenow;
|
| 232 |
-
$page = array();
|
| 233 |
-
//make sure we are on the backend
|
| 234 |
-
if (is_admin() && $name <> '') {
|
| 235 |
-
if ($name == 'edit') {
|
| 236 |
-
$page = array('post.php', 'post-new.php');
|
| 237 |
-
} else {
|
| 238 |
-
array_push($page, $name . '.php');
|
| 239 |
-
}
|
| 240 |
-
|
| 241 |
-
return in_array($pagenow, $page);
|
| 242 |
-
}
|
| 243 |
-
|
| 244 |
-
return false;
|
| 245 |
-
}
|
| 246 |
-
|
| 247 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
controllers/{SQ_Sitemaps.php → Sitemaps.php}
RENAMED
|
@@ -3,37 +3,70 @@
|
|
| 3 |
/**
|
| 4 |
* Class for Sitemap Generator
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
/* @var string root name */
|
| 8 |
|
| 9 |
var $root = 'sitemap';
|
| 10 |
/* @var string post limit */
|
| 11 |
-
var $posts_limit
|
| 12 |
-
var $news_limit =
|
| 13 |
|
| 14 |
public function __construct() {
|
| 15 |
parent::__construct();
|
| 16 |
-
|
|
|
|
| 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 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
$
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
}
|
| 33 |
|
| 34 |
public function refreshSitemap($new_status, $old_status, $post) {
|
| 35 |
if ($old_status <> $new_status && $new_status = 'publish') {
|
| 36 |
-
if (
|
| 37 |
wp_schedule_single_event(time() + 5, 'sq_processPing');
|
| 38 |
}
|
| 39 |
}
|
|
@@ -41,46 +74,51 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 41 |
|
| 42 |
/**
|
| 43 |
* Listen the feed call from wordpress
|
| 44 |
-
* @param
|
| 45 |
-
* @
|
|
|
|
| 46 |
*/
|
| 47 |
-
public function feedRequest($request) {
|
| 48 |
global $wp_query;
|
| 49 |
$query = array();
|
| 50 |
|
| 51 |
-
if (
|
| 52 |
-
$
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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') {
|
| 69 |
-
if (
|
| 70 |
-
|
| 71 |
}
|
| 72 |
}
|
| 73 |
|
| 74 |
-
if (isset(
|
| 75 |
|
| 76 |
-
add_action('do_feed_' . $
|
| 77 |
//PREPARE CUSTOM QUERIES
|
| 78 |
switch ($this->model->type) {
|
| 79 |
-
|
| 80 |
case 'sitemap-news':
|
| 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':
|
|
@@ -90,7 +128,7 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 90 |
add_filter('get_terms_fields', array($this, 'customTaxFilter'), 5, 2);
|
| 91 |
break;
|
| 92 |
case 'sitemap-page':
|
| 93 |
-
$query['post_type'] =
|
| 94 |
break;
|
| 95 |
case 'sitemap-author':
|
| 96 |
add_filter('sq-sitemap-authors', array($this, 'authorFilter'), 5);
|
|
@@ -115,27 +153,27 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 115 |
array_push($types, 'custom-post');
|
| 116 |
}
|
| 117 |
|
| 118 |
-
$query['post_type'] =
|
| 119 |
break;
|
| 120 |
case 'sitemap-product':
|
| 121 |
-
if (!$types =
|
| 122 |
$types = array('custom-post');
|
| 123 |
}
|
| 124 |
-
$query['post_type'] =
|
| 125 |
break;
|
| 126 |
case 'sitemap-archive':
|
| 127 |
add_filter('sq-sitemap-archive', array($this, 'archiveFilter'), 5);
|
| 128 |
break;
|
| 129 |
}
|
| 130 |
|
| 131 |
-
add_filter('post_limits', array($this, 'setLimits'));
|
| 132 |
}
|
| 133 |
}
|
| 134 |
-
|
| 135 |
if (method_exists($wp_query, 'parse_query')) {
|
| 136 |
$wp_query = new WP_Query($query);
|
|
|
|
| 137 |
}
|
| 138 |
-
|
|
|
|
| 139 |
}
|
| 140 |
|
| 141 |
/**
|
|
@@ -149,7 +187,7 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 149 |
header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
|
| 150 |
//Generate header
|
| 151 |
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>' . "\n";
|
| 152 |
-
echo '<?xml-stylesheet type="text/xsl" href="' .
|
| 153 |
echo '<!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->' . "\n";
|
| 154 |
echo '<!-- generator="Squirrly SEO Sitemap" -->' . "\n";
|
| 155 |
echo '<!-- generator-url="https://wordpress.org/plugins/squirrly-seo/" -->' . "\n";
|
|
@@ -214,20 +252,57 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 214 |
switch ($this->model->type) {
|
| 215 |
case 'sitemap':
|
| 216 |
$this->showSitemapHeader();
|
|
|
|
| 217 |
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
|
|
|
| 223 |
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
}
|
| 230 |
-
}
|
| 231 |
$this->showSitemapFooter();
|
| 232 |
break;
|
| 233 |
case 'sitemap-home':
|
|
@@ -256,12 +331,12 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 256 |
|
| 257 |
/**
|
| 258 |
* Pach the XML for each sitemap
|
| 259 |
-
* @param
|
| 260 |
-
* @return
|
| 261 |
*/
|
| 262 |
public function showPackXml($xml) {
|
| 263 |
if (empty($xml)) {
|
| 264 |
-
|
| 265 |
}
|
| 266 |
if (!isset($xml['contains'])) {
|
| 267 |
$xml['contains'] = '';
|
|
@@ -330,14 +405,17 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 330 |
/**
|
| 331 |
* Get the url for each sitemap
|
| 332 |
* @param string $sitemap
|
|
|
|
| 333 |
* @return string
|
| 334 |
*/
|
| 335 |
-
public function getXmlUrl($sitemap) {
|
|
|
|
|
|
|
| 336 |
if (!get_option('permalink_structure')) {
|
| 337 |
-
$sitemap = '?sq_feed=' . str_replace('.xml', '', $sitemap);
|
| 338 |
} else {
|
| 339 |
-
if (isset(
|
| 340 |
-
$sitemap =
|
| 341 |
}
|
| 342 |
|
| 343 |
if (strpos($sitemap, '.xml') === false) {
|
|
@@ -349,12 +427,15 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 349 |
}
|
| 350 |
|
| 351 |
public function processCron() {
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
}
|
| 357 |
-
}
|
| 358 |
}
|
| 359 |
|
| 360 |
/**
|
|
@@ -370,7 +451,7 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 370 |
);
|
| 371 |
|
| 372 |
foreach ($urls as $url) {
|
| 373 |
-
if ($responce =
|
| 374 |
$success = true;
|
| 375 |
sleep(mt_rand(2, 5));
|
| 376 |
}
|
|
@@ -384,9 +465,10 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 384 |
* @return boolean
|
| 385 |
*/
|
| 386 |
public function deleteSitemapFile() {
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
|
|
|
| 390 |
return true;
|
| 391 |
}
|
| 392 |
}
|
|
@@ -470,7 +552,7 @@ class SQ_Sitemaps extends SQ_FrontController {
|
|
| 470 |
|
| 471 |
public function productFilter(&$query) {
|
| 472 |
|
| 473 |
-
if (!$types =
|
| 474 |
$types = array('custom-post');
|
| 475 |
}
|
| 476 |
$query->set('post_type', $types); // id of page or post
|
| 3 |
/**
|
| 4 |
* Class for Sitemap Generator
|
| 5 |
*/
|
| 6 |
+
class SQ_Controllers_Sitemaps extends SQ_Classes_FrontController {
|
| 7 |
/* @var string root name */
|
| 8 |
|
| 9 |
var $root = 'sitemap';
|
| 10 |
/* @var string post limit */
|
| 11 |
+
var $posts_limit;
|
| 12 |
+
var $news_limit = 10;
|
| 13 |
|
| 14 |
public function __construct() {
|
| 15 |
parent::__construct();
|
| 16 |
+
$this->posts_limit = SQ_Classes_Tools::getOption('sq_sitemap_perpage');
|
| 17 |
+
add_filter('template_redirect', array($this, 'hookPreventRedirect'), 0);
|
| 18 |
add_filter('user_trailingslashit', array($this, 'untrailingslashit'));
|
| 19 |
add_action('sq_processPing', array($this, 'processCron'));
|
| 20 |
}
|
| 21 |
|
| 22 |
public function hookPreventRedirect() {
|
| 23 |
+
global $wp_query;
|
| 24 |
+
// echo '<pre>' . print_R($_SERVER, true) . '</pre>';
|
| 25 |
+
// exit();
|
| 26 |
+
if (isset($_SERVER['REQUEST_URI'])) {
|
| 27 |
+
if (strpos($_SERVER['REQUEST_URI'], 'sq_feed') !== false) {
|
| 28 |
+
$parseurl = @parse_url($_SERVER['REQUEST_URI']);
|
| 29 |
+
$sitemap = 'sitemap';
|
| 30 |
+
$page = 0;
|
| 31 |
+
|
| 32 |
+
if (isset($parseurl['query'])) {
|
| 33 |
+
parse_str($parseurl['query'], $query);
|
| 34 |
+
$sitemap = (isset($query['sq_feed']) ? $query['sq_feed'] : 'sitemap');
|
| 35 |
+
$page = (isset($query['page']) ? $query['page'] : 0);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
$wp_query->is_404 = false;
|
| 39 |
+
$wp_query->is_feed = true;
|
| 40 |
+
$this->feedRequest($sitemap, $page);
|
| 41 |
+
apply_filters('sq_sitemapxml', $this->showSitemap());
|
| 42 |
+
die();
|
| 43 |
+
} elseif (strpos($_SERVER['REQUEST_URI'], '.xml') !== false) {
|
| 44 |
+
$parseurl = @parse_url($_SERVER['REQUEST_URI']);
|
| 45 |
+
$stemaplist = SQ_Classes_Tools::getOption('sq_sitemap');
|
| 46 |
+
$page = 0;
|
| 47 |
+
|
| 48 |
+
foreach ($stemaplist as $request => $sitemap) {
|
| 49 |
+
if (isset($sitemap[0]) && $sitemap[1] && str_replace('/', '', $parseurl['path']) == $sitemap[0]) {
|
| 50 |
+
$wp_query->is_404 = false;
|
| 51 |
+
$wp_query->is_feed = true;
|
| 52 |
+
|
| 53 |
+
if (isset($parseurl['query'])) {
|
| 54 |
+
parse_str($parseurl['query'], $query);
|
| 55 |
+
$page = (isset($query['page']) ? $query['page'] : 0);
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
$this->feedRequest($request, $page);
|
| 59 |
+
apply_filters('sq_sitemapxml', $this->showSitemap());
|
| 60 |
+
die();
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
}
|
| 65 |
}
|
| 66 |
|
| 67 |
public function refreshSitemap($new_status, $old_status, $post) {
|
| 68 |
if ($old_status <> $new_status && $new_status = 'publish') {
|
| 69 |
+
if (SQ_Classes_Tools::getOption('sq_sitemap_ping')) {
|
| 70 |
wp_schedule_single_event(time() + 5, 'sq_processPing');
|
| 71 |
}
|
| 72 |
}
|
| 74 |
|
| 75 |
/**
|
| 76 |
* Listen the feed call from wordpress
|
| 77 |
+
* @param string $request
|
| 78 |
+
* @param integer $page
|
| 79 |
+
* @return SQ_Controllers_Sitemaps
|
| 80 |
*/
|
| 81 |
+
public function feedRequest($request = null, $page = 1) {
|
| 82 |
global $wp_query;
|
| 83 |
$query = array();
|
| 84 |
|
| 85 |
+
if (isset($request) && strpos($request, 'sitemap') !== false) {
|
| 86 |
+
$sq_sitemap = SQ_Classes_Tools::getOption('sq_sitemap');
|
| 87 |
+
$this->model->type = $request;
|
| 88 |
|
| 89 |
+
if ($request == 'sitemap') { //if sitemapindex, return
|
| 90 |
+
return $wp_query;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
if ($this->model->type == 'sitemap-news') {
|
| 94 |
+
$this->posts_limit = $this->news_limit;
|
| 95 |
+
}
|
| 96 |
|
|
|
|
| 97 |
//init the query
|
| 98 |
$query = array(
|
| 99 |
'sq_feed' => $this->model->type,
|
| 100 |
'post_type' => array('post'),
|
| 101 |
'tax_query' => array(),
|
| 102 |
'post_status' => 'publish',
|
| 103 |
+
'posts_per_page' => $this->posts_limit,
|
| 104 |
+
'paged' => $page,
|
| 105 |
+
'orderby' => 'date',
|
| 106 |
+
'order' => 'DESC',
|
| 107 |
);
|
| 108 |
|
| 109 |
//show products
|
| 110 |
if ($this->model->type == 'sitemap-product') {
|
| 111 |
+
if (SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->isEcommerce() && $sq_sitemap[$this->model->type][1] == 2) {
|
| 112 |
+
$sq_sitemap[$this->model->type][1] = 1;
|
| 113 |
}
|
| 114 |
}
|
| 115 |
|
| 116 |
+
if (isset($sq_sitemap[$this->model->type]) && $sq_sitemap[$this->model->type][1]) {
|
| 117 |
|
| 118 |
+
add_action('do_feed_' . $this->model->type, array($this, 'showSitemap'));
|
| 119 |
//PREPARE CUSTOM QUERIES
|
| 120 |
switch ($this->model->type) {
|
|
|
|
| 121 |
case 'sitemap-news':
|
|
|
|
|
|
|
|
|
|
| 122 |
case 'sitemap-post':
|
| 123 |
break;
|
| 124 |
case 'sitemap-category':
|
| 128 |
add_filter('get_terms_fields', array($this, 'customTaxFilter'), 5, 2);
|
| 129 |
break;
|
| 130 |
case 'sitemap-page':
|
| 131 |
+
$query['post_type'] = array('page');
|
| 132 |
break;
|
| 133 |
case 'sitemap-author':
|
| 134 |
add_filter('sq-sitemap-authors', array($this, 'authorFilter'), 5);
|
| 153 |
array_push($types, 'custom-post');
|
| 154 |
}
|
| 155 |
|
| 156 |
+
$query['post_type'] = $types;
|
| 157 |
break;
|
| 158 |
case 'sitemap-product':
|
| 159 |
+
if (!$types = SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->isEcommerce()) {
|
| 160 |
$types = array('custom-post');
|
| 161 |
}
|
| 162 |
+
$query['post_type'] = $types;
|
| 163 |
break;
|
| 164 |
case 'sitemap-archive':
|
| 165 |
add_filter('sq-sitemap-archive', array($this, 'archiveFilter'), 5);
|
| 166 |
break;
|
| 167 |
}
|
| 168 |
|
|
|
|
| 169 |
}
|
| 170 |
}
|
|
|
|
| 171 |
if (method_exists($wp_query, 'parse_query')) {
|
| 172 |
$wp_query = new WP_Query($query);
|
| 173 |
+
return $wp_query->found_posts;
|
| 174 |
}
|
| 175 |
+
|
| 176 |
+
return false;
|
| 177 |
}
|
| 178 |
|
| 179 |
/**
|
| 187 |
header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
|
| 188 |
//Generate header
|
| 189 |
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>' . "\n";
|
| 190 |
+
echo '<?xml-stylesheet type="text/xsl" href="' . _SQ_THEME_URL_ . 'css/sitemap' . ($this->model->type == 'sitemap' ? 'index' : '') . '.xsl"?>' . "\n";
|
| 191 |
echo '<!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->' . "\n";
|
| 192 |
echo '<!-- generator="Squirrly SEO Sitemap" -->' . "\n";
|
| 193 |
echo '<!-- generator-url="https://wordpress.org/plugins/squirrly-seo/" -->' . "\n";
|
| 252 |
switch ($this->model->type) {
|
| 253 |
case 'sitemap':
|
| 254 |
$this->showSitemapHeader();
|
| 255 |
+
$sq_sitemap = SQ_Classes_Tools::getOption('sq_sitemap');
|
| 256 |
|
| 257 |
+
if (!empty($sq_sitemap))
|
| 258 |
+
foreach ($sq_sitemap as $name => $value) {
|
| 259 |
+
//force to show products if not preset
|
| 260 |
+
if ($name == 'sitemap-product' && !SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->isEcommerce()) {
|
| 261 |
+
continue;
|
| 262 |
+
}
|
| 263 |
|
| 264 |
+
if ($name !== 'sitemap' && ($value[1] == 1 || $value[1] == 2)) {
|
| 265 |
+
echo "\t" . '<sitemap>' . "\n";
|
| 266 |
+
echo "\t" . '<loc>' . $this->getXmlUrl($name) . '</loc>' . "\n";
|
| 267 |
+
echo "\t" . '<lastmod>' . mysql2date('Y-m-d\TH:i:s+00:00', get_lastpostmodified('gmt'), false) . '</lastmod>' . "\n";
|
| 268 |
+
echo "\t" . '</sitemap>' . "\n";
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
if ($name == 'sitemap-post' && $count_posts = wp_count_posts()) {
|
| 272 |
+
if (isset($count_posts->publish) && $count_posts->publish > 0 && $count_posts->publish > $this->posts_limit) {
|
| 273 |
+
$pages = ceil($count_posts->publish / $this->posts_limit);
|
| 274 |
+
for ($page = 2; $page <= $pages; $page++) {
|
| 275 |
+
echo "\t" . '<sitemap>' . "\n";
|
| 276 |
+
echo "\t" . '<loc>' . $this->getXmlUrl($name, $page) . '</loc>' . "\n";
|
| 277 |
+
echo "\t" . '<lastmod>' . mysql2date('Y-m-d\TH:i:s+00:00', get_lastpostmodified('gmt'), false) . '</lastmod>' . "\n";
|
| 278 |
+
echo "\t" . '</sitemap>' . "\n";
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
}
|
| 282 |
+
if ($name == 'sitemap-page' && $count_posts = wp_count_posts('page')) {
|
| 283 |
+
if (isset($count_posts->publish) && $count_posts->publish > 0 && $count_posts->publish > $this->posts_limit) {
|
| 284 |
+
$pages = ceil($count_posts->publish / $this->posts_limit);
|
| 285 |
+
for ($page = 2; $page <= $pages; $page++) {
|
| 286 |
+
echo "\t" . '<sitemap>' . "\n";
|
| 287 |
+
echo "\t" . '<loc>' . $this->getXmlUrl($name, $page) . '</loc>' . "\n";
|
| 288 |
+
echo "\t" . '<lastmod>' . mysql2date('Y-m-d\TH:i:s+00:00', get_lastpostmodified('gmt'), false) . '</lastmod>' . "\n";
|
| 289 |
+
echo "\t" . '</sitemap>' . "\n";
|
| 290 |
+
}
|
| 291 |
+
}
|
| 292 |
+
}
|
| 293 |
+
if ($name == 'sitemap-product' && $count_posts = wp_count_posts('product')) {
|
| 294 |
+
if (isset($count_posts->publish) && $count_posts->publish > 0 && $count_posts->publish > $this->posts_limit) {
|
| 295 |
+
$pages = ceil($count_posts->publish / $this->posts_limit);
|
| 296 |
+
for ($page = 2; $page <= $pages; $page++) {
|
| 297 |
+
echo "\t" . '<sitemap>' . "\n";
|
| 298 |
+
echo "\t" . '<loc>' . $this->getXmlUrl($name, $page) . '</loc>' . "\n";
|
| 299 |
+
echo "\t" . '<lastmod>' . mysql2date('Y-m-d\TH:i:s+00:00', get_lastpostmodified('gmt'), false) . '</lastmod>' . "\n";
|
| 300 |
+
echo "\t" . '</sitemap>' . "\n";
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
}
|
| 304 |
+
}
|
| 305 |
}
|
|
|
|
| 306 |
$this->showSitemapFooter();
|
| 307 |
break;
|
| 308 |
case 'sitemap-home':
|
| 331 |
|
| 332 |
/**
|
| 333 |
* Pach the XML for each sitemap
|
| 334 |
+
* @param xhtml $xml
|
| 335 |
+
* @return xml|false
|
| 336 |
*/
|
| 337 |
public function showPackXml($xml) {
|
| 338 |
if (empty($xml)) {
|
| 339 |
+
$xml['contains'] = '';
|
| 340 |
}
|
| 341 |
if (!isset($xml['contains'])) {
|
| 342 |
$xml['contains'] = '';
|
| 405 |
/**
|
| 406 |
* Get the url for each sitemap
|
| 407 |
* @param string $sitemap
|
| 408 |
+
* @param integer $page
|
| 409 |
* @return string
|
| 410 |
*/
|
| 411 |
+
public function getXmlUrl($sitemap, $page = null) {
|
| 412 |
+
$sq_sitemap = SQ_Classes_Tools::getOption('sq_sitemap');
|
| 413 |
+
|
| 414 |
if (!get_option('permalink_structure')) {
|
| 415 |
+
$sitemap = '?sq_feed=' . str_replace('.xml', '', $sitemap) . (isset($page) ? '&page=' . $page : '');
|
| 416 |
} else {
|
| 417 |
+
if (isset($sq_sitemap[$sitemap])) {
|
| 418 |
+
$sitemap = $sq_sitemap[$sitemap][0] . (isset($page) ? '?page=' . $page : '');
|
| 419 |
}
|
| 420 |
|
| 421 |
if (strpos($sitemap, '.xml') === false) {
|
| 427 |
}
|
| 428 |
|
| 429 |
public function processCron() {
|
| 430 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Tools');
|
| 431 |
+
|
| 432 |
+
$sq_sitemap = SQ_Classes_Tools::getOption('sq_sitemap');
|
| 433 |
+
if (!empty($sq_sitemap))
|
| 434 |
+
foreach ($sq_sitemap as $name => $sitemap) {
|
| 435 |
+
if ($sitemap[1] == 1) {
|
| 436 |
+
$this->SendPing($this->getXmlUrl($name));
|
| 437 |
+
}
|
| 438 |
}
|
|
|
|
| 439 |
}
|
| 440 |
|
| 441 |
/**
|
| 451 |
);
|
| 452 |
|
| 453 |
foreach ($urls as $url) {
|
| 454 |
+
if ($responce = SQ_Classes_Tools::sq_remote_get($url)) {
|
| 455 |
$success = true;
|
| 456 |
sleep(mt_rand(2, 5));
|
| 457 |
}
|
| 465 |
* @return boolean
|
| 466 |
*/
|
| 467 |
public function deleteSitemapFile() {
|
| 468 |
+
$sq_sitemap = SQ_Classes_Tools::getOption('sq_sitemap');
|
| 469 |
+
if (isset($sq_sitemap[$this->root])) {
|
| 470 |
+
if (file_exists(ABSPATH . $sq_sitemap[$this->root])) {
|
| 471 |
+
@unlink(ABSPATH . $sq_sitemap[$this->root]);
|
| 472 |
return true;
|
| 473 |
}
|
| 474 |
}
|
| 552 |
|
| 553 |
public function productFilter(&$query) {
|
| 554 |
|
| 555 |
+
if (!$types = SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->isEcommerce()) {
|
| 556 |
$types = array('custom-post');
|
| 557 |
}
|
| 558 |
$query->set('post_type', $types); // id of page or post
|
core/{SQ_BlockAccount/SQ_BlockAccount.php → BlockAccount.php}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
/**
|
| 4 |
* Account settings
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
|
| 8 |
function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
| 3 |
/**
|
| 4 |
* Account settings
|
| 5 |
*/
|
| 6 |
+
class SQ_Core_BlockAccount extends SQ_Classes_BlockController {
|
| 7 |
|
| 8 |
function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
core/{SQ_BlockAffiliate/SQ_BlockAffiliate.php → BlockAffiliate.php}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
/**
|
| 4 |
* Affiliate settings
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
|
| 8 |
public function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
|
@@ -11,7 +11,7 @@ class SQ_BlockAffiliate extends SQ_BlockController {
|
|
| 11 |
|
| 12 |
public function action() {
|
| 13 |
parent::action();
|
| 14 |
-
switch (
|
| 15 |
//login action
|
| 16 |
case 'sq_settings_affiliate':
|
| 17 |
//post arguments
|
|
@@ -21,7 +21,7 @@ class SQ_BlockAffiliate extends SQ_BlockController {
|
|
| 21 |
//api responce variable
|
| 22 |
$responce = '';
|
| 23 |
|
| 24 |
-
$responce =
|
| 25 |
|
| 26 |
//create an object from json responce
|
| 27 |
if (is_object(json_decode($responce)))
|
|
@@ -32,7 +32,7 @@ class SQ_BlockAffiliate extends SQ_BlockController {
|
|
| 32 |
|
| 33 |
//if the affiliate link is received
|
| 34 |
if (isset($return->affiliate_link)) {
|
| 35 |
-
|
| 36 |
} elseif (!empty($return->error)) {
|
| 37 |
//if an error is throw then ...
|
| 38 |
$return->info = sprintf(__('Error: %s', _SQ_PLUGIN_NAME_), $return->error);
|
| 3 |
/**
|
| 4 |
* Affiliate settings
|
| 5 |
*/
|
| 6 |
+
class SQ_Core_BlockAffiliate extends SQ_Classes_BlockController {
|
| 7 |
|
| 8 |
public function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
| 11 |
|
| 12 |
public function action() {
|
| 13 |
parent::action();
|
| 14 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 15 |
//login action
|
| 16 |
case 'sq_settings_affiliate':
|
| 17 |
//post arguments
|
| 21 |
//api responce variable
|
| 22 |
$responce = '';
|
| 23 |
|
| 24 |
+
$responce = SQ_Classes_Action::apiCall('sq/user/affiliate', $args);
|
| 25 |
|
| 26 |
//create an object from json responce
|
| 27 |
if (is_object(json_decode($responce)))
|
| 32 |
|
| 33 |
//if the affiliate link is received
|
| 34 |
if (isset($return->affiliate_link)) {
|
| 35 |
+
SQ_Classes_Tools::saveOptions('sq_affiliate_link', $return->affiliate_link);
|
| 36 |
} elseif (!empty($return->error)) {
|
| 37 |
//if an error is throw then ...
|
| 38 |
$return->info = sprintf(__('Error: %s', _SQ_PLUGIN_NAME_), $return->error);
|
core/BlockAnalytics.php
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class SQ_Core_BlockAnalytics extends SQ_Classes_BlockController {
|
| 4 |
+
|
| 5 |
+
public function hookGetContent() {
|
| 6 |
+
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
}
|
core/{SQ_BlockAudit/SQ_BlockAudit.php → BlockAudit.php}
RENAMED
|
@@ -3,11 +3,11 @@
|
|
| 3 |
/**
|
| 4 |
* Audit Page
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
public $blog;
|
| 8 |
|
| 9 |
function hookGetContent() {
|
| 10 |
-
$blogs = json_decode(
|
| 11 |
if (!empty($blogs)) {
|
| 12 |
foreach ($blogs as $blog) {
|
| 13 |
if (get_bloginfo('url') == $blog->domain){
|
| 3 |
/**
|
| 4 |
* Audit Page
|
| 5 |
*/
|
| 6 |
+
class SQ_Core_BlockAudit extends SQ_Classes_BlockController {
|
| 7 |
public $blog;
|
| 8 |
|
| 9 |
function hookGetContent() {
|
| 10 |
+
$blogs = json_decode(SQ_Classes_Action::apiCall('sq/audit/blog-list'));
|
| 11 |
if (!empty($blogs)) {
|
| 12 |
foreach ($blogs as $blog) {
|
| 13 |
if (get_bloginfo('url') == $blog->domain){
|
core/{SQ_BlockLiveAssistant/SQ_BlockLiveAssistant.php → BlockCopyright.php}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
/**
|
| 4 |
* Live Assistant settings
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
|
| 8 |
function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
| 3 |
/**
|
| 4 |
* Live Assistant settings
|
| 5 |
*/
|
| 6 |
+
class SQ_Core_BlockCopyright extends SQ_Classes_BlockController {
|
| 7 |
|
| 8 |
function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
core/BlockCustomerService.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Customer Service Page
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Core_BlockCustomerService extends SQ_Classes_BlockController {
|
| 7 |
+
|
| 8 |
+
function hookGetContent() {
|
| 9 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('blocksupport');
|
| 10 |
+
}
|
| 11 |
+
}
|
core/{SQ_BlockDashboard/SQ_BlockDashboard.php → BlockDashboard.php}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
/**
|
| 4 |
* Dashboard settings
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
|
| 8 |
function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
| 3 |
/**
|
| 4 |
* Dashboard settings
|
| 5 |
*/
|
| 6 |
+
class SQ_Core_BlockDashboard extends SQ_Classes_BlockController {
|
| 7 |
|
| 8 |
function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
core/BlockHelp.php
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Affiliate settings
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Core_BlockHelp extends SQ_Classes_BlockController {
|
| 7 |
+
|
| 8 |
+
}
|
core/BlockImport.php
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Set the patterns
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Core_BlockImport extends SQ_Classes_BlockController {
|
| 7 |
+
|
| 8 |
+
function hookGetContent() {
|
| 9 |
+
//Remove the notification is Inport Settings are shown
|
| 10 |
+
delete_transient('sq_import');
|
| 11 |
+
|
| 12 |
+
parent::preloadSettings();
|
| 13 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Error')->hookNotices();
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Called when Post action is triggered
|
| 18 |
+
*
|
| 19 |
+
* @return void
|
| 20 |
+
*/
|
| 21 |
+
public function action() {
|
| 22 |
+
parent::action();
|
| 23 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 24 |
+
case 'sq_importsettings':
|
| 25 |
+
if (!current_user_can('manage_options')) {
|
| 26 |
+
return;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
$platform = SQ_Classes_Tools::getValue('sq_import_platform', '');
|
| 30 |
+
if ($platform <> '') {
|
| 31 |
+
if (SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->importDBSettings($platform)) {
|
| 32 |
+
SQ_Classes_Error::setMessage(__('All the Plugin settings were imported successfuly!', _SQ_PLUGIN_NAME_));
|
| 33 |
+
}else{
|
| 34 |
+
SQ_Classes_Error::setMessage(__('No settings found for this plugin/theme.', _SQ_PLUGIN_NAME_));
|
| 35 |
+
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
break;
|
| 39 |
+
|
| 40 |
+
case 'sq_importseo':
|
| 41 |
+
if (!current_user_can('manage_options')) {
|
| 42 |
+
return;
|
| 43 |
+
}
|
| 44 |
+
$platform = SQ_Classes_Tools::getValue('sq_import_platform', '');
|
| 45 |
+
if ($platform <> '') {
|
| 46 |
+
$seo = SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->importDBSeo($platform);
|
| 47 |
+
if (!empty($seo)) {
|
| 48 |
+
foreach ($seo as $sq_hash => $metas) {
|
| 49 |
+
SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->db_insert(
|
| 50 |
+
(isset($metas['url']) ? $metas['url'] : ''),
|
| 51 |
+
$sq_hash,
|
| 52 |
+
(isset($metas['post_id']) && is_numeric($metas['post_id']) ? (int)$metas['post_id'] : 0),
|
| 53 |
+
maybe_serialize($metas),
|
| 54 |
+
gmdate('Y-m-d H:i:s'));
|
| 55 |
+
}
|
| 56 |
+
SQ_Classes_Error::setMessage(sprintf(__('%s SEO records were imported successfuly! You can now deactivate the %s plugin', _SQ_PLUGIN_NAME_), count($seo), SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->getName($platform)));
|
| 57 |
+
} else {
|
| 58 |
+
SQ_Classes_Error::setMessage(sprintf(__('There are no SEO records with this plugin. You can now deactivate the %s plugin', _SQ_PLUGIN_NAME_), SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->getName($platform)));
|
| 59 |
+
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
break;
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
}
|
core/BlockKeywordResearch.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Keyword Research settings
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Core_BlockKeywordResearch extends SQ_Classes_BlockController {
|
| 7 |
+
|
| 8 |
+
function hookGetContent() {
|
| 9 |
+
parent::preloadSettings();
|
| 10 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('blockresearch');
|
| 11 |
+
}
|
| 12 |
+
}
|
core/{SQ_BlockCopyright/SQ_BlockCopyright.php → BlockLiveAssistant.php}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
/**
|
| 4 |
* Live Assistant settings
|
| 5 |
*/
|
| 6 |
-
class
|
| 7 |
|
| 8 |
function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
| 3 |
/**
|
| 4 |
* Live Assistant settings
|
| 5 |
*/
|
| 6 |
+
class SQ_Core_BlockLiveAssistant extends SQ_Classes_BlockController {
|
| 7 |
|
| 8 |
function hookGetContent() {
|
| 9 |
parent::preloadSettings();
|
core/BlockPatterns.php
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Set the patterns
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Core_BlockPatterns extends SQ_Classes_BlockController {
|
| 7 |
+
|
| 8 |
+
function hookGetContent() {
|
| 9 |
+
parent::preloadSettings();
|
| 10 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Error')->hookNotices();
|
| 11 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('patterns');
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Called when Post action is triggered
|
| 16 |
+
*
|
| 17 |
+
* @return void
|
| 18 |
+
*/
|
| 19 |
+
public function action() {
|
| 20 |
+
parent::action();
|
| 21 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 22 |
+
|
| 23 |
+
case 'sq_savepatters':
|
| 24 |
+
if (!current_user_can('manage_options')) {
|
| 25 |
+
return;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
$patterns = SQ_Classes_Tools::getValue('sq_patterns', array());
|
| 29 |
+
if (!empty($patterns)) {
|
| 30 |
+
SQ_Classes_Tools::saveOptions("patterns", $patterns);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
//If a new post type is added
|
| 34 |
+
$newposttype = SQ_Classes_Tools::getValue('sq_select_post_types', '');
|
| 35 |
+
if ($newposttype <> '') {
|
| 36 |
+
$patterns[$newposttype] = $patterns['custom'];
|
| 37 |
+
if (!empty($patterns)) {
|
| 38 |
+
SQ_Classes_Tools::saveOptions("patterns", $patterns);
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
//empty the cache on settings changed
|
| 43 |
+
SQ_Classes_Tools::emptyCache();
|
| 44 |
+
break;
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
}
|
core/{SQ_BlockPostsAnalytics/SQ_BlockPostsAnalytics.php → BlockPostsAnalytics.php}
RENAMED
|
@@ -1,15 +1,16 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class
|
| 4 |
|
| 5 |
public function hookGetContent() {
|
| 6 |
|
| 7 |
-
|
| 8 |
-
->loadMedia(_SQ_THEME_URL_ . '/css/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
SQ_Tools::saveOptions('sq_analytics', 1); //Save analytics viewed
|
| 11 |
-
SQ_Tools::saveOptions('sq_dashboard', 1); //Save dashboard viewed
|
| 12 |
-
$this->postlist = SQ_ObjController::getController('SQ_PostsList');
|
| 13 |
|
| 14 |
$this->model->prepare_items();
|
| 15 |
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class SQ_Core_BlockPostsAnalytics extends SQ_Classes_BlockController {
|
| 4 |
|
| 5 |
public function hookGetContent() {
|
| 6 |
|
| 7 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')
|
| 8 |
+
->loadMedia(_SQ_THEME_URL_ . '/css/postslist.css');
|
| 9 |
+
|
| 10 |
+
SQ_Classes_Tools::saveOptions('sq_analytics', 1); //Save analytics viewed
|
| 11 |
+
SQ_Classes_Tools::saveOptions('sq_dashboard', 1); //Save dashboard viewed
|
| 12 |
+
$this->postlist = SQ_Classes_ObjController::getClass('SQ_Controllers_PostsList');
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
$this->model->prepare_items();
|
| 16 |
|
core/BlockSettings.php
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Account settings
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Core_BlockSettings extends SQ_Classes_BlockController {
|
| 7 |
+
|
| 8 |
+
function hookGetContent() {
|
| 9 |
+
parent::preloadSettings();
|
| 10 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Error')->hookNotices();
|
| 11 |
+
echo '<script type="text/javascript">
|
| 12 |
+
jQuery(document).ready(function () {
|
| 13 |
+
jQuery("#sq_settings").find("select[name=sq_google_country]").val("' . SQ_Classes_Tools::getOption('sq_google_country') . '");
|
| 14 |
+
});
|
| 15 |
+
</script>';
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Called when Post action is triggered
|
| 20 |
+
*
|
| 21 |
+
* @return void
|
| 22 |
+
*/
|
| 23 |
+
public function action() {
|
| 24 |
+
parent::action();
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 28 |
+
|
| 29 |
+
case 'sq_settings_update':
|
| 30 |
+
if (!current_user_can('manage_options')) {
|
| 31 |
+
return;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
if (SQ_Classes_Tools::getIsset('sq_post_types')) {
|
| 35 |
+
SQ_Classes_Tools::$options['sq_post_types'] = array();
|
| 36 |
+
foreach (SQ_Classes_Tools::getValue('sq_post_types') as $key) {
|
| 37 |
+
array_push(SQ_Classes_Tools::$options['sq_post_types'], $key);
|
| 38 |
+
}
|
| 39 |
+
if (!in_array('product', get_post_types())) {
|
| 40 |
+
array_push(SQ_Classes_Tools::$options['sq_post_types'], 'product');
|
| 41 |
+
}
|
| 42 |
+
}else{
|
| 43 |
+
SQ_Classes_Tools::$options['sq_post_types'] = array();
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
SQ_Classes_Tools::saveOptions('sq_google_country', SQ_Classes_Tools::getValue('sq_google_country'));
|
| 47 |
+
SQ_Classes_Tools::saveOptions('sq_google_country_strict', SQ_Classes_Tools::getValue('sq_google_country_strict'));
|
| 48 |
+
SQ_Classes_Tools::saveOptions('sq_google_ranksperhour', SQ_Classes_Tools::getValue('sq_google_ranksperhour'));
|
| 49 |
+
|
| 50 |
+
SQ_Classes_Tools::saveOptions('sq_keyword_help', (int)SQ_Classes_Tools::getValue('sq_keyword_help'));
|
| 51 |
+
SQ_Classes_Tools::saveOptions('sq_keyword_information', (int)SQ_Classes_Tools::getValue('sq_keyword_information'));
|
| 52 |
+
SQ_Classes_Tools::saveOptions('sq_force_savepost', (int)SQ_Classes_Tools::getValue('sq_force_savepost'));
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
SQ_Classes_Tools::saveOptions('sq_sla', (int)SQ_Classes_Tools::getValue('sq_sla'));
|
| 56 |
+
SQ_Classes_Tools::saveOptions('sq_use_frontend', (int)SQ_Classes_Tools::getValue('sq_use_frontend'));
|
| 57 |
+
SQ_Classes_Tools::saveOptions('sq_local_images', (int)SQ_Classes_Tools::getValue('sq_local_images'));
|
| 58 |
+
SQ_Classes_Tools::saveOptions('sq_url_fix', (int)SQ_Classes_Tools::getValue('sq_url_fix'));
|
| 59 |
+
|
| 60 |
+
//Save custom robots
|
| 61 |
+
$robots = SQ_Classes_Tools::getValue('sq_robots_permission', '', true);
|
| 62 |
+
$robots = explode(PHP_EOL, $robots);
|
| 63 |
+
$robots = str_replace("\r", "", $robots);
|
| 64 |
+
|
| 65 |
+
if (!empty($robots)) {
|
| 66 |
+
$robots = array_unique($robots);
|
| 67 |
+
SQ_Classes_Tools::saveOptions('sq_robots_permission', $robots);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 71 |
+
SQ_Classes_Tools::emptyCache();
|
| 72 |
+
break;
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
}
|
core/BlockSettingsSeo.php
ADDED
|
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Account settings
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Core_BlockSettingsSeo extends SQ_Classes_BlockController {
|
| 7 |
+
public $post;
|
| 8 |
+
|
| 9 |
+
function hookGetContent() {
|
| 10 |
+
parent::preloadSettings();
|
| 11 |
+
|
| 12 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('frontmenu.css');
|
| 13 |
+
|
| 14 |
+
//Show Import Settings after Install if needed
|
| 15 |
+
if (current_user_can('manage_options') && get_transient('sq_import')) {
|
| 16 |
+
$platforms = SQ_Classes_ObjController::getClass('SQ_Controllers_Menu')->getImportList();
|
| 17 |
+
$imports = array();
|
| 18 |
+
if (!empty($platforms)) {
|
| 19 |
+
foreach ($platforms as $path => $settings) {
|
| 20 |
+
if ($path !== 'squirrly-seo') {
|
| 21 |
+
$imports[] = ucfirst(SQ_Classes_ObjController::getClass('SQ_Models_BlockSettingsSeo')->getName($path));
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
if (!empty($imports)) {
|
| 26 |
+
SQ_Classes_Error::setError(sprintf(__('You can now import into Squirrly SEO all the SEO Settings from %s', _SQ_PLUGIN_NAME_), '<a href="' . admin_url('admin.php?page=sq_import#import') . '">' . join(', ', $imports) . '</a>'));
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
/* Force call of error display */
|
| 33 |
+
SQ_Classes_ObjController::getClass('SQ_Classes_Error')->hookNotices();
|
| 34 |
+
echo '<script type="text/javascript">
|
| 35 |
+
var __snippetshort = "' . __('Too short', _SQ_PLUGIN_NAME_) . '";
|
| 36 |
+
var __snippetlong = "' . __('Too long', _SQ_PLUGIN_NAME_) . '";
|
| 37 |
+
jQuery(document).ready(function () {
|
| 38 |
+
jQuery("#sq_settings").find("select[name=sq_og_locale]").val("' . SQ_Classes_Tools::getOption('sq_og_locale') . '");
|
| 39 |
+
});
|
| 40 |
+
</script>';
|
| 41 |
+
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
function hookHead() {
|
| 45 |
+
if (function_exists('wp_enqueue_media')) {
|
| 46 |
+
wp_enqueue_media();
|
| 47 |
+
}
|
| 48 |
+
parent::hookHead();
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Called when Post action is triggered
|
| 53 |
+
*
|
| 54 |
+
* @return void
|
| 55 |
+
*/
|
| 56 |
+
public function action() {
|
| 57 |
+
parent::action();
|
| 58 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 59 |
+
case 'sq_settingsseo_option':
|
| 60 |
+
SQ_Classes_Tools::setHeader('json');
|
| 61 |
+
|
| 62 |
+
if (!current_user_can('manage_options')) {
|
| 63 |
+
echo json_encode(array('error' => __("You don't have enough pemission to activate this feature", _SQ_PLUGIN_NAME_)));
|
| 64 |
+
exit();
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
$option = SQ_Classes_Tools::getValue('option');
|
| 68 |
+
$value = (int)SQ_Classes_Tools::getValue('value');
|
| 69 |
+
SQ_Classes_Tools::saveOptions($option, $value);
|
| 70 |
+
|
| 71 |
+
echo json_encode(array('saved' => true));
|
| 72 |
+
exit();
|
| 73 |
+
case 'sq_settingsseo_update':
|
| 74 |
+
if (!current_user_can('manage_options')) {
|
| 75 |
+
return;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
if (!SQ_Classes_Tools::getIsset('sq_use')) {
|
| 79 |
+
return;
|
| 80 |
+
}
|
| 81 |
+
SQ_Classes_Tools::saveOptions('sq_use', (int)SQ_Classes_Tools::getValue('sq_use'));
|
| 82 |
+
SQ_Classes_Tools::saveOptions('sq_auto_title', (int)SQ_Classes_Tools::getValue('sq_auto_title'));
|
| 83 |
+
SQ_Classes_Tools::saveOptions('sq_auto_description', (int)SQ_Classes_Tools::getValue('sq_auto_description'));
|
| 84 |
+
SQ_Classes_Tools::saveOptions('sq_auto_keywords', (int)SQ_Classes_Tools::getValue('sq_auto_keywords'));
|
| 85 |
+
SQ_Classes_Tools::saveOptions('sq_keywordtag', (int)SQ_Classes_Tools::getValue('sq_keywordtag'));
|
| 86 |
+
|
| 87 |
+
SQ_Classes_Tools::saveOptions('sq_auto_canonical', (int)SQ_Classes_Tools::getValue('sq_auto_canonical'));
|
| 88 |
+
SQ_Classes_Tools::saveOptions('sq_auto_noindex', (int)SQ_Classes_Tools::getValue('sq_auto_noindex'));
|
| 89 |
+
|
| 90 |
+
SQ_Classes_Tools::saveOptions('sq_auto_amp', (int)SQ_Classes_Tools::getValue('sq_auto_amp'));
|
| 91 |
+
|
| 92 |
+
SQ_Classes_Tools::saveOptions('sq_auto_meta', (int)SQ_Classes_Tools::getValue('sq_auto_meta'));
|
| 93 |
+
SQ_Classes_Tools::saveOptions('sq_auto_favicon', (int)SQ_Classes_Tools::getValue('sq_auto_favicon'));
|
| 94 |
+
|
| 95 |
+
///////////////////////////////////////////
|
| 96 |
+
/////////////////////////////SOCIAL OPTION
|
| 97 |
+
SQ_Classes_Tools::saveOptions('sq_auto_facebook', (int)SQ_Classes_Tools::getValue('sq_auto_facebook'));
|
| 98 |
+
SQ_Classes_Tools::saveOptions('sq_auto_twitter', (int)SQ_Classes_Tools::getValue('sq_auto_twitter'));
|
| 99 |
+
SQ_Classes_Tools::saveOptions('sq_og_locale', SQ_Classes_Tools::getValue('sq_og_locale'));
|
| 100 |
+
|
| 101 |
+
$socials = array_merge(SQ_Classes_Tools::getOption('socials'), SQ_Classes_Tools::getValue('sq_socials', array()));
|
| 102 |
+
|
| 103 |
+
if (isset($socials['twitter_site'])) $socials['twitter_site'] = $this->model->checkTwitterAccount($socials['twitter_site']);
|
| 104 |
+
if (isset($socials['twitter_site'])) $socials['twitter'] = $this->model->checkTwitterAccountName($socials['twitter_site']);
|
| 105 |
+
if (isset($socials['facebook_site'])) $socials['facebook_site'] = $this->model->checkFacebookAccount($socials['facebook_site']);
|
| 106 |
+
if (isset($socials['google_plus_url'])) $socials['google_plus_url'] = $this->model->checkGoogleAccount($socials['google_plus_url']);
|
| 107 |
+
if (isset($socials['pinterest_url'])) $socials['pinterest_url'] = $this->model->checkPinterestAccount($socials['pinterest_url']);
|
| 108 |
+
if (isset($socials['instagram_url'])) $socials['instagram_url'] = $this->model->checkInstagramAccount($socials['instagram_url']);
|
| 109 |
+
if (isset($socials['linkedin_url'])) $socials['linkedin_url'] = $this->model->checkLinkeinAccount($socials['linkedin_url']);
|
| 110 |
+
if (isset($socials['myspace_url'])) $socials['myspace_url'] = $this->model->checkMySpaceAccount($socials['myspace_url']);
|
| 111 |
+
if (isset($socials['youtube_url'])) $socials['youtube_url'] = $this->model->checkYoutubeAccount($socials['youtube_url']);
|
| 112 |
+
|
| 113 |
+
$fb_admins = SQ_Classes_Tools::getValue('sq_fb_admins', array());
|
| 114 |
+
if (!empty($fb_admins)) {
|
| 115 |
+
foreach ($fb_admins as $index => $value) {
|
| 116 |
+
if (isset($value) && $value == '') {
|
| 117 |
+
unset($socials['fb_admins'][$index]);
|
| 118 |
+
} else {
|
| 119 |
+
$socials['fb_admins'][$index]['id'] = $this->model->checkFavebookAdminCode($value);
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
//get the facebook app id for sharing
|
| 125 |
+
if (SQ_Classes_Tools::getIsset('sq_fbadminapp')) $socials['fbadminapp'] = SQ_Classes_Tools::getValue('sq_fbadminapp');
|
| 126 |
+
if (SQ_Classes_Tools::getIsset('twitter_card_type')) $socials['twitter_card_type'] = SQ_Classes_Tools::getValue('twitter_card_type');
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
SQ_Classes_Tools::saveOptions("socials", $socials);
|
| 130 |
+
|
| 131 |
+
///////////////////////////////////////////
|
| 132 |
+
/////////////////////////////FIRST PAGE OPTIMIZATION
|
| 133 |
+
if ($pageId = get_option('page_on_front')) {
|
| 134 |
+
$sq_hash = md5($pageId);
|
| 135 |
+
} elseif ($post_id = get_option('page_for_posts')) {
|
| 136 |
+
$sq_hash = md5($pageId);
|
| 137 |
+
} else {
|
| 138 |
+
$sq_hash = md5('wp_homepage');
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
if ($sq_hash <> '') {
|
| 142 |
+
$url = home_url();
|
| 143 |
+
$sq = SQ_Classes_ObjController::getClass('SQ_Models_Frontend')->getSqSeo($sq_hash);
|
| 144 |
+
|
| 145 |
+
$sq->doseo = 1;
|
| 146 |
+
$sq->title = urldecode(SQ_Classes_Tools::getValue('sq_fp_title', false));
|
| 147 |
+
$sq->description = urldecode(SQ_Classes_Tools::getValue('sq_fp_description', false));
|
| 148 |
+
$sq->keywords = SQ_Classes_Tools::getValue('sq_fp_keywords', false);
|
| 149 |
+
$sq->og_media = SQ_Classes_Tools::getValue('sq_fp_ogimage', false);
|
| 150 |
+
|
| 151 |
+
$this->model->db_insert(
|
| 152 |
+
$url,
|
| 153 |
+
$sq_hash,
|
| 154 |
+
(int)$pageId,
|
| 155 |
+
maybe_serialize($sq->toArray()),
|
| 156 |
+
gmdate('Y-m-d H:i:s')
|
| 157 |
+
);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
///////////////////////////////////////////
|
| 161 |
+
/////////////////////////////SITEMAP OPTION
|
| 162 |
+
SQ_Classes_Tools::saveOptions('sq_auto_sitemap', (int)SQ_Classes_Tools::getValue('sq_auto_sitemap'));
|
| 163 |
+
SQ_Classes_Tools::saveOptions('sq_auto_feed', (int)SQ_Classes_Tools::getValue('sq_auto_feed'));
|
| 164 |
+
SQ_Classes_Tools::saveOptions('sq_sitemap_frequency', SQ_Classes_Tools::getValue('sq_sitemap_frequency'));
|
| 165 |
+
SQ_Classes_Tools::saveOptions('sq_sitemap_ping', (int)SQ_Classes_Tools::getValue('sq_sitemap_ping'));
|
| 166 |
+
SQ_Classes_Tools::saveOptions('sq_sitemap_perpage', (int)SQ_Classes_Tools::getValue('sq_sitemap_perpage'));
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
foreach (SQ_Classes_Tools::$options['sq_sitemap'] as $key => $value) {
|
| 170 |
+
if ($key == 'sitemap') {
|
| 171 |
+
continue;
|
| 172 |
+
}
|
| 173 |
+
SQ_Classes_Tools::$options['sq_sitemap'][$key][1] = 0;
|
| 174 |
+
if ($key == 'sitemap-product' && !$this->model->isEcommerce()) {
|
| 175 |
+
SQ_Classes_Tools::$options['sq_sitemap'][$key][1] = 2;
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
if (SQ_Classes_Tools::getIsset('sq_sitemap')) {
|
| 179 |
+
foreach (SQ_Classes_Tools::getValue('sq_sitemap') as $key) {
|
| 180 |
+
if (isset(SQ_Classes_Tools::$options['sq_sitemap'][$key][1])) {
|
| 181 |
+
SQ_Classes_Tools::$options['sq_sitemap'][$key][1] = 1;
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
foreach (SQ_Classes_Tools::$options['sq_sitemap_show'] as $key => $value) {
|
| 187 |
+
SQ_Classes_Tools::$options['sq_sitemap_show'][$key] = 0;
|
| 188 |
+
}
|
| 189 |
+
if (SQ_Classes_Tools::getIsset('sq_sitemap_show')) {
|
| 190 |
+
foreach (SQ_Classes_Tools::getValue('sq_sitemap_show') as $key) {
|
| 191 |
+
if (isset(SQ_Classes_Tools::$options['sq_sitemap_show'][$key])) {
|
| 192 |
+
SQ_Classes_Tools::$options['sq_sitemap_show'][$key] = 1;
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
///////////////////////////////////////////
|
| 198 |
+
///////SAVE THE CODE
|
| 199 |
+
$codes = array_merge(SQ_Classes_Tools::getOption('codes'), SQ_Classes_Tools::getValue('sq_codes', array()));
|
| 200 |
+
|
| 201 |
+
if (!empty($codes)) {
|
| 202 |
+
//if (isset($codes['facebook_pixel'])) $codes['facebook_pixel'] = $codes['facebook_pixel'];
|
| 203 |
+
if (isset($codes['google_analytics'])) $codes['google_analytics'] = $this->model->checkGoogleAnalyticsCode($codes['google_analytics']);
|
| 204 |
+
if (isset($codes['pinterest_verify'])) $codes['pinterest_verify'] = $this->model->checkPinterestCode($codes['pinterest_verify']);
|
| 205 |
+
if (isset($codes['google_wt'])) $codes['google_wt'] = $this->model->checkGoogleWTCode($codes['google_wt']);
|
| 206 |
+
if (isset($codes['bing_wt'])) $codes['bing_wt'] = $this->model->checkBingWTCode($codes['bing_wt']);
|
| 207 |
+
if (isset($codes['alexa_verify'])) $codes['alexa_verify'] = $this->model->checkBingWTCode($codes['alexa_verify']);
|
| 208 |
+
|
| 209 |
+
SQ_Classes_Tools::saveOptions("codes", $codes);
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
///////////////////////////////////////////JSONLD
|
| 214 |
+
SQ_Classes_Tools::saveOptions('sq_auto_jsonld', (int)SQ_Classes_Tools::getValue('sq_auto_jsonld'));
|
| 215 |
+
if (SQ_Classes_Tools::getIsset('sq_jsonld_type') && isset(SQ_Classes_Tools::$options['sq_jsonld'][SQ_Classes_Tools::getValue('sq_jsonld_type')])) {
|
| 216 |
+
|
| 217 |
+
foreach (SQ_Classes_Tools::$options['sq_jsonld'][SQ_Classes_Tools::getValue('sq_jsonld_type')] as $key => $value) {
|
| 218 |
+
if (isset(SQ_Classes_Tools::$options['sq_jsonld'][SQ_Classes_Tools::getValue('sq_jsonld_type')][$key])) {
|
| 219 |
+
SQ_Classes_Tools::$options['sq_jsonld'][SQ_Classes_Tools::getValue('sq_jsonld_type')][$key] = SQ_Classes_Tools::getValue('sq_jsonld_' . $key);
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
if (isset(SQ_Classes_Tools::$options['sq_jsonld'][SQ_Classes_Tools::getValue('sq_jsonld_type')]['telephone']) &&
|
| 223 |
+
SQ_Classes_Tools::$options['sq_jsonld'][SQ_Classes_Tools::getValue('sq_jsonld_type')]['telephone'] <> ''
|
| 224 |
+
) {
|
| 225 |
+
SQ_Classes_Tools::$options['sq_jsonld'][SQ_Classes_Tools::getValue('sq_jsonld_type')]['telephone'] = '+' . SQ_Classes_Tools::$options['sq_jsonld'][SQ_Classes_Tools::getValue('sq_jsonld_type')]['telephone'];
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
SQ_Classes_Tools::saveOptions('sq_jsonld_type', SQ_Classes_Tools::getValue('sq_jsonld_type'));
|
| 229 |
+
|
| 230 |
+
///////////////////////////////////////////
|
| 231 |
+
/////////////////////////////FAVICON OPTION
|
| 232 |
+
|
| 233 |
+
/* if there is an icon to upload */
|
| 234 |
+
if (!empty($_FILES['favicon'])) {
|
| 235 |
+
|
| 236 |
+
$return = $this->model->addFavicon($_FILES['favicon']);
|
| 237 |
+
if ($return['favicon'] <> '') {
|
| 238 |
+
SQ_Classes_Tools::saveOptions('favicon', strtolower(basename($return['favicon'])));
|
| 239 |
+
}
|
| 240 |
+
if ($return['message'] <> '') {
|
| 241 |
+
define('SQ_MESSAGE_FAVICON', $return['message']);
|
| 242 |
+
SQ_Classes_Error::setError(SQ_MESSAGE_FAVICON . " <br /> ");
|
| 243 |
+
}
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
if (SQ_Classes_Tools::isAjax()) {
|
| 250 |
+
SQ_Classes_Tools::setHeader('json');
|
| 251 |
+
echo json_encode(array('saved' => true));
|
| 252 |
+
exit();
|
| 253 |
+
} else {
|
| 254 |
+
//Update the rewrite rules with the new options
|
| 255 |
+
add_filter('rewrite_rules_array', array($this, 'rewrite_rules'), 999, 1);
|
| 256 |
+
//Flush the rewrite with the new favicon and sitemap
|
| 257 |
+
flush_rewrite_rules();
|
| 258 |
+
//empty the cache on settings changed
|
| 259 |
+
SQ_Classes_Tools::emptyCache();
|
| 260 |
+
|
| 261 |
+
}
|
| 262 |
+
break;
|
| 263 |
+
case 'sq_setstickysla':
|
| 264 |
+
SQ_Classes_Tools::saveUserMeta('sq_auto_sticky', (int)SQ_Classes_Tools::getValue('sq_auto_sticky'));
|
| 265 |
+
|
| 266 |
+
break;
|
| 267 |
+
case 'sq_checkissues':
|
| 268 |
+
if (!current_user_can('manage_options')) {
|
| 269 |
+
return;
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
SQ_Classes_Tools::saveOptions('sq_checkedissues', 1);
|
| 273 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 274 |
+
|
| 275 |
+
/* Load the error class */
|
| 276 |
+
SQ_Classes_Tools::checkErrorSettings();
|
| 277 |
+
|
| 278 |
+
break;
|
| 279 |
+
case 'sq_fixautoseo':
|
| 280 |
+
if (!current_user_can('manage_options')) {
|
| 281 |
+
return;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
SQ_Classes_Tools::saveOptions('sq_use', 1);
|
| 285 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 286 |
+
|
| 287 |
+
break;
|
| 288 |
+
case 'sq_fixprivate':
|
| 289 |
+
if (!current_user_can('manage_options')) {
|
| 290 |
+
return;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
update_option('blog_public', 1);
|
| 294 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 295 |
+
|
| 296 |
+
break;
|
| 297 |
+
case 'sq_fixcomments':
|
| 298 |
+
if (!current_user_can('manage_options')) {
|
| 299 |
+
return;
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
update_option('comments_notify', 1);
|
| 303 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 304 |
+
|
| 305 |
+
break;
|
| 306 |
+
case 'sq_fixpermalink':
|
| 307 |
+
if (!current_user_can('manage_options')) {
|
| 308 |
+
return;
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
$GLOBALS['wp_rewrite'] = new WP_Rewrite();
|
| 312 |
+
global $wp_rewrite;
|
| 313 |
+
$permalink_structure = ((get_option('permalink_structure') <> '') ? get_option('permalink_structure') : '/') . "%postname%/";
|
| 314 |
+
$wp_rewrite->set_permalink_structure($permalink_structure);
|
| 315 |
+
$permalink_structure = get_option('permalink_structure');
|
| 316 |
+
|
| 317 |
+
flush_rewrite_rules();
|
| 318 |
+
break;
|
| 319 |
+
case 'sq_fix_ogduplicate':
|
| 320 |
+
if (!current_user_can('manage_options')) {
|
| 321 |
+
return;
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
SQ_Classes_Tools::saveOptions('sq_auto_facebook', 0);
|
| 325 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 326 |
+
|
| 327 |
+
break;
|
| 328 |
+
case 'sq_fix_tcduplicate':
|
| 329 |
+
if (!current_user_can('manage_options')) {
|
| 330 |
+
return;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
SQ_Classes_Tools::saveOptions('sq_auto_twitter', 0);
|
| 334 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 335 |
+
|
| 336 |
+
break;
|
| 337 |
+
case 'sq_fix_titleduplicate':
|
| 338 |
+
if (!current_user_can('manage_options')) {
|
| 339 |
+
return;
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
SQ_Classes_Tools::saveOptions('sq_auto_title', 0);
|
| 343 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 344 |
+
|
| 345 |
+
break;
|
| 346 |
+
case 'sq_fix_descduplicate':
|
| 347 |
+
if (!current_user_can('manage_options')) {
|
| 348 |
+
return;
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
SQ_Classes_Tools::saveOptions('sq_auto_description', 0);
|
| 352 |
+
SQ_Classes_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Classes_Tools::getBriefOptions())), 10);
|
| 353 |
+
|
| 354 |
+
break;
|
| 355 |
+
case 'sq_active_help' :
|
| 356 |
+
if (!current_user_can('manage_options')) {
|
| 357 |
+
return;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
SQ_Classes_Tools::saveOptions('active_help', SQ_Classes_Tools::getValue('active_help'));
|
| 361 |
+
break;
|
| 362 |
+
case 'sq_warnings_off':
|
| 363 |
+
if (!current_user_can('manage_options')) {
|
| 364 |
+
return;
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
SQ_Classes_Tools::saveOptions('ignore_warn', 1);
|
| 368 |
+
break;
|
| 369 |
+
case 'sq_copyright_agreement':
|
| 370 |
+
if (!current_user_can('manage_options')) {
|
| 371 |
+
return;
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
SQ_Classes_Tools::saveOptions('sq_copyright_agreement', 1);
|
| 375 |
+
break;
|
| 376 |
+
case 'sq_get_snippet':
|
| 377 |
+
|
| 378 |
+
if (SQ_Classes_Tools::getValue('url') <> '') {
|
| 379 |
+
$url = SQ_Classes_Tools::getValue('url');
|
| 380 |
+
} else {
|
| 381 |
+
$url = get_bloginfo('url');
|
| 382 |
+
}
|
| 383 |
+
$snippet = SQ_Classes_Tools::getSnippet($url);
|
| 384 |
+
|
| 385 |
+
SQ_Classes_Tools::setHeader('json');
|
| 386 |
+
echo json_encode($snippet);
|
| 387 |
+
exit();
|
| 388 |
+
case 'sq_backup':
|
| 389 |
+
if (!current_user_can('manage_options')) {
|
| 390 |
+
return;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
SQ_Classes_Tools::setHeader('text');
|
| 394 |
+
header("Content-Disposition: attachment; filename=squirrly-settings-" . gmdate('Y-m-d') . ".txt");
|
| 395 |
+
|
| 396 |
+
if (function_exists('base64_encode')) {
|
| 397 |
+
echo base64_encode(json_encode(SQ_Classes_Tools::$options));
|
| 398 |
+
} else {
|
| 399 |
+
echo json_encode(SQ_Classes_Tools::$options);
|
| 400 |
+
}
|
| 401 |
+
exit();
|
| 402 |
+
break;
|
| 403 |
+
case 'sq_restore':
|
| 404 |
+
if (!current_user_can('manage_options')) {
|
| 405 |
+
return;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
if (!empty($_FILES['sq_options']) && $_FILES["sq_options"]["type"] == "text/plain" && $_FILES['sq_options']['tmp_name'] <> '') {
|
| 409 |
+
$fp = fopen($_FILES['sq_options']['tmp_name'], 'rb');
|
| 410 |
+
$options = '';
|
| 411 |
+
while (($line = fgets($fp)) !== false) {
|
| 412 |
+
$options .= $line;
|
| 413 |
+
}
|
| 414 |
+
try {
|
| 415 |
+
if (function_exists('base64_encode') && base64_decode($options) <> '') {
|
| 416 |
+
$options = @base64_decode($options);
|
| 417 |
+
}
|
| 418 |
+
$options = json_decode($options, true);
|
| 419 |
+
if (is_array($options) && isset($options['sq_api'])) {
|
| 420 |
+
if (SQ_Classes_Tools::getOption('sq_api') <> '') {
|
| 421 |
+
$options['sq_api'] = SQ_Classes_Tools::getOption('sq_api');
|
| 422 |
+
}
|
| 423 |
+
SQ_Classes_Tools::$options = $options;
|
| 424 |
+
SQ_Classes_Tools::saveOptions();
|
| 425 |
+
|
| 426 |
+
//Check if there is an old backup from Squirrly
|
| 427 |
+
SQ_Classes_Tools::getOptions();
|
| 428 |
+
SQ_Classes_Tools::checkUpgrade();
|
| 429 |
+
|
| 430 |
+
//Update the rewrite rules with the new options
|
| 431 |
+
add_filter('rewrite_rules_array', array($this, 'rewrite_rules'), 999, 1);
|
| 432 |
+
//Flush the rewrite with the new favicon and sitemap
|
| 433 |
+
flush_rewrite_rules();
|
| 434 |
+
|
| 435 |
+
SQ_Classes_Error::setError(__('Great! The backup is restored.', _SQ_PLUGIN_NAME_) . " <br /> ", 'success');
|
| 436 |
+
} else {
|
| 437 |
+
SQ_Classes_Error::setError(__('Error! The backup is not valid.', _SQ_PLUGIN_NAME_) . " <br /> ");
|
| 438 |
+
}
|
| 439 |
+
} catch (Exception $e) {
|
| 440 |
+
SQ_Classes_Error::setError(__('Error! The backup is not valid.', _SQ_PLUGIN_NAME_) . " <br /> ");
|
| 441 |
+
}
|
| 442 |
+
} else {
|
| 443 |
+
SQ_Classes_Error::setError(__('Error! You have to enter a previous saved backup file.', _SQ_PLUGIN_NAME_) . " <br /> ");
|
| 444 |
+
}
|
| 445 |
+
break;
|
| 446 |
+
case 'sq_backup_sql':
|
| 447 |
+
if (!current_user_can('manage_options')) {
|
| 448 |
+
return;
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
header('Content-Type: application/octet-stream');
|
| 452 |
+
header("Content-Transfer-Encoding: Binary");
|
| 453 |
+
header("Content-Disposition: attachment; filename=squirrly-seo-" . gmdate('Y-m-d') . ".sql");
|
| 454 |
+
|
| 455 |
+
if (function_exists('base64_encode')) {
|
| 456 |
+
echo base64_encode($this->model->createTableBackup());
|
| 457 |
+
} else {
|
| 458 |
+
echo $this->model->createTableBackup();
|
| 459 |
+
}
|
| 460 |
+
exit();
|
| 461 |
+
break;
|
| 462 |
+
case 'sq_restore_sql':
|
| 463 |
+
if (!current_user_can('manage_options')) {
|
| 464 |
+
return;
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
if (!empty($_FILES['sq_sql']) && $_FILES["sq_sql"]["type"] == "application/octet-stream" && $_FILES['sq_sql']['tmp_name'] <> '') {
|
| 469 |
+
$fp = fopen($_FILES['sq_sql']['tmp_name'], 'rb');
|
| 470 |
+
$sql_file = '';
|
| 471 |
+
while (($line = fgets($fp)) !== false) {
|
| 472 |
+
$sql_file .= $line;
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
if (function_exists('base64_encode')) {
|
| 476 |
+
$sql_file = @base64_decode($sql_file);
|
| 477 |
+
}
|
| 478 |
+
if ($sql_file <> '' && strpos($sql_file, 'CREATE TABLE IF NOT EXISTS') !== false) {
|
| 479 |
+
try {
|
| 480 |
+
$queries = explode(";\n", $sql_file);
|
| 481 |
+
$this->model->executeSql($queries);
|
| 482 |
+
SQ_Classes_Error::setError(__('Great! The SEO backup is restored.', _SQ_PLUGIN_NAME_) . " <br /> ", 'success');
|
| 483 |
+
|
| 484 |
+
} catch (Exception $e) {
|
| 485 |
+
SQ_Classes_Error::setError(__('Error! The backup is not valid.', _SQ_PLUGIN_NAME_) . " <br /> ");
|
| 486 |
+
}
|
| 487 |
+
} else {
|
| 488 |
+
SQ_Classes_Error::setError(__('Error! The backup is not valid.', _SQ_PLUGIN_NAME_) . " <br /> ");
|
| 489 |
+
}
|
| 490 |
+
} else {
|
| 491 |
+
SQ_Classes_Error::setError(__('Error! You have to enter a previous saved backup file.', _SQ_PLUGIN_NAME_) . " <br /> ");
|
| 492 |
+
}
|
| 493 |
+
break;
|
| 494 |
+
case 'sq_dataupgrade':
|
| 495 |
+
//Check if there is an old backup from Squirrly
|
| 496 |
+
SQ_Classes_Tools::getOptions();
|
| 497 |
+
SQ_Classes_Tools::checkUpgrade();
|
| 498 |
+
SQ_Classes_Error::setError(__('Great! Squirrly Data Settings is up to date now.', _SQ_PLUGIN_NAME_) . " <br /> ", 'success');
|
| 499 |
+
|
| 500 |
+
break;
|
| 501 |
+
case 'sq_resetsettings':
|
| 502 |
+
if (!current_user_can('manage_options')) {
|
| 503 |
+
return;
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
SQ_Classes_Tools::$options = SQ_Classes_Tools::getOptions('reset');
|
| 507 |
+
SQ_Classes_Tools::saveOptions();
|
| 508 |
+
break;
|
| 509 |
+
}
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
/**
|
| 513 |
+
* Add the favicon in the rewrite rule
|
| 514 |
+
* @param type $wp_rewrite
|
| 515 |
+
*/
|
| 516 |
+
public function rewrite_rules($wp_rewrite) {
|
| 517 |
+
$rules = array();
|
| 518 |
+
if (SQ_Classes_Tools::getOption('sq_use') == 1) {
|
| 519 |
+
|
| 520 |
+
//For Favicon
|
| 521 |
+
if (SQ_Classes_Tools::$options['sq_auto_favicon'] == 1) {
|
| 522 |
+
$rules['favicon\.ico$'] = 'index.php?sq_get=favicon';
|
| 523 |
+
$rules['favicon\.icon$'] = 'index.php?sq_get=favicon';
|
| 524 |
+
$rules['touch-icon\.png$'] = 'index.php?sq_get=touchicon';
|
| 525 |
+
foreach ($this->model->appleSizes as $size) {
|
| 526 |
+
$size = (int)$size;
|
| 527 |
+
$rules['touch-icon' . $size . '\.png$'] = 'index.php?sq_get=touchicon&sq_size=' . $size;
|
| 528 |
+
}
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
if (SQ_Classes_Tools::$options['sq_auto_feed'] == 1) {
|
| 532 |
+
$rules['sqfeedcss$'] = 'index.php?sq_get=feedcss';
|
| 533 |
+
}
|
| 534 |
+
}
|
| 535 |
+
return array_merge($rules, $wp_rewrite);
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
+
}
|
core/{SQ_BlockSupport/SQ_BlockSupport.php → BlockSupport.php}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class
|
| 4 |
|
| 5 |
/**
|
| 6 |
* Called when Post action is triggered
|
|
@@ -10,18 +10,18 @@ class SQ_BlockSupport extends SQ_BlockController {
|
|
| 10 |
public function action() {
|
| 11 |
parent::action();
|
| 12 |
|
| 13 |
-
switch (
|
| 14 |
case 'sq_feedback':
|
| 15 |
global $current_user;
|
| 16 |
$return = array();
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
$line = "\n" . "________________________________________" . "\n";
|
| 21 |
$from = $current_user->user_email;
|
| 22 |
$subject = __('Plugin Feedback', _SQ_PLUGIN_NAME_);
|
| 23 |
-
$face =
|
| 24 |
-
$message =
|
| 25 |
|
| 26 |
if ($message <> '' || (int) $face > 0) {
|
| 27 |
switch ($face) {
|
|
@@ -66,7 +66,7 @@ class SQ_BlockSupport extends SQ_BlockController {
|
|
| 66 |
$return['error'] = true;
|
| 67 |
}
|
| 68 |
|
| 69 |
-
|
| 70 |
echo json_encode($return);
|
| 71 |
break;
|
| 72 |
|
|
@@ -82,8 +82,8 @@ class SQ_BlockSupport extends SQ_BlockController {
|
|
| 82 |
|
| 83 |
$line = "\n" . "________________________________________" . "\n";
|
| 84 |
$from = $current_user->user_email;
|
| 85 |
-
$subject =
|
| 86 |
-
$message =
|
| 87 |
|
| 88 |
if ($message <> '') {
|
| 89 |
$message .= $line;
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class SQ_Core_BlockSupport extends SQ_Classes_BlockController {
|
| 4 |
|
| 5 |
/**
|
| 6 |
* Called when Post action is triggered
|
| 10 |
public function action() {
|
| 11 |
parent::action();
|
| 12 |
|
| 13 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 14 |
case 'sq_feedback':
|
| 15 |
global $current_user;
|
| 16 |
$return = array();
|
| 17 |
|
| 18 |
+
SQ_Classes_Tools::saveOptions('sq_feedback', 1);
|
| 19 |
|
| 20 |
$line = "\n" . "________________________________________" . "\n";
|
| 21 |
$from = $current_user->user_email;
|
| 22 |
$subject = __('Plugin Feedback', _SQ_PLUGIN_NAME_);
|
| 23 |
+
$face = SQ_Classes_Tools::getValue('feedback');
|
| 24 |
+
$message = SQ_Classes_Tools::getValue('message');
|
| 25 |
|
| 26 |
if ($message <> '' || (int) $face > 0) {
|
| 27 |
switch ($face) {
|
| 66 |
$return['error'] = true;
|
| 67 |
}
|
| 68 |
|
| 69 |
+
SQ_Classes_Tools::setHeader('json');
|
| 70 |
echo json_encode($return);
|
| 71 |
break;
|
| 72 |
|
| 82 |
|
| 83 |
$line = "\n" . "________________________________________" . "\n";
|
| 84 |
$from = $current_user->user_email;
|
| 85 |
+
$subject = SQ_Classes_Tools::getValue('subject', __('Plugin Support', _SQ_PLUGIN_NAME_));
|
| 86 |
+
$message = SQ_Classes_Tools::getValue('message');
|
| 87 |
|
| 88 |
if ($message <> '') {
|
| 89 |
$message .= $line;
|
core/BlockToolbar.php
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class SQ_Core_BlockToolbar extends SQ_Classes_BlockController {
|
| 3 |
+
|
| 4 |
+
}
|
core/{SQ_Blocklogin/SQ_Blocklogin.php → Blocklogin.php}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class
|
| 4 |
|
| 5 |
public function init() {
|
| 6 |
/* If logged in, then return */
|
| 7 |
-
if (
|
| 8 |
return;
|
| 9 |
parent::init();
|
| 10 |
}
|
|
@@ -15,7 +15,7 @@ class SQ_Blocklogin extends SQ_BlockController {
|
|
| 15 |
*/
|
| 16 |
public function action() {
|
| 17 |
parent::action();
|
| 18 |
-
switch (
|
| 19 |
//login action
|
| 20 |
case 'sq_login':
|
| 21 |
$this->squirrlyLogin();
|
|
@@ -28,12 +28,12 @@ class SQ_Blocklogin extends SQ_BlockController {
|
|
| 28 |
|
| 29 |
//reset the token action
|
| 30 |
case 'sq_reset':
|
| 31 |
-
|
| 32 |
$return = array();
|
| 33 |
$return['reset'] = 'success';
|
| 34 |
|
| 35 |
//Set the header for json reply
|
| 36 |
-
|
| 37 |
echo json_encode($return);
|
| 38 |
//force exit
|
| 39 |
exit();
|
|
@@ -54,15 +54,15 @@ class SQ_Blocklogin extends SQ_BlockController {
|
|
| 54 |
$args = array();
|
| 55 |
|
| 56 |
//Check if email is set
|
| 57 |
-
if (
|
| 58 |
$args['name'] = '';
|
| 59 |
-
$args['user'] =
|
| 60 |
-
$args['email'] =
|
| 61 |
}
|
| 62 |
|
| 63 |
//if email is set
|
| 64 |
if ($args['email'] <> '') {
|
| 65 |
-
$responce =
|
| 66 |
|
| 67 |
//create an object from json responce
|
| 68 |
if (is_object(json_decode($responce)))
|
|
@@ -73,7 +73,7 @@ class SQ_Blocklogin extends SQ_BlockController {
|
|
| 73 |
|
| 74 |
//check if token is set and save it
|
| 75 |
if (isset($return->token)) {
|
| 76 |
-
|
| 77 |
} elseif (!empty($return->error)) {
|
| 78 |
//if an error is throw then ...
|
| 79 |
switch ($return->error) {
|
|
@@ -89,7 +89,7 @@ class SQ_Blocklogin extends SQ_BlockController {
|
|
| 89 |
$return->error = sprintf(__('Could not send your informations to squirrly. Please register %smanually%s.', _SQ_PLUGIN_NAME_), '<a href="' . _SQ_DASH_URL_ . 'login/?action=register" target="_blank">', '</a>');
|
| 90 |
|
| 91 |
//Set the header to json
|
| 92 |
-
|
| 93 |
echo json_encode($return); //transform object in json and show it
|
| 94 |
|
| 95 |
exit();
|
|
@@ -105,12 +105,12 @@ class SQ_Blocklogin extends SQ_BlockController {
|
|
| 105 |
$responce = '';
|
| 106 |
|
| 107 |
//get the user and password
|
| 108 |
-
$args['user'] =
|
| 109 |
-
$args['password'] =
|
| 110 |
|
| 111 |
if ($args['user'] <> '' && $args['password'] <> '') {
|
| 112 |
//get the responce from server on login call
|
| 113 |
-
$responce =
|
| 114 |
|
| 115 |
//create an object from json responce
|
| 116 |
if (is_object(json_decode($responce)))
|
|
@@ -121,7 +121,7 @@ class SQ_Blocklogin extends SQ_BlockController {
|
|
| 121 |
|
| 122 |
//check if token is set and save it
|
| 123 |
if (isset($return->token)) {
|
| 124 |
-
|
| 125 |
} elseif (!empty($return->error)) {
|
| 126 |
//if an error is throw then ...
|
| 127 |
switch ($return->error) {
|
|
@@ -139,7 +139,7 @@ class SQ_Blocklogin extends SQ_BlockController {
|
|
| 139 |
$return->error = __('Both fields are required.', _SQ_PLUGIN_NAME_);
|
| 140 |
|
| 141 |
//Set the header to json
|
| 142 |
-
|
| 143 |
echo json_encode($return);
|
| 144 |
|
| 145 |
exit();
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class SQ_Core_Blocklogin extends SQ_Classes_BlockController {
|
| 4 |
|
| 5 |
public function init() {
|
| 6 |
/* If logged in, then return */
|
| 7 |
+
if (SQ_Classes_Tools::getOption('sq_api') <> '')
|
| 8 |
return;
|
| 9 |
parent::init();
|
| 10 |
}
|
| 15 |
*/
|
| 16 |
public function action() {
|
| 17 |
parent::action();
|
| 18 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 19 |
//login action
|
| 20 |
case 'sq_login':
|
| 21 |
$this->squirrlyLogin();
|
| 28 |
|
| 29 |
//reset the token action
|
| 30 |
case 'sq_reset':
|
| 31 |
+
SQ_Classes_Tools::saveOptions('sq_api', '');
|
| 32 |
$return = array();
|
| 33 |
$return['reset'] = 'success';
|
| 34 |
|
| 35 |
//Set the header for json reply
|
| 36 |
+
SQ_Classes_Tools::setHeader('json');
|
| 37 |
echo json_encode($return);
|
| 38 |
//force exit
|
| 39 |
exit();
|
| 54 |
$args = array();
|
| 55 |
|
| 56 |
//Check if email is set
|
| 57 |
+
if (SQ_Classes_Tools::getValue('email') <> '') {
|
| 58 |
$args['name'] = '';
|
| 59 |
+
$args['user'] = SQ_Classes_Tools::getValue('email');
|
| 60 |
+
$args['email'] = SQ_Classes_Tools::getValue('email');
|
| 61 |
}
|
| 62 |
|
| 63 |
//if email is set
|
| 64 |
if ($args['email'] <> '') {
|
| 65 |
+
$responce = SQ_Classes_Action::apiCall('sq/register', $args);
|
| 66 |
|
| 67 |
//create an object from json responce
|
| 68 |
if (is_object(json_decode($responce)))
|
| 73 |
|
| 74 |
//check if token is set and save it
|
| 75 |
if (isset($return->token)) {
|
| 76 |
+
SQ_Classes_Tools::saveOptions('sq_api', $return->token);
|
| 77 |
} elseif (!empty($return->error)) {
|
| 78 |
//if an error is throw then ...
|
| 79 |
switch ($return->error) {
|
| 89 |
$return->error = sprintf(__('Could not send your informations to squirrly. Please register %smanually%s.', _SQ_PLUGIN_NAME_), '<a href="' . _SQ_DASH_URL_ . 'login/?action=register" target="_blank">', '</a>');
|
| 90 |
|
| 91 |
//Set the header to json
|
| 92 |
+
SQ_Classes_Tools::setHeader('json');
|
| 93 |
echo json_encode($return); //transform object in json and show it
|
| 94 |
|
| 95 |
exit();
|
| 105 |
$responce = '';
|
| 106 |
|
| 107 |
//get the user and password
|
| 108 |
+
$args['user'] = SQ_Classes_Tools::getValue('user', null, true);
|
| 109 |
+
$args['password'] = SQ_Classes_Tools::getValue('password', null, true);
|
| 110 |
|
| 111 |
if ($args['user'] <> '' && $args['password'] <> '') {
|
| 112 |
//get the responce from server on login call
|
| 113 |
+
$responce = SQ_Classes_Action::apiCall('sq/login', $args);
|
| 114 |
|
| 115 |
//create an object from json responce
|
| 116 |
if (is_object(json_decode($responce)))
|
| 121 |
|
| 122 |
//check if token is set and save it
|
| 123 |
if (isset($return->token)) {
|
| 124 |
+
SQ_Classes_Tools::saveOptions('sq_api', $return->token);
|
| 125 |
} elseif (!empty($return->error)) {
|
| 126 |
//if an error is throw then ...
|
| 127 |
switch ($return->error) {
|
| 139 |
$return->error = __('Both fields are required.', _SQ_PLUGIN_NAME_);
|
| 140 |
|
| 141 |
//Set the header to json
|
| 142 |
+
SQ_Classes_Tools::setHeader('json');
|
| 143 |
echo json_encode($return);
|
| 144 |
|
| 145 |
exit();
|
core/Blockresearch.php
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Core class for SQ_Core_Blocksearch
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Core_Blockresearch extends SQ_Classes_BlockController {
|
| 7 |
+
|
| 8 |
+
}
|
core/Blocksearch.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Core class for SQ_Core_Blocksearch
|
| 5 |
+
*/
|
| 6 |
+
class SQ_Core_Blocksearch extends SQ_Classes_BlockController {
|
| 7 |
+
|
| 8 |
+
public function action() {
|
| 9 |
+
$start = 0;
|
| 10 |
+
$nbr = 8;
|
| 11 |
+
$exclude = array();
|
| 12 |
+
|
| 13 |
+
parent::action();
|
| 14 |
+
switch (SQ_Classes_Tools::getValue('action')) {
|
| 15 |
+
case 'sq_type_click':
|
| 16 |
+
SQ_Classes_Tools::saveOptions('sq_img_licence', SQ_Classes_Tools::getValue('licence'));
|
| 17 |
+
exit();
|
| 18 |
+
break;
|
| 19 |
+
case 'sq_search_blog':
|
| 20 |
+
if (SQ_Classes_Tools::getValue('exclude') && SQ_Classes_Tools::getValue('exclude') <> 'undefined')
|
| 21 |
+
$exclude = array((int) SQ_Classes_Tools::getValue('exclude'));
|
| 22 |
+
|
| 23 |
+
if (SQ_Classes_Tools::getValue('start'))
|
| 24 |
+
$start = array((int) SQ_Classes_Tools::getValue('start'));
|
| 25 |
+
|
| 26 |
+
if (SQ_Classes_Tools::getValue('nrb'))
|
| 27 |
+
$nrb = (int) SQ_Classes_Tools::getValue('nrb');
|
| 28 |
+
|
| 29 |
+
if (SQ_Classes_Tools::getValue('q') <> '')
|
| 30 |
+
echo SQ_Classes_ObjController::getClass('SQ_Models_Post')->searchPost(SQ_Classes_Tools::getValue('q'), $exclude, (int) $start, (int) $nrb);
|
| 31 |
+
break;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
exit();
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
public function hookHead() {
|
| 38 |
+
parent::hookHead();
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
}
|
core/Blockseo.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class SQ_Core_Blockseo extends SQ_Classes_BlockController {
|
| 4 |
+
|
| 5 |
+
public function action() {
|
| 6 |
+
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
public function hookHead() {
|
| 10 |
+
parent::hookHead();
|
| 11 |
+
|
| 12 |
+
echo '<script type="text/javascript">
|
| 13 |
+
var __snippetshort = "' . __('Too short', _SQ_PLUGIN_NAME_) . '";
|
| 14 |
+
var __snippetlong = "' . __('Too long', _SQ_PLUGIN_NAME_) . '";
|
| 15 |
+
var __sq_snippet = "' . __('snippet', _SQ_PLUGIN_NAME_) . '";
|
| 16 |
+
' . "\n" . '</script>';
|
| 17 |
+
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
core/Loading.php
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class SQ_Core_Loading extends SQ_Classes_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_Classes_Tools::getBrowserInfo();
|
| 15 |
+
|
| 16 |
+
if ((isset($browser) && $browser != false && is_array($browser) && $browser['name'] == 'IE' && (int)$browser['version'] < 9 && (int)$browser['version'] > 0)) {
|
| 17 |
+
echo '<script type="text/javascript">
|
| 18 |
+
(function($){
|
| 19 |
+
$("#sq_preloading").removeClass("sq_loading");
|
| 20 |
+
$("#sq_preloading").addClass("sq_error")
|
| 21 |
+
$("#sq_preloading").html("' . __('For Squirrly to work properly you have to use a higher version of Internet Explorer. <br /> We recommend you to use Chrome or Mozilla.', _SQ_PLUGIN_NAME_) . '");
|
| 22 |
+
$("#sq_options").hide();
|
| 23 |
+
$("#sq_blocklogin").hide();
|
| 24 |
+
})(jQuery);
|
| 25 |
+
</script>';
|
| 26 |
+
} else {
|
| 27 |
+
echo '<script type="text/javascript">
|
| 28 |
+
var SQ_DEBUG = ' . (int)SQ_DEBUG . ';
|
| 29 |
+
(function($){
|
| 30 |
+
$.sq_config = {
|
| 31 |
+
sq_use: ' . (int)SQ_Classes_Tools::getOption('sq_use') . ',
|
| 32 |
+
user_url: "' . home_url() . '",
|
| 33 |
+
sq_baseurl: "' . _SQ_STATIC_API_URL_ . '",
|
| 34 |
+
sq_uri: "' . SQ_URI . '",
|
| 35 |
+
sq_apiurl: "' . _SQ_API_URL_ . '",
|
| 36 |
+
language: "' . get_bloginfo('language') . '",
|
| 37 |
+
sq_version: "' . SQ_VERSION_ID . '",
|
| 38 |
+
sq_wpversion: "' . WP_VERSION_ID . '",
|
| 39 |
+
sq_phpversion: "' . PHP_VERSION_ID . '",
|
| 40 |
+
sq_seoversion: "' . (SQ_Classes_Tools::getOption('sq_sla') + 1) . '",
|
| 41 |
+
keyword_information: ' . (int)SQ_Classes_Tools::getOption('sq_keyword_information') . ',
|
| 42 |
+
sq_keywordtag: ' . (int)SQ_Classes_Tools::getOption('sq_keywordtag') . ',
|
| 43 |
+
frontend_css: "' . _SQ_THEME_URL_ . 'css/frontend' . (SQ_DEBUG ? '' : '.min') . '.css",
|
| 44 |
+
postID: "' . $sq_postID . '",
|
| 45 |
+
prevNonce: "' . wp_create_nonce('post_preview_' . $sq_postID) . '",
|
| 46 |
+
token: "' . SQ_Classes_Tools::getOption('sq_api') . '",
|
| 47 |
+
__infotext: ["' . __('Recent discussions:', _SQ_PLUGIN_NAME_) . '", "' . __('SEO Search Volume:', _SQ_PLUGIN_NAME_) . '", "' . __('Competition:', _SQ_PLUGIN_NAME_) . '", "' . __('Trend:', _SQ_PLUGIN_NAME_) . '"],
|
| 48 |
+
__keyword: "' . __('Keyword:', _SQ_PLUGIN_NAME_) . '",
|
| 49 |
+
__date: "' . __('date', _SQ_PLUGIN_NAME_) . '",
|
| 50 |
+
__readit: "' . __('Read it!', _SQ_PLUGIN_NAME_) . '",
|
| 51 |
+
__insertit: "' . __('Insert it!', _SQ_PLUGIN_NAME_) . '",
|
| 52 |
+
__reference: "' . __('Reference', _SQ_PLUGIN_NAME_) . '",
|
| 53 |
+
__insertasbox: "' . __('Insert as box', _SQ_PLUGIN_NAME_) . '",
|
| 54 |
+
__addlink: "' . __('Insert Link', _SQ_PLUGIN_NAME_) . '",
|
| 55 |
+
__notrelevant: "' . __('Not relevant?', _SQ_PLUGIN_NAME_) . '",
|
| 56 |
+
__insertparagraph: "' . __('Insert in your article', _SQ_PLUGIN_NAME_) . '",
|
| 57 |
+
__ajaxerror: "' . __(':( An error occurred while processing your request. Please try again', _SQ_PLUGIN_NAME_) . '",
|
| 58 |
+
__krerror: "' . __('Keyword Research takes too long to get the results. Click to try again', _SQ_PLUGIN_NAME_) . '",
|
| 59 |
+
__nofound: "' . __('No results found!', _SQ_PLUGIN_NAME_) . '",
|
| 60 |
+
__morewords: "' . __('Enter one more word to find relevant results', _SQ_PLUGIN_NAME_) . '",
|
| 61 |
+
__toolong: "' . __('Takes too long to check this keyword ...', _SQ_PLUGIN_NAME_) . '",
|
| 62 |
+
__doresearch: "' . __('Do a research!', _SQ_PLUGIN_NAME_) . '",
|
| 63 |
+
__morekeywords: "' . __('Do more research!', _SQ_PLUGIN_NAME_) . '",
|
| 64 |
+
__sq_photo_copyright: "' . __('[ ATTRIBUTE: Please check: %s to find out how to attribute this image ]', _SQ_PLUGIN_NAME_) . '",
|
| 65 |
+
__has_attributes: "' . __('Has creative commons attributes', _SQ_PLUGIN_NAME_) . '",
|
| 66 |
+
__no_attributes: "' . __('No known copyright restrictions', _SQ_PLUGIN_NAME_) . '",
|
| 67 |
+
__noopt: "' . __('You haven`t used Squirrly SEO to optimize your article. Do you want to optimize for a keyword before publishing?', _SQ_PLUGIN_NAME_) . '",
|
| 68 |
+
__limit_exceeded: "' . __('Keyword Research limit exceeded', _SQ_PLUGIN_NAME_) . '",
|
| 69 |
+
__subscription_expired: "' . __('Your Subscription has Expired', _SQ_PLUGIN_NAME_) . '",
|
| 70 |
+
__add_keywords: "' . __('Add 20 Keyword Researches', _SQ_PLUGIN_NAME_) . '",
|
| 71 |
+
__no_briefcase: "' . __('There are no keywords saved in briefcase yet', _SQ_PLUGIN_NAME_) . '",
|
| 72 |
+
__fulloptimized: "' . __('Congratulations! Your article is 100% optimized!', _SQ_PLUGIN_NAME_) . '",
|
| 73 |
+
__toomanytimes: "' . __('appears too many times. Try to remove %s of them', _SQ_PLUGIN_NAME_) . '",
|
| 74 |
+
__writemorewords: "' . __('write %s more words', _SQ_PLUGIN_NAME_) . '",
|
| 75 |
+
__keywordinintroduction: "' . __('Add the keyword in the %s of your article', _SQ_PLUGIN_NAME_) . '",
|
| 76 |
+
__clicktohighlight: "' . __('Click to keep the highlight on', _SQ_PLUGIN_NAME_) . '",
|
| 77 |
+
__introduction: "' . __('introduction', _SQ_PLUGIN_NAME_) . '",
|
| 78 |
+
__morewordsafter: "' . __('Write more words after the %s keyword', _SQ_PLUGIN_NAME_) . '",
|
| 79 |
+
__orusesynonyms: "' . __('or use synonyms', _SQ_PLUGIN_NAME_) . '",
|
| 80 |
+
__addmorewords: "' . __('add %s more word(s)', _SQ_PLUGIN_NAME_) . '",
|
| 81 |
+
__removewords: "' . __('or remove %s word(s)', _SQ_PLUGIN_NAME_) . '",
|
| 82 |
+
__addmorekeywords: "' . __('add %s more keyword(s)', _SQ_PLUGIN_NAME_) . '",
|
| 83 |
+
__addminimumwords: "' . __('write %s more words to start calculating', _SQ_PLUGIN_NAME_) . '",
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
if (typeof sq_script === "undefined"){
|
| 88 |
+
var sq_script = document.createElement(\'script\');
|
| 89 |
+
sq_script.src = "' . _SQ_STATIC_API_URL_ . SQ_URI . '/js/squirrly' . (SQ_DEBUG ? '' : '.min') . '.js?ver=' . SQ_VERSION_ID . '";
|
| 90 |
+
var site_head = document.getElementsByTagName ("head")[0] || document.documentElement;
|
| 91 |
+
site_head.insertBefore(sq_script, site_head.firstChild);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
$(document).ready(function() {
|
| 96 |
+
$("#sq_preloading").html("");
|
| 97 |
+
});
|
| 98 |
+
})(jQuery);
|
| 99 |
+
|
| 100 |
+
</script>';
|
| 101 |
+
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
}
|
core/SQ_BlockAnalytics/SQ_BlockAnalytics.php
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class SQ_BlockAnalytics extends SQ_BlockController {
|
| 4 |
-
|
| 5 |
-
public function hookGetContent() {
|
| 6 |
-
|
| 7 |
-
}
|
| 8 |
-
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/SQ_BlockCustomerService/SQ_BlockCustomerService.php
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 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_BlockHelp/SQ_BlockHelp.php
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* Affiliate settings
|
| 5 |
-
*/
|
| 6 |
-
class SQ_BlockHelp extends SQ_BlockController {
|
| 7 |
-
|
| 8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/SQ_BlockKeywordResearch/SQ_BlockKeywordResearch.php
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 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_BlockSettings/SQ_BlockSettings.php
DELETED
|
@@ -1,72 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* Account settings
|
| 5 |
-
*/
|
| 6 |
-
class SQ_BlockSettings extends SQ_BlockController {
|
| 7 |
-
|
| 8 |
-
function hookGetContent() {
|
| 9 |
-
parent::preloadSettings();
|
| 10 |
-
SQ_ObjController::getController('SQ_Error', false)->hookNotices();
|
| 11 |
-
echo '<script type="text/javascript">
|
| 12 |
-
jQuery(document).ready(function () {
|
| 13 |
-
jQuery("#sq_settings").find("select[name=sq_google_country]").val("' . SQ_Tools::$options['sq_google_country'] . '");
|
| 14 |
-
});
|
| 15 |
-
</script>';
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
/**
|
| 19 |
-
* Called when Post action is triggered
|
| 20 |
-
*
|
| 21 |
-
* @return void
|
| 22 |
-
*/
|
| 23 |
-
public function action() {
|
| 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) {
|
| 38 |
-
array_push(SQ_Tools::$options['sq_post_types'], $key);
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
if (!in_array('product', get_post_types())) {
|
| 42 |
-
array_push(SQ_Tools::$options['sq_post_types'], 'product');
|
| 43 |
-
}
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
SQ_Tools::saveOptions('sq_google_country', SQ_Tools::getValue('sq_google_country'));
|
| 47 |
-
SQ_Tools::saveOptions('sq_google_country_strict', SQ_Tools::getValue('sq_google_country_strict'));
|
| 48 |
-
SQ_Tools::saveOptions('sq_google_ranksperhour', SQ_Tools::getValue('sq_google_ranksperhour'));
|
| 49 |
-
|
| 50 |
-
SQ_Tools::saveOptions('sq_keyword_help', (int) SQ_Tools::getValue('sq_keyword_help'));
|
| 51 |
-
SQ_Tools::saveOptions('sq_keyword_information', (int) SQ_Tools::getValue('sq_keyword_information'));
|
| 52 |
-
SQ_Tools::saveOptions('sq_force_savepost', (int) SQ_Tools::getValue('sq_force_savepost'));
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
SQ_Tools::saveOptions('sq_sla', (int) SQ_Tools::getValue('sq_sla'));
|
| 56 |
-
SQ_Tools::saveOptions('sq_keywordtag', (int) SQ_Tools::getValue('sq_keywordtag'));
|
| 57 |
-
SQ_Tools::saveOptions('sq_local_images', (int) SQ_Tools::getValue('sq_local_images'));
|
| 58 |
-
SQ_Tools::saveOptions('sq_url_fix', (int) SQ_Tools::getValue('sq_url_fix'));
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
SQ_Tools::saveOptions('sq_google_wt', SQ_ObjController::getModel('SQ_BlockSettingsSeo')->checkGoogleWTCode(SQ_Tools::getValue('sq_google_wt','',true)));
|
| 62 |
-
SQ_Tools::saveOptions('sq_bing_wt', SQ_ObjController::getModel('SQ_BlockSettingsSeo')->checkBingWTCode(SQ_Tools::getValue('sq_bing_wt','',true)));
|
| 63 |
-
SQ_Tools::saveOptions('sq_alexa', SQ_ObjController::getModel('SQ_BlockSettingsSeo')->checkBingWTCode(SQ_Tools::getValue('sq_alexa','',true)));
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 67 |
-
SQ_Tools::emptyCache();
|
| 68 |
-
break;
|
| 69 |
-
}
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/SQ_BlockSettingsSeo/SQ_BlockSettingsSeo.php
DELETED
|
@@ -1,382 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* Account settings
|
| 5 |
-
*/
|
| 6 |
-
class SQ_BlockSettingsSeo extends SQ_BlockController {
|
| 7 |
-
|
| 8 |
-
function hookGetContent() {
|
| 9 |
-
parent::preloadSettings();
|
| 10 |
-
/* Force call of error display */
|
| 11 |
-
SQ_ObjController::getController('SQ_Error', false)->hookNotices();
|
| 12 |
-
echo '<script type="text/javascript">
|
| 13 |
-
var __snippetshort = "' . __('Too short', _SQ_PLUGIN_NAME_) . '";
|
| 14 |
-
var __snippetlong = "' . __('Too long', _SQ_PLUGIN_NAME_) . '";
|
| 15 |
-
jQuery(document).ready(function () {
|
| 16 |
-
jQuery("#sq_settings").find("select[name=sq_og_locale]").val("' . SQ_Tools::$options['sq_og_locale'] . '");
|
| 17 |
-
});
|
| 18 |
-
</script>';
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
function hookHead() {
|
| 22 |
-
if (function_exists('wp_enqueue_media')) {
|
| 23 |
-
wp_enqueue_media();
|
| 24 |
-
}
|
| 25 |
-
parent::hookHead();
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
/**
|
| 29 |
-
* Called when Post action is triggered
|
| 30 |
-
*
|
| 31 |
-
* @return void
|
| 32 |
-
*/
|
| 33 |
-
public function action() {
|
| 34 |
-
parent::action();
|
| 35 |
-
|
| 36 |
-
switch (SQ_Tools::getValue('action')) {
|
| 37 |
-
|
| 38 |
-
case 'sq_settingsseo_update':
|
| 39 |
-
if (!current_user_can('manage_options')) {
|
| 40 |
-
return;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
if (!SQ_Tools::getIsset('sq_use')) {
|
| 44 |
-
return;
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
SQ_Tools::saveOptions('sq_use', (int)SQ_Tools::getValue('sq_use'));
|
| 48 |
-
SQ_Tools::saveOptions('sq_auto_title', (int)SQ_Tools::getValue('sq_auto_title'));
|
| 49 |
-
SQ_Tools::saveOptions('sq_auto_description', (int)SQ_Tools::getValue('sq_auto_description'));
|
| 50 |
-
SQ_Tools::saveOptions('sq_auto_canonical', (int)SQ_Tools::getValue('sq_auto_canonical'));
|
| 51 |
-
SQ_Tools::saveOptions('sq_auto_amp', (int)SQ_Tools::getValue('sq_auto_amp'));
|
| 52 |
-
|
| 53 |
-
SQ_Tools::saveOptions('sq_auto_meta', (int)SQ_Tools::getValue('sq_auto_meta'));
|
| 54 |
-
SQ_Tools::saveOptions('sq_auto_favicon', (int)SQ_Tools::getValue('sq_auto_favicon'));
|
| 55 |
-
|
| 56 |
-
///////////////////////////////////////////
|
| 57 |
-
/////////////////////////////SOCIAL OPTION
|
| 58 |
-
SQ_Tools::saveOptions('sq_auto_facebook', (int)SQ_Tools::getValue('sq_auto_facebook'));
|
| 59 |
-
SQ_Tools::saveOptions('sq_auto_twitter', (int)SQ_Tools::getValue('sq_auto_twitter'));
|
| 60 |
-
SQ_Tools::saveOptions('sq_auto_twittersize', SQ_Tools::getValue('sq_auto_twittersize'));
|
| 61 |
-
SQ_Tools::saveOptions('sq_og_locale', SQ_Tools::getValue('sq_og_locale'));
|
| 62 |
-
|
| 63 |
-
SQ_Tools::saveOptions('sq_twitter_account', $this->model->checkTwitterAccount(SQ_Tools::getValue('sq_twitter_account')));
|
| 64 |
-
SQ_Tools::saveOptions('sq_facebook_account', $this->model->checkFacebookAccount(SQ_Tools::getValue('sq_facebook_account')));
|
| 65 |
-
SQ_Tools::saveOptions('sq_google_plus', $this->model->checkGoogleAccount(SQ_Tools::getValue('sq_google_plus')));
|
| 66 |
-
SQ_Tools::saveOptions('sq_linkedin_account', $this->model->checkLinkeinAccount(SQ_Tools::getValue('sq_linkedin_account')));
|
| 67 |
-
SQ_Tools::saveOptions('sq_pinterest_account', $this->model->checkPinterestAccount(SQ_Tools::getValue('sq_pinterest_account')));
|
| 68 |
-
SQ_Tools::saveOptions('sq_instagram_account', $this->model->checkInstagramAccount(SQ_Tools::getValue('sq_instagram_account')));
|
| 69 |
-
|
| 70 |
-
///////////////////////////////////////////
|
| 71 |
-
/////////////////////////////FIRST PAGE OPTIMIZATION
|
| 72 |
-
SQ_Tools::saveOptions('sq_auto_seo', 0);
|
| 73 |
-
if ($pageId = get_option('page_on_front')) {
|
| 74 |
-
$meta = array();
|
| 75 |
-
if (SQ_Tools::getIsset('sq_fp_title'))
|
| 76 |
-
$meta[] = array('key' => '_sq_fp_title', 'value' => urldecode(SQ_Tools::getValue('sq_fp_title')));
|
| 77 |
-
|
| 78 |
-
if (SQ_Tools::getIsset('sq_fp_description'))
|
| 79 |
-
$meta[] = array('key' => '_sq_fp_description', 'value' => urldecode(SQ_Tools::getValue('sq_fp_description')));
|
| 80 |
-
|
| 81 |
-
if (SQ_Tools::getIsset('sq_fp_keywords'))
|
| 82 |
-
$meta[] = array('key' => '_sq_fp_keywords', 'value' => SQ_Tools::getValue('sq_fp_keywords'));
|
| 83 |
-
|
| 84 |
-
if (SQ_Tools::getIsset('sq_fp_ogimage'))
|
| 85 |
-
$meta[] = array('key' => '_sq_fp_ogimage', 'value' => SQ_Tools::getValue('sq_fp_ogimage'));
|
| 86 |
-
|
| 87 |
-
if (!empty($meta))
|
| 88 |
-
SQ_ObjController::getModel('SQ_Post')->saveAdvMeta($pageId, $meta);
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
SQ_Tools::saveOptions('sq_fp_title', SQ_Tools::getValue('sq_fp_title'));
|
| 92 |
-
SQ_Tools::saveOptions('sq_fp_description', SQ_Tools::getValue('sq_fp_description'));
|
| 93 |
-
SQ_Tools::saveOptions('sq_fp_keywords', SQ_Tools::getValue('sq_fp_keywords'));
|
| 94 |
-
SQ_Tools::saveOptions('sq_fp_ogimage', SQ_Tools::getValue('sq_fp_ogimage'));
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
///////////////////////////////////////////
|
| 98 |
-
/////////////////////////////SITEMAP OPTION
|
| 99 |
-
SQ_Tools::saveOptions('sq_auto_sitemap', (int)SQ_Tools::getValue('sq_auto_sitemap'));
|
| 100 |
-
SQ_Tools::saveOptions('sq_auto_feed', (int)SQ_Tools::getValue('sq_auto_feed'));
|
| 101 |
-
SQ_Tools::saveOptions('sq_sitemap_frequency', SQ_Tools::getValue('sq_sitemap_frequency'));
|
| 102 |
-
SQ_Tools::saveOptions('sq_sitemap_ping', (int)SQ_Tools::getValue('sq_sitemap_ping'));
|
| 103 |
-
|
| 104 |
-
foreach (SQ_Tools::$options['sq_sitemap'] as $key => $value) {
|
| 105 |
-
if ($key == 'sitemap') {
|
| 106 |
-
continue;
|
| 107 |
-
}
|
| 108 |
-
SQ_Tools::$options['sq_sitemap'][$key][1] = 0;
|
| 109 |
-
if ($key == 'sitemap-product' && !$this->model->isEcommerce()) {
|
| 110 |
-
SQ_Tools::$options['sq_sitemap'][$key][1] = 2;
|
| 111 |
-
}
|
| 112 |
-
}
|
| 113 |
-
if (SQ_Tools::getIsset('sq_sitemap')) {
|
| 114 |
-
foreach (SQ_Tools::getValue('sq_sitemap') as $key) {
|
| 115 |
-
if (isset(SQ_Tools::$options['sq_sitemap'][$key][1])) {
|
| 116 |
-
SQ_Tools::$options['sq_sitemap'][$key][1] = 1;
|
| 117 |
-
}
|
| 118 |
-
}
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
foreach (SQ_Tools::$options['sq_sitemap_show'] as $key => $value) {
|
| 122 |
-
SQ_Tools::$options['sq_sitemap_show'][$key] = 0;
|
| 123 |
-
}
|
| 124 |
-
if (SQ_Tools::getIsset('sq_sitemap_show')) {
|
| 125 |
-
foreach (SQ_Tools::getValue('sq_sitemap_show') as $key) {
|
| 126 |
-
if (isset(SQ_Tools::$options['sq_sitemap_show'][$key])) {
|
| 127 |
-
SQ_Tools::$options['sq_sitemap_show'][$key] = 1;
|
| 128 |
-
}
|
| 129 |
-
}
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
///////////////////////////////////////////
|
| 133 |
-
|
| 134 |
-
SQ_Tools::saveOptions('sq_google_analytics', $this->model->checkGoogleAnalyticsCode(SQ_Tools::getValue('sq_google_analytics', '', true)));
|
| 135 |
-
SQ_Tools::saveOptions('sq_facebook_insights', $this->model->checkFavebookInsightsCode(SQ_Tools::getValue('sq_facebook_insights', '', true)));
|
| 136 |
-
SQ_Tools::saveOptions('sq_facebook_analytics', SQ_Tools::getValue('sq_facebook_analytics', ''));
|
| 137 |
-
SQ_Tools::saveOptions('sq_pinterest', $this->model->checkPinterestCode(SQ_Tools::getValue('sq_pinterest', '', true)));
|
| 138 |
-
|
| 139 |
-
///////////////////////////////////////////JSONLD
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
SQ_Tools::saveOptions('sq_auto_jsonld', (int)SQ_Tools::getValue('sq_auto_jsonld'));
|
| 143 |
-
if (SQ_Tools::getIsset('sq_jsonld_type') && isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')])) {
|
| 144 |
-
|
| 145 |
-
foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')] as $key => $value) {
|
| 146 |
-
if (isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')][$key])) {
|
| 147 |
-
SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')][$key] = SQ_Tools::getValue('sq_jsonld_' . $key);
|
| 148 |
-
}
|
| 149 |
-
}
|
| 150 |
-
if (isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')]['telephone']) &&
|
| 151 |
-
SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')]['telephone'] <> ''
|
| 152 |
-
) {
|
| 153 |
-
SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')]['telephone'] = '+' . SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')]['telephone'];
|
| 154 |
-
}
|
| 155 |
-
}
|
| 156 |
-
SQ_Tools::saveOptions('sq_jsonld_type', SQ_Tools::getValue('sq_jsonld_type'));
|
| 157 |
-
|
| 158 |
-
///////////////////////////////////////////
|
| 159 |
-
/////////////////////////////FAVICON OPTION
|
| 160 |
-
|
| 161 |
-
/* if there is an icon to upload */
|
| 162 |
-
if (!empty($_FILES['favicon'])) {
|
| 163 |
-
|
| 164 |
-
$return = $this->model->addFavicon($_FILES['favicon']);
|
| 165 |
-
if ($return['favicon'] <> '') {
|
| 166 |
-
SQ_Tools::saveOptions('favicon', strtolower(basename($return['favicon'])));
|
| 167 |
-
}
|
| 168 |
-
if ($return['message'] <> '') {
|
| 169 |
-
define('SQ_MESSAGE_FAVICON', $return['message']);
|
| 170 |
-
SQ_Error::setError(SQ_MESSAGE_FAVICON . " <br /> ");
|
| 171 |
-
}
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 175 |
-
//Update the rewrite rules with the new options
|
| 176 |
-
add_filter('rewrite_rules_array', array($this, 'rewrite_rules'), 999, 1);
|
| 177 |
-
//Flush the rewrite with the new favicon and sitemap
|
| 178 |
-
global $wp_rewrite;
|
| 179 |
-
$wp_rewrite->flush_rules();
|
| 180 |
-
|
| 181 |
-
//empty the cache on settings changed
|
| 182 |
-
SQ_Tools::emptyCache();
|
| 183 |
-
break;
|
| 184 |
-
case 'sq_checkissues':
|
| 185 |
-
if (!current_user_can('manage_options')) {
|
| 186 |
-
return;
|
| 187 |
-
}
|
| 188 |
-
|
| 189 |
-
SQ_Tools::saveOptions('sq_checkedissues', 1);
|
| 190 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 191 |
-
|
| 192 |
-
/* Load the error class */
|
| 193 |
-
SQ_Tools::checkErrorSettings();
|
| 194 |
-
|
| 195 |
-
break;
|
| 196 |
-
case 'sq_fixautoseo':
|
| 197 |
-
if (!current_user_can('manage_options')) {
|
| 198 |
-
return;
|
| 199 |
-
}
|
| 200 |
-
|
| 201 |
-
SQ_Tools::saveOptions('sq_use', 1);
|
| 202 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 203 |
-
|
| 204 |
-
break;
|
| 205 |
-
case 'sq_fixprivate':
|
| 206 |
-
if (!current_user_can('manage_options')) {
|
| 207 |
-
return;
|
| 208 |
-
}
|
| 209 |
-
|
| 210 |
-
update_option('blog_public', 1);
|
| 211 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 212 |
-
|
| 213 |
-
break;
|
| 214 |
-
case 'sq_fixcomments':
|
| 215 |
-
if (!current_user_can('manage_options')) {
|
| 216 |
-
return;
|
| 217 |
-
}
|
| 218 |
-
|
| 219 |
-
update_option('comments_notify', 1);
|
| 220 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 221 |
-
|
| 222 |
-
break;
|
| 223 |
-
case 'sq_fixpermalink':
|
| 224 |
-
if (!current_user_can('manage_options')) {
|
| 225 |
-
return;
|
| 226 |
-
}
|
| 227 |
-
|
| 228 |
-
$GLOBALS['wp_rewrite'] = new WP_Rewrite();
|
| 229 |
-
global $wp_rewrite;
|
| 230 |
-
$permalink_structure = ((get_option('permalink_structure') <> '') ? get_option('permalink_structure') : '/') . "%postname%/";
|
| 231 |
-
$wp_rewrite->set_permalink_structure($permalink_structure);
|
| 232 |
-
$permalink_structure = get_option('permalink_structure');
|
| 233 |
-
|
| 234 |
-
flush_rewrite_rules();
|
| 235 |
-
break;
|
| 236 |
-
case 'sq_fix_ogduplicate':
|
| 237 |
-
if (!current_user_can('manage_options')) {
|
| 238 |
-
return;
|
| 239 |
-
}
|
| 240 |
-
|
| 241 |
-
SQ_Tools::saveOptions('sq_auto_facebook', 0);
|
| 242 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 243 |
-
|
| 244 |
-
break;
|
| 245 |
-
case 'sq_fix_tcduplicate':
|
| 246 |
-
if (!current_user_can('manage_options')) {
|
| 247 |
-
return;
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
SQ_Tools::saveOptions('sq_auto_twitter', 0);
|
| 251 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 252 |
-
|
| 253 |
-
break;
|
| 254 |
-
case 'sq_fix_titleduplicate':
|
| 255 |
-
if (!current_user_can('manage_options')) {
|
| 256 |
-
return;
|
| 257 |
-
}
|
| 258 |
-
|
| 259 |
-
SQ_Tools::saveOptions('sq_auto_title', 0);
|
| 260 |
-
SQ_Tools::saveOptions('sq_auto_seo', 1);
|
| 261 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 262 |
-
|
| 263 |
-
break;
|
| 264 |
-
case 'sq_fix_descduplicate':
|
| 265 |
-
if (!current_user_can('manage_options')) {
|
| 266 |
-
return;
|
| 267 |
-
}
|
| 268 |
-
|
| 269 |
-
SQ_Tools::saveOptions('sq_auto_description', 0);
|
| 270 |
-
SQ_Tools::saveOptions('sq_auto_seo', 1);
|
| 271 |
-
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
| 272 |
-
|
| 273 |
-
break;
|
| 274 |
-
case 'sq_active_help' :
|
| 275 |
-
if (!current_user_can('manage_options')) {
|
| 276 |
-
return;
|
| 277 |
-
}
|
| 278 |
-
|
| 279 |
-
SQ_Tools::saveOptions('active_help', SQ_Tools::getValue('active_help'));
|
| 280 |
-
break;
|
| 281 |
-
case 'sq_warnings_off':
|
| 282 |
-
if (!current_user_can('manage_options')) {
|
| 283 |
-
return;
|
| 284 |
-
}
|
| 285 |
-
|
| 286 |
-
SQ_Tools::saveOptions('ignore_warn', 1);
|
| 287 |
-
break;
|
| 288 |
-
case 'sq_get_snippet':
|
| 289 |
-
|
| 290 |
-
if (SQ_Tools::getValue('url') <> '') {
|
| 291 |
-
$url = SQ_Tools::getValue('url');
|
| 292 |
-
} else {
|
| 293 |
-
$url = get_bloginfo('url');
|
| 294 |
-
}
|
| 295 |
-
$snippet = SQ_Tools::getSnippet($url);
|
| 296 |
-
|
| 297 |
-
SQ_Tools::setHeader('json');
|
| 298 |
-
echo json_encode($snippet);
|
| 299 |
-
exit();
|
| 300 |
-
case 'sq_backup':
|
| 301 |
-
if (!current_user_can('manage_options')) {
|
| 302 |
-
return;
|
| 303 |
-
}
|
| 304 |
-
|
| 305 |
-
SQ_Tools::setHeader('text');
|
| 306 |
-
header("Content-Disposition: attachment; filename=squirrly.txt");
|
| 307 |
-
|
| 308 |
-
if (function_exists('base64_encode')) {
|
| 309 |
-
echo base64_encode(json_encode(SQ_Tools::$options));
|
| 310 |
-
} else {
|
| 311 |
-
echo json_encode(SQ_Tools::$options);
|
| 312 |
-
}
|
| 313 |
-
exit();
|
| 314 |
-
break;
|
| 315 |
-
case 'sq_restore':
|
| 316 |
-
if (!current_user_can('manage_options')) {
|
| 317 |
-
return;
|
| 318 |
-
}
|
| 319 |
-
|
| 320 |
-
if (!empty($_FILES['sq_options']) && $_FILES['sq_options']['tmp_name'] <> '') {
|
| 321 |
-
$options = file_get_contents($_FILES['sq_options']['tmp_name']);
|
| 322 |
-
try {
|
| 323 |
-
if (function_exists('base64_encode') && base64_decode($options) <> '') {
|
| 324 |
-
$options = base64_decode($options);
|
| 325 |
-
}
|
| 326 |
-
$options = json_decode($options, true);
|
| 327 |
-
if (is_array($options) && isset($options['sq_api'])) {
|
| 328 |
-
if (SQ_Tools::$options['sq_api'] <> '') {
|
| 329 |
-
$options['sq_api'] = SQ_Tools::$options['sq_api'];
|
| 330 |
-
}
|
| 331 |
-
SQ_Tools::$options = $options;
|
| 332 |
-
SQ_Tools::saveOptions();
|
| 333 |
-
SQ_Error::setError(__('Great! The backup is restored.', _SQ_PLUGIN_NAME_) . " <br /> ", 'success');
|
| 334 |
-
} else {
|
| 335 |
-
SQ_Error::setError(__('Error! The backup is not valid.', _SQ_PLUGIN_NAME_) . " <br /> ");
|
| 336 |
-
}
|
| 337 |
-
} catch (Exception $e) {
|
| 338 |
-
SQ_Error::setError(__('Error! The backup is not valid.', _SQ_PLUGIN_NAME_) . " <br /> ");
|
| 339 |
-
}
|
| 340 |
-
} else {
|
| 341 |
-
SQ_Error::setError(__('Error! You have to enter a previous saved backup file.', _SQ_PLUGIN_NAME_) . " <br /> ");
|
| 342 |
-
}
|
| 343 |
-
break;
|
| 344 |
-
}
|
| 345 |
-
}
|
| 346 |
-
|
| 347 |
-
/**
|
| 348 |
-
* Add the favicon in the rewrite rule
|
| 349 |
-
* @param type $wp_rewrite
|
| 350 |
-
*/
|
| 351 |
-
public function rewrite_rules($wp_rewrite) {
|
| 352 |
-
$rules = array();
|
| 353 |
-
if (SQ_Tools::$options['sq_use'] == 1) {
|
| 354 |
-
|
| 355 |
-
//For Favicon
|
| 356 |
-
if (SQ_Tools::$options['sq_auto_favicon'] == 1) {
|
| 357 |
-
$rules['favicon\.ico$'] = 'index.php?sq_get=favicon';
|
| 358 |
-
$rules['favicon\.icon$'] = 'index.php?sq_get=favicon';
|
| 359 |
-
$rules['touch-icon\.png$'] = 'index.php?sq_get=touchicon';
|
| 360 |
-
foreach ($this->model->appleSizes as $size) {
|
| 361 |
-
$size = (int)$size;
|
| 362 |
-
$rules['touch-icon' . $size . '\.png$'] = 'index.php?sq_get=touchicon&sq_size=' . $size;
|
| 363 |
-
}
|
| 364 |
-
}
|
| 365 |
-
|
| 366 |
-
//For Sitemap
|
| 367 |
-
if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
|
| 368 |
-
foreach (SQ_Tools::$options['sq_sitemap'] as $name => $sitemap) {
|
| 369 |
-
if ($sitemap[1] == 1 || $sitemap[1] == 2) { // is show sitemap
|
| 370 |
-
$rules[preg_quote($sitemap[0])] = 'index.php?sq_feed=' . $name;
|
| 371 |
-
}
|
| 372 |
-
}
|
| 373 |
-
}
|
| 374 |
-
|
| 375 |
-
if (SQ_Tools::$options['sq_auto_feed'] == 1) {
|
| 376 |
-
$rules['sqfeedcss$'] = 'index.php?sq_get=feedcss';
|
| 377 |
-
}
|
| 378 |
-
}
|
| 379 |
-
return array_merge($rules, $wp_rewrite);
|
| 380 |
-
}
|
| 381 |
-
|
| 382 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/SQ_Blockresearch/SQ_Blockresearch.php
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* Core class for SQ_Blocksearch
|
| 5 |
-
*/
|
| 6 |
-
class SQ_Blockresearch extends SQ_BlockController {
|
| 7 |
-
|
| 8 |
-
public function hookHead() {
|
| 9 |
-
parent::hookHead();
|
| 10 |
-
|
| 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 |
-
|
| 17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/SQ_Blocksearch/SQ_Blocksearch.php
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* Core class for SQ_Blocksearch
|
| 5 |
-
*/
|
| 6 |
-
class SQ_Blocksearch extends SQ_BlockController {
|
| 7 |
-
|
| 8 |
-
public function action() {
|
| 9 |
-
$start = 0;
|
| 10 |
-
$nbr = 8;
|
| 11 |
-
$exclude = array();
|
| 12 |
-
|
| 13 |
-
parent::action();
|
| 14 |
-
switch (SQ_Tools::getValue('action')) {
|
| 15 |
-
case 'sq_type_click':
|
| 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'));
|
| 22 |
-
|
| 23 |
-
if (SQ_Tools::getValue('start'))
|
| 24 |
-
$start = array((int) SQ_Tools::getValue('start'));
|
| 25 |
-
|
| 26 |
-
if (SQ_Tools::getValue('nrb'))
|
| 27 |
-
$nrb = (int) SQ_Tools::getValue('nrb');
|
| 28 |
-
|
| 29 |
-
if (SQ_Tools::getValue('q') <> '')
|
| 30 |
-
echo SQ_ObjController::getController('SQ_Post')->model->searchPost(SQ_Tools::getValue('q'), $exclude, (int) $start, (int) $nrb);
|
| 31 |
-
break;
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
exit();
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
public function hookHead() {
|
| 38 |
-
parent::hookHead();
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/SQ_Blockseo/SQ_Blockseo.php
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class SQ_Blockseo extends SQ_BlockController {
|
| 4 |
-
|
| 5 |
-
public function action() {
|
| 6 |
-
|
| 7 |
-
}
|
| 8 |
-
|
| 9 |
-
public function hookHead() {
|
| 10 |
-
parent::hookHead();
|
| 11 |
-
$metas = array();
|
| 12 |
-
$metas = $this->model->getAdvSeo();
|
| 13 |
-
|
| 14 |
-
echo '<script type="text/javascript">
|
| 15 |
-
var __snippetsavechanges = "' . __('Save changes', _SQ_PLUGIN_NAME_) . '";
|
| 16 |
-
var __snippetsavecancel = "' . __('Cancel', _SQ_PLUGIN_NAME_) . '";
|
| 17 |
-
var __snippetreset = "' . __('Reset', _SQ_PLUGIN_NAME_) . '";
|
| 18 |
-
|
| 19 |
-
var __snippetcustomize = "' . __('Edit Meta / Open Graph', _SQ_PLUGIN_NAME_) . '";
|
| 20 |
-
var __snippetkeyword = "' . __('manage keywords', _SQ_PLUGIN_NAME_) . '";
|
| 21 |
-
var __snippetshort = "' . __('Too short', _SQ_PLUGIN_NAME_) . '";
|
| 22 |
-
var __snippetlong = "' . __('Too long', _SQ_PLUGIN_NAME_) . '";
|
| 23 |
-
|
| 24 |
-
var __snippetname = "' . __('Squirrly Snippet', _SQ_PLUGIN_NAME_) . '";
|
| 25 |
-
var __snippetrefresh = "' . __('Update', _SQ_PLUGIN_NAME_) . '";
|
| 26 |
-
var __sq_snippet = "' . __('snippet', _SQ_PLUGIN_NAME_) . '";
|
| 27 |
-
|
| 28 |
-
var __snippetclickrefresh = "' . __('Click the Update button (to the right) to see the snippet from your website.', _SQ_PLUGIN_NAME_) . '";
|
| 29 |
-
var __snippetentertitle = "' . __('Enter a title above for the snippet to get data.', _SQ_PLUGIN_NAME_) . '";' . "\n";
|
| 30 |
-
|
| 31 |
-
if (is_array($metas)) {
|
| 32 |
-
foreach ($metas as $key => $meta) {
|
| 33 |
-
echo 'var _' . $key . ' = "' . str_replace('"', '\"', $meta) . '";' . "\n";
|
| 34 |
-
}
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
echo '</script>';
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/SQ_Loading/SQ_Loading.php
DELETED
|
@@ -1,74 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 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">
|
| 19 |
-
jQuery("#sq_preloading").removeClass("sq_loading");
|
| 20 |
-
jQuery("#sq_preloading").addClass("sq_error")
|
| 21 |
-
jQuery("#sq_preloading").html("' . __('For Squirrly to work properly you have to use a higher version of Internet Explorer. <br /> We recommend you to use Chrome or Mozilla.', _SQ_PLUGIN_NAME_) . '");
|
| 22 |
-
jQuery("#sq_options").hide();
|
| 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_ . '";
|
| 32 |
-
var sq_uri = "' . SQ_URI . '"; var sq_language = "' . get_bloginfo('language') . '";
|
| 33 |
-
var sq_version = "' . SQ_VERSION_ID . '"; var sq_wpversion = "' . WP_VERSION_ID . '"; var sq_phpversion = "' . PHP_VERSION_ID . '"; var sq_seoversion = "' . (SQ_Tools::$options['sq_sla'] + 1) . '";
|
| 34 |
-
var __postID = "' . $sq_postID . '";
|
| 35 |
-
var __prevNonce = "' . wp_create_nonce('post_preview_' . $sq_postID) . '";
|
| 36 |
-
var __token = "' . SQ_Tools::$options['sq_api'] . '";
|
| 37 |
-
var sq_keyword_information = "' . ((isset(SQ_Tools::$options['sq_keyword_information'])) ? SQ_Tools::$options['sq_keyword_information'] : '0') . '";
|
| 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\');
|
| 63 |
-
sq_script.src = "' . _SQ_STATIC_API_URL_ . SQ_URI . '/js/squirrly.js?ver=' . SQ_VERSION_ID . '2";
|
| 64 |
-
var site_head = document.getElementsByTagName ("head")[0] || document.documentElement;
|
| 65 |
-
site_head.insertBefore(sq_script, site_head.firstChild);
|
| 66 |
-
}
|
| 67 |
-
jQuery(document).ready(function() {
|
| 68 |
-
jQuery("#sq_preloading").html("");
|
| 69 |
-
});
|
| 70 |
-
</script>';
|
| 71 |
-
}
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/config.xml
CHANGED
|
@@ -1,18 +1,26 @@
|
|
| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<blocks>
|
| 3 |
<block>
|
| 4 |
-
<name>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
<description>Post Page</description>
|
| 6 |
<actions>
|
| 7 |
-
<action>sq_save_meta</action>
|
| 8 |
<action>sq_save_ogimage</action>
|
| 9 |
<action>sq_get_keyword</action>
|
| 10 |
</actions>
|
| 11 |
<active>1</active>
|
| 12 |
-
<
|
| 13 |
</block>
|
| 14 |
<block>
|
| 15 |
-
<name>
|
| 16 |
<description>Posts List Page</description>
|
| 17 |
<actions>
|
| 18 |
<action>sq_posts_rank</action>
|
|
@@ -20,16 +28,18 @@
|
|
| 20 |
<action>sq_recheck</action>
|
| 21 |
</actions>
|
| 22 |
<active>1</active>
|
| 23 |
-
<
|
| 24 |
</block>
|
| 25 |
<block>
|
| 26 |
-
<name>
|
| 27 |
<description>SEO Setting page</description>
|
| 28 |
<actions>
|
| 29 |
<action>sq_settingsseo_update</action>
|
|
|
|
| 30 |
<action>sq_get_snippet</action>
|
| 31 |
<action>sq_checkissues</action>
|
| 32 |
|
|
|
|
| 33 |
<action>sq_active_help</action>
|
| 34 |
<action>sq_fixautoseo</action>
|
| 35 |
<action>sq_fixpermalink</action>
|
|
@@ -40,39 +50,62 @@
|
|
| 40 |
<action>sq_fix_titleduplicate</action>
|
| 41 |
<action>sq_fix_descduplicate</action>
|
| 42 |
<action>sq_backup</action>
|
|
|
|
| 43 |
<action>sq_restore</action>
|
|
|
|
|
|
|
|
|
|
| 44 |
<action>sq_warnings_off</action>
|
|
|
|
| 45 |
</actions>
|
| 46 |
<active>1</active>
|
| 47 |
-
<
|
| 48 |
</block>
|
| 49 |
<block>
|
| 50 |
-
<name>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
<description>Setting page</description>
|
| 52 |
<actions>
|
| 53 |
<action>sq_settings_update</action>
|
| 54 |
</actions>
|
| 55 |
<active>1</active>
|
| 56 |
-
<
|
| 57 |
</block>
|
| 58 |
<block>
|
| 59 |
-
<name>
|
| 60 |
<description>The support</description>
|
| 61 |
<controllers>
|
| 62 |
-
<controller>
|
| 63 |
</controllers>
|
| 64 |
<actions>
|
| 65 |
<action>sq_feedback</action>
|
| 66 |
<action>sq_support</action>
|
| 67 |
</actions>
|
| 68 |
<active>1</active>
|
| 69 |
-
<
|
| 70 |
</block>
|
| 71 |
<block>
|
| 72 |
-
<name>
|
| 73 |
<description>Connect to Squirrly</description>
|
| 74 |
<controllers>
|
| 75 |
-
<controller>
|
| 76 |
</controllers>
|
| 77 |
<actions>
|
| 78 |
<action>sq_login</action>
|
|
@@ -80,58 +113,66 @@
|
|
| 80 |
<action>sq_reset</action>
|
| 81 |
</actions>
|
| 82 |
<active>1</active>
|
| 83 |
-
<
|
| 84 |
</block>
|
| 85 |
<block>
|
| 86 |
-
<name>
|
| 87 |
<description>Inspiration box</description>
|
| 88 |
<controllers>
|
| 89 |
-
<controller>
|
| 90 |
</controllers>
|
| 91 |
<actions>
|
| 92 |
<action>sq_search_blog</action>
|
| 93 |
<action>sq_type_click</action>
|
| 94 |
</actions>
|
| 95 |
<active>1</active>
|
| 96 |
-
<
|
| 97 |
</block>
|
| 98 |
-
|
| 99 |
<block>
|
| 100 |
-
<name>
|
| 101 |
<description>SEO Live assistant</description>
|
| 102 |
<controllers>
|
| 103 |
-
<controller>
|
| 104 |
</controllers>
|
| 105 |
<active>1</active>
|
| 106 |
-
<
|
| 107 |
</block>
|
| 108 |
-
|
| 109 |
<block>
|
| 110 |
-
<name>
|
| 111 |
<description>Research block</description>
|
| 112 |
<controllers>
|
| 113 |
-
<controller>
|
| 114 |
</controllers>
|
| 115 |
<active>1</active>
|
| 116 |
-
<
|
| 117 |
</block>
|
| 118 |
-
|
| 119 |
<block>
|
| 120 |
-
<name>
|
| 121 |
<description>Affiliate Page</description>
|
| 122 |
<actions>
|
| 123 |
<action>sq_settings_affiliate</action>
|
| 124 |
</actions>
|
| 125 |
<active>1</active>
|
| 126 |
-
<
|
| 127 |
</block>
|
| 128 |
<block>
|
| 129 |
-
<name>
|
| 130 |
<description>Loading JS</description>
|
| 131 |
<controllers>
|
| 132 |
-
<controller>
|
| 133 |
</controllers>
|
| 134 |
<active>1</active>
|
| 135 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
</block>
|
| 137 |
</blocks>
|
| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<blocks>
|
| 3 |
<block>
|
| 4 |
+
<name>SQ_Controllers_Menu</name>
|
| 5 |
+
<description>Loading the Menu in Admin and Frontend</description>
|
| 6 |
+
<actions>
|
| 7 |
+
<action>sq_getfrontmenu</action>
|
| 8 |
+
</actions>
|
| 9 |
+
<active>1</active>
|
| 10 |
+
<admin>1</admin>
|
| 11 |
+
</block>
|
| 12 |
+
<block>
|
| 13 |
+
<name>SQ_Controllers_Post</name>
|
| 14 |
<description>Post Page</description>
|
| 15 |
<actions>
|
|
|
|
| 16 |
<action>sq_save_ogimage</action>
|
| 17 |
<action>sq_get_keyword</action>
|
| 18 |
</actions>
|
| 19 |
<active>1</active>
|
| 20 |
+
<admin>1</admin>
|
| 21 |
</block>
|
| 22 |
<block>
|
| 23 |
+
<name>SQ_Controllers_PostsList</name>
|
| 24 |
<description>Posts List Page</description>
|
| 25 |
<actions>
|
| 26 |
<action>sq_posts_rank</action>
|
| 28 |
<action>sq_recheck</action>
|
| 29 |
</actions>
|
| 30 |
<active>1</active>
|
| 31 |
+
<admin>1</admin>
|
| 32 |
</block>
|
| 33 |
<block>
|
| 34 |
+
<name>SQ_Core_BlockSettingsSeo</name>
|
| 35 |
<description>SEO Setting page</description>
|
| 36 |
<actions>
|
| 37 |
<action>sq_settingsseo_update</action>
|
| 38 |
+
<action>sq_settingsseo_option</action>
|
| 39 |
<action>sq_get_snippet</action>
|
| 40 |
<action>sq_checkissues</action>
|
| 41 |
|
| 42 |
+
<action>sq_setstickysla</action>
|
| 43 |
<action>sq_active_help</action>
|
| 44 |
<action>sq_fixautoseo</action>
|
| 45 |
<action>sq_fixpermalink</action>
|
| 50 |
<action>sq_fix_titleduplicate</action>
|
| 51 |
<action>sq_fix_descduplicate</action>
|
| 52 |
<action>sq_backup</action>
|
| 53 |
+
<action>sq_backup_sql</action>
|
| 54 |
<action>sq_restore</action>
|
| 55 |
+
<action>sq_restore_sql</action>
|
| 56 |
+
<action>sq_dataupgrade</action>
|
| 57 |
+
<action>sq_resetsettings</action>
|
| 58 |
<action>sq_warnings_off</action>
|
| 59 |
+
<action>sq_copyright_agreement</action>
|
| 60 |
</actions>
|
| 61 |
<active>1</active>
|
| 62 |
+
<admin>1</admin>
|
| 63 |
</block>
|
| 64 |
<block>
|
| 65 |
+
<name>SQ_Controllers_FrontMenu</name>
|
| 66 |
+
<description>Front Menu page</description>
|
| 67 |
+
<actions>
|
| 68 |
+
<action>sq_saveseo</action>
|
| 69 |
+
</actions>
|
| 70 |
+
<active>1</active>
|
| 71 |
+
<admin>1</admin>
|
| 72 |
+
</block>
|
| 73 |
+
<block>
|
| 74 |
+
<name>SQ_Core_BlockPatterns</name>
|
| 75 |
+
<description>Setting page</description>
|
| 76 |
+
<actions>
|
| 77 |
+
<action>sq_savepatters</action>
|
| 78 |
+
</actions>
|
| 79 |
+
<active>1</active>
|
| 80 |
+
<admin>1</admin>
|
| 81 |
+
</block>
|
| 82 |
+
<block>
|
| 83 |
+
<name>SQ_Core_BlockSettings</name>
|
| 84 |
<description>Setting page</description>
|
| 85 |
<actions>
|
| 86 |
<action>sq_settings_update</action>
|
| 87 |
</actions>
|
| 88 |
<active>1</active>
|
| 89 |
+
<admin>1</admin>
|
| 90 |
</block>
|
| 91 |
<block>
|
| 92 |
+
<name>SQ_Core_BlockSupport</name>
|
| 93 |
<description>The support</description>
|
| 94 |
<controllers>
|
| 95 |
+
<controller>SQ_Controllers_Post</controller>
|
| 96 |
</controllers>
|
| 97 |
<actions>
|
| 98 |
<action>sq_feedback</action>
|
| 99 |
<action>sq_support</action>
|
| 100 |
</actions>
|
| 101 |
<active>1</active>
|
| 102 |
+
<admin>1</admin>
|
| 103 |
</block>
|
| 104 |
<block>
|
| 105 |
+
<name>SQ_Core_Blocklogin</name>
|
| 106 |
<description>Connect to Squirrly</description>
|
| 107 |
<controllers>
|
| 108 |
+
<controller>SQ_Controllers_Post</controller>
|
| 109 |
</controllers>
|
| 110 |
<actions>
|
| 111 |
<action>sq_login</action>
|
| 113 |
<action>sq_reset</action>
|
| 114 |
</actions>
|
| 115 |
<active>1</active>
|
| 116 |
+
<admin>1</admin>
|
| 117 |
</block>
|
| 118 |
<block>
|
| 119 |
+
<name>SQ_Core_Blocksearch</name>
|
| 120 |
<description>Inspiration box</description>
|
| 121 |
<controllers>
|
| 122 |
+
<controller>SQ_Controllers_Post</controller>
|
| 123 |
</controllers>
|
| 124 |
<actions>
|
| 125 |
<action>sq_search_blog</action>
|
| 126 |
<action>sq_type_click</action>
|
| 127 |
</actions>
|
| 128 |
<active>1</active>
|
| 129 |
+
<admin>1</admin>
|
| 130 |
</block>
|
|
|
|
| 131 |
<block>
|
| 132 |
+
<name>SQ_Core_Blockseo</name>
|
| 133 |
<description>SEO Live assistant</description>
|
| 134 |
<controllers>
|
| 135 |
+
<controller>SQ_Controllers_Post</controller>
|
| 136 |
</controllers>
|
| 137 |
<active>1</active>
|
| 138 |
+
<admin>1</admin>
|
| 139 |
</block>
|
|
|
|
| 140 |
<block>
|
| 141 |
+
<name>SQ_Core_Blockresearch</name>
|
| 142 |
<description>Research block</description>
|
| 143 |
<controllers>
|
| 144 |
+
<controller>SQ_Controllers_Post</controller>
|
| 145 |
</controllers>
|
| 146 |
<active>1</active>
|
| 147 |
+
<admin>1</admin>
|
| 148 |
</block>
|
|
|
|
| 149 |
<block>
|
| 150 |
+
<name>SQ_Core_BlockAffiliate</name>
|
| 151 |
<description>Affiliate Page</description>
|
| 152 |
<actions>
|
| 153 |
<action>sq_settings_affiliate</action>
|
| 154 |
</actions>
|
| 155 |
<active>1</active>
|
| 156 |
+
<admin>1</admin>
|
| 157 |
</block>
|
| 158 |
<block>
|
| 159 |
+
<name>SQ_Core_Loading</name>
|
| 160 |
<description>Loading JS</description>
|
| 161 |
<controllers>
|
| 162 |
+
<controller>SQ_Controllers_Post</controller>
|
| 163 |
</controllers>
|
| 164 |
<active>1</active>
|
| 165 |
+
<admin>1</admin>
|
| 166 |
+
</block>
|
| 167 |
+
|
| 168 |
+
<block>
|
| 169 |
+
<name>SQ_Core_BlockImport</name>
|
| 170 |
+
<description>Import from other plugins</description>
|
| 171 |
+
<actions>
|
| 172 |
+
<action>sq_importseo</action>
|
| 173 |
+
<action>sq_importsettings</action>
|
| 174 |
+
</actions>
|
| 175 |
+
<active>1</active>
|
| 176 |
+
<admin>1</admin>
|
| 177 |
</block>
|
| 178 |
</blocks>
|
languages/squirrly-seo-de_DE.mo
CHANGED
|
Binary file
|
languages/squirrly-seo-de_DE.po
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
msgid ""
|
| 2 |
msgstr ""
|
| 3 |
-
"Project-Id-Version: Squirrly SEO Plugin
|
| 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"
|
|
@@ -11,16 +11,16 @@ msgstr ""
|
|
| 11 |
"Content-Type: text/plain; charset=UTF-8\n"
|
| 12 |
"Content-Transfer-Encoding: 8bit\n"
|
| 13 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
| 14 |
-
"X-Poedit-SourceCharset:
|
| 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: ..\n"
|
| 18 |
"X-Textdomain-Support: yes\n"
|
| 19 |
-
"X-Generator: Poedit 1.8.
|
| 20 |
"X-Poedit-SearchPath-0: .\n"
|
| 21 |
|
| 22 |
# @ squirrly-seo
|
| 23 |
-
#: classes/
|
| 24 |
msgid ""
|
| 25 |
"Function get_class does not exists! Is required for Squirrly to work "
|
| 26 |
"properly."
|
|
@@ -29,7 +29,7 @@ msgstr ""
|
|
| 29 |
"richtig zu arbeiten."
|
| 30 |
|
| 31 |
# @ squirrly-seo
|
| 32 |
-
#: classes/
|
| 33 |
msgid ""
|
| 34 |
"Function file_exists does not exists! Is required for Squirrly to work "
|
| 35 |
"properly."
|
|
@@ -38,250 +38,499 @@ msgstr ""
|
|
| 38 |
"richtig zu arbeiten."
|
| 39 |
|
| 40 |
# @ squirrly-seo
|
| 41 |
-
#: classes/
|
| 42 |
msgid "The home directory is not set!"
|
| 43 |
msgstr "Das Home-Verzeichnis wurde nicht gesetzt!"
|
| 44 |
|
| 45 |
# @ squirrly-seo
|
| 46 |
-
#: classes/
|
| 47 |
msgid "The PHP version has to be greater then 4.0"
|
| 48 |
msgstr "Die PHP-Version muß größer als 4.0 sein"
|
| 49 |
|
| 50 |
# @ squirrly-seo
|
| 51 |
-
#: classes/
|
| 52 |
msgid "Turn off warnings!"
|
| 53 |
msgstr "Warnungen ausschalten!"
|
| 54 |
|
| 55 |
-
#: classes/
|
| 56 |
msgid "Don't bother me!"
|
| 57 |
msgstr ""
|
| 58 |
|
| 59 |
-
#: classes/
|
| 60 |
msgid "Getting started"
|
| 61 |
msgstr ""
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
# @ squirrly-seo
|
| 64 |
-
#: classes/
|
| 65 |
msgid "Fix it for me!"
|
| 66 |
msgstr "Beheben Sie es für mich!"
|
| 67 |
|
| 68 |
-
#: classes/
|
| 69 |
msgid "Activate the Squirrly SEO for your blog (recommended)"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
-
#: classes/
|
| 73 |
msgid ""
|
| 74 |
"You have META Title Duplicates. Disable the Squirrly Title Optimization or "
|
| 75 |
"disable the other SEO Plugins"
|
| 76 |
msgstr ""
|
| 77 |
|
| 78 |
-
#: classes/
|
| 79 |
msgid ""
|
| 80 |
"You have META Description Duplicates. Disable the Squirrly Description "
|
| 81 |
"Optimization or disable the other SEO Plugins"
|
| 82 |
msgstr ""
|
| 83 |
|
| 84 |
-
#: classes/
|
| 85 |
msgid ""
|
| 86 |
"You have Open Graph META Duplicates. Disable the Squirrly SEO Open Graph or "
|
| 87 |
"disable the other SEO Plugins"
|
| 88 |
msgstr ""
|
| 89 |
|
| 90 |
-
#: classes/
|
| 91 |
msgid ""
|
| 92 |
"You have Twitter Card META Duplicates. Disable the Squirrly SEO Twitter Card "
|
| 93 |
"or disable the other SEO Plugins"
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
# @ squirrly-seo
|
| 97 |
-
#: classes/
|
| 98 |
msgid "You're blocking google from indexing your site!"
|
| 99 |
msgstr "Sie blockieren Google zum Indizieren Ihrer Website!"
|
| 100 |
|
| 101 |
-
#: classes/
|
| 102 |
msgid ""
|
| 103 |
"It is highly recommended that you include the %postname% variable in the "
|
| 104 |
"permalink structure. <br />Go to Settings > Permalinks and add /%postname%/ "
|
| 105 |
"in Custom Structure"
|
| 106 |
msgstr ""
|
| 107 |
|
| 108 |
-
#: classes/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
msgid "Great! We didn't find any issue in your site."
|
| 110 |
msgstr ""
|
| 111 |
|
| 112 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
msgid "See Your Rank on Google"
|
| 114 |
msgstr ""
|
| 115 |
|
| 116 |
-
#: controllers/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
msgid ""
|
| 118 |
"Check out the Squirrly Analytics section. <a href=\"admin.php?page=sq_posts"
|
| 119 |
"\" title=\"Squirrly Analytics\">Click here</a>"
|
| 120 |
msgstr ""
|
| 121 |
|
| 122 |
-
#: controllers/
|
| 123 |
-
msgid "
|
| 124 |
msgstr ""
|
| 125 |
|
| 126 |
-
#: controllers/
|
| 127 |
msgid "First Step"
|
| 128 |
msgstr ""
|
| 129 |
|
| 130 |
-
#: controllers/
|
| 131 |
msgid "Dashboard"
|
| 132 |
msgstr ""
|
| 133 |
|
| 134 |
-
#: controllers/
|
| 135 |
-
msgid "
|
| 136 |
msgstr ""
|
| 137 |
|
| 138 |
-
#: controllers/
|
| 139 |
msgid "Performance <br />Analytics"
|
| 140 |
msgstr ""
|
| 141 |
|
| 142 |
-
#: controllers/
|
| 143 |
-
msgid "
|
| 144 |
msgstr ""
|
| 145 |
|
| 146 |
-
#: controllers/
|
| 147 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
msgstr ""
|
| 149 |
|
| 150 |
-
#: controllers/
|
| 151 |
-
msgid "
|
| 152 |
msgstr ""
|
| 153 |
|
| 154 |
-
#: controllers/
|
| 155 |
-
msgid "
|
| 156 |
msgstr ""
|
| 157 |
|
| 158 |
-
#: controllers/
|
| 159 |
-
msgid "
|
| 160 |
msgstr ""
|
| 161 |
|
| 162 |
-
#: controllers/
|
| 163 |
msgid "Account Info"
|
| 164 |
msgstr ""
|
| 165 |
|
| 166 |
-
#: controllers/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
msgid "Become an Affiliate with "
|
| 168 |
msgstr ""
|
| 169 |
|
| 170 |
-
#: controllers/
|
| 171 |
-
msgid "Affiliate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
msgstr ""
|
| 173 |
|
| 174 |
-
#: controllers/
|
| 175 |
msgid "Squirrly"
|
| 176 |
msgstr ""
|
| 177 |
|
| 178 |
-
#: controllers/
|
| 179 |
msgid "Custom description: "
|
| 180 |
msgstr ""
|
| 181 |
|
| 182 |
-
#: controllers/
|
| 183 |
msgid "Custom title: "
|
| 184 |
msgstr ""
|
| 185 |
|
| 186 |
-
#: controllers/
|
| 187 |
msgid "SEO Analytics, by Squirrly"
|
| 188 |
msgstr ""
|
| 189 |
|
| 190 |
-
#: controllers/
|
| 191 |
msgid "Update"
|
| 192 |
msgstr ""
|
| 193 |
|
| 194 |
-
#: controllers/
|
| 195 |
msgid "Not Public"
|
| 196 |
msgstr ""
|
| 197 |
|
| 198 |
-
#: controllers/
|
| 199 |
msgid "Could not process"
|
| 200 |
msgstr ""
|
| 201 |
|
| 202 |
-
#: controllers/
|
| 203 |
-
|
| 204 |
-
msgid "
|
| 205 |
-
msgstr ""
|
| 206 |
-
|
| 207 |
-
#: controllers/SQ_PostsList.php:321 models/SQ_BlockPostsAnalytics.php:401
|
| 208 |
-
msgid "> 100"
|
| 209 |
msgstr ""
|
| 210 |
|
| 211 |
-
#: controllers/
|
| 212 |
-
msgid "URL Indexed"
|
| 213 |
msgstr ""
|
| 214 |
|
| 215 |
-
#: controllers/
|
|
|
|
| 216 |
#, php-format
|
| 217 |
msgid "%s"
|
| 218 |
msgstr ""
|
| 219 |
|
| 220 |
-
#: core/
|
| 221 |
#, php-format
|
| 222 |
msgid "Error: %s"
|
| 223 |
msgstr ""
|
| 224 |
|
| 225 |
-
#: core/
|
| 226 |
msgid "An error occured. Mabe a network error :("
|
| 227 |
msgstr ""
|
| 228 |
|
| 229 |
-
#: core/
|
| 230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
msgid "Too short"
|
| 232 |
msgstr ""
|
| 233 |
|
| 234 |
-
#: core/
|
| 235 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:22
|
| 236 |
msgid "Too long"
|
| 237 |
msgstr ""
|
| 238 |
|
| 239 |
-
#: core/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
msgid "Great! The backup is restored."
|
| 241 |
msgstr ""
|
| 242 |
|
| 243 |
-
#: core/
|
| 244 |
-
#: core/
|
| 245 |
msgid "Error! The backup is not valid."
|
| 246 |
msgstr ""
|
| 247 |
|
| 248 |
-
#: core/
|
| 249 |
msgid "Error! You have to enter a previous saved backup file."
|
| 250 |
msgstr ""
|
| 251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
# @ squirrly-seo
|
| 253 |
-
#: core/
|
| 254 |
msgid "Plugin Feedback"
|
| 255 |
msgstr "Plugin Feedback"
|
| 256 |
|
| 257 |
# @ squirrly-seo
|
| 258 |
-
#: core/
|
| 259 |
msgid "Thank you for your feedback"
|
| 260 |
msgstr "Vielen Dank für Ihre Feedback"
|
| 261 |
|
| 262 |
# @ squirrly-seo
|
| 263 |
-
#: core/
|
| 264 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:99
|
| 265 |
msgid "Could not send the email..."
|
| 266 |
msgstr "Konnte E-Mail nicht senden ..."
|
| 267 |
|
| 268 |
# @ squirrly-seo
|
| 269 |
-
#: core/
|
| 270 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:103
|
| 271 |
msgid "No message."
|
| 272 |
msgstr "Keine Nachricht."
|
| 273 |
|
| 274 |
# @ squirrly-seo
|
| 275 |
-
#: core/
|
| 276 |
msgid "Plugin Support"
|
| 277 |
msgstr "Plugin Support"
|
| 278 |
|
| 279 |
-
#: core/
|
| 280 |
msgid "Message sent. Thank you!"
|
| 281 |
msgstr ""
|
| 282 |
|
| 283 |
# @ squirrly-seo
|
| 284 |
-
#: core/
|
| 285 |
#, php-format
|
| 286 |
msgid ""
|
| 287 |
"We found your email, so it means you already have a Squirrly.co account. "
|
|
@@ -292,7 +541,7 @@ msgstr ""
|
|
| 292 |
"Sie sich mit Ihrer Squirrly-ID ein. Falls Sie Ihr Passwort vergessen haben, "
|
| 293 |
"klicken Sie %shier%s"
|
| 294 |
|
| 295 |
-
#: core/
|
| 296 |
msgid ""
|
| 297 |
"Error: Couldn't connect to host :( . Please contact your site's webhost (or "
|
| 298 |
"webmaster) and request them to add http://api.squirrly.co/ to their IP "
|
|
@@ -300,7 +549,7 @@ msgid ""
|
|
| 300 |
msgstr ""
|
| 301 |
|
| 302 |
# @ squirrly-seo
|
| 303 |
-
#: core/
|
| 304 |
#, php-format
|
| 305 |
msgid ""
|
| 306 |
"Could not send your informations to squirrly. Please register %smanually%s."
|
|
@@ -309,348 +558,401 @@ msgstr ""
|
|
| 309 |
"%smanually%s."
|
| 310 |
|
| 311 |
# @ squirrly-seo
|
| 312 |
-
#: core/
|
| 313 |
msgid "Wrong email or password!"
|
| 314 |
msgstr "Benutzername oder Passwort falsch!"
|
| 315 |
|
| 316 |
# @ squirrly-seo
|
| 317 |
-
#: core/
|
| 318 |
msgid "You can use this account only for the URL you registered first!"
|
| 319 |
msgstr ""
|
| 320 |
"Dieses Konto können Sie nur für die URL benutzen, die Sie zuerst registriert "
|
| 321 |
"haben!"
|
| 322 |
|
| 323 |
# @ squirrly-seo
|
| 324 |
-
#: core/
|
| 325 |
msgid "An error occured."
|
| 326 |
msgstr "Ein Fehler ist aufgetreten."
|
| 327 |
|
| 328 |
# @ squirrly-seo
|
| 329 |
-
#: core/
|
| 330 |
msgid "Both fields are required."
|
| 331 |
msgstr "Beide Felder sind Pflichtfelder."
|
| 332 |
|
| 333 |
-
#: core/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
msgid "Recent discussions:"
|
| 335 |
msgstr "Bisherige Diskussionen:"
|
| 336 |
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
msgstr "Exakte Suche:"
|
| 341 |
|
| 342 |
# @ squirrly-seo
|
| 343 |
-
#: core/
|
| 344 |
msgid "Competition:"
|
| 345 |
msgstr "Wettbewerb:"
|
| 346 |
|
| 347 |
# @ squirrly-seo
|
| 348 |
-
#: core/
|
| 349 |
msgid "Trend:"
|
| 350 |
msgstr "Trend:"
|
| 351 |
|
| 352 |
# @ squirrly-seo
|
| 353 |
-
#: core/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
msgid "date"
|
| 355 |
msgstr "Datum"
|
| 356 |
|
| 357 |
# @ squirrly-seo
|
| 358 |
-
#: core/
|
| 359 |
msgid "Read it!"
|
| 360 |
msgstr "Lesen!"
|
| 361 |
|
| 362 |
# @ squirrly-seo
|
| 363 |
-
#: core/
|
| 364 |
msgid "Insert it!"
|
| 365 |
msgstr "Einfügen!"
|
| 366 |
|
| 367 |
# @ squirrly-seo
|
| 368 |
-
#: core/
|
| 369 |
msgid "Reference"
|
| 370 |
msgstr "Referenz"
|
| 371 |
|
| 372 |
# @ squirrly-seo
|
| 373 |
-
#: core/
|
| 374 |
msgid "Insert as box"
|
| 375 |
msgstr "Als Box einfügen"
|
| 376 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
# @ squirrly-seo
|
| 378 |
-
#: core/
|
| 379 |
msgid "Not relevant?"
|
| 380 |
msgstr "Nicht relevant?"
|
| 381 |
|
| 382 |
# @ squirrly-seo
|
| 383 |
-
#: core/
|
| 384 |
msgid "Insert in your article"
|
| 385 |
msgstr "In Artikel einfügen"
|
| 386 |
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
msgstr "Damit Squirrly arbeitet, muss tinymce installiert sein!"
|
| 391 |
-
|
| 392 |
-
# @ squirrly-seo
|
| 393 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:50
|
| 394 |
-
msgid ":( I lost my squirrel. Please reload the page."
|
| 395 |
-
msgstr ":( Ich verlor meine Eichhörnchen. Laden Sie die Seite erneut."
|
| 396 |
|
| 397 |
# @ squirrly-seo
|
| 398 |
-
#: core/
|
| 399 |
msgid "No results found!"
|
| 400 |
msgstr "Keine Ergebnisse gefunden!"
|
| 401 |
|
| 402 |
-
|
| 403 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:50
|
| 404 |
-
msgid "Switch to Visual editor!"
|
| 405 |
-
msgstr "Zum Visual Editor wechseln !"
|
| 406 |
-
|
| 407 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:50
|
| 408 |
msgid "Enter one more word to find relevant results"
|
| 409 |
msgstr ""
|
| 410 |
|
| 411 |
# @ squirrly-seo
|
| 412 |
-
#: core/
|
| 413 |
msgid "Takes too long to check this keyword ..."
|
| 414 |
msgstr "Dauert zu lange, um dieses Schlüsselwort zu überprüfen ..."
|
| 415 |
|
| 416 |
# @ squirrly-seo
|
| 417 |
-
#: core/
|
| 418 |
msgid "Do a research!"
|
| 419 |
msgstr "Erweiterte Suche!"
|
| 420 |
|
| 421 |
# @ squirrly-seo
|
| 422 |
-
#: core/
|
| 423 |
msgid "Do more research!"
|
| 424 |
msgstr "Erweiterte Suche!"
|
| 425 |
|
| 426 |
-
#: core/
|
| 427 |
#, php-format
|
| 428 |
msgid "[ ATTRIBUTE: Please check: %s to find out how to attribute this image ]"
|
| 429 |
msgstr ""
|
| 430 |
|
| 431 |
-
#: core/
|
| 432 |
msgid "Has creative commons attributes"
|
| 433 |
msgstr ""
|
| 434 |
|
| 435 |
-
#: core/
|
| 436 |
msgid "No known copyright restrictions"
|
| 437 |
msgstr ""
|
| 438 |
|
| 439 |
-
#: core/
|
| 440 |
-
msgid "
|
|
|
|
|
|
|
| 441 |
msgstr ""
|
|
|
|
|
|
|
| 442 |
|
| 443 |
-
#: core/
|
| 444 |
-
msgid "
|
| 445 |
msgstr ""
|
| 446 |
|
| 447 |
-
#: core/
|
| 448 |
-
msgid "
|
| 449 |
msgstr ""
|
| 450 |
|
| 451 |
-
#: core/
|
| 452 |
-
msgid "
|
| 453 |
msgstr ""
|
| 454 |
|
| 455 |
-
#: core/
|
| 456 |
-
msgid "
|
| 457 |
msgstr ""
|
| 458 |
|
| 459 |
-
#: core/
|
| 460 |
-
|
| 461 |
-
msgid "
|
| 462 |
msgstr ""
|
| 463 |
|
| 464 |
-
#: core/
|
| 465 |
-
|
|
|
|
| 466 |
msgstr ""
|
| 467 |
|
| 468 |
-
#: core/
|
| 469 |
-
|
| 470 |
-
"
|
| 471 |
msgstr ""
|
| 472 |
|
| 473 |
-
#: core/
|
| 474 |
-
|
|
|
|
| 475 |
msgstr ""
|
| 476 |
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
msgid ""
|
| 480 |
-
"For Squirrly to work properly you have to use a higher version of Internet "
|
| 481 |
-
"Explorer. <br /> We recommend you to use Chrome or Mozilla."
|
| 482 |
msgstr ""
|
| 483 |
-
"Damit Squirrly ordnungsgemäß funktioniert, müssen Sie eine höhere Version "
|
| 484 |
-
"von Internet Explorer verwenden. <br /> Wir empfehlen, Chrome oder Mozilla."
|
| 485 |
|
| 486 |
-
#: core/
|
| 487 |
-
msgid ""
|
| 488 |
-
|
| 489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 490 |
msgstr ""
|
| 491 |
-
"You haven`t used Squirrly SEO to optimize your article. Do you want to "
|
| 492 |
-
"optimize for a keyword before publishing?"
|
| 493 |
|
| 494 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 495 |
msgctxt "column name"
|
| 496 |
msgid "Title"
|
| 497 |
msgstr ""
|
| 498 |
|
| 499 |
-
#: models/
|
| 500 |
msgid "Type"
|
| 501 |
msgstr ""
|
| 502 |
|
| 503 |
-
#: models/
|
| 504 |
msgid "Author"
|
| 505 |
msgstr ""
|
| 506 |
|
| 507 |
-
#: models/
|
| 508 |
msgid "Keywords"
|
| 509 |
msgstr ""
|
| 510 |
|
| 511 |
-
#: models/
|
| 512 |
#, php-format
|
| 513 |
msgid "Google.%s Position"
|
| 514 |
msgstr ""
|
| 515 |
|
| 516 |
-
#: models/
|
| 517 |
msgid "Date"
|
| 518 |
msgstr ""
|
| 519 |
|
| 520 |
-
#: models/
|
| 521 |
msgid "Reset Filters"
|
| 522 |
msgstr ""
|
| 523 |
|
| 524 |
-
#: models/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 525 |
#, php-format
|
| 526 |
msgid "Edit “%s”"
|
| 527 |
msgstr ""
|
| 528 |
|
| 529 |
-
#: models/
|
| 530 |
msgid "Edit this item"
|
| 531 |
msgstr ""
|
| 532 |
|
| 533 |
-
#: models/
|
| 534 |
msgid "Edit"
|
| 535 |
msgstr ""
|
| 536 |
|
| 537 |
-
#: models/
|
| 538 |
#, php-format
|
| 539 |
msgid "Preview “%s”"
|
| 540 |
msgstr ""
|
| 541 |
|
| 542 |
-
#: models/
|
| 543 |
msgid "Preview"
|
| 544 |
msgstr ""
|
| 545 |
|
| 546 |
-
#: models/
|
| 547 |
#, php-format
|
| 548 |
|
