Version Description
- Changed Squirrly look
- Compatible with WP eCommerce plugin
- Made SEO improvements for Woocommerce plugin
- Interactive learning for the entire Squirrly SEO plugin
- Faster post save for long text and remote images
- Settings and SEO check improved
- Added robots.txt for multisites with security
- Added sitemap for multisites
- Added sitemap for images and videos for each article
- Added the Json LD in Structured Data META
- Added the social linked Data for Json LD and publisher
- Added the favicon.ico for multisites
- Added the icos for apple devices
- Added the SEO progress in post editor
- Added the SEO Star option in Dashboard
- Fixed bugs for multisites and made it compatible with WP 4.2
- Fixed the snippet title and description special chars
- Fixed the custom fields variable in post editor
- Fixed the site icon and added the site icon for multisites
- Fixed Sitemap for default permalink option
Download this release
Release Info
Developer | cifi |
Plugin | ![]() |
Version | 5.0.0 |
Comparing to | |
See all releases |
Code changes from version 3.4.4 to 5.0.0
- classes/SQ_Action.php +2 -4
- classes/SQ_BlockController.php +12 -0
- classes/SQ_Error.php +14 -7
- classes/SQ_FrontController.php +0 -3
- classes/SQ_HookController.php +0 -7
- classes/SQ_Ranking.php +2 -2
- classes/SQ_Sitemap.php +0 -382
- classes/SQ_Tools.php +246 -118
- config/config.php +3 -1
- controllers/SQ_Frontend.php +80 -11
- controllers/SQ_Menu.php +106 -261
- controllers/SQ_Post.php +36 -22
- controllers/SQ_PostsList.php +6 -2
- controllers/SQ_Sitemaps.php +417 -0
- core/SQ_BlockAccount/SQ_BlockAccount.php +2 -8
- core/SQ_BlockAffiliate/SQ_BlockAffiliate.php +4 -4
- core/SQ_BlockAudit/SQ_BlockAudit.php +0 -9
- core/SQ_BlockDashboard/SQ_BlockDashboard.php +4 -0
- core/SQ_BlockPostsAnalytics/SQ_BlockPostsAnalytics.php +1 -0
- core/SQ_BlockSettings/SQ_BlockSettings.php +63 -0
- core/SQ_BlockSettingsSeo/SQ_BlockSettingsSeo.php +267 -0
- core/SQ_BlockStatus/SQ_BlockStatus.php +0 -11
- core/SQ_Blockseo/SQ_Blockseo.php +3 -2
- core/config.xml +10 -9
- languages/squirrly-seo-ru_RU.mo +0 -0
- languages/squirrly-seo-ru_RU.po +0 -1193
- models/SQ_BlockSettingsSeo.php +348 -0
- models/SQ_BlockStatus.php +0 -158
- models/SQ_Blockseo.php +3 -3
- models/SQ_Frontend.php +525 -450
- models/SQ_Ico.php +20 -8
- models/SQ_Menu.php +0 -245
- models/SQ_Post.php +5 -5
- models/SQ_Sitemaps.php +443 -0
- readme.txt +28 -5
- squirrly.php +3 -5
- themes/default/SQ_BlocStatus.php +0 -1
- themes/default/SQ_BlockAccount.php +23 -30
- themes/default/SQ_BlockAffiliate.php +88 -90
- themes/default/SQ_BlockAnalytics.php +17 -10
- themes/default/SQ_BlockAudit.php +0 -9
- themes/default/SQ_BlockDashboard.php +87 -47
- themes/default/SQ_BlockHelp.php +0 -36
- themes/default/SQ_BlockSettings.php +290 -0
- themes/default/SQ_BlockSettingsSeo.php +501 -0
- themes/default/SQ_Blocklogin.php +2 -4
- themes/default/SQ_Blocksearch.php +1 -1
- themes/default/SQ_Menu.php +0 -536
- themes/default/SQ_notices.php +14 -1
- themes/default/css/sq_blockaccount.css +26 -0
- themes/default/css/sq_blockaudit.css +0 -1
- themes/default/css/sq_blockdashboard.css +117 -0
- themes/default/css/sq_blockresearch.css +443 -1
- themes/default/css/sq_blocksearch.css +1004 -1
- themes/default/css/sq_blockseo.css +500 -1
- themes/default/css/sq_blocksettings.css +37 -0
- themes/default/css/sq_blocksettingsseo.css +175 -0
- themes/default/css/sq_frontend.css +126 -1
- themes/default/css/sq_global.css +414 -1
- themes/default/css/sq_menu.css +890 -1
- themes/default/css/sq_post.css +398 -1
- themes/default/css/sq_postslist.css +622 -1
- themes/default/css/sq_sitemap.xsl +97 -0
- themes/default/css/sq_sitemapindex.xsl +61 -0
- themes/default/img/avatar-margin.png +0 -0
- themes/default/img/banners/banner1.jpg +0 -0
- themes/default/img/banners/banner2.jpg +0 -0
- themes/default/img/banners/banner3.png +0 -0
- themes/default/img/complete.png +0 -0
- themes/default/img/dashboard_analytics.png +0 -0
- themes/default/img/dashboard_assistant.png +0 -0
- themes/default/img/dashboard_audit.png +0 -0
- themes/default/img/dashboard_research.png +0 -0
- themes/default/img/editor/complete.png +0 -0
- themes/default/img/editor/heading.png +0 -0
- themes/default/img/{sq_searching.gif → editor/sq_searching.gif} +0 -0
- themes/default/img/front/avatar-margin.png +0 -0
- themes/default/img/header_back.png +0 -0
- themes/default/img/header_stars.png +0 -0
- themes/default/img/heading.png +0 -0
- themes/default/img/loading.gif +0 -0
- themes/default/img/menu_icon_16.png +0 -0
- themes/default/img/minloading.gif +0 -0
- themes/default/img/minloading.png +0 -0
- themes/default/img/settings/facebook.png +0 -0
- themes/default/img/settings/facebook_tmb.png +0 -0
- themes/default/img/settings/googlejsonld.png +0 -0
- themes/default/img/settings/googlejsonld_tmb.png +0 -0
- themes/default/img/settings/header_stars.png +0 -0
- themes/default/img/{settings_login.jpg → settings/login.jpg} +0 -0
- themes/default/img/{settings_login_done.jpg → settings/login_done.jpg} +0 -0
- themes/default/img/settings/menu_icon_16.png +0 -0
- themes/default/img/settings/squirrly.png +0 -0
- themes/default/img/settings/twitter.png +0 -0
- themes/default/img/settings/twitter_tmb.png +0 -0
- themes/default/img/settings_edit.png +0 -0
- themes/default/img/settings_howto.jpg +0 -0
- themes/default/img/sprite.png +0 -0
- themes/default/img/status/backgroundv2.jpg +0 -0
- themes/default/img/status/squirrly_cheers.png +0 -0
- themes/default/js/sq_blockaudit.js +0 -3
- themes/default/js/sq_blockdashboard.js +26 -0
- themes/default/js/sq_blocklogin.js +230 -23
- themes/default/js/sq_blocksettings.js +58 -0
- themes/default/js/sq_blocksettingsseo.js +302 -0
- themes/default/js/sq_blocksupport.js +240 -15
- themes/default/js/sq_menu.js +344 -37
- themes/default/js/tinymce.js +20 -1
- uninstall.php +0 -1
classes/SQ_Action.php
CHANGED
@@ -35,7 +35,6 @@ class SQ_Action extends SQ_FrontController {
|
|
35 |
if (isset($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], '/admin-ajax.php') !== false) {
|
36 |
return;
|
37 |
}
|
38 |
-
|
39 |
$this->actions = array();
|
40 |
$this->getActions(((isset($_GET['action']) ? $_GET['action'] : (isset($_POST['action']) ? $_POST['action'] : ''))));
|
41 |
}
|
@@ -129,10 +128,9 @@ class SQ_Action extends SQ_FrontController {
|
|
129 |
if (SQ_Tools::$options['sq_api'] == '' && $module <> 'sq/login' && $module <> 'sq/register') {
|
130 |
return false;
|
131 |
}
|
132 |
-
$lang = (defined('WPLANG') ? WPLANG : 'en_US');
|
133 |
|
134 |
$extra = array('user_url' => urlencode(get_bloginfo('wpurl')),
|
135 |
-
'lang' =>
|
136 |
'versq' => SQ_VERSION_ID,
|
137 |
'verwp' => WP_VERSION_ID,
|
138 |
'verphp' => PHP_VERSION_ID,
|
@@ -165,7 +163,7 @@ class SQ_Action extends SQ_FrontController {
|
|
165 |
|
166 |
$url = self::cleanUrl(_SQ_API_URL_ . $module . "?" . $parameters);
|
167 |
//SQ_Tools::dump($url);
|
168 |
-
return SQ_Tools::sq_remote_get($url, array('timeout' => $timeout));
|
169 |
}
|
170 |
|
171 |
/**
|
35 |
if (isset($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], '/admin-ajax.php') !== false) {
|
36 |
return;
|
37 |
}
|
|
|
38 |
$this->actions = array();
|
39 |
$this->getActions(((isset($_GET['action']) ? $_GET['action'] : (isset($_POST['action']) ? $_POST['action'] : ''))));
|
40 |
}
|
128 |
if (SQ_Tools::$options['sq_api'] == '' && $module <> 'sq/login' && $module <> 'sq/register') {
|
129 |
return false;
|
130 |
}
|
|
|
131 |
|
132 |
$extra = array('user_url' => urlencode(get_bloginfo('wpurl')),
|
133 |
+
'lang' => (defined('WPLANG') ? WPLANG : 'en_US'),
|
134 |
'versq' => SQ_VERSION_ID,
|
135 |
'verwp' => WP_VERSION_ID,
|
136 |
'verphp' => PHP_VERSION_ID,
|
163 |
|
164 |
$url = self::cleanUrl(_SQ_API_URL_ . $module . "?" . $parameters);
|
165 |
//SQ_Tools::dump($url);
|
166 |
+
return SQ_Tools::sq_remote_get($url, array(), array('timeout' => $timeout));
|
167 |
}
|
168 |
|
169 |
/**
|
classes/SQ_BlockController.php
CHANGED
@@ -56,6 +56,18 @@ class SQ_BlockController {
|
|
56 |
return $this->view->echoBlock($this);
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
/**
|
60 |
* This function is called from Ajax class as a wp_ajax_action
|
61 |
*
|
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 |
*
|
classes/SQ_Error.php
CHANGED
@@ -55,16 +55,24 @@ class SQ_Error extends SQ_FrontController {
|
|
55 |
die();
|
56 |
break;
|
57 |
case 'settings':
|
58 |
-
if (isset(SQ_Tools::$options['ignore_warn']) && SQ_Tools::$options['ignore_warn'] == 1)
|
59 |
-
break;
|
60 |
-
|
61 |
/* switch off option for notifications */
|
62 |
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'); } });\" >" . __("Turn off warnings!", _SQ_PLUGIN_NAME_) . "</a>";
|
63 |
-
self::showError(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
break;
|
65 |
default:
|
66 |
|
67 |
-
self::showError(
|
68 |
}
|
69 |
}
|
70 |
self::$errors = array();
|
@@ -75,8 +83,7 @@ class SQ_Error extends SQ_FrontController {
|
|
75 |
*
|
76 |
* @return void
|
77 |
*/
|
78 |
-
public static function showError($message, $id = '') {
|
79 |
-
$type = 'sq_error';
|
80 |
|
81 |
if (file_exists(_SQ_THEME_DIR_ . 'SQ_notices.php')) {
|
82 |
include (_SQ_THEME_DIR_ . 'SQ_notices.php');
|
55 |
die();
|
56 |
break;
|
57 |
case 'settings':
|
|
|
|
|
|
|
58 |
/* switch off option for notifications */
|
59 |
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'); } });\" >" . __("Turn off warnings!", _SQ_PLUGIN_NAME_) . "</a>";
|
60 |
+
self::showError("<span class='sq_notice_author'>" . _SQ_PLUGIN_NAME_ . "</span> " . $error['text'] . " ", $error['id']);
|
61 |
+
break;
|
62 |
+
|
63 |
+
case 'helpnotice':
|
64 |
+
if (isset(SQ_Tools::$options['ignore_warn']) && SQ_Tools::$options['ignore_warn'] == 1) {
|
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>";
|
68 |
+
self::showError("<span class='sq_notice_author'>" . _SQ_PLUGIN_NAME_ . "</span> " . $error['text'] . " " . self::$switch_off, $error['id'], 'sq_helpnotice');
|
69 |
+
break;
|
70 |
+
case 'success':
|
71 |
+
self::showError("<span class='sq_notice_author'>" . _SQ_PLUGIN_NAME_ . "</span> " . $error['text'] . " ", $error['id'], 'sq_success');
|
72 |
break;
|
73 |
default:
|
74 |
|
75 |
+
self::showError("<span class='sq_notice_author'>" . _SQ_PLUGIN_NAME_ . "</span> " . $error['text'], $error['id']);
|
76 |
}
|
77 |
}
|
78 |
self::$errors = array();
|
83 |
*
|
84 |
* @return void
|
85 |
*/
|
86 |
+
public static function showError($message, $id = '', $type = 'sq_error') {
|
|
|
87 |
|
88 |
if (file_exists(_SQ_THEME_DIR_ . 'SQ_notices.php')) {
|
89 |
include (_SQ_THEME_DIR_ . 'SQ_notices.php');
|
classes/SQ_FrontController.php
CHANGED
@@ -86,9 +86,6 @@ class SQ_FrontController {
|
|
86 |
|
87 |
/* show the admin menu and post actions */
|
88 |
$this->loadMenu();
|
89 |
-
|
90 |
-
/* Load the Sitemap Generator */
|
91 |
-
SQ_ObjController::getController('SQ_Sitemap', false);
|
92 |
}
|
93 |
|
94 |
/**
|
86 |
|
87 |
/* show the admin menu and post actions */
|
88 |
$this->loadMenu();
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
/**
|
classes/SQ_HookController.php
CHANGED
@@ -14,16 +14,9 @@ class SQ_HookController {
|
|
14 |
$this->admin_hooks = array('init' => 'admin_init',
|
15 |
'head' => 'admin_head',
|
16 |
'footer' => 'admin_footer',
|
17 |
-
'wmenu' => '_admin_menu',
|
18 |
'menu' => 'admin_menu',
|
19 |
-
'submenu' => 'add_submenu_page',
|
20 |
'preload' => 'template_redirect',
|
21 |
-
'loaded' => 'plugins_loaded',
|
22 |
-
'xml' => 'admin_xml_ns',
|
23 |
-
'scripts' => 'admin_enqueue_scripts',
|
24 |
'notices' => 'admin_notices',
|
25 |
-
'shutdown' => 'shutdown',
|
26 |
-
'fronttitletheme' => 'thematic_doctitle',
|
27 |
'frontinit' => 'init',
|
28 |
'fronthead' => 'wp_head',
|
29 |
'frontfooter' => 'wp_footer',
|
14 |
$this->admin_hooks = array('init' => 'admin_init',
|
15 |
'head' => 'admin_head',
|
16 |
'footer' => 'admin_footer',
|
|
|
17 |
'menu' => 'admin_menu',
|
|
|
18 |
'preload' => 'template_redirect',
|
|
|
|
|
|
|
19 |
'notices' => 'admin_notices',
|
|
|
|
|
20 |
'frontinit' => 'init',
|
21 |
'fronthead' => 'wp_head',
|
22 |
'frontfooter' => 'wp_footer',
|
classes/SQ_Ranking.php
CHANGED
@@ -170,13 +170,13 @@ class SQ_Ranking extends SQ_FrontController {
|
|
170 |
//check 20 keyword at one time
|
171 |
$sql = "SELECT `post_id`, `meta_value`
|
172 |
FROM `" . $wpdb->postmeta . "`
|
173 |
-
WHERE (`meta_key` = '
|
174 |
ORDER BY `post_id` DESC";
|
175 |
|
176 |
if ($rows = $wpdb->get_results($sql)) {
|
177 |
$count = 0;
|
178 |
foreach ($rows as $row) {
|
179 |
-
if ($count >
|
180 |
break; //check only 10 keywords at the time
|
181 |
}
|
182 |
if ($row->meta_value <> '') {
|
170 |
//check 20 keyword at one time
|
171 |
$sql = "SELECT `post_id`, `meta_value`
|
172 |
FROM `" . $wpdb->postmeta . "`
|
173 |
+
WHERE (`meta_key` = '_sq_post_keyword')
|
174 |
ORDER BY `post_id` DESC";
|
175 |
|
176 |
if ($rows = $wpdb->get_results($sql)) {
|
177 |
$count = 0;
|
178 |
foreach ($rows as $row) {
|
179 |
+
if ($count > SQ_Tools::$options['sq_google_ranksperhour']) {
|
180 |
break; //check only 10 keywords at the time
|
181 |
}
|
182 |
if ($row->meta_value <> '') {
|
classes/SQ_Sitemap.php
DELETED
@@ -1,382 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class for Sitemap Generator
|
5 |
-
*/
|
6 |
-
class SQ_Sitemap extends SQ_FrontController {
|
7 |
-
/* @var string file path */
|
8 |
-
|
9 |
-
var $file;
|
10 |
-
var $opt = array();
|
11 |
-
var $data = array();
|
12 |
-
var $args = array();
|
13 |
-
var $posts_limit = 0;
|
14 |
-
|
15 |
-
public function __construct() {
|
16 |
-
if (!isset(SQ_Tools::$options['sq_use']) || SQ_Tools::$options['sq_use'] == 0)
|
17 |
-
return;
|
18 |
-
if (isset(SQ_Tools::$options['sq_auto_sitemap']) && SQ_Tools::$options['sq_auto_sitemap'] == 0)
|
19 |
-
return;
|
20 |
-
|
21 |
-
$this->filename = 'sitemap.xml';
|
22 |
-
|
23 |
-
$this->file = ABSPATH . $this->filename;
|
24 |
-
//For sitemap ping
|
25 |
-
$this->args['timeout'] = 5;
|
26 |
-
$this->opt = array('home' => array(1, 'daily'),
|
27 |
-
'page' => array(0.6, 'monthly'),
|
28 |
-
'post' => array(0.8, 'weekly'),
|
29 |
-
'static' => array(0.6, 'weekly'),
|
30 |
-
'category' => array(0.4, 'monthly'),
|
31 |
-
'archive' => array(0.3, 'weekly'),
|
32 |
-
'oldarchive' => array(0.3, 'monthly'),
|
33 |
-
'tag' => array(0.3, 'weekly'),
|
34 |
-
'author' => array(0.3, 'monthly'),
|
35 |
-
);
|
36 |
-
|
37 |
-
//Existing posts was deleted
|
38 |
-
add_action('delete_post', array($this, 'generateSitemap'), 9999, 1);
|
39 |
-
//Existing post was published
|
40 |
-
add_action('publish_post', array($this, 'generateSitemap'), 9999, 1);
|
41 |
-
//Existing page was published
|
42 |
-
add_action('publish_page', array($this, 'generateSitemap'), 9999, 1);
|
43 |
-
}
|
44 |
-
|
45 |
-
public function init() {
|
46 |
-
return;
|
47 |
-
}
|
48 |
-
|
49 |
-
public function action() {
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Generate the XML sitemap for google
|
55 |
-
*/
|
56 |
-
public function generateSitemap() {
|
57 |
-
global $wpdb, $wp_query, $wp_version;
|
58 |
-
/* get the home url */
|
59 |
-
$home = get_bloginfo('url');
|
60 |
-
$homeID = 0;
|
61 |
-
$wpCompat = (floatval($wp_version) < 2.1);
|
62 |
-
|
63 |
-
/* If the site starts with a page */
|
64 |
-
if (get_option('show_on_front') == 'page' && get_option('page_on_front')) {
|
65 |
-
$page = get_page(get_option('page_on_front'));
|
66 |
-
if ($page) {
|
67 |
-
$homeID = $page->ID;
|
68 |
-
$lastmod = ($page->post_modified_gmt && $page->post_modified_gmt != '0000-00-00 00:00:00' ? $page->post_modified_gmt : $page->post_date_gmt);
|
69 |
-
$this->addLine($home, $this->getTimestamp($lastmod), $this->opt['home'][1], $this->opt['home'][0]);
|
70 |
-
}
|
71 |
-
} else
|
72 |
-
$this->addLine($home, $this->getTimestamp(get_lastpostmodified('GMT')), $this->opt['home'][1], $this->opt['home'][0]);
|
73 |
-
|
74 |
-
/* * ******************************************************************** */
|
75 |
-
//Add the pages
|
76 |
-
$query = array();
|
77 |
-
|
78 |
-
/* CREATE QUERY */
|
79 |
-
$query['what'] = "`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_status`, `post_name`, `post_modified`, `post_modified_gmt`, `post_parent`, `post_type` ";
|
80 |
-
|
81 |
-
/* from */
|
82 |
-
$query['from'] = " `" . $wpdb->posts . "` ";
|
83 |
-
/* where */
|
84 |
-
$query['where'] = '(';
|
85 |
-
|
86 |
-
|
87 |
-
if ($wpCompat)
|
88 |
-
$query['where'] .= "(post_status = 'publish' AND post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "')";
|
89 |
-
else
|
90 |
-
$query['where'] .= "(post_status = 'publish' AND (post_type = 'post' OR post_type = '')) ";
|
91 |
-
|
92 |
-
$query['where'] .= " OR ";
|
93 |
-
if ($wpCompat)
|
94 |
-
$query['where'] .= " post_status='static' ";
|
95 |
-
else
|
96 |
-
$query['where'] .= " (post_status = 'publish' AND post_type = 'page') ";
|
97 |
-
|
98 |
-
$query['where'] .= ") ";
|
99 |
-
$query['where'] .= " AND post_password=''";
|
100 |
-
/* order */
|
101 |
-
$query['order'] = " ORDER BY post_modified DESC";
|
102 |
-
/* limit */
|
103 |
-
$query['limit'] = ((int) $this->posts_limit > 0) ? " LIMIT 0," . $this->posts_limit : '';
|
104 |
-
|
105 |
-
|
106 |
-
$posts = $wpdb->get_results('SELECT ' . $query['what'] . ' FROM ' . $query['from'] . ' WHERE ' . $query['where'] . ' ' . $query['order'] . ' ' . $query['limit'] . ' ');
|
107 |
-
if (!$posts) {
|
108 |
-
trigger_error(ucfirst(_SQ_PLUGIN_NAME_) . " failed to connect to database: " . mysql_error(), E_USER_NOTICE); //E_USER_NOTICE will be displayed on our debug mode
|
109 |
-
return;
|
110 |
-
}
|
111 |
-
|
112 |
-
/* loop */
|
113 |
-
foreach ($posts as $post) {
|
114 |
-
$out = array();
|
115 |
-
$permalink = get_permalink($post->ID);
|
116 |
-
if ($permalink != $home && $post->ID != $homeID) {
|
117 |
-
|
118 |
-
$isPage = false;
|
119 |
-
if ($wpCompat)
|
120 |
-
$isPage = ($post->post_status == 'static');
|
121 |
-
else
|
122 |
-
$isPage = ($post->post_type == 'page');
|
123 |
-
|
124 |
-
if ($isPage) {
|
125 |
-
$out['priority'] = $this->opt['page'][0];
|
126 |
-
$out['changefreq'] = $this->opt['page'][1];
|
127 |
-
} else {
|
128 |
-
$out['priority'] = $this->opt['post'][0];
|
129 |
-
$out['changefreq'] = $this->opt['post'][1];
|
130 |
-
}
|
131 |
-
$out['lastmod'] = ($post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt);
|
132 |
-
|
133 |
-
//Add it
|
134 |
-
$this->addLine($permalink, $this->getTimestamp($out['lastmod']), $out['changefreq'], $out['priority']);
|
135 |
-
|
136 |
-
$subPage = '';
|
137 |
-
if (isset($post->postPages) > 0)
|
138 |
-
for ($i = 1; $i <= $post->postPages; $i++) {
|
139 |
-
if (get_option('permalink_structure') == '') {
|
140 |
-
$subPage = $permalink . '&page=' . ($p + 1);
|
141 |
-
} else {
|
142 |
-
$subPage = trailingslashit($permalink) . user_trailingslashit($p + 1, 'single_paged');
|
143 |
-
}
|
144 |
-
|
145 |
-
$this->addLine($subPage, $this->getTimestamp($out['lastmod']), $out['changefreq'], $out['priority']);
|
146 |
-
}
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
/* * ******************************************************************** */
|
151 |
-
/* Add links ftom categories */
|
152 |
-
if (!$this->IsTaxonomySupported()) {
|
153 |
-
$query = array();
|
154 |
-
|
155 |
-
/* CREATE QUERY */
|
156 |
-
$query['what'] = "c.cat_ID AS ID, MAX(p.post_modified_gmt) AS last_mod";
|
157 |
-
$query['from'] = "`" . $wpdb->categories . "` c, `" . $wpdb->post2cat . "` pc, `" . $wpdb->posts . "` p";
|
158 |
-
$query['where'] = "pc.category_id = c.cat_ID AND p.ID = pc.post_id AND p.post_status = 'publish' AND p.post_type='post'";
|
159 |
-
$query['order'] = "";
|
160 |
-
$query['limit'] = "";
|
161 |
-
$query['group'] = "GROUP BY c.cat_id";
|
162 |
-
|
163 |
-
$categories = $wpdb->get_results("SELECT " . $query['what'] . " FROM " . $query['from'] . " WHERE " . $query['where'] . " " . $query['order'] . " " . $query['group'] . " " . $query['limit'] . "");
|
164 |
-
|
165 |
-
if ($categories) {
|
166 |
-
foreach ($categories as $category) {
|
167 |
-
if ($category && $category->ID && $category->ID > 0) {
|
168 |
-
$this->addLine(get_category_link($category->ID), $this->getTimestamp($category->last_mod), $this->opt['category'][1], $this->opt['category'][0]);
|
169 |
-
}
|
170 |
-
}
|
171 |
-
}
|
172 |
-
} else {
|
173 |
-
$categories = get_terms("category", array("hide_empty" => true, "hierarchical" => false));
|
174 |
-
if ($categories && is_array($categories) && count($categories) > 0) {
|
175 |
-
foreach ($categories AS $category) {
|
176 |
-
$this->addLine(get_category_link($category->term_id), $this->getTimestamp(get_lastpostmodified('GMT')), $this->opt['category'][1], $this->opt['category'][0]);
|
177 |
-
}
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
/* * ******************************************************************** */
|
182 |
-
//Add the archives
|
183 |
-
$now = current_time('mysql');
|
184 |
-
$query = array();
|
185 |
-
|
186 |
-
/* CREATE QUERY */
|
187 |
-
$query['what'] = 'YEAR(post_date_gmt) AS `year`, MONTH(post_date_gmt) AS `month`, MAX(post_date_gmt) as last_mod, count(ID) as posts';
|
188 |
-
$query['from'] = "`" . $wpdb->posts . "`";
|
189 |
-
$query['where'] = "post_date < '$now' AND post_status = 'publish' AND post_type = 'post' " . (floatval($wp_version) < 2.1 ? "AND {$wpdb->posts}.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'" : "") . "";
|
190 |
-
$query['order'] = "ORDER BY post_date_gmt DESC";
|
191 |
-
$query['limit'] = "";
|
192 |
-
$query['group'] = "GROUP BY YEAR(post_date_gmt),MONTH(post_date_gmt)";
|
193 |
-
|
194 |
-
$archives = $wpdb->get_results("SELECT DISTINCT " . $query['what'] . " FROM " . $query['from'] . " WHERE " . $query['where'] . " " . $query['group'] . " " . $query['order'] . " " . $query['limit'] . "");
|
195 |
-
|
196 |
-
|
197 |
-
if ($archives) {
|
198 |
-
foreach ($archives as $archive) {
|
199 |
-
|
200 |
-
$changeFreq = "";
|
201 |
-
//Archive is the current one
|
202 |
-
if ($archive->month == date("n") && $archive->year == date("Y")) {
|
203 |
-
$changeFreq = $this->opt['archive'][1];
|
204 |
-
} else { // Archive is older
|
205 |
-
$changeFreq = $this->opt['oldarchive'][1];
|
206 |
-
}
|
207 |
-
|
208 |
-
$this->addLine(get_month_link($archive->year, $archive->month), $this->getTimestamp($archive->last_mod), $changeFreq, $this->opt['archive'][0]);
|
209 |
-
}
|
210 |
-
}
|
211 |
-
|
212 |
-
/* * ******************************************************************** */
|
213 |
-
//Add the author pages
|
214 |
-
$linkFunc = null;
|
215 |
-
|
216 |
-
//get_author_link is deprecated in WP 2.1, try to use get_author_posts_url first.
|
217 |
-
if (function_exists('get_author_posts_url'))
|
218 |
-
$linkFunc = 'get_author_posts_url';
|
219 |
-
else if (function_exists('get_author_link'))
|
220 |
-
$linkFunc = 'get_author_link';
|
221 |
-
|
222 |
-
if ($linkFunc !== null) {
|
223 |
-
$query = array();
|
224 |
-
|
225 |
-
/* CREATE QUERY */
|
226 |
-
$query['what'] = 'u.ID, u.user_nicename, MAX(p.post_modified_gmt) AS last_post';
|
227 |
-
$query['from'] = "`" . $wpdb->users . "` u, `" . $wpdb->posts . "` p";
|
228 |
-
$query['where'] = "p.post_author = u.ID AND p.post_status = 'publish' AND p.post_type = 'post' AND p.post_password = '' " . (floatval($wp_version) < 2.1 ? "AND p.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'" : "") . "";
|
229 |
-
$query['order'] = "";
|
230 |
-
$query['limit'] = "";
|
231 |
-
$query['group'] = "GROUP BY u.ID, u.user_nicename";
|
232 |
-
|
233 |
-
$authors = $wpdb->get_results("SELECT DISTINCT " . $query['what'] . " FROM " . $query['from'] . " WHERE " . $query['where'] . " " . $query['order'] . " " . $query['group'] . " " . $query['limit'] . "");
|
234 |
-
|
235 |
-
|
236 |
-
if ($authors && is_array($authors)) {
|
237 |
-
foreach ($authors as $author) {
|
238 |
-
|
239 |
-
$author_url = ($linkFunc == 'get_author_posts_url' ? get_author_posts_url($author->ID, $author->user_nicename) : get_author_link(false, $author->ID, $author->user_nicename));
|
240 |
-
$this->addLine($author_url, $this->getTimestamp($author->last_post), $this->opt['author'][1], $this->opt['author'][0]);
|
241 |
-
}
|
242 |
-
}
|
243 |
-
}
|
244 |
-
|
245 |
-
/* * ******************************************************************** */
|
246 |
-
if ($this->IsTaxonomySupported()) {
|
247 |
-
$count = 0;
|
248 |
-
$tags = get_terms("post_tag", array("hide_empty" => true, "hierarchical" => false));
|
249 |
-
if ($tags && is_array($tags) && count($tags) > 0) {
|
250 |
-
foreach ($tags AS $tag) {
|
251 |
-
if ($count > 3000)
|
252 |
-
break; //not to have a memory break
|
253 |
-
$this->addLine(get_tag_link($tag->term_id), strtotime(get_lastpostmodified()), $this->opt['tag'][1], $this->opt['tag'][0]);
|
254 |
-
$count++;
|
255 |
-
}
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
259 |
-
return $this->render();
|
260 |
-
}
|
261 |
-
|
262 |
-
/**
|
263 |
-
* Push new info to array
|
264 |
-
*
|
265 |
-
* @param string $link
|
266 |
-
* @param string $timestamp
|
267 |
-
* @param string $changefreq
|
268 |
-
* @param string $priority
|
269 |
-
*/
|
270 |
-
private function addLine($link, $timestamp, $changefreq, $priority) {
|
271 |
-
|
272 |
-
array_push($this->data, array(
|
273 |
-
'loc' => $link,
|
274 |
-
'lastmod' => date('Y-m-d\TH:i:s+00:00', $timestamp),
|
275 |
-
'changefreq' => $changefreq,
|
276 |
-
'priority' => $priority
|
277 |
-
));
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Create the XML sitemap
|
282 |
-
* @return string
|
283 |
-
*/
|
284 |
-
private function render() {
|
285 |
-
$content = '';
|
286 |
-
try {
|
287 |
-
@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
|
288 |
-
|
289 |
-
$content .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
290 |
-
$content .= '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
291 |
-
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
|
292 |
-
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
|
293 |
-
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
294 |
-
|
295 |
-
|
296 |
-
if (is_array($this->data) && count($this->data) > 0)
|
297 |
-
foreach ($this->data as $data) {
|
298 |
-
$content .= "\t" . '<url>' . "\n";
|
299 |
-
$content .= "\t\t" . '<loc>' . $data['loc'] . '</loc>' . "\n";
|
300 |
-
$content .= "\t\t" . '<lastmod>' . $data['lastmod'] . '</lastmod>' . "\n";
|
301 |
-
$content .= "\t\t" . '<changefreq>' . $data['changefreq'] . '</changefreq>' . "\n";
|
302 |
-
$content .= "\t\t" . '<priority>' . $data['priority'] . '</priority>' . "\n";
|
303 |
-
$content .= "\t" . '</url>' . "\n";
|
304 |
-
} # end foreach
|
305 |
-
$content .= '</urlset>';
|
306 |
-
} catch (Exception $e) {
|
307 |
-
|
308 |
-
}
|
309 |
-
|
310 |
-
$this->saveSitemap($content);
|
311 |
-
|
312 |
-
return $content;
|
313 |
-
}
|
314 |
-
|
315 |
-
/**
|
316 |
-
* Converts into a unix timestamp
|
317 |
-
*
|
318 |
-
* @param string time
|
319 |
-
* @return string
|
320 |
-
*/
|
321 |
-
private function getTimestamp($time) {
|
322 |
-
if (!isset($time) || $time == '')
|
323 |
-
$time = date('Y-m-d H:i:s');
|
324 |
-
|
325 |
-
list($date, $hours) = explode(' ', $time);
|
326 |
-
list($year, $month, $day) = explode('-', $date);
|
327 |
-
list($hour, $min, $sec) = explode(':', $hours);
|
328 |
-
|
329 |
-
return mktime(intval($hour), intval($min), intval($sec), intval($month), intval($day), intval($year));
|
330 |
-
}
|
331 |
-
|
332 |
-
/**
|
333 |
-
* Function to save the sitemap data to file as either XML or XML.GZ format
|
334 |
-
* @param string $data XML data
|
335 |
-
* @param string $filename file path
|
336 |
-
*
|
337 |
-
* @return boolean
|
338 |
-
*/
|
339 |
-
private function saveSitemap($data) {
|
340 |
-
if (function_exists('gzopen') && function_exists('gzwrite') && function_exists('gzclose')) {
|
341 |
-
if (function_exists('file_exists') && file_exists($this->file . '.gz'))
|
342 |
-
@unlink($this->file . '.gz');
|
343 |
-
|
344 |
-
if (function_exists('file_exists') && !file_exists($this->file . '.gz'))
|
345 |
-
if ($gz = @gzopen($this->file . '.gz', 'wb9')) {
|
346 |
-
@gzwrite($gz, $data);
|
347 |
-
@gzclose($gz);
|
348 |
-
}
|
349 |
-
}
|
350 |
-
|
351 |
-
if (function_exists('fopen'))
|
352 |
-
if ($fp = @fopen($this->file, 'w+')) {
|
353 |
-
fwrite($fp, $data);
|
354 |
-
fclose($fp);
|
355 |
-
return true;
|
356 |
-
}
|
357 |
-
|
358 |
-
return false;
|
359 |
-
}
|
360 |
-
|
361 |
-
/**
|
362 |
-
* Returns the URL for the XML sitemap file
|
363 |
-
*
|
364 |
-
* @return string
|
365 |
-
*/
|
366 |
-
public function getXmlUrl() {
|
367 |
-
return trailingslashit(get_bloginfo('url')) . $this->filename;
|
368 |
-
}
|
369 |
-
|
370 |
-
/**
|
371 |
-
* Returns if this version of WordPress supports the new taxonomy system
|
372 |
-
*
|
373 |
-
* @since 3.0b8
|
374 |
-
* @access private
|
375 |
-
* @author Arne Brachhold
|
376 |
-
* @return true if supported
|
377 |
-
*/
|
378 |
-
private function IsTaxonomySupported() {
|
379 |
-
return (function_exists("get_taxonomy") && function_exists("get_terms"));
|
380 |
-
}
|
381 |
-
|
382 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/SQ_Tools.php
CHANGED
@@ -22,7 +22,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
22 |
|
23 |
self::$options = $this->getOptions();
|
24 |
|
25 |
-
$this->checkDebug(); //
|
26 |
}
|
27 |
|
28 |
public static function getUserID() {
|
@@ -36,7 +36,6 @@ class SQ_Tools extends SQ_FrontController {
|
|
36 |
* @return void
|
37 |
*/
|
38 |
function hookInit() {
|
39 |
-
$this->sq_patch3000(); //Update the older version
|
40 |
//TinyMCE editor required
|
41 |
//set_user_setting('editor', 'tinymce');
|
42 |
|
@@ -55,13 +54,8 @@ class SQ_Tools extends SQ_FrontController {
|
|
55 |
*/
|
56 |
public function hookActionlink($links, $file) {
|
57 |
if ($file == _SQ_PLUGIN_NAME_ . '/squirrly.php') {
|
58 |
-
|
59 |
-
|
60 |
-
array_unshift($links, $link);
|
61 |
-
} elseif (SQ_Tools::$options['sq_api'] <> '') {
|
62 |
-
$link = '<a href="' . admin_url('admin.php?page=sq_dashboard') . '">' . __('Dashboard', _SQ_PLUGIN_NAME_) . '</a>';
|
63 |
-
array_unshift($links, $link);
|
64 |
-
}
|
65 |
}
|
66 |
|
67 |
return $links;
|
@@ -74,17 +68,73 @@ class SQ_Tools extends SQ_FrontController {
|
|
74 |
*/
|
75 |
public static function getOptions() {
|
76 |
$default = array(
|
|
|
77 |
'sq_api' => '',
|
|
|
|
|
78 |
'sq_use' => 0,
|
79 |
-
'
|
|
|
|
|
80 |
// --
|
81 |
'sq_auto_canonical' => 1,
|
82 |
-
'sq_auto_sitemap' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
'sq_auto_meta' => 1,
|
84 |
'sq_auto_favicon' => 1,
|
|
|
85 |
'sq_auto_twitter' => 1,
|
86 |
'sq_auto_facebook' => 1,
|
87 |
'sq_twitter_account' => '',
|
|
|
|
|
|
|
88 |
// --
|
89 |
'sq_auto_seo' => 1,
|
90 |
'sq_auto_title' => 1,
|
@@ -93,7 +143,6 @@ class SQ_Tools extends SQ_FrontController {
|
|
93 |
'sq_fp_description' => '',
|
94 |
'sq_fp_keywords' => '',
|
95 |
// --
|
96 |
-
'sq_google_plus' => '',
|
97 |
'sq_google_wt' => '',
|
98 |
'sq_google_analytics' => '',
|
99 |
'sq_facebook_insights' => '',
|
@@ -101,21 +150,21 @@ class SQ_Tools extends SQ_FrontController {
|
|
101 |
'sq_pinterest' => '',
|
102 |
'sq_alexa' => '',
|
103 |
// --
|
|
|
104 |
'ignore_warn' => 0,
|
105 |
'sq_keyword_help' => 1,
|
106 |
'sq_keyword_information' => 0,
|
107 |
//
|
108 |
'sq_google_country' => 'com',
|
109 |
'sq_google_language' => 'en',
|
110 |
-
'sq_google_country_strict' =>
|
|
|
111 |
// --
|
112 |
-
'sq_advance_user' => 0,
|
113 |
'sq_affiliate_link' => '',
|
114 |
'sq_sla' => 1,
|
115 |
'sq_keywordtag' => 1,
|
116 |
'sq_local_images' => 1,
|
117 |
//--
|
118 |
-
'sq_dbtables' => 0,
|
119 |
'sq_dashboard' => 0,
|
120 |
'sq_analytics' => 0,
|
121 |
);
|
@@ -129,6 +178,39 @@ class SQ_Tools extends SQ_FrontController {
|
|
129 |
return $default;
|
130 |
}
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
/**
|
133 |
* Save the Options in user option table in DB
|
134 |
*
|
@@ -150,6 +232,13 @@ class SQ_Tools extends SQ_FrontController {
|
|
150 |
switch ($type) {
|
151 |
case 'json':
|
152 |
header('Content-Type: application/json');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
}
|
154 |
}
|
155 |
|
@@ -161,13 +250,15 @@ class SQ_Tools extends SQ_FrontController {
|
|
161 |
* @param mixed $defaultValue (optional)
|
162 |
* @return mixed Value
|
163 |
*/
|
164 |
-
public static function getValue($key, $defaultValue = false) {
|
165 |
if (!isset($key) OR empty($key) OR ! is_string($key))
|
166 |
return false;
|
167 |
-
$ret = (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $defaultValue));
|
168 |
|
169 |
-
if (is_string($ret) === true)
|
170 |
$ret = sanitize_text_field($ret);
|
|
|
|
|
171 |
return !is_string($ret) ? $ret : stripslashes($ret);
|
172 |
}
|
173 |
|
@@ -213,7 +304,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
213 |
/**
|
214 |
* Connect remote with CURL if exists
|
215 |
*/
|
216 |
-
public static function sq_remote_get($url, $param = array()) {
|
217 |
$parameters = '';
|
218 |
$cookies = array();
|
219 |
$cookie_string = '';
|
@@ -221,13 +312,15 @@ class SQ_Tools extends SQ_FrontController {
|
|
221 |
$url_domain = parse_url($url);
|
222 |
$url_domain = $url_domain['host'];
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
228 |
if ($parameters <> '')
|
229 |
$url .= ((strpos($url, "?") === false) ? "?" : "&") . $parameters;
|
230 |
|
|
|
231 |
if ($url_domain == $_SERVER['HTTP_HOST'] && strpos($url, 'preview=true') !== false) {
|
232 |
foreach ($_COOKIE as $name => $value) {
|
233 |
if (strpos($name, 'wordpress') !== false || strpos($name, 'wpta') !== false) {
|
@@ -235,16 +328,21 @@ class SQ_Tools extends SQ_FrontController {
|
|
235 |
$cookie_string .= "$name=$value;";
|
236 |
}
|
237 |
}
|
238 |
-
$cookies[] = new WP_Http_Cookie(array('name' => 'sq_snippet', 'value' => 1));
|
239 |
-
$cookie_string .= "sq_snippet=1;";
|
240 |
}
|
241 |
|
242 |
-
$timeout = (isset($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
if (function_exists('curl_init')) {
|
245 |
-
return self::sq_curl($url,
|
246 |
} else {
|
247 |
-
return self::sq_wpcall($url,
|
248 |
}
|
249 |
}
|
250 |
|
@@ -254,7 +352,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
254 |
* @param array $param
|
255 |
* @return string
|
256 |
*/
|
257 |
-
private static function sq_curl($url, $
|
258 |
|
259 |
$ch = curl_init();
|
260 |
curl_setopt($ch, CURLOPT_URL, $url);
|
@@ -264,23 +362,27 @@ class SQ_Tools extends SQ_FrontController {
|
|
264 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
265 |
//--
|
266 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
267 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, $
|
268 |
-
|
|
|
|
|
|
|
|
|
269 |
|
270 |
-
if ($
|
271 |
-
curl_setopt($ch, CURLOPT_COOKIE, $
|
272 |
|
273 |
$response = curl_exec($ch);
|
274 |
$response = self::cleanResponce($response);
|
275 |
|
276 |
-
self::dump('CURL', $url, $
|
277 |
|
278 |
if (curl_errno($ch) == 1 || $response === false) { //if protocol not supported
|
279 |
if (curl_errno($ch)) {
|
280 |
self::dump(curl_getinfo($ch), curl_errno($ch), curl_error($ch));
|
281 |
}
|
282 |
curl_close($ch);
|
283 |
-
$response = self::sq_wpcall($url, $
|
284 |
} else {
|
285 |
curl_close($ch);
|
286 |
}
|
@@ -294,10 +396,10 @@ class SQ_Tools extends SQ_FrontController {
|
|
294 |
* @param array $param
|
295 |
* @return string
|
296 |
*/
|
297 |
-
private static function sq_wpcall($url, $
|
298 |
-
$response = wp_remote_get($url, $
|
299 |
$response = self::cleanResponce(wp_remote_retrieve_body($response)); //clear and get the body
|
300 |
-
self::dump('wp_remote_get', $url, $
|
301 |
return $response;
|
302 |
}
|
303 |
|
@@ -346,71 +448,75 @@ class SQ_Tools extends SQ_FrontController {
|
|
346 |
* Check for SEO blog bad settings
|
347 |
*/
|
348 |
public static function checkErrorSettings($count_only = false) {
|
|
|
349 |
|
350 |
-
|
351 |
-
return;
|
352 |
-
|
353 |
-
if (isset(self::$options['ignore_warn']) && self::$options['ignore_warn'] == 1)
|
354 |
-
return;
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
$fixit = "<a href=\"javascript:void(0);\" onclick=\"%s jQuery(this).closest('div').fadeOut('slow'); if(parseInt(jQuery('.sq_count').html())>0) { var notif = (parseInt(jQuery('.sq_count').html()) - 1); if (notif > 0) {jQuery('.sq_count').html(notif); }else{ jQuery('.sq_count').html(notif); jQuery('.sq_count').hide(); } } jQuery.post(ajaxurl, { action: '%s', nonce: '" . wp_create_nonce(_SQ_NONCE_ID_) . "'});\" >" . __("Fix it for me!", _SQ_PLUGIN_NAME_) . "</a>";
|
359 |
-
|
360 |
|
361 |
-
|
362 |
-
|
363 |
-
if ($count_only)
|
364 |
self::$errors_count ++;
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
//check only when in seo settings
|
370 |
-
if (strpos($_SERVER['REQUEST_URI'], 'page=squirrly')) {
|
371 |
-
self::$source_code = self::sq_remote_get(get_bloginfo('url'), array('timeout' => 5));
|
372 |
|
|
|
|
|
373 |
if (self::$source_code <> '') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
/* IF DESCRIPTION DUPLICATES */
|
375 |
if (self::getDuplicateDescription()) {
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
}
|
381 |
|
382 |
/* IF OG DUPLICATES */
|
383 |
if (self::getDuplicateOG()) {
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
}
|
389 |
|
390 |
/* IF TWITTER CARD DUPLICATES */
|
391 |
if (self::getDuplicateTC()) {
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
}
|
397 |
}
|
398 |
-
}
|
399 |
-
|
400 |
-
/* IF SEO INDEX IS OFF */
|
401 |
-
if (self::getPrivateBlog()) {
|
402 |
|
403 |
-
|
|
|
404 |
self::$errors_count++;
|
405 |
-
|
406 |
-
|
407 |
-
|
|
|
408 |
|
409 |
-
|
410 |
-
if ($count_only)
|
411 |
self::$errors_count++;
|
412 |
-
|
413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
}
|
415 |
}
|
416 |
|
@@ -495,6 +601,32 @@ class SQ_Tools extends SQ_FrontController {
|
|
495 |
return ($total > 1);
|
496 |
}
|
497 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
/**
|
499 |
* Check if the blog is in private mode
|
500 |
* @return bool
|
@@ -631,11 +763,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
631 |
'description' => 240,
|
632 |
'url' => 45);
|
633 |
|
634 |
-
|
635 |
-
self::$source_code = self::sq_remote_get($url, array('timeout' => 10));
|
636 |
-
} else {
|
637 |
-
self::$source_code = self::sq_remote_get($url, array('timeout' => 10));
|
638 |
-
}
|
639 |
|
640 |
$title_regex = "/<title[^>]*>([^<>]*)<\/title>/si";
|
641 |
preg_match($title_regex, self::$source_code, $title);
|
@@ -648,7 +776,7 @@ class SQ_Tools extends SQ_FrontController {
|
|
648 |
$description_regex = '/<meta[^<>]*description[^<>]*content="([^"<>]+)"[^<>]*>/si';
|
649 |
preg_match($description_regex, self::$source_code, $description);
|
650 |
if (is_array($description) && count($description) > 0) {
|
651 |
-
$snippet['description'] = trim(strip_tags(
|
652 |
|
653 |
if (strlen($snippet['description']) > $length['description'])
|
654 |
$snippet['description'] = substr($snippet['description'], 0, ($length['description'] - 1)) . '...';
|
@@ -667,18 +795,16 @@ class SQ_Tools extends SQ_FrontController {
|
|
667 |
private function checkDebug() {
|
668 |
//if debug is called
|
669 |
if (self::getIsset('sq_debug')) {
|
670 |
-
|
671 |
-
|
672 |
-
if (self::getValue('sq_debug') == self::$options['sq_api'])
|
673 |
$_GET['sq_debug'] = 'on';
|
674 |
-
|
675 |
-
$_GET['sq_debug'] = 'on';
|
676 |
-
else
|
677 |
$_GET['sq_debug'] = 'off';
|
|
|
678 |
|
679 |
if (self::getValue('sq_debug') === 'on') {
|
680 |
-
if (function_exists('register_shutdown_function'))
|
681 |
register_shutdown_function(array($this, 'showDebug'));
|
|
|
682 |
}
|
683 |
}
|
684 |
}
|
@@ -687,6 +813,10 @@ class SQ_Tools extends SQ_FrontController {
|
|
687 |
* Store the debug for a later view
|
688 |
*/
|
689 |
public static function dump() {
|
|
|
|
|
|
|
|
|
690 |
$output = '';
|
691 |
$callee = array('file' => '', 'line' => '');
|
692 |
if (function_exists('func_get_args')) {
|
@@ -696,12 +826,12 @@ class SQ_Tools extends SQ_FrontController {
|
|
696 |
$arguments = array();
|
697 |
|
698 |
|
699 |
-
|
700 |
if (function_exists('debug_backtrace'))
|
701 |
list( $callee ) = debug_backtrace();
|
702 |
|
703 |
$output .= '<fieldset style="background: #FFFFFF; border: 1px #CCCCCC solid; padding: 5px; font-size: 9pt; margin: 0;">';
|
704 |
-
$output .= '<legend style="background: #EEEEEE; padding: 2px; font-size: 8pt;">' . $callee['file'] . ' @ line: ' . $callee['line']
|
705 |
. '</legend><pre style="margin: 0; font-size: 8pt; text-align: left;">';
|
706 |
|
707 |
$i = 0;
|
@@ -733,8 +863,8 @@ class SQ_Tools extends SQ_FrontController {
|
|
733 |
}
|
734 |
|
735 |
public function sq_activate() {
|
736 |
-
|
737 |
-
set_transient('
|
738 |
}
|
739 |
|
740 |
public function sq_deactivate() {
|
@@ -744,24 +874,10 @@ class SQ_Tools extends SQ_FrontController {
|
|
744 |
$args = array();
|
745 |
$args['type'] = 'deact';
|
746 |
SQ_Action::apiCall('sq/user/log', $args, 5);
|
747 |
-
}
|
748 |
-
|
749 |
-
/**
|
750 |
-
* Update patch for older versions
|
751 |
-
*/
|
752 |
-
public function sq_patch3000() {
|
753 |
-
//Delete the old versions table
|
754 |
-
if (self::$options['sq_dbtables'] == 1) {
|
755 |
-
self::$options['sq_dbtables'] = 0;
|
756 |
-
global $wpdb;
|
757 |
-
|
758 |
-
$ranking = SQ_ObjController::getController('SQ_Ranking', false);
|
759 |
-
$ranking->getKeywordHistory();
|
760 |
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
}
|
765 |
}
|
766 |
|
767 |
public static function emptyCache($post_id = null) {
|
@@ -781,6 +897,18 @@ class SQ_Tools extends SQ_FrontController {
|
|
781 |
}
|
782 |
}
|
783 |
|
784 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
785 |
|
786 |
-
|
|
|
|
|
|
|
|
22 |
|
23 |
self::$options = $this->getOptions();
|
24 |
|
25 |
+
$this->checkDebug(); //dev mode
|
26 |
}
|
27 |
|
28 |
public static function getUserID() {
|
36 |
* @return void
|
37 |
*/
|
38 |
function hookInit() {
|
|
|
39 |
//TinyMCE editor required
|
40 |
//set_user_setting('editor', 'tinymce');
|
41 |
|
54 |
*/
|
55 |
public function hookActionlink($links, $file) {
|
56 |
if ($file == _SQ_PLUGIN_NAME_ . '/squirrly.php') {
|
57 |
+
$link = '<a href="' . admin_url('admin.php?page=sq_dashboard') . '">' . __('Getting started', _SQ_PLUGIN_NAME_) . '</a>';
|
58 |
+
array_unshift($links, $link);
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
return $links;
|
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' => 0,
|
76 |
+
'sq_post_types' => array(
|
77 |
+
'post', 'page', 'product', 'shopp_page_shopp-products'
|
78 |
+
),
|
79 |
// --
|
80 |
'sq_auto_canonical' => 1,
|
81 |
+
'sq_auto_sitemap' => 1,
|
82 |
+
'sq_auto_jsonld' => 1,
|
83 |
+
'sq_jsonld_type' => 'Organization',
|
84 |
+
'sq_jsonld' => array(
|
85 |
+
'Organization' => array(
|
86 |
+
'name' => '',
|
87 |
+
'logo' => '',
|
88 |
+
'telephone' => '',
|
89 |
+
'contactType' => '',
|
90 |
+
'description' => ''
|
91 |
+
),
|
92 |
+
'Person' => array(
|
93 |
+
'name' => '',
|
94 |
+
'logo' => '',
|
95 |
+
'telephone' => '',
|
96 |
+
'jobTitle' => '',
|
97 |
+
'description' => ''
|
98 |
+
)),
|
99 |
+
'sq_sitemap_ping' => 1,
|
100 |
+
'sq_sitemap_show' => array(
|
101 |
+
'images' => 1,
|
102 |
+
'videos' => 1,
|
103 |
+
),
|
104 |
+
'sq_sitemap_frequency' => 'weekly',
|
105 |
+
'sq_sitemap' => array(
|
106 |
+
'sitemap' => array('sitemap.xml', 1),
|
107 |
+
'sitemap-home' => array('sitemap-home.xml', 1),
|
108 |
+
'sitemap-news' => array('sitemap-news.xml', 1),
|
109 |
+
'sitemap-product' => array('sitemap-product.xml', 1),
|
110 |
+
'sitemap-post' => array('sitemap-posts.xml', 1),
|
111 |
+
'sitemap-page' => array('sitemap-pages.xml', 1),
|
112 |
+
'sitemap-category' => array('sitemap-categories.xml', 1),
|
113 |
+
'sitemap-post_tag' => array('sitemap-tags.xml', 1),
|
114 |
+
'sitemap-archive' => array('sitemap-archives.xml', 1),
|
115 |
+
'sitemap-author' => array('sitemap-authors.xml', 0),
|
116 |
+
'sitemap-custom-tax' => array('sitemap-custom-taxonomies.xml', 0),
|
117 |
+
'sitemap-custom-post' => array('sitemap-custom-posts.xml', 0),
|
118 |
+
),
|
119 |
+
'sq_auto_robots' => 1,
|
120 |
+
'sq_robots_security' => array(
|
121 |
+
'User-agent: *',
|
122 |
+
'Disallow: */trackback/',
|
123 |
+
'Disallow: */xmlrpc.php',
|
124 |
+
'Disallow: /wp-*.php',
|
125 |
+
'Disallow: /cgi-bin/',
|
126 |
+
'Disallow: /wp-admin/',
|
127 |
+
'Disallow: /wp-includes/',
|
128 |
+
'Allow: */wp-content/uploads/'),
|
129 |
'sq_auto_meta' => 1,
|
130 |
'sq_auto_favicon' => 1,
|
131 |
+
'favicon' => '',
|
132 |
'sq_auto_twitter' => 1,
|
133 |
'sq_auto_facebook' => 1,
|
134 |
'sq_twitter_account' => '',
|
135 |
+
'sq_facebook_account' => '',
|
136 |
+
'sq_google_plus' => '',
|
137 |
+
'sq_linkedin_account' => '',
|
138 |
// --
|
139 |
'sq_auto_seo' => 1,
|
140 |
'sq_auto_title' => 1,
|
143 |
'sq_fp_description' => '',
|
144 |
'sq_fp_keywords' => '',
|
145 |
// --
|
|
|
146 |
'sq_google_wt' => '',
|
147 |
'sq_google_analytics' => '',
|
148 |
'sq_facebook_insights' => '',
|
150 |
'sq_pinterest' => '',
|
151 |
'sq_alexa' => '',
|
152 |
// --
|
153 |
+
'active_help' => '',
|
154 |
'ignore_warn' => 0,
|
155 |
'sq_keyword_help' => 1,
|
156 |
'sq_keyword_information' => 0,
|
157 |
//
|
158 |
'sq_google_country' => 'com',
|
159 |
'sq_google_language' => 'en',
|
160 |
+
'sq_google_country_strict' => 0,
|
161 |
+
'sq_google_ranksperhour' => 5,
|
162 |
// --
|
|
|
163 |
'sq_affiliate_link' => '',
|
164 |
'sq_sla' => 1,
|
165 |
'sq_keywordtag' => 1,
|
166 |
'sq_local_images' => 1,
|
167 |
//--
|
|
|
168 |
'sq_dashboard' => 0,
|
169 |
'sq_analytics' => 0,
|
170 |
);
|
178 |
return $default;
|
179 |
}
|
180 |
|
181 |
+
public static function getBriefOptions() {
|
182 |
+
return array(
|
183 |
+
'sq_version' => SQ_VERSION_ID,
|
184 |
+
'sq_use' => SQ_Tools::$options['sq_use'],
|
185 |
+
'sq_checkedissues' => SQ_Tools::$options['sq_checkedissues'],
|
186 |
+
'sq_areissues' => SQ_Tools::$options['sq_areissues'],
|
187 |
+
'sq_auto_canonical' => SQ_Tools::$options['sq_auto_canonical'],
|
188 |
+
'sq_auto_meta' => SQ_Tools::$options['sq_auto_meta'],
|
189 |
+
'sq_auto_sitemap' => SQ_Tools::$options['sq_auto_sitemap'],
|
190 |
+
'sq_auto_jsonld' => (SQ_Tools::$options['sq_auto_jsonld'] && (SQ_Tools::$options['sq_jsonld']['Organization']['name'] <> '' || SQ_Tools::$options['sq_jsonld']['Person']['name'] <> '')),
|
191 |
+
'sq_sitemap_ping' => SQ_Tools::$options['sq_sitemap_ping'],
|
192 |
+
'sq_auto_robots' => SQ_Tools::$options['sq_auto_robots'],
|
193 |
+
'sq_auto_favicon' => (SQ_Tools::$options['sq_auto_favicon'] && SQ_Tools::$options['favicon'] <> ''),
|
194 |
+
'sq_auto_twitter' => SQ_Tools::$options['sq_auto_twitter'],
|
195 |
+
'sq_auto_facebook' => SQ_Tools::$options['sq_auto_facebook'],
|
196 |
+
'sq_auto_seo' => SQ_Tools::$options['sq_auto_seo'],
|
197 |
+
'sq_auto_title' => (int) (SQ_Tools::$options['sq_auto_title'] && SQ_Tools::$options['sq_fp_title'] <> ''),
|
198 |
+
'sq_auto_description' => (int) (SQ_Tools::$options['sq_auto_description'] && SQ_Tools::$options['sq_fp_description'] <> ''),
|
199 |
+
'sq_google_plus' => (int) (SQ_Tools::$options['sq_google_plus'] <> ''),
|
200 |
+
'sq_google_wt' => (int) (SQ_Tools::$options['sq_google_wt'] <> ''),
|
201 |
+
'sq_google_analytics' => (int) (SQ_Tools::$options['sq_google_analytics'] <> ''),
|
202 |
+
'sq_facebook_insights' => (int) (SQ_Tools::$options['sq_facebook_insights'] <> ''),
|
203 |
+
'sq_bing_wt' => (int) (SQ_Tools::$options['sq_bing_wt'] <> ''),
|
204 |
+
'sq_pinterest' => (int) (SQ_Tools::$options['sq_pinterest'] <> ''),
|
205 |
+
'sq_alexa' => (int) (SQ_Tools::$options['sq_alexa'] <> ''),
|
206 |
+
'sq_keyword_help' => SQ_Tools::$options['sq_keyword_help'],
|
207 |
+
'sq_keyword_information' => SQ_Tools::$options['sq_keyword_information'],
|
208 |
+
'sq_google_country_strict' => SQ_Tools::$options['sq_google_country_strict'],
|
209 |
+
'sq_keywordtag' => SQ_Tools::$options['sq_keywordtag'],
|
210 |
+
'sq_local_images' => SQ_Tools::$options['sq_local_images'],
|
211 |
+
);
|
212 |
+
}
|
213 |
+
|
214 |
/**
|
215 |
* Save the Options in user option table in DB
|
216 |
*
|
232 |
switch ($type) {
|
233 |
case 'json':
|
234 |
header('Content-Type: application/json');
|
235 |
+
break;
|
236 |
+
case 'ico':
|
237 |
+
header('Content-Type: image/x-icon');
|
238 |
+
break;
|
239 |
+
case 'png':
|
240 |
+
header('Content-Type: image/png');
|
241 |
+
break;
|
242 |
}
|
243 |
}
|
244 |
|
250 |
* @param mixed $defaultValue (optional)
|
251 |
* @return mixed Value
|
252 |
*/
|
253 |
+
public static function getValue($key, $defaultValue = false, $withcode = false) {
|
254 |
if (!isset($key) OR empty($key) OR ! is_string($key))
|
255 |
return false;
|
256 |
+
$ret = (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? (is_string($_GET[$key]) ? urldecode($_GET[$key]) : $_GET[$key]) : $defaultValue));
|
257 |
|
258 |
+
if (is_string($ret) === true && $withcode === false) {
|
259 |
$ret = sanitize_text_field($ret);
|
260 |
+
}
|
261 |
+
|
262 |
return !is_string($ret) ? $ret : stripslashes($ret);
|
263 |
}
|
264 |
|
304 |
/**
|
305 |
* Connect remote with CURL if exists
|
306 |
*/
|
307 |
+
public static function sq_remote_get($url, $param = array(), $options = array()) {
|
308 |
$parameters = '';
|
309 |
$cookies = array();
|
310 |
$cookie_string = '';
|
312 |
$url_domain = parse_url($url);
|
313 |
$url_domain = $url_domain['host'];
|
314 |
|
315 |
+
if (isset($param))
|
316 |
+
foreach ($param as $key => $value) {
|
317 |
+
if (isset($key) && $key <> '' && $key <> 'timeout')
|
318 |
+
$parameters .= ($parameters == "" ? "" : "&") . $key . "=" . $value;
|
319 |
+
}
|
320 |
if ($parameters <> '')
|
321 |
$url .= ((strpos($url, "?") === false) ? "?" : "&") . $parameters;
|
322 |
|
323 |
+
//send the cookie for preview
|
324 |
if ($url_domain == $_SERVER['HTTP_HOST'] && strpos($url, 'preview=true') !== false) {
|
325 |
foreach ($_COOKIE as $name => $value) {
|
326 |
if (strpos($name, 'wordpress') !== false || strpos($name, 'wpta') !== false) {
|
328 |
$cookie_string .= "$name=$value;";
|
329 |
}
|
330 |
}
|
|
|
|
|
331 |
}
|
332 |
|
333 |
+
$options['timeout'] = (isset($options['timeout'])) ? $options['timeout'] : 30;
|
334 |
+
if (!isset($options['cookie_string'])) {
|
335 |
+
$options['cookies'] = $cookies;
|
336 |
+
}
|
337 |
+
if (!isset($options['cookie_string'])) {
|
338 |
+
$options['cookie_string'] = $cookie_string;
|
339 |
+
}
|
340 |
+
$options['sslverify'] = false;
|
341 |
|
342 |
if (function_exists('curl_init')) {
|
343 |
+
return self::sq_curl($url, $options);
|
344 |
} else {
|
345 |
+
return self::sq_wpcall($url, $options);
|
346 |
}
|
347 |
}
|
348 |
|
352 |
* @param array $param
|
353 |
* @return string
|
354 |
*/
|
355 |
+
private static function sq_curl($url, $options) {
|
356 |
|
357 |
$ch = curl_init();
|
358 |
curl_setopt($ch, CURLOPT_URL, $url);
|
362 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
363 |
//--
|
364 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
365 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, $options['timeout']);
|
366 |
+
|
367 |
+
if (isset($options['followlocation'])) {
|
368 |
+
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
369 |
+
curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
|
370 |
+
}
|
371 |
|
372 |
+
if ($options['cookie_string'] <> '')
|
373 |
+
curl_setopt($ch, CURLOPT_COOKIE, $options['cookie_string']);
|
374 |
|
375 |
$response = curl_exec($ch);
|
376 |
$response = self::cleanResponce($response);
|
377 |
|
378 |
+
self::dump('CURL', $url, $options, $response); //output debug
|
379 |
|
380 |
if (curl_errno($ch) == 1 || $response === false) { //if protocol not supported
|
381 |
if (curl_errno($ch)) {
|
382 |
self::dump(curl_getinfo($ch), curl_errno($ch), curl_error($ch));
|
383 |
}
|
384 |
curl_close($ch);
|
385 |
+
$response = self::sq_wpcall($url, $options); //use the wordpress call
|
386 |
} else {
|
387 |
curl_close($ch);
|
388 |
}
|
396 |
* @param array $param
|
397 |
* @return string
|
398 |
*/
|
399 |
+
private static function sq_wpcall($url, $options) {
|
400 |
+
$response = wp_remote_get($url, $options);
|
401 |
$response = self::cleanResponce(wp_remote_retrieve_body($response)); //clear and get the body
|
402 |
+
self::dump('wp_remote_get', $url, $options, $response); //output debug
|
403 |
return $response;
|
404 |
}
|
405 |
|
448 |
* Check for SEO blog bad settings
|
449 |
*/
|
450 |
public static function checkErrorSettings($count_only = false) {
|
451 |
+
if (current_user_can('manage_options')) {
|
452 |
|
453 |
+
$fixit = "<a href=\"javascript:void(0);\" onclick=\"%s jQuery(this).closest('div').fadeOut('slow'); if(parseInt(jQuery('.sq_count').html())>0) { var notif = (parseInt(jQuery('.sq_count').html()) - 1); if (notif > 0) {jQuery('.sq_count').html(notif); }else{ jQuery('.sq_count').html(notif); jQuery('.sq_count').hide(); } } jQuery.post(ajaxurl, { action: '%s', nonce: '" . wp_create_nonce(_SQ_NONCE_ID_) . "'});\" >" . __("Fix it for me!", _SQ_PLUGIN_NAME_) . "</a>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
|
455 |
+
/* IF SEO INDEX IS OFF */
|
456 |
+
if (self::getAutoSeoSquirrly()) {
|
|
|
457 |
self::$errors_count ++;
|
458 |
+
if (!$count_only) {
|
459 |
+
SQ_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');
|
460 |
+
}
|
461 |
+
}
|
|
|
|
|
|
|
462 |
|
463 |
+
//check only when in seo settings
|
464 |
+
self::$source_code = self::sq_remote_get(get_bloginfo('url'), array(), array('timeout' => 5, 'followlocation' => true));
|
465 |
if (self::$source_code <> '') {
|
466 |
+
/* IF TITLE DUPLICATES */
|
467 |
+
if (self::getDuplicateTitle()) {
|
468 |
+
self::$errors_count ++;
|
469 |
+
if (!$count_only) {
|
470 |
+
SQ_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');
|
471 |
+
}
|
472 |
+
}
|
473 |
+
|
474 |
/* IF DESCRIPTION DUPLICATES */
|
475 |
if (self::getDuplicateDescription()) {
|
476 |
+
self::$errors_count ++;
|
477 |
+
if (!$count_only) {
|
478 |
+
SQ_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');
|
479 |
+
}
|
480 |
}
|
481 |
|
482 |
/* IF OG DUPLICATES */
|
483 |
if (self::getDuplicateOG()) {
|
484 |
+
self::$errors_count ++;
|
485 |
+
if (!$count_only) {
|
486 |
+
SQ_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');
|
487 |
+
}
|
488 |
}
|
489 |
|
490 |
/* IF TWITTER CARD DUPLICATES */
|
491 |
if (self::getDuplicateTC()) {
|
492 |
+
self::$errors_count ++;
|
493 |
+
if (!$count_only) {
|
494 |
+
SQ_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');
|
495 |
+
}
|
496 |
}
|
497 |
}
|
|
|
|
|
|
|
|
|
498 |
|
499 |
+
/* IF SEO INDEX IS OFF */
|
500 |
+
if (self::getPrivateBlog()) {
|
501 |
self::$errors_count++;
|
502 |
+
if (!$count_only) {
|
503 |
+
SQ_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');
|
504 |
+
}
|
505 |
+
}
|
506 |
|
507 |
+
if (self::getBadLinkStructure()) {
|
|
|
508 |
self::$errors_count++;
|
509 |
+
if (!$count_only) {
|
510 |
+
SQ_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');
|
511 |
+
}
|
512 |
+
}
|
513 |
+
|
514 |
+
if (self::$errors_count == 0) {
|
515 |
+
self::saveOptions('sq_areissues', 0);
|
516 |
+
SQ_Error::setError(__('Great! We didn\'t find any issue in your site.', _SQ_PLUGIN_NAME_) . " <br /> ", 'success');
|
517 |
+
} else {
|
518 |
+
self::saveOptions('sq_areissues', 1);
|
519 |
+
}
|
520 |
}
|
521 |
}
|
522 |
|
601 |
return ($total > 1);
|
602 |
}
|
603 |
|
604 |
+
/**
|
605 |
+
* Check for META duplicates
|
606 |
+
* @return boolean
|
607 |
+
*/
|
608 |
+
private static function getDuplicateTitle() {
|
609 |
+
if (!function_exists('preg_match_all')) {
|
610 |
+
return false;
|
611 |
+
}
|
612 |
+
$total = 0;
|
613 |
+
|
614 |
+
if (self::$options['sq_use'] == 1 && self::$options['sq_auto_title'] == 1) {
|
615 |
+
if (self::$source_code <> '') {
|
616 |
+
preg_match_all("/<title[^>]*>(.*)?<\/title>/i", self::$source_code, $out);
|
617 |
+
if (!empty($out) && isset($out[0]) && is_array($out[0])) {
|
618 |
+
$total += sizeof($out[0]);
|
619 |
+
}
|
620 |
+
preg_match_all("/<meta[^>]*name=[\"|\']title[\"|\'][^>]*content=[\"|\']([^>\"]*)[\"|\'][^>]*>/i", self::$source_code, $out);
|
621 |
+
if (!empty($out) && isset($out[0]) && is_array($out[0])) {
|
622 |
+
$total += sizeof($out[0]);
|
623 |
+
}
|
624 |
+
}
|
625 |
+
}
|
626 |
+
|
627 |
+
return ($total > 1);
|
628 |
+
}
|
629 |
+
|
630 |
/**
|
631 |
* Check if the blog is in private mode
|
632 |
* @return bool
|
763 |
'description' => 240,
|
764 |
'url' => 45);
|
765 |
|
766 |
+
self::$source_code = self::sq_remote_get($url, array(), array('timeout' => 10, 'followlocation' => true));
|
|
|
|
|
|
|
|
|
767 |
|
768 |
$title_regex = "/<title[^>]*>([^<>]*)<\/title>/si";
|
769 |
preg_match($title_regex, self::$source_code, $title);
|
776 |
$description_regex = '/<meta[^<>]*description[^<>]*content="([^"<>]+)"[^<>]*>/si';
|
777 |
preg_match($description_regex, self::$source_code, $description);
|
778 |
if (is_array($description) && count($description) > 0) {
|
779 |
+
$snippet['description'] = self::i18n(trim(strip_tags($description[1])));
|
780 |
|
781 |
if (strlen($snippet['description']) > $length['description'])
|
782 |
$snippet['description'] = substr($snippet['description'], 0, ($length['description'] - 1)) . '...';
|
795 |
private function checkDebug() {
|
796 |
//if debug is called
|
797 |
if (self::getIsset('sq_debug')) {
|
798 |
+
if (self::getValue('sq_debug') == self::$options['sq_api']) {
|
|
|
|
|
799 |
$_GET['sq_debug'] = 'on';
|
800 |
+
} else {
|
|
|
|
|
801 |
$_GET['sq_debug'] = 'off';
|
802 |
+
}
|
803 |
|
804 |
if (self::getValue('sq_debug') === 'on') {
|
805 |
+
if (function_exists('register_shutdown_function')) {
|
806 |
register_shutdown_function(array($this, 'showDebug'));
|
807 |
+
}
|
808 |
}
|
809 |
}
|
810 |
}
|
813 |
* Store the debug for a later view
|
814 |
*/
|
815 |
public static function dump() {
|
816 |
+
if (self::getValue('sq_debug') !== 'on') {
|
817 |
+
return;
|
818 |
+
}
|
819 |
+
|
820 |
$output = '';
|
821 |
$callee = array('file' => '', 'line' => '');
|
822 |
if (function_exists('func_get_args')) {
|
826 |
$arguments = array();
|
827 |
|
828 |
|
829 |
+
$run_time = number_format(microtime(true) - REQUEST_TIME, 3);
|
830 |
if (function_exists('debug_backtrace'))
|
831 |
list( $callee ) = debug_backtrace();
|
832 |
|
833 |
$output .= '<fieldset style="background: #FFFFFF; border: 1px #CCCCCC solid; padding: 5px; font-size: 9pt; margin: 0;">';
|
834 |
+
$output .= '<legend style="background: #EEEEEE; padding: 2px; font-size: 8pt;">' . $callee['file'] . ' Time: ' . $run_time . ' @ line: ' . $callee['line']
|
835 |
. '</legend><pre style="margin: 0; font-size: 8pt; text-align: left;">';
|
836 |
|
837 |
$i = 0;
|
863 |
}
|
864 |
|
865 |
public function sq_activate() {
|
866 |
+
set_transient('sq_activate', true);
|
867 |
+
set_transient('sq_rewrite', true);
|
868 |
}
|
869 |
|
870 |
public function sq_deactivate() {
|
874 |
$args = array();
|
875 |
$args['type'] = 'deact';
|
876 |
SQ_Action::apiCall('sq/user/log', $args, 5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
877 |
|
878 |
+
remove_filter('rewrite_rules_array', array(SQ_ObjController::getBlock('SQ_BlockSettingsSeo'), 'rewrite_rules'), 999, 1);
|
879 |
+
global $wp_rewrite;
|
880 |
+
$wp_rewrite->flush_rules();
|
|
|
881 |
}
|
882 |
|
883 |
public static function emptyCache($post_id = null) {
|
897 |
}
|
898 |
}
|
899 |
|
900 |
+
public static function checkUpgrade() {
|
901 |
+
if (self::$options['sq_ver'] == 0 || self::$options['sq_ver'] < SQ_VERSION_ID) {
|
902 |
+
//Delete the old versions table
|
903 |
+
global $wpdb;
|
904 |
+
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_fp_title' WHERE `meta_key` = 'sq_fp_title'");
|
905 |
+
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_fp_description' WHERE `meta_key` = 'sq_fp_description'");
|
906 |
+
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_fp_ogimage' WHERE `meta_key` = 'sq_fp_ogimage'");
|
907 |
+
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_fp_keywords' WHERE `meta_key` = 'sq_fp_keywords'");
|
908 |
+
$wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_post_keyword' WHERE `meta_key` = 'sq_post_keyword'");
|
909 |
|
910 |
+
self::saveOptions('sq_ver', SQ_VERSION_ID);
|
911 |
+
}
|
912 |
+
}
|
913 |
+
|
914 |
+
}
|
config/config.php
CHANGED
@@ -5,6 +5,9 @@
|
|
5 |
*/
|
6 |
define('_SQ_SUPPORT_EMAIL_', 'support@squirrly.co');
|
7 |
define('_SQ_NONCE_ID_', NONCE_KEY);
|
|
|
|
|
|
|
8 |
|
9 |
if (!defined('PHP_VERSION_ID')) {
|
10 |
$version = explode('.', PHP_VERSION);
|
@@ -27,5 +30,4 @@ require_once(dirname(__FILE__) . '/paths.php');
|
|
27 |
|
28 |
/* Define the record name in the Option and UserMeta tables */
|
29 |
define('SQ_OPTION', 'sq_options');
|
30 |
-
define('SQ_META', 'sq_plugin_flash');
|
31 |
?>
|
5 |
*/
|
6 |
define('_SQ_SUPPORT_EMAIL_', 'support@squirrly.co');
|
7 |
define('_SQ_NONCE_ID_', NONCE_KEY);
|
8 |
+
define('_SQ_MOBILE_ICON_SIZES', '76,120,152');
|
9 |
+
define('REQUEST_TIME', microtime(true));
|
10 |
+
|
11 |
|
12 |
if (!defined('PHP_VERSION_ID')) {
|
13 |
$version = explode('.', PHP_VERSION);
|
30 |
|
31 |
/* Define the record name in the Option and UserMeta tables */
|
32 |
define('SQ_OPTION', 'sq_options');
|
|
|
33 |
?>
|
controllers/SQ_Frontend.php
CHANGED
@@ -5,11 +5,21 @@ class SQ_Frontend extends SQ_FrontController {
|
|
5 |
public static $options;
|
6 |
|
7 |
public function __construct() {
|
|
|
8 |
if ($this->_isAjax())
|
9 |
return;
|
10 |
|
11 |
parent::__construct();
|
12 |
SQ_ObjController::getController('SQ_Tools', false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
|
15 |
private function _isAjax() {
|
@@ -29,13 +39,29 @@ class SQ_Frontend extends SQ_FrontController {
|
|
29 |
SQ_Tools::$options['sq_use'] = 0;
|
30 |
}
|
31 |
|
|
|
32 |
if (SQ_Tools::$options['sq_use'] == 1) {
|
33 |
-
if ($this->_isAjax())
|
34 |
return;
|
|
|
|
|
|
|
|
|
|
|
35 |
//Use buffer only for meta Title
|
36 |
-
//if(SQ_Tools::$options['sq_auto_title'] == 1)
|
37 |
$this->model->startBuffer();
|
38 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
/**
|
@@ -48,11 +74,11 @@ class SQ_Frontend extends SQ_FrontController {
|
|
48 |
echo $this->model->setStart();
|
49 |
|
50 |
if (isset(SQ_Tools::$options['sq_use']) && (int) SQ_Tools::$options['sq_use'] == 1) {
|
51 |
-
|
52 |
-
|
53 |
-
//Use buffer only for meta Title
|
54 |
-
//if(SQ_Tools::$options['sq_auto_title'] == 1)
|
55 |
$this->model->flushHeader();
|
|
|
|
|
|
|
56 |
}
|
57 |
|
58 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
@@ -82,6 +108,20 @@ class SQ_Frontend extends SQ_FrontController {
|
|
82 |
}
|
83 |
}
|
84 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
if (!is_array($urls) || (is_array($urls) && empty($urls)))
|
86 |
return $content;
|
87 |
|
@@ -97,12 +137,41 @@ class SQ_Frontend extends SQ_FrontController {
|
|
97 |
}
|
98 |
|
99 |
/**
|
100 |
-
*
|
|
|
|
|
|
|
|
|
101 |
*/
|
102 |
-
public function
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
}
|
107 |
}
|
108 |
|
5 |
public static $options;
|
6 |
|
7 |
public function __construct() {
|
8 |
+
|
9 |
if ($this->_isAjax())
|
10 |
return;
|
11 |
|
12 |
parent::__construct();
|
13 |
SQ_ObjController::getController('SQ_Tools', false);
|
14 |
+
|
15 |
+
/* Check if sitemap is on */
|
16 |
+
if (SQ_Tools::$options['sq_use'] == 1 && SQ_Tools::$options['sq_auto_sitemap'] == 1) {
|
17 |
+
/* Load the Sitemap */
|
18 |
+
SQ_ObjController::getController('SQ_Sitemaps');
|
19 |
+
}
|
20 |
+
|
21 |
+
//validate custom arguments for favicon and sitemap
|
22 |
+
add_filter('query_vars', array($this, 'validateParams'), 1, 1);
|
23 |
}
|
24 |
|
25 |
private function _isAjax() {
|
39 |
SQ_Tools::$options['sq_use'] = 0;
|
40 |
}
|
41 |
|
42 |
+
|
43 |
if (SQ_Tools::$options['sq_use'] == 1) {
|
44 |
+
if ($this->_isAjax()) {
|
45 |
return;
|
46 |
+
}
|
47 |
+
|
48 |
+
add_filter('sq_title', array($this->model, 'clearTitle'));
|
49 |
+
add_filter('sq_description', array($this->model, 'clearDescription'));
|
50 |
+
|
51 |
//Use buffer only for meta Title
|
|
|
52 |
$this->model->startBuffer();
|
53 |
}
|
54 |
+
|
55 |
+
//Check for sitemap and robots
|
56 |
+
if (SQ_Tools::$options['sq_use'] == 1) {
|
57 |
+
if (isset($_SERVER['REQUEST_URI']) && SQ_Tools::$options['sq_auto_robots'] == 1) {
|
58 |
+
if (substr(strrchr($_SERVER['REQUEST_URI'], "/"), 1) == "robots.txt" || $_SERVER['REQUEST_URI'] == "/robots.txt") {
|
59 |
+
$this->model->robots();
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
//check the action call
|
64 |
+
$this->action();
|
65 |
}
|
66 |
|
67 |
/**
|
74 |
echo $this->model->setStart();
|
75 |
|
76 |
if (isset(SQ_Tools::$options['sq_use']) && (int) SQ_Tools::$options['sq_use'] == 1) {
|
77 |
+
//flush the header with the title and removing duplicates
|
|
|
|
|
|
|
78 |
$this->model->flushHeader();
|
79 |
+
|
80 |
+
//show the Squirrly header
|
81 |
+
echo $this->model->setHeader();
|
82 |
}
|
83 |
|
84 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
108 |
}
|
109 |
}
|
110 |
}
|
111 |
+
|
112 |
+
@preg_match_all('/<a[^>]*href="([^"]+)"[^>]*>/i', $content, $out);
|
113 |
+
if (is_array($out)) {
|
114 |
+
if (!is_array($out[1]) || empty($out[1]))
|
115 |
+
return $content;
|
116 |
+
|
117 |
+
foreach ($out[1] as $row) {
|
118 |
+
if (strpos($row, '//') === false) {
|
119 |
+
if (!in_array($row, $urls)) {
|
120 |
+
$urls[] = $row;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}
|
125 |
if (!is_array($urls) || (is_array($urls) && empty($urls)))
|
126 |
return $content;
|
127 |
|
137 |
}
|
138 |
|
139 |
/**
|
140 |
+
* Validate the params for getting the basic info from the server
|
141 |
+
* eg favicon.ico
|
142 |
+
*
|
143 |
+
* @param array $vars
|
144 |
+
* @return $vars
|
145 |
*/
|
146 |
+
public function validateParams($vars) {
|
147 |
+
$vars[] = 'sq_get';
|
148 |
+
$vars[] = 'sq_size';
|
149 |
+
return $vars;
|
150 |
+
}
|
151 |
+
|
152 |
+
public function action() {
|
153 |
+
|
154 |
+
switch (get_query_var('sq_get')) {
|
155 |
+
case 'favicon':
|
156 |
+
if (SQ_Tools::$options['favicon'] <> '') {
|
157 |
+
//show the favico file
|
158 |
+
SQ_Tools::setHeader('ico');
|
159 |
+
echo readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon']);
|
160 |
+
exit();
|
161 |
+
}
|
162 |
+
break;
|
163 |
+
case 'touchicon':
|
164 |
+
$size = get_query_var('sq_size');
|
165 |
+
if (SQ_Tools::$options['favicon'] <> '') {
|
166 |
+
//show the favico file
|
167 |
+
SQ_Tools::setHeader('png');
|
168 |
+
if ($size <> '') {
|
169 |
+
echo readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon'] . get_query_var('sq_size'));
|
170 |
+
} else {
|
171 |
+
echo readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon']);
|
172 |
+
}
|
173 |
+
exit();
|
174 |
+
}
|
175 |
}
|
176 |
}
|
177 |
|
controllers/SQ_Menu.php
CHANGED
@@ -8,128 +8,95 @@ class SQ_Menu extends SQ_FrontController {
|
|
8 |
/** @var array snippet */
|
9 |
var $options = array();
|
10 |
|
|
|
|
|
|
|
|
|
|
|
11 |
/**
|
12 |
-
*
|
13 |
-
*
|
14 |
-
* @global type $wpdb
|
15 |
-
* @return type
|
16 |
*/
|
17 |
-
public function
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
}
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
-
exit();
|
37 |
}
|
38 |
|
39 |
/**
|
40 |
* Creates the Setting menu in Wordpress
|
41 |
*/
|
42 |
public function hookMenu() {
|
43 |
-
$first_page = preg_replace('/\s/', '_', _SQ_NAME_);
|
44 |
-
$this->post_type = array('post', 'page', 'movie', 'product', 'download', 'shopp_page_shopp-products');
|
45 |
|
46 |
-
|
47 |
-
if (SQ_Tools::getIsset('post_type')) {
|
48 |
-
if (SQ_Tools::getValue('post_type') <> '') {
|
49 |
-
array_push($this->post_type, SQ_Tools::getValue('post_type'));
|
50 |
-
}
|
51 |
-
} elseif (SQ_Tools::getIsset('post')) {
|
52 |
-
$post = get_post(SQ_Tools::getValue('post'));
|
53 |
-
if (isset($post->post_type)) {
|
54 |
-
array_push($this->post_type, $post->post_type);
|
55 |
-
}
|
56 |
-
} elseif (SQ_Tools::getIsset('id')) {
|
57 |
-
$post = get_post(SQ_Tools::getValue('id'));
|
58 |
-
if (isset($post->post_type)) {
|
59 |
-
array_push($this->post_type, $post->post_type);
|
60 |
-
}
|
61 |
-
}
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
$first_page = 'sq_dashboard';
|
67 |
}
|
68 |
-
|
69 |
-
|
70 |
-
if (current_user_can('manage_options')) {
|
71 |
-
SQ_Tools::checkErrorSettings(true);
|
72 |
-
//check if activated
|
73 |
-
$this->checkActivation();
|
74 |
-
//activate the cron job if not exists
|
75 |
-
if (!wp_get_schedule('sq_processCron')) {
|
76 |
-
wp_schedule_event(time(), 'hourly', 'sq_processCron');
|
77 |
-
}
|
78 |
}
|
79 |
|
80 |
-
//Push the Analytics Check
|
81 |
$analytics_alert = 0;
|
82 |
-
if (SQ_ObjController::getModel('SQ_Post')->countKeywords() > 0) {
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
if (strpos($_SERVER['REQUEST_URI'], '?page=sq_dashboard') !== false) {
|
88 |
-
SQ_Tools::saveOptions('sq_dashboard', 1);
|
89 |
} else {
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
set_transient('sq_dashboard', time(), (60 * 60 * 24 * 7));
|
94 |
-
} else {
|
95 |
-
$time_loaded = get_transient('sq_dashboard');
|
96 |
-
if (time() - $time_loaded > (60 * 60 * 24 * 3)) {
|
97 |
-
SQ_Error::setError(__('Check out your SEO Audit and the Performance Analytics section. <a href="admin.php?page=sq_dashboard" title="Squirrly Dashboard">Click here</a>', _SQ_PLUGIN_NAME_));
|
98 |
-
}
|
99 |
-
}
|
100 |
}
|
101 |
}
|
102 |
}
|
103 |
|
104 |
-
SQ_Tools::$
|
105 |
-
|
|
|
|
|
|
|
106 |
|
107 |
$this->model->addMenu(array(ucfirst(_SQ_NAME_),
|
108 |
'Squirrly' . SQ_Tools::showNotices(SQ_Tools::$errors_count, 'errors_count'),
|
109 |
'edit_posts',
|
110 |
-
|
111 |
null,
|
112 |
-
_SQ_THEME_URL_ . 'img/menu_icon_16.png'
|
113 |
));
|
114 |
-
if (SQ_Tools::$options['sq_api'] == '') {
|
115 |
-
$this->model->addSubmenu(array($first_page,
|
116 |
-
ucfirst(_SQ_NAME_) . __(' getting started', _SQ_PLUGIN_NAME_),
|
117 |
-
__('Getting started', _SQ_PLUGIN_NAME_),
|
118 |
-
'edit_posts',
|
119 |
-
'sq_howto',
|
120 |
-
array(SQ_ObjController::getBlock('SQ_BlockHelp'), 'init')
|
121 |
-
));
|
122 |
-
}
|
123 |
-
if (SQ_Tools::$options['sq_api'] <> '') {
|
124 |
-
$this->model->addSubmenu(array($first_page,
|
125 |
-
ucfirst(_SQ_NAME_) . __(' dashboard', _SQ_PLUGIN_NAME_),
|
126 |
-
__('Dashboard', _SQ_PLUGIN_NAME_),
|
127 |
-
'edit_posts',
|
128 |
-
'sq_dashboard',
|
129 |
-
array(SQ_ObjController::getBlock('SQ_BlockDashboard'), 'init')
|
130 |
-
));
|
131 |
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
ucfirst(_SQ_NAME_) . __(' post list', _SQ_PLUGIN_NAME_),
|
134 |
__('Performance <br />Analytics', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices($analytics_alert, 'errors_count'),
|
135 |
'edit_posts',
|
@@ -137,26 +104,35 @@ class SQ_Menu extends SQ_FrontController {
|
|
137 |
array(SQ_ObjController::getBlock('SQ_BlockPostsAnalytics'), 'init')
|
138 |
));
|
139 |
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
ucfirst(_SQ_NAME_) . __(' account info', _SQ_PLUGIN_NAME_),
|
142 |
__('Account Info', _SQ_PLUGIN_NAME_),
|
143 |
'manage_options',
|
144 |
'sq_account',
|
145 |
array(SQ_ObjController::getBlock('SQ_BlockAccount'), 'init')
|
146 |
));
|
147 |
-
|
148 |
-
$this->model->addSubmenu(array($first_page,
|
149 |
-
ucfirst(_SQ_NAME_) . __(' settings', _SQ_PLUGIN_NAME_),
|
150 |
-
__('SEO Settings', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices(SQ_Tools::$errors_count, 'errors_count'),
|
151 |
-
'manage_options',
|
152 |
-
preg_replace('/\s/', '_', _SQ_NAME_),
|
153 |
-
array($this, 'showMenu')
|
154 |
-
));
|
155 |
}
|
156 |
|
157 |
-
$this->model->addSubmenu(array(
|
158 |
-
__('
|
159 |
-
__('
|
160 |
'manage_options',
|
161 |
'sq_affiliate',
|
162 |
array(SQ_ObjController::getBlock('SQ_BlockAffiliate'), 'init')
|
@@ -173,172 +149,41 @@ class SQ_Menu extends SQ_FrontController {
|
|
173 |
|
174 |
//Add the Rank in the Posts list
|
175 |
$postlist = SQ_ObjController::getController('SQ_PostsList');
|
176 |
-
if (is_object($postlist))
|
177 |
$postlist->init();
|
178 |
-
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Show the menu content after click event
|
182 |
-
*
|
183 |
-
* @return void
|
184 |
-
*/
|
185 |
-
public function showMenu() {
|
186 |
-
/* Load the error class */
|
187 |
-
SQ_Tools::checkErrorSettings();
|
188 |
-
/* Force call of error display */
|
189 |
-
SQ_ObjController::getController('SQ_Error', false)->hookNotices();
|
190 |
-
|
191 |
-
|
192 |
-
/* Get the options from Database */
|
193 |
-
$this->options = SQ_Tools::$options;
|
194 |
-
SQ_ObjController::getBlock('SQ_BlockSupport')->init();
|
195 |
|
196 |
-
//
|
197 |
-
|
|
|
|
|
|
|
|
|
198 |
}
|
199 |
|
200 |
/**
|
201 |
-
*
|
|
|
202 |
*
|
203 |
-
* @
|
|
|
|
|
204 |
*/
|
205 |
-
public function
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
SQ_Tools::saveOptions('sq_use', (int) SQ_Tools::getValue('sq_use'));
|
216 |
-
SQ_Tools::saveOptions('sq_auto_title', (int) SQ_Tools::getValue('sq_auto_title'));
|
217 |
-
SQ_Tools::saveOptions('sq_auto_description', (int) SQ_Tools::getValue('sq_auto_description'));
|
218 |
-
SQ_Tools::saveOptions('sq_auto_canonical', (int) SQ_Tools::getValue('sq_auto_canonical'));
|
219 |
-
SQ_Tools::saveOptions('sq_auto_sitemap', (int) SQ_Tools::getValue('sq_auto_sitemap'));
|
220 |
-
SQ_Tools::saveOptions('sq_auto_meta', (int) SQ_Tools::getValue('sq_auto_meta'));
|
221 |
-
SQ_Tools::saveOptions('sq_auto_favicon', (int) SQ_Tools::getValue('sq_auto_favicon'));
|
222 |
-
SQ_Tools::saveOptions('sq_auto_facebook', (int) SQ_Tools::getValue('sq_auto_facebook'));
|
223 |
-
SQ_Tools::saveOptions('sq_auto_twitter', (int) SQ_Tools::getValue('sq_auto_twitter'));
|
224 |
-
|
225 |
-
$sq_twitter_account = SQ_Tools::getValue('sq_twitter_account');
|
226 |
-
if ($sq_twitter_account <> '')
|
227 |
-
if (strpos($sq_twitter_account, '@') === false)
|
228 |
-
$sq_twitter_account = '@' . $sq_twitter_account;
|
229 |
-
SQ_Tools::saveOptions('sq_twitter_account', $sq_twitter_account);
|
230 |
-
|
231 |
-
SQ_Tools::saveOptions('sq_auto_seo', 0);
|
232 |
-
if ($pageId = get_option('page_on_front')) {
|
233 |
-
$meta = array();
|
234 |
-
if (SQ_Tools::getIsset('sq_fp_title'))
|
235 |
-
$meta[] = array('key' => 'sq_fp_title', 'value' => urldecode(SQ_Tools::getValue('sq_fp_title')));
|
236 |
-
|
237 |
-
if (SQ_Tools::getIsset('sq_fp_description'))
|
238 |
-
$meta[] = array('key' => 'sq_fp_description', 'value' => urldecode(SQ_Tools::getValue('sq_fp_description')));
|
239 |
-
|
240 |
-
if (SQ_Tools::getIsset('sq_fp_keywords'))
|
241 |
-
$meta[] = array('key' => 'sq_fp_keywords', 'value' => SQ_Tools::getValue('sq_fp_keywords'));
|
242 |
-
|
243 |
-
if (SQ_Tools::getIsset('sq_fp_ogimage'))
|
244 |
-
$meta[] = array('key' => 'sq_fp_ogimage', 'value' => SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'ogimage'));
|
245 |
-
|
246 |
-
if (!empty($meta))
|
247 |
-
SQ_ObjController::getModel('SQ_Post')->saveAdvMeta($pageId, $meta);
|
248 |
-
}else {
|
249 |
-
SQ_Tools::saveOptions('sq_fp_title', SQ_Tools::getValue('sq_fp_title'));
|
250 |
-
SQ_Tools::saveOptions('sq_fp_description', SQ_Tools::getValue('sq_fp_description'));
|
251 |
-
SQ_Tools::saveOptions('sq_fp_keywords', SQ_Tools::getValue('sq_fp_keywords'));
|
252 |
-
}
|
253 |
-
|
254 |
-
SQ_Tools::saveOptions('sq_google_country', SQ_Tools::getValue('sq_google_country'));
|
255 |
-
SQ_Tools::saveOptions('sq_google_country_strict', SQ_Tools::getValue('sq_google_country_strict'));
|
256 |
-
|
257 |
-
|
258 |
-
SQ_Tools::saveOptions('sq_google_plus', SQ_Tools::getValue('sq_google_plus'));
|
259 |
-
SQ_Tools::saveOptions('sq_google_wt', $this->model->checkGoogleWTCode(SQ_Tools::getValue('sq_google_wt')));
|
260 |
-
SQ_Tools::saveOptions('sq_google_analytics', $this->model->checkGoogleAnalyticsCode(SQ_Tools::getValue('sq_google_analytics')));
|
261 |
-
SQ_Tools::saveOptions('sq_facebook_insights', $this->model->checkFavebookInsightsCode(SQ_Tools::getValue('sq_facebook_insights')));
|
262 |
-
SQ_Tools::saveOptions('sq_bing_wt', $this->model->checkBingWTCode(SQ_Tools::getValue('sq_bing_wt')));
|
263 |
-
SQ_Tools::saveOptions('sq_pinterest', $this->model->checkPinterestCode(SQ_Tools::getValue('sq_pinterest')));
|
264 |
-
SQ_Tools::saveOptions('sq_alexa', $this->model->checkBingWTCode(SQ_Tools::getValue('sq_alexa')));
|
265 |
-
|
266 |
-
|
267 |
-
SQ_Tools::saveOptions('ignore_warn', (int) SQ_Tools::getValue('ignore_warn'));
|
268 |
-
SQ_Tools::saveOptions('sq_keyword_help', (int) SQ_Tools::getValue('sq_keyword_help'));
|
269 |
-
SQ_Tools::saveOptions('sq_keyword_information', (int) SQ_Tools::getValue('sq_keyword_information'));
|
270 |
-
SQ_Tools::saveOptions('sq_sla', (int) SQ_Tools::getValue('sq_sla'));
|
271 |
-
SQ_Tools::saveOptions('sq_keywordtag', (int) SQ_Tools::getValue('sq_keywordtag'));
|
272 |
-
SQ_Tools::saveOptions('sq_local_images', (int) SQ_Tools::getValue('sq_local_images'));
|
273 |
-
|
274 |
-
//update_option('blog_public', (int)SQ_Tools::getValue('sq_google_index'));
|
275 |
-
|
276 |
-
/* if there is an icon to upload */
|
277 |
-
if (!empty($_FILES['favicon'])) {
|
278 |
-
|
279 |
-
$return = $this->model->addFavicon($_FILES['favicon']);
|
280 |
-
if ($return['favicon'] <> '')
|
281 |
-
SQ_Tools::saveOptions('favicon', $return['favicon']);
|
282 |
-
if ($return['name'] <> '')
|
283 |
-
SQ_Tools::saveOptions('favicon_tmp', $return['name']);
|
284 |
-
if ($return['message'] <> '')
|
285 |
-
define('SQ_MESSAGE_FAVICON', $return['message']);
|
286 |
-
}
|
287 |
-
|
288 |
-
/* Generate the sitemap */
|
289 |
-
if (SQ_Tools::getValue('sq_use'))
|
290 |
-
add_action('admin_footer', array(SQ_ObjController::getController('SQ_Sitemap', false), 'generateSitemap'), 9999, 1);
|
291 |
-
|
292 |
-
//empty the cache on settings changed
|
293 |
-
SQ_Tools::emptyCache();
|
294 |
-
break;
|
295 |
-
case 'sq_fixautoseo':
|
296 |
-
SQ_Tools::saveOptions('sq_use', 1);
|
297 |
-
break;
|
298 |
-
case 'sq_fixprivate':
|
299 |
-
update_option('blog_public', 1);
|
300 |
-
break;
|
301 |
-
case 'sq_fixcomments':
|
302 |
-
update_option('comments_notify', 1);
|
303 |
-
break;
|
304 |
-
case 'sq_fixpermalink':
|
305 |
-
$GLOBALS['wp_rewrite'] = new WP_Rewrite();
|
306 |
-
global $wp_rewrite;
|
307 |
-
$permalink_structure = ((get_option('permalink_structure') <> '') ? get_option('permalink_structure') : '/') . "%postname%/";
|
308 |
-
$wp_rewrite->set_permalink_structure($permalink_structure);
|
309 |
-
$permalink_structure = get_option('permalink_structure');
|
310 |
-
|
311 |
-
flush_rewrite_rules();
|
312 |
-
break;
|
313 |
-
case 'sq_fix_ogduplicate':
|
314 |
-
SQ_Tools::saveOptions('sq_auto_facebook', 0);
|
315 |
-
break;
|
316 |
-
case 'sq_fix_tcduplicate':
|
317 |
-
SQ_Tools::saveOptions('sq_auto_twitter', 0);
|
318 |
-
break;
|
319 |
-
case 'sq_fix_descduplicate':
|
320 |
-
SQ_Tools::saveOptions('sq_auto_description', 0);
|
321 |
-
SQ_Tools::saveOptions('sq_auto_seo', 1);
|
322 |
-
break;
|
323 |
-
|
324 |
-
case 'sq_warnings_off':
|
325 |
-
SQ_Tools::saveOptions('ignore_warn', 1);
|
326 |
-
break;
|
327 |
-
case 'sq_get_snippet':
|
328 |
-
if (SQ_Tools::getValue('url') <> '') {
|
329 |
-
$url = SQ_Tools::getValue('url');
|
330 |
-
} else {
|
331 |
-
$url = get_bloginfo('url');
|
332 |
-
}
|
333 |
-
$snippet = SQ_Tools::getSnippet($url);
|
334 |
-
//SQ_Tools::dump($snippet);
|
335 |
|
336 |
-
|
337 |
-
$snippet['url'] = get_permalink((int)SQ_Tools::getValue('post_id'));
|
338 |
-
*/
|
339 |
-
echo json_encode($snippet);
|
340 |
-
exit();
|
341 |
}
|
|
|
|
|
342 |
}
|
343 |
|
344 |
}
|
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 |
+
}
|
15 |
+
|
16 |
/**
|
17 |
+
* Hook the Admin load
|
|
|
|
|
|
|
18 |
*/
|
19 |
+
public function hookInit() {
|
20 |
+
|
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 |
+
// Delete the redirect transient
|
26 |
+
delete_transient('sq_activate');
|
27 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
28 |
|
29 |
+
wp_safe_redirect(admin_url('admin.php?page=sq_dashboard'));
|
30 |
+
exit();
|
31 |
+
}
|
32 |
|
33 |
+
if (get_transient('sq_rewrite') == 1) {
|
34 |
+
// Delete the redirect transient
|
35 |
+
delete_transient('sq_rewrite');
|
36 |
+
global $wp_rewrite;
|
37 |
+
$wp_rewrite->flush_rules();
|
38 |
+
}
|
39 |
|
40 |
+
//Check if there are expected upgrades
|
41 |
+
SQ_Tools::checkUpgrade();
|
42 |
+
}
|
43 |
+
//activate the cron job if not exists
|
44 |
+
if (!wp_get_schedule('sq_processCron')) {
|
45 |
+
wp_schedule_event(time(), 'hourly', 'sq_processCron');
|
46 |
}
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
* Creates the Setting menu in Wordpress
|
51 |
*/
|
52 |
public function hookMenu() {
|
|
|
|
|
53 |
|
54 |
+
$this->post_type = SQ_Tools::$options['sq_post_types'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
+
//Push the Analytics Check
|
57 |
+
if (strpos($_SERVER['REQUEST_URI'], '?page=sq_dashboard') !== false) {
|
58 |
+
SQ_Tools::saveOptions('sq_dashboard', 1);
|
|
|
59 |
}
|
60 |
+
if (strpos($_SERVER['REQUEST_URI'], '?page=sq_analytics') !== false) {
|
61 |
+
SQ_Tools::saveOptions('sq_analytics', 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
|
|
64 |
$analytics_alert = 0;
|
65 |
+
if (SQ_ObjController::getModel('SQ_Post')->countKeywords() > 0 && SQ_Tools::$options['sq_analytics'] == 0) {
|
66 |
+
$analytics_alert = 1;
|
67 |
+
if (!get_transient('sq_analytics')) {
|
68 |
+
set_transient('sq_analytics', time(), (60 * 60 * 24 * 7));
|
|
|
|
|
|
|
69 |
} else {
|
70 |
+
$time_loaded = get_transient('sq_analytics');
|
71 |
+
if (time() - $time_loaded > (60 * 60 * 24 * 3)) {
|
72 |
+
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_));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
}
|
75 |
}
|
76 |
|
77 |
+
$dashboard_alert = (int) (SQ_Tools::$options['sq_dashboard'] == 0);
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
///////////////
|
82 |
|
83 |
$this->model->addMenu(array(ucfirst(_SQ_NAME_),
|
84 |
'Squirrly' . SQ_Tools::showNotices(SQ_Tools::$errors_count, 'errors_count'),
|
85 |
'edit_posts',
|
86 |
+
'sq_dashboard',
|
87 |
null,
|
88 |
+
_SQ_THEME_URL_ . 'img/settings/menu_icon_16.png'
|
89 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
92 |
+
ucfirst(_SQ_NAME_) . __(' dashboard', _SQ_PLUGIN_NAME_),
|
93 |
+
( (SQ_Tools::$options['sq_api'] == '') ? __('First Step', _SQ_PLUGIN_NAME_) : __('Dashboard', _SQ_PLUGIN_NAME_)) . SQ_Tools::showNotices($dashboard_alert, 'errors_count'),
|
94 |
+
'edit_posts',
|
95 |
+
'sq_dashboard',
|
96 |
+
array(SQ_ObjController::getBlock('SQ_BlockDashboard'), 'init')
|
97 |
+
));
|
98 |
+
if (SQ_Tools::$options['sq_api'] <> '') {
|
99 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
100 |
ucfirst(_SQ_NAME_) . __(' post list', _SQ_PLUGIN_NAME_),
|
101 |
__('Performance <br />Analytics', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices($analytics_alert, 'errors_count'),
|
102 |
'edit_posts',
|
104 |
array(SQ_ObjController::getBlock('SQ_BlockPostsAnalytics'), 'init')
|
105 |
));
|
106 |
|
107 |
+
|
108 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
109 |
+
ucfirst(_SQ_NAME_) . __(' settings', _SQ_PLUGIN_NAME_),
|
110 |
+
__('SEO', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices(SQ_Tools::$errors_count, 'errors_count'),
|
111 |
+
'manage_options',
|
112 |
+
'sq_seo',
|
113 |
+
array(SQ_ObjController::getBlock('SQ_BlockSettingsSeo'), 'init')
|
114 |
+
));
|
115 |
+
|
116 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
117 |
+
ucfirst(_SQ_NAME_) . __(' Settings', _SQ_PLUGIN_NAME_),
|
118 |
+
__('Settings', _SQ_PLUGIN_NAME_),
|
119 |
+
'manage_options',
|
120 |
+
'sq_settings',
|
121 |
+
array(SQ_ObjController::getBlock('SQ_BlockSettings'), 'init')
|
122 |
+
));
|
123 |
+
|
124 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
125 |
ucfirst(_SQ_NAME_) . __(' account info', _SQ_PLUGIN_NAME_),
|
126 |
__('Account Info', _SQ_PLUGIN_NAME_),
|
127 |
'manage_options',
|
128 |
'sq_account',
|
129 |
array(SQ_ObjController::getBlock('SQ_BlockAccount'), 'init')
|
130 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
|
133 |
+
$this->model->addSubmenu(array('sq_dashboard',
|
134 |
+
__('Become an Affiliate with ', _SQ_PLUGIN_NAME_) . ucfirst(_SQ_NAME_),
|
135 |
+
__('Affiliate plan', _SQ_PLUGIN_NAME_),
|
136 |
'manage_options',
|
137 |
'sq_affiliate',
|
138 |
array(SQ_ObjController::getBlock('SQ_BlockAffiliate'), 'init')
|
149 |
|
150 |
//Add the Rank in the Posts list
|
151 |
$postlist = SQ_ObjController::getController('SQ_PostsList');
|
152 |
+
if (is_object($postlist)) {
|
153 |
$postlist->init();
|
154 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
+
//Show bar to go back and finish the help
|
157 |
+
if ($this->is_page('edit') || strpos($_SERVER['REQUEST_URI'], 'sq_posts') !== false) {
|
158 |
+
if (SQ_Tools::$options['active_help'] <> '' && SQ_Tools::$options['ignore_warn'] == 0) {
|
159 |
+
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');
|
160 |
+
}
|
161 |
+
}
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
+
* Is the user on page name? Default name = post edit page
|
166 |
+
* name = 'quirrly'
|
167 |
*
|
168 |
+
* @global array $pagenow
|
169 |
+
* @param string $name
|
170 |
+
* @return boolean
|
171 |
*/
|
172 |
+
public function is_page($name = '') {
|
173 |
+
global $pagenow;
|
174 |
+
$page = array();
|
175 |
+
//make sure we are on the backend
|
176 |
+
if (is_admin() && $name <> '') {
|
177 |
+
if ($name == 'edit') {
|
178 |
+
$page = array('post.php', 'post-new.php');
|
179 |
+
} else {
|
180 |
+
array_push($page, $name . '.php');
|
181 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
+
return in_array($pagenow, $page);
|
|
|
|
|
|
|
|
|
184 |
}
|
185 |
+
|
186 |
+
return false;
|
187 |
}
|
188 |
|
189 |
}
|
controllers/SQ_Post.php
CHANGED
@@ -20,9 +20,11 @@ class SQ_Post extends SQ_FrontController {
|
|
20 |
return;
|
21 |
|
22 |
add_action('save_post', array($this, 'hookSavePost'), 11);
|
23 |
-
|
24 |
-
//For Shopp plugin - product
|
25 |
add_action('shopp_product_saved', array($this, 'hookShopp'), 11);
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
/**
|
@@ -193,7 +195,8 @@ class SQ_Post extends SQ_FrontController {
|
|
193 |
$args['author'] = (int) SQ_Tools::getUserID();
|
194 |
$args['post_id'] = $post_id;
|
195 |
|
196 |
-
|
|
|
197 |
|
198 |
//Save the keyword for this post
|
199 |
if ($json = $this->model->getKeyword($post_id)) {
|
@@ -233,22 +236,24 @@ class SQ_Post extends SQ_FrontController {
|
|
233 |
if (!empty($_FILES['ogimage'])) {
|
234 |
$return = $this->model->addImage($_FILES['ogimage']);
|
235 |
}
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
|
|
249 |
SQ_Tools::setHeader('json');
|
250 |
echo json_encode($return);
|
251 |
SQ_Tools::emptyCache();
|
|
|
252 |
break;
|
253 |
case 'sq_get_keyword':
|
254 |
SQ_Tools::setHeader('json');
|
@@ -274,25 +279,34 @@ class SQ_Post extends SQ_FrontController {
|
|
274 |
$meta = array();
|
275 |
if (SQ_Tools::getIsset('sq_fp_title') || SQ_Tools::getIsset('sq_fp_description') || SQ_Tools::getIsset('sq_fp_keywords')) {
|
276 |
if (SQ_Tools::getIsset('sq_fp_title'))
|
277 |
-
$meta[] = array('key' => '
|
278 |
-
'value' =>
|
279 |
|
280 |
if (SQ_Tools::getIsset('sq_fp_description'))
|
281 |
-
$meta[] = array('key' => '
|
282 |
-
'value' =>
|
283 |
|
284 |
if (SQ_Tools::getIsset('sq_fp_keywords'))
|
285 |
-
$meta[] = array('key' => '
|
286 |
'value' => SQ_Tools::getValue('sq_fp_keywords'));
|
287 |
|
288 |
if (SQ_Tools::getIsset('sq_fp_ogimage'))
|
289 |
-
$meta[] = array('key' => '
|
290 |
'value' => SQ_Tools::getValue('sq_fp_ogimage'));
|
291 |
|
|
|
292 |
$this->model->saveAdvMeta($post_id, $meta);
|
|
|
293 |
return $meta;
|
294 |
}
|
295 |
return false;
|
296 |
}
|
297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
}
|
20 |
return;
|
21 |
|
22 |
add_action('save_post', array($this, 'hookSavePost'), 11);
|
|
|
|
|
23 |
add_action('shopp_product_saved', array($this, 'hookShopp'), 11);
|
24 |
+
|
25 |
+
if (SQ_Tools::$options['sq_use'] == 1 && SQ_Tools::$options['sq_auto_sitemap'] == 1) {
|
26 |
+
add_action('transition_post_status', array(SQ_ObjController::getController('SQ_Sitemaps'), 'refreshSitemap'), 9999, 3);
|
27 |
+
}
|
28 |
}
|
29 |
|
30 |
/**
|
195 |
$args['author'] = (int) SQ_Tools::getUserID();
|
196 |
$args['post_id'] = $post_id;
|
197 |
|
198 |
+
//save for later send to api
|
199 |
+
set_transient('sq_seopost', json_encode($args));
|
200 |
|
201 |
//Save the keyword for this post
|
202 |
if ($json = $this->model->getKeyword($post_id)) {
|
236 |
if (!empty($_FILES['ogimage'])) {
|
237 |
$return = $this->model->addImage($_FILES['ogimage']);
|
238 |
}
|
239 |
+
if (isset($return['file'])) {
|
240 |
+
$return['filename'] = basename($return['file']);
|
241 |
+
$local_file = str_replace($return['filename'], urlencode($return['filename']), $return['url']);
|
242 |
+
$attach_id = wp_insert_attachment(array(
|
243 |
+
'post_mime_type' => $return['type'],
|
244 |
+
'post_title' => preg_replace('/\.[^.]+$/', '', $return['filename']),
|
245 |
+
'post_content' => '',
|
246 |
+
'post_status' => 'inherit',
|
247 |
+
'guid' => $local_file
|
248 |
+
), $return['file'], SQ_Tools::getValue('post_id'));
|
249 |
+
|
250 |
+
$attach_data = wp_generate_attachment_metadata($attach_id, $return['file']);
|
251 |
+
wp_update_attachment_metadata($attach_id, $attach_data);
|
252 |
+
}
|
253 |
SQ_Tools::setHeader('json');
|
254 |
echo json_encode($return);
|
255 |
SQ_Tools::emptyCache();
|
256 |
+
|
257 |
break;
|
258 |
case 'sq_get_keyword':
|
259 |
SQ_Tools::setHeader('json');
|
279 |
$meta = array();
|
280 |
if (SQ_Tools::getIsset('sq_fp_title') || SQ_Tools::getIsset('sq_fp_description') || SQ_Tools::getIsset('sq_fp_keywords')) {
|
281 |
if (SQ_Tools::getIsset('sq_fp_title'))
|
282 |
+
$meta[] = array('key' => '_sq_fp_title',
|
283 |
+
'value' => SQ_Tools::getValue('sq_fp_title'));
|
284 |
|
285 |
if (SQ_Tools::getIsset('sq_fp_description'))
|
286 |
+
$meta[] = array('key' => '_sq_fp_description',
|
287 |
+
'value' => SQ_Tools::getValue('sq_fp_description'));
|
288 |
|
289 |
if (SQ_Tools::getIsset('sq_fp_keywords'))
|
290 |
+
$meta[] = array('key' => '_sq_fp_keywords',
|
291 |
'value' => SQ_Tools::getValue('sq_fp_keywords'));
|
292 |
|
293 |
if (SQ_Tools::getIsset('sq_fp_ogimage'))
|
294 |
+
$meta[] = array('key' => '_sq_fp_ogimage',
|
295 |
'value' => SQ_Tools::getValue('sq_fp_ogimage'));
|
296 |
|
297 |
+
|
298 |
$this->model->saveAdvMeta($post_id, $meta);
|
299 |
+
|
300 |
return $meta;
|
301 |
}
|
302 |
return false;
|
303 |
}
|
304 |
|
305 |
+
public function hookFooter() {
|
306 |
+
if (get_transient('sq_seopost') !== false) {
|
307 |
+
SQ_Action::apiCall('sq/seo/post', (array) json_decode(get_transient('sq_seopost')), 30);
|
308 |
+
delete_transient('sq_seopost');
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
}
|
controllers/SQ_PostsList.php
CHANGED
@@ -23,7 +23,6 @@ class SQ_PostsList extends SQ_FrontController {
|
|
23 |
'page_posts',
|
24 |
'edit-product',
|
25 |
'product_posts');
|
26 |
-
// do_action('sq_processCron');
|
27 |
}
|
28 |
|
29 |
public function setPosts($posts) {
|
@@ -150,6 +149,9 @@ class SQ_PostsList extends SQ_FrontController {
|
|
150 |
|
151 |
echo '<script type="text/javascript">
|
152 |
var sq_posts = new Array(' . $posts . ');
|
|
|
|
|
|
|
153 |
</script>';
|
154 |
|
155 |
$this->setVars();
|
@@ -279,7 +281,9 @@ class SQ_PostsList extends SQ_FrontController {
|
|
279 |
}
|
280 |
|
281 |
$response = json_decode(SQ_Action::apiCall('sq/user-analytics/detail', $args, 30));
|
282 |
-
|
|
|
|
|
283 |
if (!is_object($response)) {
|
284 |
exit(json_encode(array('error' => $response)));
|
285 |
} else {
|
23 |
'page_posts',
|
24 |
'edit-product',
|
25 |
'product_posts');
|
|
|
26 |
}
|
27 |
|
28 |
public function setPosts($posts) {
|
149 |
|
150 |
echo '<script type="text/javascript">
|
151 |
var sq_posts = new Array(' . $posts . ');
|
152 |
+
//Show set complete
|
153 |
+
if (jQuery(".sq_helpnotice").length > 0)
|
154 |
+
jQuery(".sq_helpnotice").slideDown();
|
155 |
</script>';
|
156 |
|
157 |
$this->setVars();
|
281 |
}
|
282 |
|
283 |
$response = json_decode(SQ_Action::apiCall('sq/user-analytics/detail', $args, 30));
|
284 |
+
if (SQ_Tools::getValue('sq_debug') === 'on') {
|
285 |
+
exit();
|
286 |
+
}
|
287 |
if (!is_object($response)) {
|
288 |
exit(json_encode(array('error' => $response)));
|
289 |
} else {
|
controllers/SQ_Sitemaps.php
ADDED
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class for Sitemap Generator
|
5 |
+
*/
|
6 |
+
class SQ_Sitemaps extends SQ_FrontController {
|
7 |
+
/* @var string root name */
|
8 |
+
|
9 |
+
var $root = 'sitemap';
|
10 |
+
/* @var string post limit */
|
11 |
+
var $posts_limit = 10000;
|
12 |
+
var $news_limit = 50;
|
13 |
+
|
14 |
+
public function __construct() {
|
15 |
+
parent::__construct();
|
16 |
+
|
17 |
+
add_filter('request', array($this, 'feedRequest'));
|
18 |
+
add_filter('user_trailingslashit', array($this, 'untrailingslashit'));
|
19 |
+
add_action('sq_processPing', array($this, 'processCron'));
|
20 |
+
}
|
21 |
+
|
22 |
+
public function refreshSitemap($new_status, $old_status, $post) {
|
23 |
+
if ($old_status <> $new_status && $new_status = 'publish') {
|
24 |
+
if (SQ_Tools::$options['sq_sitemap_ping'] == 1) {
|
25 |
+
wp_schedule_single_event(time() + 5, 'sq_processPing');
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Listen the feed call from wordpress
|
32 |
+
* @param array $request
|
33 |
+
* @return array
|
34 |
+
*/
|
35 |
+
public function feedRequest($request) {
|
36 |
+
|
37 |
+
if (isset($request['feed']) && strpos($request['feed'], 'sitemap') !== false) {
|
38 |
+
$this->model->type = $request['feed'];
|
39 |
+
|
40 |
+
//show products
|
41 |
+
if ($this->model->type == 'sitemap-product') {
|
42 |
+
if (SQ_ObjController::getModel('SQ_BlockSettingsSeo')->isEcommerce() && SQ_Tools::$options['sq_sitemap'][$this->model->type][1] == 2) {
|
43 |
+
SQ_Tools::$options['sq_sitemap'][$this->model->type][1] = 1;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
if (isset(SQ_Tools::$options['sq_sitemap'][$this->model->type]) && SQ_Tools::$options['sq_sitemap'][$this->model->type][1] == 1) {
|
48 |
+
|
49 |
+
add_action('do_feed_' . $request['feed'], array($this, 'showSitemap'));
|
50 |
+
|
51 |
+
//PREPARE CUSTOM QUERIES
|
52 |
+
switch ($this->model->type) {
|
53 |
+
|
54 |
+
case 'sitemap-news':
|
55 |
+
if ($this->model->type == 'sitemap-news') {
|
56 |
+
$this->posts_limit = $this->news_limit;
|
57 |
+
}
|
58 |
+
case 'sitemap-category':
|
59 |
+
case 'sitemap-post_tag':
|
60 |
+
case 'sitemap-custom-tax':
|
61 |
+
add_filter("get_terms_fields", function($query) {
|
62 |
+
global $wpdb;
|
63 |
+
|
64 |
+
$query[] = "(SELECT
|
65 |
+
UNIX_TIMESTAMP(MAX(p.post_date_gmt)) as _mod_date
|
66 |
+
FROM {$wpdb->posts} p, {$wpdb->term_relationships} r
|
67 |
+
WHERE p.ID = r.object_id AND p.post_status = 'publish' AND p.post_password = '' AND r.term_taxonomy_id = tt.term_taxonomy_id
|
68 |
+
) as lastmod";
|
69 |
+
|
70 |
+
return $query;
|
71 |
+
}, 5, 2);
|
72 |
+
break;
|
73 |
+
case 'sitemap-page':
|
74 |
+
add_filter('pre_get_posts', function($query) {
|
75 |
+
$query->set('post_type', array('page'));
|
76 |
+
}, 5);
|
77 |
+
break;
|
78 |
+
case 'sitemap-author':
|
79 |
+
add_filter('sq-sitemap-authors', function() {
|
80 |
+
//get only the author with posts
|
81 |
+
add_filter('pre_user_query', function($query) {
|
82 |
+
$query->query_fields .= ',p.lastmod';
|
83 |
+
$query->query_from .= ' LEFT OUTER JOIN (
|
84 |
+
SELECT MAX(post_modified) as lastmod, post_author, COUNT(*) as post_count
|
85 |
+
FROM wp_posts
|
86 |
+
WHERE post_type = "post" AND post_status = "publish"
|
87 |
+
GROUP BY post_author
|
88 |
+
) p ON (wp_users.ID = p.post_author)';
|
89 |
+
$query->query_where .= ' AND post_count > 0 ';
|
90 |
+
});
|
91 |
+
return get_users();
|
92 |
+
}, 5);
|
93 |
+
break;
|
94 |
+
case 'sitemap-custom-post':
|
95 |
+
add_filter('pre_get_posts', function($query) {
|
96 |
+
$types = get_post_types();
|
97 |
+
foreach (array('post', 'page', 'attachment', 'revision', 'nav_menu_item', 'product', 'wpsc-product') as $exclude) {
|
98 |
+
if (in_array($exclude, $types)) {
|
99 |
+
unset($types[$exclude]);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
foreach ($types as $type) {
|
104 |
+
$type_data = get_post_type_object($type);
|
105 |
+
if (!isset($type_data->rewrite['feeds']) || $type_data->rewrite['feeds'] != 1) {
|
106 |
+
unset($types[$type]);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
if (empty($types)) {
|
111 |
+
array_push($types, 'custom-post');
|
112 |
+
}
|
113 |
+
|
114 |
+
$query->set('post_type', $types); // id of page or post
|
115 |
+
}, 5);
|
116 |
+
break;
|
117 |
+
case 'sitemap-product':
|
118 |
+
add_filter('pre_get_posts', function($query) {
|
119 |
+
if (!$types = SQ_ObjController::getModel('SQ_BlockSettingsSeo')->isEcommerce()) {
|
120 |
+
$types = array('custom-post');
|
121 |
+
}
|
122 |
+
$query->set('post_type', $types); // id of page or post
|
123 |
+
}, 5);
|
124 |
+
break;
|
125 |
+
case 'sitemap-archive':
|
126 |
+
add_filter('sq-sitemap-archive', function() {
|
127 |
+
global $wpdb;
|
128 |
+
$archives = $wpdb->get_results("
|
129 |
+
SELECT DISTINCT YEAR(post_date_gmt) as `year`, MONTH(post_date_gmt) as `month`, max(post_date_gmt) as lastmod, count(ID) as posts
|
130 |
+
FROM $wpdb->posts
|
131 |
+
WHERE post_date_gmt < NOW() AND post_status = 'publish' AND post_type = 'post'
|
132 |
+
GROUP BY YEAR(post_date_gmt), MONTH(post_date_gmt)
|
133 |
+
ORDER BY post_date_gmt DESC
|
134 |
+
");
|
135 |
+
return $archives;
|
136 |
+
}, 5);
|
137 |
+
break;
|
138 |
+
}
|
139 |
+
|
140 |
+
add_filter('post_limits', array($this, 'setLimits'));
|
141 |
+
}
|
142 |
+
}
|
143 |
+
return $request;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Show the Sitemap Header
|
148 |
+
* @global integer $blog_id Used for charset
|
149 |
+
* @param array $include Include schema
|
150 |
+
*/
|
151 |
+
public function showSitemapHeader($include = array()) {
|
152 |
+
@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
|
153 |
+
global $blog_id;
|
154 |
+
|
155 |
+
header('Status: 200 OK', true, 200);
|
156 |
+
header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
|
157 |
+
//Generate header
|
158 |
+
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>' . "\n";
|
159 |
+
echo '<?xml-stylesheet type="text/xsl" href="' . _SQ_THEME_URL_ . 'css/sq_sitemap' . ($this->model->type == 'sitemap' ? 'index' : '') . '.xsl"?>' . "\n";
|
160 |
+
echo '<!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->' . "\n";
|
161 |
+
echo '<!-- generator="Squirrly SEO Sitemap" -->' . "\n";
|
162 |
+
echo '<!-- generator-url="https://wordpress.org/plugins/squirrly-seo/" -->' . "\n";
|
163 |
+
echo '<!-- generator-version="' . SQ_VERSION . '" -->' . "\n";
|
164 |
+
echo '' . "\n";
|
165 |
+
|
166 |
+
$schema = array(
|
167 |
+
'image' => 'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"',
|
168 |
+
'video' => 'xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"',
|
169 |
+
'news' => 'xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"',
|
170 |
+
'mobile' => 'xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"',
|
171 |
+
);
|
172 |
+
|
173 |
+
if (!empty($include))
|
174 |
+
$include = array_unique($include);
|
175 |
+
|
176 |
+
switch ($this->model->type) {
|
177 |
+
case 'sitemap':
|
178 |
+
echo '<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
|
179 |
+
. 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" '
|
180 |
+
. 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
|
181 |
+
foreach ($include as $value) {
|
182 |
+
echo ' ' . $schema[$value] . "\n";
|
183 |
+
}
|
184 |
+
echo '>' . "\n";
|
185 |
+
break;
|
186 |
+
case 'sitemap-news':
|
187 |
+
array_push($include, 'news');
|
188 |
+
$include = array_unique($include);
|
189 |
+
default:
|
190 |
+
echo '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
|
191 |
+
. 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" '
|
192 |
+
. 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
|
193 |
+
if (!empty($include))
|
194 |
+
foreach ($include as $value) {
|
195 |
+
echo " " . $schema[$value] . " ";
|
196 |
+
}
|
197 |
+
echo '>' . "\n";
|
198 |
+
break;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Show the Sitemap Footer
|
204 |
+
*/
|
205 |
+
private function showSitemapFooter() {
|
206 |
+
switch ($this->model->type) {
|
207 |
+
case 'sitemap':
|
208 |
+
echo '</sitemapindex>' . "\n";
|
209 |
+
break;
|
210 |
+
default :
|
211 |
+
echo '</urlset>' . "\n";
|
212 |
+
break;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Create the XML sitemap
|
218 |
+
* @return string
|
219 |
+
*/
|
220 |
+
public function showSitemap() {
|
221 |
+
|
222 |
+
switch ($this->model->type) {
|
223 |
+
case 'sitemap':
|
224 |
+
$this->showSitemapHeader();
|
225 |
+
|
226 |
+
foreach (SQ_Tools::$options['sq_sitemap'] as $name => $value) {
|
227 |
+
//force to show products if not preset
|
228 |
+
if ($name == 'sitemap-product' && !SQ_ObjController::getModel('SQ_BlockSettingsSeo')->isEcommerce()) {
|
229 |
+
continue;
|
230 |
+
}
|
231 |
+
|
232 |
+
if ($name !== 'sitemap' && ($value[1] == 1 || $value[1] == 2)) {
|
233 |
+
echo "\t" . '<sitemap>' . "\n";
|
234 |
+
echo "\t" . '<loc>' . $this->getXmlUrl($name) . '</loc>' . "\n";
|
235 |
+
echo "\t" . '<lastmod>' . mysql2date('Y-m-d\TH:i:s+00:00', get_lastpostmodified('gmt'), false) . '</lastmod>' . "\n";
|
236 |
+
echo "\t" . '</sitemap>' . "\n";
|
237 |
+
}
|
238 |
+
}
|
239 |
+
$this->showSitemapFooter();
|
240 |
+
break;
|
241 |
+
case 'sitemap-home':
|
242 |
+
$this->showPackXml($this->model->getHomeLink());
|
243 |
+
break;
|
244 |
+
case 'sitemap-news':
|
245 |
+
$this->showPackXml($this->model->getListNews());
|
246 |
+
break;
|
247 |
+
case 'sitemap-category':
|
248 |
+
case 'sitemap-post_tag':
|
249 |
+
case 'sitemap-custom-tax':
|
250 |
+
$this->showPackXml($this->model->getListTerms());
|
251 |
+
break;
|
252 |
+
case 'sitemap-author':
|
253 |
+
$this->showPackXml($this->model->getListAuthors());
|
254 |
+
break;
|
255 |
+
case 'sitemap-archive':
|
256 |
+
$this->showPackXml($this->model->getListArchive());
|
257 |
+
break;
|
258 |
+
|
259 |
+
default:
|
260 |
+
$this->showPackXml($this->model->getListPosts());
|
261 |
+
break;
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Pach the XML for each sitemap
|
267 |
+
* @param type $xml
|
268 |
+
* @return type
|
269 |
+
*/
|
270 |
+
public function showPackXml($xml) {
|
271 |
+
if (empty($xml)) {
|
272 |
+
return;
|
273 |
+
}
|
274 |
+
if (!isset($xml['contains'])) {
|
275 |
+
$xml['contains'] = '';
|
276 |
+
}
|
277 |
+
$this->showSitemapHeader($xml['contains']);
|
278 |
+
|
279 |
+
unset($xml['contains']);
|
280 |
+
foreach ($xml as $row) {
|
281 |
+
echo "\t" . '<url>' . "\n";
|
282 |
+
|
283 |
+
if (is_array($row)) {
|
284 |
+
echo $this->getRecursiveXml($row);
|
285 |
+
}
|
286 |
+
echo "\t" . '</url>' . "\n";
|
287 |
+
}
|
288 |
+
$this->showSitemapFooter();
|
289 |
+
unset($xml);
|
290 |
+
}
|
291 |
+
|
292 |
+
public function getRecursiveXml($xml, $pkey = '', $level = 2) {
|
293 |
+
$str = '';
|
294 |
+
$tab = str_repeat("\t", $level);
|
295 |
+
if (is_array($xml)) {
|
296 |
+
$cnt = 0;
|
297 |
+
foreach ($xml as $key => $data) {
|
298 |
+
if (!is_array($data)) {
|
299 |
+
$str .= $tab . '<' . $key . ($key == 'video:player_loc' ? ' allow_embed="yes"' : '') . '>' . $data . ((strpos($data, '?') == false && $key == 'video:player_loc') ? '' : '') . '</' . $key . '>' . "\n";
|
300 |
+
} else {
|
301 |
+
if ($this->getRecursiveXml($data) <> '') {
|
302 |
+
if (!$this->_ckeckIntergerArray($data)) {
|
303 |
+
$str .= $tab . '<' . (!is_numeric($key) ? $key : $pkey) . '>' . "\n";
|
304 |
+
}
|
305 |
+
$str .= $this->getRecursiveXml($data, $key, ($this->_ckeckIntergerArray($data) ? $level : $level + 1));
|
306 |
+
if (!$this->_ckeckIntergerArray($data)) {
|
307 |
+
$str .= $tab . '</' . (!is_numeric($key) ? $key : $pkey) . '>' . "\n";
|
308 |
+
}
|
309 |
+
}
|
310 |
+
}
|
311 |
+
$cnt ++;
|
312 |
+
}
|
313 |
+
}
|
314 |
+
return $str;
|
315 |
+
}
|
316 |
+
|
317 |
+
private function _ckeckIntergerArray($data) {
|
318 |
+
foreach ($data as $key => $value) {
|
319 |
+
if (is_numeric($key)) {
|
320 |
+
return true;
|
321 |
+
}
|
322 |
+
break;
|
323 |
+
}
|
324 |
+
return false;
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Set the query limit
|
329 |
+
* @param integer $limits
|
330 |
+
* @return string
|
331 |
+
*/
|
332 |
+
public function setLimits($limits) {
|
333 |
+
if (isset($this->posts_limit) && $this->posts_limit > 0) {
|
334 |
+
return 'LIMIT 0, ' . $this->posts_limit;
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Get the url for each sitemap
|
340 |
+
* @param string $sitemap
|
341 |
+
* @return string
|
342 |
+
*/
|
343 |
+
public function getXmlUrl($sitemap) {
|
344 |
+
if (!get_option('permalink_structure')){
|
345 |
+
$sitemap = '?feed=' . str_replace('.xml', '', $sitemap);
|
346 |
+
}else{
|
347 |
+
if(isset(SQ_Tools::$options['sq_sitemap'][$sitemap])){
|
348 |
+
$sitemap = SQ_Tools::$options['sq_sitemap'][$sitemap][0];
|
349 |
+
}
|
350 |
+
|
351 |
+
if (strpos($sitemap, '.xml') === false) {
|
352 |
+
$sitemap .= '.xml';
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
return esc_url(trailingslashit(home_url())) . $sitemap;
|
357 |
+
}
|
358 |
+
|
359 |
+
public function processCron() {
|
360 |
+
SQ_ObjController::getController('SQ_Tools', false);
|
361 |
+
foreach (SQ_Tools::$options['sq_sitemap'] as $name => $sitemap) {
|
362 |
+
if ($sitemap[1] == 1) {
|
363 |
+
$this->SendPing($this->getXmlUrl($name));
|
364 |
+
}
|
365 |
+
}
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Ping the sitemap to Google and Bing
|
370 |
+
* @param string $sitemapUrl
|
371 |
+
* @return boolean
|
372 |
+
*/
|
373 |
+
protected function SendPing($sitemapUrl) {
|
374 |
+
$success = true;
|
375 |
+
$urls = array(
|
376 |
+
"http://www.google.com/webmasters/sitemaps/ping?sitemap=%s",
|
377 |
+
"http://www.bing.com/webmaster/ping.aspx?siteMap=%s",
|
378 |
+
);
|
379 |
+
|
380 |
+
foreach ($urls as $url) {
|
381 |
+
if ($responce = SQ_Tools::sq_remote_get($url)) {
|
382 |
+
$success = true;
|
383 |
+
sleep(mt_rand(2, 5));
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
+
return $success;
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* Delete the fizical file if exists
|
392 |
+
* @return boolean
|
393 |
+
*/
|
394 |
+
public function deleteSitemapFile() {
|
395 |
+
if (isset(SQ_Tools::$options['sq_sitemap'][$this->root])) {
|
396 |
+
if (file_exists(ABSPATH . SQ_Tools::$options['sq_sitemap'][$this->root])) {
|
397 |
+
@unlink(ABSPATH . SQ_Tools::$options['sq_sitemap'][$this->root]);
|
398 |
+
return true;
|
399 |
+
}
|
400 |
+
}
|
401 |
+
return false;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* Remove the trailing slash from permalinks that have an extension,
|
406 |
+
* such as /sitemap.xml
|
407 |
+
*
|
408 |
+
* @param string $request
|
409 |
+
*/
|
410 |
+
public function untrailingslashit($request) {
|
411 |
+
if (pathinfo($request, PATHINFO_EXTENSION)) {
|
412 |
+
return untrailingslashit($request);
|
413 |
+
}
|
414 |
+
return $request; // trailingslashit($request);
|
415 |
+
}
|
416 |
+
|
417 |
+
}
|
core/SQ_BlockAccount/SQ_BlockAccount.php
CHANGED
@@ -5,14 +5,8 @@
|
|
5 |
*/
|
6 |
class SQ_BlockAccount extends SQ_BlockController {
|
7 |
|
8 |
-
|
9 |
-
parent::
|
10 |
-
switch (SQ_Tools::getValue('action')) {
|
11 |
-
case 'sq_hide_survey':
|
12 |
-
SQ_Tools::saveOptions('sq_hide_survey', (int) SQ_Tools::getValue('sq_hide_survey'));
|
13 |
-
exit();
|
14 |
-
break;
|
15 |
-
}
|
16 |
}
|
17 |
|
18 |
}
|
5 |
*/
|
6 |
class SQ_BlockAccount extends SQ_BlockController {
|
7 |
|
8 |
+
function hookGetContent() {
|
9 |
+
parent::preloadSettings();
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
}
|
core/SQ_BlockAffiliate/SQ_BlockAffiliate.php
CHANGED
@@ -5,6 +5,10 @@
|
|
5 |
*/
|
6 |
class SQ_BlockAffiliate extends SQ_BlockController {
|
7 |
|
|
|
|
|
|
|
|
|
8 |
public function action() {
|
9 |
parent::action();
|
10 |
switch (SQ_Tools::getValue('action')) {
|
@@ -40,8 +44,4 @@ class SQ_BlockAffiliate extends SQ_BlockController {
|
|
40 |
}
|
41 |
}
|
42 |
|
43 |
-
public function hookGetContent() {
|
44 |
-
$this->options = SQ_Tools::$options;
|
45 |
-
}
|
46 |
-
|
47 |
}
|
5 |
*/
|
6 |
class SQ_BlockAffiliate extends SQ_BlockController {
|
7 |
|
8 |
+
public function hookGetContent() {
|
9 |
+
parent::preloadSettings();
|
10 |
+
}
|
11 |
+
|
12 |
public function action() {
|
13 |
parent::action();
|
14 |
switch (SQ_Tools::getValue('action')) {
|
44 |
}
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
47 |
}
|
core/SQ_BlockAudit/SQ_BlockAudit.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class SQ_BlockAudit extends SQ_BlockController {
|
4 |
-
|
5 |
-
public function hookGetContent() {
|
6 |
-
|
7 |
-
}
|
8 |
-
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/SQ_BlockDashboard/SQ_BlockDashboard.php
CHANGED
@@ -5,4 +5,8 @@
|
|
5 |
*/
|
6 |
class SQ_BlockDashboard extends SQ_BlockController {
|
7 |
|
|
|
|
|
|
|
|
|
8 |
}
|
5 |
*/
|
6 |
class SQ_BlockDashboard extends SQ_BlockController {
|
7 |
|
8 |
+
function hookGetContent() {
|
9 |
+
parent::preloadSettings();
|
10 |
+
}
|
11 |
+
|
12 |
}
|
core/SQ_BlockPostsAnalytics/SQ_BlockPostsAnalytics.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
class SQ_BlockPostsAnalytics extends SQ_BlockController {
|
4 |
|
5 |
public function hookGetContent() {
|
|
|
6 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
7 |
->loadMedia(_SQ_THEME_URL_ . '/css/sq_postslist.css');
|
8 |
|
3 |
class SQ_BlockPostsAnalytics extends SQ_BlockController {
|
4 |
|
5 |
public function hookGetContent() {
|
6 |
+
|
7 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
8 |
->loadMedia(_SQ_THEME_URL_ . '/css/sq_postslist.css');
|
9 |
|
core/SQ_BlockSettings/SQ_BlockSettings.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
switch (SQ_Tools::getValue('action')) {
|
28 |
+
|
29 |
+
case 'sq_settings_update':
|
30 |
+
if (SQ_Tools::getIsset('sq_post_types')) {
|
31 |
+
SQ_Tools::$options['sq_post_types'] = array();
|
32 |
+
foreach (SQ_Tools::getValue('sq_post_types') as $key) {
|
33 |
+
array_push(SQ_Tools::$options['sq_post_types'], $key);
|
34 |
+
}
|
35 |
+
|
36 |
+
if (!in_array('product', get_post_types())) {
|
37 |
+
array_push(SQ_Tools::$options['sq_post_types'], 'product');
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
SQ_Tools::saveOptions('sq_google_country', SQ_Tools::getValue('sq_google_country'));
|
42 |
+
SQ_Tools::saveOptions('sq_google_country_strict', SQ_Tools::getValue('sq_google_country_strict'));
|
43 |
+
SQ_Tools::saveOptions('sq_google_ranksperhour', SQ_Tools::getValue('sq_google_ranksperhour'));
|
44 |
+
|
45 |
+
SQ_Tools::saveOptions('sq_keyword_help', (int) SQ_Tools::getValue('sq_keyword_help'));
|
46 |
+
SQ_Tools::saveOptions('sq_keyword_information', (int) SQ_Tools::getValue('sq_keyword_information'));
|
47 |
+
SQ_Tools::saveOptions('sq_sla', (int) SQ_Tools::getValue('sq_sla'));
|
48 |
+
SQ_Tools::saveOptions('sq_keywordtag', (int) SQ_Tools::getValue('sq_keywordtag'));
|
49 |
+
SQ_Tools::saveOptions('sq_local_images', (int) SQ_Tools::getValue('sq_local_images'));
|
50 |
+
|
51 |
+
|
52 |
+
SQ_Tools::saveOptions('sq_google_wt', SQ_ObjController::getModel('SQ_BlockSettingsSeo')->checkGoogleWTCode(SQ_Tools::getValue('sq_google_wt','',true)));
|
53 |
+
SQ_Tools::saveOptions('sq_bing_wt', SQ_ObjController::getModel('SQ_BlockSettingsSeo')->checkBingWTCode(SQ_Tools::getValue('sq_bing_wt','',true)));
|
54 |
+
SQ_Tools::saveOptions('sq_alexa', SQ_ObjController::getModel('SQ_BlockSettingsSeo')->checkBingWTCode(SQ_Tools::getValue('sq_alexa','',true)));
|
55 |
+
|
56 |
+
|
57 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
58 |
+
SQ_Tools::emptyCache();
|
59 |
+
break;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
core/SQ_BlockSettingsSeo/SQ_BlockSettingsSeo.php
ADDED
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
</script>';
|
16 |
+
}
|
17 |
+
|
18 |
+
function hookHead() {
|
19 |
+
wp_enqueue_media();
|
20 |
+
parent::hookHead();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Called when Post action is triggered
|
25 |
+
*
|
26 |
+
* @return void
|
27 |
+
*/
|
28 |
+
public function action() {
|
29 |
+
parent::action();
|
30 |
+
|
31 |
+
switch (SQ_Tools::getValue('action')) {
|
32 |
+
|
33 |
+
case 'sq_settingsseo_update':
|
34 |
+
if (!SQ_Tools::getIsset('sq_use')) {
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
|
38 |
+
SQ_Tools::saveOptions('sq_use', (int) SQ_Tools::getValue('sq_use'));
|
39 |
+
SQ_Tools::saveOptions('sq_auto_title', (int) SQ_Tools::getValue('sq_auto_title'));
|
40 |
+
SQ_Tools::saveOptions('sq_auto_description', (int) SQ_Tools::getValue('sq_auto_description'));
|
41 |
+
SQ_Tools::saveOptions('sq_auto_canonical', (int) SQ_Tools::getValue('sq_auto_canonical'));
|
42 |
+
|
43 |
+
SQ_Tools::saveOptions('sq_auto_meta', (int) SQ_Tools::getValue('sq_auto_meta'));
|
44 |
+
SQ_Tools::saveOptions('sq_auto_favicon', (int) SQ_Tools::getValue('sq_auto_favicon'));
|
45 |
+
|
46 |
+
///////////////////////////////////////////
|
47 |
+
/////////////////////////////SOCIAL OPTION
|
48 |
+
SQ_Tools::saveOptions('sq_auto_facebook', (int) SQ_Tools::getValue('sq_auto_facebook'));
|
49 |
+
SQ_Tools::saveOptions('sq_auto_twitter', (int) SQ_Tools::getValue('sq_auto_twitter'));
|
50 |
+
|
51 |
+
SQ_Tools::saveOptions('sq_twitter_account', $this->model->checkTwitterAccount(SQ_Tools::getValue('sq_twitter_account')));
|
52 |
+
SQ_Tools::saveOptions('sq_facebook_account', $this->model->checkFacebookAccount(SQ_Tools::getValue('sq_facebook_account')));
|
53 |
+
SQ_Tools::saveOptions('sq_google_plus', $this->model->checkGoogleAccount(SQ_Tools::getValue('sq_google_plus')));
|
54 |
+
SQ_Tools::saveOptions('sq_linkedin_account', $this->model->checkLinkeinAccount(SQ_Tools::getValue('sq_linkedin_account')));
|
55 |
+
|
56 |
+
///////////////////////////////////////////
|
57 |
+
/////////////////////////////FIRST PAGE OPTIMIZATION
|
58 |
+
SQ_Tools::saveOptions('sq_auto_seo', 0);
|
59 |
+
if ($pageId = get_option('page_on_front')) {
|
60 |
+
$meta = array();
|
61 |
+
if (SQ_Tools::getIsset('sq_fp_title'))
|
62 |
+
$meta[] = array('key' => '_sq_fp_title', 'value' => urldecode(SQ_Tools::getValue('sq_fp_title')));
|
63 |
+
|
64 |
+
if (SQ_Tools::getIsset('sq_fp_description'))
|
65 |
+
$meta[] = array('key' => '_sq_fp_description', 'value' => urldecode(SQ_Tools::getValue('sq_fp_description')));
|
66 |
+
|
67 |
+
if (SQ_Tools::getIsset('sq_fp_keywords'))
|
68 |
+
$meta[] = array('key' => '_sq_fp_keywords', 'value' => SQ_Tools::getValue('sq_fp_keywords'));
|
69 |
+
|
70 |
+
if (SQ_Tools::getIsset('sq_fp_ogimage'))
|
71 |
+
$meta[] = array('key' => '_sq_fp_ogimage', 'value' => SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'ogimage'));
|
72 |
+
|
73 |
+
if (!empty($meta))
|
74 |
+
SQ_ObjController::getModel('SQ_Post')->saveAdvMeta($pageId, $meta);
|
75 |
+
}else {
|
76 |
+
SQ_Tools::saveOptions('sq_fp_title', SQ_Tools::getValue('sq_fp_title'));
|
77 |
+
SQ_Tools::saveOptions('sq_fp_description', SQ_Tools::getValue('sq_fp_description'));
|
78 |
+
SQ_Tools::saveOptions('sq_fp_keywords', SQ_Tools::getValue('sq_fp_keywords'));
|
79 |
+
}
|
80 |
+
|
81 |
+
///////////////////////////////////////////
|
82 |
+
/////////////////////////////SITEMAP OPTION
|
83 |
+
SQ_Tools::saveOptions('sq_auto_sitemap', (int) SQ_Tools::getValue('sq_auto_sitemap'));
|
84 |
+
SQ_Tools::saveOptions('sq_sitemap_frequency', SQ_Tools::getValue('sq_sitemap_frequency'));
|
85 |
+
SQ_Tools::saveOptions('sq_sitemap_ping', (int) SQ_Tools::getValue('sq_sitemap_ping'));
|
86 |
+
|
87 |
+
foreach (SQ_Tools::$options['sq_sitemap'] as $key => $value) {
|
88 |
+
if ($key == 'sitemap') {
|
89 |
+
continue;
|
90 |
+
}
|
91 |
+
SQ_Tools::$options['sq_sitemap'][$key][1] = 0;
|
92 |
+
if ($key == 'sitemap-product' && !$this->model->isEcommerce()) {
|
93 |
+
SQ_Tools::$options['sq_sitemap'][$key][1] = 2;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
if (SQ_Tools::getIsset('sq_sitemap')) {
|
97 |
+
foreach (SQ_Tools::getValue('sq_sitemap') as $key) {
|
98 |
+
if (isset(SQ_Tools::$options['sq_sitemap'][$key][1])) {
|
99 |
+
SQ_Tools::$options['sq_sitemap'][$key][1] = 1;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
foreach (SQ_Tools::$options['sq_sitemap_show'] as $key => $value) {
|
105 |
+
SQ_Tools::$options['sq_sitemap_show'][$key] = 0;
|
106 |
+
}
|
107 |
+
if (SQ_Tools::getIsset('sq_sitemap_show')) {
|
108 |
+
foreach (SQ_Tools::getValue('sq_sitemap_show') as $key) {
|
109 |
+
if (isset(SQ_Tools::$options['sq_sitemap_show'][$key])) {
|
110 |
+
SQ_Tools::$options['sq_sitemap_show'][$key] = 1;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
///////////////////////////////////////////
|
116 |
+
|
117 |
+
|
118 |
+
SQ_Tools::saveOptions('sq_google_analytics', $this->model->checkGoogleAnalyticsCode(SQ_Tools::getValue('sq_google_analytics')));
|
119 |
+
SQ_Tools::saveOptions('sq_facebook_insights', $this->model->checkFavebookInsightsCode(SQ_Tools::getValue('sq_facebook_insights')));
|
120 |
+
SQ_Tools::saveOptions('sq_pinterest', $this->model->checkPinterestCode(SQ_Tools::getValue('sq_pinterest','',true)));
|
121 |
+
|
122 |
+
///////////////////////////////////////////JSONLD
|
123 |
+
|
124 |
+
SQ_Tools::saveOptions('sq_auto_jsonld', (int) SQ_Tools::getValue('sq_auto_jsonld'));
|
125 |
+
if (SQ_Tools::getIsset('sq_jsonld_type') && isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')])) {
|
126 |
+
|
127 |
+
foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')] as $key => $value) {
|
128 |
+
if (isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')][$key])) {
|
129 |
+
SQ_Tools::$options['sq_jsonld'][SQ_Tools::getValue('sq_jsonld_type')][$key] = SQ_Tools::getValue('sq_jsonld_' . $key);
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
SQ_Tools::saveOptions('sq_jsonld_type', SQ_Tools::getValue('sq_jsonld_type'));
|
134 |
+
|
135 |
+
///////////////////////////////////////////
|
136 |
+
/////////////////////////////FAVICON OPTION
|
137 |
+
|
138 |
+
/* if there is an icon to upload */
|
139 |
+
if (!empty($_FILES['favicon'])) {
|
140 |
+
|
141 |
+
$return = $this->model->addFavicon($_FILES['favicon']);
|
142 |
+
if ($return['favicon'] <> '') {
|
143 |
+
SQ_Tools::saveOptions('favicon', strtolower(basename($return['favicon'])));
|
144 |
+
}
|
145 |
+
if ($return['message'] <> '') {
|
146 |
+
define('SQ_MESSAGE_FAVICON', $return['message']);
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
151 |
+
//Update the rewrite rules with the new options
|
152 |
+
add_filter('rewrite_rules_array', array($this, 'rewrite_rules'), 999, 1);
|
153 |
+
//Flush the rewrite with the new favicon and sitemap
|
154 |
+
global $wp_rewrite;
|
155 |
+
$wp_rewrite->flush_rules();
|
156 |
+
|
157 |
+
//empty the cache on settings changed
|
158 |
+
SQ_Tools::emptyCache();
|
159 |
+
break;
|
160 |
+
case 'sq_checkissues':
|
161 |
+
SQ_Tools::saveOptions('sq_checkedissues', 1);
|
162 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
163 |
+
|
164 |
+
/* Load the error class */
|
165 |
+
SQ_Tools::checkErrorSettings();
|
166 |
+
|
167 |
+
break;
|
168 |
+
case 'sq_fixautoseo':
|
169 |
+
SQ_Tools::saveOptions('sq_use', 1);
|
170 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
171 |
+
|
172 |
+
break;
|
173 |
+
case 'sq_fixprivate':
|
174 |
+
update_option('blog_public', 1);
|
175 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
176 |
+
|
177 |
+
break;
|
178 |
+
case 'sq_fixcomments':
|
179 |
+
update_option('comments_notify', 1);
|
180 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
181 |
+
|
182 |
+
break;
|
183 |
+
case 'sq_fixpermalink':
|
184 |
+
$GLOBALS['wp_rewrite'] = new WP_Rewrite();
|
185 |
+
global $wp_rewrite;
|
186 |
+
$permalink_structure = ((get_option('permalink_structure') <> '') ? get_option('permalink_structure') : '/') . "%postname%/";
|
187 |
+
$wp_rewrite->set_permalink_structure($permalink_structure);
|
188 |
+
$permalink_structure = get_option('permalink_structure');
|
189 |
+
|
190 |
+
flush_rewrite_rules();
|
191 |
+
break;
|
192 |
+
case 'sq_fix_ogduplicate':
|
193 |
+
SQ_Tools::saveOptions('sq_auto_facebook', 0);
|
194 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
195 |
+
|
196 |
+
break;
|
197 |
+
case 'sq_fix_tcduplicate':
|
198 |
+
SQ_Tools::saveOptions('sq_auto_twitter', 0);
|
199 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
200 |
+
|
201 |
+
break;
|
202 |
+
case 'sq_fix_titleduplicate':
|
203 |
+
SQ_Tools::saveOptions('sq_auto_title', 0);
|
204 |
+
SQ_Tools::saveOptions('sq_auto_seo', 1);
|
205 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
206 |
+
|
207 |
+
break;
|
208 |
+
case 'sq_fix_descduplicate':
|
209 |
+
SQ_Tools::saveOptions('sq_auto_description', 0);
|
210 |
+
SQ_Tools::saveOptions('sq_auto_seo', 1);
|
211 |
+
SQ_Action::apiCall('sq/user/settings', array('settings' => json_encode(SQ_Tools::getBriefOptions())), 10);
|
212 |
+
|
213 |
+
break;
|
214 |
+
case 'sq_active_help' :
|
215 |
+
SQ_Tools::saveOptions('active_help', SQ_Tools::getValue('active_help'));
|
216 |
+
break;
|
217 |
+
case 'sq_warnings_off':
|
218 |
+
SQ_Tools::saveOptions('ignore_warn', 1);
|
219 |
+
break;
|
220 |
+
case 'sq_get_snippet':
|
221 |
+
if (SQ_Tools::getValue('url') <> '') {
|
222 |
+
$url = SQ_Tools::getValue('url');
|
223 |
+
} else {
|
224 |
+
$url = get_bloginfo('url');
|
225 |
+
}
|
226 |
+
$snippet = SQ_Tools::getSnippet($url);
|
227 |
+
//SQ_Tools::dump($snippet);
|
228 |
+
|
229 |
+
/* if((int)SQ_Tools::getValue('post_id') > 0)
|
230 |
+
$snippet['url'] = get_permalink((int)SQ_Tools::getValue('post_id'));
|
231 |
+
*/
|
232 |
+
echo json_encode($snippet);
|
233 |
+
exit();
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Add the favicon in the rewrite rule
|
239 |
+
* @param type $wp_rewrite
|
240 |
+
*/
|
241 |
+
public function rewrite_rules($wp_rewrite) {
|
242 |
+
$rules = array();
|
243 |
+
if (SQ_Tools::$options['sq_use'] == 1) {
|
244 |
+
|
245 |
+
//For Favicon
|
246 |
+
if (SQ_Tools::$options['sq_auto_favicon'] == 1) {
|
247 |
+
$rules['favicon\.ico$'] = 'index.php?sq_get=favicon';
|
248 |
+
$rules['favicon\.icon$'] = 'index.php?sq_get=favicon';
|
249 |
+
$rules['touch-icon\.png$'] = 'index.php?sq_get=touchicon';
|
250 |
+
foreach ($this->model->appleSizes as $size) {
|
251 |
+
$rules['touch-icon' . $size . '\.png$'] = 'index.php?sq_get=touchicon&sq_size=' . $size;
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
//For Sitemap
|
256 |
+
if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
|
257 |
+
foreach (SQ_Tools::$options['sq_sitemap'] as $name => $sitemap) {
|
258 |
+
if ($sitemap[1] == 1 || $sitemap[1] == 2) { // is show sitemap
|
259 |
+
$rules[preg_quote($sitemap[0]) . '$'] = 'index.php?feed=' . $name;
|
260 |
+
}
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
return array_merge($rules, $wp_rewrite);
|
265 |
+
}
|
266 |
+
|
267 |
+
}
|
core/SQ_BlockStatus/SQ_BlockStatus.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class SQ_BlockStatus extends SQ_BlockController {
|
4 |
-
|
5 |
-
public $progress = array();
|
6 |
-
|
7 |
-
public function hookGetContent() {
|
8 |
-
global $wpdb;
|
9 |
-
}
|
10 |
-
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/SQ_Blockseo/SQ_Blockseo.php
CHANGED
@@ -28,10 +28,11 @@ class SQ_Blockseo extends SQ_BlockController {
|
|
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
|
34 |
}
|
|
|
35 |
|
36 |
echo '</script>';
|
37 |
}
|
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 |
}
|
core/config.xml
CHANGED
@@ -23,32 +23,33 @@
|
|
23 |
<path>controllers</path>
|
24 |
</block>
|
25 |
<block>
|
26 |
-
<name>
|
27 |
-
<description>Setting page</description>
|
28 |
<actions>
|
29 |
-
<action>
|
30 |
-
<action>sq_save_analytics</action>
|
31 |
<action>sq_get_snippet</action>
|
|
|
32 |
|
|
|
33 |
<action>sq_fixautoseo</action>
|
34 |
<action>sq_fixpermalink</action>
|
35 |
<action>sq_fixprivate</action>
|
36 |
<action>sq_fixcomments</action>
|
37 |
<action>sq_fix_ogduplicate</action>
|
38 |
<action>sq_fix_tcduplicate</action>
|
|
|
39 |
<action>sq_fix_descduplicate</action>
|
40 |
|
41 |
-
<action>sq_upgrade</action>
|
42 |
<action>sq_warnings_off</action>
|
43 |
</actions>
|
44 |
<active>1</active>
|
45 |
-
<path>
|
46 |
</block>
|
47 |
<block>
|
48 |
-
<name>
|
49 |
-
<description>
|
50 |
<actions>
|
51 |
-
<action>
|
52 |
</actions>
|
53 |
<active>1</active>
|
54 |
<path>core</path>
|
23 |
<path>controllers</path>
|
24 |
</block>
|
25 |
<block>
|
26 |
+
<name>SQ_BlockSettingsSeo</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>
|
36 |
<action>sq_fixprivate</action>
|
37 |
<action>sq_fixcomments</action>
|
38 |
<action>sq_fix_ogduplicate</action>
|
39 |
<action>sq_fix_tcduplicate</action>
|
40 |
+
<action>sq_fix_titleduplicate</action>
|
41 |
<action>sq_fix_descduplicate</action>
|
42 |
|
|
|
43 |
<action>sq_warnings_off</action>
|
44 |
</actions>
|
45 |
<active>1</active>
|
46 |
+
<path>core</path>
|
47 |
</block>
|
48 |
<block>
|
49 |
+
<name>SQ_BlockSettings</name>
|
50 |
+
<description>Setting page</description>
|
51 |
<actions>
|
52 |
+
<action>sq_settings_update</action>
|
53 |
</actions>
|
54 |
<active>1</active>
|
55 |
<path>core</path>
|
languages/squirrly-seo-ru_RU.mo
DELETED
Binary file
|
languages/squirrly-seo-ru_RU.po
DELETED
@@ -1,1193 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: squirrly-seo\n"
|
4 |
-
"POT-Creation-Date: 2013-06-27 13:42+0200\n"
|
5 |
-
"PO-Revision-Date: 2013-10-03 14:45+0200\n"
|
6 |
-
"Last-Translator: \n"
|
7 |
-
"Language-Team: Squirrly UK <support@squirrly.co>\n"
|
8 |
-
"Language: en\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.5.7\n"
|
13 |
-
"X-Poedit-KeywordsList: __;_e\n"
|
14 |
-
"X-Poedit-Basepath: d:\\pagini_net\\se_lucreaza\\squirrly\\wordpress\\wp-"
|
15 |
-
"content\\plugins\\squirrly-seo\n"
|
16 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
-
"X-Poedit-SearchPath-0: .\n"
|
18 |
-
|
19 |
-
#: squirrly.php:45
|
20 |
-
msgid ""
|
21 |
-
"For Squirrly to work, the PHP version has to be equal or greater then 5.1"
|
22 |
-
msgstr ""
|
23 |
-
"Для исправной работы Squirrly, версия PHP должна быть равна или выше 5.1 "
|
24 |
-
|
25 |
-
#: classes/SQ_Error.php:20
|
26 |
-
msgid ""
|
27 |
-
"Function get_class does not exists! Is required for Squirrly to work "
|
28 |
-
"properly."
|
29 |
-
msgstr ""
|
30 |
-
"Функция get_class не существует! Она требуется для исправной работы Squirrly."
|
31 |
-
|
32 |
-
#: classes/SQ_Error.php:23
|
33 |
-
msgid ""
|
34 |
-
"Function file_exists does not exists! Is required for Squirrly to work "
|
35 |
-
"properly."
|
36 |
-
msgstr ""
|
37 |
-
"Функция file_exists не существует! Она требуется для исправной работы "
|
38 |
-
"Squirrly."
|
39 |
-
|
40 |
-
#: classes/SQ_Error.php:27
|
41 |
-
msgid "The home directory is not set!"
|
42 |
-
msgstr "Домашняя директория не установлена!"
|
43 |
-
|
44 |
-
#: classes/SQ_Error.php:31
|
45 |
-
msgid "The PHP version has to be greater then 4.0"
|
46 |
-
msgstr "Версия PHP должна быть выше, чем 4,0"
|
47 |
-
|
48 |
-
#: classes/SQ_Error.php:69
|
49 |
-
msgid "Turn off warnings!"
|
50 |
-
msgstr "Отключить предупреждения!"
|
51 |
-
|
52 |
-
#: classes/SQ_Error.php:70
|
53 |
-
msgid "Notice: "
|
54 |
-
msgstr "Примечание:"
|
55 |
-
|
56 |
-
#: classes/SQ_Error.php:74
|
57 |
-
msgid "Note: "
|
58 |
-
msgstr "Обратите внимание:"
|
59 |
-
|
60 |
-
#: classes/SQ_Tools.php:82 controllers/SQ_Menu.php:52
|
61 |
-
msgid "Settings"
|
62 |
-
msgstr "Настройки"
|
63 |
-
|
64 |
-
#: classes/SQ_Tools.php:85 controllers/SQ_Menu.php:35
|
65 |
-
msgid "Getting started"
|
66 |
-
msgstr "Введение"
|
67 |
-
|
68 |
-
#: classes/SQ_Tools.php:394
|
69 |
-
msgid "Fix it for me!"
|
70 |
-
msgstr "Починить это!"
|
71 |
-
|
72 |
-
#: classes/SQ_Tools.php:400
|
73 |
-
msgid "Let Squirrly optimize your SEO automatically (recommended)"
|
74 |
-
msgstr ""
|
75 |
-
"Разрешить Squirrly автоматически оптимизировать ваш SEO (Поиско́вая "
|
76 |
-
"оптимиза́ция) (рекомендуется)\t"
|
77 |
-
|
78 |
-
#: classes/SQ_Tools.php:408
|
79 |
-
msgid "You're blocking google from indexing your site!"
|
80 |
-
msgstr "Вы блокируете индексирования вашего сайта в Google!"
|
81 |
-
|
82 |
-
#: classes/SQ_Tools.php:414
|
83 |
-
msgid ""
|
84 |
-
"It is highly recommended that you include the %postname% variable in the "
|
85 |
-
"permalink structure. <br />Go to Settings > Permalinks and add /%postname%/ "
|
86 |
-
"in Custom Structure"
|
87 |
-
msgstr ""
|
88 |
-
"Настоятельно рекомендуется включить переменную %postname% в структуру "
|
89 |
-
"постоянной ссылки. <br />Перейти в раздел Настройки> Постоянные ссылки и "
|
90 |
-
"добавить /%postname%/ в пользовательскую структуру"
|
91 |
-
|
92 |
-
#: controllers/SQ_Menu.php:34
|
93 |
-
msgid " getting started"
|
94 |
-
msgstr "введение"
|
95 |
-
|
96 |
-
#: controllers/SQ_Menu.php:43
|
97 |
-
msgid " dashboard"
|
98 |
-
msgstr "панель управления"
|
99 |
-
|
100 |
-
#: controllers/SQ_Menu.php:44
|
101 |
-
msgid "Dashboard"
|
102 |
-
msgstr "Панель управления"
|
103 |
-
|
104 |
-
#: controllers/SQ_Menu.php:51
|
105 |
-
msgid " settings"
|
106 |
-
msgstr "настройки"
|
107 |
-
|
108 |
-
#: controllers/SQ_Menu.php:58
|
109 |
-
msgid "Make money with "
|
110 |
-
msgstr "Заработать деньги с"
|
111 |
-
|
112 |
-
#: controllers/SQ_Menu.php:59
|
113 |
-
msgid "Make money"
|
114 |
-
msgstr "Заработать деньги"
|
115 |
-
|
116 |
-
#: controllers/SQ_Menu.php:78
|
117 |
-
msgid "Squirrly Article Rank"
|
118 |
-
msgstr "Рейтинг статеи Squirrly"
|
119 |
-
|
120 |
-
#: controllers/SQ_PostsList.php:97
|
121 |
-
msgid "Squirrly"
|
122 |
-
msgstr "Squirrly"
|
123 |
-
|
124 |
-
#: controllers/SQ_PostsList.php:134
|
125 |
-
msgid "Custom description: "
|
126 |
-
msgstr "Индивидуальное описание:"
|
127 |
-
|
128 |
-
#: controllers/SQ_PostsList.php:134
|
129 |
-
msgid "Custom title: "
|
130 |
-
msgstr "Индивидуальное название: "
|
131 |
-
|
132 |
-
#: controllers/SQ_PostsList.php:157
|
133 |
-
msgid "Squirrly article rank"
|
134 |
-
msgstr "Рейтинг статеи Squirrly"
|
135 |
-
|
136 |
-
#: controllers/SQ_PostsList.php:158 core/SQ_Blockseo/SQ_Blockseo.php:21
|
137 |
-
msgid "Update"
|
138 |
-
msgstr "Обновление"
|
139 |
-
|
140 |
-
#: controllers/SQ_PostsList.php:159
|
141 |
-
msgid "More details"
|
142 |
-
msgstr "Подробнее"
|
143 |
-
|
144 |
-
#: controllers/SQ_PostsList.php:160
|
145 |
-
msgid "Less details"
|
146 |
-
msgstr "Менее подробно"
|
147 |
-
|
148 |
-
#: controllers/SQ_PostsList.php:161
|
149 |
-
msgid "Interval: "
|
150 |
-
msgstr "Интервал:"
|
151 |
-
|
152 |
-
#: controllers/SQ_PostsList.php:162 models/SQ_PostsList.php:30
|
153 |
-
msgid "Latest"
|
154 |
-
msgstr "Последние"
|
155 |
-
|
156 |
-
#: controllers/SQ_PostsList.php:163 models/SQ_PostsList.php:31
|
157 |
-
msgid "Last 7 days"
|
158 |
-
msgstr "За последние 7 дней"
|
159 |
-
|
160 |
-
#: controllers/SQ_PostsList.php:164 models/SQ_PostsList.php:32
|
161 |
-
msgid "Last 30 days"
|
162 |
-
msgstr "За последние 30 дней"
|
163 |
-
|
164 |
-
#: controllers/SQ_PostsList.php:166 core/SQ_Blockrank/SQ_Blockrank.php:19
|
165 |
-
msgid "See it in 'All Posts'"
|
166 |
-
msgstr "Посмотреть в папке 'Все посты'"
|
167 |
-
|
168 |
-
#: controllers/SQ_PostsList.php:167
|
169 |
-
msgid "progress"
|
170 |
-
msgstr "прогресс"
|
171 |
-
|
172 |
-
#: controllers/SQ_PostsList.php:168
|
173 |
-
msgid "optimized"
|
174 |
-
msgstr "оптимизированный"
|
175 |
-
|
176 |
-
#: controllers/SQ_PostsList.php:169
|
177 |
-
msgid "See rank"
|
178 |
-
msgstr "Показать рейтинг"
|
179 |
-
|
180 |
-
#: controllers/SQ_PostsList.php:170
|
181 |
-
msgid "Hide rank"
|
182 |
-
msgstr "Скрыть рейтинг"
|
183 |
-
|
184 |
-
#: controllers/SQ_PostsList.php:171
|
185 |
-
msgid "Optimize"
|
186 |
-
msgstr "Оптимизировать"
|
187 |
-
|
188 |
-
#: controllers/SQ_PostsList.php:173
|
189 |
-
msgid "Not Public"
|
190 |
-
msgstr "Не публичный"
|
191 |
-
|
192 |
-
#: controllers/SQ_PostsList.php:259 core/SQ_Blockrank/SQ_Blockrank.php:31
|
193 |
-
msgid "Publish the article to start Squirrly Article Rank"
|
194 |
-
msgstr "Опубликуйте статью, чтобы начать Squirrly Article Rank"
|
195 |
-
|
196 |
-
#: core/SQ_BlockAffiliate/SQ_BlockAffiliate.php:33
|
197 |
-
#, php-format
|
198 |
-
msgid "Error: %s"
|
199 |
-
msgstr "Ошибка: %s"
|
200 |
-
|
201 |
-
#: core/SQ_BlockAffiliate/SQ_BlockAffiliate.php:36
|
202 |
-
#: core/SQ_Blocklogin/SQ_Blocklogin.php:85
|
203 |
-
msgid "An error occured. Mabe a network error :("
|
204 |
-
msgstr "Произошла ошибка. Может быть, сетевая ошибка:("
|
205 |
-
|
206 |
-
#: core/SQ_Blocklogin/SQ_Blocklogin.php:80
|
207 |
-
#, php-format
|
208 |
-
msgid ""
|
209 |
-
"We found your email, so it means you already have a Squirrly.co account. "
|
210 |
-
"Please login with your Squirrly Email. If you forgot your password click "
|
211 |
-
"%shere%s"
|
212 |
-
msgstr ""
|
213 |
-
"Мы нашли вашу электронную почту, так означает, что вы уже имеете аккаунт на "
|
214 |
-
"Squirrly.co. Пожалуйста, войдите в систему с вашим адресом электронной почты "
|
215 |
-
"Squirrly. Если вы забыли свой пароль нажмите на %sсюда%s"
|
216 |
-
|
217 |
-
#: core/SQ_Blocklogin/SQ_Blocklogin.php:88
|
218 |
-
#, php-format
|
219 |
-
msgid ""
|
220 |
-
"Could not send your informations to squirrly. Please register %smanually%s."
|
221 |
-
msgstr ""
|
222 |
-
"Невозможно послать вашу информацию в squirrly. Пожалуйста, зарегистрируйтесь "
|
223 |
-
"%sвручную%s."
|
224 |
-
|
225 |
-
#: core/SQ_Blocklogin/SQ_Blocklogin.php:129
|
226 |
-
msgid "Wrong email or password!"
|
227 |
-
msgstr "Неправильное имя пользователя или пароль!"
|
228 |
-
|
229 |
-
#: core/SQ_Blocklogin/SQ_Blocklogin.php:132
|
230 |
-
msgid "You can use this account only for the URL you registered first!"
|
231 |
-
msgstr ""
|
232 |
-
"Вы можете использовать этот аккаунт только для URL который вы "
|
233 |
-
"зарегистрировали изначально!"
|
234 |
-
|
235 |
-
#: core/SQ_Blocklogin/SQ_Blocklogin.php:137
|
236 |
-
msgid "An error occured."
|
237 |
-
msgstr "Произошла ошибка."
|
238 |
-
|
239 |
-
#: core/SQ_Blocklogin/SQ_Blocklogin.php:139
|
240 |
-
msgid "Both fields are required."
|
241 |
-
msgstr "Оба поля обязательны для заполнения."
|
242 |
-
|
243 |
-
#: core/SQ_Blockresearch/SQ_Blockresearch.php:12
|
244 |
-
msgid "Recent discussions:"
|
245 |
-
msgstr "Недавние дискуссии:"
|
246 |
-
|
247 |
-
#: core/SQ_Blockresearch/SQ_Blockresearch.php:12
|
248 |
-
msgid "Exact search:"
|
249 |
-
msgstr "Точный поиск:"
|
250 |
-
|
251 |
-
#: core/SQ_Blockresearch/SQ_Blockresearch.php:12
|
252 |
-
msgid "Competition:"
|
253 |
-
msgstr "Конкуренция:"
|
254 |
-
|
255 |
-
#: core/SQ_Blockresearch/SQ_Blockresearch.php:12
|
256 |
-
msgid "Trend:"
|
257 |
-
msgstr "Тенденция:"
|
258 |
-
|
259 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
260 |
-
msgid "date"
|
261 |
-
msgstr "дата"
|
262 |
-
|
263 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
264 |
-
msgid "Read it!"
|
265 |
-
msgstr "Прочитайте!"
|
266 |
-
|
267 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
268 |
-
msgid "Insert it!"
|
269 |
-
msgstr "Вставьте!"
|
270 |
-
|
271 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
272 |
-
msgid "Reference"
|
273 |
-
msgstr "Ссылка"
|
274 |
-
|
275 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
276 |
-
msgid "Insert as box"
|
277 |
-
msgstr "Вставить в качестве окна"
|
278 |
-
|
279 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
280 |
-
msgid "Not relevant?"
|
281 |
-
msgstr "Не применимо?"
|
282 |
-
|
283 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
284 |
-
msgid "Insert in your article"
|
285 |
-
msgstr "Вставить в вашу статью"
|
286 |
-
|
287 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
288 |
-
msgid "For Squirrly to work, you have to have tinymce editor installed!"
|
289 |
-
msgstr "Для исправной работы Squirrly, вы должны установить редактор tinymce!"
|
290 |
-
|
291 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
292 |
-
msgid ":( I lost my squirrel. Please reload the page."
|
293 |
-
msgstr ":( Я потерял свой свою белку. Пожалуйста, перезагрузите страницу"
|
294 |
-
|
295 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
296 |
-
msgid "No results found!"
|
297 |
-
msgstr "Ничего не найдено!"
|
298 |
-
|
299 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
300 |
-
msgid "Switch to Visual editor!"
|
301 |
-
msgstr "Переключиться на визуальный редактор!"
|
302 |
-
|
303 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
304 |
-
msgid "Use more words in one keyword"
|
305 |
-
msgstr "Используйте больше слов в ключевом слове"
|
306 |
-
|
307 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
308 |
-
msgid "Takes too long to check this keyword ..."
|
309 |
-
msgstr "Проверка ключевого слова занимает слишком много времени..."
|
310 |
-
|
311 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
312 |
-
msgid "Do a research!"
|
313 |
-
msgstr "Делайте поиск!"
|
314 |
-
|
315 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
316 |
-
msgid "Do more research!"
|
317 |
-
msgstr "Делайте больше поисков!"
|
318 |
-
|
319 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
320 |
-
#, php-format
|
321 |
-
msgid "[ ATTRIBUTE: Please check: %s to find out how to attribute this image ]"
|
322 |
-
msgstr ""
|
323 |
-
"[АТРИБУТ: Пожалуйста, проверьте: %s чтобы узнать, какие атрибуты дать этому "
|
324 |
-
"изображению]"
|
325 |
-
|
326 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
327 |
-
msgid "Has creative commons attributes"
|
328 |
-
msgstr "Имеет атрибуты «криэ́йтив ка́мэнс»"
|
329 |
-
|
330 |
-
#: core/SQ_Blocksearch/SQ_Blocksearch.php:51
|
331 |
-
msgid "No known copyright restrictions"
|
332 |
-
msgstr "Нет известных ограничений в связи с авторскими правами"
|
333 |
-
|
334 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:11
|
335 |
-
msgid "Save changes"
|
336 |
-
msgstr "Сохранить изменения"
|
337 |
-
|
338 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:12
|
339 |
-
msgid "Cancel"
|
340 |
-
msgstr "Отменить"
|
341 |
-
|
342 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:13
|
343 |
-
msgid "Reset"
|
344 |
-
msgstr "Переустановка"
|
345 |
-
|
346 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:15
|
347 |
-
msgid "Customize Title"
|
348 |
-
msgstr "Персонализация Название"
|
349 |
-
|
350 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:16
|
351 |
-
msgid "manage keywords"
|
352 |
-
msgstr "управления ключевыми словами"
|
353 |
-
|
354 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:17 themes/default/SQ_Menu.php:327
|
355 |
-
msgid "Too short"
|
356 |
-
msgstr "Слишком короткий"
|
357 |
-
|
358 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:18 themes/default/SQ_Menu.php:328
|
359 |
-
msgid "Too long"
|
360 |
-
msgstr "Слишком длинный"
|
361 |
-
|
362 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:20 themes/default/SQ_Menu.php:214
|
363 |
-
msgid "Squirrly Snippet"
|
364 |
-
msgstr "Squirrly образец"
|
365 |
-
|
366 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:22
|
367 |
-
msgid ""
|
368 |
-
"Click the Update button (to the right) to see the snippet from your website."
|
369 |
-
msgstr ""
|
370 |
-
"Нажмите на кнопку обновить (вправо), чтобы увидеть образец с вашего сайта."
|
371 |
-
|
372 |
-
#: core/SQ_Blockseo/SQ_Blockseo.php:23
|
373 |
-
msgid "Enter a title above for the snippet to get data."
|
374 |
-
msgstr "Введите название выше чтобы подать данные образцу."
|
375 |
-
|
376 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:21
|
377 |
-
msgid "Plugin Feedback"
|
378 |
-
msgstr "Плагин обратной связи"
|
379 |
-
|
380 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:57
|
381 |
-
msgid "Thank you for your feedback"
|
382 |
-
msgstr "Спасибо за ваш отзыв"
|
383 |
-
|
384 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:59
|
385 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:94
|
386 |
-
msgid "Could not send the email..."
|
387 |
-
msgstr "Не удалось отправить электронную почту…"
|
388 |
-
|
389 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:62
|
390 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:97
|
391 |
-
msgid "No message."
|
392 |
-
msgstr "Нет сообщений"
|
393 |
-
|
394 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:81
|
395 |
-
msgid "Plugin Support"
|
396 |
-
msgstr "Поддержка плагинов"
|
397 |
-
|
398 |
-
#: core/SQ_BlockSupport/SQ_BlockSupport.php:92
|
399 |
-
msgid "Message sent..."
|
400 |
-
msgstr "Сообщение послано..."
|
401 |
-
|
402 |
-
#: core/SQ_Loading/SQ_Loading.php:23
|
403 |
-
msgid ""
|
404 |
-
"For Squirrly to work properly you have to use a higher version of Internet "
|
405 |
-
"Explorer. <br /> We recommend you to use Chrome or Mozilla."
|
406 |
-
msgstr ""
|
407 |
-
"Чтобы Squirrly работал исправно, вы должны использовать более высокую версию "
|
408 |
-
"Internet Explorer. <br /> Мы рекомендуем использовать Chrome или Mozilla."
|
409 |
-
|
410 |
-
#: core/SQ_Loading/SQ_Loading.php:30
|
411 |
-
msgid ""
|
412 |
-
"You haven`t used Squirrly SEO to optimize your article. Do you want to "
|
413 |
-
"optimize for a keyword before publishing?"
|
414 |
-
msgstr ""
|
415 |
-
"Вы не использовали (поисковую оптимизацию) Squirrly SEO чтобы оптимизировать "
|
416 |
-
"вашу статью. Хотите перед публикацией оптимизировать ключевые слова?"
|
417 |
-
|
418 |
-
#: models/SQ_Menu.php:139
|
419 |
-
msgid "The code for Google Webmaster Tool is incorrect."
|
420 |
-
msgstr "Неверный код Google Webmaster."
|
421 |
-
|
422 |
-
#: models/SQ_Menu.php:166
|
423 |
-
msgid "The code for Google Analytics is incorrect."
|
424 |
-
msgstr "Неверный код для Google Analytics."
|
425 |
-
|
426 |
-
#: models/SQ_Menu.php:194
|
427 |
-
msgid "The code for Facebook is incorrect."
|
428 |
-
msgstr "Неверный код для Facebook."
|
429 |
-
|
430 |
-
#: models/SQ_Menu.php:219
|
431 |
-
msgid "The code for Bing is incorrect."
|
432 |
-
msgstr "Неверный код Bing."
|
433 |
-
|
434 |
-
#: models/SQ_Menu.php:252
|
435 |
-
msgid "File type error: Only JPEG, JPG, GIF or PNG files are allowed."
|
436 |
-
msgstr "Ошибка в типе файла: поддерживаются только JPEG, JPG, GIF или PNG."
|
437 |
-
|
438 |
-
#: models/SQ_Menu.php:265
|
439 |
-
msgid "GD error: The GD library must be installed on your server."
|
440 |
-
msgstr "Ошибка GD: библиотека GD должна быть установлена на вашем сервере."
|
441 |
-
|
442 |
-
#: models/SQ_Menu.php:272
|
443 |
-
msgid "Delete error: Could not delete the old favicon."
|
444 |
-
msgstr "Ошибка при удалении : Не удалось удалить старый значок."
|
445 |
-
|
446 |
-
#: models/SQ_Menu.php:279
|
447 |
-
msgid "Upload error: Could not upload the favicon."
|
448 |
-
msgstr "Ошибка при загрузке: Не удалось загрузить значок."
|
449 |
-
|
450 |
-
#: models/SQ_Menu.php:285
|
451 |
-
msgid "Permission error: Could not change the favicon permissions."
|
452 |
-
msgstr "Ошибка доступа: Не удалось изменить значок доступа."
|
453 |
-
|
454 |
-
#: models/SQ_Menu.php:311
|
455 |
-
msgid ""
|
456 |
-
"ICO Error: Could not create the ICO from file. Try with another file type."
|
457 |
-
msgstr ""
|
458 |
-
"Ошибка ICO : Из данного файла не удалось создать ICO . Попробуйте с файлом "
|
459 |
-
"другого типа."
|
460 |
-
|
461 |
-
#: models/SQ_Menu.php:314
|
462 |
-
msgid "The favicon has been updated."
|
463 |
-
msgstr "Значок был обновлен."
|
464 |
-
|
465 |
-
#: models/SQ_Post.php:71
|
466 |
-
msgid "Squirrly could not find any results for: "
|
467 |
-
msgstr "Squirrly не смог найти никаких результатов на:"
|
468 |
-
|
469 |
-
#: models/SQ_PostsList.php:29
|
470 |
-
msgid "This article"
|
471 |
-
msgstr "Эта статья"
|
472 |
-
|
473 |
-
#: models/SQ_PostsList.php:29
|
474 |
-
msgid "All your articles"
|
475 |
-
msgstr "Все ваши статьи"
|
476 |
-
|
477 |
-
#: models/SQ_PostsList.php:69
|
478 |
-
msgid "Optimize this article to start Squirrly Article Rank"
|
479 |
-
msgstr "Оптимизировать эту статью, чтобы начать Squirrly Article Rank "
|
480 |
-
|
481 |
-
#: models/SQ_PostsList.php:111
|
482 |
-
msgid "There are no information for this post yet."
|
483 |
-
msgstr "Для этого поста еще нет информации."
|
484 |
-
|
485 |
-
#: models/SQ_PostsList.php:129 models/SQ_PostsList.php:247
|
486 |
-
msgid "Traffic to article"
|
487 |
-
msgstr "Трафик на статью"
|
488 |
-
|
489 |
-
#: models/SQ_PostsList.php:130
|
490 |
-
msgid "Social impact"
|
491 |
-
msgstr "Социальный эффект"
|
492 |
-
|
493 |
-
#: models/SQ_PostsList.php:131
|
494 |
-
msgid "Links to article"
|
495 |
-
msgstr "Ссылки на статью"
|
496 |
-
|
497 |
-
#: models/SQ_PostsList.php:193
|
498 |
-
msgid "Google Indexed"
|
499 |
-
msgstr "проиндексирован на Google"
|
500 |
-
|
501 |
-
#: models/SQ_PostsList.php:198
|
502 |
-
msgid "pos"
|
503 |
-
msgstr "pos"
|
504 |
-
|
505 |
-
#: models/SQ_PostsList.php:198 themes/default/SQ_Menu.php:21
|
506 |
-
#: themes/default/SQ_Menu.php:40 themes/default/SQ_Menu.php:57
|
507 |
-
#: themes/default/SQ_Menu.php:74 themes/default/SQ_Menu.php:91
|
508 |
-
#: themes/default/SQ_Menu.php:108 themes/default/SQ_Menu.php:125
|
509 |
-
#: themes/default/SQ_Menu.php:152 themes/default/SQ_Menu.php:169
|
510 |
-
#: themes/default/SQ_Menu.php:237 themes/default/SQ_Menu.php:248
|
511 |
-
#: themes/default/SQ_Menu.php:259
|
512 |
-
msgid "Yes"
|
513 |
-
msgstr "Да"
|
514 |
-
|
515 |
-
#: models/SQ_PostsList.php:198 themes/default/SQ_Menu.php:23
|
516 |
-
#: themes/default/SQ_Menu.php:42 themes/default/SQ_Menu.php:59
|
517 |
-
#: themes/default/SQ_Menu.php:76 themes/default/SQ_Menu.php:93
|
518 |
-
#: themes/default/SQ_Menu.php:110 themes/default/SQ_Menu.php:127
|
519 |
-
#: themes/default/SQ_Menu.php:154 themes/default/SQ_Menu.php:171
|
520 |
-
#: themes/default/SQ_Menu.php:239 themes/default/SQ_Menu.php:250
|
521 |
-
#: themes/default/SQ_Menu.php:261
|
522 |
-
msgid "No"
|
523 |
-
msgstr "Нет"
|
524 |
-
|
525 |
-
#: models/SQ_PostsList.php:198
|
526 |
-
msgid "for:"
|
527 |
-
msgstr "для:"
|
528 |
-
|
529 |
-
#: models/SQ_PostsList.php:198
|
530 |
-
msgid "(searched with the url)"
|
531 |
-
msgstr "(искать с URL)"
|
532 |
-
|
533 |
-
#: models/SQ_PostsList.php:218
|
534 |
-
msgid "This article|Average"
|
535 |
-
msgstr "Эта статья | Средняя"
|
536 |
-
|
537 |
-
#: models/SQ_PostsList.php:254
|
538 |
-
msgid "Visits"
|
539 |
-
msgstr "Просмотры"
|
540 |
-
|
541 |
-
#: models/SQ_PostsList.php:257
|
542 |
-
msgid "Unique"
|
543 |
-
msgstr "Уникальные"
|
544 |
-
|
545 |
-
#: models/SQ_PostsList.php:369
|
546 |
-
msgid "Google result for: "
|
547 |
-
msgstr "Результаты Google для:"
|
548 |
-
|
549 |
-
#: models/SQ_PostsList.php:402
|
550 |
-
msgid "Change"
|
551 |
-
msgstr "Изменить"
|
552 |
-
|
553 |
-
#: models/SQ_PostsList.php:402
|
554 |
-
msgid "since"
|
555 |
-
msgstr "с"
|
556 |
-
|
557 |
-
#: models/SQ_PostsList.php:403 models/SQ_PostsList.php:478
|
558 |
-
msgid "Current position"
|
559 |
-
msgstr "Текущая позиция"
|
560 |
-
|
561 |
-
#: models/SQ_PostsList.php:437
|
562 |
-
msgid "Recommended by Squirrly"
|
563 |
-
msgstr "Рекомендовано Squirrly"
|
564 |
-
|
565 |
-
#: models/SQ_PostsList.php:477
|
566 |
-
msgid "Keyword"
|
567 |
-
msgstr "Ключевое слово"
|
568 |
-
|
569 |
-
#: themes/default/SQ_BlockAffiliate.php:4
|
570 |
-
#: themes/default/SQ_BlockAffiliate.php:14
|
571 |
-
msgid "Join Squirrly today!"
|
572 |
-
msgstr "Зарегистрироваться на Squirrly сегодня!"
|
573 |
-
|
574 |
-
#: themes/default/SQ_BlockAffiliate.php:21
|
575 |
-
msgid ""
|
576 |
-
"To redirect users to your site, just change \"squirrly.co\" with your domain."
|
577 |
-
msgstr ""
|
578 |
-
"Для перенаправления пользователей на ваш сайт, просто замените \"squirrly.co"
|
579 |
-
"\" на ваш домен."
|
580 |
-
|
581 |
-
#: themes/default/SQ_BlockAffiliate.php:23
|
582 |
-
msgid "Generate affiliate link"
|
583 |
-
msgstr "Создайте партнерскую ссылку"
|
584 |
-
|
585 |
-
#: themes/default/SQ_BlockAffiliate.php:28
|
586 |
-
msgid "Affiliate Benefits"
|
587 |
-
msgstr "Партнерские преимущества"
|
588 |
-
|
589 |
-
#: themes/default/SQ_BlockAffiliate.php:33
|
590 |
-
#, php-format
|
591 |
-
msgid "- Recurring 45%s commission"
|
592 |
-
msgstr "- Текущая комиссия 45%s"
|
593 |
-
|
594 |
-
#: themes/default/SQ_BlockAffiliate.php:38
|
595 |
-
msgid "- No cost"
|
596 |
-
msgstr "- Бесплатно"
|
597 |
-
|
598 |
-
#: themes/default/SQ_BlockAffiliate.php:43
|
599 |
-
msgid "- Monthly payments in your Paypal account"
|
600 |
-
msgstr "- Ежемесячные платежи на Ваш счет Paypal"
|
601 |
-
|
602 |
-
#: themes/default/SQ_BlockAffiliate.php:50
|
603 |
-
msgid ""
|
604 |
-
"Your affiliate account is set and ready to go. Above you have the affiliate "
|
605 |
-
"link. "
|
606 |
-
msgstr ""
|
607 |
-
"Ваш партнерский счет установлен и готов к работе. Выше партнерская ссылка."
|
608 |
-
|
609 |
-
#: themes/default/SQ_BlockAffiliate.php:52
|
610 |
-
#, php-format
|
611 |
-
msgid "Check your affiliate page: %sAffiliate page%s"
|
612 |
-
msgstr "Проверьте вашу партнерскую страницу: %sпартнерская страница%s"
|
613 |
-
|
614 |
-
#: themes/default/SQ_BlockAffiliate.php:54
|
615 |
-
#, php-format
|
616 |
-
msgid "%sTerms of Use for our Affiliate Program%s"
|
617 |
-
msgstr "%sУсловия использования нашей партнерской программы%s"
|
618 |
-
|
619 |
-
#: themes/default/SQ_BlockAffiliate.php:58
|
620 |
-
msgid ""
|
621 |
-
"After you connect to Squirrly you can begin to use your free Squirrly "
|
622 |
-
"affiliate link immediately!"
|
623 |
-
msgstr ""
|
624 |
-
"После подключения к Squirrly вы сразуже можете начать использовать "
|
625 |
-
"бесплатную партнерскую ссылку Squirrly!"
|
626 |
-
|
627 |
-
#: themes/default/SQ_BlockAffiliate.php:66
|
628 |
-
msgid "Squirrly banners you can use"
|
629 |
-
msgstr "Баннеры Squirrly которые вы можете использовать"
|
630 |
-
|
631 |
-
#: themes/default/SQ_BlockAffiliate.php:87 themes/default/SQ_BlockHelp.php:20
|
632 |
-
#: themes/default/SQ_Menu.php:4
|
633 |
-
#, fuzzy
|
634 |
-
msgid "See Squirrly in action"
|
635 |
-
msgstr "Опции Squirrly"
|
636 |
-
|
637 |
-
#: themes/default/SQ_BlockAffiliate.php:88 themes/default/SQ_BlockHelp.php:21
|
638 |
-
msgid "See dashboard"
|
639 |
-
msgstr "Перейти на панель управления"
|
640 |
-
|
641 |
-
#: themes/default/SQ_BlockAffiliate.php:89
|
642 |
-
#: themes/default/SQ_BlockDashboard.php:54 themes/default/SQ_BlockHelp.php:22
|
643 |
-
msgid "Go to settings"
|
644 |
-
msgstr "Перейдите в раздел Настройки"
|
645 |
-
|
646 |
-
#: themes/default/SQ_BlockDashboard.php:5
|
647 |
-
msgid "Squirrly dashboard"
|
648 |
-
msgstr "Панель управления Squirrly "
|
649 |
-
|
650 |
-
#: themes/default/SQ_BlockDashboard.php:8
|
651 |
-
msgid "User level"
|
652 |
-
msgstr "Уровень пользователя"
|
653 |
-
|
654 |
-
#: themes/default/SQ_BlockDashboard.php:12
|
655 |
-
msgid "Beginner"
|
656 |
-
msgstr "Начинающий"
|
657 |
-
|
658 |
-
#: themes/default/SQ_BlockDashboard.php:14
|
659 |
-
msgid "Advanced"
|
660 |
-
msgstr "Продвинутый"
|
661 |
-
|
662 |
-
#: themes/default/SQ_BlockDashboard.php:18
|
663 |
-
msgid "Select Advanced only if you have SEO knowledge."
|
664 |
-
msgstr ""
|
665 |
-
"Выберите « Продвинутый » только если у вас есть знания в сфере SEO "
|
666 |
-
"(поисковой оптимизации)."
|
667 |
-
|
668 |
-
#: themes/default/SQ_BlockDashboard.php:21
|
669 |
-
msgid "What does the Beginner option bring you:"
|
670 |
-
msgstr ""
|
671 |
-
|
672 |
-
#: themes/default/SQ_BlockDashboard.php:23
|
673 |
-
msgid ""
|
674 |
-
"Squirrly <strong>finds the optimum Title and Description</strong> for each "
|
675 |
-
"page of your blog but you can still customize the home page Title and "
|
676 |
-
"Description if you want."
|
677 |
-
msgstr ""
|
678 |
-
|
679 |
-
#: themes/default/SQ_BlockDashboard.php:24
|
680 |
-
msgid ""
|
681 |
-
"Squirrly <strong>manages the sitemap</strong> for your blog and pings it to "
|
682 |
-
"Google and Bing every time you add a new article. This ensures that your "
|
683 |
-
"articles get indexed much faster."
|
684 |
-
msgstr ""
|
685 |
-
|
686 |
-
#: themes/default/SQ_BlockDashboard.php:25
|
687 |
-
msgid ""
|
688 |
-
"Squirrly <strong>adds the Facebook required meta</strong>, so that when your "
|
689 |
-
"readers share your page or article, it looks really good."
|
690 |
-
msgstr ""
|
691 |
-
|
692 |
-
#: themes/default/SQ_BlockDashboard.php:26
|
693 |
-
msgid ""
|
694 |
-
"You can connect your site with your <strong>Google Plus</strong> and "
|
695 |
-
"<strong>Google Analytics</strong> accounts."
|
696 |
-
msgstr ""
|
697 |
-
|
698 |
-
#: themes/default/SQ_BlockDashboard.php:27
|
699 |
-
msgid ""
|
700 |
-
"You can add the site icon (also known as favicon) and Squirrly will set it "
|
701 |
-
"up to look good for <strong>Apple devices</strong>."
|
702 |
-
msgstr ""
|
703 |
-
|
704 |
-
#: themes/default/SQ_BlockDashboard.php:32
|
705 |
-
msgid "What does the Advanced option bring you:"
|
706 |
-
msgstr ""
|
707 |
-
|
708 |
-
#: themes/default/SQ_BlockDashboard.php:34
|
709 |
-
msgid "More <strong>SEO options</strong> are available on the Settings page."
|
710 |
-
msgstr ""
|
711 |
-
|
712 |
-
#: themes/default/SQ_BlockDashboard.php:35
|
713 |
-
msgid ""
|
714 |
-
"You can connect your site with <strong>Google Webmaster Tools</strong>, "
|
715 |
-
"<strong>Bing Webmaster Tools</strong> and <strong>Facebook Insights</strong>."
|
716 |
-
msgstr ""
|
717 |
-
|
718 |
-
#: themes/default/SQ_BlockDashboard.php:36
|
719 |
-
msgid ""
|
720 |
-
"You can see the <strong>Snippet</strong> when you edit your Post or Page."
|
721 |
-
msgstr ""
|
722 |
-
|
723 |
-
#: themes/default/SQ_BlockDashboard.php:37
|
724 |
-
msgid ""
|
725 |
-
"You can <strong>customize the Title and Description</strong> of each Post/"
|
726 |
-
"Page from within the snippet."
|
727 |
-
msgstr ""
|
728 |
-
|
729 |
-
#: themes/default/SQ_BlockHelp.php:4
|
730 |
-
msgid ""
|
731 |
-
"With Squirrly SEO, your Wordpress will get Excellent SEO on each article you "
|
732 |
-
"write."
|
733 |
-
msgstr ""
|
734 |
-
"С Squirrly SEO, ваш Wordpress получит отличное SEO для каждой вами написаной "
|
735 |
-
"статьи."
|
736 |
-
|
737 |
-
#: themes/default/SQ_BlockHelp.php:6
|
738 |
-
msgid "SEO Software"
|
739 |
-
msgstr "Программное обеспечение для SEO"
|
740 |
-
|
741 |
-
#: themes/default/SQ_BlockHelp.php:6
|
742 |
-
msgid ""
|
743 |
-
"delivered as a plugin for Wordpress. <br /><br />We connect your wordpress "
|
744 |
-
"with Squirrly, so that we can find the best SEO opportunities, give you "
|
745 |
-
"reports and analyse your competitors."
|
746 |
-
msgstr ""
|
747 |
-
"поставляется в виде плагина для WordPress. <br /> <br /> Мы подключаем "
|
748 |
-
"WordPress к Squirrly, чтобы найти лучшие возможности SEO, предоставить вам "
|
749 |
-
"отчеты и анализировать ваших конкурентов."
|
750 |
-
|
751 |
-
#: themes/default/SQ_BlockHelp.php:19
|
752 |
-
msgid "Don't show this page"
|
753 |
-
msgstr "Больше не показывать эту страницу"
|
754 |
-
|
755 |
-
#: themes/default/SQ_Blocklogin.php:2
|
756 |
-
msgid "Squirrly.co Login"
|
757 |
-
msgstr "Войти на Squirrly.co"
|
758 |
-
|
759 |
-
#: themes/default/SQ_Blocklogin.php:9
|
760 |
-
msgid "Email:"
|
761 |
-
msgstr "Электронная почта:"
|
762 |
-
|
763 |
-
#: themes/default/SQ_Blocklogin.php:10
|
764 |
-
msgid "Password:"
|
765 |
-
msgstr "Пароль:"
|
766 |
-
|
767 |
-
#: themes/default/SQ_Blocklogin.php:11
|
768 |
-
msgid "Login"
|
769 |
-
msgstr "Войти"
|
770 |
-
|
771 |
-
#: themes/default/SQ_Blocklogin.php:12
|
772 |
-
msgid "Register"
|
773 |
-
msgstr "Регистрация"
|
774 |
-
|
775 |
-
#: themes/default/SQ_Blocklogin.php:12
|
776 |
-
msgid "Register to Squirrly.co"
|
777 |
-
msgstr "Зарегистрируйтесь на Squirrly.co"
|
778 |
-
|
779 |
-
#: themes/default/SQ_Blocklogin.php:13
|
780 |
-
msgid "Lost password?"
|
781 |
-
msgstr "Забыли пароль?"
|
782 |
-
|
783 |
-
#: themes/default/SQ_Blocklogin.php:13
|
784 |
-
msgid "Lost password"
|
785 |
-
msgstr "Восстановить пароль"
|
786 |
-
|
787 |
-
#: themes/default/SQ_Blocklogin.php:17
|
788 |
-
msgid "Enter your email"
|
789 |
-
msgstr "Введите адрес электронной почты"
|
790 |
-
|
791 |
-
#: themes/default/SQ_Blocklogin.php:18
|
792 |
-
msgid "Your E-mail:"
|
793 |
-
msgstr "Ваш адрес электронной почты:"
|
794 |
-
|
795 |
-
#: themes/default/SQ_Blocklogin.php:19
|
796 |
-
msgid "Sign Up"
|
797 |
-
msgstr "Зарегистрироваться"
|
798 |
-
|
799 |
-
#: themes/default/SQ_Blocklogin.php:20
|
800 |
-
msgid "I already have an account"
|
801 |
-
msgstr "У меня уже есть аккаунт"
|
802 |
-
|
803 |
-
#: themes/default/SQ_Blocklogin.php:21
|
804 |
-
msgid "This email connects you to Squirrly.co"
|
805 |
-
msgstr "Эта электронная почта связывает вас с Squirrly.co"
|
806 |
-
|
807 |
-
#: themes/default/SQ_Blocklogin.php:30
|
808 |
-
msgid "The email address is invalid!"
|
809 |
-
msgstr "Адрес электронной почты недействителен!"
|
810 |
-
|
811 |
-
#: themes/default/SQ_Blocklogin.php:31
|
812 |
-
msgid "Click on Sign Up button and try again ..."
|
813 |
-
msgstr "Нажмите на кнопку Зарегистрироваться и попробуйте еще раз ..."
|
814 |
-
|
815 |
-
#: themes/default/SQ_Blocklogin.php:32
|
816 |
-
msgid "An error occured while logging in!"
|
817 |
-
msgstr "Произошла ошибка при входе в систему!"
|
818 |
-
|
819 |
-
#: themes/default/SQ_Blocklogin.php:33
|
820 |
-
msgid "Connecting ..."
|
821 |
-
msgstr "Подключение ..."
|
822 |
-
|
823 |
-
#: themes/default/SQ_Blocklogin.php:40
|
824 |
-
msgid "Congratulations! Now write a new article with:"
|
825 |
-
msgstr ""
|
826 |
-
|
827 |
-
#: themes/default/SQ_Blocklogin.php:43
|
828 |
-
msgid ""
|
829 |
-
"<strong>Keyword Research and Analysis</strong>: find the keywords that are "
|
830 |
-
"easier to rank for."
|
831 |
-
msgstr ""
|
832 |
-
|
833 |
-
#: themes/default/SQ_Blocklogin.php:44
|
834 |
-
msgid ""
|
835 |
-
"<strong>SEO Live Assistant</strong>: Your Wordpress gives you SEO adivce as "
|
836 |
-
"you type your article."
|
837 |
-
msgstr ""
|
838 |
-
|
839 |
-
#: themes/default/SQ_Blocklogin.php:45
|
840 |
-
msgid ""
|
841 |
-
"<strong>Inspiration box</strong>: get images you can use for free, tweets "
|
842 |
-
"you can quote and get up to date with latest news about your subject."
|
843 |
-
msgstr ""
|
844 |
-
|
845 |
-
#: themes/default/SQ_Blocklogin.php:46
|
846 |
-
msgid ""
|
847 |
-
"<strong>Article Rank</strong>: Measure and Monitor the impact of SEO and "
|
848 |
-
"Social Signals for each of your articles."
|
849 |
-
msgstr ""
|
850 |
-
|
851 |
-
#: themes/default/SQ_Blockresearch.php:2
|
852 |
-
msgid "Squirrly Keyword Research"
|
853 |
-
msgstr "Поиск ключевых слов Squirrly"
|
854 |
-
|
855 |
-
#: themes/default/SQ_Blockresearch.php:3
|
856 |
-
msgid "Clear"
|
857 |
-
msgstr "Очистить"
|
858 |
-
|
859 |
-
#: themes/default/SQ_Blockresearch.php:9
|
860 |
-
msgid "Keyword:"
|
861 |
-
msgstr "Ключевое слово:"
|
862 |
-
|
863 |
-
#: themes/default/SQ_Blockresearch.php:11 themes/default/SQ_Blocksearch.php:23
|
864 |
-
msgid "Use this keyword"
|
865 |
-
msgstr "Используйте это ключевое слово"
|
866 |
-
|
867 |
-
#: themes/default/SQ_Blockresearch.php:20
|
868 |
-
msgid "+ Add keyword"
|
869 |
-
msgstr "+ Добавить ключевое слово"
|
870 |
-
|
871 |
-
#: themes/default/SQ_Blockresearch.php:21
|
872 |
-
msgid "Do the research"
|
873 |
-
msgstr "Сделать поиск"
|
874 |
-
|
875 |
-
#: themes/default/SQ_Blockresearch.php:24
|
876 |
-
msgid "Enter even more keywords."
|
877 |
-
msgstr "Введите даже больше ключевых слов."
|
878 |
-
|
879 |
-
#: themes/default/SQ_Blockresearch.php:25
|
880 |
-
msgid "Let some keywords for the next time as well!"
|
881 |
-
msgstr "Оставить некоторые ключевые слова на следующий раз!"
|
882 |
-
|
883 |
-
#: themes/default/SQ_Blocksearch.php:3
|
884 |
-
msgid "Optimize for Keyword"
|
885 |
-
msgstr "Оптимизация ключевых слов"
|
886 |
-
|
887 |
-
#: themes/default/SQ_Blocksearch.php:10
|
888 |
-
msgid "Enter a keyword"
|
889 |
-
msgstr "Введите ключевое слово"
|
890 |
-
|
891 |
-
#: themes/default/SQ_Blocksearch.php:10
|
892 |
-
msgid "for Squirrly Live SEO optimization"
|
893 |
-
msgstr "для оптимизации Squirrly Live SEO"
|
894 |
-
|
895 |
-
#: themes/default/SQ_Blocksearch.php:22
|
896 |
-
msgid "Do a research"
|
897 |
-
msgstr "Сделать поиск"
|
898 |
-
|
899 |
-
#: themes/default/SQ_Blocksearch.php:27
|
900 |
-
msgid "Enter a keyword above!"
|
901 |
-
msgstr "Введите выше ключевое слово!"
|
902 |
-
|
903 |
-
#: themes/default/SQ_Blocksearch.php:28
|
904 |
-
msgid "I have more then one keyword!"
|
905 |
-
msgstr "У меня более одного ключевого слова!"
|
906 |
-
|
907 |
-
#: themes/default/SQ_Blocksearch.php:34
|
908 |
-
msgid "Images"
|
909 |
-
msgstr "Изображения"
|
910 |
-
|
911 |
-
#: themes/default/SQ_Blocksearch.php:35
|
912 |
-
msgid "Twitter"
|
913 |
-
msgstr "Twitter"
|
914 |
-
|
915 |
-
#: themes/default/SQ_Blocksearch.php:36
|
916 |
-
msgid "Wiki"
|
917 |
-
msgstr "Wiki"
|
918 |
-
|
919 |
-
#: themes/default/SQ_Blocksearch.php:37
|
920 |
-
msgid "News"
|
921 |
-
msgstr "Новости"
|
922 |
-
|
923 |
-
#: themes/default/SQ_Blocksearch.php:38
|
924 |
-
msgid "Blogs"
|
925 |
-
msgstr "Блоги"
|
926 |
-
|
927 |
-
#: themes/default/SQ_Blocksearch.php:39
|
928 |
-
msgid "My articles"
|
929 |
-
msgstr "Мои статьи"
|
930 |
-
|
931 |
-
#: themes/default/SQ_Blocksearch.php:44
|
932 |
-
msgid "Show only Copyright Free images"
|
933 |
-
msgstr "Показать только изображения свободные от авторских прав "
|
934 |
-
|
935 |
-
#: themes/default/SQ_Blockseo.php:3
|
936 |
-
msgid "Squirrly LIVE SEO assistant"
|
937 |
-
msgstr "Ассистент Squirrly LIVE SEO"
|
938 |
-
|
939 |
-
#: themes/default/SQ_BlockSupport.php:6
|
940 |
-
msgid "Go to Profile"
|
941 |
-
msgstr "Перейти к профилю"
|
942 |
-
|
943 |
-
#: themes/default/SQ_BlockSupport.php:6
|
944 |
-
msgid "Profile"
|
945 |
-
msgstr "Профиль"
|
946 |
-
|
947 |
-
#: themes/default/SQ_BlockSupport.php:10
|
948 |
-
msgid "Support"
|
949 |
-
msgstr "Поддерживать"
|
950 |
-
|
951 |
-
#: themes/default/SQ_BlockSupport.php:13
|
952 |
-
msgid "Need Help with Squirrly SEO?"
|
953 |
-
msgstr "Нужна помощь в Squirrly SEO?"
|
954 |
-
|
955 |
-
#: themes/default/SQ_BlockSupport.php:17
|
956 |
-
msgid "Send Question"
|
957 |
-
msgstr "Послать вопрос"
|
958 |
-
|
959 |
-
#: themes/default/SQ_BlockSupport.php:20 themes/default/SQ_BlockSupport.php:52
|
960 |
-
msgid "Go to:"
|
961 |
-
msgstr "Перейти к:"
|
962 |
-
|
963 |
-
#: themes/default/SQ_BlockSupport.php:20 themes/default/SQ_BlockSupport.php:52
|
964 |
-
msgid "support page"
|
965 |
-
msgstr "страница поддержки"
|
966 |
-
|
967 |
-
#: themes/default/SQ_BlockSupport.php:25
|
968 |
-
msgid "How was your Squirrly experience today?"
|
969 |
-
msgstr "Каково вам было сегодня работать с Squirrly ?"
|
970 |
-
|
971 |
-
#: themes/default/SQ_BlockSupport.php:32
|
972 |
-
msgid "How was Squirrly today?"
|
973 |
-
msgstr "Каким был Squirrly сегодня?"
|
974 |
-
|
975 |
-
#: themes/default/SQ_BlockSupport.php:45
|
976 |
-
msgid "Please tell us why?"
|
977 |
-
msgstr "Расскажите, пожалуйста, почему?"
|
978 |
-
|
979 |
-
#: themes/default/SQ_BlockSupport.php:48
|
980 |
-
msgid "Send feedback"
|
981 |
-
msgstr "Отправить отзыв"
|
982 |
-
|
983 |
-
#: themes/default/SQ_BlockSupport.php:57
|
984 |
-
msgid "Thank you! You can send us a happy face tomorow too."
|
985 |
-
msgstr "Спасибо! завтра тоже Вы можете отправить нам Смайлик."
|
986 |
-
|
987 |
-
#: themes/default/SQ_Menu.php:4
|
988 |
-
msgid "Squirrly settings"
|
989 |
-
msgstr "Настройки Squirrly "
|
990 |
-
|
991 |
-
#: themes/default/SQ_Menu.php:4 themes/default/SQ_Menu.php:321
|
992 |
-
msgid "Save settings"
|
993 |
-
msgstr "Сохранить настройки"
|
994 |
-
|
995 |
-
#: themes/default/SQ_Menu.php:15
|
996 |
-
msgid "Let Squirrly automatically optimize my blog"
|
997 |
-
msgstr "Позволить Squirrly автоматически оптимизировать мой блог"
|
998 |
-
|
999 |
-
#: themes/default/SQ_Menu.php:29
|
1000 |
-
msgid "What does Squirrly automatically do for SEO?"
|
1001 |
-
msgstr "Что Squirrly делает автоматически для SEO (поисковой оптимизации) ?"
|
1002 |
-
|
1003 |
-
#: themes/default/SQ_Menu.php:45
|
1004 |
-
msgid "Add <strong>canonical</strong> link in home page"
|
1005 |
-
msgstr "Добавить <strong>canonical</strong> на главную страницу"
|
1006 |
-
|
1007 |
-
#: themes/default/SQ_Menu.php:62
|
1008 |
-
msgid "Add the <strong>XML Sitemap</strong> for search engines"
|
1009 |
-
msgstr "Добавить <strong>XML Карту сайта </strong> для поисковых систем"
|
1010 |
-
|
1011 |
-
#: themes/default/SQ_Menu.php:79
|
1012 |
-
msgid ""
|
1013 |
-
"Add the required METAs for home page (<strong>icon, author, language, dc "
|
1014 |
-
"publisher</strong>, etc.)"
|
1015 |
-
msgstr ""
|
1016 |
-
"Добавить необходимое для главной мета страницы (<strong> икона, автор, язык, "
|
1017 |
-
"издатель dc </strong>, и т.д.)"
|
1018 |
-
|
1019 |
-
#: themes/default/SQ_Menu.php:96
|
1020 |
-
msgid ""
|
1021 |
-
"Add the <strong>favicon</strong> and the <strong>icon for Apple devices</"
|
1022 |
-
"strong>."
|
1023 |
-
msgstr ""
|
1024 |
-
"Добавить <strong>значок</strong> и <strong> иконки для устройств компании "
|
1025 |
-
"Apple</strong>."
|
1026 |
-
|
1027 |
-
#: themes/default/SQ_Menu.php:113
|
1028 |
-
msgid ""
|
1029 |
-
"Add the <strong>Facebook meta objects</strong> for a good looking share. "
|
1030 |
-
msgstr "Добавить<strong> мета-объекты Facebook</strong> для красивого вида."
|
1031 |
-
|
1032 |
-
#: themes/default/SQ_Menu.php:130
|
1033 |
-
msgid "Add the <strong>Twitter card</strong> in your tweets. "
|
1034 |
-
msgstr "Добавить<strong>карту Twitter</strong> в ваши твиты."
|
1035 |
-
|
1036 |
-
#: themes/default/SQ_Menu.php:131
|
1037 |
-
msgid "Your twitter account: "
|
1038 |
-
msgstr "Ваш счет twitter:"
|
1039 |
-
|
1040 |
-
#: themes/default/SQ_Menu.php:141
|
1041 |
-
msgid "First page optimization (Title, Description, Keywords)"
|
1042 |
-
msgstr "Первая оптимизации страницы (Название, описание, ключевые слова)"
|
1043 |
-
|
1044 |
-
#: themes/default/SQ_Menu.php:157
|
1045 |
-
msgid "Add the correct <strong>title</strong> in the home page"
|
1046 |
-
msgstr "Добавить правильное <strong>название</strong> на главной странице"
|
1047 |
-
|
1048 |
-
#: themes/default/SQ_Menu.php:174
|
1049 |
-
msgid ""
|
1050 |
-
"Add the correct <strong>description</strong> and <strong>keywords</strong> "
|
1051 |
-
"in home page"
|
1052 |
-
msgstr ""
|
1053 |
-
"Добавить правильное <strong>описание</strong> и <strong>ключевые слова</"
|
1054 |
-
"strong> на всех страницах"
|
1055 |
-
|
1056 |
-
#: themes/default/SQ_Menu.php:190
|
1057 |
-
msgid "Auto"
|
1058 |
-
msgstr "Автоматически "
|
1059 |
-
|
1060 |
-
#: themes/default/SQ_Menu.php:192
|
1061 |
-
msgid "Custom"
|
1062 |
-
msgstr "Индивидуальное"
|
1063 |
-
|
1064 |
-
#: themes/default/SQ_Menu.php:195
|
1065 |
-
msgid "Home page SEO optimization"
|
1066 |
-
msgstr "для оптимизации Squirrly Live SEO"
|
1067 |
-
|
1068 |
-
#: themes/default/SQ_Menu.php:200
|
1069 |
-
msgid "Title:"
|
1070 |
-
msgstr "Название:"
|
1071 |
-
|
1072 |
-
#: themes/default/SQ_Menu.php:201
|
1073 |
-
msgid "Tips: Length 10-75 chars"
|
1074 |
-
msgstr "Советы: длина 10-75 символов"
|
1075 |
-
|
1076 |
-
#: themes/default/SQ_Menu.php:204
|
1077 |
-
msgid "Description:"
|
1078 |
-
msgstr "Описание:"
|
1079 |
-
|
1080 |
-
#: themes/default/SQ_Menu.php:205
|
1081 |
-
msgid "Tips: Length 70-165 chars"
|
1082 |
-
msgstr "Советы: длина 70-165 символов"
|
1083 |
-
|
1084 |
-
#: themes/default/SQ_Menu.php:208
|
1085 |
-
msgid "Keywords:"
|
1086 |
-
msgstr "Ключевые слова:"
|
1087 |
-
|
1088 |
-
#: themes/default/SQ_Menu.php:209
|
1089 |
-
msgid "Tips: 2-4 keywords"
|
1090 |
-
msgstr "Советы: 2-4 ключевых слов"
|
1091 |
-
|
1092 |
-
#: themes/default/SQ_Menu.php:220
|
1093 |
-
msgid "Check with google ..."
|
1094 |
-
msgstr "Проверьте с Google..."
|
1095 |
-
|
1096 |
-
#: themes/default/SQ_Menu.php:223
|
1097 |
-
msgid ""
|
1098 |
-
"If you don't see any changes in custom optimization, check if another SEO "
|
1099 |
-
"plugin affects Squirrly SEO"
|
1100 |
-
msgstr ""
|
1101 |
-
"Если вы не видите изменений в пользовательской оптимизации, убедитесь, что "
|
1102 |
-
"другие плагины не влияют на SEO Squirrly"
|
1103 |
-
|
1104 |
-
#: themes/default/SQ_Menu.php:233
|
1105 |
-
msgid "Squirrly Options"
|
1106 |
-
msgstr "Опции Squirrly"
|
1107 |
-
|
1108 |
-
#: themes/default/SQ_Menu.php:242
|
1109 |
-
msgid "Let Squirrly warn me if there are errors related to SEO settings"
|
1110 |
-
msgstr ""
|
1111 |
-
"Позвольте Squirrly вас предупреждать в случае, ошибок, связанных с "
|
1112 |
-
"настройками SEO"
|
1113 |
-
|
1114 |
-
#: themes/default/SQ_Menu.php:253
|
1115 |
-
msgid ""
|
1116 |
-
"Show <strong>\"Enter a keyword\"</strong> bubble when posting a new article."
|
1117 |
-
msgstr ""
|
1118 |
-
"Показать пузырь <strong>\"Введите ключевое слово \"</strong> при написании "
|
1119 |
-
"новой статьи"
|
1120 |
-
|
1121 |
-
#: themes/default/SQ_Menu.php:264
|
1122 |
-
msgid ""
|
1123 |
-
"Always show <strong>Keyword Informations</strong> about the selected keyword."
|
1124 |
-
msgstr ""
|
1125 |
-
"Всегда показывать <strong>Информацию (о Ключевых словах) </strong> о "
|
1126 |
-
"выбранных ключевых словах."
|
1127 |
-
|
1128 |
-
#: themes/default/SQ_Menu.php:272
|
1129 |
-
msgid "Change the Website Icon"
|
1130 |
-
msgstr "Изменить Икону Сайта"
|
1131 |
-
|
1132 |
-
#: themes/default/SQ_Menu.php:275
|
1133 |
-
msgid "File types: JPG, JPEG, GIF and PNG."
|
1134 |
-
msgstr "Типы файлов: JPG, JPEG, GIF и PNG"
|
1135 |
-
|
1136 |
-
#: themes/default/SQ_Menu.php:278
|
1137 |
-
msgid "Upload file:"
|
1138 |
-
msgstr "Загрузить файл:"
|
1139 |
-
|
1140 |
-
#: themes/default/SQ_Menu.php:283
|
1141 |
-
msgid "Upload"
|
1142 |
-
msgstr "Загружать "
|
1143 |
-
|
1144 |
-
#: themes/default/SQ_Menu.php:287
|
1145 |
-
#, php-format
|
1146 |
-
msgid ""
|
1147 |
-
"You can use %shttp://convertico.com/%s to convert your photo to icon and "
|
1148 |
-
"upload it here after that."
|
1149 |
-
msgstr ""
|
1150 |
-
"Вы можете использовать %shttp://convertico.com/%s чтобы конвертировать ваши "
|
1151 |
-
"фотографии в иконки и загрузить их сюда."
|
1152 |
-
|
1153 |
-
#: themes/default/SQ_Menu.php:288
|
1154 |
-
msgid ""
|
1155 |
-
"If you don't see the new icon in your browser, empty the browser cache and "
|
1156 |
-
"refresh the page."
|
1157 |
-
msgstr ""
|
1158 |
-
"Если вы не видите новый значок в вашем браузере, очистьте кэш браузера и "
|
1159 |
-
"обновите страницу."
|
1160 |
-
|
1161 |
-
#: themes/default/SQ_Menu.php:292
|
1162 |
-
msgid "Tool for Search Engines"
|
1163 |
-
msgstr "Инструмент для поисковых систем"
|
1164 |
-
|
1165 |
-
#: themes/default/SQ_Menu.php:296
|
1166 |
-
msgid "Google Plus URL:"
|
1167 |
-
msgstr "Google Plus URL:"
|
1168 |
-
|
1169 |
-
#: themes/default/SQ_Menu.php:300
|
1170 |
-
#, php-format
|
1171 |
-
msgid "Google META verification code for %sWebmaster Tool%s`:"
|
1172 |
-
msgstr "Google META код проверки для %sWebmaster Tool%s`:"
|
1173 |
-
|
1174 |
-
#: themes/default/SQ_Menu.php:304
|
1175 |
-
#, php-format
|
1176 |
-
msgid "Google %sAnalytics ID%s`:"
|
1177 |
-
msgstr "Google %sAnalytics ID%s`:"
|
1178 |
-
|
1179 |
-
#: themes/default/SQ_Menu.php:308
|
1180 |
-
#, php-format
|
1181 |
-
msgid "Facebook META code (for %sInsights%s )`:"
|
1182 |
-
msgstr "Код Facebook META (для %sInsights%s )`:"
|
1183 |
-
|
1184 |
-
#: themes/default/SQ_Menu.php:312
|
1185 |
-
#, php-format
|
1186 |
-
msgid "Bing META code (for %sWebmaster Tool%s )`:"
|
1187 |
-
msgstr "Код Bing META (для %sWebmaster Tool%s )`: "
|
1188 |
-
|
1189 |
-
#~ msgid "Can not connect to Squirrly. Error: "
|
1190 |
-
#~ msgstr "Не удается подключиться к Squirrly. Ошибка:"
|
1191 |
-
|
1192 |
-
#~ msgid "Write a new post with Squirrly"
|
1193 |
-
#~ msgstr "Написать новый пост с Squirrly"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models/SQ_BlockSettingsSeo.php
ADDED
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Model_SQ_BlockSettingsSeo {
|
4 |
+
|
5 |
+
var $eTypes;
|
6 |
+
var $appleSizes;
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
$this->appleSizes = preg_split('/[,]+/', _SQ_MOBILE_ICON_SIZES);
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Check if ecommerce is installed
|
14 |
+
* @return boolean
|
15 |
+
*/
|
16 |
+
public function isEcommerce() {
|
17 |
+
if (isset($this->eTypes)) {
|
18 |
+
return $this->eTypes;
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
$this->eTypes = array('product', 'wpsc-product');
|
23 |
+
foreach ($this->eTypes as $key => $type) {
|
24 |
+
if (!in_array($type, get_post_types())) {
|
25 |
+
unset($this->eTypes[$key]);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
if (!empty($this->eTypes)) {
|
30 |
+
return $this->eTypes;
|
31 |
+
}
|
32 |
+
|
33 |
+
return false;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Check the google code saved at settings
|
38 |
+
*
|
39 |
+
* @return string
|
40 |
+
*/
|
41 |
+
public function checkGoogleWTCode($code) {
|
42 |
+
|
43 |
+
if ($code <> '') {
|
44 |
+
if (strpos($code, 'content') !== false) {
|
45 |
+
preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
46 |
+
if (isset($result[1]) && !empty($result[1]))
|
47 |
+
$code = $result[1];
|
48 |
+
}
|
49 |
+
if (strpos($code, '"') !== false) {
|
50 |
+
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
51 |
+
if (isset($result[1]) && !empty($result[1]))
|
52 |
+
$code = $result[1];
|
53 |
+
}
|
54 |
+
|
55 |
+
if ($code == '')
|
56 |
+
SQ_Error::setError(__("The code for Google Webmaster Tool is incorrect.", _SQ_PLUGIN_NAME_));
|
57 |
+
}
|
58 |
+
return $code;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Check the google code saved at settings
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
public function checkGoogleAnalyticsCode($code) {
|
67 |
+
//echo $code;
|
68 |
+
if ($code <> '') {
|
69 |
+
if (strpos($code, '_gaq.push') !== false) {
|
70 |
+
preg_match('/_gaq.push\(\[[\'\"]_setAccount[\'\"],\\s?[\'\"]([^\'\"]+)[\'\"]\]\)/i', $code, $result);
|
71 |
+
if (isset($result[1]) && !empty($result[1]))
|
72 |
+
$code = $result[1];
|
73 |
+
}
|
74 |
+
|
75 |
+
if (strpos($code, '"') !== false) {
|
76 |
+
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
77 |
+
if (isset($result[1]) && !empty($result[1]))
|
78 |
+
$code = $result[1];
|
79 |
+
}
|
80 |
+
|
81 |
+
if (strpos($code, 'UA-') === false) {
|
82 |
+
$code = '';
|
83 |
+
SQ_Error::setError(__("The code for Google Analytics is incorrect.", _SQ_PLUGIN_NAME_));
|
84 |
+
}
|
85 |
+
}
|
86 |
+
return $code;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Check the Facebook code saved at settings
|
91 |
+
*
|
92 |
+
* @return string
|
93 |
+
*/
|
94 |
+
public function checkFavebookInsightsCode($code) {
|
95 |
+
if ($code <> '') {
|
96 |
+
if (strpos($code, 'content') !== false) {
|
97 |
+
preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
98 |
+
$code = '';
|
99 |
+
if (isset($result[1]) && !empty($result[1])) {
|
100 |
+
$code = $result[1];
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
if (strpos($code, 'facebook.com/') !== false) {
|
105 |
+
preg_match('/facebook.com\/([^\/]+)/i', $code, $result);
|
106 |
+
$code = '';
|
107 |
+
if (isset($result[1]) && !empty($result[1])) {
|
108 |
+
$json = SQ_Tools::sq_remote_get('http://graph.facebook.com/' . $result[1]);
|
109 |
+
if ($json <> '') {
|
110 |
+
if ($json = @json_decode($json)) {
|
111 |
+
if (isset($json->id)) {
|
112 |
+
$code = $json->id;
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
if (strpos($code, '"') !== false) {
|
120 |
+
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
121 |
+
$code = '';
|
122 |
+
if (isset($result[1]) && !empty($result[1])) {
|
123 |
+
$code = $result[1];
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
if ($code == '') {
|
128 |
+
SQ_Error::setError(__("The code for Facebook is incorrect.", _SQ_PLUGIN_NAME_));
|
129 |
+
}
|
130 |
+
}
|
131 |
+
return $code;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Check the Pinterest code saved at settings
|
136 |
+
*
|
137 |
+
* @return string
|
138 |
+
*/
|
139 |
+
public function checkPinterestCode($code) {
|
140 |
+
if ($code <> '') {
|
141 |
+
if (strpos($code, 'content') !== false) {
|
142 |
+
preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
143 |
+
if (isset($result[1]) && !empty($result[1]))
|
144 |
+
$code = $result[1];
|
145 |
+
}
|
146 |
+
|
147 |
+
if (strpos($code, '"') !== false) {
|
148 |
+
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
149 |
+
if (isset($result[1]) && !empty($result[1]))
|
150 |
+
$code = $result[1];
|
151 |
+
}
|
152 |
+
|
153 |
+
if ($code == '')
|
154 |
+
SQ_Error::setError(__("The code for Pinterest is incorrect.", _SQ_PLUGIN_NAME_));
|
155 |
+
}
|
156 |
+
return $code;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Check the Bing code saved at settings
|
161 |
+
*
|
162 |
+
* @return string
|
163 |
+
*/
|
164 |
+
public function checkBingWTCode($code) {
|
165 |
+
if ($code <> '') {
|
166 |
+
if (strpos($code, 'content') !== false) {
|
167 |
+
preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
168 |
+
if (isset($result[1]) && !empty($result[1]))
|
169 |
+
$code = $result[1];
|
170 |
+
}
|
171 |
+
|
172 |
+
if (strpos($code, '"') !== false) {
|
173 |
+
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
174 |
+
if (isset($result[1]) && !empty($result[1]))
|
175 |
+
$code = $result[1];
|
176 |
+
}
|
177 |
+
|
178 |
+
if ($code == '')
|
179 |
+
SQ_Error::setError(__("The code for Bing is incorrect.", _SQ_PLUGIN_NAME_));
|
180 |
+
}
|
181 |
+
return $code;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Check the twitter account
|
186 |
+
*
|
187 |
+
* @return string
|
188 |
+
*/
|
189 |
+
public function checkTwitterAccount($account) {
|
190 |
+
if (SQ_ObjController::getModel('SQ_Frontend')->getTwitterAccount($account) === false) {
|
191 |
+
SQ_Error::setError(__("The twitter account is incorrect", _SQ_PLUGIN_NAME_));
|
192 |
+
}
|
193 |
+
if ($account <> '' && strpos($account, 'twitter.') === false) {
|
194 |
+
$account = 'https://twitter.com/' . $account;
|
195 |
+
}
|
196 |
+
return $account;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Check the google + account
|
201 |
+
*
|
202 |
+
* @return string
|
203 |
+
*/
|
204 |
+
public function checkGoogleAccount($account) {
|
205 |
+
if ($account <> '' && strpos($account, 'google.') === false) {
|
206 |
+
$account = 'https://plus.google.com/' . $account;
|
207 |
+
}
|
208 |
+
return $account;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Check the google + account
|
213 |
+
*
|
214 |
+
* @return string
|
215 |
+
*/
|
216 |
+
public function checkLinkeinAccount($account) {
|
217 |
+
if ($account <> '' && strpos($account, 'linkedin.') === false) {
|
218 |
+
$account = 'https://www.linkedin.com/in/' . $account;
|
219 |
+
}
|
220 |
+
return $account;
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Check the facebook account
|
225 |
+
*
|
226 |
+
* @return string
|
227 |
+
*/
|
228 |
+
public function checkFacebookAccount($account) {
|
229 |
+
if ($account <> '' && strpos($account, 'facebook.com') === false) {
|
230 |
+
$account = 'https://www.facebook.com/' . $account;
|
231 |
+
}
|
232 |
+
return $account;
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Add the image to the root path
|
237 |
+
*
|
238 |
+
* @param string $file
|
239 |
+
* @param string $path
|
240 |
+
* @return array [name (the name of the file), favicon (the path of the ico), message (the returned message)]
|
241 |
+
*
|
242 |
+
*/
|
243 |
+
public function addFavicon($file, $path = ABSPATH) {
|
244 |
+
|
245 |
+
/* get the file extension */
|
246 |
+
$file_name = explode('.', $file['name']);
|
247 |
+
$file_type = strtolower($file_name[count($file_name) - 1]);
|
248 |
+
|
249 |
+
$out = array();
|
250 |
+
$out['tmp'] = _SQ_CACHE_DIR_ . strtolower(md5($file['name']) . '_tmp.' . $file_type);
|
251 |
+
$out['favicon'] = _SQ_CACHE_DIR_ . strtolower(md5($file['name']) . '.' . $file_type);
|
252 |
+
foreach ($this->appleSizes as $size) {
|
253 |
+
$out['favicon' . $size] = _SQ_CACHE_DIR_ . strtolower(md5($file['name']) . '.' . $file_type . $size);
|
254 |
+
}
|
255 |
+
|
256 |
+
/* if the file has a name */
|
257 |
+
if (!empty($file['name'])) {
|
258 |
+
/* Check the extension */
|
259 |
+
$file_type = strtolower($file_type);
|
260 |
+
$files = array('ico', 'jpeg', 'jpg', 'gif', 'png');
|
261 |
+
$key = in_array($file_type, $files);
|
262 |
+
|
263 |
+
if (!$key) {
|
264 |
+
SQ_Error::setError(__("File type error: Only ICO, JPEG, JPG, GIF or PNG files are allowed.", _SQ_PLUGIN_NAME_));
|
265 |
+
return;
|
266 |
+
}
|
267 |
+
|
268 |
+
/* Check for error messages */
|
269 |
+
if (!$this->checkFunctions()) {
|
270 |
+
SQ_Error::setError(__("GD error: The GD library must be installed on your server.", _SQ_PLUGIN_NAME_));
|
271 |
+
return;
|
272 |
+
} else {
|
273 |
+
/* Delete the previous file if exists */
|
274 |
+
if (is_file($out['favicon'])) {
|
275 |
+
if (!unlink($out['favicon'])) {
|
276 |
+
SQ_Error::setError(__("Delete error: Could not delete the old favicon.", _SQ_PLUGIN_NAME_));
|
277 |
+
return;
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
/* Upload the file */
|
282 |
+
if (!move_uploaded_file($file['tmp_name'], $out['tmp'])) {
|
283 |
+
SQ_Error::setError(__("Upload error: Could not upload the favicon.", _SQ_PLUGIN_NAME_));
|
284 |
+
return;
|
285 |
+
}
|
286 |
+
|
287 |
+
/* Change the permision */
|
288 |
+
if (!chmod($out['tmp'], 0755)) {
|
289 |
+
SQ_Error::setError(__("Permission error: Could not change the favicon permissions.", _SQ_PLUGIN_NAME_));
|
290 |
+
return;
|
291 |
+
}
|
292 |
+
|
293 |
+
if ($file_type <> 'ico') {
|
294 |
+
/* Save the file */
|
295 |
+
if ($out['tmp']) {
|
296 |
+
$ico = SQ_ObjController::getModel('SQ_Ico');
|
297 |
+
$ico->set_image($out['tmp'], array(32, 32));
|
298 |
+
if ($ico->save_ico($out['favicon'])) {
|
299 |
+
if (file_exists($path . "/" . 'favicon.ico')) {
|
300 |
+
$ico->remove_ico($path . "/" . 'favicon.ico');
|
301 |
+
}
|
302 |
+
}
|
303 |
+
foreach ($this->appleSizes as $size) {
|
304 |
+
$ico->set_image($out['tmp'], array($size, $size));
|
305 |
+
$ico->save_ico($out['favicon' . $size]);
|
306 |
+
}
|
307 |
+
} else {
|
308 |
+
SQ_Error::setError(__("ICO Error: Could not create the ICO from file. Try with another file type.", _SQ_PLUGIN_NAME_));
|
309 |
+
}
|
310 |
+
} else {
|
311 |
+
if (file_exists($path . "/" . 'favicon.ico')) {
|
312 |
+
$ico->remove_ico($path . "/" . 'favicon.ico');
|
313 |
+
}
|
314 |
+
}
|
315 |
+
$ico->remove_ico($out['tmp']);
|
316 |
+
unset($out['tmp']);
|
317 |
+
$out['message'] = __("The favicon has been updated.", _SQ_PLUGIN_NAME_);
|
318 |
+
|
319 |
+
return $out;
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
private function checkFunctions() {
|
325 |
+
$required_functions = array(
|
326 |
+
'getimagesize',
|
327 |
+
'imagecreatefromstring',
|
328 |
+
'imagecreatetruecolor',
|
329 |
+
'imagecolortransparent',
|
330 |
+
'imagecolorallocatealpha',
|
331 |
+
'imagealphablending',
|
332 |
+
'imagesavealpha',
|
333 |
+
'imagesx',
|
334 |
+
'imagesy',
|
335 |
+
'imagecopyresampled',
|
336 |
+
);
|
337 |
+
|
338 |
+
foreach ($required_functions as $function) {
|
339 |
+
if (!function_exists($function)) {
|
340 |
+
SQ_Error::setError("The PHP_ICO class was unable to find the $function function, which is part of the GD library. Ensure that the system has the GD library installed and that PHP has access to it through a PHP interface, such as PHP's GD module. Since this function was not found, the library will be unable to create ICO files.");
|
341 |
+
return false;
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
return true;
|
346 |
+
}
|
347 |
+
|
348 |
+
}
|
models/SQ_BlockStatus.php
DELETED
@@ -1,158 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* The model class for SQ_BlockStatus
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class Model_SQ_BlockStatus {
|
8 |
-
|
9 |
-
/** @var string */
|
10 |
-
private $analytics_table;
|
11 |
-
|
12 |
-
/** @var integer Days to the latest traffic check */
|
13 |
-
private $prev_check;
|
14 |
-
|
15 |
-
public function __construct() {
|
16 |
-
$traffic = SQ_ObjController::getController('SQ_Traffic', false);
|
17 |
-
|
18 |
-
//get the analytic table name
|
19 |
-
$this->analytics_table = $traffic->getAnalyticsTable();
|
20 |
-
|
21 |
-
$this->prev_check = 7;
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Add the global progress of the traffic
|
26 |
-
*
|
27 |
-
*/
|
28 |
-
public function getGlobalProgress() {
|
29 |
-
global $wpdb;
|
30 |
-
|
31 |
-
if ($wpdb->get_var("SHOW TABLES LIKE '" . $this->analytics_table . "'") != $this->analytics_table)
|
32 |
-
return false;
|
33 |
-
|
34 |
-
$progress = $this->setProgress();
|
35 |
-
if (isset(SQ_Tools::$options['sq_posts_status_close'])) {
|
36 |
-
$latest = $this->setProgress(date('Y-m-d', time() - 3600 * 24 * $this->prev_check));
|
37 |
-
//Chech if there is an inrease in trafic sinse previous check
|
38 |
-
$progress['increase'] = (int) ($latest['gapr'] < $progress['gapr']);
|
39 |
-
$progress['latest'] = $latest;
|
40 |
-
} else {
|
41 |
-
$progress['increase'] = 1;
|
42 |
-
}
|
43 |
-
return $progress;
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
*
|
48 |
-
* @param type $until
|
49 |
-
* @return type
|
50 |
-
*/
|
51 |
-
private function setProgress($until = '') {
|
52 |
-
$progress = array('op' => 0, 'nop' => 0, 'opc' => 0, 'nopc' => 0, 'gapr' => 0);
|
53 |
-
|
54 |
-
if ($tno = $this->getNOProgress($until))
|
55 |
-
if ($to = $this->getOProgress($until))
|
56 |
-
if ($to->count > 0 && $tno->count > 0 && $to->posts > 0 && $tno->posts > 0) {
|
57 |
-
$gapr = ((($to->count / $to->posts) * 100) / ($tno->count / $tno->posts)) - 100;
|
58 |
-
$progress = array('op' => $to->posts,
|
59 |
-
'nop' => $tno->posts,
|
60 |
-
'opc' => $to->count,
|
61 |
-
'nopc' => $tno->count,
|
62 |
-
'gapr' => $gapr
|
63 |
-
);
|
64 |
-
}
|
65 |
-
|
66 |
-
return $progress;
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Get the unoptimized traffic from database
|
71 |
-
* @global type $wpdb
|
72 |
-
* @return type
|
73 |
-
*/
|
74 |
-
public function getNOProgress($until) {
|
75 |
-
global $wpdb;
|
76 |
-
if ($until <> '')
|
77 |
-
$until = " AND date < '" . $until . "'";
|
78 |
-
|
79 |
-
$sql = "SELECT SUM(analytics.`count`) as `count`, COUNT(DISTINCT analytics.`post_id`) as `posts`
|
80 |
-
FROM `" . $this->analytics_table . "` analytics
|
81 |
-
INNER JOIN " . $wpdb->posts . " wp ON wp.ID = analytics.`post_id` AND wp.post_status = 'publish'
|
82 |
-
WHERE keyword = ''
|
83 |
-
" . $until;
|
84 |
-
|
85 |
-
return $wpdb->get_row($sql);
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Get the optimized traffic from database
|
90 |
-
* @global type $wpdb
|
91 |
-
* @return type
|
92 |
-
*/
|
93 |
-
public function getOProgress($until) {
|
94 |
-
global $wpdb;
|
95 |
-
if ($until <> '')
|
96 |
-
$until = " AND date < '" . $until . "'";
|
97 |
-
|
98 |
-
$sql = "SELECT SUM(analytics.`count`) as `count`, COUNT(DISTINCT analytics.`post_id`) as `posts`
|
99 |
-
FROM `" . $this->analytics_table . "` analytics
|
100 |
-
INNER JOIN " . $wpdb->posts . " wp ON wp.ID = analytics.`post_id` AND wp.post_status = 'publish'
|
101 |
-
WHERE keyword <> ''
|
102 |
-
" . $until;
|
103 |
-
|
104 |
-
return $wpdb->get_row($sql);
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Pack the traffic status popup
|
109 |
-
* @param array $progress
|
110 |
-
* @return string
|
111 |
-
*/
|
112 |
-
public function packStatus($progress) {
|
113 |
-
$str = '';
|
114 |
-
//Check show conditions
|
115 |
-
if (!$this->showPopup($progress))
|
116 |
-
return;
|
117 |
-
if (isset(SQ_Tools::$options['sq_posts_status_close']) && (time() - SQ_Tools::$options['sq_posts_status_close'] < 3600 * 24 * $this->prev_check))
|
118 |
-
return; //min 7 days before show it again
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
//Set the percent string to progress
|
124 |
-
$progress['gapr'] = number_format($progress['gapr'], 0) . '%';
|
125 |
-
$str .= '
|
126 |
-
<div id="sq_status">
|
127 |
-
<ul class="sq_box">
|
128 |
-
<li class="sq_header"><span>Squirrly SEO</span>' . sprintf(__('%s More Traffic for you!'), $progress['gapr']) . '<span class="sq_status_close">' . __('[close this box]') . ' X</span></li>
|
129 |
-
<li>
|
130 |
-
<div class="sq_status_image"></div>
|
131 |
-
<table>
|
132 |
-
<tr>
|
133 |
-
<td class="sq_status_text1">' . __('CONGRATULATIONS!!') . ' :-)</td>
|
134 |
-
<td class="sq_status_bigtext" rowspan="2">' . $progress['gapr'] . '</td>
|
135 |
-
</tr>
|
136 |
-
<td class="sq_status_text2">' . __('Your Traffic Increased by:') . '</td>
|
137 |
-
<tr>
|
138 |
-
</tr>
|
139 |
-
</table>
|
140 |
-
</li>
|
141 |
-
<li class="sq_status_text3">' . sprintf(__('the articles you’ve optimized with Squirrly SEO bring you %s more traffic than the other ones.'), $progress['gapr']) . '
|
142 |
-
</li>
|
143 |
-
</ul>
|
144 |
-
<div>
|
145 |
-
';
|
146 |
-
|
147 |
-
return $str;
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Show popup condition
|
152 |
-
* @return type
|
153 |
-
*/
|
154 |
-
private function showPopup($progress) {
|
155 |
-
return ($progress['op'] > 0 && $progress['nop'] > 0 && ($progress['op'] < $progress['nop']) && $progress['opc'] > 100 && $progress['gapr'] > 100 && $progress['increase'] == 1);
|
156 |
-
}
|
157 |
-
|
158 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models/SQ_Blockseo.php
CHANGED
@@ -20,9 +20,9 @@ class Model_SQ_Blockseo {
|
|
20 |
if ((int) $sq_postID == 0)
|
21 |
return;
|
22 |
|
23 |
-
$meta = array('
|
24 |
-
'
|
25 |
-
'
|
26 |
|
27 |
$sql = "SELECT `meta_id`, `meta_value`, `meta_key`
|
28 |
FROM `" . $wpdb->postmeta . "`
|
20 |
if ((int) $sq_postID == 0)
|
21 |
return;
|
22 |
|
23 |
+
$meta = array('_sq_fp_title' => '',
|
24 |
+
'_sq_fp_description' => '',
|
25 |
+
'_sq_fp_ogimage' => '');
|
26 |
|
27 |
$sql = "SELECT `meta_id`, `meta_value`, `meta_key`
|
28 |
FROM `" . $wpdb->postmeta . "`
|
models/SQ_Frontend.php
CHANGED
@@ -2,8 +2,13 @@
|
|
2 |
|
3 |
class Model_SQ_Frontend {
|
4 |
|
|
|
|
|
|
|
|
|
5 |
/** @var canonical link */
|
6 |
private $url;
|
|
|
7 |
|
8 |
/** @var string */
|
9 |
private $title;
|
@@ -27,18 +32,14 @@ class Model_SQ_Frontend {
|
|
27 |
private $min_description_length = 70;
|
28 |
|
29 |
/** @var integer */
|
30 |
-
private $
|
31 |
-
|
32 |
-
/** @var object Current post */
|
33 |
-
private $post;
|
34 |
-
private $post_type;
|
35 |
|
36 |
/** @var array Meta custom content */
|
37 |
private $meta = array();
|
38 |
|
39 |
public function __construct() {
|
40 |
SQ_ObjController::getController('SQ_Tools', false);
|
41 |
-
$this->post_type =
|
42 |
}
|
43 |
|
44 |
/** @var meta from other plugins */
|
@@ -48,7 +49,7 @@ class Model_SQ_Frontend {
|
|
48 |
* @return string
|
49 |
*/
|
50 |
public function setStart() {
|
51 |
-
return "\n\n<!-- Squirrly
|
52 |
}
|
53 |
|
54 |
/**
|
@@ -56,7 +57,7 @@ class Model_SQ_Frontend {
|
|
56 |
* @return string
|
57 |
*/
|
58 |
public function setEnd() {
|
59 |
-
return "<!-- /Squirrly
|
60 |
}
|
61 |
|
62 |
/* * *****USE BUFFER****** */
|
@@ -103,38 +104,41 @@ class Model_SQ_Frontend {
|
|
103 |
* @return string
|
104 |
*/
|
105 |
private function setMetaInBuffer($buffer) {
|
106 |
-
global $
|
107 |
-
|
|
|
|
|
108 |
return $buffer;
|
109 |
}
|
110 |
|
111 |
//get the post from shop if woocommerce is installed
|
112 |
if (function_exists('is_shop') && is_shop()) {
|
113 |
$this->post = get_post(woocommerce_get_page_id('shop'));
|
114 |
-
}
|
115 |
$this->post = get_post($post->ID);
|
116 |
}
|
117 |
|
118 |
-
if (
|
119 |
preg_match("/<head[^>]*>/i", $buffer, $out);
|
120 |
if (!empty($out)) {
|
121 |
-
$title = $this->getCustomTitle();
|
122 |
-
if (isset($title) &&
|
123 |
-
|
|
|
124 |
if ($count == 0) { //if no title found
|
125 |
-
$buffer .= sprintf("<title>%s</title>", $title) . "\n";
|
126 |
-
}
|
127 |
}
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
$buffer = @preg_replace('/<meta[^>]*name=\"description\"[^>]*content=[\"|\'][^>]*[\"|\'][^>]*>/si', $description, $buffer, 1, $count);
|
133 |
}
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
138 |
}
|
139 |
}
|
140 |
}
|
@@ -149,17 +153,9 @@ class Model_SQ_Frontend {
|
|
149 |
* @return string
|
150 |
*/
|
151 |
public function setHeader() {
|
152 |
-
global $
|
153 |
$ret = '';
|
154 |
|
155 |
-
//get the post from shop if woocommerce is installed
|
156 |
-
if (function_exists('is_shop') && is_shop()) {
|
157 |
-
$this->post = get_post(woocommerce_get_page_id('shop'));
|
158 |
-
} else {
|
159 |
-
$this->post = get_post($post->ID);
|
160 |
-
}
|
161 |
-
|
162 |
-
$this->meta['blogname'] = get_bloginfo('name');
|
163 |
|
164 |
if (!function_exists('preg_replace')) {
|
165 |
return $ret;
|
@@ -167,8 +163,26 @@ class Model_SQ_Frontend {
|
|
167 |
|
168 |
if ($this->isHomePage() || is_single() || is_page() || is_singular() || is_preview() || is_archive() || is_category() || is_author() || is_tag() || is_search() || in_array(get_post_type(), $this->post_type)) {
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
/* Meta setting */
|
171 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
//Add description in homepage if is set or add description in other pages if is not home page
|
174 |
if ((SQ_Tools::$options['sq_auto_description'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
|
@@ -191,9 +205,10 @@ class Model_SQ_Frontend {
|
|
191 |
}
|
192 |
|
193 |
if (SQ_Tools::$options['sq_auto_meta'] == 1) {
|
194 |
-
$ret .=
|
195 |
$ret .= $this->getGooglePlusMeta();
|
196 |
$ret .= $this->getLanguage();
|
|
|
197 |
$ret .= $this->getDublinCore();
|
198 |
}
|
199 |
if (SQ_Tools::$options['sq_auto_facebook'] == 1) {
|
@@ -201,7 +216,7 @@ class Model_SQ_Frontend {
|
|
201 |
}
|
202 |
|
203 |
if (SQ_Tools::$options['sq_auto_twitter'] == 1) {
|
204 |
-
$ret .= $this->getTwitterCard(
|
205 |
}
|
206 |
/* SEO optimizer tool */
|
207 |
$ret .= $this->getGoogleWT();
|
@@ -209,15 +224,18 @@ class Model_SQ_Frontend {
|
|
209 |
$ret .= $this->getFacebookIns();
|
210 |
$ret .= $this->getBingWT();
|
211 |
$ret .= $this->getPinterest();
|
212 |
-
|
213 |
$ret .= $this->getAlexaT();
|
214 |
|
|
|
|
|
|
|
|
|
215 |
$ret .= $this->setEnd();
|
216 |
}
|
217 |
return $ret;
|
218 |
}
|
219 |
|
220 |
-
private function getTwitterCard(
|
221 |
$meta = "\n";
|
222 |
|
223 |
//Title and Description is required
|
@@ -225,29 +243,52 @@ class Model_SQ_Frontend {
|
|
225 |
return;
|
226 |
}
|
227 |
|
228 |
-
|
229 |
-
|
230 |
-
}
|
231 |
-
|
232 |
-
//if ($options['sq_twitter_creator'] == '' && $options['sq_twitter_site'] == '') return;
|
233 |
-
$sq_twitter_creator = $options['sq_twitter_account'];
|
234 |
-
$sq_twitter_site = $options['sq_twitter_account'];
|
235 |
|
236 |
if (!isset($this->thumb_image) || $this->thumb_image == '') {
|
237 |
-
$
|
|
|
|
|
|
|
238 |
}
|
239 |
|
240 |
$meta .= '<meta name="twitter:card" content="summary" />' . "\n";
|
241 |
|
242 |
-
$meta .= (($sq_twitter_creator <> '') ? sprintf('<meta name="twitter:creator" content="%s" />', $sq_twitter_creator) . "\n" : '');
|
243 |
-
$meta .= (($sq_twitter_site <> '') ? sprintf('<meta name="twitter:site" content="%s" />', $
|
244 |
$meta .= sprintf('<meta name="twitter:url" content="%s">', $this->url) . "\n";
|
245 |
$meta .= sprintf('<meta name="twitter:title" content="%s">', $this->title) . "\n";
|
246 |
$meta .= (($this->description <> '') ? sprintf('<meta name="twitter:description" content="%s">', $this->description . ' | ' . $this->meta['blogname']) . "\n" : '');
|
247 |
$meta .= ((isset($this->thumb_image) && $this->thumb_image <> '') ? sprintf('<meta name="twitter:image" content="%s">', $this->thumb_image) . "\n" : '');
|
248 |
$meta .= (($this->meta['blogname'] <> '') ? sprintf('<meta name="twitter:domain" content="%s">', $this->meta['blogname']) . "\n" : '');
|
249 |
|
250 |
-
return $meta;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
|
253 |
/**
|
@@ -257,29 +298,29 @@ class Model_SQ_Frontend {
|
|
257 |
private function getOpenGraph() {
|
258 |
$meta = "\n";
|
259 |
$image = '';
|
260 |
-
$ogimage = null;
|
261 |
|
262 |
-
$url = $this->getCanonicalUrl();
|
263 |
if (!isset($this->thumb_image) || $this->thumb_image == '') {
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
$this->thumb_image = $this->getImageFromContent();
|
268 |
}
|
269 |
}
|
270 |
|
271 |
if (!isset($this->thumb_video) || $this->thumb_video == '') {
|
272 |
-
$
|
|
|
|
|
|
|
273 |
}
|
274 |
|
275 |
-
if ($image == '' && $url == '') {
|
276 |
return;
|
277 |
}
|
278 |
//GET THE URL
|
279 |
-
$meta .= sprintf('<meta property="og:url" content="%s" />', $url) . "\n";
|
280 |
-
if (
|
281 |
$meta .= sprintf('<meta property="og:image" content="%s" />', $this->thumb_image) . "\n";
|
282 |
-
$meta .= sprintf('<meta property="og:image:width" content="%s" />',
|
283 |
}
|
284 |
|
285 |
if ((isset($this->thumb_video) && $this->thumb_video <> '')) {
|
@@ -288,7 +329,7 @@ class Model_SQ_Frontend {
|
|
288 |
|
289 |
$meta .= sprintf('<meta property="og:title" content="%s" />', $this->title) . "\n";
|
290 |
$meta .= sprintf('<meta property="og:description" content="%s" />', $this->description) . "\n";
|
291 |
-
$meta .= (($this->meta['blogname'] <> '') ? sprintf('<meta property="og:site_name" content="%s" />', $this->meta['blogname']) . "\n" : '');
|
292 |
|
293 |
if (is_author()) {
|
294 |
$author = get_queried_object();
|
@@ -297,10 +338,10 @@ class Model_SQ_Frontend {
|
|
297 |
$meta .= sprintf('<meta property="profile:first_name" content="%s" />', get_the_author_meta('first_name', $author->ID)) . "\n";
|
298 |
$meta .= sprintf('<meta property="profile:last_name" content="%s" />', get_the_author_meta('last_name', $author->ID)) . "\n";
|
299 |
} elseif (!$this->isHomePage() && (is_single() || is_page())) {
|
300 |
-
$meta .= sprintf('<meta property="og:type" content="%s" />', ((isset($this->thumb_video) && $this->thumb_video <> '') ? 'video' : 'article')) . "\n";
|
301 |
if ((isset($this->thumb_video) && $this->thumb_video <> '')) {
|
302 |
-
|
303 |
} else {
|
|
|
304 |
$meta .= sprintf('<meta property="article:published_time" content="%s" />', get_the_time('c', $this->post->ID)) . "\n";
|
305 |
if ($this->keywords <> '') {
|
306 |
$keywords = preg_split('/[,]+/', $this->keywords);
|
@@ -315,7 +356,7 @@ class Model_SQ_Frontend {
|
|
315 |
$meta .= sprintf('<meta property="og:type" content="%s" />', 'website') . "\n";
|
316 |
}
|
317 |
|
318 |
-
return $meta;
|
319 |
}
|
320 |
|
321 |
/**
|
@@ -324,9 +365,6 @@ class Model_SQ_Frontend {
|
|
324 |
* @return string
|
325 |
*/
|
326 |
private function setCanonical() {
|
327 |
-
if (!isset($this->url)) {
|
328 |
-
$this->url = $this->getCanonicalUrl();
|
329 |
-
}
|
330 |
|
331 |
if ($this->url) {
|
332 |
remove_action('wp_head', 'rel_canonical');
|
@@ -342,15 +380,14 @@ class Model_SQ_Frontend {
|
|
342 |
$meta = "";
|
343 |
if (!$this->isHomePage()) {
|
344 |
if (get_previous_posts_link()) {
|
345 |
-
$meta .= sprintf('<link rel="prev" href="%s" />', get_pagenum_link($paged - 1)) . "\n";
|
346 |
}
|
347 |
if (get_next_posts_link()) {
|
348 |
-
$meta .= sprintf('<link rel="next" href="%s" />', get_pagenum_link($paged + 1)) . "\n";
|
349 |
}
|
350 |
}
|
351 |
|
352 |
-
return (($meta <> '') ?
|
353 |
-
$meta . "\n" : '');
|
354 |
}
|
355 |
|
356 |
/**
|
@@ -360,46 +397,82 @@ class Model_SQ_Frontend {
|
|
360 |
*/
|
361 |
public function getCustomTitle() {
|
362 |
$title = '';
|
363 |
-
$sep = '|';
|
|
|
|
|
|
|
|
|
364 |
|
365 |
//If its a post/page
|
366 |
if (!$this->isHomePage()) {
|
367 |
//If is category
|
368 |
if (is_category()) { //for category
|
369 |
$category = get_category(get_query_var('cat'), false);
|
370 |
-
$title =
|
371 |
if ($title == '') {
|
372 |
-
$title = $this->
|
373 |
}
|
374 |
if (is_paged()) {
|
375 |
-
$title .=
|
376 |
}
|
377 |
} elseif (is_author()) { //for author
|
378 |
-
$author = SQ_Tools::i18n(get_the_author_meta('nicename', get_query_var('author')));
|
379 |
-
|
380 |
if ($title == '') {
|
381 |
-
$title = $this->
|
382 |
}
|
383 |
if ($title == '') {
|
384 |
-
$title = __('About') . " " . ucfirst($
|
385 |
}
|
386 |
if (is_paged()) {
|
387 |
-
$title .=
|
388 |
}
|
389 |
} elseif (is_tag()) { //for tags
|
390 |
if (is_paged()) {
|
391 |
$tag = get_query_var('tag');
|
392 |
-
$title = ucfirst(str_replace('-', ' ',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
}
|
394 |
} elseif (is_single() || is_page() || is_singular() || in_array(get_post_type(), $this->post_type)) {
|
395 |
-
|
396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
}
|
398 |
}
|
399 |
|
400 |
//If title then clear it and truncate it
|
401 |
if ($title <> '') {
|
402 |
-
$title = $this->truncate($
|
403 |
}
|
404 |
|
405 |
/* Check if is a predefined Title for home page */
|
@@ -408,96 +481,114 @@ class Model_SQ_Frontend {
|
|
408 |
|
409 |
//If the home page is a static page that has custom snippet
|
410 |
if (is_page() && isset($this->post) && isset($this->post->ID) && $this->getAdvancedMeta($this->post->ID, 'title') <> '') {
|
411 |
-
$title =
|
412 |
-
} elseif (SQ_Tools
|
413 |
-
$title =
|
414 |
} else {
|
415 |
-
$title = $this->
|
416 |
if ($title <> "" && $this->meta['blogname'] <> '') {
|
417 |
-
$title .=
|
418 |
}
|
419 |
}
|
420 |
}
|
421 |
|
|
|
|
|
422 |
|
|
|
|
|
|
|
|
|
423 |
return $title;
|
424 |
}
|
425 |
|
426 |
/**
|
427 |
* Get the image from content
|
428 |
* @global type $wp_query
|
|
|
429 |
* @return type
|
430 |
*/
|
431 |
-
public function
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
if (!empty($wp_query->posts))
|
438 |
-
foreach ($wp_query->posts as $post) {
|
439 |
-
if (isset($post->ID) && get_post_status($post->ID) == 'publish') {
|
440 |
-
$post = get_post($post->ID);
|
441 |
-
break;
|
442 |
-
}
|
443 |
-
}
|
444 |
}
|
445 |
|
446 |
if ($post && isset($post->ID)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
if (has_post_thumbnail($post->ID)) {
|
448 |
-
$
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
|
|
|
|
|
|
|
|
453 |
preg_match('/<img[^>]*src="([^"]*)"[^>]*>/i', $post->post_content, $match);
|
454 |
-
if (empty($match)) {
|
455 |
-
return;
|
456 |
-
}
|
457 |
|
458 |
-
if (
|
459 |
-
|
460 |
-
}
|
461 |
|
462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
}
|
464 |
}
|
|
|
|
|
465 |
}
|
466 |
|
467 |
/**
|
468 |
* Get the video from content
|
469 |
-
* @
|
470 |
* @return type
|
471 |
*/
|
472 |
-
public function
|
473 |
-
|
474 |
-
|
|
|
|
|
|
|
|
|
475 |
}
|
476 |
|
477 |
-
if (isset($
|
478 |
-
|
|
|
479 |
|
480 |
-
|
481 |
-
|
482 |
-
|
|
|
|
|
483 |
}
|
484 |
-
}
|
485 |
|
486 |
-
|
487 |
-
$match)) {
|
488 |
|
489 |
-
|
490 |
-
|
491 |
-
|
|
|
492 |
}
|
493 |
|
494 |
-
return $
|
495 |
-
}
|
496 |
-
|
497 |
-
private function clearTitle($title) {
|
498 |
-
$title = str_replace(array('"', " ", " "), array('', ' ', ' '), $title);
|
499 |
-
return trim(strip_tags(html_entity_decode(
|
500 |
-
$title)));
|
501 |
}
|
502 |
|
503 |
/**
|
@@ -506,7 +597,8 @@ class Model_SQ_Frontend {
|
|
506 |
* @return string
|
507 |
*/
|
508 |
private function getCustomDescription() {
|
509 |
-
|
|
|
510 |
$description = '';
|
511 |
|
512 |
//If not homepage
|
@@ -514,44 +606,79 @@ class Model_SQ_Frontend {
|
|
514 |
//If is a category
|
515 |
if (is_category()) { //for categories
|
516 |
$category = get_category(get_query_var('cat'), false);
|
517 |
-
$description =
|
518 |
if ($description == '') {
|
519 |
-
$description =
|
520 |
}
|
521 |
if ($description == '') {
|
522 |
$description = $this->grabDescriptionFromPost();
|
523 |
}
|
524 |
|
525 |
if (is_paged()) {
|
526 |
-
$description .=
|
527 |
}
|
528 |
|
529 |
if ($this->isHomePage() && $description <> '') {
|
530 |
if ($this->meta['blogname'] <> '') {
|
531 |
-
$description .=
|
532 |
}
|
533 |
}
|
|
|
534 |
} elseif (is_author()) { //for author
|
535 |
-
$description =
|
536 |
if ($description == '') {
|
537 |
-
$
|
538 |
-
$description = $this->grabDescriptionFromPost() . " " . $sep . " " . $author;
|
539 |
}
|
540 |
if (is_paged()) {
|
541 |
-
$description .=
|
542 |
}
|
543 |
} elseif (is_tag()) { //for tags
|
544 |
-
$description =
|
545 |
if ($description == '') {
|
546 |
-
$tag =
|
547 |
-
$description = ucfirst($tag) .
|
548 |
}
|
549 |
if (is_paged()) {
|
550 |
-
$description .=
|
551 |
}
|
552 |
-
} elseif (
|
|
|
553 |
if (isset($this->post) && isset($this->post->ID)) {
|
554 |
$description = $this->grabDescriptionFromPost($this->post->ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
}
|
556 |
}
|
557 |
}
|
@@ -562,7 +689,7 @@ class Model_SQ_Frontend {
|
|
562 |
|
563 |
//If the home page is a static page that has custom snippet
|
564 |
if (is_page() && isset($this->post) && isset($this->post->ID) && $this->getAdvancedMeta($this->post->ID, 'description') <> '') {
|
565 |
-
$description =
|
566 |
} elseif (SQ_Tools::$options ['sq_fp_description'] <> '') {
|
567 |
$description = strip_tags(SQ_Tools::$options['sq_fp_description']);
|
568 |
} else {
|
@@ -572,33 +699,30 @@ class Model_SQ_Frontend {
|
|
572 |
|
573 |
$description = (($description <> '') ? $description : $this->title);
|
574 |
if ($description <> '') {
|
575 |
-
$this->description = $this->clearDescription($description);
|
576 |
|
|
|
577 |
if ($this->description <> '') { //prevent blank description
|
578 |
-
|
579 |
-
} else {
|
580 |
-
$description = '';
|
581 |
}
|
582 |
}
|
583 |
|
584 |
-
return
|
585 |
}
|
586 |
|
587 |
-
|
588 |
-
$description
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
|
597 |
-
|
598 |
-
|
599 |
-
$description = str_replace('"', '\'', $description);
|
600 |
|
601 |
-
return
|
602 |
}
|
603 |
|
604 |
/**
|
@@ -607,7 +731,6 @@ class Model_SQ_Frontend {
|
|
607 |
* @return string
|
608 |
*/
|
609 |
private function getCustomKeyword() {
|
610 |
-
global $wp_query;
|
611 |
$keywords = '';
|
612 |
|
613 |
if ($this->checkPostsPage() && SQ_Tools::$options['sq_auto_description'] == 1) {
|
@@ -627,7 +750,7 @@ class Model_SQ_Frontend {
|
|
627 |
}
|
628 |
|
629 |
if (isset($keywords) && !empty($keywords) && !(is_home() && is_paged())) {
|
630 |
-
$this->keywords = str_replace('"', '', $keywords);
|
631 |
|
632 |
return sprintf("<meta name=\"keywords\" content=\"%s\" />", $this->keywords);
|
633 |
}
|
@@ -641,16 +764,18 @@ class Model_SQ_Frontend {
|
|
641 |
* @return string
|
642 |
*/
|
643 |
private function getCopyright() {
|
644 |
-
$
|
|
|
|
|
645 |
if (!$name) {
|
646 |
$name = $this->meta['blogname'];
|
647 |
}
|
648 |
|
649 |
if ($name <> '') {
|
650 |
-
|
651 |
}
|
652 |
|
653 |
-
return
|
654 |
}
|
655 |
|
656 |
/**
|
@@ -659,24 +784,18 @@ class Model_SQ_Frontend {
|
|
659 |
* @return string
|
660 |
*/
|
661 |
private function getGooglePlusMeta() {
|
|
|
662 |
$author = SQ_Tools::$options['sq_google_plus'];
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
$author = $this->meta['blogname'];
|
667 |
-
} elseif (strpos($author, 'plus.google.com') === false && is_numeric($author)) {
|
668 |
-
$author = 'https://plus.google.com/' . $author . '/posts';
|
669 |
}
|
670 |
|
671 |
-
if ($
|
672 |
-
|
673 |
-
} else {
|
674 |
-
if (is_single() && !class_exists('ABH_Classes_ObjController')) {
|
675 |
-
return '<link rel="author" href="' . $author . '" />' . "\n";
|
676 |
-
}
|
677 |
}
|
678 |
|
679 |
-
return
|
680 |
}
|
681 |
|
682 |
/**
|
@@ -685,24 +804,27 @@ class Model_SQ_Frontend {
|
|
685 |
* @return string
|
686 |
*/
|
687 |
private function getFavicon() {
|
688 |
-
|
689 |
-
$str = '';
|
690 |
$rnd = '';
|
691 |
|
692 |
-
if (
|
693 |
-
|
694 |
-
$rnd = '?ver=' . base64_encode(SQ_Tools::$options['favicon_tmp']);
|
695 |
-
}
|
696 |
}
|
697 |
|
698 |
-
|
|
|
|
|
|
|
|
|
|
|
699 |
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
|
|
704 |
}
|
705 |
-
return $
|
706 |
}
|
707 |
|
708 |
/**
|
@@ -712,22 +834,19 @@ class Model_SQ_Frontend {
|
|
712 |
*/
|
713 |
private function getLanguage() {
|
714 |
$meta = '';
|
715 |
-
|
716 |
-
|
717 |
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
}
|
722 |
}
|
723 |
|
724 |
-
$language = get_bloginfo('language');
|
725 |
-
|
726 |
if ($language <> '') {
|
727 |
-
$meta .= sprintf("<meta name=\"language\" content=\"%s\" />", $language) . "\n";
|
728 |
}
|
729 |
|
730 |
-
return $meta;
|
731 |
}
|
732 |
|
733 |
/**
|
@@ -736,35 +855,32 @@ class Model_SQ_Frontend {
|
|
736 |
* @return string
|
737 |
*/
|
738 |
private function getDublinCore() {
|
739 |
-
global $wp_query;
|
740 |
$date = null;
|
741 |
$meta = '';
|
742 |
|
743 |
-
$name = $this->
|
744 |
if (!$name) {
|
745 |
$name = $this->meta['blogname'];
|
746 |
}
|
747 |
|
748 |
if ($name <> '') {
|
749 |
-
$meta .= sprintf("<meta name=\"
|
750 |
}
|
751 |
|
752 |
-
$meta .= sprintf('<meta name="
|
753 |
-
$meta .= sprintf('<meta name="
|
754 |
|
755 |
if ($this->isHomePage()) {
|
756 |
-
$date = date('Y-m-d', strtotime(get_lastpostmodified()));
|
757 |
-
} elseif (is_single()) {
|
758 |
$date = date('Y-m-d', strtotime($this->post->post_date));
|
759 |
}
|
760 |
|
761 |
-
if ($date) {
|
762 |
-
$meta .= sprintf("<meta name=\"
|
763 |
-
|
764 |
-
$meta .= sprintf("<meta name=\"DC.date.issued\" content=\"%s\" />", $date) . "\n";
|
765 |
}
|
766 |
|
767 |
-
return $meta;
|
768 |
}
|
769 |
|
770 |
/**
|
@@ -773,13 +889,15 @@ class Model_SQ_Frontend {
|
|
773 |
* @return string
|
774 |
*/
|
775 |
private function getXMLSitemap() {
|
776 |
-
$
|
|
|
|
|
777 |
|
778 |
if ($xml_url <> '') {
|
779 |
-
|
780 |
}
|
781 |
|
782 |
-
return
|
783 |
}
|
784 |
|
785 |
/**
|
@@ -790,7 +908,7 @@ class Model_SQ_Frontend {
|
|
790 |
private function getGoogleWT() {
|
791 |
$sq_google_wt = SQ_Tools::$options['sq_google_wt'];
|
792 |
|
793 |
-
if (
|
794 |
return sprintf("<meta name=\"google-site-verification\" content=\"%s\" />", $sq_google_wt) . "\n";
|
795 |
}
|
796 |
|
@@ -808,12 +926,10 @@ class Model_SQ_Frontend {
|
|
808 |
if ($sq_google_analytics <> '') {
|
809 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
810 |
->loadMedia('https://www.google-analytics.com/analytics.js');
|
811 |
-
return sprintf("
|
812 |
-
<script>
|
813 |
//<![CDATA[
|
814 |
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
815 |
-
ga('create', '%s', 'auto');
|
816 |
-
ga('send', 'pageview');
|
817 |
//]]>
|
818 |
</script>", $sq_google_analytics) . "\n";
|
819 |
}
|
@@ -829,7 +945,7 @@ class Model_SQ_Frontend {
|
|
829 |
private function getFacebookIns() {
|
830 |
$sq_facebook_insights = SQ_Tools::$options ['sq_facebook_insights'];
|
831 |
|
832 |
-
if (
|
833 |
return sprintf("<meta property=\"fb:admins\" content=\"%s\" />", $sq_facebook_insights) . "\n";
|
834 |
}
|
835 |
|
@@ -844,7 +960,7 @@ class Model_SQ_Frontend {
|
|
844 |
private function getPinterest() {
|
845 |
$sq_pinterest = SQ_Tools::$options['sq_pinterest'];
|
846 |
|
847 |
-
if (
|
848 |
return sprintf("<meta name=\"p:domain_verify\" content=\"%s\" />", $sq_pinterest) . "\n";
|
849 |
}
|
850 |
|
@@ -859,7 +975,7 @@ class Model_SQ_Frontend {
|
|
859 |
private function getAlexaT() {
|
860 |
$sq_alexa = SQ_Tools::$options['sq_alexa'];
|
861 |
|
862 |
-
if (
|
863 |
return sprintf("<meta name=\"alexaVerifyID\" content=\"%s\" />", $sq_alexa) . "\n";
|
864 |
}
|
865 |
|
@@ -874,14 +990,96 @@ class Model_SQ_Frontend {
|
|
874 |
private function getBingWT() {
|
875 |
$sq_bing_wt = SQ_Tools::$options['sq_bing_wt'];
|
876 |
|
877 |
-
if (
|
878 |
return sprintf("<meta name=\"msvalidate.01\" content=\"%s\" />", $sq_bing_wt) . "\n";
|
879 |
}
|
880 |
|
881 |
return false;
|
882 |
}
|
883 |
|
884 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
885 |
* ******************************************************************** */
|
886 |
|
887 |
/**
|
@@ -889,7 +1087,7 @@ class Model_SQ_Frontend {
|
|
889 |
*
|
890 |
* @return string
|
891 |
*/
|
892 |
-
|
893 |
global $wp_query;
|
894 |
$post = null;
|
895 |
$title = '';
|
@@ -921,9 +1119,7 @@ class Model_SQ_Frontend {
|
|
921 |
}
|
922 |
}
|
923 |
|
924 |
-
return
|
925 |
-
|
926 |
-
$title;
|
927 |
}
|
928 |
|
929 |
/**
|
@@ -979,11 +1175,11 @@ class Model_SQ_Frontend {
|
|
979 |
*
|
980 |
* @return array
|
981 |
*/
|
982 |
-
|
983 |
global $wp_query;
|
984 |
|
985 |
-
$this->
|
986 |
-
if ($this->
|
987 |
return;
|
988 |
}
|
989 |
|
@@ -1006,25 +1202,13 @@ class Model_SQ_Frontend {
|
|
1006 |
}
|
1007 |
}
|
1008 |
|
1009 |
-
if (count($keywords) <= $this->
|
1010 |
if ($advkeywords = $this->getAdvancedMeta($post->ID, 'keywords')) {
|
1011 |
$keywords[] = SQ_Tools::i18n($advkeywords);
|
1012 |
-
} else {
|
1013 |
-
|
1014 |
-
$density = $this->calcDensity(strip_tags($post->post_content), $post->post_title, $this->description);
|
1015 |
-
if (is_array($density)) {
|
1016 |
-
if (is_array($keywords) && is_array($density)) {
|
1017 |
-
$keywords = array_merge($keywords, $density);
|
1018 |
-
} else {
|
1019 |
-
if (is_array($density)) {
|
1020 |
-
$keywords = $density;
|
1021 |
-
}
|
1022 |
-
}
|
1023 |
-
}
|
1024 |
}
|
1025 |
}
|
1026 |
-
if (sizeof($keywords) > $this->
|
1027 |
-
$keywords = array_slice($keywords, 0, $this->
|
1028 |
}
|
1029 |
} else {
|
1030 |
if (is_404()) {
|
@@ -1044,19 +1228,11 @@ class Model_SQ_Frontend {
|
|
1044 |
}
|
1045 |
}
|
1046 |
|
1047 |
-
if (
|
1048 |
-
|
1049 |
-
$more_keywords = $this->calcDensity(strip_tags($post->post_content), $post->post_title, $this->description);
|
1050 |
-
|
1051 |
-
if (is_array($more_keywords) && is_array($more_keywords)) {
|
1052 |
-
$keywords = array_merge($keywords, $more_keywords);
|
1053 |
-
}
|
1054 |
-
}
|
1055 |
-
} if (sizeof($keywords) > $this->max_keywrods) {
|
1056 |
-
$keywords = array_slice($keywords, 0, $this->max_keywrods);
|
1057 |
}
|
1058 |
}
|
1059 |
-
if (count($keywords) <= $this->
|
1060 |
foreach ($wp_query->posts as $post) {
|
1061 |
$id = (is_attachment()) ? ($post->post_parent) : ($post->ID);
|
1062 |
|
@@ -1089,123 +1265,7 @@ class Model_SQ_Frontend {
|
|
1089 |
$keywords[] = SQ_Tools::i18n($advkeywords);
|
1090 |
}
|
1091 |
|
1092 |
-
return $this->getUniqueKeywords(
|
1093 |
-
$keywords);
|
1094 |
-
}
|
1095 |
-
|
1096 |
-
/**
|
1097 |
-
* Calculate the keyword density from blog content
|
1098 |
-
*
|
1099 |
-
* @return array
|
1100 |
-
*/
|
1101 |
-
private function calcDensity($text, $title = '', $description = '') {
|
1102 |
-
$keywords = array();
|
1103 |
-
$text = $title . '. ' . $text;
|
1104 |
-
if (function_exists('preg_replace')) {
|
1105 |
-
$text = preg_replace('/[^a-zA-Z0-9-.]/', ' ', $text);
|
1106 |
-
}
|
1107 |
-
|
1108 |
-
$title = explode(" ", $title);
|
1109 |
-
$description = explode(" ", $description);
|
1110 |
-
$words = explode(" ", strtolower($text));
|
1111 |
-
$phrases = $this->searchPhrase(strtolower($text));
|
1112 |
-
|
1113 |
-
$common_words = "a,i,he,she,it,and,me,my,you,the,tags,hash,that,this,they,their";
|
1114 |
-
$common_words = strtolower($common_words);
|
1115 |
-
$common_words = explode(",", $common_words);
|
1116 |
-
// Get keywords
|
1117 |
-
$words_sum = 0;
|
1118 |
-
foreach ($words as $value) {
|
1119 |
-
$common = false;
|
1120 |
-
$value = $this->trimReplace($value);
|
1121 |
-
if (strlen($value) >= 3) {
|
1122 |
-
foreach ($common_words as $common_word) {
|
1123 |
-
if ($common_word == $value) {
|
1124 |
-
$common = true;
|
1125 |
-
}
|
1126 |
-
} if ($common != true) {
|
1127 |
-
if (!preg_match("/http/i", $value) && !preg_match("/mailto:/i", $value)) {
|
1128 |
-
$keywords[] = SQ_Tools::i18n($value);
|
1129 |
-
$words_sum++;
|
1130 |
-
}
|
1131 |
-
}
|
1132 |
-
}
|
1133 |
-
}
|
1134 |
-
|
1135 |
-
$results = $results1 = $results2 = array();
|
1136 |
-
if (is_array($keywords) && count($keywords) > 0) {
|
1137 |
-
// Do some maths and write array
|
1138 |
-
$keywords = array_count_values($keywords);
|
1139 |
-
arsort($keywords);
|
1140 |
-
|
1141 |
-
if (sizeof($keywords) > 10) {
|
1142 |
-
$keywords = array_slice($keywords, 0, 10);
|
1143 |
-
}
|
1144 |
-
|
1145 |
-
$phraseId = 0;
|
1146 |
-
foreach ($keywords as $key => $value) {
|
1147 |
-
$percent = 100 / $words_sum * $value;
|
1148 |
-
if ($percent > 1 && in_array($key, $title)) {
|
1149 |
-
foreach ($phrases as $phrase => $count) {
|
1150 |
-
if (strpos($phrase, $key) !== false) {
|
1151 |
-
$results1[] = trim($key);
|
1152 |
-
$results2[] = $phrase;
|
1153 |
-
}
|
1154 |
-
}
|
1155 |
-
}
|
1156 |
-
|
1157 |
-
$results = array_merge($results2, $results1);
|
1158 |
-
}
|
1159 |
-
if (sizeof($keywords) > 4) {
|
1160 |
-
$results = array_slice($results, 0, 4);
|
1161 |
-
}
|
1162 |
-
}
|
1163 |
-
// Return array
|
1164 |
-
return $results;
|
1165 |
-
}
|
1166 |
-
|
1167 |
-
public function searchPhrase($text) {
|
1168 |
-
$words = explode(".", strtolower($text));
|
1169 |
-
//print_r($words);
|
1170 |
-
$frequencies = array();
|
1171 |
-
foreach ($words as $str) {
|
1172 |
-
$phrases = $this->twoWordPhrases($str);
|
1173 |
-
|
1174 |
-
foreach ($phrases as $phrase) {
|
1175 |
-
$key = join(' ', $phrase);
|
1176 |
-
if (!isset($frequencies[$key])) {
|
1177 |
-
$frequencies[$key] = 0;
|
1178 |
-
}
|
1179 |
-
$frequencies[$key] ++;
|
1180 |
-
}
|
1181 |
-
} arsort($frequencies);
|
1182 |
-
if (sizeof($frequencies) >
|
1183 |
-
10) {
|
1184 |
-
$frequencies = array_slice($frequencies, 0, 10);
|
1185 |
-
} return $frequencies;
|
1186 |
-
}
|
1187 |
-
|
1188 |
-
public function twoWordPhrases($str) {
|
1189 |
-
$words = preg_split('#\s+#', $str, -1, PREG_SPLIT_NO_EMPTY);
|
1190 |
-
|
1191 |
-
$phrases = array();
|
1192 |
-
if (count($words) > 2) {
|
1193 |
-
foreach (range(0, count($words) - 2) as $offset) {
|
1194 |
-
$phrases[] = array_slice($words, $offset, 2);
|
1195 |
-
}
|
1196 |
-
}
|
1197 |
-
return $phrases;
|
1198 |
-
}
|
1199 |
-
|
1200 |
-
/**
|
1201 |
-
* Get the newlines out
|
1202 |
-
*
|
1203 |
-
* @return string
|
1204 |
-
*/
|
1205 |
-
private function trimReplace($string) {
|
1206 |
-
$string = trim($string);
|
1207 |
-
return (string) str_replace(array("\r", "\r\n",
|
1208 |
-
"\n"), '', $string);
|
1209 |
}
|
1210 |
|
1211 |
/**
|
@@ -1215,11 +1275,16 @@ class Model_SQ_Frontend {
|
|
1215 |
*/
|
1216 |
public function getCanonicalUrl() {
|
1217 |
global $wp_query;
|
1218 |
-
|
|
|
|
|
|
|
|
|
|
|
1219 |
return false;
|
1220 |
}
|
1221 |
|
1222 |
-
$haspost = count($wp_query->posts) > 0;
|
1223 |
$has_ut = function_exists('user_trailingslashit');
|
1224 |
|
1225 |
if (get_query_var('m') <> '') {
|
@@ -1246,18 +1311,7 @@ class Model_SQ_Frontend {
|
|
1246 |
$link = get_permalink($post->ID);
|
1247 |
$link = $this->getPaged($link);
|
1248 |
} elseif (is_author() && $haspost) {
|
1249 |
-
|
1250 |
-
if ($wp_version >= '2') {
|
1251 |
-
$author = get_userdata(get_query_var('author'));
|
1252 |
-
if ($author === false) {
|
1253 |
-
return false;
|
1254 |
-
}
|
1255 |
-
$link = get_author_posts_url($author->ID, $author->user_nicename);
|
1256 |
-
} else {
|
1257 |
-
global $cache_userdata;
|
1258 |
-
$userid = get_query_var('author');
|
1259 |
-
$link = get_author_posts_url($userid, $cache_userdata[$userid]->user_nicename);
|
1260 |
-
}
|
1261 |
} elseif (is_category() && $haspost) {
|
1262 |
$link = $this->getPaged(get_category_link(get_query_var('cat')));
|
1263 |
} else if (is_tag() && $haspost) {
|
@@ -1292,27 +1346,26 @@ class Model_SQ_Frontend {
|
|
1292 |
return false;
|
1293 |
}
|
1294 |
|
1295 |
-
return $link;
|
1296 |
}
|
1297 |
|
1298 |
-
public function
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
$author = get_userdata(
|
1304 |
-
|
1305 |
-
|
1306 |
-
}
|
1307 |
-
return get_author_posts_url($author->ID, $author->user_nicename);
|
1308 |
-
} else {
|
1309 |
-
global $cache_userdata;
|
1310 |
-
$userid = get_query_var('author');
|
1311 |
-
return
|
1312 |
|
1313 |
-
|
|
|
|
|
|
|
|
|
1314 |
}
|
1315 |
}
|
|
|
1316 |
return false;
|
1317 |
}
|
1318 |
|
@@ -1341,8 +1394,7 @@ class Model_SQ_Frontend {
|
|
1341 |
* @return bool
|
1342 |
*/
|
1343 |
private function checkFrontPage() {
|
1344 |
-
return is_page() && get_option('show_on_front') == 'page' && $this->post->ID ==
|
1345 |
-
get_option('page_on_front');
|
1346 |
}
|
1347 |
|
1348 |
/**
|
@@ -1351,24 +1403,7 @@ class Model_SQ_Frontend {
|
|
1351 |
* @return bool
|
1352 |
*/
|
1353 |
private function checkPostsPage() {
|
1354 |
-
return is_home() && get_option('show_on_front') == 'page' && $this->post->ID ==
|
1355 |
-
get_option('page_for_posts');
|
1356 |
-
}
|
1357 |
-
|
1358 |
-
/**
|
1359 |
-
* Check if posts in home page
|
1360 |
-
*
|
1361 |
-
* @return bool
|
1362 |
-
*/
|
1363 |
-
private function checkHomePosts() {
|
1364 |
-
global $wp_query;
|
1365 |
-
|
1366 |
-
if (!$this->checkPostsPage()) {
|
1367 |
-
return is_home() && (int) $wp_query->post_count > 0 &&
|
1368 |
-
isset($wp_query->posts) && is_array($wp_query->posts);
|
1369 |
-
} else {
|
1370 |
-
return false;
|
1371 |
-
}
|
1372 |
}
|
1373 |
|
1374 |
public function truncate($text, $min, $max) {
|
@@ -1384,8 +1419,7 @@ class Model_SQ_Frontend {
|
|
1384 |
}
|
1385 |
}
|
1386 |
$text = substr($text, 0, $max);
|
1387 |
-
return trim(
|
1388 |
-
stripcslashes($text));
|
1389 |
}
|
1390 |
|
1391 |
public function _truncate($text) {
|
@@ -1394,9 +1428,8 @@ class Model_SQ_Frontend {
|
|
1394 |
$text = str_replace(']]>', ']]>', $text);
|
1395 |
$text = @preg_replace('|\[(.+?)\](.+?\[/\\1\])?|s', '', $text);
|
1396 |
$text = strip_tags($text);
|
1397 |
-
return
|
1398 |
|
1399 |
-
|
1400 |
}
|
1401 |
|
1402 |
/**
|
@@ -1418,8 +1451,8 @@ class Model_SQ_Frontend {
|
|
1418 |
|
1419 |
if (is_array($all) && count($all) > 0) {
|
1420 |
$all = array_unique($all);
|
1421 |
-
if (sizeof($all) >
|
1422 |
-
$all = array_slice($all, 0,
|
1423 |
}
|
1424 |
|
1425 |
return implode(',', $all);
|
@@ -1444,31 +1477,30 @@ class Model_SQ_Frontend {
|
|
1444 |
return '';
|
1445 |
}
|
1446 |
|
1447 |
-
//check yoast
|
1448 |
switch ($meta) {
|
1449 |
case 'title':
|
1450 |
-
$field = '
|
1451 |
break;
|
1452 |
case 'description':
|
1453 |
-
$field = '
|
1454 |
break;
|
1455 |
case 'keyword':
|
1456 |
-
$field = '
|
1457 |
break;
|
1458 |
case 'ogimage':
|
1459 |
-
$field = '
|
1460 |
break;
|
1461 |
default:
|
1462 |
-
$field = '
|
1463 |
}
|
1464 |
|
1465 |
if ($field <> '' && isset($this->meta[$post_id][$field])) {
|
1466 |
return $this->meta[$post_id][$field];
|
1467 |
}
|
1468 |
|
1469 |
-
// Get the custom Squirrly meta
|
1470 |
-
//////////////////////////////////////////
|
1471 |
-
$fields = array('
|
1472 |
|
1473 |
$sql = "SELECT `meta_key`, `meta_value`
|
1474 |
FROM `" . $wpdb->postmeta . "`
|
@@ -1511,7 +1543,7 @@ class Model_SQ_Frontend {
|
|
1511 |
return '';
|
1512 |
}
|
1513 |
|
1514 |
-
//check yoast
|
1515 |
switch ($meta) {
|
1516 |
case 'title':
|
1517 |
$field = '_yoast_wpseo_title';
|
@@ -1559,4 +1591,47 @@ class Model_SQ_Frontend {
|
|
1559 |
return false;
|
1560 |
}
|
1561 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1562 |
}
|
2 |
|
3 |
class Model_SQ_Frontend {
|
4 |
|
5 |
+
/** @var object Current post */
|
6 |
+
private $post;
|
7 |
+
private $post_type;
|
8 |
+
|
9 |
/** @var canonical link */
|
10 |
private $url;
|
11 |
+
private $author;
|
12 |
|
13 |
/** @var string */
|
14 |
private $title;
|
32 |
private $min_description_length = 70;
|
33 |
|
34 |
/** @var integer */
|
35 |
+
private $max_keywords = 8;
|
|
|
|
|
|
|
|
|
36 |
|
37 |
/** @var array Meta custom content */
|
38 |
private $meta = array();
|
39 |
|
40 |
public function __construct() {
|
41 |
SQ_ObjController::getController('SQ_Tools', false);
|
42 |
+
$this->post_type = SQ_Tools::$options['sq_post_types'];
|
43 |
}
|
44 |
|
45 |
/** @var meta from other plugins */
|
49 |
* @return string
|
50 |
*/
|
51 |
public function setStart() {
|
52 |
+
return "\n\n<!-- Squirrly SEO Plugin " . SQ_VERSION . ", visit: http://www.squirrly.co/ -->\n";
|
53 |
}
|
54 |
|
55 |
/**
|
57 |
* @return string
|
58 |
*/
|
59 |
public function setEnd() {
|
60 |
+
return "<!-- /Squirrly SEO Plugin -->\n\n";
|
61 |
}
|
62 |
|
63 |
/* * *****USE BUFFER****** */
|
104 |
* @return string
|
105 |
*/
|
106 |
private function setMetaInBuffer($buffer) {
|
107 |
+
global $post;
|
108 |
+
|
109 |
+
//if the title is already shown
|
110 |
+
if (isset($this->title)) {
|
111 |
return $buffer;
|
112 |
}
|
113 |
|
114 |
//get the post from shop if woocommerce is installed
|
115 |
if (function_exists('is_shop') && is_shop()) {
|
116 |
$this->post = get_post(woocommerce_get_page_id('shop'));
|
117 |
+
} elseif (isset($post->ID)) {
|
118 |
$this->post = get_post($post->ID);
|
119 |
}
|
120 |
|
121 |
+
if ($this->isHomePage() || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search() || in_array(get_post_type(), $this->post_type)) {
|
122 |
preg_match("/<head[^>]*>/i", $buffer, $out);
|
123 |
if (!empty($out)) {
|
124 |
+
$this->title = $this->getCustomTitle();
|
125 |
+
if (isset($this->title) && $this->title <> '') {
|
126 |
+
//replace the existing title
|
127 |
+
$buffer = @preg_replace('/<title[^<>]*>([^<>]*)<\/title>/si', sprintf("<title>%s</title>", str_replace('$', '\$', $this->title)), $buffer, 1, $count);
|
128 |
if ($count == 0) { //if no title found
|
129 |
+
$buffer .= sprintf("<title>%s</title>", $this->title) . "\n"; //add the title
|
130 |
+
}
|
131 |
}
|
132 |
|
133 |
+
if ((SQ_Tools::$options['sq_auto_description'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
|
134 |
+
//clear the existing description and keywords
|
135 |
+
$buffer = @preg_replace('/<meta[^>]*(name|property)=\"(description|keywords)\"[^>]*content=["\'][^"\'>]*["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
|
|
|
136 |
}
|
137 |
+
if (SQ_Tools::$options['sq_auto_facebook'] == 1) {
|
138 |
+
$buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](og:|article:|twitter:)[^"\'>]+["\'][^>]*content=["\'][^"\'>]+["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
|
139 |
+
}
|
140 |
+
if (SQ_Tools::$options['sq_auto_twitter'] == 1) {
|
141 |
+
$buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](twitter:)[^"\'>]+["\'][^>]*content=["\'][^"\'>]+["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
|
142 |
}
|
143 |
}
|
144 |
}
|
153 |
* @return string
|
154 |
*/
|
155 |
public function setHeader() {
|
156 |
+
global $post;
|
157 |
$ret = '';
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
if (!function_exists('preg_replace')) {
|
161 |
return $ret;
|
163 |
|
164 |
if ($this->isHomePage() || is_single() || is_page() || is_singular() || is_preview() || is_archive() || is_category() || is_author() || is_tag() || is_search() || in_array(get_post_type(), $this->post_type)) {
|
165 |
|
166 |
+
if (!isset($this->post)) {
|
167 |
+
//get the post from shop if woocommerce is installed
|
168 |
+
if (function_exists('is_shop') && is_shop()) {
|
169 |
+
$this->post = get_post(woocommerce_get_page_id('shop'));
|
170 |
+
} elseif (isset($post->ID)) {
|
171 |
+
$this->post = get_post($post->ID);
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
$this->meta['blogname'] = get_bloginfo('name');
|
176 |
+
|
177 |
/* Meta setting */
|
178 |
+
$this->url = $this->getCanonicalUrl();
|
179 |
+
$this->title = $this->getCustomTitle();
|
180 |
+
|
181 |
+
/* Get the thumb image from post */
|
182 |
+
$images = $this->getImagesFromContent();
|
183 |
+
if (isset($images[0])) {
|
184 |
+
$this->thumb_image = $images[0]['src'];
|
185 |
+
}
|
186 |
|
187 |
//Add description in homepage if is set or add description in other pages if is not home page
|
188 |
if ((SQ_Tools::$options['sq_auto_description'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
|
205 |
}
|
206 |
|
207 |
if (SQ_Tools::$options['sq_auto_meta'] == 1) {
|
208 |
+
$ret .= "\n";
|
209 |
$ret .= $this->getGooglePlusMeta();
|
210 |
$ret .= $this->getLanguage();
|
211 |
+
$ret .= $this->getCopyright();
|
212 |
$ret .= $this->getDublinCore();
|
213 |
}
|
214 |
if (SQ_Tools::$options['sq_auto_facebook'] == 1) {
|
216 |
}
|
217 |
|
218 |
if (SQ_Tools::$options['sq_auto_twitter'] == 1) {
|
219 |
+
$ret .= $this->getTwitterCard() . "\n";
|
220 |
}
|
221 |
/* SEO optimizer tool */
|
222 |
$ret .= $this->getGoogleWT();
|
224 |
$ret .= $this->getFacebookIns();
|
225 |
$ret .= $this->getBingWT();
|
226 |
$ret .= $this->getPinterest();
|
|
|
227 |
$ret .= $this->getAlexaT();
|
228 |
|
229 |
+
if (SQ_Tools::$options['sq_auto_jsonld'] == 1) {
|
230 |
+
$ret .= $this->getJsonLD() . "\n";
|
231 |
+
}
|
232 |
+
|
233 |
$ret .= $this->setEnd();
|
234 |
}
|
235 |
return $ret;
|
236 |
}
|
237 |
|
238 |
+
private function getTwitterCard() {
|
239 |
$meta = "\n";
|
240 |
|
241 |
//Title and Description is required
|
243 |
return;
|
244 |
}
|
245 |
|
246 |
+
$sq_twitter_creator = SQ_Tools::$options['sq_twitter_account'];
|
247 |
+
$sq_twitter_site = SQ_Tools::$options['sq_twitter_account'];
|
|
|
|
|
|
|
|
|
|
|
248 |
|
249 |
if (!isset($this->thumb_image) || $this->thumb_image == '') {
|
250 |
+
$images = $this->getImagesFromContent();
|
251 |
+
if (isset($images[0])) {
|
252 |
+
$this->thumb_image = $images[0]['src'];
|
253 |
+
}
|
254 |
}
|
255 |
|
256 |
$meta .= '<meta name="twitter:card" content="summary" />' . "\n";
|
257 |
|
258 |
+
$meta .= (($sq_twitter_creator <> '') ? sprintf('<meta name="twitter:creator" content="%s" />', $this->getTwitterAccount($sq_twitter_creator)) . "\n" : '');
|
259 |
+
$meta .= (($sq_twitter_site <> '') ? sprintf('<meta name="twitter:site" content="%s" />', $this->getTwitterAccount($sq_twitter_creator)) . "\n" : '');
|
260 |
$meta .= sprintf('<meta name="twitter:url" content="%s">', $this->url) . "\n";
|
261 |
$meta .= sprintf('<meta name="twitter:title" content="%s">', $this->title) . "\n";
|
262 |
$meta .= (($this->description <> '') ? sprintf('<meta name="twitter:description" content="%s">', $this->description . ' | ' . $this->meta['blogname']) . "\n" : '');
|
263 |
$meta .= ((isset($this->thumb_image) && $this->thumb_image <> '') ? sprintf('<meta name="twitter:image" content="%s">', $this->thumb_image) . "\n" : '');
|
264 |
$meta .= (($this->meta['blogname'] <> '') ? sprintf('<meta name="twitter:domain" content="%s">', $this->meta['blogname']) . "\n" : '');
|
265 |
|
266 |
+
return apply_filters('sq_twitter_card_meta', $meta);
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Get the twitter account from url
|
271 |
+
*
|
272 |
+
* @param string $account
|
273 |
+
* @return string | false
|
274 |
+
*/
|
275 |
+
public function getTwitterAccount($account) {
|
276 |
+
if ($account <> '') {
|
277 |
+
if (strpos($account, 'twitter.com') !== false) {
|
278 |
+
preg_match('/twitter.com\/([@1-9a-z_-]+)/i', $account, $result);
|
279 |
+
if (isset($result[1]) && !empty($result[1])) {
|
280 |
+
return '@' . str_replace('@', '', $result[1]);
|
281 |
+
}
|
282 |
+
} else {
|
283 |
+
preg_match('/([@1-9a-z_-]+)/i', $account, $result);
|
284 |
+
if (isset($result[1]) && !empty($result[1])) {
|
285 |
+
return '@' . str_replace('@', '', $result[1]);
|
286 |
+
}
|
287 |
+
}
|
288 |
+
} else {
|
289 |
+
return '';
|
290 |
+
}
|
291 |
+
return false;
|
292 |
}
|
293 |
|
294 |
/**
|
298 |
private function getOpenGraph() {
|
299 |
$meta = "\n";
|
300 |
$image = '';
|
|
|
301 |
|
|
|
302 |
if (!isset($this->thumb_image) || $this->thumb_image == '') {
|
303 |
+
$images = $this->getImagesFromContent();
|
304 |
+
if (isset($images[0])) {
|
305 |
+
$this->thumb_image = $images[0]['src'];
|
|
|
306 |
}
|
307 |
}
|
308 |
|
309 |
if (!isset($this->thumb_video) || $this->thumb_video == '') {
|
310 |
+
$videos = $this->getVideosFromContent();
|
311 |
+
if (isset($videos[0])) {
|
312 |
+
$this->thumb_video = $videos[0];
|
313 |
+
}
|
314 |
}
|
315 |
|
316 |
+
if ($image == '' && $this->url == '') {
|
317 |
return;
|
318 |
}
|
319 |
//GET THE URL
|
320 |
+
$meta .= sprintf('<meta property="og:url" content="%s" />', apply_filters('sq_open_graph_url', $this->url)) . "\n";
|
321 |
+
if (isset($this->thumb_image) && $this->thumb_image <> '') {
|
322 |
$meta .= sprintf('<meta property="og:image" content="%s" />', $this->thumb_image) . "\n";
|
323 |
+
$meta .= sprintf('<meta property="og:image:width" content="%s" />', 500) . "\n";
|
324 |
}
|
325 |
|
326 |
if ((isset($this->thumb_video) && $this->thumb_video <> '')) {
|
329 |
|
330 |
$meta .= sprintf('<meta property="og:title" content="%s" />', $this->title) . "\n";
|
331 |
$meta .= sprintf('<meta property="og:description" content="%s" />', $this->description) . "\n";
|
332 |
+
$meta .= (($this->meta['blogname'] <> '') ? sprintf('<meta property="og:site_name" content="%s" />', apply_filters('sq_open_graph_site', $this->meta['blogname'])) . "\n" : '');
|
333 |
|
334 |
if (is_author()) {
|
335 |
$author = get_queried_object();
|
338 |
$meta .= sprintf('<meta property="profile:first_name" content="%s" />', get_the_author_meta('first_name', $author->ID)) . "\n";
|
339 |
$meta .= sprintf('<meta property="profile:last_name" content="%s" />', get_the_author_meta('last_name', $author->ID)) . "\n";
|
340 |
} elseif (!$this->isHomePage() && (is_single() || is_page())) {
|
|
|
341 |
if ((isset($this->thumb_video) && $this->thumb_video <> '')) {
|
342 |
+
$meta .= sprintf('<meta property="og:type" content="%s" />', 'video') . "\n";
|
343 |
} else {
|
344 |
+
$meta .= sprintf('<meta property="og:type" content="%s" />', 'article') . "\n";
|
345 |
$meta .= sprintf('<meta property="article:published_time" content="%s" />', get_the_time('c', $this->post->ID)) . "\n";
|
346 |
if ($this->keywords <> '') {
|
347 |
$keywords = preg_split('/[,]+/', $this->keywords);
|
356 |
$meta .= sprintf('<meta property="og:type" content="%s" />', 'website') . "\n";
|
357 |
}
|
358 |
|
359 |
+
return apply_filters('sq_open_graph_meta', $meta);
|
360 |
}
|
361 |
|
362 |
/**
|
365 |
* @return string
|
366 |
*/
|
367 |
private function setCanonical() {
|
|
|
|
|
|
|
368 |
|
369 |
if ($this->url) {
|
370 |
remove_action('wp_head', 'rel_canonical');
|
380 |
$meta = "";
|
381 |
if (!$this->isHomePage()) {
|
382 |
if (get_previous_posts_link()) {
|
383 |
+
$meta .= sprintf('<link rel="prev" href="%s" />', apply_filters('sq_prev_link', get_pagenum_link($paged - 1))) . "\n";
|
384 |
}
|
385 |
if (get_next_posts_link()) {
|
386 |
+
$meta .= sprintf('<link rel="next" href="%s" />', apply_filters('sq_next_link', get_pagenum_link($paged + 1))) . "\n";
|
387 |
}
|
388 |
}
|
389 |
|
390 |
+
return (($meta <> '') ? apply_filters('sq_prevnext_meta', $meta) . "\n" : '');
|
|
|
391 |
}
|
392 |
|
393 |
/**
|
397 |
*/
|
398 |
public function getCustomTitle() {
|
399 |
$title = '';
|
400 |
+
$sep = ' | ';
|
401 |
+
|
402 |
+
if (isset($this->title)) {
|
403 |
+
return $this->title;
|
404 |
+
}
|
405 |
|
406 |
//If its a post/page
|
407 |
if (!$this->isHomePage()) {
|
408 |
//If is category
|
409 |
if (is_category()) { //for category
|
410 |
$category = get_category(get_query_var('cat'), false);
|
411 |
+
$title = $category->cat_name;
|
412 |
if ($title == '') {
|
413 |
+
$title = $this->grabTitleFromPost();
|
414 |
}
|
415 |
if (is_paged()) {
|
416 |
+
$title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
|
417 |
}
|
418 |
} elseif (is_author()) { //for author
|
|
|
|
|
419 |
if ($title == '') {
|
420 |
+
$title = $this->grabTitleFromPost() . $sep . ucfirst($this->getAuthor('display_name'));
|
421 |
}
|
422 |
if ($title == '') {
|
423 |
+
$title = __('About') . " " . ucfirst($this->getAuthor('display_name'));
|
424 |
}
|
425 |
if (is_paged()) {
|
426 |
+
$title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
|
427 |
}
|
428 |
} elseif (is_tag()) { //for tags
|
429 |
if (is_paged()) {
|
430 |
$tag = get_query_var('tag');
|
431 |
+
$title = ucfirst(str_replace('-', ' ', $tag)) . $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
|
432 |
+
}
|
433 |
+
}elseif (is_archive()) { //for archive and products
|
434 |
+
if (isset($this->post) && isset($this->post->ID)) {
|
435 |
+
$title = $this->grabTitleFromPost($this->post->ID);
|
436 |
+
|
437 |
+
//if woocommerce is installed and is a product category
|
438 |
+
if (function_exists('is_product_category') && is_product_category()){
|
439 |
+
global $wp_query;
|
440 |
+
$cat = $wp_query->get_queried_object();
|
441 |
+
if (!empty($cat)){
|
442 |
+
$title .= $sep . $cat->name;
|
443 |
+
}
|
444 |
+
}else{
|
445 |
+
$cat = get_the_terms( $this->post->ID, 'category' );
|
446 |
+
if (!empty($cat)){
|
447 |
+
$title .= $sep . $cat[0]->name;
|
448 |
+
}
|
449 |
+
}
|
450 |
+
}
|
451 |
+
|
452 |
+
if (is_paged()) {
|
453 |
+
$title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
|
454 |
}
|
455 |
} elseif (is_single() || is_page() || is_singular() || in_array(get_post_type(), $this->post_type)) {
|
456 |
+
if (isset($this->post) && isset($this->post->ID)) {
|
457 |
+
//is a post page
|
458 |
+
$title = $this->grabTitleFromPost($this->post->ID);
|
459 |
+
|
460 |
+
//if woocommerce is installed and is a product
|
461 |
+
if (function_exists('is_product') && is_product()){
|
462 |
+
$cat = get_the_terms( $this->post->ID, 'product_cat' );
|
463 |
+
if (!empty($cat) && count($cat) > 1){
|
464 |
+
$title .= $sep . $cat[0]->name;
|
465 |
+
}
|
466 |
+
}
|
467 |
+
}
|
468 |
+
|
469 |
+
|
470 |
}
|
471 |
}
|
472 |
|
473 |
//If title then clear it and truncate it
|
474 |
if ($title <> '') {
|
475 |
+
$title = $this->truncate($title, $this->min_title_length, $this->max_title_length);
|
476 |
}
|
477 |
|
478 |
/* Check if is a predefined Title for home page */
|
481 |
|
482 |
//If the home page is a static page that has custom snippet
|
483 |
if (is_page() && isset($this->post) && isset($this->post->ID) && $this->getAdvancedMeta($this->post->ID, 'title') <> '') {
|
484 |
+
$title = $this->getAdvancedMeta($this->post->ID, 'title');
|
485 |
+
} elseif (SQ_Tools::$options['sq_fp_title'] <> '') {
|
486 |
+
$title = SQ_Tools::$options['sq_fp_title'];
|
487 |
} else {
|
488 |
+
$title = $this->grabTitleFromPost();
|
489 |
if ($title <> "" && $this->meta['blogname'] <> '') {
|
490 |
+
$title .= $sep . $this->meta ['blogname'];
|
491 |
}
|
492 |
}
|
493 |
}
|
494 |
|
495 |
+
return apply_filters('sq_title', $title);
|
496 |
+
}
|
497 |
|
498 |
+
public function clearTitle($title) {
|
499 |
+
if ($title <> '') {
|
500 |
+
$title = SQ_Tools::i18n(trim(esc_html(ent2ncr(strip_tags($title)))));
|
501 |
+
}
|
502 |
return $title;
|
503 |
}
|
504 |
|
505 |
/**
|
506 |
* Get the image from content
|
507 |
* @global type $wp_query
|
508 |
+
* @param integer $id Post ID
|
509 |
* @return type
|
510 |
*/
|
511 |
+
public function getImagesFromContent($id = null) {
|
512 |
+
$images = array();
|
513 |
+
if (isset($id)) {
|
514 |
+
$post = get_post($id);
|
515 |
+
} else {
|
516 |
+
$post = $this->post;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
}
|
518 |
|
519 |
if ($post && isset($post->ID)) {
|
520 |
+
if ($url = $this->getAdvancedMeta($post->ID, 'ogimage')) {
|
521 |
+
$images[] = array(
|
522 |
+
'src' => esc_url($url),
|
523 |
+
'title' => $this->clearTitle($this->grabTitleFromPost($post->ID)),
|
524 |
+
'description' => $this->clearDescription($this->grabDescriptionFromPost($post->ID)),
|
525 |
+
);
|
526 |
+
}
|
527 |
if (has_post_thumbnail($post->ID)) {
|
528 |
+
$attachment = get_post(get_post_thumbnail_id($post->ID));
|
529 |
+
$url = wp_get_attachment_image_src($attachment->ID, 'full');
|
530 |
+
$images[] = array(
|
531 |
+
'src' => esc_url($url[0]),
|
532 |
+
'title' => $this->clearTitle($attachment->post_title),
|
533 |
+
'description' => $this->clearDescription($attachment->post_excerpt),
|
534 |
+
);
|
535 |
+
}
|
536 |
+
if (isset($post->post_content)) {
|
537 |
preg_match('/<img[^>]*src="([^"]*)"[^>]*>/i', $post->post_content, $match);
|
|
|
|
|
|
|
538 |
|
539 |
+
if (!empty($match)) {
|
540 |
+
preg_match('/alt="([^"]*)"/i', $match[0], $alt);
|
|
|
541 |
|
542 |
+
if (strpos($match[1], '//') === false) {
|
543 |
+
$match[1] = get_bloginfo('url') . $match[1];
|
544 |
+
}
|
545 |
+
|
546 |
+
$images[] = array(
|
547 |
+
'src' => esc_url($match[1]),
|
548 |
+
'title' => $this->clearTitle(!empty($alt[1]) ? $alt[1] : ''),
|
549 |
+
'description' => '',
|
550 |
+
);
|
551 |
+
}
|
552 |
}
|
553 |
}
|
554 |
+
|
555 |
+
return $images;
|
556 |
}
|
557 |
|
558 |
/**
|
559 |
* Get the video from content
|
560 |
+
* @param integer $id Post ID
|
561 |
* @return type
|
562 |
*/
|
563 |
+
public function getVideosFromContent($id = null) {
|
564 |
+
$videos = array();
|
565 |
+
|
566 |
+
if (isset($id)) {
|
567 |
+
$post = get_post($id);
|
568 |
+
} else {
|
569 |
+
$post = $this->post;
|
570 |
}
|
571 |
|
572 |
+
if ($post && isset($post->ID)) {
|
573 |
+
if (isset($post->post_content)) {
|
574 |
+
preg_match('/(?:http(?:s)?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&\"\'>\s]+)/si', $post->post_content, $match);
|
575 |
|
576 |
+
if (isset($match[0])) {
|
577 |
+
if (strpos($match[0], '//') !== false && strpos($match[0], 'http') === false) {
|
578 |
+
$match[0] = 'http:' . $match[0];
|
579 |
+
}
|
580 |
+
$videos[] = esc_url($match[0]);
|
581 |
}
|
|
|
582 |
|
583 |
+
preg_match('/src=["|\']([^"\']*(.mpg|.mpeg|.mp4|.mov|.wmv|.asf|.avi|.ra|.ram|.rm|.flv)["|\'])/i', $post->post_content, $match);
|
|
|
584 |
|
585 |
+
if (isset($match[1])) {
|
586 |
+
$videos[] = esc_url($match[1]);
|
587 |
+
}
|
588 |
+
}
|
589 |
}
|
590 |
|
591 |
+
return $videos;
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
}
|
593 |
|
594 |
/**
|
597 |
* @return string
|
598 |
*/
|
599 |
private function getCustomDescription() {
|
600 |
+
|
601 |
+
$sep = ' | ';
|
602 |
$description = '';
|
603 |
|
604 |
//If not homepage
|
606 |
//If is a category
|
607 |
if (is_category()) { //for categories
|
608 |
$category = get_category(get_query_var('cat'), false);
|
609 |
+
$description = $category->category_description;
|
610 |
if ($description == '') {
|
611 |
+
$description = $category->cat_name;
|
612 |
}
|
613 |
if ($description == '') {
|
614 |
$description = $this->grabDescriptionFromPost();
|
615 |
}
|
616 |
|
617 |
if (is_paged()) {
|
618 |
+
$description .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
|
619 |
}
|
620 |
|
621 |
if ($this->isHomePage() && $description <> '') {
|
622 |
if ($this->meta['blogname'] <> '') {
|
623 |
+
$description .= $sep . $this->meta['blogname'];
|
624 |
}
|
625 |
}
|
626 |
+
|
627 |
} elseif (is_author()) { //for author
|
628 |
+
$description = $this->getAuthor('user_description');
|
629 |
if ($description == '') {
|
630 |
+
$description = $this->grabDescriptionFromPost() . $sep . $this->getAuthor('display_name');
|
|
|
631 |
}
|
632 |
if (is_paged()) {
|
633 |
+
$description .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
|
634 |
}
|
635 |
} elseif (is_tag()) { //for tags
|
636 |
+
$description = tag_description();
|
637 |
if ($description == '') {
|
638 |
+
$tag = single_tag_title('', false);
|
639 |
+
$description = ucfirst($tag) . $sep . $this->grabDescriptionFromPost();
|
640 |
}
|
641 |
if (is_paged()) {
|
642 |
+
$description .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
|
643 |
}
|
644 |
+
} elseif (is_archive()) { //for archive and products
|
645 |
+
|
646 |
if (isset($this->post) && isset($this->post->ID)) {
|
647 |
$description = $this->grabDescriptionFromPost($this->post->ID);
|
648 |
+
|
649 |
+
//if woocommerce is installed and is a product category
|
650 |
+
if (function_exists('is_product_category') && is_product_category()){
|
651 |
+
global $wp_query;
|
652 |
+
$cat = $wp_query->get_queried_object();
|
653 |
+
if (!empty($cat)){
|
654 |
+
$description .= $sep . $cat->name ;
|
655 |
+
}
|
656 |
+
|
657 |
+
}else{
|
658 |
+
$cat = get_the_terms( $this->post->ID, 'category' );
|
659 |
+
if (!empty($cat)){
|
660 |
+
$description .= $sep . $cat[0]->name;
|
661 |
+
}
|
662 |
+
}
|
663 |
+
|
664 |
+
}
|
665 |
+
|
666 |
+
if (is_paged()) {
|
667 |
+
$description .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
|
668 |
+
}
|
669 |
+
} elseif (is_single() || is_page() || is_singular() || $this->checkPostsPage() || in_array(get_post_type(), $this->post_type)) {
|
670 |
+
if (isset($this->post) && isset($this->post->ID)) {
|
671 |
+
//is a post page
|
672 |
+
$description .= $this->grabDescriptionFromPost($this->post->ID);
|
673 |
+
|
674 |
+
//if woocommerce is installed and is a product
|
675 |
+
if (function_exists('is_product') && is_product()){
|
676 |
+
$cat = get_the_terms( $this->post->ID, 'product_cat' );
|
677 |
+
if (!empty($cat) && count($cat) > 1){
|
678 |
+
$description .= $sep . $cat[0]->name;
|
679 |
+
}
|
680 |
+
}
|
681 |
+
|
682 |
}
|
683 |
}
|
684 |
}
|
689 |
|
690 |
//If the home page is a static page that has custom snippet
|
691 |
if (is_page() && isset($this->post) && isset($this->post->ID) && $this->getAdvancedMeta($this->post->ID, 'description') <> '') {
|
692 |
+
$description = $this->getAdvancedMeta($this->post->ID, 'description');
|
693 |
} elseif (SQ_Tools::$options ['sq_fp_description'] <> '') {
|
694 |
$description = strip_tags(SQ_Tools::$options['sq_fp_description']);
|
695 |
} else {
|
699 |
|
700 |
$description = (($description <> '') ? $description : $this->title);
|
701 |
if ($description <> '') {
|
|
|
702 |
|
703 |
+
$this->description = apply_filters('sq_description', $description);
|
704 |
if ($this->description <> '') { //prevent blank description
|
705 |
+
return sprintf("<meta name=\"description\" content=\"%s\" />", $this->description);
|
|
|
|
|
706 |
}
|
707 |
}
|
708 |
|
709 |
+
return '';
|
710 |
}
|
711 |
|
712 |
+
public function clearDescription($description) {
|
713 |
+
if ($description <> '') {
|
714 |
+
$search = array("'<script[^>]*?>.*?<\/script>'si", // strip out javascript
|
715 |
+
"/<form.*?<\/form>/si",
|
716 |
+
"/<iframe.*?<\/iframe>/si");
|
717 |
|
718 |
+
if (function_exists('preg_replace')) {
|
719 |
+
$description = preg_replace($search, '', $description);
|
720 |
+
}
|
721 |
|
722 |
+
$description = SQ_Tools::i18n(trim(esc_html(ent2ncr(strip_tags($description)))));
|
723 |
+
}
|
|
|
724 |
|
725 |
+
return $description;
|
726 |
}
|
727 |
|
728 |
/**
|
731 |
* @return string
|
732 |
*/
|
733 |
private function getCustomKeyword() {
|
|
|
734 |
$keywords = '';
|
735 |
|
736 |
if ($this->checkPostsPage() && SQ_Tools::$options['sq_auto_description'] == 1) {
|
750 |
}
|
751 |
|
752 |
if (isset($keywords) && !empty($keywords) && !(is_home() && is_paged())) {
|
753 |
+
$this->keywords = apply_filters('sq_keywords', str_replace('"', '', $keywords));
|
754 |
|
755 |
return sprintf("<meta name=\"keywords\" content=\"%s\" />", $this->keywords);
|
756 |
}
|
764 |
* @return string
|
765 |
*/
|
766 |
private function getCopyright() {
|
767 |
+
$meta = '';
|
768 |
+
|
769 |
+
$name = $this->getAuthor();
|
770 |
if (!$name) {
|
771 |
$name = $this->meta['blogname'];
|
772 |
}
|
773 |
|
774 |
if ($name <> '') {
|
775 |
+
$meta = sprintf("<meta name=\"dcterms.rightsHolder\" content=\"%s\" />" . "\n", apply_filters('sq_copyright', $meta));
|
776 |
}
|
777 |
|
778 |
+
return apply_filters('sq_copyright_meta', $meta);
|
779 |
}
|
780 |
|
781 |
/**
|
784 |
* @return string
|
785 |
*/
|
786 |
private function getGooglePlusMeta() {
|
787 |
+
$meta = '';
|
788 |
$author = SQ_Tools::$options['sq_google_plus'];
|
789 |
+
|
790 |
+
if (strpos($author, 'plus.google.com') === false && is_numeric($author)) {
|
791 |
+
$author = 'https://plus.google.com/' . $author;
|
|
|
|
|
|
|
792 |
}
|
793 |
|
794 |
+
if ($author <> '' && !class_exists('ABH_Classes_ObjController')) {
|
795 |
+
$meta = '<link rel="publisher" href="' . $author . '" />' . "\n";
|
|
|
|
|
|
|
|
|
796 |
}
|
797 |
|
798 |
+
return apply_filters('sq_publisher_meta', $meta);
|
799 |
}
|
800 |
|
801 |
/**
|
804 |
* @return string
|
805 |
*/
|
806 |
private function getFavicon() {
|
807 |
+
$meta = '';
|
|
|
808 |
$rnd = '';
|
809 |
|
810 |
+
if (current_user_can('manage_options')) {
|
811 |
+
$rnd = '?' . md5(SQ_Tools::$options['favicon']);
|
|
|
|
|
812 |
}
|
813 |
|
814 |
+
if (SQ_Tools::$options['favicon'] <> '' && file_exists(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon'])) {
|
815 |
+
$meta .= "\n";
|
816 |
+
|
817 |
+
$favicon = get_bloginfo('wpurl') . '/favicon.icon' . $rnd;
|
818 |
+
$meta .= sprintf("<link rel=\"shortcut icon\" href=\"%s\" />" . "\n", $favicon);
|
819 |
+
$meta .= sprintf("<link rel=\"apple-touch-icon\" href=\"%s\" />" . "\n", get_bloginfo('wpurl') . '/touch-icon.png' . $rnd);
|
820 |
|
821 |
+
$appleSizes = preg_split('/[,]+/', _SQ_MOBILE_ICON_SIZES);
|
822 |
+
foreach ($appleSizes as $size) {
|
823 |
+
$favicon = get_bloginfo('wpurl') . '/touch-icon' . $size . '.png' . $rnd;
|
824 |
+
$meta .= sprintf("<link rel=\"apple-touch-icon\" sizes=\"" . $size . "x" . $size . "\" href=\"%s\" />" . "\n", $favicon);
|
825 |
+
}
|
826 |
}
|
827 |
+
return apply_filters('sq_publisher_meta', $meta);
|
828 |
}
|
829 |
|
830 |
/**
|
834 |
*/
|
835 |
private function getLanguage() {
|
836 |
$meta = '';
|
837 |
+
$language = get_bloginfo('language');
|
838 |
+
$hreflang = SQ_ObjController::getController('SQ_Ranking', false)->getLanguage();
|
839 |
|
840 |
+
if ($hreflang <> '') {
|
841 |
+
$url = get_bloginfo('url');
|
842 |
+
$meta .= sprintf("<link rel=\"alternate\" hreflang=\"%s\" href=\"$url\" />", $hreflang) . "\n";
|
|
|
843 |
}
|
844 |
|
|
|
|
|
845 |
if ($language <> '') {
|
846 |
+
$meta .= sprintf("<meta name=\"dc.language\" content=\"%s\" />", $language) . "\n";
|
847 |
}
|
848 |
|
849 |
+
return apply_filters('sq_language_meta', $meta);
|
850 |
}
|
851 |
|
852 |
/**
|
855 |
* @return string
|
856 |
*/
|
857 |
private function getDublinCore() {
|
|
|
858 |
$date = null;
|
859 |
$meta = '';
|
860 |
|
861 |
+
$name = $this->getAuthor();
|
862 |
if (!$name) {
|
863 |
$name = $this->meta['blogname'];
|
864 |
}
|
865 |
|
866 |
if ($name <> '') {
|
867 |
+
$meta .= sprintf("<meta name=\"dc.publisher\" content=\"%s\" />", $name) . "\n";
|
868 |
}
|
869 |
|
870 |
+
$meta .= sprintf('<meta name="dc.title" content="%s" />', $this->title) . "\n";
|
871 |
+
$meta .= sprintf('<meta name="dc.description" content="%s" />', $this->description) . "\n";
|
872 |
|
873 |
if ($this->isHomePage()) {
|
874 |
+
$date = date('Y-m-d', strtotime(get_lastpostmodified('gmt')));
|
875 |
+
} elseif (is_single() && isset($this->post->post_date)) {
|
876 |
$date = date('Y-m-d', strtotime($this->post->post_date));
|
877 |
}
|
878 |
|
879 |
+
if (isset($date)) {
|
880 |
+
$meta .= sprintf("<meta name=\"dc.date.issued\" content=\"%s\" />", $date) . "\n";
|
|
|
|
|
881 |
}
|
882 |
|
883 |
+
return apply_filters('sq_dublin_meta', $meta);
|
884 |
}
|
885 |
|
886 |
/**
|
889 |
* @return string
|
890 |
*/
|
891 |
private function getXMLSitemap() {
|
892 |
+
$meta = '';
|
893 |
+
|
894 |
+
$xml_url = SQ_ObjController::getController('SQ_Sitemaps')->getXmlUrl('sitemap');
|
895 |
|
896 |
if ($xml_url <> '') {
|
897 |
+
$meta = sprintf("<link rel=\"alternate\" type=\"application/rss+xml\" " . (($this->title <> '') ? "title=\"%s\"" : "") . " href=\"%s\" />", $this->title, $xml_url) . "\n";
|
898 |
}
|
899 |
|
900 |
+
return apply_filters('sq_sitemap_meta', $meta);
|
901 |
}
|
902 |
|
903 |
/**
|
908 |
private function getGoogleWT() {
|
909 |
$sq_google_wt = SQ_Tools::$options['sq_google_wt'];
|
910 |
|
911 |
+
if ($this->isHomePage() && $sq_google_wt <> '') {
|
912 |
return sprintf("<meta name=\"google-site-verification\" content=\"%s\" />", $sq_google_wt) . "\n";
|
913 |
}
|
914 |
|
926 |
if ($sq_google_analytics <> '') {
|
927 |
SQ_ObjController::getController('SQ_DisplayController', false)
|
928 |
->loadMedia('https://www.google-analytics.com/analytics.js');
|
929 |
+
return sprintf("<script>
|
|
|
930 |
//<![CDATA[
|
931 |
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
932 |
+
ga('create', '%s', 'auto'); ga('require', 'linkid', 'linkid.js'); ga('send', 'pageview');
|
|
|
933 |
//]]>
|
934 |
</script>", $sq_google_analytics) . "\n";
|
935 |
}
|
945 |
private function getFacebookIns() {
|
946 |
$sq_facebook_insights = SQ_Tools::$options ['sq_facebook_insights'];
|
947 |
|
948 |
+
if ($this->isHomePage() && $sq_facebook_insights <> '') {
|
949 |
return sprintf("<meta property=\"fb:admins\" content=\"%s\" />", $sq_facebook_insights) . "\n";
|
950 |
}
|
951 |
|
960 |
private function getPinterest() {
|
961 |
$sq_pinterest = SQ_Tools::$options['sq_pinterest'];
|
962 |
|
963 |
+
if ($this->isHomePage() && $sq_pinterest <> '') {
|
964 |
return sprintf("<meta name=\"p:domain_verify\" content=\"%s\" />", $sq_pinterest) . "\n";
|
965 |
}
|
966 |
|
975 |
private function getAlexaT() {
|
976 |
$sq_alexa = SQ_Tools::$options['sq_alexa'];
|
977 |
|
978 |
+
if ($this->isHomePage() && $sq_alexa <> '') {
|
979 |
return sprintf("<meta name=\"alexaVerifyID\" content=\"%s\" />", $sq_alexa) . "\n";
|
980 |
}
|
981 |
|
990 |
private function getBingWT() {
|
991 |
$sq_bing_wt = SQ_Tools::$options['sq_bing_wt'];
|
992 |
|
993 |
+
if ($this->isHomePage() && $sq_bing_wt <> '') {
|
994 |
return sprintf("<meta name=\"msvalidate.01\" content=\"%s\" />", $sq_bing_wt) . "\n";
|
995 |
}
|
996 |
|
997 |
return false;
|
998 |
}
|
999 |
|
1000 |
+
/**
|
1001 |
+
* Get the JsonLD meta for this site
|
1002 |
+
* @return string
|
1003 |
+
*/
|
1004 |
+
private function getJsonLD() {
|
1005 |
+
$meta = '';
|
1006 |
+
$sep = ",\n";
|
1007 |
+
|
1008 |
+
if ($this->isHomePage()) {
|
1009 |
+
if (isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']])) {
|
1010 |
+
$meta .= '"@type":"' . SQ_Tools::$options['sq_jsonld_type'] . '"' . $sep;
|
1011 |
+
$meta .= '"url": "' . $this->url . '"';
|
1012 |
+
foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']] as $key => $value) {
|
1013 |
+
if ($value <> '') {
|
1014 |
+
if (SQ_Tools::$options['sq_jsonld_type'] == 'Person' && $key == 'logo') {
|
1015 |
+
$key = 'image';
|
1016 |
+
}
|
1017 |
+
if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'contactType') {
|
1018 |
+
continue;
|
1019 |
+
}
|
1020 |
+
if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'telephone') {
|
1021 |
+
$meta .= $sep . '"contactPoint": {"@type": "ContactPoint", "telephone": "' . $value . '", "contactType": "' . SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']]['contactType'] . '"}';
|
1022 |
+
}
|
1023 |
+
$meta .= ($meta <> '' ? $sep : '') . '"' . $key . '":"' . $value . '"';
|
1024 |
+
}
|
1025 |
+
}
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
if ($meta <> '') {
|
1029 |
+
$social = '';
|
1030 |
+
if (isset(SQ_Tools::$options['sq_twitter_account'])) {
|
1031 |
+
$social .= ($social <> '' ? "," : '') . '"' . SQ_Tools::$options['sq_twitter_account'] . '"';
|
1032 |
+
}
|
1033 |
+
if (isset(SQ_Tools::$options['sq_facebook_account'])) {
|
1034 |
+
$social .= ($social <> '' ? "," : '') . '"' . SQ_Tools::$options['sq_facebook_account'] . '"';
|
1035 |
+
}
|
1036 |
+
if (isset(SQ_Tools::$options['sq_google_plus'])) {
|
1037 |
+
$social .= ($social <> '' ? "," : '') . '"' . SQ_Tools::$options['sq_google_plus'] . '"';
|
1038 |
+
}
|
1039 |
+
if (isset(SQ_Tools::$options['sq_linkedin_account'])) {
|
1040 |
+
$social .= ($social <> '' ? "," : '') . '"' . SQ_Tools::$options['sq_linkedin_account'] . '"';
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
$search = $sep . '"potentialAction": {"@type": "SearchAction","target": "' . get_bloginfo('url') . '?s={search_string}", "query-input": "required name=search_string"}';
|
1044 |
+
|
1045 |
+
if ($social <> '') {
|
1046 |
+
$social = $sep . '"sameAs": [' . $social . ']';
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
$meta = '{ "@context": "http://schema.org"' . $sep . $meta . $search . $social . '}';
|
1050 |
+
}
|
1051 |
+
} elseif (is_single()) {
|
1052 |
+
$meta .= '"@type": "Article"' . $sep;
|
1053 |
+
if (isset($this->title))
|
1054 |
+
$meta .= '"name": "' . $this->title . '"' . $sep;
|
1055 |
+
if (isset($this->description))
|
1056 |
+
$meta .= '"headline": "' . $this->description . '"' . $sep;
|
1057 |
+
$meta .= '"url": "' . $this->url . '"' . $sep;
|
1058 |
+
if (isset($this->thumb_image) && $this->thumb_image <> '')
|
1059 |
+
$meta .= '"thumbnailUrl": "' . $this->thumb_image . '"' . $sep;
|
1060 |
+
if (isset($this->post->post_date))
|
1061 |
+
$meta .= '"dateCreated": "' . date('c', strtotime($this->post->post_date)) . '"' . $sep;
|
1062 |
+
$meta .= '"author": {"@type": "Person", "url": "' . $this->getAuthor('user_url') . '", "name": "' . $this->getAuthor('display_name') . '"}' . $sep;
|
1063 |
+
$meta .= '"keywords": ["' . str_replace(',', '","', $this->grabKeywordsFromPost()) . '"]';
|
1064 |
+
|
1065 |
+
$meta = '{ "@context": "http://schema.org"' . $sep . $meta . '}';
|
1066 |
+
}elseif (is_author()) {
|
1067 |
+
$meta .= '"@type": "Person"' . $sep;
|
1068 |
+
$meta .= '"name": "' . $this->getAuthor('display_name') . '"' . $sep;
|
1069 |
+
$meta .= '"url": "' . $this->getAuthor('user_url') . '"';
|
1070 |
+
|
1071 |
+
$meta = '{ "@context": "http://schema.org"' . $sep . $meta . '}';
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
if ($meta <> '') {
|
1075 |
+
$meta = "\n" . '<script type="application/ld+json">' . "\n" . $meta . "\n" . '</script>';
|
1076 |
+
}
|
1077 |
+
|
1078 |
+
return apply_filters('sq_sjon_ld_meta', $meta);
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
/**
|
1082 |
+
* *******************************************************************
|
1083 |
* ******************************************************************** */
|
1084 |
|
1085 |
/**
|
1087 |
*
|
1088 |
* @return string
|
1089 |
*/
|
1090 |
+
public function grabTitleFromPost($id = null) {
|
1091 |
global $wp_query;
|
1092 |
$post = null;
|
1093 |
$title = '';
|
1119 |
}
|
1120 |
}
|
1121 |
|
1122 |
+
return $title;
|
|
|
|
|
1123 |
}
|
1124 |
|
1125 |
/**
|
1175 |
*
|
1176 |
* @return array
|
1177 |
*/
|
1178 |
+
public function grabKeywordsFromPost($id = null) {
|
1179 |
global $wp_query;
|
1180 |
|
1181 |
+
$this->max_keywords = ($this->max_keywords > 0 ? ($this->max_keywords - 1) : 0);
|
1182 |
+
if ($this->max_keywords == 0) {
|
1183 |
return;
|
1184 |
}
|
1185 |
|
1202 |
}
|
1203 |
}
|
1204 |
|
1205 |
+
if (count($keywords) <= $this->max_keywords) {
|
1206 |
if ($advkeywords = $this->getAdvancedMeta($post->ID, 'keywords')) {
|
1207 |
$keywords[] = SQ_Tools::i18n($advkeywords);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1208 |
}
|
1209 |
}
|
1210 |
+
if (sizeof($keywords) > $this->max_keywords) {
|
1211 |
+
$keywords = array_slice($keywords, 0, $this->max_keywords);
|
1212 |
}
|
1213 |
} else {
|
1214 |
if (is_404()) {
|
1228 |
}
|
1229 |
}
|
1230 |
|
1231 |
+
if (sizeof($keywords) > $this->max_keywords) {
|
1232 |
+
$keywords = array_slice($keywords, 0, $this->max_keywords);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1233 |
}
|
1234 |
}
|
1235 |
+
if (count($keywords) <= $this->max_keywords) {
|
1236 |
foreach ($wp_query->posts as $post) {
|
1237 |
$id = (is_attachment()) ? ($post->post_parent) : ($post->ID);
|
1238 |
|
1265 |
$keywords[] = SQ_Tools::i18n($advkeywords);
|
1266 |
}
|
1267 |
|
1268 |
+
return $this->getUniqueKeywords($keywords);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1269 |
}
|
1270 |
|
1271 |
/**
|
1275 |
*/
|
1276 |
public function getCanonicalUrl() {
|
1277 |
global $wp_query;
|
1278 |
+
|
1279 |
+
if (isset($this->url)) {
|
1280 |
+
return $this->url;
|
1281 |
+
}
|
1282 |
+
|
1283 |
+
if (!isset($wp_query) || is_404() || is_search()) {
|
1284 |
return false;
|
1285 |
}
|
1286 |
|
1287 |
+
$haspost = (count($wp_query->posts) > 0);
|
1288 |
$has_ut = function_exists('user_trailingslashit');
|
1289 |
|
1290 |
if (get_query_var('m') <> '') {
|
1311 |
$link = get_permalink($post->ID);
|
1312 |
$link = $this->getPaged($link);
|
1313 |
} elseif (is_author() && $haspost) {
|
1314 |
+
$link = $this->getAuthor('user_url');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1315 |
} elseif (is_category() && $haspost) {
|
1316 |
$link = $this->getPaged(get_category_link(get_query_var('cat')));
|
1317 |
} else if (is_tag() && $haspost) {
|
1346 |
return false;
|
1347 |
}
|
1348 |
|
1349 |
+
return apply_filters('sq_canonical', $link);
|
1350 |
}
|
1351 |
|
1352 |
+
public function getAuthor($what = 'user_nicename') {
|
1353 |
+
if (!isset($this->author)) {
|
1354 |
+
if (is_author()) {
|
1355 |
+
$this->author = get_userdata(get_query_var('author'));
|
1356 |
+
} elseif (is_single() && isset($this->post->post_author)) {
|
1357 |
+
$this->author = get_userdata((int) $this->post->post_author)->data;
|
1358 |
+
}
|
1359 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1360 |
|
1361 |
+
if (isset($this->author)) {
|
1362 |
+
if ($what == 'user_url' && $this->author->$what == '') {
|
1363 |
+
return get_author_posts_url($this->author->ID, $this->author->user_nicename);
|
1364 |
+
}if (isset($this->author->$what)) {
|
1365 |
+
return $this->author->$what;
|
1366 |
}
|
1367 |
}
|
1368 |
+
|
1369 |
return false;
|
1370 |
}
|
1371 |
|
1394 |
* @return bool
|
1395 |
*/
|
1396 |
private function checkFrontPage() {
|
1397 |
+
return is_page() && get_option('show_on_front') == 'page' && isset($this->post->ID) && $this->post->ID == get_option('page_on_front');
|
|
|
1398 |
}
|
1399 |
|
1400 |
/**
|
1403 |
* @return bool
|
1404 |
*/
|
1405 |
private function checkPostsPage() {
|
1406 |
+
return is_home() && get_option('show_on_front') == 'page' && isset($this->post->ID) && $this->post->ID == get_option('page_for_posts');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1407 |
}
|
1408 |
|
1409 |
public function truncate($text, $min, $max) {
|
1419 |
}
|
1420 |
}
|
1421 |
$text = substr($text, 0, $max);
|
1422 |
+
return trim(stripcslashes($text));
|
|
|
1423 |
}
|
1424 |
|
1425 |
public function _truncate($text) {
|
1428 |
$text = str_replace(']]>', ']]>', $text);
|
1429 |
$text = @preg_replace('|\[(.+?)\](.+?\[/\\1\])?|s', '', $text);
|
1430 |
$text = strip_tags($text);
|
|
|
1431 |
|
1432 |
+
return trim(stripcslashes($text));
|
1433 |
}
|
1434 |
|
1435 |
/**
|
1451 |
|
1452 |
if (is_array($all) && count($all) > 0) {
|
1453 |
$all = array_unique($all);
|
1454 |
+
if (sizeof($all) > $this->max_keywords) {
|
1455 |
+
$all = array_slice($all, 0, $this->max_keywords);
|
1456 |
}
|
1457 |
|
1458 |
return implode(',', $all);
|
1477 |
return '';
|
1478 |
}
|
1479 |
|
|
|
1480 |
switch ($meta) {
|
1481 |
case 'title':
|
1482 |
+
$field = '_sq_fp_title';
|
1483 |
break;
|
1484 |
case 'description':
|
1485 |
+
$field = '_sq_fp_description';
|
1486 |
break;
|
1487 |
case 'keyword':
|
1488 |
+
$field = '_sq_fp_keywords';
|
1489 |
break;
|
1490 |
case 'ogimage':
|
1491 |
+
$field = '_sq_fp_ogimage';
|
1492 |
break;
|
1493 |
default:
|
1494 |
+
$field = '_sq_fp_title';
|
1495 |
}
|
1496 |
|
1497 |
if ($field <> '' && isset($this->meta[$post_id][$field])) {
|
1498 |
return $this->meta[$post_id][$field];
|
1499 |
}
|
1500 |
|
1501 |
+
// Get the custom Squirrly meta
|
1502 |
+
//////////////////////////////////////////
|
1503 |
+
$fields = array('_sq_fp_title' => '', '_sq_fp_description' => '', '_sq_fp_keywords' => '', '_sq_fp_ogimage' => '');
|
1504 |
|
1505 |
$sql = "SELECT `meta_key`, `meta_value`
|
1506 |
FROM `" . $wpdb->postmeta . "`
|
1543 |
return '';
|
1544 |
}
|
1545 |
|
1546 |
+
//check yoast
|
1547 |
switch ($meta) {
|
1548 |
case 'title':
|
1549 |
$field = '_yoast_wpseo_title';
|
1591 |
return false;
|
1592 |
}
|
1593 |
|
1594 |
+
/**
|
1595 |
+
* ROBOTSTXT
|
1596 |
+
*/
|
1597 |
+
// add sitemap location in robots.txt generated by WP
|
1598 |
+
public function robots($content = '') {
|
1599 |
+
global $blog_id;
|
1600 |
+
|
1601 |
+
/** display robots.txt */
|
1602 |
+
header('Status: 200 OK', true, 200);
|
1603 |
+
header('Content-type: text/plain; charset=' . get_bloginfo('charset'));
|
1604 |
+
|
1605 |
+
|
1606 |
+
echo "\n# Squirrly SEO Robots";
|
1607 |
+
|
1608 |
+
if (get_option('blog_public') != 1) {
|
1609 |
+
echo "\n# Squirrly Sitemaps is disabled. Please see Site Visibility on Settings > Reading.";
|
1610 |
+
} else {
|
1611 |
+
if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
|
1612 |
+
foreach ((array) SQ_Tools::$options['sq_sitemap'] as $name => $sitemap) {
|
1613 |
+
if ($name == 'sitemap-product' && !SQ_ObjController::getModel('SQ_BlockSettingsSeo')->isEcommerce()) {
|
1614 |
+
continue;
|
1615 |
+
}
|
1616 |
+
if ($sitemap[1] == 1 || $sitemap[1] == 2) {
|
1617 |
+
echo "\nSitemap: " . trailingslashit(get_bloginfo('url')) . $sitemap[0];
|
1618 |
+
}
|
1619 |
+
}
|
1620 |
+
}
|
1621 |
+
|
1622 |
+
if (empty(SQ_Tools::$options['sq_sitemap']))
|
1623 |
+
echo "\n# No Squirrly SEO Robots found. ";
|
1624 |
+
}
|
1625 |
+
echo "\n\n";
|
1626 |
+
|
1627 |
+
if (!empty(SQ_Tools::$options['sq_robots_security'])) {
|
1628 |
+
foreach ((array) SQ_Tools::$options['sq_robots_security'] as $robot_txt)
|
1629 |
+
echo $robot_txt . "\n";
|
1630 |
+
}
|
1631 |
+
echo "\n\n";
|
1632 |
+
|
1633 |
+
echo $content;
|
1634 |
+
exit;
|
1635 |
+
}
|
1636 |
+
|
1637 |
}
|
models/SQ_Ico.php
CHANGED
@@ -1,12 +1,5 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
/*
|
4 |
-
Copyright 2011-2013 Chris Jean & iThemes
|
5 |
-
Licensed under GPLv2 or above
|
6 |
-
|
7 |
-
Version 1.0.2
|
8 |
-
*/
|
9 |
-
|
10 |
class Model_SQ_Ico {
|
11 |
|
12 |
/**
|
@@ -100,6 +93,25 @@ class Model_SQ_Ico {
|
|
100 |
return true;
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
/**
|
104 |
* Generate the final ICO data by creating a file header and adding the image data.
|
105 |
*
|
@@ -211,7 +223,7 @@ class Model_SQ_Ico {
|
|
211 |
*/
|
212 |
function _load_image_file($file) {
|
213 |
// Run a cheap check to verify that it is an image file.
|
214 |
-
if (false === ( $size = getimagesize($file) ))
|
215 |
return false;
|
216 |
|
217 |
if (false === ( $file_data = file_get_contents($file) ))
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class Model_SQ_Ico {
|
4 |
|
5 |
/**
|
93 |
return true;
|
94 |
}
|
95 |
|
96 |
+
// public function save_ico(&$file) {
|
97 |
+
// $dir = null;
|
98 |
+
//
|
99 |
+
// $file = wp_upload_bits($file['name'], null, file_get_contents($file['tmp']));
|
100 |
+
//
|
101 |
+
// if (!isset($file['error']) || $file['error'] == '')
|
102 |
+
// if (isset($file['url']) && $file['url'] <> '') {
|
103 |
+
// $file['filename'] = basename($file['url']);
|
104 |
+
// return $file;
|
105 |
+
// }
|
106 |
+
// $file = false;
|
107 |
+
// }
|
108 |
+
|
109 |
+
function remove_ico($file) {
|
110 |
+
if (file_exists($file)) {
|
111 |
+
unlink($file);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
/**
|
116 |
* Generate the final ICO data by creating a file header and adding the image data.
|
117 |
*
|
223 |
*/
|
224 |
function _load_image_file($file) {
|
225 |
// Run a cheap check to verify that it is an image file.
|
226 |
+
if (false === ( $size = @getimagesize($file) ))
|
227 |
return false;
|
228 |
|
229 |
if (false === ( $file_data = file_get_contents($file) ))
|
models/SQ_Menu.php
CHANGED
@@ -117,253 +117,8 @@ class Model_SQ_Menu {
|
|
117 |
$this->meta[6] = null;
|
118 |
/* add the box content with WP */
|
119 |
add_meta_box($this->meta[0], $this->meta[1], $this->meta[2], $this->meta[3], $this->meta[4], $this->meta[5]);
|
120 |
-
//add_meta_box('post'._SQ_PLUGIN_NAME_, __(ucfirst(_SQ_PLUGIN_NAME_),_SQ_PLUGIN_NAME_), array($this, 'showMenu'), 'post', 'side', 'high');
|
121 |
}
|
122 |
}
|
123 |
}
|
124 |
|
125 |
-
/**
|
126 |
-
* Check the google code saved at settings
|
127 |
-
*
|
128 |
-
* @return string
|
129 |
-
*/
|
130 |
-
public function checkGoogleWTCode($code) {
|
131 |
-
if ($code <> '') {
|
132 |
-
if (strpos($code, 'content') !== false) {
|
133 |
-
preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
134 |
-
if (isset($result[1]) && !empty($result[1]))
|
135 |
-
$code = $result[1];
|
136 |
-
}
|
137 |
-
|
138 |
-
if (strpos($code, '"') !== false) {
|
139 |
-
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
140 |
-
if (isset($result[1]) && !empty($result[1]))
|
141 |
-
$code = $result[1];
|
142 |
-
}
|
143 |
-
|
144 |
-
if ($code == '')
|
145 |
-
SQ_Error::setError(__("The code for Google Webmaster Tool is incorrect.", _SQ_PLUGIN_NAME_));
|
146 |
-
}
|
147 |
-
return $code;
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Check the google code saved at settings
|
152 |
-
*
|
153 |
-
* @return string
|
154 |
-
*/
|
155 |
-
public function checkGoogleAnalyticsCode($code) {
|
156 |
-
//echo $code;
|
157 |
-
if ($code <> '') {
|
158 |
-
if (strpos($code, '_gaq.push') !== false) {
|
159 |
-
preg_match('/_gaq.push\(\[[\'\"]_setAccount[\'\"],\\s?[\'\"]([^\'\"]+)[\'\"]\]\)/i', $code, $result);
|
160 |
-
if (isset($result[1]) && !empty($result[1]))
|
161 |
-
$code = $result[1];
|
162 |
-
}
|
163 |
-
|
164 |
-
if (strpos($code, '"') !== false) {
|
165 |
-
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
166 |
-
if (isset($result[1]) && !empty($result[1]))
|
167 |
-
$code = $result[1];
|
168 |
-
}
|
169 |
-
|
170 |
-
if (strpos($code, 'UA-') === false) {
|
171 |
-
$code = '';
|
172 |
-
SQ_Error::setError(__("The code for Google Analytics is incorrect.", _SQ_PLUGIN_NAME_));
|
173 |
-
}
|
174 |
-
}
|
175 |
-
return $code;
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Check the Facebook code saved at settings
|
180 |
-
*
|
181 |
-
* @return string
|
182 |
-
*/
|
183 |
-
public function checkFavebookInsightsCode($code) {
|
184 |
-
if ($code <> '') {
|
185 |
-
if (strpos($code, 'content') !== false) {
|
186 |
-
preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
187 |
-
if (isset($result[1]) && !empty($result[1]))
|
188 |
-
$code = $result[1];
|
189 |
-
}
|
190 |
-
|
191 |
-
if (strpos($code, '"') !== false) {
|
192 |
-
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
193 |
-
if (isset($result[1]) && !empty($result[1]))
|
194 |
-
$code = $result[1];
|
195 |
-
}
|
196 |
-
|
197 |
-
if ($code == '')
|
198 |
-
SQ_Error::setError(__("The code for Facebook is incorrect.", _SQ_PLUGIN_NAME_));
|
199 |
-
}
|
200 |
-
return $code;
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Check the Pinterest code saved at settings
|
205 |
-
*
|
206 |
-
* @return string
|
207 |
-
*/
|
208 |
-
public function checkPinterestCode($code) {
|
209 |
-
if ($code <> '') {
|
210 |
-
if (strpos($code, 'content') !== false) {
|
211 |
-
preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
212 |
-
if (isset($result[1]) && !empty($result[1]))
|
213 |
-
$code = $result[1];
|
214 |
-
}
|
215 |
-
|
216 |
-
if (strpos($code, '"') !== false) {
|
217 |
-
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
218 |
-
if (isset($result[1]) && !empty($result[1]))
|
219 |
-
$code = $result[1];
|
220 |
-
}
|
221 |
-
|
222 |
-
if ($code == '')
|
223 |
-
SQ_Error::setError(__("The code for Pinterest is incorrect.", _SQ_PLUGIN_NAME_));
|
224 |
-
}
|
225 |
-
return $code;
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* Check the Bing code saved at settings
|
230 |
-
*
|
231 |
-
* @return string
|
232 |
-
*/
|
233 |
-
public function checkBingWTCode($code) {
|
234 |
-
if ($code <> '') {
|
235 |
-
if (strpos($code, 'content') !== false) {
|
236 |
-
preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
237 |
-
if (isset($result[1]) && !empty($result[1]))
|
238 |
-
$code = $result[1];
|
239 |
-
}
|
240 |
-
|
241 |
-
if (strpos($code, '"') !== false) {
|
242 |
-
preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
|
243 |
-
if (isset($result[1]) && !empty($result[1]))
|
244 |
-
$code = $result[1];
|
245 |
-
}
|
246 |
-
|
247 |
-
if ($code == '')
|
248 |
-
SQ_Error::setError(__("The code for Bing is incorrect.", _SQ_PLUGIN_NAME_));
|
249 |
-
}
|
250 |
-
return $code;
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Add the image to the root path
|
255 |
-
*
|
256 |
-
* @param string $file
|
257 |
-
* @param string $path
|
258 |
-
* @return array [name (the name of the file), favicon (the path of the ico), message (the returned message)]
|
259 |
-
*
|
260 |
-
*/
|
261 |
-
public function addFavicon($file, $path = ABSPATH) {
|
262 |
-
|
263 |
-
$out = array();
|
264 |
-
$out['name'] = strtolower(basename($file['name']));
|
265 |
-
$out['tmp'] = _SQ_CACHE_DIR_ . strtolower(basename($file['name']));
|
266 |
-
$out['favicon'] = $path . "/" . 'favicon.ico';
|
267 |
-
$file_err = $file['error'];
|
268 |
-
|
269 |
-
/* get the file extension */
|
270 |
-
$file_name = explode('.', $file['name']);
|
271 |
-
$file_type = strtolower($file_name[count($file_name) - 1]);
|
272 |
-
|
273 |
-
/* if the file has a name */
|
274 |
-
if (!empty($file['name'])) {
|
275 |
-
/* Check the extension */
|
276 |
-
$file_type = strtolower($file_type);
|
277 |
-
$files = array('ico', 'jpeg', 'jpg', 'gif', 'png');
|
278 |
-
$key = in_array($file_type, $files);
|
279 |
-
|
280 |
-
if (!$key) {
|
281 |
-
SQ_Error::setError(__("File type error: Only ICO, JPEG, JPG, GIF or PNG files are allowed.", _SQ_PLUGIN_NAME_));
|
282 |
-
return;
|
283 |
-
}
|
284 |
-
|
285 |
-
/* Check for error messages */
|
286 |
-
if (!$this->checkFunctions()) {
|
287 |
-
SQ_Error::setError(__("GD error: The GD library must be installed on your server.", _SQ_PLUGIN_NAME_));
|
288 |
-
return;
|
289 |
-
} else {
|
290 |
-
/* Delete the previous file if exists */
|
291 |
-
if (is_file($out['tmp'])) {
|
292 |
-
if (!unlink($out['tmp'])) {
|
293 |
-
SQ_Error::setError(__("Delete error: Could not delete the old favicon.", _SQ_PLUGIN_NAME_));
|
294 |
-
return;
|
295 |
-
}
|
296 |
-
}
|
297 |
-
|
298 |
-
/* Upload the file */
|
299 |
-
if (!move_uploaded_file($file['tmp_name'], $out['tmp'])) {
|
300 |
-
SQ_Error::setError(__("Upload error: Could not upload the favicon.", _SQ_PLUGIN_NAME_));
|
301 |
-
return;
|
302 |
-
}
|
303 |
-
|
304 |
-
/* Change the permision */
|
305 |
-
if (!chmod($out['tmp'], 0755)) {
|
306 |
-
SQ_Error::setError(__("Permission error: Could not change the favicon permissions.", _SQ_PLUGIN_NAME_));
|
307 |
-
return;
|
308 |
-
}
|
309 |
-
|
310 |
-
if ($file_type <> 'ico') {
|
311 |
-
/* Transform the image into icon */
|
312 |
-
|
313 |
-
switch ($file_type) {
|
314 |
-
case "jpeg":
|
315 |
-
case "jpg":
|
316 |
-
$im = @imagecreatefromjpeg($out['tmp']);
|
317 |
-
break;
|
318 |
-
case "gif":
|
319 |
-
$im = @imagecreatefromgif($out['tmp']);
|
320 |
-
break;
|
321 |
-
case "png":
|
322 |
-
$im = @imagecreatefrompng($out['tmp']);
|
323 |
-
break;
|
324 |
-
}
|
325 |
-
|
326 |
-
/* Save the file */
|
327 |
-
if ($im) {
|
328 |
-
$ico = SQ_ObjController::getModel('SQ_Ico');
|
329 |
-
$ico->set_image($out['tmp'], array(32, 32));
|
330 |
-
$ico->save_ico($out['favicon']);
|
331 |
-
} else {
|
332 |
-
SQ_Error::setError(__("ICO Error: Could not create the ICO from file. Try with another file type.", _SQ_PLUGIN_NAME_));
|
333 |
-
}
|
334 |
-
} else {
|
335 |
-
copy($out['tmp'], $out['favicon']);
|
336 |
-
}
|
337 |
-
|
338 |
-
$out['message'] = __("The favicon has been updated.", _SQ_PLUGIN_NAME_);
|
339 |
-
|
340 |
-
return $out;
|
341 |
-
}
|
342 |
-
}
|
343 |
-
}
|
344 |
-
|
345 |
-
private function checkFunctions() {
|
346 |
-
$required_functions = array(
|
347 |
-
'getimagesize',
|
348 |
-
'imagecreatefromstring',
|
349 |
-
'imagecreatetruecolor',
|
350 |
-
'imagecolortransparent',
|
351 |
-
'imagecolorallocatealpha',
|
352 |
-
'imagealphablending',
|
353 |
-
'imagesavealpha',
|
354 |
-
'imagesx',
|
355 |
-
'imagesy',
|
356 |
-
'imagecopyresampled',
|
357 |
-
);
|
358 |
-
|
359 |
-
foreach ($required_functions as $function) {
|
360 |
-
if (!function_exists($function)) {
|
361 |
-
SQ_Error::setError("The PHP_ICO class was unable to find the $function function, which is part of the GD library. Ensure that the system has the GD library installed and that PHP has access to it through a PHP interface, such as PHP's GD module. Since this function was not found, the library will be unable to create ICO files.");
|
362 |
-
return false;
|
363 |
-
}
|
364 |
-
}
|
365 |
-
|
366 |
-
return true;
|
367 |
-
}
|
368 |
-
|
369 |
}
|
117 |
$this->meta[6] = null;
|
118 |
/* add the box content with WP */
|
119 |
add_meta_box($this->meta[0], $this->meta[1], $this->meta[2], $this->meta[3], $this->meta[4], $this->meta[5]);
|
|
|
120 |
}
|
121 |
}
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
models/SQ_Post.php
CHANGED
@@ -66,7 +66,7 @@ class Model_SQ_Post {
|
|
66 |
'date' => $post->post_date_gmt);
|
67 |
}
|
68 |
} else {
|
69 |
-
$responce['error']
|
70 |
}
|
71 |
return json_encode($responce);
|
72 |
}
|
@@ -307,7 +307,7 @@ class Model_SQ_Post {
|
|
307 |
|
308 |
if ($posts = $wpdb->get_row("SELECT count(`post_id`) as count
|
309 |
FROM `" . $wpdb->postmeta . "`
|
310 |
-
WHERE (`meta_key` = '
|
311 |
|
312 |
return $posts->count;
|
313 |
}
|
@@ -329,7 +329,7 @@ class Model_SQ_Post {
|
|
329 |
|
330 |
if ($posts = $wpdb->get_results("SELECT `post_id`, `meta_value`
|
331 |
FROM `" . $wpdb->postmeta . "`
|
332 |
-
WHERE (`meta_key` = '
|
333 |
. $filter .
|
334 |
'ORDER BY `' . $ord . '`')) {
|
335 |
|
@@ -351,7 +351,7 @@ class Model_SQ_Post {
|
|
351 |
|
352 |
if ($row = $wpdb->get_row("SELECT `post_id`, `meta_value`
|
353 |
FROM `" . $wpdb->postmeta . "`
|
354 |
-
WHERE (`meta_key` = '
|
355 |
ORDER BY `meta_id` DESC")) {
|
356 |
|
357 |
return json_decode($row->meta_value);
|
@@ -368,7 +368,7 @@ class Model_SQ_Post {
|
|
368 |
public function saveKeyword($post_id, $args) {
|
369 |
$args->update = current_time('timestamp');
|
370 |
|
371 |
-
$meta[] = array('key' => '
|
372 |
'value' => json_encode($args));
|
373 |
|
374 |
$this->saveAdvMeta($post_id, $meta);
|
66 |
'date' => $post->post_date_gmt);
|
67 |
}
|
68 |
} else {
|
69 |
+
$responce['error'] = __('Squirrly could not find any results for: ') . ' "' . stripslashes($q) . '"';
|
70 |
}
|
71 |
return json_encode($responce);
|
72 |
}
|
307 |
|
308 |
if ($posts = $wpdb->get_row("SELECT count(`post_id`) as count
|
309 |
FROM `" . $wpdb->postmeta . "`
|
310 |
+
WHERE (`meta_key` = '_sq_post_keyword')")) {
|
311 |
|
312 |
return $posts->count;
|
313 |
}
|
329 |
|
330 |
if ($posts = $wpdb->get_results("SELECT `post_id`, `meta_value`
|
331 |
FROM `" . $wpdb->postmeta . "`
|
332 |
+
WHERE (`meta_key` = '_sq_post_keyword')"
|
333 |
. $filter .
|
334 |
'ORDER BY `' . $ord . '`')) {
|
335 |
|
351 |
|
352 |
if ($row = $wpdb->get_row("SELECT `post_id`, `meta_value`
|
353 |
FROM `" . $wpdb->postmeta . "`
|
354 |
+
WHERE (`meta_key` = '_sq_post_keyword' AND `post_id`=" . (int) $post_id . ")
|
355 |
ORDER BY `meta_id` DESC")) {
|
356 |
|
357 |
return json_decode($row->meta_value);
|
368 |
public function saveKeyword($post_id, $args) {
|
369 |
$args->update = current_time('timestamp');
|
370 |
|
371 |
+
$meta[] = array('key' => '_sq_post_keyword',
|
372 |
'value' => json_encode($args));
|
373 |
|
374 |
$this->saveAdvMeta($post_id, $meta);
|
models/SQ_Sitemaps.php
ADDED
@@ -0,0 +1,443 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Squirrly SEO - Sitemap Model
|
5 |
+
*
|
6 |
+
* Used to get the sitemap format for each type
|
7 |
+
*
|
8 |
+
* @class Model_SQ_Sitemaps
|
9 |
+
*/
|
10 |
+
class Model_SQ_Sitemaps {
|
11 |
+
|
12 |
+
var $args = array();
|
13 |
+
var $frequency;
|
14 |
+
var $type;
|
15 |
+
|
16 |
+
public function __construct() {
|
17 |
+
//For sitemap ping
|
18 |
+
$this->args['timeout'] = 5;
|
19 |
+
|
20 |
+
$this->frequency = array();
|
21 |
+
$this->frequency['daily'] = array('sitemap-home' => array(1, 'daily'), 'sitemap-product' => array(0.8, 'weekly'), 'sitemap-post' => array(0.8, 'daily'), 'sitemap-page' => array(0.6, 'weekly'), 'sitemap-category' => array(0.5, 'weekly'), 'sitemap-post_tag' => array(0.5, 'daily'), 'sitemap-archive' => array(0.3, 'monthly'), 'sitemap-author' => array(0.3, 'weekly'), 'sitemap-custom-tax' => array(0.3, 'weekly'), 'sitemap-custom-post' => array(0.8, 'daily'));
|
22 |
+
$this->frequency['weekly'] = array('sitemap-home' => array(1, 'weekly'), 'sitemap-product' => array(0.8, 'weekly'), 'sitemap-post' => array(0.8, 'weekly'), 'sitemap-page' => array(0.6, 'monthly'), 'sitemap-category' => array(0.3, 'monthly'), 'sitemap-post_tag' => array(0.5, 'weekly'), 'sitemap-archive' => array(0.3, 'monthly'), 'sitemap-author' => array(0.3, 'weekly'), 'sitemap-custom-tax' => array(0.3, 'weekly'), 'sitemap-custom-post' => array(0.8, 'weekly'));
|
23 |
+
$this->frequency['monthly'] = array('sitemap-home' => array(1, 'monthly'), 'sitemap-product' => array(0.8, 'weekly'), 'sitemap-post' => array(0.8, 'monthly'), 'sitemap-page' => array(0.6, 'monthly'), 'sitemap-category' => array(0.3, 'monthly'), 'sitemap-post_tag' => array(0.5, 'monthly'), 'sitemap-archive' => array(0.3, 'monthly'), 'sitemap-author' => array(0.3, 'monthly'), 'sitemap-custom-tax' => array(0.3, 'monthly'), 'sitemap-custom-post' => array(0.8, 'monthly'));
|
24 |
+
$this->frequency['yearly'] = array('sitemap-home' => array(1, 'monthly'), 'sitemap-product' => array(0.8, 'weekly'), 'sitemap-post' => array(0.8, 'monthly'), 'sitemap-page' => array(0.6, 'yearly'), 'sitemap-category' => array(0.3, 'yearly'), 'sitemap-post_tag' => array(0.5, 'monthly'), 'sitemap-archive' => array(0.3, 'yearly'), 'sitemap-author' => array(0.3, 'yearly'), 'sitemap-custom-tax' => array(0.3, 'yearly'), 'sitemap-custom-post' => array(0.8, 'monthly'));
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Add the Sitemap Index
|
29 |
+
* @global type $polylang
|
30 |
+
* @return type
|
31 |
+
*/
|
32 |
+
public function getHomeLink() {
|
33 |
+
$homes = array();
|
34 |
+
$homes['contains'] = array();
|
35 |
+
global $polylang;
|
36 |
+
|
37 |
+
if (isset($polylang)) {
|
38 |
+
foreach ($polylang->get_languages_list() as $term) {
|
39 |
+
$xml = array();
|
40 |
+
$xml['loc'] = esc_url($polylang->get_home_url($term));
|
41 |
+
$xml['lastmod'] = trim(mysql2date('Y-m-d\TH:i:s+00:00', $this->lastModified(), false));
|
42 |
+
$xml['changefreq'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']]['sitemap-home'][1];
|
43 |
+
$xml['priority'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']]['sitemap-home'][0];
|
44 |
+
$homes[] = $xml;
|
45 |
+
}
|
46 |
+
} else {
|
47 |
+
$xml = array();
|
48 |
+
$xml['loc'] = home_url();
|
49 |
+
$xml['lastmod'] = trim(mysql2date('Y-m-d\TH:i:s+00:00', $this->lastModified(), false));
|
50 |
+
$xml['changefreq'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']]['sitemap-home'][1];
|
51 |
+
$xml['priority'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']]['sitemap-home'][0];
|
52 |
+
if ($post_id = get_option('page_on_front')) {
|
53 |
+
if (SQ_Tools::$options['sq_sitemap_show']['images'] == 1) {
|
54 |
+
if ($images = SQ_ObjController::getModel('SQ_Frontend')->getImagesFromContent($post_id)) {
|
55 |
+
array_push($homes['contains'], 'image');
|
56 |
+
$xml['image:image'] = array();
|
57 |
+
foreach ($images as $image) {
|
58 |
+
if (empty($image['src']))
|
59 |
+
continue;
|
60 |
+
|
61 |
+
|
62 |
+
$xml['image:image'][] = array(
|
63 |
+
'image:loc' => $image['src'],
|
64 |
+
'image:title' => $image['title'],
|
65 |
+
'image:caption' => $image['description'],
|
66 |
+
);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
$homes[] = $xml;
|
72 |
+
unset($xml);
|
73 |
+
}
|
74 |
+
|
75 |
+
return $homes;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Add posts/pages in sitemap
|
80 |
+
* @return type
|
81 |
+
*/
|
82 |
+
public function getListPosts() {
|
83 |
+
$posts = array();
|
84 |
+
$posts['contains'] = array();
|
85 |
+
if (have_posts()) {
|
86 |
+
while (have_posts()) {
|
87 |
+
the_post();
|
88 |
+
|
89 |
+
//do not incude password protected pages in sitemap
|
90 |
+
if (post_password_required()) {
|
91 |
+
continue;
|
92 |
+
}
|
93 |
+
|
94 |
+
$post = get_post();
|
95 |
+
|
96 |
+
$xml = array();
|
97 |
+
$xml['loc'] = esc_url(get_permalink());
|
98 |
+
$xml['lastmod'] = trim(mysql2date('Y-m-d\TH:i:s+00:00', $this->lastModified(), false));
|
99 |
+
$xml['changefreq'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']][$this->type][1];
|
100 |
+
$xml['priority'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']][$this->type][0];
|
101 |
+
|
102 |
+
if (SQ_Tools::$options['sq_sitemap_show']['images'] == 1) {
|
103 |
+
if ($images = SQ_ObjController::getModel('SQ_Frontend')->getImagesFromContent($post->ID)) {
|
104 |
+
array_push($posts['contains'], 'image');
|
105 |
+
$xml['image:image'] = array();
|
106 |
+
foreach ($images as $image) {
|
107 |
+
if (empty($image['src']))
|
108 |
+
continue;
|
109 |
+
|
110 |
+
$xml['image:image'][] = array(
|
111 |
+
'image:loc' => $image['src'],
|
112 |
+
'image:title' => $image['title'],
|
113 |
+
'image:caption' => $image['description'],
|
114 |
+
);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
if (SQ_Tools::$options['sq_sitemap_show']['videos'] == 1) {
|
120 |
+
$images = SQ_ObjController::getModel('SQ_Frontend')->getImagesFromContent($post->ID);
|
121 |
+
if (isset($images[0]['src']) && $videos = SQ_ObjController::getModel('SQ_Frontend')->getVideosFromContent($post->ID)) {
|
122 |
+
array_push($posts['contains'], 'video');
|
123 |
+
$xml['video:video'] = array();
|
124 |
+
|
125 |
+
foreach ($videos as $video) {
|
126 |
+
if ($video == '')
|
127 |
+
continue;
|
128 |
+
|
129 |
+
$xml['video:video'][$post->ID] = array(
|
130 |
+
'video:player_loc' => htmlentities($video),
|
131 |
+
'video:thumbnail_loc' => htmlentities($images[0]['src']),
|
132 |
+
'video:title' => SQ_ObjController::getModel('SQ_Frontend')->grabTitleFromPost($post->ID),
|
133 |
+
'video:description' => SQ_ObjController::getModel('SQ_Frontend')->grabDescriptionFromPost($post->ID),
|
134 |
+
);
|
135 |
+
|
136 |
+
//set the first keyword for this video
|
137 |
+
$keywords = SQ_ObjController::getModel('SQ_Frontend')->grabKeywordsFromPost($post->ID);
|
138 |
+
$keywords = preg_split('/,/', $keywords);
|
139 |
+
if (is_array($keywords)) {
|
140 |
+
$xml['video:video'][$post->ID]['video:tag'] = $keywords[0];
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
$posts[] = $xml;
|
146 |
+
unset($xml);
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
return $posts;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Add the post news in sitemap
|
155 |
+
* If the site is registeres for google news
|
156 |
+
* @return type
|
157 |
+
*/
|
158 |
+
public function getListNews() {
|
159 |
+
$posts = array();
|
160 |
+
$posts['contains'] = array();
|
161 |
+
|
162 |
+
if (have_posts()) {
|
163 |
+
while (have_posts()) {
|
164 |
+
the_post();
|
165 |
+
$post = get_post();
|
166 |
+
|
167 |
+
$xml = array();
|
168 |
+
|
169 |
+
$xml['loc'] = esc_url(get_permalink());
|
170 |
+
$language = convert_chars(strip_tags(get_bloginfo('language')));
|
171 |
+
$language = substr($language, 0, strpos($language, '-'));
|
172 |
+
if ($language == '')
|
173 |
+
$language = 'en';
|
174 |
+
|
175 |
+
$xml['news:news'][$post->ID] = array(
|
176 |
+
'news:publication' => array(
|
177 |
+
'news:name' => $this->sanitizeString(get_bloginfo('name')),
|
178 |
+
'news:language' => $language
|
179 |
+
)
|
180 |
+
);
|
181 |
+
$xml['news:news'][$post->ID]['news:publication_date'] = trim(mysql2date('Y-m-d\TH:i:s+00:00', $this->lastModified(), false));
|
182 |
+
$xml['news:news'][$post->ID]['news:title'] = $this->sanitizeString(get_the_title());
|
183 |
+
$xml['news:news'][$post->ID]['news:keywords'] = (string) SQ_ObjController::getModel('SQ_Frontend')->grabKeywordsFromPost($post->ID);
|
184 |
+
|
185 |
+
|
186 |
+
if (SQ_Tools::$options['sq_sitemap_show']['images'] == 1) {
|
187 |
+
if ($images = SQ_ObjController::getModel('SQ_Frontend')->getImagesFromContent($post->ID)) {
|
188 |
+
array_push($posts['contains'], 'image');
|
189 |
+
$xml['image:image'] = array();
|
190 |
+
foreach ($images as $image) {
|
191 |
+
if (empty($image['src']))
|
192 |
+
continue;
|
193 |
+
|
194 |
+
$xml['image:image'][] = array(
|
195 |
+
'image:loc' => $image['src'],
|
196 |
+
'image:title' => $image['title'],
|
197 |
+
'image:caption' => $image['description'],
|
198 |
+
);
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
if (SQ_Tools::$options['sq_sitemap_show']['videos'] == 1) {
|
204 |
+
$images = SQ_ObjController::getModel('SQ_Frontend')->getImagesFromContent($post->ID);
|
205 |
+
if (isset($images[0]['src']) && $videos = SQ_ObjController::getModel('SQ_Frontend')->getVideosFromContent($post->ID)) {
|
206 |
+
array_push($posts['contains'], 'video');
|
207 |
+
$xml['video:video'] = array();
|
208 |
+
foreach ($videos as $video) {
|
209 |
+
if ($video == '')
|
210 |
+
continue;
|
211 |
+
|
212 |
+
$xml['video:video'][$post->ID] = array(
|
213 |
+
'video:player_loc' => $video,
|
214 |
+
'video:thumbnail_loc' => $images[0]['src'],
|
215 |
+
'video:title' => SQ_ObjController::getModel('SQ_Frontend')->grabTitleFromPost($post->ID),
|
216 |
+
'video:description' => SQ_ObjController::getModel('SQ_Frontend')->grabDescriptionFromPost($post->ID),
|
217 |
+
);
|
218 |
+
|
219 |
+
//set the first keyword for this video
|
220 |
+
$keywords = SQ_ObjController::getModel('SQ_Frontend')->grabKeywordsFromPost($post->ID);
|
221 |
+
$keywords = preg_split('/,/', $keywords);
|
222 |
+
if (is_array($keywords)) {
|
223 |
+
$xml['video:video'][$post->ID]['video:tag'] = $keywords[0];
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
$posts[] = $xml;
|
229 |
+
unset($xml);
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
return $posts;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Add the Taxonomies in sitemap
|
238 |
+
* @param type $type
|
239 |
+
* @return type
|
240 |
+
*/
|
241 |
+
public function getListTerms($type = null) {
|
242 |
+
if (!isset($type)) {
|
243 |
+
$type = $this->type;
|
244 |
+
}
|
245 |
+
|
246 |
+
$terms = $array = array();
|
247 |
+
$array['contains'] = array();
|
248 |
+
if ($type == 'sitemap-custom-tax') {
|
249 |
+
$taxonomies = $this->excludeTypes(get_taxonomies(), array('category', 'post_tag', 'nav_menu', 'link_category', 'post_format'));
|
250 |
+
if (!empty($taxonomies)) {
|
251 |
+
$taxonomies = array_unique($taxonomies);
|
252 |
+
}
|
253 |
+
foreach ($taxonomies as $taxonomy) {
|
254 |
+
$array = array_merge($array, $this->getListTerms($taxonomy));
|
255 |
+
}
|
256 |
+
} else {
|
257 |
+
$terms = get_terms(str_replace('sitemap-', '', $type));
|
258 |
+
}
|
259 |
+
|
260 |
+
if (!isset(SQ_Tools::$options['sq_sitemap'][$type])) {
|
261 |
+
$type = 'sitemap-custom-tax';
|
262 |
+
}
|
263 |
+
|
264 |
+
if (!empty($terms)) {
|
265 |
+
foreach ($terms AS $term) {
|
266 |
+
$xml = array();
|
267 |
+
|
268 |
+
$xml['loc'] = esc_url(get_term_link($term, $term->taxonomy));
|
269 |
+
$xml['lastmod'] = date('Y-m-d\TH:i:s+00:00', $term->lastmod);
|
270 |
+
$xml['changefreq'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']][$type][1];
|
271 |
+
$xml['priority'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']][$type][0];
|
272 |
+
|
273 |
+
$array[] = $xml;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
return $array;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Add the authors in sitemap
|
281 |
+
* @return type
|
282 |
+
*/
|
283 |
+
public function getListAuthors() {
|
284 |
+
$authors = $array = array();
|
285 |
+
$authors = apply_filters('sq-sitemap-authors', $this->type);
|
286 |
+
|
287 |
+
if (!empty($authors)) {
|
288 |
+
foreach ($authors AS $author) {
|
289 |
+
$xml = array();
|
290 |
+
|
291 |
+
$xml['loc'] = get_author_posts_url($author->ID, $author->user_nicename);
|
292 |
+
if (isset($author->lastmod) && $author->lastmod <> '')
|
293 |
+
$xml['lastmod'] = date('Y-m-d\TH:i:s+00:00', strtotime($author->lastmod));
|
294 |
+
$xml['changefreq'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']][$this->type][1];
|
295 |
+
$xml['priority'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']][$this->type][0];
|
296 |
+
|
297 |
+
$array[] = $xml;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
return $array;
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Add the archive in sitemap
|
305 |
+
* @return type
|
306 |
+
*/
|
307 |
+
public function getListArchive() {
|
308 |
+
$array = array();
|
309 |
+
$archives = apply_filters('sq-sitemap-archive', $this->type);
|
310 |
+
if (!empty($archives)) {
|
311 |
+
foreach ($archives as $archive) {
|
312 |
+
$xml = array();
|
313 |
+
|
314 |
+
$xml['loc'] = get_month_link($archive->year, $archive->month);
|
315 |
+
if (isset($archive->lastmod) && $archive->lastmod <> '')
|
316 |
+
$xml['lastmod'] = date('Y-m-d\TH:i:s+00:00', strtotime($archive->lastmod));
|
317 |
+
|
318 |
+
$xml['changefreq'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']][$this->type][1];
|
319 |
+
$xml['priority'] = $this->frequency[SQ_Tools::$options['sq_sitemap_frequency']][$this->type][0];
|
320 |
+
|
321 |
+
$array[] = $xml;
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
return $array;
|
326 |
+
}
|
327 |
+
|
328 |
+
private function sanitizeString($string) {
|
329 |
+
return esc_html(ent2ncr(strip_tags($string)));
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Get the last modified date for the specific post/page
|
334 |
+
*
|
335 |
+
* @global WP_Post $post
|
336 |
+
* @param string $sitemap
|
337 |
+
* @param string $term
|
338 |
+
* @return string
|
339 |
+
*/
|
340 |
+
public function lastModified($sitemap = 'post_type', $term = '') {
|
341 |
+
if ('post_type' == $sitemap) :
|
342 |
+
|
343 |
+
global $post;
|
344 |
+
|
345 |
+
if (isset($post->ID)) {
|
346 |
+
// if blog page look for last post date
|
347 |
+
if ($post->post_type == 'page' && $this->is_home($post->ID))
|
348 |
+
return get_lastmodified('GMT', 'post');
|
349 |
+
|
350 |
+
if (empty($this->postmodified[$post->ID])) {
|
351 |
+
$postmodified = get_post_modified_time('Y-m-d H:i:s', true, $post->ID);
|
352 |
+
$options = get_option('post_types');
|
353 |
+
|
354 |
+
if (!empty($options[$post->post_type]['update_lastmod_on_comments']))
|
355 |
+
$lastcomment = get_comments(array(
|
356 |
+
'status' => 'approve',
|
357 |
+
'number' => 1,
|
358 |
+
'post_id' => $post->ID,
|
359 |
+
));
|
360 |
+
|
361 |
+
if (isset($lastcomment[0]->comment_date_gmt))
|
362 |
+
if (mysql2date('U', $lastcomment[0]->comment_date_gmt) > mysql2date('U', $postmodified))
|
363 |
+
$postmodified = $lastcomment[0]->comment_date_gmt;
|
364 |
+
|
365 |
+
$this->postmodified[$post->ID] = $postmodified;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
return $this->postmodified[$post->ID];
|
369 |
+
|
370 |
+
elseif (!empty($term)) :
|
371 |
+
|
372 |
+
if (is_object($term)) {
|
373 |
+
if (!isset($this->termmodified[$term->term_id])) {
|
374 |
+
// get the latest post in this taxonomy item, to use its post_date as lastmod
|
375 |
+
$posts = get_posts(array(
|
376 |
+
'post_type' => 'any',
|
377 |
+
'numberposts' => 1,
|
378 |
+
'no_found_rows' => true,
|
379 |
+
'update_post_meta_cache' => false,
|
380 |
+
'update_post_term_cache' => false,
|
381 |
+
'update_cache' => false,
|
382 |
+
'tax_query' => array(
|
383 |
+
array(
|
384 |
+
'taxonomy' => $term->taxonomy,
|
385 |
+
'field' => 'slug',
|
386 |
+
'terms' => $term->slug
|
387 |
+
)
|
388 |
+
)
|
389 |
+
)
|
390 |
+
);
|
391 |
+
$this->termmodified[$term->term_id] = isset($posts[0]->post_date_gmt) ? $posts[0]->post_date_gmt : '';
|
392 |
+
}
|
393 |
+
return $this->termmodified[$term->term_id];
|
394 |
+
} else {
|
395 |
+
$obj = get_taxonomy($term);
|
396 |
+
return get_lastdate('gmt', $obj->object_type);
|
397 |
+
}
|
398 |
+
|
399 |
+
else :
|
400 |
+
|
401 |
+
return '0000-00-00 00:00:00';
|
402 |
+
|
403 |
+
endif;
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Check if the current page is the home page
|
408 |
+
* @global type $polylang
|
409 |
+
* @param type $id
|
410 |
+
* @return type
|
411 |
+
*/
|
412 |
+
public function is_home($id) {
|
413 |
+
$home = array();
|
414 |
+
$id = get_option('page_for_posts');
|
415 |
+
|
416 |
+
if (!empty($id)) {
|
417 |
+
global $polylang;
|
418 |
+
if (isset($polylang)) {
|
419 |
+
$home = $polylang->get_translations('post', $id);
|
420 |
+
} else {
|
421 |
+
$home = array($id);
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
return in_array($id, $home);
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Excude types from array
|
430 |
+
* @param array $types
|
431 |
+
* @param array $exclude
|
432 |
+
* @return array
|
433 |
+
*/
|
434 |
+
public function excludeTypes($types, $exclude) {
|
435 |
+
foreach ($exclude as $value) {
|
436 |
+
if (in_array($value, $types)) {
|
437 |
+
unset($types[$value]);
|
438 |
+
}
|
439 |
+
}
|
440 |
+
return $types;
|
441 |
+
}
|
442 |
+
|
443 |
+
}
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== SEO by SQUIRRLY ===
|
2 |
Contributors: cifi, calinvingan, florinmuresan
|
3 |
Tags: seo,seo optimization,seo content,seo plugin,wordpress seo,plugin,content seo,search engine optimization,xml,sitemap,keyword,keyword research,post,posts,page,squirrly,tag,image,images,photos,flickr,statistics,stats,google,content,title,description,favicon,mobile,canonical,author,google plus,analytics,admin,seo correction,seo title,seo meta,meta,google,twitter,news,blog,e-commerce,ecommerce,woocommerce,feed,feeds,marketing,multisite,buddypress,social,social media,url,automatic,iphone
|
4 |
-
Requires at least: 3.
|
5 |
Tested up to: 4.2
|
6 |
-
Stable tag:
|
7 |
Donate link: https://www.squirrly.co
|
8 |
|
9 |
SEO Plugin By Squirrly is for the NON-SEO experts. Get Excellent Seo with Better Content, Ranking and Analytics. For Both Humans and Search Bots.
|
@@ -137,6 +137,30 @@ Type a keyword to the right of the screen and start using Squirrly Seo. Enjoy!
|
|
137 |
|
138 |
|
139 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
= 3.4.4 =
|
141 |
* Updated the Twitter Card information
|
142 |
* Compatible with WP 4.1.1
|
@@ -271,7 +295,6 @@ Type a keyword to the right of the screen and start using Squirrly Seo. Enjoy!
|
|
271 |
* Fixed the Favicon issue for PNG images
|
272 |
|
273 |
|
274 |
-
|
275 |
== Credits ==
|
276 |
Florin Muresan - CEO at Squirrly
|
277 |
Calin Vingan - CTO at Squirrly
|
@@ -401,5 +424,5 @@ It all depends on how you have setup your wordpress until now. Some people use S
|
|
401 |
|
402 |
== Upgrade Notice ==
|
403 |
|
404 |
-
=
|
405 |
-
|
1 |
=== SEO by SQUIRRLY ===
|
2 |
Contributors: cifi, calinvingan, florinmuresan
|
3 |
Tags: seo,seo optimization,seo content,seo plugin,wordpress seo,plugin,content seo,search engine optimization,xml,sitemap,keyword,keyword research,post,posts,page,squirrly,tag,image,images,photos,flickr,statistics,stats,google,content,title,description,favicon,mobile,canonical,author,google plus,analytics,admin,seo correction,seo title,seo meta,meta,google,twitter,news,blog,e-commerce,ecommerce,woocommerce,feed,feeds,marketing,multisite,buddypress,social,social media,url,automatic,iphone
|
4 |
+
Requires at least: 3.5
|
5 |
Tested up to: 4.2
|
6 |
+
Stable tag: 3.4.4
|
7 |
Donate link: https://www.squirrly.co
|
8 |
|
9 |
SEO Plugin By Squirrly is for the NON-SEO experts. Get Excellent Seo with Better Content, Ranking and Analytics. For Both Humans and Search Bots.
|
137 |
|
138 |
|
139 |
== Changelog ==
|
140 |
+
|
141 |
+
= 5.0.0 =
|
142 |
+
* Changed Squirrly look
|
143 |
+
* Compatible with WP eCommerce plugin
|
144 |
+
* Made SEO improvements for Woocommerce plugin
|
145 |
+
* Interactive learning for the entire Squirrly SEO plugin
|
146 |
+
* Faster post save for long text and remote images
|
147 |
+
* Settings and SEO check improved
|
148 |
+
* Added robots.txt for multisites with security
|
149 |
+
* Added sitemap for multisites
|
150 |
+
* Added sitemap for images and videos for each article
|
151 |
+
* Added the Json LD in Structured Data META
|
152 |
+
* Added the social linked Data for Json LD and publisher
|
153 |
+
* Added the favicon.ico for multisites
|
154 |
+
* Added the icos for apple devices
|
155 |
+
* Added the SEO progress in post editor
|
156 |
+
* Added the SEO Star option in Dashboard
|
157 |
+
* Fixed bugs for multisites and made it compatible with WP 4.2
|
158 |
+
* Fixed the snippet title and description special chars
|
159 |
+
* Fixed the custom fields variable in post editor
|
160 |
+
* Fixed the site icon and added the site icon for multisites
|
161 |
+
* Fixed Sitemap for default permalink option
|
162 |
+
|
163 |
+
|
164 |
= 3.4.4 =
|
165 |
* Updated the Twitter Card information
|
166 |
* Compatible with WP 4.1.1
|
295 |
* Fixed the Favicon issue for PNG images
|
296 |
|
297 |
|
|
|
298 |
== Credits ==
|
299 |
Florin Muresan - CEO at Squirrly
|
300 |
Calin Vingan - CTO at Squirrly
|
424 |
|
425 |
== Upgrade Notice ==
|
426 |
|
427 |
+
= 5.0.0 =
|
428 |
+
5.0.0 is an important update. Different Squirrly look. Compatible with eCommerce plugins. Added interactive learning features. Added robots.txt and sitemap.xml for multisites. Added the JSON-LD. Option to show Squirrly for selected Post Types and more.
|
squirrly.php
CHANGED
@@ -8,12 +8,12 @@
|
|
8 |
Plugin URI: http://www.squirrly.co
|
9 |
Description: SEO Plugin By Squirrly is for the NON-SEO experts. Get Excellent Seo with Better Content, Ranking and Analytics. For Both Humans and Search Bots.<BR> <a href="http://my.squirrly.co/user" target="_blank"><strong>Check your profile</strong></a>
|
10 |
Author: cifi, calinvingan, florinmuresan
|
11 |
-
Version:
|
12 |
Author URI: http://www.squirrly.co
|
13 |
*/
|
14 |
|
15 |
/* SET THE CURRENT VERSION ABOVE AND BELOW */
|
16 |
-
define('SQ_VERSION', '
|
17 |
/* Call config files */
|
18 |
if (file_exists(dirname(__FILE__) . '/config/config.php')) {
|
19 |
require(dirname(__FILE__) . '/config/config.php');
|
@@ -58,6 +58,4 @@ if (file_exists(dirname(__FILE__) . '/config/config.php')) {
|
|
58 |
*/
|
59 |
register_activation_hook(__FILE__, array(SQ_ObjController::getController('SQ_Tools', false), 'sq_activate'));
|
60 |
register_deactivation_hook(__FILE__, array(SQ_ObjController::getController('SQ_Tools', false), 'sq_deactivate'));
|
61 |
-
}
|
62 |
-
|
63 |
-
|
8 |
Plugin URI: http://www.squirrly.co
|
9 |
Description: SEO Plugin By Squirrly is for the NON-SEO experts. Get Excellent Seo with Better Content, Ranking and Analytics. For Both Humans and Search Bots.<BR> <a href="http://my.squirrly.co/user" target="_blank"><strong>Check your profile</strong></a>
|
10 |
Author: cifi, calinvingan, florinmuresan
|
11 |
+
Version: 5.0.0
|
12 |
Author URI: http://www.squirrly.co
|
13 |
*/
|
14 |
|
15 |
/* SET THE CURRENT VERSION ABOVE AND BELOW */
|
16 |
+
define('SQ_VERSION', '5.0.0');
|
17 |
/* Call config files */
|
18 |
if (file_exists(dirname(__FILE__) . '/config/config.php')) {
|
19 |
require(dirname(__FILE__) . '/config/config.php');
|
58 |
*/
|
59 |
register_activation_hook(__FILE__, array(SQ_ObjController::getController('SQ_Tools', false), 'sq_activate'));
|
60 |
register_deactivation_hook(__FILE__, array(SQ_ObjController::getController('SQ_Tools', false), 'sq_deactivate'));
|
61 |
+
}
|
|
|
|
themes/default/SQ_BlocStatus.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
|
|
themes/default/SQ_BlockAccount.php
CHANGED
@@ -2,40 +2,33 @@
|
|
2 |
<?php SQ_ObjController::getBlock('SQ_BlockSupport')->init(); ?>
|
3 |
|
4 |
<?php if (SQ_Tools::$options['sq_api'] <> '') { ?>
|
5 |
-
<
|
6 |
<span class="sq_icon"></span>
|
7 |
<div id="sq_settings_title" ><?php _e('Squirrly account information', _SQ_PLUGIN_NAME_); ?> </div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
<div id="sq_settings_body" style="min-height: 400px;">
|
9 |
-
<?php if (SQ_Tools::$options['
|
10 |
-
<div id="
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
<p id="sq_survey_msg"><textarea class="sq_small_input" name="sq_survey_message" cols="60" rows="10"></textarea></p>
|
17 |
-
<div id="sq_survey_error"></div>
|
18 |
-
<p><div id="sq_survey_close" ><?php echo __('[stop showing this message]', _SQ_PLUGIN_NAME_) ?></div> <input id="sq_survey_submit" type="button" value="<?php _e('Send Reply', _SQ_PLUGIN_NAME_) ?>"> </p>
|
19 |
-
</li>
|
20 |
-
</ul>
|
21 |
-
</div>
|
22 |
<?php } ?>
|
23 |
-
<?php
|
24 |
-
if (SQ_Tools::$options['sq_api'] <> '') {
|
25 |
-
echo '<fieldset style="background: none; border: none; box-shadow: none;"><div id="sq_userinfo"></div></fieldset>
|
26 |
-
<script type="text/javascript">
|
27 |
-
jQuery(document).ready(function() {
|
28 |
-
sq_getUserStatus("' . _SQ_API_URL_ . '", "' . SQ_Tools::$options['sq_api'] . '");
|
29 |
-
});
|
30 |
-
</script>';
|
31 |
-
}
|
32 |
-
?>
|
33 |
-
<div id="sq_settings_title" style="text-align: right">
|
34 |
-
<input id="sq_goto_dashboard" type="button" value="<?php _e('Go to dashboard', _SQ_PLUGIN_NAME_) ?> »" />
|
35 |
-
</div>
|
36 |
|
37 |
</div>
|
38 |
-
</form>
|
39 |
|
40 |
-
|
41 |
-
|
|
|
|
|
|
2 |
<?php SQ_ObjController::getBlock('SQ_BlockSupport')->init(); ?>
|
3 |
|
4 |
<?php if (SQ_Tools::$options['sq_api'] <> '') { ?>
|
5 |
+
<div>
|
6 |
<span class="sq_icon"></span>
|
7 |
<div id="sq_settings_title" ><?php _e('Squirrly account information', _SQ_PLUGIN_NAME_); ?> </div>
|
8 |
+
<div id="sq_settings_title" style="text-align: right">
|
9 |
+
<input id="sq_goto_dashboard" type="button" value="<?php _e('Go to dashboard', _SQ_PLUGIN_NAME_) ?> »" />
|
10 |
+
<br style="clear: both;">
|
11 |
+
</div>
|
12 |
+
</div>
|
13 |
+
<?php } ?>
|
14 |
+
<div id="sq_helpaccountside" class="sq_helpside"></div>
|
15 |
+
<div id="sq_left">
|
16 |
+
|
17 |
+
<?php if (SQ_Tools::$options['sq_api'] <> '') { ?>
|
18 |
<div id="sq_settings_body" style="min-height: 400px;">
|
19 |
+
<?php if (SQ_Tools::$options['sq_api'] <> '') { ?>
|
20 |
+
<fieldset style="background: none; border: none; box-shadow: none;"><div id="sq_userinfo" class="sq_loading"></div></fieldset>
|
21 |
+
<script type="text/javascript">
|
22 |
+
jQuery(document).ready(function () {
|
23 |
+
sq_getUserStatus();
|
24 |
+
});
|
25 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
</div>
|
|
|
29 |
|
30 |
+
<?php } ?>
|
31 |
+
|
32 |
+
</div>
|
33 |
+
<div id="sq_sidehelp"></div>
|
34 |
+
</div>
|
themes/default/SQ_BlockAffiliate.php
CHANGED
@@ -1,105 +1,103 @@
|
|
1 |
<div id="sq_settings" >
|
2 |
<?php SQ_ObjController::getBlock('SQ_BlockSupport')->init(); ?>
|
3 |
-
<
|
4 |
<span class="sq_icon"></span>
|
5 |
<div id="sq_settings_title" ><?php _e('Join Squirrly today!', _SQ_PLUGIN_NAME_); ?> </div>
|
6 |
-
<div id="
|
7 |
-
<?php
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
<fieldset>
|
15 |
-
<legend>
|
16 |
-
<span class="sq_legend_title"><?php _e('Join Squirrly today!', _SQ_PLUGIN_NAME_); ?></span>
|
17 |
-
<span><?php echo sprintf(__('%sHow I Started Making Money With the Squirrly Affiliate Program%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/affiliate_program_squirrly-pagblog-article_id62228.html" target="_blank">', '</a>'); ?></span>
|
18 |
-
|
19 |
-
<span><p class="sq_settings_affiliate_bigtitle">
|
20 |
-
<?php _e('Affiliate Benefits', _SQ_PLUGIN_NAME_); ?>
|
21 |
-
</p>
|
22 |
-
<ul class="sq_settings_affiliate_info">
|
23 |
-
<li>
|
24 |
-
<div>
|
25 |
-
<span><?php echo sprintf(__('- Recurring 45%s commission', _SQ_PLUGIN_NAME_), '%'); ?></span>
|
26 |
-
</div>
|
27 |
-
</li>
|
28 |
-
<li>
|
29 |
-
<div>
|
30 |
-
<span><?php _e('- No cost', _SQ_PLUGIN_NAME_); ?></span>
|
31 |
-
</div>
|
32 |
-
</li>
|
33 |
-
<li>
|
34 |
-
<div>
|
35 |
-
<span><?php _e('- Monthly payments in your Paypal account', _SQ_PLUGIN_NAME_); ?></span>
|
36 |
-
</div>
|
37 |
-
</li>
|
38 |
-
</ul></span>
|
39 |
-
</legend>
|
40 |
-
<div>
|
41 |
-
<p class="sq_settings_affiliate_bigbutton" style="margin-bottom:35px;">
|
42 |
-
<?php
|
43 |
-
if (SQ_Tools::$options['sq_api'] <> '')
|
44 |
-
if (SQ_Tools::$options['sq_affiliate_link'] <> '') {
|
45 |
-
echo '<span>' . SQ_Tools::$options['sq_affiliate_link'] . '</span>';
|
46 |
-
echo '<span class="sq_settings_info">' . __('To redirect users to your site, just change "squirrly.co" with your domain.', _SQ_PLUGIN_NAME_) . '</span>';
|
47 |
-
} else {
|
48 |
-
?><input type="submit" name="sq_affiliate_link" value="<?php _e('Generate affiliate link', _SQ_PLUGIN_NAME_) ?> »" /><?php
|
49 |
-
}
|
50 |
-
?>
|
51 |
-
</p>
|
52 |
-
|
53 |
-
<?php
|
54 |
-
if (SQ_Tools::$options['sq_api'] <> '') {
|
55 |
-
if (SQ_Tools::$options['sq_affiliate_link'] <> '') {
|
56 |
-
echo __('Your affiliate account is set and ready to go. Above you have the affiliate link. ', _SQ_PLUGIN_NAME_);
|
57 |
-
echo '<br />';
|
58 |
-
echo sprintf(__('Check your affiliate page: %sAffiliate page%s', _SQ_PLUGIN_NAME_), '<a href="' . _SQ_DASH_URL_ . 'login/?token=' . SQ_Tools::$options['sq_api'] . '&redirect_to=' . _SQ_DASH_URL_ . 'user/affiliate' . '" target="_blank" style="font-weight:bold">', '</a>');
|
59 |
-
} else {
|
60 |
-
echo sprintf(__('%sTerms of Use for our Affiliate Program%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/partnertermsofuse-pag68354.html" target="_blank" style="font-weight:bold">', '</a>');
|
61 |
-
}
|
62 |
-
} else {
|
63 |
-
echo __('After you connect to Squirrly you can begin to use your free Squirrly affiliate link immediately!', _SQ_PLUGIN_NAME_);
|
64 |
-
}
|
65 |
-
?>
|
66 |
-
</div>
|
67 |
|
68 |
-
</fieldset>
|
69 |
-
<?php if (SQ_Tools::$options['sq_affiliate_link'] <> '') { ?>
|
70 |
<fieldset>
|
71 |
-
<legend
|
72 |
-
<span class="sq_legend_title"><?php _e('Squirrly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
</legend>
|
74 |
<div>
|
75 |
-
<
|
76 |
<?php
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
echo '<textarea style="width: 500px; height: 45px;" onclick="this.focus(); this.select();"><a href="' . SQ_Tools::$options['sq_affiliate_link'] . '" target="_blank" title="Seo Plugin by Squirrly"><img src="' . $sq_affiliate_image . '" /></a></textarea>';
|
85 |
-
echo '</span></li>';
|
86 |
}
|
87 |
?>
|
88 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
</div>
|
90 |
|
91 |
</fieldset>
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
</div>
|
1 |
<div id="sq_settings" >
|
2 |
<?php SQ_ObjController::getBlock('SQ_BlockSupport')->init(); ?>
|
3 |
+
<div>
|
4 |
<span class="sq_icon"></span>
|
5 |
<div id="sq_settings_title" ><?php _e('Join Squirrly today!', _SQ_PLUGIN_NAME_); ?> </div>
|
6 |
+
<div id="sq_settings_title" >
|
7 |
+
<input id="sq_goto_dashboard" type="button" value="<?php _e('Go to dashboard', _SQ_PLUGIN_NAME_) ?> »" />
|
8 |
+
</div>
|
9 |
+
</div>
|
10 |
+
<div id="sq_helpaffiliateside" class="sq_helpside"></div>
|
11 |
+
<div id="sq_left">
|
12 |
+
<form id="sq_settings_affiliate_form" name="settings" action="" method="post" enctype="multipart/form-data">
|
13 |
+
<div id="sq_settings_body">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
|
|
|
|
15 |
<fieldset>
|
16 |
+
<legend>
|
17 |
+
<span class="sq_legend_title"><?php _e('Join Squirrly today!', _SQ_PLUGIN_NAME_); ?></span>
|
18 |
+
<span><?php echo sprintf(__('%sHow I Started Making Money With the Squirrly Affiliate Program%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/affiliate_program_squirrly-pagblog-article_id62228.html" target="_blank">', '</a>'); ?></span>
|
19 |
+
|
20 |
+
<span><p class="sq_settings_affiliate_bigtitle">
|
21 |
+
<?php _e('Affiliate Benefits', _SQ_PLUGIN_NAME_); ?>
|
22 |
+
</p>
|
23 |
+
<ul class="sq_settings_affiliate_info">
|
24 |
+
<li>
|
25 |
+
<div>
|
26 |
+
<span><?php echo sprintf(__('- Recurring 45%s commission', _SQ_PLUGIN_NAME_), '%'); ?></span>
|
27 |
+
</div>
|
28 |
+
</li>
|
29 |
+
<li>
|
30 |
+
<div>
|
31 |
+
<span><?php _e('- No cost', _SQ_PLUGIN_NAME_); ?></span>
|
32 |
+
</div>
|
33 |
+
</li>
|
34 |
+
<li>
|
35 |
+
<div>
|
36 |
+
<span><?php _e('- Monthly payments in your Paypal account', _SQ_PLUGIN_NAME_); ?></span>
|
37 |
+
</div>
|
38 |
+
</li>
|
39 |
+
</ul></span>
|
40 |
</legend>
|
41 |
<div>
|
42 |
+
<p class="sq_settings_affiliate_bigbutton" style="margin-bottom:35px;">
|
43 |
<?php
|
44 |
+
if (SQ_Tools::$options['sq_api'] <> '') {
|
45 |
+
if (SQ_Tools::$options['sq_affiliate_link'] <> '') {
|
46 |
+
echo '<span>' . SQ_Tools::$options['sq_affiliate_link'] . '</span>';
|
47 |
+
echo '<span class="sq_settings_info">' . __('To redirect users to your site, just change "squirrly.co" with your domain.', _SQ_PLUGIN_NAME_) . '</span>';
|
48 |
+
} else {
|
49 |
+
?><input type="submit" name="sq_affiliate_link" value="<?php _e('Generate affiliate link', _SQ_PLUGIN_NAME_) ?> »" /><?php
|
50 |
+
}
|
|
|
|
|
51 |
}
|
52 |
?>
|
53 |
+
</p>
|
54 |
+
|
55 |
+
<?php
|
56 |
+
if (SQ_Tools::$options['sq_api'] <> '') {
|
57 |
+
if (SQ_Tools::$options['sq_affiliate_link'] <> '') {
|
58 |
+
echo __('Your affiliate account is set and ready to go. Above you have the affiliate link. ', _SQ_PLUGIN_NAME_);
|
59 |
+
echo '<br />';
|
60 |
+
echo sprintf(__('Check your affiliate page: %sAffiliate page%s', _SQ_PLUGIN_NAME_), '<a href="' . _SQ_DASH_URL_ . 'login/?token=' . SQ_Tools::$options['sq_api'] . '&redirect_to=' . _SQ_DASH_URL_ . 'user/affiliate' . '" target="_blank" style="font-weight:bold">', '</a>');
|
61 |
+
}
|
62 |
+
} else {
|
63 |
+
echo __('After you connect to Squirrly you can begin to use your free Squirrly affiliate link immediately!', _SQ_PLUGIN_NAME_);
|
64 |
+
}
|
65 |
+
?>
|
66 |
</div>
|
67 |
|
68 |
</fieldset>
|
69 |
+
<?php if (SQ_Tools::$options['sq_affiliate_link'] <> '') { ?>
|
70 |
+
<fieldset>
|
71 |
+
<legend class="sq_legend_big" style=" min-height: 1200px">
|
72 |
+
<span class="sq_legend_title"><?php _e('Squirrly banners you can use', _SQ_PLUGIN_NAME_); ?></span>
|
73 |
+
</legend>
|
74 |
+
<div>
|
75 |
+
<ul class="sq_settings_affiliate_info">
|
76 |
+
<?php
|
77 |
+
$sq_affiliate_images[] = _SQ_THEME_URL_ . 'img/banners/banner1.jpg';
|
78 |
+
$sq_affiliate_images[] = _SQ_THEME_URL_ . 'img/banners/banner1.png';
|
79 |
+
$sq_affiliate_images[] = _SQ_THEME_URL_ . 'img/banners/banner2.jpg';
|
80 |
+
$sq_affiliate_images[] = _SQ_THEME_URL_ . 'img/banners/banner2.png';
|
81 |
+
|
82 |
+
foreach ($sq_affiliate_images as $sq_affiliate_image) {
|
83 |
+
echo '<li><a href="' . SQ_Tools::$options['sq_affiliate_link'] . '" target="_blank"><img src="' . $sq_affiliate_image . '" alt="Seo Plugin by Squirrly" /></a>';
|
84 |
+
echo '<span class="sq_affiliate_banner" >';
|
85 |
+
echo '<textarea style="width: 500px; height: 45px;" onclick="this.focus(); this.select();"><a href="' . SQ_Tools::$options['sq_affiliate_link'] . '" target="_blank" title="Seo Plugin by Squirrly"><img src="' . $sq_affiliate_image . '" /></a></textarea>';
|
86 |
+
echo '</span></li>';
|
87 |
+
}
|
88 |
+
?>
|
89 |
+
</ul>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
</fieldset>
|
93 |
+
<?php } ?>
|
94 |
+
</div>
|
95 |
+
<br style="clear: both;"/>
|
96 |
+
<div id="sq_settings_title" style="text-align: right">
|
97 |
+
<a href="?page=sq_dashboard" id="sq_goto_newpost" style="display:none" /><?php _e('<< START HERE >>', _SQ_PLUGIN_NAME_) ?></a>
|
98 |
+
</div>
|
99 |
+
<input type="hidden" name="action" value="sq_settings_affiliate" />
|
100 |
+
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce(_SQ_NONCE_ID_); ?>" />
|
101 |
+
</form>
|
102 |
+
</div>
|
103 |
</div>
|
themes/default/SQ_BlockAnalytics.php
CHANGED
@@ -46,15 +46,23 @@
|
|
46 |
}
|
47 |
} elseif (is_object($task->value)) {
|
48 |
if ($task->name === 'Links') {
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
<li>
|
53 |
<div class="sq_analytics_values_title">' . __('Moz Inbound Links') . '</div>
|
54 |
<div class="sq_analytics_values_value">' . $task->value->mozLinks . '</div>
|
55 |
<div class="sq_rank_sprite sq_rank_seomoz_inbound"></div>
|
56 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
</ul>';
|
|
|
58 |
} elseif ($task->name === 'Authority') {
|
59 |
$task->value->mozAuthority = number_format_i18n($task->value->mozAuthority);
|
60 |
$task->value->mozRank = number_format_i18n($task->value->mozRank);
|
@@ -76,13 +84,12 @@
|
|
76 |
<div class = "sq_analytics_values_title">' . __('Google Page Rank') . '</div>
|
77 |
<div class = "sq_analytics_values_value">' . $task->value->googleRank . '</div>
|
78 |
<div class = "sq_rank_sprite sq_rank_google_pagerank"></div>
|
79 |
-
</li>' : '') .
|
80 |
-
|
81 |
-
((isset($task->value->auditScore)) ?
|
82 |
'<li>
|
83 |
-
<div class = "sq_analytics_values_title">' . __('
|
84 |
-
<div class = "sq_analytics_values_value">' . $task->value->
|
85 |
-
<div class = "sq_rank_sprite
|
86 |
</li>' : '') . '
|
87 |
</ul>';
|
88 |
} elseif ($task->name === 'Shares') {
|
@@ -277,7 +284,7 @@
|
|
277 |
</div>
|
278 |
|
279 |
<script>
|
280 |
-
jQuery('.sq_analytics_tasks_video_cover').unbind('click').bind('click', function() {
|
281 |
jQuery(this).html('<object width="280" height="158"><param name="movie" value="https://www.youtube.com/v/' + jQuery(this).attr('rel') + ((jQuery(this).attr('rel').indexOf('?') != -1) ? '&' : '?') + 'version=3&hl=en_US&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="https://www.youtube.com/v/' + jQuery(this).attr('rel') + ((jQuery(this).attr('rel').indexOf('?') != -1) ? '&' : '?') + 'version=3&hl=en_US&autoplay=1" type="application/x-shockwave-flash" width="280" height="158" allowscriptaccess="always" allowfullscreen="true"></embed></object>');
|
282 |
});
|
283 |
</script>
|
46 |
}
|
47 |
} elseif (is_object($task->value)) {
|
48 |
if ($task->name === 'Links') {
|
49 |
+
if (isset($task->value->mozLinks)) {
|
50 |
+
$task->value->mozLinks = number_format_i18n($task->value->mozLinks);
|
51 |
+
$replace .= '<ul class="sq_analytics_values" >
|
52 |
<li>
|
53 |
<div class="sq_analytics_values_title">' . __('Moz Inbound Links') . '</div>
|
54 |
<div class="sq_analytics_values_value">' . $task->value->mozLinks . '</div>
|
55 |
<div class="sq_rank_sprite sq_rank_seomoz_inbound"></div>
|
56 |
</li>
|
57 |
+
' .
|
58 |
+
((isset($task->value->ahrefsLinks)) ?
|
59 |
+
'<li>
|
60 |
+
<div class="sq_analytics_values_title">' . __('Ahrefs Inbound Links') . '</div>
|
61 |
+
<div class="sq_analytics_values_value">' . $task->value->ahrefsLinks . '</div>
|
62 |
+
<div class="sq_rank_sprite sq_rank_ahrefs_rank"></div>
|
63 |
+
</li>' : '') . '
|
64 |
</ul>';
|
65 |
+
}
|
66 |
} elseif ($task->name === 'Authority') {
|
67 |
$task->value->mozAuthority = number_format_i18n($task->value->mozAuthority);
|
68 |
$task->value->mozRank = number_format_i18n($task->value->mozRank);
|
84 |
<div class = "sq_analytics_values_title">' . __('Google Page Rank') . '</div>
|
85 |
<div class = "sq_analytics_values_value">' . $task->value->googleRank . '</div>
|
86 |
<div class = "sq_rank_sprite sq_rank_google_pagerank"></div>
|
87 |
+
</li>' : '') .
|
88 |
+
((isset($task->value->ahrefsRank)) ?
|
|
|
89 |
'<li>
|
90 |
+
<div class = "sq_analytics_values_title">' . __('Ahrefs Rank') . '</div>
|
91 |
+
<div class = "sq_analytics_values_value">' . $task->value->ahrefsRank . '</div>
|
92 |
+
<div class = "sq_rank_sprite sq_rank_ahrefs_rank"></div>
|
93 |
</li>' : '') . '
|
94 |
</ul>';
|
95 |
} elseif ($task->name === 'Shares') {
|
284 |
</div>
|
285 |
|
286 |
<script>
|
287 |
+
jQuery('.sq_analytics_tasks_video_cover').unbind('click').bind('click', function () {
|
288 |
jQuery(this).html('<object width="280" height="158"><param name="movie" value="https://www.youtube.com/v/' + jQuery(this).attr('rel') + ((jQuery(this).attr('rel').indexOf('?') != -1) ? '&' : '?') + 'version=3&hl=en_US&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="https://www.youtube.com/v/' + jQuery(this).attr('rel') + ((jQuery(this).attr('rel').indexOf('?') != -1) ? '&' : '?') + 'version=3&hl=en_US&autoplay=1" type="application/x-shockwave-flash" width="280" height="158" allowscriptaccess="always" allowfullscreen="true"></embed></object>');
|
289 |
});
|
290 |
</script>
|
themes/default/SQ_BlockAudit.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<div class="sq_dashboard_box">
|
2 |
-
<div class="sq_dashboard_audit" onclick="window.open('<?php echo _SQ_DASH_URL_ ?>user/audit/<?php echo SQ_Tools::$options['sq_api'] . md5(strtolower(get_bloginfo('url'))) ?>', '_blank');"><span id="sq_audit_error" style="display: none;"><?php _e('Your site audit is not yet ready. It may take up to 7 days to audit your blog.', _SQ_PLUGIN_NAME_); ?></span></div>
|
3 |
-
</div>
|
4 |
-
<script type="text/javascript">
|
5 |
-
jQuery(document).ready(function() {
|
6 |
-
sq_checkAudit("<?php echo _SQ_DASH_URL_ ?>", "<?php echo SQ_Tools::$options['sq_api'] . md5(strtolower(get_bloginfo('url'))) ?>"); //Check the seo audit for this page
|
7 |
-
});
|
8 |
-
|
9 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
themes/default/SQ_BlockDashboard.php
CHANGED
@@ -1,54 +1,94 @@
|
|
1 |
-
<div id="
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
6 |
|
7 |
-
<div class="
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
</div>
|
|
|
|
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
</div>
|
19 |
-
|
20 |
</div>
|
21 |
</div>
|
22 |
-
<script type="text/javascript">
|
23 |
-
//Dashboard
|
24 |
-
jQuery("#sq_dashboard").find('.sq_dashboard_assistant').bind('click', function() {
|
25 |
-
<?php
|
26 |
-
global $current_user;
|
27 |
-
$recent_posts = wp_get_recent_posts(array('post_status' => 'publish', 'author' => $current_user->ID));
|
28 |
-
if (!empty($recent_posts)) {
|
29 |
-
foreach ($recent_posts as $recent) {
|
30 |
-
echo 'location.href = "post.php?post=' . $recent["ID"] . '&action=edit";';
|
31 |
-
break;
|
32 |
-
}
|
33 |
-
} else {
|
34 |
-
echo 'location.href = "post-new.php";';
|
35 |
-
}
|
36 |
-
?>
|
37 |
-
});
|
38 |
-
jQuery("#sq_dashboard").find('.sq_dashboard_analytics').bind('click', function() {
|
39 |
-
<?php
|
40 |
-
if (SQ_ObjController::getModel('SQ_Post')->countKeywords() > 0) {
|
41 |
-
echo 'location.href = "admin.php?page=sq_posts";';
|
42 |
-
} else {
|
43 |
-
echo 'alert("' . __('To see the analytics for your posts, you have to start optimizing your articles using Squirrly. That will enable tracking, and we\'ll be able to send you valuable data about your post.', _SQ_PLUGIN_NAME_) . '");';
|
44 |
-
}
|
45 |
-
?>
|
46 |
-
});
|
47 |
-
|
48 |
-
jQuery("#sq_dashboard").find('.sq_dashboard_research').bind('click', function() {
|
49 |
-
location.href = "post-new.php#sq_research=1";
|
50 |
-
});
|
51 |
-
</script>
|
52 |
-
|
53 |
-
<?php
|
54 |
-
|
1 |
+
<div id="sq_settings" >
|
2 |
+
<?php SQ_ObjController::getBlock('SQ_BlockSupport')->init(); ?>
|
3 |
+
<?php if (SQ_Tools::$options['sq_api'] == '') { ?>
|
4 |
+
<span class="sq_icon"></span>
|
5 |
+
<div id="sq_settings_title" ><?php _e('Connect to Squirrly.co', _SQ_PLUGIN_NAME_); ?> </div>
|
6 |
+
<div id="sq_settings_login"><?php SQ_ObjController::getBlock('SQ_Blocklogin')->init(); ?></div>
|
7 |
|
8 |
+
<div class="sq_login_link"><?php _e('Connect to Squirrly and start optimizing your site', _SQ_PLUGIN_NAME_); ?></div>
|
9 |
+
<input id="sq_goto_dashboard" style="display:none; margin: 0 auto; width: 500px; padding: 0px 10px;" type="button" value="«<?php _e('START HERE', _SQ_PLUGIN_NAME_) ?> »" />
|
10 |
+
|
11 |
+
<?php
|
12 |
+
} else {
|
13 |
+
?>
|
14 |
+
<div>
|
15 |
+
<span class="sq_icon"></span>
|
16 |
+
<div id="sq_settings_title" ><?php _e('Squirrly dashboard', _SQ_PLUGIN_NAME_); ?> </div>
|
17 |
</div>
|
18 |
+
<div id="sq_helpdashboardside" class="sq_helpside"></div>
|
19 |
+
<div id="sq_helpdashboardcontent" class="sq_helpcontent"></div>
|
20 |
|
21 |
+
<?php } ?>
|
22 |
|
23 |
+
<div class="sq_helpcontent" style="display: none; clear: left; <?php echo (SQ_Tools::$options['sq_api'] == '') ? 'text-align: center;' : '' ?>">
|
24 |
+
<div style="width: 700px; display: inline-block;">
|
25 |
+
<div style="font-size: 24px; margin: 30px 0; color: #999;">All Squirrly Features</div>
|
26 |
+
<ul class="sq_slidelist">
|
27 |
+
<li>
|
28 |
+
<a href="javascript:void(0);" rel="44987512" style="background-image: url('//image.slidesharecdn.com/kr-150222110827-conversion-gate01/95/squirrly-keyword-research-1-638.jpg?cb=1424624994')"></a>
|
29 |
+
<div>Squirrly Keyword Research</div>
|
30 |
+
</li>
|
31 |
+
<li>
|
32 |
+
<a href="javascript:void(0);" rel="44987943" style="background-image: url('//image.slidesharecdn.com/sla-150222112751-conversion-gate01/95/squirrly-live-assistant-1-638.jpg?cb=1424626190')"></a>
|
33 |
+
<div>Squirrly Live Assistant</div>
|
34 |
+
</li>
|
35 |
+
<li>
|
36 |
+
<a href="javascript:void(0);" rel="44987925" style="background-image: url('//image.slidesharecdn.com/snippet1-150222112635-conversion-gate01/95/squirrly-snippet-tool-1-638.jpg?cb=1424626028')"></a>
|
37 |
+
<div>Squirrly Snippet Tool</div>
|
38 |
+
</li>
|
39 |
+
<li>
|
40 |
+
<a href="javascript:void(0);" rel="45020680" style="background-image: url('//image.slidesharecdn.com/analytics-150223081607-conversion-gate02/95/squirrly-performance-analytics-1-638.jpg?cb=1424701102')"></a>
|
41 |
+
<div>Squirrly Performance Analyticsl</div>
|
42 |
+
</li>
|
43 |
+
<li>
|
44 |
+
<a href="javascript:void(0);" rel="45062956" style="background-image: url('//image.slidesharecdn.com/firstpage-150224040740-conversion-gate01/95/squirrly-first-page-optimization-1-638.jpg?cb=1427713684')"></a>
|
45 |
+
<div>Squirrly First Page Optimization</div>
|
46 |
+
</li>
|
47 |
+
<li>
|
48 |
+
<a href="javascript:void(0);" rel="45117764" style="background-image: url('//image.slidesharecdn.com/socialoption-150225050457-conversion-gate02/95/squirrly-open-graph-and-twitter-card-1-638.jpg?cb=1427713066')"></a>
|
49 |
+
<div>Squirrly Open Graph and Twitter Card</div>
|
50 |
+
</li>
|
51 |
+
<li>
|
52 |
+
<a href="javascript:void(0);" rel="45142191" style="background-image: url('//image.slidesharecdn.com/check-150225143101-conversion-gate02/95/squirrly-check-for-seo-errors-1-638.jpg?cb=1427713151')"></a>
|
53 |
+
<div>Squirrly Check for SEO errors</div>
|
54 |
+
</li>
|
55 |
+
<li>
|
56 |
+
<a href="javascript:void(0);" rel="46171871" style="background-image: url('//image.slidesharecdn.com/sitemap-150323092133-conversion-gate01/95/squirrly-sitemap-xml-1-638.jpg?cb=1427713209')"></a>
|
57 |
+
<div>Squirrly Sitemap XML</div>
|
58 |
+
</li>
|
59 |
+
<li>
|
60 |
+
<a href="javascript:void(0);" rel="46209176" style="background-image: url('//image.slidesharecdn.com/favicon-150324035827-conversion-gate01/95/squirrly-faviconico-1-638.jpg?cb=1427713276')"></a>
|
61 |
+
<div>Squirrly Favicon.ico</div>
|
62 |
+
</li>
|
63 |
+
<li>
|
64 |
+
<a href="javascript:void(0);" rel="46213739" style="background-image: url('//image.slidesharecdn.com/jsonld-150324055711-conversion-gate01/95/squirrly-jsonld-structured-data-1-638.jpg?cb=1427713334')"></a>
|
65 |
+
<div>Squirrly Json-LD Structured Data</div>
|
66 |
+
</li>
|
67 |
+
<li>
|
68 |
+
<a href="javascript:void(0);" rel="46218043" style="background-image: url('//image.slidesharecdn.com/tracking-150324074838-conversion-gate01/95/squirrly-tracking-tools-1-638.jpg?cb=1427713384')"></a>
|
69 |
+
<div>Squirrly Tracking Tools</div>
|
70 |
+
</li>
|
71 |
+
<li>
|
72 |
+
<a href="javascript:void(0);" rel="46219965" style="background-image: url('//image.slidesharecdn.com/types-150324083302-conversion-gate01/95/squirrly-settings-for-posts-and-pages-1-638.jpg?cb=1427713476')"></a>
|
73 |
+
<div>Squirrly Settings for Posts and Pages</div>
|
74 |
+
</li>
|
75 |
+
<li>
|
76 |
+
<a href="javascript:void(0);" rel="46220852" style="background-image: url('//image.slidesharecdn.com/ranking-150324085252-conversion-gate01/95/squirrly-google-rank-option-1-638.jpg?cb=1427713539')"></a>
|
77 |
+
<div>Squirrly Google Rank Option</div>
|
78 |
+
</li>
|
79 |
+
<li>
|
80 |
+
<a href="javascript:void(0);" rel="46222827" style="background-image: url('//image.slidesharecdn.com/success-150324093815-conversion-gate01/95/measure-your-success-option-from-squirrly-1-638.jpg?cb=1427713584')"></a>
|
81 |
+
<div>Measure Your Success Option from Squirrly</div>
|
82 |
+
</li>
|
83 |
+
<li>
|
84 |
+
<a href="javascript:void(0);" rel="46256414" style="background-image: url('//image.slidesharecdn.com/robots-150325031929-conversion-gate01/95/squirrly-robotstxt-1-638.jpg?cb=1427713635')"></a>
|
85 |
+
<div>Squirrly Robots.txt</div>
|
86 |
+
</li>
|
87 |
+
<li>
|
88 |
+
<a href="javascript:void(0);" rel="46440187" style="background-image: url('//image.slidesharecdn.com/audit-150330042921-conversion-gate01/95/squirrly-site-audit-1-638.jpg?cb=1427707809')"></a>
|
89 |
+
<div>Squirrly Site Audit</div>
|
90 |
+
</li>
|
91 |
+
</ul>
|
92 |
</div>
|
|
|
93 |
</div>
|
94 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
themes/default/SQ_BlockHelp.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<div id="sq_settings" >
|
2 |
-
<span class="sq_icon"></span>
|
3 |
-
<div id="sq_settings_title" ><?php _e('Connect to Squirrly.co', _SQ_PLUGIN_NAME_); ?> </div>
|
4 |
-
<?php
|
5 |
-
if (SQ_Tools::$options['sq_api'] == '') {
|
6 |
-
echo '<div id="sq_settings_login">';
|
7 |
-
SQ_ObjController::getBlock('SQ_Blocklogin')->init();
|
8 |
-
echo '</div>';
|
9 |
-
}
|
10 |
-
|
11 |
-
|
12 |
-
global $current_user;
|
13 |
-
$recent_posts = wp_get_recent_posts(array('post_status' => 'publish', 'author' => $current_user->ID));
|
14 |
-
if (!empty($recent_posts)) {
|
15 |
-
foreach ($recent_posts as $recent) {
|
16 |
-
$link = 'post.php?post=' . $recent["ID"] . '&action=edit";';
|
17 |
-
break;
|
18 |
-
}
|
19 |
-
} else {
|
20 |
-
$link = 'post-new.php';
|
21 |
-
}
|
22 |
-
?>
|
23 |
-
|
24 |
-
<div id="sq_settings_howto">
|
25 |
-
<div id="sq_settings_howto_title" ><?php _e('Get Excellent SEO with Better Content and SEO Stats. For Both Humans and Search Bots.', _SQ_PLUGIN_NAME_); ?></div>
|
26 |
-
<div id="sq_settings_howto_body">
|
27 |
-
<p><iframe width="640" height="480" src="//www.youtube.com/embed/mEjrE7TuDDc" frameborder="0" allowfullscreen></iframe></p>
|
28 |
-
<div id="sq_settings_howto_title" ><?php _e('Squirrly SEO Plugin is for the NON-SEO expert. ', _SQ_PLUGIN_NAME_); ?></div>
|
29 |
-
<p><span><?php _e('See all the Squirrly SEO features at: ', _SQ_PLUGIN_NAME_); ?><a href="http://bit.ly/1lV9dX6" target="_blank"><strong>Squirrly Features</strong></a></span></p>
|
30 |
-
</div>
|
31 |
-
</div>
|
32 |
-
<div class="sq_login_link"><?php _e('Connect to Squirrly and start optimizing your site', _SQ_PLUGIN_NAME_); ?></div>
|
33 |
-
<div id="sq_settings_title" style="text-align: right">
|
34 |
-
<a href="<?php echo $link ?>" id="sq_goto_newpost" <?php echo ((SQ_Tools::$options['sq_api'] <> '') ? '' : 'style="display:none"') ?> /><?php _e('<< START HERE >>', _SQ_PLUGIN_NAME_) ?></a>
|
35 |
-
</div>
|
36 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
themes/default/SQ_BlockSettings.php
ADDED
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="sq_settings">
|
2 |
+
<?php SQ_ObjController::getBlock('SQ_BlockSupport')->init(); ?>
|
3 |
+
<div>
|
4 |
+
<span class="sq_icon"></span>
|
5 |
+
<div id="sq_settings_title" ><?php _e('Settings', _SQ_PLUGIN_NAME_); ?> </div>
|
6 |
+
<div id="sq_settings_title" >
|
7 |
+
<input type="submit" name="sq_update" value="<?php _e('Save settings', _SQ_PLUGIN_NAME_) ?> »" />
|
8 |
+
</div>
|
9 |
+
</div>
|
10 |
+
<div id="sq_helpsettingscontent" class="sq_helpcontent"></div>
|
11 |
+
<div id="sq_helpsettingsside" class="sq_helpside"></div>
|
12 |
+
<div id="sq_left">
|
13 |
+
<form id="sq_settings_form" name="settings" action="" method="post" enctype="multipart/form-data">
|
14 |
+
<div id="sq_settings_body">
|
15 |
+
<fieldset>
|
16 |
+
<legend class="sq_legend_medium">
|
17 |
+
<span class="sq_legend_title"><?php _e('Post/Page Edit', _SQ_PLUGIN_NAME_); ?></span>
|
18 |
+
<span><?php echo sprintf(__('%sThe right method in working with Squirrly, SEO plugin%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/the-right-premises-in-working-with-squirrly-wordpress-seo-plugin" target="_blank">', '</a>'); ?></span>
|
19 |
+
<span><?php echo sprintf(__('%sGetting inspired with Squirrly WordPress SEO plugin%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/getting-inspired-with-squirrly-wordpress-seo-plugin" target="_blank">', '</a>'); ?></span>
|
20 |
+
|
21 |
+
<span><?php echo sprintf(__('%sThere is a New SEO Live Assistant from Squirrly%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/there-is-a-new-seo-live-assistant-from-squirrly" target="_blank">', '</a>'); ?></span>
|
22 |
+
<span><?php echo sprintf(__('%sHow to create Human friendly content with the WordPress SEO plugin?%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/how-to-create-human-friendly-content-with-the-a-wordpress-seo-plugin" target="_blank">', '</a>'); ?></span>
|
23 |
+
|
24 |
+
</legend>
|
25 |
+
|
26 |
+
<div>
|
27 |
+
<div id="sq_post_type_option" class="withborder">
|
28 |
+
<p style="font-weight: bold;"><?php _e('Load Squirrly Live Assistant for', _SQ_PLUGIN_NAME_); ?>:</p>
|
29 |
+
<ul id="sq_post_types">
|
30 |
+
<li class="sq_selectall"><input type="checkbox" id="sq_selectall"/>Select All</li>
|
31 |
+
<li><input type="checkbox" class="sq_post_types" name="sq_post_types[]" value="post" <?php echo (in_array('post', SQ_Tools::$options['sq_post_types']) ? 'checked="checked"' : ''); ?>><?php _e('Posts', _SQ_PLUGIN_NAME_); ?></li>
|
32 |
+
<li><input type="checkbox" class="sq_post_types" name="sq_post_types[]" value="page" <?php echo (in_array('page', SQ_Tools::$options['sq_post_types']) ? 'checked="checked"' : ''); ?>><?php _e('Pages', _SQ_PLUGIN_NAME_); ?></li>
|
33 |
+
<?php if (in_array('product', get_post_types())) { //check for ecommerce product ?>
|
34 |
+
<li><input type="checkbox" class="sq_post_types" name="sq_post_types[]" value="product" <?php echo (in_array('product', SQ_Tools::$options['sq_post_types']) ? 'checked="checked"' : ''); ?>><?php _e('Products', _SQ_PLUGIN_NAME_); ?></li>
|
35 |
+
<?php } ?>
|
36 |
+
<?php
|
37 |
+
$types = get_post_types();
|
38 |
+
foreach (array('post', 'page', 'revision', 'nav_menu_item', 'product', 'shop_order', 'shop_coupon') as $exclude) {
|
39 |
+
if (in_array($exclude, $types)) {
|
40 |
+
unset($types[$exclude]);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
foreach ($types as $type) {
|
44 |
+
$type_data = get_post_type_object($type);
|
45 |
+
if (!isset($type_data->show_ui) || $type_data->show_ui != 1) {
|
46 |
+
unset($types[$type]);
|
47 |
+
} else {
|
48 |
+
//echo '<pre>' . print_r($type_data, true) . '</pre>';
|
49 |
+
?>
|
50 |
+
<li><input type="checkbox" class="sq_post_types" name="sq_post_types[]" value="<?php echo $type ?>" <?php echo (in_array($type, SQ_Tools::$options['sq_post_types']) ? 'checked="checked"' : ''); ?>><?php echo $type_data->labels->name; ?></li>
|
51 |
+
<?php
|
52 |
+
}
|
53 |
+
}
|
54 |
+
?>
|
55 |
+
</ul>
|
56 |
+
</div>
|
57 |
+
<br />
|