SEO SQUIRRLY™ - Version 6.3.1

Version Description

  • Inform users with multiple active subscriptions
  • Updated terms and contitions
  • Added more links for support in the Feedback and Support sections
  • Fixed Facebook Admin ID for Profile and Pages
  • Changed the Theme for Squirrly SEO Settings and Advanced sections
  • Fixed Typos and Broken Links
  • Updated the Keyword Research for Long Tail Keyword

  • Optimized the loading speed in case of poor connection with the API

  • Pass the SSL issue for API calls

  • Fixed the Squirrly SEO Weekly audit for free users

  • Fixed Pay With a Tweet button

  • Added google.us in Ranking Option

Download this release

Release Info

Developer cifi
Plugin Icon 128x128 SEO SQUIRRLY™
Version 6.3.1
Comparing to
See all releases

Code changes from version 6.2.6 to 6.3.1

Files changed (42) hide show
  1. classes/SQ_Action.php +53 -47
  2. classes/SQ_Ranking.php +10 -3
  3. classes/SQ_Tools.php +7 -9
  4. config/paths.php +7 -5
  5. controllers/SQ_Frontend.php +4 -1
  6. controllers/SQ_Menu.php +8 -8
  7. controllers/SQ_Post.php +12 -22
  8. controllers/SQ_PostsList.php +2 -3
  9. controllers/SQ_Sitemaps.php +1 -3
  10. core/SQ_BlockPostsAnalytics/SQ_BlockPostsAnalytics.php +2 -0
  11. core/SQ_BlockSettings/SQ_BlockSettings.php +4 -0
  12. core/SQ_BlockSettingsSeo/SQ_BlockSettingsSeo.php +0 -1
  13. core/SQ_Blockseo/SQ_Blockseo.php +1 -1
  14. models/SQ_BlockPostsAnalytics.php +16 -4
  15. models/SQ_BlockSettingsSeo.php +35 -56
  16. models/SQ_Frontend.php +245 -88
  17. models/SQ_Post.php +0 -1
  18. readme.txt +29 -3
  19. squirrly.php +2 -2
  20. themes/default/SQ_BlockAccount.php +1 -1
  21. themes/default/SQ_BlockAffiliate.php +1 -1
  22. themes/default/SQ_BlockAnalytics.php +1 -1
  23. themes/default/SQ_BlockDashboard.php +3 -3
  24. themes/default/SQ_BlockPostsAnalytics.php +35 -16
  25. themes/default/SQ_BlockSettings.php +28 -9
  26. themes/default/SQ_BlockSettingsSeo.php +111 -102
  27. themes/default/SQ_BlockSupport.php +12 -7
  28. themes/default/SQ_Blocklogin.php +6 -3
  29. themes/default/css/sq_blockdashboard.css +4 -2
  30. themes/default/css/sq_global.css +2 -3
  31. themes/default/css/sq_menu.css +31 -6
  32. themes/default/css/sq_post.css +14 -5
  33. themes/default/css/sq_sitemap.xsl +1 -1
  34. themes/default/css/sq_sitemapindex.xsl +1 -1
  35. themes/default/img/settings/bgimage.jpg +0 -0
  36. themes/default/img/sprite.png +0 -0
  37. themes/default/js/sq_blockdashboard.js +2 -2
  38. themes/default/js/sq_blocklogin.js +19 -6
  39. themes/default/js/sq_blocksettings.js +22 -18
  40. themes/default/js/sq_blocksettingsseo.js +77 -42
  41. themes/default/js/sq_blocksupport.js +13 -13
  42. themes/default/js/sq_menu.js +8 -39
classes/SQ_Action.php CHANGED
@@ -5,12 +5,22 @@
5
  */
6
  class SQ_Action extends SQ_FrontController {
7
 
8
- /** @var array with all form and ajax actions */
9
  var $actions = array();
10
 
11
  /** @var array from core config */
12
  private static $config;
13
 
 
 
 
 
 
 
 
 
 
 
14
  /**
15
  * The hookAjax is loaded as custom hook in hookController class
16
  *
@@ -19,7 +29,7 @@ class SQ_Action extends SQ_FrontController {
19
  public function hookInit() {
20
 
21
  /* Only if ajax */
22
- if (isset($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], '/admin-ajax.php') !== false) {
23
  $this->actions = array();
24
  $this->getActions(((isset($_GET['action']) ? $_GET['action'] : (isset($_POST['action']) ? $_POST['action'] : ''))));
25
  }
@@ -32,11 +42,10 @@ class SQ_Action extends SQ_FrontController {
32
  */
33
  public function hookMenu() {
34
  /* Only if post */
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
  }
41
 
42
  /**
@@ -55,9 +64,6 @@ class SQ_Action extends SQ_FrontController {
55
  "adminlisturl": "' . admin_url('edit.php') . '",
56
  "nonce": "' . wp_create_nonce(_SQ_NONCE_ID_) . '"
57
  }
58
-
59
- if(parseInt(jQuery.fn.jquery.replace(/\./g,"")) < 162)
60
- google.load("jquery", "1.6.2");
61
  </script>';
62
  }
63
 
@@ -67,51 +73,51 @@ class SQ_Action extends SQ_FrontController {
67
  * @return void
68
  */
69
  public function getActions($cur_action) {
 
 
 
 
 
 
 
 
70
 
71
- /* if config allready in cache */
72
- if (!isset(self::$config)) {
73
- $config_file = _SQ_CORE_DIR_ . 'config.xml';
74
- if (!file_exists($config_file)) {
75
- return;
76
  }
77
 
78
- /* load configuration blocks data from core config files */
79
- $data = file_get_contents($config_file);
80
- self::$config = json_decode(json_encode((array) simplexml_load_string($data)), 1);
81
- }
82
-
83
- if (is_array(self::$config)) {
84
- foreach (self::$config['block'] as $block) {
85
- if ($block['active'] == 1) {
86
- /* if there is a single action */
87
- if (isset($block['actions']['action']))
88
-
89
- /* if there are more actions for the current block */ {
90
- if (!is_array($block['actions']['action'])) {
91
- /* add the action in the actions array */
92
- if ($block['actions']['action'] == $cur_action) {
93
- $this->actions[] = array('class' => $block['name'], 'path' => $block['path']);
94
- }
95
- } else {
96
- /* if there are more actions for the current block */
97
- foreach ($block['actions']['action'] as $action) {
98
- /* add the actions in the actions array */
99
- if ($action == $cur_action) {
100
  $this->actions[] = array('class' => $block['name'], 'path' => $block['path']);
101
  }
 
 
 
 
 
 
 
 
102
  }
103
  }
104
  }
105
  }
106
  }
107
- }
108
 
109
- /* add the actions in WP */
110
- foreach ($this->actions as $actions) {
111
- if ($actions['path'] == 'core') {
112
- SQ_ObjController::getBlock($actions['class'])->action();
113
- } elseif ($actions['path'] == 'controllers') {
114
- SQ_ObjController::getController($actions['class'])->action();
 
115
  }
116
  }
117
  }
@@ -122,8 +128,9 @@ class SQ_Action extends SQ_FrontController {
122
  * @param array $args
123
  * @return json | string
124
  */
125
- public static function apiCall($module, $args = array(), $timeout = 90) {
126
  $parameters = "";
 
127
 
128
  if (SQ_Tools::$options['sq_api'] == '' && $module <> 'sq/login' && $module <> 'sq/register') {
129
  return false;
@@ -137,7 +144,6 @@ class SQ_Action extends SQ_FrontController {
137
  'token' => SQ_Tools::$options['sq_api']);
138
 
139
 
140
-
141
  if (is_array($args)) {
142
  $args = array_merge($args, $extra);
143
  } else {
@@ -160,8 +166,8 @@ class SQ_Action extends SQ_FrontController {
160
  if ($module <> "") {
161
  $module .= "/";
162
  }
163
-
164
- $url = self::cleanUrl(_SQ_API_URL_ . $module . "?" . $parameters);
165
  return SQ_Tools::sq_remote_get($url, array(), array('timeout' => $timeout));
166
  }
167
 
5
  */
6
  class SQ_Action extends SQ_FrontController {
7
 
8
+ /** @var array with all form and ajax actions */
9
  var $actions = array();
10
 
11
  /** @var array from core config */
12
  private static $config;
13
 
14
+
15
+ private function _isAjax() {
16
+ $url = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false);
17
+ if ($url && (strpos($url, admin_url('admin-ajax.php', 'relative')) !== false || strpos(admin_url('admin-ajax.php', 'relative'), $url) !== false)) {
18
+ return true;
19
+ }
20
+
21
+ return false;
22
+ }
23
+
24
  /**
25
  * The hookAjax is loaded as custom hook in hookController class
26
  *
29
  public function hookInit() {
30
 
31
  /* Only if ajax */
32
+ if ($this->_isAjax()) {
33
  $this->actions = array();
34
  $this->getActions(((isset($_GET['action']) ? $_GET['action'] : (isset($_POST['action']) ? $_POST['action'] : ''))));
35
  }
42
  */
43
  public function hookMenu() {
44
  /* Only if post */
45
+ if (!$this->_isAjax()) {
46
+ $this->actions = array();
47
+ $this->getActions(((isset($_GET['action']) ? $_GET['action'] : (isset($_POST['action']) ? $_POST['action'] : ''))));
48
  }
 
 
49
  }
50
 
51
  /**
64
  "adminlisturl": "' . admin_url('edit.php') . '",
65
  "nonce": "' . wp_create_nonce(_SQ_NONCE_ID_) . '"
66
  }
 
 
 
67
  </script>';
68
  }
69
 
73
  * @return void
74
  */
75
  public function getActions($cur_action) {
76
+ //Let only the logged users to access the actions
77
+ if (is_admin() || is_network_admin()) {
78
+ /* if config allready in cache */
79
+ if (!isset(self::$config)) {
80
+ $config_file = _SQ_CORE_DIR_ . 'config.xml';
81
+ if (!file_exists($config_file)) {
82
+ return;
83
+ }
84
 
85
+ /* load configuration blocks data from core config files */
86
+ $data = file_get_contents($config_file);
87
+ self::$config = json_decode(json_encode((array)simplexml_load_string($data)), 1);
 
 
88
  }
89
 
90
+ if (is_array(self::$config)) {
91
+ foreach (self::$config['block'] as $block) {
92
+ if ($block['active'] == 1) {
93
+ /* if there is a single action */
94
+ if (isset($block['actions']['action'])) /* if there are more actions for the current block */ {
95
+ if (!is_array($block['actions']['action'])) {
96
+ /* add the action in the actions array */
97
+ if ($block['actions']['action'] == $cur_action) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  $this->actions[] = array('class' => $block['name'], 'path' => $block['path']);
99
  }
100
+ } else {
101
+ /* if there are more actions for the current block */
102
+ foreach ($block['actions']['action'] as $action) {
103
+ /* add the actions in the actions array */
104
+ if ($action == $cur_action) {
105
+ $this->actions[] = array('class' => $block['name'], 'path' => $block['path']);
106
+ }
107
+ }
108
  }
109
  }
110
  }
111
  }
112
  }
 
113
 
114
+ /* add the actions in WP */
115
+ foreach ($this->actions as $actions) {
116
+ if ($actions['path'] == 'core') {
117
+ SQ_ObjController::getBlock($actions['class'])->action();
118
+ } elseif ($actions['path'] == 'controllers') {
119
+ SQ_ObjController::getController($actions['class'])->action();
120
+ }
121
  }
122
  }
123
  }
128
  * @param array $args
129
  * @return json | string
130
  */
131
+ public static function apiCall($module, $args = array(), $timeout = 10) {
132
  $parameters = "";
133
+ $scheme = "http:";
134
 
135
  if (SQ_Tools::$options['sq_api'] == '' && $module <> 'sq/login' && $module <> 'sq/register') {
136
  return false;
144
  'token' => SQ_Tools::$options['sq_api']);
145
 
146
 
 
147
  if (is_array($args)) {
148
  $args = array_merge($args, $extra);
149
  } else {
166
  if ($module <> "") {
167
  $module .= "/";
168
  }
169
+ //call it with http to prevent curl issues with ssls
170
+ $url = self::cleanUrl($scheme . _SQ_API_URL_ . $module . "?" . $parameters);
171
  return SQ_Tools::sq_remote_get($url, array(), array('timeout' => $timeout));
172
  }
173
 
classes/SQ_Ranking.php CHANGED
@@ -85,7 +85,8 @@ class SQ_Ranking extends SQ_FrontController
85
  */
86
  public function getGoogleRank()
87
  {
88
- global $wpdb;
 
89
  $this->error = '';
90
 
91
  if (trim($this->keyword) == '') {
@@ -229,7 +230,6 @@ class SQ_Ranking extends SQ_FrontController
229
 
230
  preg_match_all('/<h3.*?><a href="(.*?)".*?<\/h3>/is', $response, $matches);
231
 
232
- SQ_Tools::dump($matches[1]);
233
  if (!empty($matches[1])) {
234
  $pos = -1;
235
  foreach ($matches[1] as $index => $url) {
@@ -251,9 +251,16 @@ class SQ_Ranking extends SQ_FrontController
251
  public function processCron()
252
  {
253
  global $wpdb;
254
- if (get_transient('google_blocked') !== false) {
 
255
  return;
256
  }
 
 
 
 
 
 
257
  set_time_limit(3000);
258
  /* Load the Submit Actions Handler */
259
  SQ_ObjController::getController('SQ_Tools', false);
85
  */
86
  public function getGoogleRank()
87
  {
88
+
89
+ @ini_set('open_basedir', null);
90
  $this->error = '';
91
 
92
  if (trim($this->keyword) == '') {
230
 
231
  preg_match_all('/<h3.*?><a href="(.*?)".*?<\/h3>/is', $response, $matches);
232
 
 
233
  if (!empty($matches[1])) {
234
  $pos = -1;
235
  foreach ($matches[1] as $index => $url) {
251
  public function processCron()
252
  {
253
  global $wpdb;
254
+
255
+ if (get_transient('google_blocked') !== false || SQ_Tools::$options['sq_google_ranksperhour'] == 0) {
256
  return;
257
  }
258
+
259
+ if (isset($_SERVER['SERVER_ADDR'])){
260
+ if (strpos($_SERVER['SERVER_ADDR'], '192.') === 0){
261
+ return;
262
+ }
263
+ }
264
  set_time_limit(3000);
265
  /* Load the Submit Actions Handler */
266
  SQ_ObjController::getController('SQ_Tools', false);
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(); //dev mode
26
  }
27
 
28
  public static function getUserID() {
@@ -64,7 +64,7 @@ class SQ_Tools extends SQ_FrontController {
64
  /**
65
  * Load the Options from user option table in DB
66
  *
67
- * @return void
68
  */
69
  public static function getOptions() {
70
  $default = array(
@@ -72,7 +72,7 @@ class SQ_Tools extends SQ_FrontController {
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
  ),
@@ -187,6 +187,10 @@ class SQ_Tools extends SQ_FrontController {
187
  return $default;
188
  }
189
 
 
 
 
 
190
  public static function getBriefOptions() {
191
  if ($pageId = get_option('page_on_front')) {
192
  $title = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'title');
@@ -894,15 +898,11 @@ class SQ_Tools extends SQ_FrontController {
894
  }
895
 
896
  if ($postid > 0) {
897
- self::dump("it's a post", $url, $postid);
898
  $frontend->setPost(get_post($postid));
899
  $snippet['title'] = $frontend->getTitle();
900
  $snippet['description'] = $frontend->getDescription();
901
  $snippet['url'] = $url;
902
- self::dump($snippet);
903
  } elseif ($url == get_bloginfo('url')) {
904
- self::dump("it's main page", $url, get_bloginfo('url'));
905
-
906
  if (self::$options ['sq_auto_title'] == 1) {
907
  $snippet['title'] = self::$options['sq_fp_title'];
908
  }
@@ -911,7 +911,6 @@ class SQ_Tools extends SQ_FrontController {
911
  }
912
 
913
  $snippet['url'] = $url;
914
- self::dump($snippet);
915
  } else {
916
  $length = array('title' => 66,
917
  'description' => 240,
@@ -1027,7 +1026,6 @@ class SQ_Tools extends SQ_FrontController {
1027
 
1028
  echo PHP_EOL . " Load: {$memory_avail} (avail) / {$memory_used}M (used) / {$memory_peak}M (peak)";
1029
  echo " | Time: {$run_time}s | {$pps} req/sec";
1030
- echo "<pre>" . print_r($wp_query, true) . "</pre>";
1031
  }
1032
 
1033
  public function sq_activate() {
22
 
23
  self::$options = $this->getOptions();
24
 
25
+ //$this->checkDebug(); //dev mode
26
  }
27
 
28
  public static function getUserID() {
64
  /**
65
  * Load the Options from user option table in DB
66
  *
67
+ * @return array
68
  */
69
  public static function getOptions() {
70
  $default = array(
72
  'sq_api' => '',
73
  'sq_checkedissues' => 0,
74
  'sq_areissues' => 0,
75
+ 'sq_use' => 1,
76
  'sq_post_types' => array(
77
  'post', 'page', 'product', 'shopp_page_shopp-products'
78
  ),
187
  return $default;
188
  }
189
 
190
+ /**
191
+ * Send completed tasks from tutorial
192
+ * @return array
193
+ */
194
  public static function getBriefOptions() {
195
  if ($pageId = get_option('page_on_front')) {
196
  $title = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'title');
898
  }
899
 
900
  if ($postid > 0) {
 
901
  $frontend->setPost(get_post($postid));
902
  $snippet['title'] = $frontend->getTitle();
903
  $snippet['description'] = $frontend->getDescription();
904
  $snippet['url'] = $url;
 
905
  } elseif ($url == get_bloginfo('url')) {
 
 
906
  if (self::$options ['sq_auto_title'] == 1) {
907
  $snippet['title'] = self::$options['sq_fp_title'];
908
  }
911
  }
912
 
913
  $snippet['url'] = $url;
 
914
  } else {
915
  $length = array('title' => 66,
916
  'description' => 240,
1026
 
1027
  echo PHP_EOL . " Load: {$memory_avail} (avail) / {$memory_used}M (used) / {$memory_peak}M (peak)";
1028
  echo " | Time: {$run_time}s | {$pps} req/sec";
 
1029
  }
1030
 
1031
  public function sq_activate() {
config/paths.php CHANGED
@@ -6,14 +6,16 @@ define('_SQ_NAME_', 'squirrly');
6
  define('_SQ_PLUGIN_NAME_', 'squirrly-seo'); //THIS LINE WILL BE CHANGED WITH THE USER SETTINGS
7
  define('_THEME_NAME_', 'default'); //THIS LINE WILL BE CHANGED WITH THE USER SETTINGS
8
 
9
- defined('_SQ_DASH_URL_') || define('_SQ_DASH_URL_', 'https://my.squirrly.co/');
10
  $scheme = (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") || (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN)) ? 'https:' : 'http:'); //CHECK IF SCURE
11
-
12
  defined('SQ_URI') || define('SQ_URI', (WP_VERSION_ID >= 3000) ? 'wp350' : 'wp2');
13
- defined('_SQ_API_URL_') || define('_SQ_API_URL_', $scheme . '//api.squirrly.co/');
14
 
15
- defined('_SQ_STATIC_API_URL_') || define('_SQ_STATIC_API_URL_', $scheme . '//storage.googleapis.com/squirrly/');
16
- defined('_SQ_SUPPORT_URL_') || define('_SQ_SUPPORT_URL_', 'https://plus.google.com/u/0/communities/104196720668136264985');
 
 
 
17
 
18
  /* Directories */
19
  define('_SQ_ROOT_DIR_', realpath(dirname($currentDir)));
6
  define('_SQ_PLUGIN_NAME_', 'squirrly-seo'); //THIS LINE WILL BE CHANGED WITH THE USER SETTINGS
7
  define('_THEME_NAME_', 'default'); //THIS LINE WILL BE CHANGED WITH THE USER SETTINGS
8
 
 
9
  $scheme = (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") || (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN)) ? 'https:' : 'http:'); //CHECK IF SCURE
10
+ defined('_SQ_DASH_URL_') || define('_SQ_DASH_URL_', 'https://my.squirrly.co/');
11
  defined('SQ_URI') || define('SQ_URI', (WP_VERSION_ID >= 3000) ? 'wp350' : 'wp2');
12
+ defined('_SQ_API_URL_') || define('_SQ_API_URL_', '//api.squirrly.co/');
13
 
14
+ defined('_SQ_STATIC_API_URL_') || define('_SQ_STATIC_API_URL_', '//storage.googleapis.com/squirrly/');
15
+ defined('_SQ_SUPPORT_EMAIL_URL_') || define('_SQ_SUPPORT_EMAIL_URL_', 'http://plugin.squirrly.co/contact/');
16
+ defined('_SQ_SUPPORT_GOOGLE_URL_') || define('_SQ_SUPPORT_GOOGLE_URL_', 'https://plus.google.com/u/0/communities/104196720668136264985');
17
+ defined('_SQ_SUPPORT_FACEBOOK_URL_') || define('_SQ_SUPPORT_FACEBOOK_URL_', 'https://www.facebook.com/Squirrly.co');
18
+ defined('_SQ_SUPPORT_URL_') || define('_SQ_SUPPORT_URL_', _SQ_SUPPORT_FACEBOOK_URL_);
19
 
20
  /* Directories */
21
  define('_SQ_ROOT_DIR_', realpath(dirname($currentDir)));
controllers/SQ_Frontend.php CHANGED
@@ -33,6 +33,7 @@ class SQ_Frontend extends SQ_FrontController {
33
  add_filter('sq_description', array($this->model, 'clearDescription'));
34
 
35
  add_action('plugins_loaded', array($this->model, 'startBuffer'));
 
36
  //flush the header with the title and removing duplicates
37
  add_action('wp_head', array($this->model, 'flushHeader'),99);
38
  add_action('shutdown', array($this->model, 'flushHeader'));
@@ -55,8 +56,10 @@ class SQ_Frontend extends SQ_FrontController {
55
  }
56
 
57
  private function _isAjax() {
58
- if (isset($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], '/admin-ajax.php') !== false)
 
59
  return true;
 
60
 
61
  return false;
62
  }
33
  add_filter('sq_description', array($this->model, 'clearDescription'));
34
 
35
  add_action('plugins_loaded', array($this->model, 'startBuffer'));
36
+ add_action('template_redirect', array($this->model, 'checkHandles'));
37
  //flush the header with the title and removing duplicates
38
  add_action('wp_head', array($this->model, 'flushHeader'),99);
39
  add_action('shutdown', array($this->model, 'flushHeader'));
56
  }
57
 
58
  private function _isAjax() {
59
+ $url = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false);
60
+ if ($url && (strpos($url, admin_url('admin-ajax.php', 'relative')) !== false || strpos(admin_url('admin-ajax.php', 'relative'), $url) !== false)) {
61
  return true;
62
+ }
63
 
64
  return false;
65
  }
controllers/SQ_Menu.php CHANGED
@@ -104,7 +104,7 @@ class SQ_Menu extends SQ_FrontController {
104
  ));
105
 
106
  $this->model->addSubmenu(array('sq_dashboard',
107
- ucfirst(_SQ_NAME_) . __(' dashboard', _SQ_PLUGIN_NAME_),
108
  ( (SQ_Tools::$options['sq_api'] == '') ? __('First Step', _SQ_PLUGIN_NAME_) : __('Dashboard', _SQ_PLUGIN_NAME_)) . SQ_Tools::showNotices($dashboard_alert, 'errors_count'),
109
  'edit_posts',
110
  'sq_dashboard',
@@ -115,7 +115,7 @@ class SQ_Menu extends SQ_FrontController {
115
  //IF SERP PLUGIN IS NOT INSTALLED
116
  if (!class_exists('SRC_Classes_ObjController')){
117
  $this->model->addSubmenu(array('sq_dashboard',
118
- ucfirst(_SQ_NAME_) . __(' post list', _SQ_PLUGIN_NAME_),
119
  __('Performance <br />Analytics', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices($analytics_alert, 'errors_count'),
120
  'edit_posts',
121
  'sq_posts',
@@ -126,23 +126,23 @@ class SQ_Menu extends SQ_FrontController {
126
 
127
 
128
  $this->model->addSubmenu(array('sq_dashboard',
129
- ucfirst(_SQ_NAME_) . __(' settings', _SQ_PLUGIN_NAME_),
130
- __('SEO', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices(SQ_Tools::$errors_count, 'errors_count'),
131
  'manage_options',
132
  'sq_seo',
133
  array(SQ_ObjController::getBlock('SQ_BlockSettingsSeo'), 'init')
134
  ));
135
 
136
  $this->model->addSubmenu(array('sq_dashboard',
137
- ucfirst(_SQ_NAME_) . __(' Settings', _SQ_PLUGIN_NAME_),
138
- __('Settings', _SQ_PLUGIN_NAME_),
139
  'manage_options',
140
  'sq_settings',
141
  array(SQ_ObjController::getBlock('SQ_BlockSettings'), 'init')
142
  ));
143
 
144
  $this->model->addSubmenu(array('sq_dashboard',
145
- ucfirst(_SQ_NAME_) . __(' account info', _SQ_PLUGIN_NAME_),
146
  __('Account Info', _SQ_PLUGIN_NAME_),
147
  'manage_options',
148
  'sq_account',
@@ -152,7 +152,7 @@ class SQ_Menu extends SQ_FrontController {
152
 
153
  $this->model->addSubmenu(array('sq_dashboard',
154
  __('Become an Affiliate with ', _SQ_PLUGIN_NAME_) . ucfirst(_SQ_NAME_),
155
- __('Affiliate plan', _SQ_PLUGIN_NAME_),
156
  'manage_options',
157
  'sq_affiliate',
158
  array(SQ_ObjController::getBlock('SQ_BlockAffiliate'), 'init')
104
  ));
105
 
106
  $this->model->addSubmenu(array('sq_dashboard',
107
+ ucfirst(_SQ_NAME_) . __(' Dashboard', _SQ_PLUGIN_NAME_),
108
  ( (SQ_Tools::$options['sq_api'] == '') ? __('First Step', _SQ_PLUGIN_NAME_) : __('Dashboard', _SQ_PLUGIN_NAME_)) . SQ_Tools::showNotices($dashboard_alert, 'errors_count'),
109
  'edit_posts',
110
  'sq_dashboard',
115
  //IF SERP PLUGIN IS NOT INSTALLED
116
  if (!class_exists('SRC_Classes_ObjController')){
117
  $this->model->addSubmenu(array('sq_dashboard',
118
+ ucfirst(_SQ_NAME_) . __(' Performance Analytics', _SQ_PLUGIN_NAME_),
119
  __('Performance <br />Analytics', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices($analytics_alert, 'errors_count'),
120
  'edit_posts',
121
  'sq_posts',
126
 
127
 
128
  $this->model->addSubmenu(array('sq_dashboard',
129
+ ucfirst(_SQ_NAME_) . __(' SEO Settings', _SQ_PLUGIN_NAME_),
130
+ __('SEO Settings', _SQ_PLUGIN_NAME_) . SQ_Tools::showNotices(SQ_Tools::$errors_count, 'errors_count'),
131
  'manage_options',
132
  'sq_seo',
133
  array(SQ_ObjController::getBlock('SQ_BlockSettingsSeo'), 'init')
134
  ));
135
 
136
  $this->model->addSubmenu(array('sq_dashboard',
137
+ ucfirst(_SQ_NAME_) . __(' Advanced Settings', _SQ_PLUGIN_NAME_),
138
+ __('Advanced', _SQ_PLUGIN_NAME_),
139
  'manage_options',
140
  'sq_settings',
141
  array(SQ_ObjController::getBlock('SQ_BlockSettings'), 'init')
142
  ));
143
 
144
  $this->model->addSubmenu(array('sq_dashboard',
145
+ ucfirst(_SQ_NAME_) . __(' Account Info', _SQ_PLUGIN_NAME_),
146
  __('Account Info', _SQ_PLUGIN_NAME_),
147
  'manage_options',
148
  'sq_account',
152
 
153
  $this->model->addSubmenu(array('sq_dashboard',
154
  __('Become an Affiliate with ', _SQ_PLUGIN_NAME_) . ucfirst(_SQ_NAME_),
155
+ __('Affiliate', _SQ_PLUGIN_NAME_),
156
  'manage_options',
157
  'sq_affiliate',
158
  array(SQ_ObjController::getBlock('SQ_BlockAffiliate'), 'init')
controllers/SQ_Post.php CHANGED
@@ -209,26 +209,15 @@ class SQ_Post extends SQ_FrontController {
209
  SQ_Action::apiCall('sq/seo/post', $args, 10);
210
  } else {
211
  $process = array();
212
- if (get_transient('sq_seopost') !== false) {
213
- $process = json_decode(get_transient('sq_seopost'), true);
214
  }
215
- //Add args at the beginning of the process
216
- array_unshift($process, $args);
217
 
218
- //save for later send to api
219
- set_transient('sq_seopost', json_encode($process));
220
-
221
- //prevent lost posts if there are not processed
222
- if (count($process) > 5){
223
- SQ_Tools::saveOptions('sq_force_savepost', 1);
224
- SQ_Action::apiCall('sq/seo/post', $args, 10);
225
- }
226
 
227
- if (get_transient('sq_seopost') !== false) {
228
- wp_schedule_single_event(time(), 'sq_processApi');
229
- } else {
230
- SQ_Action::apiCall('sq/seo/post', $args, 1);
231
- }
232
  }
233
 
234
  //Save the keyword for this post
@@ -331,7 +320,6 @@ class SQ_Post extends SQ_FrontController {
331
  $meta[] = array('key' => '_sq_canonical',
332
  'value' => SQ_Tools::getValue('sq_canonical'));
333
 
334
- SQ_Tools::dump($meta);
335
  $this->model->saveAdvMeta($post_id, $meta);
336
 
337
  return $meta;
@@ -352,17 +340,19 @@ class SQ_Post extends SQ_FrontController {
352
  SQ_ObjController::getController('SQ_Tools', false);
353
  SQ_ObjController::getController('SQ_Action', false);
354
 
355
- if (get_transient('sq_seopost') !== false) {
356
- $process = json_decode(get_transient('sq_seopost'), true);
357
  foreach ($process as $key => $call) {
358
 
359
- $response = json_decode(SQ_Action::apiCall('sq/seo/post', $call, 60));
 
 
360
 
361
  if (isset($response->saved) && $response->saved == true) {
362
  unset($process[$key]);
363
  }
364
  }
365
- set_transient('sq_seopost', json_encode($process));
366
  }
367
  }
368
 
209
  SQ_Action::apiCall('sq/seo/post', $args, 10);
210
  } else {
211
  $process = array();
212
+ if (get_option('sq_seopost') !== false) {
213
+ $process = json_decode(get_option('sq_seopost'), true);
214
  }
 
 
215
 
216
+ $process[] = $args;
 
 
 
 
 
 
 
217
 
218
+ //save for later send to api
219
+ update_option('sq_seopost', json_encode($process));
220
+ wp_schedule_single_event(time(), 'sq_processApi');
 
 
221
  }
222
 
223
  //Save the keyword for this post
320
  $meta[] = array('key' => '_sq_canonical',
321
  'value' => SQ_Tools::getValue('sq_canonical'));
322
 
 
323
  $this->model->saveAdvMeta($post_id, $meta);
324
 
325
  return $meta;
340
  SQ_ObjController::getController('SQ_Tools', false);
341
  SQ_ObjController::getController('SQ_Action', false);
342
 
343
+ if (get_option('sq_seopost') !== false) {
344
+ $process = json_decode(get_option('sq_seopost'), true);
345
  foreach ($process as $key => $call) {
346
 
347
+ if(!$response = json_decode(SQ_Action::apiCall('sq/seo/post', $call, 10))){
348
+ break;
349
+ }
350
 
351
  if (isset($response->saved) && $response->saved == true) {
352
  unset($process[$key]);
353
  }
354
  }
355
+ update_option('sq_seopost', json_encode($process));
356
  }
357
  }
358
 
controllers/SQ_PostsList.php CHANGED
@@ -267,7 +267,7 @@ class SQ_PostsList extends SQ_FrontController
267
  $posts = SQ_Tools::getValue('posts');
268
  $args['posts'] = join(',', $posts);
269
 
270
- $response = json_decode(SQ_Action::apiCall('sq/user-analytics/total', $args, 30));
271
  }
272
  if (isset($response) && is_object($response)) {
273
  $response = $this->model->getTotal($response);
@@ -297,7 +297,7 @@ class SQ_PostsList extends SQ_FrontController
297
  }
298
  }
299
 
300
- $response = json_decode(SQ_Action::apiCall('sq/user-analytics/detail', $args, 30));
301
 
302
  if (!is_object($response)) {
303
  exit(json_encode(array('error' => $response)));
@@ -309,7 +309,6 @@ class SQ_PostsList extends SQ_FrontController
309
  $analytics->audit = $this->model->getAnalytics($response, $this->model->post_id);
310
 
311
  $response = $analytics->init();
312
- SQ_Tools::dump($response);
313
  if (SQ_Tools::getValue('sq_debug') === 'on') {
314
  exit();
315
  }
267
  $posts = SQ_Tools::getValue('posts');
268
  $args['posts'] = join(',', $posts);
269
 
270
+ $response = json_decode(SQ_Action::apiCall('sq/user-analytics/total', $args, 20));
271
  }
272
  if (isset($response) && is_object($response)) {
273
  $response = $this->model->getTotal($response);
297
  }
298
  }
299
 
300
+ $response = json_decode(SQ_Action::apiCall('sq/user-analytics/detail', $args, 20));
301
 
302
  if (!is_object($response)) {
303
  exit(json_encode(array('error' => $response)));
309
  $analytics->audit = $this->model->getAnalytics($response, $this->model->post_id);
310
 
311
  $response = $analytics->init();
 
312
  if (SQ_Tools::getValue('sq_debug') === 'on') {
313
  exit();
314
  }
controllers/SQ_Sitemaps.php CHANGED
@@ -107,16 +107,14 @@ class SQ_Sitemaps extends SQ_FrontController {
107
 
108
  /**
109
  * Show the Sitemap Header
110
- * @global integer $blog_id Used for charset
111
  * @param array $include Include schema
112
  */
113
  public function showSitemapHeader($include = array()) {
114
  @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
115
- global $blog_id;
116
 
117
  header('Status: 200 OK', true, 200);
118
  header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
119
- //Generate header
120
  echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>' . "\n";
121
  echo '<?xml-stylesheet type="text/xsl" href="' . wp_make_link_relative(_SQ_THEME_URL_) . 'css/sq_sitemap' . ($this->model->type == 'sitemap' ? 'index' : '') . '.xsl"?>' . "\n";
122
  echo '<!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->' . "\n";
107
 
108
  /**
109
  * Show the Sitemap Header
 
110
  * @param array $include Include schema
111
  */
112
  public function showSitemapHeader($include = array()) {
113
  @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
 
114
 
115
  header('Status: 200 OK', true, 200);
116
  header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
117
+ //Generate header
118
  echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>' . "\n";
119
  echo '<?xml-stylesheet type="text/xsl" href="' . wp_make_link_relative(_SQ_THEME_URL_) . 'css/sq_sitemap' . ($this->model->type == 'sitemap' ? 'index' : '') . '.xsl"?>' . "\n";
120
  echo '<!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->' . "\n";
core/SQ_BlockPostsAnalytics/SQ_BlockPostsAnalytics.php CHANGED
@@ -12,6 +12,8 @@ class SQ_BlockPostsAnalytics extends SQ_BlockController {
12
  $this->postlist = SQ_ObjController::getController('SQ_PostsList');
13
 
14
  $this->model->prepare_items();
 
 
15
  }
16
 
17
  public function getNavigationTop() {
12
  $this->postlist = SQ_ObjController::getController('SQ_PostsList');
13
 
14
  $this->model->prepare_items();
15
+
16
+ @ini_set('open_basedir', null);
17
  }
18
 
19
  public function getNavigationTop() {
core/SQ_BlockSettings/SQ_BlockSettings.php CHANGED
@@ -49,9 +49,13 @@ class SQ_BlockSettings extends SQ_BlockController {
49
 
50
  SQ_Tools::saveOptions('sq_keyword_help', (int) SQ_Tools::getValue('sq_keyword_help'));
51
  SQ_Tools::saveOptions('sq_keyword_information', (int) SQ_Tools::getValue('sq_keyword_information'));
 
 
 
52
  SQ_Tools::saveOptions('sq_sla', (int) SQ_Tools::getValue('sq_sla'));
53
  SQ_Tools::saveOptions('sq_keywordtag', (int) SQ_Tools::getValue('sq_keywordtag'));
54
  SQ_Tools::saveOptions('sq_local_images', (int) SQ_Tools::getValue('sq_local_images'));
 
55
 
56
 
57
  SQ_Tools::saveOptions('sq_google_wt', SQ_ObjController::getModel('SQ_BlockSettingsSeo')->checkGoogleWTCode(SQ_Tools::getValue('sq_google_wt','',true)));
49
 
50
  SQ_Tools::saveOptions('sq_keyword_help', (int) SQ_Tools::getValue('sq_keyword_help'));
51
  SQ_Tools::saveOptions('sq_keyword_information', (int) SQ_Tools::getValue('sq_keyword_information'));
52
+ SQ_Tools::saveOptions('sq_force_savepost', (int) SQ_Tools::getValue('sq_force_savepost'));
53
+
54
+
55
  SQ_Tools::saveOptions('sq_sla', (int) SQ_Tools::getValue('sq_sla'));
56
  SQ_Tools::saveOptions('sq_keywordtag', (int) SQ_Tools::getValue('sq_keywordtag'));
57
  SQ_Tools::saveOptions('sq_local_images', (int) SQ_Tools::getValue('sq_local_images'));
58
+ SQ_Tools::saveOptions('sq_url_fix', (int) SQ_Tools::getValue('sq_url_fix'));
59
 
60
 
61
  SQ_Tools::saveOptions('sq_google_wt', SQ_ObjController::getModel('SQ_BlockSettingsSeo')->checkGoogleWTCode(SQ_Tools::getValue('sq_google_wt','',true)));
core/SQ_BlockSettingsSeo/SQ_BlockSettingsSeo.php CHANGED
@@ -33,7 +33,6 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
33
  public function action() {
34
  parent::action();
35
 
36
-
37
  switch (SQ_Tools::getValue('action')) {
38
 
39
  case 'sq_settingsseo_update':
33
  public function action() {
34
  parent::action();
35
 
 
36
  switch (SQ_Tools::getValue('action')) {
37
 
38
  case 'sq_settingsseo_update':
core/SQ_Blockseo/SQ_Blockseo.php CHANGED
@@ -16,7 +16,7 @@ class SQ_Blockseo extends SQ_BlockController {
16
  var __snippetsavecancel = "' . __('Cancel', _SQ_PLUGIN_NAME_) . '";
17
  var __snippetreset = "' . __('Reset', _SQ_PLUGIN_NAME_) . '";
18
 
19
- var __snippetcustomize = "' . __('Customize Meta', _SQ_PLUGIN_NAME_) . '";
20
  var __snippetkeyword = "' . __('manage keywords', _SQ_PLUGIN_NAME_) . '";
21
  var __snippetshort = "' . __('Too short', _SQ_PLUGIN_NAME_) . '";
22
  var __snippetlong = "' . __('Too long', _SQ_PLUGIN_NAME_) . '";
16
  var __snippetsavecancel = "' . __('Cancel', _SQ_PLUGIN_NAME_) . '";
17
  var __snippetreset = "' . __('Reset', _SQ_PLUGIN_NAME_) . '";
18
 
19
+ var __snippetcustomize = "' . __('Edit Meta / Open Graph', _SQ_PLUGIN_NAME_) . '";
20
  var __snippetkeyword = "' . __('manage keywords', _SQ_PLUGIN_NAME_) . '";
21
  var __snippetshort = "' . __('Too short', _SQ_PLUGIN_NAME_) . '";
22
  var __snippetlong = "' . __('Too long', _SQ_PLUGIN_NAME_) . '";
models/SQ_BlockPostsAnalytics.php CHANGED
@@ -220,13 +220,18 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
220
 
221
  function get_sortable_columns()
222
  {
223
- return array(
224
  'title' => 'title',
225
  'type' => 'type',
226
  'author' => 'author',
227
- 'rank' => 'rank',
228
- 'date' => array('date', true)
229
  );
 
 
 
 
 
 
 
230
  }
231
 
232
  function print_column_headers($with_id = true)
@@ -302,7 +307,14 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table
302
  if (empty($post_type) || is_object_in_taxonomy($post_type, 'post_tag'))
303
  $posts_columns['keywords'] = __('Keywords');
304
 
305
- $posts_columns['rank'] = sprintf(__('Google.%s Position'), SQ_Tools::$options['sq_google_country']);
 
 
 
 
 
 
 
306
  $posts_columns['traffic'] = '';
307
  $posts_columns['date'] = __('Date');
308
  return $posts_columns;
220
 
221
  function get_sortable_columns()
222
  {
223
+ $columns = array(
224
  'title' => 'title',
225
  'type' => 'type',
226
  'author' => 'author',
 
 
227
  );
228
+ if(SQ_Tools::$options['sq_google_ranksperhour'] > 0){
229
+ $columns['rank'] = 'rank';
230
+ }
231
+
232
+ $columns['date'] = array('date', true);
233
+
234
+ return $columns;
235
  }
236
 
237
  function print_column_headers($with_id = true)
307
  if (empty($post_type) || is_object_in_taxonomy($post_type, 'post_tag'))
308
  $posts_columns['keywords'] = __('Keywords');
309
 
310
+ if(SQ_Tools::$options['sq_google_ranksperhour'] > 0) {
311
+ $blog_ip = @gethostbyname(gethostname());
312
+ if (isset($blog_ip)) {
313
+ if (strpos($blog_ip, '192.') === false) {
314
+ $posts_columns['rank'] = sprintf(__('Google.%s Position'), SQ_Tools::$options['sq_google_country']);
315
+ }
316
+ }
317
+ }
318
  $posts_columns['traffic'] = '';
319
  $posts_columns['date'] = __('Date');
320
  return $posts_columns;
models/SQ_BlockSettingsSeo.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
 
3
- class Model_SQ_BlockSettingsSeo
4
- {
5
 
6
  var $eTypes;
7
  var $appleSizes;
8
 
9
- public function __construct()
10
- {
11
  $this->appleSizes = preg_split('/[,]+/', _SQ_MOBILE_ICON_SIZES);
12
  }
13
 
@@ -15,8 +13,7 @@ class Model_SQ_BlockSettingsSeo
15
  * Check if ecommerce is installed
16
  * @return boolean
17
  */
18
- public function isEcommerce()
19
- {
20
  if (isset($this->eTypes)) {
21
  return $this->eTypes;
22
  }
@@ -41,8 +38,7 @@ class Model_SQ_BlockSettingsSeo
41
  *
42
  * @return string
43
  */
44
- public function checkGoogleWTCode($code)
45
- {
46
 
47
  if ($code <> '') {
48
  if (strpos($code, 'content') !== false) {
@@ -64,8 +60,7 @@ class Model_SQ_BlockSettingsSeo
64
  *
65
  * @return string
66
  */
67
- public function checkGoogleAnalyticsCode($code)
68
- {
69
  //echo $code;
70
  if ($code <> '') {
71
  if (strpos($code, 'GoogleAnalyticsObject') !== false) {
@@ -91,50 +86,44 @@ class Model_SQ_BlockSettingsSeo
91
  *
92
  * @return string
93
  */
94
- public function checkFavebookInsightsCode($code)
95
- {
96
  if ($code <> '') {
97
- if (strpos($code, 'content') !== false) {
98
- preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
99
- $code = '';
100
  if (isset($result[1]) && !empty($result[1])) {
101
- $code = $result[1];
102
  }
103
  }
104
 
105
  if (strpos($code, 'facebook.com/') !== false) {
106
  preg_match('/facebook.com\/([^\/]+)/i', $code, $result);
107
- $code = '';
108
  if (isset($result[1]) && !empty($result[1])) {
109
  if (is_string($result[1])) {
110
- $html = SQ_Tools::sq_remote_post('http://findmyfbid.com/', array('url' => $result[1]));
111
- if ($html <> '' && strpos($html, '<code') !== false) {
112
- $result = array();
113
- if (preg_match('/<code[^>]*>([0-9]+)<\/code[^>]*>/i', $html, $result)) {
114
- if (isset($result[1]) && !empty($result[1])) {
115
- $code = $result[1];
116
- }
117
- }
118
  }
119
- } elseif(is_numeric($result[1])) {
120
- $code = $result[1];
121
  }
122
  }
123
- }
124
-
125
- if (strpos($code, '"') !== false) {
126
- preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
127
- $code = '';
128
- if (isset($result[1]) && !empty($result[1])) {
129
- $code = $result[1];
 
130
  }
131
  }
132
 
133
- if ($code == '') {
134
  SQ_Error::setError(__("The code for Facebook is incorrect.", _SQ_PLUGIN_NAME_));
135
  }
136
  }
137
- return $code;
138
  }
139
 
140
  /**
@@ -142,8 +131,7 @@ class Model_SQ_BlockSettingsSeo
142
  *
143
  * @return string
144
  */
145
- public function checkPinterestCode($code)
146
- {
147
  if ($code <> '') {
148
  if (strpos($code, 'content') !== false) {
149
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
@@ -165,8 +153,7 @@ class Model_SQ_BlockSettingsSeo
165
  *
166
  * @return string
167
  */
168
- public function checkBingWTCode($code)
169
- {
170
  if ($code <> '') {
171
  if (strpos($code, 'content') !== false) {
172
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
@@ -188,8 +175,7 @@ class Model_SQ_BlockSettingsSeo
188
  *
189
  * @return string
190
  */
191
- public function checkTwitterAccount($account)
192
- {
193
  if (SQ_ObjController::getModel('SQ_Frontend')->getTwitterAccount($account) === false) {
194
  SQ_Error::setError(__("The twitter account is incorrect", _SQ_PLUGIN_NAME_));
195
  }
@@ -204,8 +190,7 @@ class Model_SQ_BlockSettingsSeo
204
  *
205
  * @return string
206
  */
207
- public function checkGoogleAccount($account)
208
- {
209
  if ($account <> '' && strpos($account, 'google.') === false) {
210
  $account = 'https://plus.google.com/' . $account;
211
  }
@@ -217,8 +202,7 @@ class Model_SQ_BlockSettingsSeo
217
  *
218
  * @return string
219
  */
220
- public function checkLinkeinAccount($account)
221
- {
222
  if ($account <> '' && strpos($account, 'linkedin.') === false) {
223
  $account = 'https://www.linkedin.com/in/' . $account;
224
  }
@@ -230,24 +214,21 @@ class Model_SQ_BlockSettingsSeo
230
  *
231
  * @return string
232
  */
233
- public function checkFacebookAccount($account)
234
- {
235
  if ($account <> '' && strpos($account, 'facebook.com') === false) {
236
  $account = 'https://www.facebook.com/' . $account;
237
  }
238
  return $account;
239
  }
240
 
241
- public function checkPinterestAccount($account)
242
- {
243
  if ($account <> '' && strpos($account, 'pinterest.com') === false) {
244
  $account = 'https://www.pinterest.com/' . $account;
245
  }
246
  return $account;
247
  }
248
 
249
- public function checkInstagramAccount($account)
250
- {
251
  if ($account <> '' && strpos($account, 'instagram.com') === false) {
252
  $account = 'https://www.instagram.com/' . $account;
253
  }
@@ -263,8 +244,7 @@ class Model_SQ_BlockSettingsSeo
263
  * @return array [name (the name of the file), favicon (the path of the ico), message (the returned message)]
264
  *
265
  */
266
- public function addFavicon($file, $path = ABSPATH)
267
- {
268
 
269
  /* get the file extension */
270
  $file_name = explode('.', $file['name']);
@@ -358,8 +338,7 @@ class Model_SQ_BlockSettingsSeo
358
  }
359
  }
360
 
361
- private function checkFunctions()
362
- {
363
  $required_functions = array('getimagesize', 'imagecreatefromstring', 'imagecreatetruecolor', 'imagecolortransparent', 'imagecolorallocatealpha', 'imagealphablending', 'imagesavealpha', 'imagesx', 'imagesy', 'imagecopyresampled',);
364
 
365
  foreach ($required_functions as $function) {
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
 
13
  * Check if ecommerce is installed
14
  * @return boolean
15
  */
16
+ public function isEcommerce() {
 
17
  if (isset($this->eTypes)) {
18
  return $this->eTypes;
19
  }
38
  *
39
  * @return string
40
  */
41
+ public function checkGoogleWTCode($code) {
 
42
 
43
  if ($code <> '') {
44
  if (strpos($code, 'content') !== false) {
60
  *
61
  * @return string
62
  */
63
+ public function checkGoogleAnalyticsCode($code) {
 
64
  //echo $code;
65
  if ($code <> '') {
66
  if (strpos($code, 'GoogleAnalyticsObject') !== false) {
86
  *
87
  * @return string
88
  */
89
+ public function checkFavebookInsightsCode($code) {
90
+ $id = '';
91
  if ($code <> '') {
92
+ if (strpos($code, '"') !== false) {
93
+ preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
 
94
  if (isset($result[1]) && !empty($result[1])) {
95
+ $id = $result[1];
96
  }
97
  }
98
 
99
  if (strpos($code, 'facebook.com/') !== false) {
100
  preg_match('/facebook.com\/([^\/]+)/i', $code, $result);
 
101
  if (isset($result[1]) && !empty($result[1])) {
102
  if (is_string($result[1])) {
103
+ $response = SQ_Action::apiCall('sq/seo/facebook-id', array('profile' => $result[1]));
104
+ if ($response && $json = json_decode($response)) {
105
+ $id = $json->code;
 
 
 
 
 
106
  }
107
+ } elseif (is_numeric($result[1])) {
108
+ $id = $result[1];
109
  }
110
  }
111
+ }else {
112
+ if (is_string($code)) {
113
+ $response = SQ_Action::apiCall('sq/seo/facebook-id', array('profile' => $code));
114
+ if ($response && $json = json_decode($response)) {
115
+ $id = $json->code;
116
+ }
117
+ } elseif (is_numeric($code)) {
118
+ $id = $code;
119
  }
120
  }
121
 
122
+ if ($id == '') {
123
  SQ_Error::setError(__("The code for Facebook is incorrect.", _SQ_PLUGIN_NAME_));
124
  }
125
  }
126
+ return $id;
127
  }
128
 
129
  /**
131
  *
132
  * @return string
133
  */
134
+ public function checkPinterestCode($code) {
 
135
  if ($code <> '') {
136
  if (strpos($code, 'content') !== false) {
137
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
153
  *
154
  * @return string
155
  */
156
+ public function checkBingWTCode($code) {
 
157
  if ($code <> '') {
158
  if (strpos($code, 'content') !== false) {
159
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
175
  *
176
  * @return string
177
  */
178
+ public function checkTwitterAccount($account) {
 
179
  if (SQ_ObjController::getModel('SQ_Frontend')->getTwitterAccount($account) === false) {
180
  SQ_Error::setError(__("The twitter account is incorrect", _SQ_PLUGIN_NAME_));
181
  }
190
  *
191
  * @return string
192
  */
193
+ public function checkGoogleAccount($account) {
 
194
  if ($account <> '' && strpos($account, 'google.') === false) {
195
  $account = 'https://plus.google.com/' . $account;
196
  }
202
  *
203
  * @return string
204
  */
205
+ public function checkLinkeinAccount($account) {
 
206
  if ($account <> '' && strpos($account, 'linkedin.') === false) {
207
  $account = 'https://www.linkedin.com/in/' . $account;
208
  }
214
  *
215
  * @return string
216
  */
217
+ public function checkFacebookAccount($account) {
 
218
  if ($account <> '' && strpos($account, 'facebook.com') === false) {
219
  $account = 'https://www.facebook.com/' . $account;
220
  }
221
  return $account;
222
  }
223
 
224
+ public function checkPinterestAccount($account) {
 
225
  if ($account <> '' && strpos($account, 'pinterest.com') === false) {
226
  $account = 'https://www.pinterest.com/' . $account;
227
  }
228
  return $account;
229
  }
230
 
231
+ public function checkInstagramAccount($account) {
 
232
  if ($account <> '' && strpos($account, 'instagram.com') === false) {
233
  $account = 'https://www.instagram.com/' . $account;
234
  }
244
  * @return array [name (the name of the file), favicon (the path of the ico), message (the returned message)]
245
  *
246
  */
247
+ public function addFavicon($file, $path = ABSPATH) {
 
248
 
249
  /* get the file extension */
250
  $file_name = explode('.', $file['name']);
338
  }
339
  }
340
 
341
+ private function checkFunctions() {
 
342
  $required_functions = array('getimagesize', 'imagecreatefromstring', 'imagecreatetruecolor', 'imagecolortransparent', 'imagecolorallocatealpha', 'imagealphablending', 'imagesavealpha', 'imagesx', 'imagesy', 'imagecopyresampled',);
343
 
344
  foreach ($required_functions as $function) {
models/SQ_Frontend.php CHANGED
@@ -5,8 +5,10 @@ class Model_SQ_Frontend {
5
  public $buffer;
6
 
7
  /** @var object Current post */
8
- private $post;
 
9
  private $post_type;
 
10
 
11
  /** @var canonical link */
12
  private $url;
@@ -46,11 +48,10 @@ class Model_SQ_Frontend {
46
 
47
  public function __construct() {
48
  SQ_ObjController::getController('SQ_Tools', false);
49
- $this->post_type = SQ_Tools::$options['sq_post_types'];
50
  }
51
 
52
  /** @var meta from other plugins */
53
- // private $op_meta = array();
54
  /**
55
  * Write the signature
56
  * @return string
@@ -64,20 +65,55 @@ class Model_SQ_Frontend {
64
  * @return string
65
  */
66
  public function setStartTag() {
67
-
68
  if ($this->is_squirrly()) {
69
- global $post;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
- if (function_exists('is_shop') && is_shop()) {
72
- $this->post = get_post(woocommerce_get_page_id('shop'));
73
- } elseif (isset($post->ID)) {
 
 
74
  $this->post = get_post($post->ID);
75
  }
76
 
77
- SQ_Tools::dump('Show Squirrly', 'isHomePage: ' . $this->isHomePage(), 'is_single: ' . is_single(), 'is_preview: ' . is_preview(), 'is_page: ' . is_page(), 'is_archive: ' . is_archive(), 'is_author: ' . is_author(), 'is_category: ' . is_category(), 'is_tag: ' . is_tag(), 'is_search: ' . is_search(), 'in_array: ' . (!empty($this->post_type) && in_array(get_post_type(), $this->post_type)));
78
- return "<squirrly />";
79
- } else {
80
- SQ_Tools::dump('Hide Squirrly');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
82
  }
83
 
@@ -114,6 +150,22 @@ class Model_SQ_Frontend {
114
  return $this->buffer;
115
  }
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  /**
118
  * Flush the header from wordpress
119
  *
@@ -121,9 +173,6 @@ class Model_SQ_Frontend {
121
  *
122
  */
123
  public function flushHeader() {
124
- $buffers = array();
125
-
126
-
127
  try {
128
  if (function_exists('ob_list_handlers')) {
129
  $buffers = @ob_list_handlers();
@@ -151,7 +200,7 @@ class Model_SQ_Frontend {
151
  return false;
152
  }
153
 
154
- if ($this->isHomePage() || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search() || (!empty($this->post_type) && in_array(get_post_type(), $this->post_type))) {
155
  return true;
156
  }
157
 
@@ -164,7 +213,6 @@ class Model_SQ_Frontend {
164
  * @return string
165
  */
166
  public function setMetaInBuffer($buffer) {
167
- global $post;
168
 
169
  //if the title is already shown
170
  if (isset($this->url)) {
@@ -172,18 +220,14 @@ class Model_SQ_Frontend {
172
  }
173
  //get the post from shop if woocommerce is installed
174
  if (!isset($this->post)) {
175
- if (function_exists('is_shop') && is_shop()) {
176
- $this->post = get_post(wc_get_page_id('shop'));
177
- } elseif (isset($post->ID)) {
178
- $this->post = get_post($post->ID);
179
- }
180
  }
181
 
182
  if ($this->is_squirrly()) {
183
 
184
  //update ... please monitor
185
- if(is_single() || is_page() ){
186
- if(!isset($this->post->ID)){
187
  return $buffer;
188
  }
189
  }
@@ -225,7 +269,7 @@ class Model_SQ_Frontend {
225
  if (isset($this->title) && $this->title <> '') {
226
  //replace the existing title
227
  $buffer = @preg_replace('/<title[^<>]*>([^<>]*)<\/title>/si', '', $buffer, -1);
228
- $buffer = @preg_replace('/(<head[^>]*>)/si', sprintf("$1\n<title>%s</title>", $this->title) . "\n", $buffer, -1 );
229
  }
230
  }
231
 
@@ -311,12 +355,8 @@ class Model_SQ_Frontend {
311
  return $ret;
312
  }
313
 
314
- public function setPost($newpost) {
315
- global $post;
316
- $this->post = $post = $newpost;
317
- }
318
 
319
- private function getTwitterCard() {
320
  $meta = "\n";
321
 
322
  //Title and Description is required
@@ -336,8 +376,8 @@ class Model_SQ_Frontend {
336
  $meta .= (($sq_twitter_creator <> '') ? sprintf('<meta name="twitter:creator" content="%s" />', $this->getTwitterAccount($sq_twitter_creator)) . "\n" : '');
337
  $meta .= (($sq_twitter_site <> '') ? sprintf('<meta name="twitter:site" content="%s" />', $this->getTwitterAccount($sq_twitter_creator)) . "\n" : '');
338
  $meta .= sprintf('<meta name="twitter:url" content="%s">', $this->url) . "\n";
339
- $meta .= sprintf('<meta name="twitter:title" content="%s">', $this->title) . "\n";
340
- $meta .= (($this->description <> '') ? sprintf('<meta name="twitter:description" content="%s">', $this->description . ' | ' . $this->meta['blogname']) . "\n" : '');
341
  $meta .= (!empty($this->thumb_images) ? sprintf('<meta name="twitter:image" content="%s">', $this->thumb_images[0]['src']) . "\n" : '');
342
  $meta .= (($this->meta['blogname'] <> '') ? sprintf('<meta name="twitter:domain" content="%s">', $this->meta['blogname']) . "\n" : '');
343
 
@@ -373,7 +413,7 @@ class Model_SQ_Frontend {
373
  * Get the Open Graph Protocol
374
  * @return string
375
  */
376
- private function getOpenGraph() {
377
  $meta = "\n";
378
  $image = '';
379
 
@@ -405,8 +445,8 @@ class Model_SQ_Frontend {
405
  $meta .= sprintf('<meta property="og:video:height" content="%s" />', 280) . "\n";
406
  }
407
 
408
- $meta .= sprintf('<meta property="og:title" content="%s" />', $this->title) . "\n";
409
- $meta .= sprintf('<meta property="og:description" content="%s" />', $this->description) . "\n";
410
  $meta .= (($this->meta['blogname'] <> '') ? sprintf('<meta property="og:site_name" content="%s" />', apply_filters('sq_open_graph_site', $this->meta['blogname'])) . "\n" : '');
411
 
412
 
@@ -497,7 +537,7 @@ class Model_SQ_Frontend {
497
  *
498
  * @return string
499
  */
500
- private function setCanonical() {
501
  if ($url = $this->getCanonicalUrl(true)) {
502
  remove_action('wp_head', 'rel_canonical');
503
 
@@ -588,7 +628,7 @@ class Model_SQ_Frontend {
588
  if (is_paged()) {
589
  $this->title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . (int)get_query_var('paged');
590
  }
591
- } elseif (is_single() || is_page() || is_singular() || in_array(get_post_type(), $this->post_type)) {
592
  if (isset($this->post) && isset($this->post->ID)) {
593
  //is a post page
594
  $this->title = $this->grabTitleFromPost($this->post->ID);
@@ -855,7 +895,7 @@ class Model_SQ_Frontend {
855
  if (is_paged()) {
856
  $description .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . (int)get_query_var('paged');
857
  }
858
- } elseif (is_single() || is_page() || is_singular() || $this->checkPostsPage() || in_array(get_post_type(), $this->post_type)) {
859
  if (isset($this->post) && isset($this->post->ID)) {
860
  //is a post page
861
  $description .= $this->grabDescriptionFromPost($this->post->ID);
@@ -918,7 +958,7 @@ class Model_SQ_Frontend {
918
  *
919
  * @return string
920
  */
921
- private function getCustomKeyword() {
922
  $keywords = '';
923
 
924
  if ($this->checkPostsPage() && SQ_Tools::$options['sq_auto_description'] == 1) {
@@ -952,7 +992,7 @@ class Model_SQ_Frontend {
952
  *
953
  * @return string
954
  */
955
- private function getCopyright() {
956
  $meta = '';
957
 
958
  $name = $this->getAuthor('display_name');
@@ -972,7 +1012,7 @@ class Model_SQ_Frontend {
972
  *
973
  * @return string
974
  */
975
- private function getGooglePlusMeta() {
976
  $meta = '';
977
  $author = SQ_Tools::$options['sq_google_plus'];
978
 
@@ -992,7 +1032,7 @@ class Model_SQ_Frontend {
992
  *
993
  * @return string
994
  */
995
- private function getFavicon() {
996
  $meta = '';
997
  $rnd = '';
998
 
@@ -1035,7 +1075,7 @@ class Model_SQ_Frontend {
1035
  *
1036
  * @return string
1037
  */
1038
- private function getLanguage() {
1039
  $meta = '';
1040
  $language = get_bloginfo('language');
1041
 
@@ -1057,7 +1097,7 @@ class Model_SQ_Frontend {
1057
  *
1058
  * @return string
1059
  */
1060
- private function getDublinCore() {
1061
  $date = null;
1062
  $meta = '';
1063
 
@@ -1091,7 +1131,7 @@ class Model_SQ_Frontend {
1091
  *
1092
  * @return string
1093
  */
1094
- private function getXMLSitemap() {
1095
  $meta = '';
1096
 
1097
  $xml_url = SQ_ObjController::getController('SQ_Sitemaps')->getXmlUrl('sitemap');
@@ -1108,7 +1148,7 @@ class Model_SQ_Frontend {
1108
  *
1109
  * @return string
1110
  */
1111
- private function getGoogleWT() {
1112
  $sq_google_wt = SQ_Tools::$options['sq_google_wt'];
1113
 
1114
  if ($this->isHomePage() && $sq_google_wt <> '') {
@@ -1123,26 +1163,17 @@ class Model_SQ_Frontend {
1123
  *
1124
  * @return string
1125
  */
1126
- private function getGoogleAnalytics() {
1127
  $sq_google_analytics = SQ_Tools::$options['sq_google_analytics'];
1128
 
1129
  if ($sq_google_analytics <> '') {
1130
- if (SQ_Tools::$options['sq_auto_amp']){
1131
  return '<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>' . "\n";
1132
- }else {
1133
  SQ_ObjController::getController('SQ_DisplayController', false)
1134
  ->loadMedia('https://www.google-analytics.com/analytics.js');
1135
 
1136
- return sprintf("<script>
1137
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1138
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
1139
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
1140
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
1141
-
1142
- ga('create', '%s', 'auto');
1143
- ga('send', 'pageview');
1144
- ga('require', 'linked');
1145
- </script>", $sq_google_analytics);
1146
  }
1147
  }
1148
 
@@ -1153,36 +1184,152 @@ class Model_SQ_Frontend {
1153
  $sq_google_analytics = SQ_Tools::$options['sq_google_analytics'];
1154
 
1155
  if ($sq_google_analytics <> '') {
1156
- if (SQ_Tools::$options['sq_auto_amp']){
1157
  return sprintf('<amp-analytics type="googleanalytics" id="analytics1"><script type="application/json">{"vars": {"account": "%s"},"triggers": {"trackPageview": {"on": "visible","request": "pageview"}}}</script></amp-analytics>', $sq_google_analytics) . "\n";
1158
  }
1159
  }
1160
  return '';
1161
  }
1162
 
1163
- private function getFacebookPixel() {
1164
-
1165
  $sq_facebook_analytics = SQ_Tools::$options['sq_facebook_analytics'];
1166
-
1167
  if ($sq_facebook_analytics <> '') {
1168
- if (SQ_Tools::$options['sq_auto_amp']){
1169
- //not yet supported
1170
- }else {
1171
- return sprintf("<script>
1172
- !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
1173
- n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
1174
- n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
1175
- t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
1176
- document,'script','https://connect.facebook.net/en_US/fbevents.js');
1177
- fbq('init', '%s');
1178
- fbq('track', 'ViewContent');
1179
- fbq('track', 'PageView');</script>
1180
- <noscript><img height='1' width='1' style='display:none'
1181
- src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1182
- /></noscript>" . "\n", $sq_facebook_analytics, $sq_facebook_analytics);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1183
  }
1184
  }
1185
-
1186
  return false;
1187
  }
1188
 
@@ -1191,7 +1338,7 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1191
  *
1192
  * @return string
1193
  */
1194
- private function getFacebookIns() {
1195
  $sq_facebook_insights = SQ_Tools::$options ['sq_facebook_insights'];
1196
 
1197
  if ($this->isHomePage() && $sq_facebook_insights <> '') {
@@ -1206,7 +1353,7 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1206
  *
1207
  * @return string
1208
  */
1209
- private function getPinterest() {
1210
  $sq_pinterest = SQ_Tools::$options['sq_pinterest'];
1211
 
1212
  if ($this->isHomePage() && $sq_pinterest <> '') {
@@ -1221,7 +1368,7 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1221
  *
1222
  * @return string
1223
  */
1224
- private function getAlexaT() {
1225
  $sq_alexa = SQ_Tools::$options['sq_alexa'];
1226
 
1227
  if ($this->isHomePage() && $sq_alexa <> '') {
@@ -1236,7 +1383,7 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1236
  *
1237
  * @return string
1238
  */
1239
- private function getBingWT() {
1240
  $sq_bing_wt = SQ_Tools::$options['sq_bing_wt'];
1241
 
1242
  if ($this->isHomePage() && $sq_bing_wt <> '') {
@@ -1250,7 +1397,7 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1250
  * Get the JsonLD meta for this site
1251
  * @return string
1252
  */
1253
- private function getJsonLD() {
1254
  $meta = '';
1255
  $sep = ",\n";
1256
  if ($this->isHomePage()) {
@@ -1598,6 +1745,16 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1598
  }
1599
  }
1600
 
 
 
 
 
 
 
 
 
 
 
1601
  $haspost = (count($wp_query->posts) > 0);
1602
 
1603
  if (get_query_var('m') <> '') {
@@ -1697,7 +1854,7 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1697
  *
1698
  * @return bool
1699
  */
1700
- private function isHomePage() {
1701
  global $wp_query;
1702
 
1703
  if (isset($wp_query->queried_object_id)) {
@@ -1713,7 +1870,7 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1713
  return (is_home() || (isset($wp_query->query) && empty($wp_query->query) && !is_preview()));
1714
  }
1715
 
1716
- private function isHtmlHeader() {
1717
  $headers = headers_list();
1718
 
1719
  foreach ($headers as $index => $value) {
@@ -1741,7 +1898,7 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1741
  *
1742
  * @return bool
1743
  */
1744
- private function checkFrontPage() {
1745
  return is_page() && get_option('show_on_front') == 'page' && isset($this->post->ID) && $this->post->ID == get_option('page_on_front');
1746
  }
1747
 
@@ -1750,7 +1907,7 @@ src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'
1750
  *
1751
  * @return bool
1752
  */
1753
- private function checkPostsPage() {
1754
  return is_home() && get_option('show_on_front') == 'page' && isset($this->post->ID) && $this->post->ID == get_option('page_for_posts');
1755
  }
1756
 
5
  public $buffer;
6
 
7
  /** @var object Current post */
8
+ private $post = null;
9
+
10
  private $post_type;
11
+ private $post_types;
12
 
13
  /** @var canonical link */
14
  private $url;
48
 
49
  public function __construct() {
50
  SQ_ObjController::getController('SQ_Tools', false);
51
+ $this->post_types = SQ_Tools::$options['sq_post_types'];
52
  }
53
 
54
  /** @var meta from other plugins */
 
55
  /**
56
  * Write the signature
57
  * @return string
65
  * @return string
66
  */
67
  public function setStartTag() {
68
+ $this->setPost();
69
  if ($this->is_squirrly()) {
70
+ SQ_Tools::dump('Show Squirrly', 'isHomePage: ' . $this->isHomePage(), 'is_single: ' . is_single(), 'is_preview: ' . is_preview(), 'is_page: ' . is_page(), 'is_archive: ' . is_archive(), 'is_author: ' . is_author(), 'is_category: ' . is_category(), 'is_tag: ' . is_tag(), 'is_search: ' . is_search(), 'in_array: ' . (!empty($this->post_types) && in_array($this->post_type, $this->post_types)));
71
+ return "<squirrly />";
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Set the post
77
+ *
78
+ * @param null|WP_Post $newpost
79
+ * @return array|null|object|WP_Post
80
+ */
81
+ public function setPost($newpost = null) {
82
+ global $post;
83
+
84
+ if (isset($newpost)) {
85
+ $post = $newpost;
86
+ }
87
 
88
+ if (function_exists('is_shop') && is_shop()) {
89
+ $this->post = get_post(wc_get_page_id('shop'));
90
+ $this->post_type = 'shop';
91
+ } else {
92
+ if (isset($post->ID)) {
93
  $this->post = get_post($post->ID);
94
  }
95
 
96
+ if (function_exists('is_product') && is_product()) {
97
+ $this->post_type = 'product';
98
+ } elseif (function_exists('is_checkout') && is_checkout()) {
99
+ $this->post_type = 'checkout';
100
+ } elseif (is_single()) {
101
+ $this->post_type = 'post';
102
+ } elseif (is_page()) {
103
+ $this->post_type = 'page';
104
+ } elseif (is_category()) {
105
+ $this->post_type = 'category';
106
+ } elseif (is_tag()) {
107
+ $this->post_type = 'tag';
108
+ } elseif (is_author()) {
109
+ $this->post_type = 'author';
110
+ } elseif (is_search()) {
111
+ $this->post_type = 'search';
112
+ } elseif (is_archive()) {
113
+ $this->post_type = 'archive';
114
+ } else {
115
+ $this->post_type = get_post_type();
116
+ }
117
  }
118
  }
119
 
150
  return $this->buffer;
151
  }
152
 
153
+ public function checkHandles() {
154
+ try {
155
+ if (function_exists('ob_list_handlers')) {
156
+ $buffers = @ob_list_handlers();
157
+
158
+ if (sizeof($buffers) > 0) {
159
+ if (!in_array(get_class($this) . '::getBuffer', $buffers)) {
160
+ $this->startBuffer();
161
+ }
162
+ }
163
+ }
164
+ } catch (Exception $ex) {
165
+ //error
166
+ }
167
+ }
168
+
169
  /**
170
  * Flush the header from wordpress
171
  *
173
  *
174
  */
175
  public function flushHeader() {
 
 
 
176
  try {
177
  if (function_exists('ob_list_handlers')) {
178
  $buffers = @ob_list_handlers();
200
  return false;
201
  }
202
 
203
+ if ($this->isHomePage() || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search() || (!empty($this->post_types) && in_array($this->post_type, $this->post_types))) {
204
  return true;
205
  }
206
 
213
  * @return string
214
  */
215
  public function setMetaInBuffer($buffer) {
 
216
 
217
  //if the title is already shown
218
  if (isset($this->url)) {
220
  }
221
  //get the post from shop if woocommerce is installed
222
  if (!isset($this->post)) {
223
+ $this->setPost();
 
 
 
 
224
  }
225
 
226
  if ($this->is_squirrly()) {
227
 
228
  //update ... please monitor
229
+ if (is_single() || is_page()) {
230
+ if (!isset($this->post->ID)) {
231
  return $buffer;
232
  }
233
  }
269
  if (isset($this->title) && $this->title <> '') {
270
  //replace the existing title
271
  $buffer = @preg_replace('/<title[^<>]*>([^<>]*)<\/title>/si', '', $buffer, -1);
272
+ $buffer = @preg_replace('/(<head[^>]*>)/si', sprintf("$1\n<title>%s</title>", $this->title) . "\n", $buffer, -1);
273
  }
274
  }
275
 
355
  return $ret;
356
  }
357
 
 
 
 
 
358
 
359
+ public function getTwitterCard() {
360
  $meta = "\n";
361
 
362
  //Title and Description is required
376
  $meta .= (($sq_twitter_creator <> '') ? sprintf('<meta name="twitter:creator" content="%s" />', $this->getTwitterAccount($sq_twitter_creator)) . "\n" : '');
377
  $meta .= (($sq_twitter_site <> '') ? sprintf('<meta name="twitter:site" content="%s" />', $this->getTwitterAccount($sq_twitter_creator)) . "\n" : '');
378
  $meta .= sprintf('<meta name="twitter:url" content="%s">', $this->url) . "\n";
379
+ $meta .= sprintf('<meta name="twitter:title" content="%s">', apply_filters('sq_twitter_card_title', $this->title)) . "\n";
380
+ $meta .= (($this->description <> '') ? sprintf('<meta name="twitter:description" content="%s">', apply_filters('sq_twitter_card_description', ($this->description . ' | ' . $this->meta['blogname']))) . "\n" : '');
381
  $meta .= (!empty($this->thumb_images) ? sprintf('<meta name="twitter:image" content="%s">', $this->thumb_images[0]['src']) . "\n" : '');
382
  $meta .= (($this->meta['blogname'] <> '') ? sprintf('<meta name="twitter:domain" content="%s">', $this->meta['blogname']) . "\n" : '');
383
 
413
  * Get the Open Graph Protocol
414
  * @return string
415
  */
416
+ public function getOpenGraph() {
417
  $meta = "\n";
418
  $image = '';
419
 
445
  $meta .= sprintf('<meta property="og:video:height" content="%s" />', 280) . "\n";
446
  }
447
 
448
+ $meta .= sprintf('<meta property="og:title" content="%s" />', apply_filters('sq_open_graph_title', $this->title)) . "\n";
449
+ $meta .= sprintf('<meta property="og:description" content="%s" />', apply_filters('sq_open_graph_description', $this->description)) . "\n";
450
  $meta .= (($this->meta['blogname'] <> '') ? sprintf('<meta property="og:site_name" content="%s" />', apply_filters('sq_open_graph_site', $this->meta['blogname'])) . "\n" : '');
451
 
452
 
537
  *
538
  * @return string
539
  */
540
+ public function setCanonical() {
541
  if ($url = $this->getCanonicalUrl(true)) {
542
  remove_action('wp_head', 'rel_canonical');
543
 
628
  if (is_paged()) {
629
  $this->title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . (int)get_query_var('paged');
630
  }
631
+ } elseif (is_single() || is_page() || is_singular() || in_array($this->post_type, $this->post_types)) {
632
  if (isset($this->post) && isset($this->post->ID)) {
633
  //is a post page
634
  $this->title = $this->grabTitleFromPost($this->post->ID);
895
  if (is_paged()) {
896
  $description .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . (int)get_query_var('paged');
897
  }
898
+ } elseif (is_single() || is_page() || is_singular() || $this->checkPostsPage() || in_array($this->post_type, $this->post_types)) {
899
  if (isset($this->post) && isset($this->post->ID)) {
900
  //is a post page
901
  $description .= $this->grabDescriptionFromPost($this->post->ID);
958
  *
959
  * @return string
960
  */
961
+ public function getCustomKeyword() {
962
  $keywords = '';
963
 
964
  if ($this->checkPostsPage() && SQ_Tools::$options['sq_auto_description'] == 1) {
992
  *
993
  * @return string
994
  */
995
+ public function getCopyright() {
996
  $meta = '';
997
 
998
  $name = $this->getAuthor('display_name');
1012
  *
1013
  * @return string
1014
  */
1015
+ public function getGooglePlusMeta() {
1016
  $meta = '';
1017
  $author = SQ_Tools::$options['sq_google_plus'];
1018
 
1032
  *
1033
  * @return string
1034
  */
1035
+ public function getFavicon() {
1036
  $meta = '';
1037
  $rnd = '';
1038
 
1075
  *
1076
  * @return string
1077
  */
1078
+ public function getLanguage() {
1079
  $meta = '';
1080
  $language = get_bloginfo('language');
1081
 
1097
  *
1098
  * @return string
1099
  */
1100
+ public function getDublinCore() {
1101
  $date = null;
1102
  $meta = '';
1103
 
1131
  *
1132
  * @return string
1133
  */
1134
+ public function getXMLSitemap() {
1135
  $meta = '';
1136
 
1137
  $xml_url = SQ_ObjController::getController('SQ_Sitemaps')->getXmlUrl('sitemap');
1148
  *
1149
  * @return string
1150
  */
1151
+ public function getGoogleWT() {
1152
  $sq_google_wt = SQ_Tools::$options['sq_google_wt'];
1153
 
1154
  if ($this->isHomePage() && $sq_google_wt <> '') {
1163
  *
1164
  * @return string
1165
  */
1166
+ public function getGoogleAnalytics() {
1167
  $sq_google_analytics = SQ_Tools::$options['sq_google_analytics'];
1168
 
1169
  if ($sq_google_analytics <> '') {
1170
+ if (SQ_Tools::$options['sq_auto_amp']) {
1171
  return '<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>' . "\n";
1172
+ } else {
1173
  SQ_ObjController::getController('SQ_DisplayController', false)
1174
  ->loadMedia('https://www.google-analytics.com/analytics.js');
1175
 
1176
+ return sprintf("<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '%s', 'auto');ga('send', 'pageview');</script>", $sq_google_analytics);
 
 
 
 
 
 
 
 
 
1177
  }
1178
  }
1179
 
1184
  $sq_google_analytics = SQ_Tools::$options['sq_google_analytics'];
1185
 
1186
  if ($sq_google_analytics <> '') {
1187
+ if (SQ_Tools::$options['sq_auto_amp']) {
1188
  return sprintf('<amp-analytics type="googleanalytics" id="analytics1"><script type="application/json">{"vars": {"account": "%s"},"triggers": {"trackPageview": {"on": "visible","request": "pageview"}}}</script></amp-analytics>', $sq_google_analytics) . "\n";
1189
  }
1190
  }
1191
  return '';
1192
  }
1193
 
1194
+ public function getFacebookPixel() {
 
1195
  $sq_facebook_analytics = SQ_Tools::$options['sq_facebook_analytics'];
 
1196
  if ($sq_facebook_analytics <> '') {
1197
+ $this->setPost($this->post);
1198
+ $domain = str_replace(array('http://', 'http://', 'www.'), '', get_bloginfo('url'));
1199
+ if ($this->isHomePage()) {
1200
+ $events[] = array(
1201
+ 'type' => 'track',
1202
+ 'name' => 'PageView',
1203
+ 'params' => array('page' => get_bloginfo('url'), 'domain' => $domain)
1204
+ );
1205
+ } else {
1206
+ if (isset($this->post->ID)) {
1207
+ $params['content_ids'] = array((string)$this->post->ID);
1208
+ }
1209
+
1210
+ $params['content_type'] = $this->post_type;
1211
+
1212
+ if ($this->post_type == 'category') {
1213
+ $category = get_category(get_query_var('cat'), false);
1214
+ if (isset($category->name)) {
1215
+ $params['content_category'] = $category->name;
1216
+ }
1217
+ } elseif ($this->post_type == 'product') {
1218
+ $params['content_name'] = $this->post->post_title;
1219
+ $cat = get_the_terms($this->post->ID, 'product_cat');
1220
+ if (!empty($cat)) {
1221
+ $params['content_category'] = $cat[0]->name;
1222
+ }
1223
+
1224
+ if (isset($_POST['product_id']) && isset($params['content_ids']) && isset($params['content_type'])) {
1225
+ if (function_exists('wc_get_product') && function_exists('get_woocommerce_currency')) {
1226
+ if ($product = wc_get_product((int)$_POST['product_id'])) {
1227
+ $params['value'] = $product->get_price();
1228
+ $params['currency'] = get_woocommerce_currency();
1229
+ }
1230
+ }
1231
+
1232
+ $events[] = array(
1233
+ 'type' => 'track',
1234
+ 'name' => 'AddToCart',
1235
+ 'params' => $params
1236
+ );
1237
+ }
1238
+ } elseif ($this->post_type == 'search') {
1239
+ $search = get_search_query(true);
1240
+ if ($search <> '') {
1241
+ $params['search_string'] = $search;
1242
+ $events[] = array(
1243
+ 'type' => 'track',
1244
+ 'name' => 'Search',
1245
+ 'params' => $params
1246
+ );
1247
+ }
1248
+ } elseif ($this->post_type == 'checkout' && isset($this->post->ID)) {
1249
+ global $woocommerce;
1250
+ if (isset($woocommerce->cart->total) && $woocommerce->cart->total > 0) {
1251
+ $params['value'] = $woocommerce->cart->total;
1252
+
1253
+ if (isset($woocommerce->cart->cart_contents) && !empty($woocommerce->cart->cart_contents)) {
1254
+ $quantity = 0;
1255
+ foreach ($woocommerce->cart->cart_contents as $product) {
1256
+ $quantity += $product['quantity'];
1257
+ }
1258
+ if ($quantity > 0) {
1259
+ $params['num_items'] = $quantity;
1260
+ }
1261
+ }
1262
+ $events[] = array(
1263
+ 'type' => 'track',
1264
+ 'name' => 'InitiateCheckout',
1265
+ 'params' => $params
1266
+ );
1267
+ } elseif (SQ_Tools::getIsset('key')) {
1268
+ $params['content_type'] = 'purchase';
1269
+ global $wpdb;
1270
+ $sql = "SELECT `post_id`
1271
+ FROM `" . $wpdb->postmeta . "`
1272
+ WHERE `meta_key` = '_order_key' AND `meta_value`='" . SQ_Tools::getValue('key') . "'";
1273
+
1274
+ if ($post = $wpdb->get_row($sql)) {
1275
+ if ($order = wc_get_order($post->post_id)) {
1276
+ $params['content_type'] = "checkout";
1277
+ $params['value'] = $order->get_total();
1278
+ $params['currency'] = $order->get_order_currency();
1279
+
1280
+ $events[] = array(
1281
+ 'type' => 'track',
1282
+ 'name' => 'Purchase',
1283
+ 'params' => $params
1284
+ );
1285
+ }
1286
+ }
1287
+ }
1288
+
1289
+
1290
+ } else {
1291
+ $cat = get_the_terms($this->post->ID, 'category');
1292
+ if (!empty($cat)) {
1293
+ $params['content_category'] = $cat[0]->name;
1294
+ }
1295
+ }
1296
+
1297
+ $params['page'] = $this->getCanonicalUrl();
1298
+ $params['domain'] = $domain;
1299
+
1300
+ if (isset($params['content_ids']) && isset($params['content_type'])) {
1301
+ $events[] = array(
1302
+ 'type' => 'track',
1303
+ 'name' => 'ViewContent',
1304
+ 'params' => $params
1305
+ );
1306
+ } else {
1307
+ $events[] = array(
1308
+ 'type' => 'trackCustom',
1309
+ 'name' => 'GeneralEvent',
1310
+ 'params' => $params
1311
+ );
1312
+ }
1313
+
1314
+ $events[] = array(
1315
+ 'type' => 'track',
1316
+ 'name' => 'PageView',
1317
+ 'params' => array('page' => $params['page'], 'domain' => $params['domain'])
1318
+ );
1319
+ }
1320
+ $track = '';
1321
+ foreach ($events as $event) {
1322
+ $track .= "fbq('" . $event['type'] . "', '" . $event['name'] . "', '" . json_encode($event['params']) . "');";
1323
+ }
1324
+ //$track .= json_encode($this->post);
1325
+ if ($sq_facebook_analytics <> '') {
1326
+ if (SQ_Tools::$options['sq_auto_amp']) {
1327
+ //not yet supported
1328
+ } else {
1329
+ return sprintf("<script>!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init', '%s');%s</script><noscript><img height='1' width='1' style='display:none'src='https://www.facebook.com/tr?id=%s&ev=PageView&noscript=1'/></noscript>" . "\n", $sq_facebook_analytics, $track, $sq_facebook_analytics);
1330
+ }
1331
  }
1332
  }
 
1333
  return false;
1334
  }
1335
 
1338
  *
1339
  * @return string
1340
  */
1341
+ public function getFacebookIns() {
1342
  $sq_facebook_insights = SQ_Tools::$options ['sq_facebook_insights'];
1343
 
1344
  if ($this->isHomePage() && $sq_facebook_insights <> '') {
1353
  *
1354
  * @return string
1355
  */
1356
+ public function getPinterest() {
1357
  $sq_pinterest = SQ_Tools::$options['sq_pinterest'];
1358
 
1359
  if ($this->isHomePage() && $sq_pinterest <> '') {
1368
  *
1369
  * @return string
1370
  */
1371
+ public function getAlexaT() {
1372
  $sq_alexa = SQ_Tools::$options['sq_alexa'];
1373
 
1374
  if ($this->isHomePage() && $sq_alexa <> '') {
1383
  *
1384
  * @return string
1385
  */
1386
+ public function getBingWT() {
1387
  $sq_bing_wt = SQ_Tools::$options['sq_bing_wt'];
1388
 
1389
  if ($this->isHomePage() && $sq_bing_wt <> '') {
1397
  * Get the JsonLD meta for this site
1398
  * @return string
1399
  */
1400
+ public function getJsonLD() {
1401
  $meta = '';
1402
  $sep = ",\n";
1403
  if ($this->isHomePage()) {
1745
  }
1746
  }
1747
 
1748
+ //If we have the Post ID
1749
+ if (isset($this->post->ID)) {
1750
+ $link = get_permalink($this->post->ID);
1751
+ $link = $this->getPaged($link);
1752
+ if ($link <> '') {
1753
+ return apply_filters('sq_canonical', $link);
1754
+ }
1755
+ }
1756
+
1757
+ //Find the canonical
1758
  $haspost = (count($wp_query->posts) > 0);
1759
 
1760
  if (get_query_var('m') <> '') {
1854
  *
1855
  * @return bool
1856
  */
1857
+ public function isHomePage() {
1858
  global $wp_query;
1859
 
1860
  if (isset($wp_query->queried_object_id)) {
1870
  return (is_home() || (isset($wp_query->query) && empty($wp_query->query) && !is_preview()));
1871
  }
1872
 
1873
+ public function isHtmlHeader() {
1874
  $headers = headers_list();
1875
 
1876
  foreach ($headers as $index => $value) {
1898
  *
1899
  * @return bool
1900
  */
1901
+ public function checkFrontPage() {
1902
  return is_page() && get_option('show_on_front') == 'page' && isset($this->post->ID) && $this->post->ID == get_option('page_on_front');
1903
  }
1904
 
1907
  *
1908
  * @return bool
1909
  */
1910
+ public function checkPostsPage() {
1911
  return is_home() && get_option('show_on_front') == 'page' && isset($this->post->ID) && $this->post->ID == get_option('page_for_posts');
1912
  }
1913
 
models/SQ_Post.php CHANGED
@@ -295,7 +295,6 @@ class Model_SQ_Post {
295
  (`post_id`,`meta_key`,`meta_value`)
296
  VALUES (" . (int) $post_id . ",'" . $meta['key'] . "','" . addslashes($meta['value']) . "')";
297
  }
298
- SQ_Tools::dump($sql);
299
  $wpdb->query($sql);
300
  }
301
 
295
  (`post_id`,`meta_key`,`meta_value`)
296
  VALUES (" . (int) $post_id . ",'" . $meta['key'] . "','" . addslashes($meta['value']) . "')";
297
  }
 
298
  $wpdb->query($sql);
299
  }
300
 
readme.txt CHANGED
@@ -17,7 +17,7 @@ Recommended by <strong><a href="http://www.quicksprout.com/university/how-to-max
17
 
18
  [youtube https://www.youtube.com/watch?v=mEjrE7TuDDc]
19
 
20
- See all the Squirrly SEO 2016 features at: http://howto.squirrly.co/category/sides/
21
 
22
  Based on the topic you're writing about, the interface will light up green while you're editing your text, so that you know you've done something right. When all the lights are green, you can publish it, because your text has excellent SEO and it's 100% optimized.
23
 
@@ -134,9 +134,35 @@ Type a keyword to the right of the screen and start using Squirrly Seo. Enjoy!
134
  7. Seo - Check your Weekly Site Audit and improve to get higher scores
135
 
136
  == Upgrade Notice ==
137
- Squirrly 5.2.8 it's a stable version of Squirrly SEO and has all the SEO requirements by Search Engines
138
 
139
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  = 6.2.6 =
141
  * Fixed Canonical link for facebook Open Graph
142
  * Don't show the Canonical Link if Squirrly SEO is off
@@ -374,7 +400,7 @@ For higher content marketing and SEO needs, you can check our Official Site and
374
  == Frequently Asked Questions ==
375
  = I can't log into the Wordpress with my user. Get the message 'An error occured.' What can I do? =
376
  I see that your host server is not letting you to access our remote API.
377
- Please tell your web master to add the IPs 144.76.66.106 and 176.9.112.210 in the white-list for remote access and it should work.
378
 
379
  = How does Squirrly WordPress SEO Plugin work? =
380
  Neil Patel, the Co-Founder of Kissmetrics and Crazy Egg made a great video on how to use Squirrly's Live Assistant:
17
 
18
  [youtube https://www.youtube.com/watch?v=mEjrE7TuDDc]
19
 
20
+ See all the Squirrly SEO 2017 features at: http://howto.squirrly.co/category/sides/
21
 
22
  Based on the topic you're writing about, the interface will light up green while you're editing your text, so that you know you've done something right. When all the lights are green, you can publish it, because your text has excellent SEO and it's 100% optimized.
23
 
134
  7. Seo - Check your Weekly Site Audit and improve to get higher scores
135
 
136
  == Upgrade Notice ==
137
+ Squirrly 6.2.8 it's a stable version of Squirrly SEO and has all the SEO requirements by Search Engines
138
 
139
  == Changelog ==
140
+ = 6.3.1 =
141
+ * Inform users with multiple active subscriptions
142
+ * Updated terms and contitions
143
+ * Added more links for support in the Feedback and Support sections
144
+ * Fixed Facebook Admin ID for Profile and Pages
145
+ * Changed the Theme for Squirrly SEO Settings and Advanced sections
146
+ * Fixed Typos and Broken Links
147
+ * Updated the Keyword Research for Long Tail Keyword
148
+
149
+ * Optimized the loading speed in case of poor connection with the API
150
+ * Pass the SSL issue for API calls
151
+ * Fixed the Squirrly SEO Weekly audit for free users
152
+ * Fixed Pay With a Tweet button
153
+ * Added google.us in Ranking Option
154
+
155
+ = 6.3.0 =
156
+ * Updated the facebook and google tracking code
157
+ * Improved the Faceboox Pixel Feature to work with Woocommerce
158
+ * Corrected the google tracking code
159
+ * Improved the comunication with the API server
160
+
161
+ = 6.2.8 =
162
+ * Fixed the Canonical link for some WP Themes
163
+ * Added forced keyword update in Squirrly SEO Settings
164
+ * Added a new Country in the Rank Option section
165
+
166
  = 6.2.6 =
167
  * Fixed Canonical link for facebook Open Graph
168
  * Don't show the Canonical Link if Squirrly SEO is off
400
  == Frequently Asked Questions ==
401
  = I can't log into the Wordpress with my user. Get the message 'An error occured.' What can I do? =
402
  I see that your host server is not letting you to access our remote API.
403
+ Please tell your web master to add the IPs 176.9.59.55 and 176.9.112.210 in the white-list for remote access and it should work.
404
 
405
  = How does Squirrly WordPress SEO Plugin work? =
406
  Neil Patel, the Co-Founder of Kissmetrics and Crazy Egg made a great video on how to use Squirrly's Live Assistant:
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: calinvingan, florinmuresan, nagy.sorel
11
- Version: 6.2.6
12
  Author URI: http://www.squirrly.co
13
  */
14
 
15
  /* SET THE CURRENT VERSION ABOVE AND BELOW */
16
- define('SQ_VERSION', '6.2.6');
17
  /* Call config files */
18
  if (file_exists(dirname(__FILE__) . '/config/config.php')) {
19
  require(dirname(__FILE__) . '/config/config.php');
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: calinvingan, florinmuresan, nagy.sorel
11
+ Version: 6.3.1
12
  Author URI: http://www.squirrly.co
13
  */
14
 
15
  /* SET THE CURRENT VERSION ABOVE AND BELOW */
16
+ define('SQ_VERSION', '6.3.1');
17
  /* Call config files */
18
  if (file_exists(dirname(__FILE__) . '/config/config.php')) {
19
  require(dirname(__FILE__) . '/config/config.php');
themes/default/SQ_BlockAccount.php CHANGED
@@ -6,7 +6,7 @@
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_) ?> &raquo;" />
10
  <br style="clear: both;">
11
  </div>
12
  </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" class="sq_goto_dashboard" type="button" value="<?php _e('Go to dashboard', _SQ_PLUGIN_NAME_) ?> &raquo;" />
10
  <br style="clear: both;">
11
  </div>
12
  </div>
themes/default/SQ_BlockAffiliate.php CHANGED
@@ -4,7 +4,7 @@
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_) ?> &raquo;" />
8
  </div>
9
  </div>
10
  <div id="sq_helpaffiliateside" class="sq_helpside"></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" class="sq_goto_dashboard" type="button" value="<?php _e('Go to dashboard', _SQ_PLUGIN_NAME_) ?> &raquo;" />
8
  </div>
9
  </div>
10
  <div id="sq_helpaffiliateside" class="sq_helpside"></div>
themes/default/SQ_BlockAnalytics.php CHANGED
@@ -286,7 +286,7 @@
286
  </div>
287
 
288
  <script>
289
- jQuery('.sq_analytics_tasks_video_cover').unbind('click').bind('click', function () {
290
  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&amp;hl=en_US&amp;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&amp;hl=en_US&amp;autoplay=1" type="application/x-shockwave-flash" width="280" height="158" allowscriptaccess="always" allowfullscreen="true"></embed></object>');
291
  });
292
  </script>
286
  </div>
287
 
288
  <script>
289
+ jQuery('.sq_analytics_tasks_video_cover').off('click').on('click', function () {
290
  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&amp;hl=en_US&amp;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&amp;hl=en_US&amp;autoplay=1" type="application/x-shockwave-flash" width="280" height="158" allowscriptaccess="always" allowfullscreen="true"></embed></object>');
291
  });
292
  </script>
themes/default/SQ_BlockDashboard.php CHANGED
@@ -10,7 +10,7 @@
10
 
11
 
12
  <div class="sq_login_link"><?php _e('Connect to Squirrly and start optimizing your site', _SQ_PLUGIN_NAME_); ?></div>
13
- <input id="sq_goto_dashboard" style="display:none; margin: 0 auto; width: 500px; padding: 0px 10px;" type="button" value="&laquo;<?php _e('START HERE', _SQ_PLUGIN_NAME_) ?> &raquo;" />
14
 
15
  <?php
16
  } else {
@@ -26,7 +26,7 @@
26
 
27
  <div class="sq_helpcontent" style="display: none; clear: left; <?php echo (SQ_Tools::$options['sq_api'] == '') ? 'text-align: center;' : '' ?>">
28
  <div style="width: 700px; display: inline-block;">
29
- <div style="font-size: 24px; margin: 30px 0; color: #999;">All Squirrly Features</div>
30
  <ul class="sq_slidelist">
31
  <li>
32
  <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>
@@ -82,7 +82,7 @@
82
  </li>
83
  <li>
84
  <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>
85
- <div>Measure Your Success Option from Squirrly</div>
86
  </li>
87
  <li>
88
  <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>
10
 
11
 
12
  <div class="sq_login_link"><?php _e('Connect to Squirrly and start optimizing your site', _SQ_PLUGIN_NAME_); ?></div>
13
+ <input id="sq_goto_dashboard" class="sq_goto_dashboard" style="display:none; margin: 0 auto; width: 500px; padding: 0px 10px;" type="button" value="&laquo;<?php _e('START HERE', _SQ_PLUGIN_NAME_) ?> &raquo;" />
14
 
15
  <?php
16
  } else {
26
 
27
  <div class="sq_helpcontent" style="display: none; clear: left; <?php echo (SQ_Tools::$options['sq_api'] == '') ? 'text-align: center;' : '' ?>">
28
  <div style="width: 700px; display: inline-block;">
29
+ <div style="font-size: 24px; margin: 30px 0; color: #999;">Learn About Squirrly's Features (click on the images):</div>
30
  <ul class="sq_slidelist">
31
  <li>
32
  <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>
82
  </li>
83
  <li>
84
  <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>
85
+ <div>Measure Your Success with Squirrly</div>
86
  </li>
87
  <li>
88
  <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>
themes/default/SQ_BlockPostsAnalytics.php CHANGED
@@ -1,24 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <div id="sq_posts">
2
  <span class="sq_icon"></span>
3
 
 
4
  <div id="sq_posts_title"><?php _e('Squirrly Analytics', _SQ_PLUGIN_NAME_); ?> </div>
5
  <div id="sq_posts_subtitle"><?php _e('Don\'t see all your pages here? Make sure you optimize them with Squirrly, so that we can track them, and display you the analytics', _SQ_PLUGIN_NAME_); ?> </div>
6
- <?php
7
- if (get_transient('google_blocked') !== false) {
8
- echo '<div id="sq_posts_subtitle" style="font-size: 14px;color: red;padding: 0px;margin: 0 0 15px 0;text-align: center;line-height: 15px;">';
9
- if (function_exists('curl_init') && !ini_get('open_basedir')) {
10
- echo sprintf(__('The IP %s is calling the rank too often and google stopped the calls for %s mins. Lower the Rank check rate in Squirrly > Settings > Rank Option. %sMore details%s', _SQ_PLUGIN_NAME_), @gethostbyname(gethostname()), (((get_transient('google_blocked')- time() + 3600) > 0) ? date('i',(get_transient('google_blocked')- time() + 3600)) : 'an hour'),'<a href="http://howto.squirrly.co/wordpress-seo/could-not-receive-data-from-google-err-blocked-ip/" target="_blank" >','</a>');
11
- } else {
12
- if (!function_exists('curl_init')) {
13
- echo sprintf(__('To be able to check the RANK please activate cURL for PHP on your server %sDetails%s', _SQ_PLUGIN_NAME_), '<a href="http://stackoverflow.com/questions/1347146/how-to-enable-curl-in-php-xampp" target="_blank">', '</a>');
14
- } else {
15
- echo sprintf(__('To be able to check the RANK please remove the "safe_mode" and "open_basedir" for PHP cURL on your server %sDetails%s', _SQ_PLUGIN_NAME_), '<a href="http://stackoverflow.com/a/6918685" target="_blank">', '</a>');
16
-
17
- }
18
- }
19
- echo '</div>';
20
- }
21
- ?>
22
 
23
  <?php echo $view->getNavigationTop() ?>
24
  <table class="wp-list-table widefat fixed posts" cellspacing="0">
1
+ <?php
2
+ if (SQ_Tools::$options['sq_google_ranksperhour'] > 0) {
3
+ $blog_ip = @gethostbyname(gethostname());
4
+ if (isset($blog_ip)){
5
+ if (strpos($blog_ip, '192.') === 0){
6
+ echo '<div class="notice sq_message"><p>';
7
+ echo sprintf(__("You can't check the Google Rank from a local server. You need a shared or a dedicated hosting plan for this option.", _SQ_PLUGIN_NAME_));
8
+ echo '</p></div>';
9
+ }
10
+ }
11
+
12
+ if (get_transient('google_blocked') !== false) {
13
+ echo '<div id="notice sq_message" style="font-size: 14px;color: red;padding: 0px;margin: 0 0 15px 0;text-align: center;line-height: 15px;"><p>';
14
+ if (function_exists('curl_init') && !ini_get('open_basedir')) {
15
+ echo sprintf(__('The IP %s is calling the rank too often and google stopped the calls for %s mins. Lower the Rank check rate in Squirrly > Advanced > Rank Option. %sMore details%s', _SQ_PLUGIN_NAME_),$blog_ip, (((get_transient('google_blocked') - time() + 3600) > 0) ? date('i', (get_transient('google_blocked') - time() + 3600)) : 'an hour'), '<a href="http://howto.squirrly.co/wordpress-seo/could-not-receive-data-from-google-err-blocked-ip/" target="_blank" >', '</a>');
16
+ }
17
+ echo '</p></div>';
18
+ } elseif (!function_exists('curl_init')) {
19
+ echo '<div class="notice sq_message"><p>';
20
+ echo sprintf(__('To be able to check the RANK please activate cURL for PHP on your server %sDetails%s', _SQ_PLUGIN_NAME_), '<a href="http://stackoverflow.com/questions/1347146/how-to-enable-curl-in-php-xampp" target="_blank">', '</a>');
21
+ echo '</p></div>';
22
+ } elseif (ini_get('open_basedir') <> '') {
23
+ echo '<div class="notice sq_message"><p>';
24
+ echo sprintf(__('To be able to check the RANK please set the "open_basedir" to NULL on your server %sDetails%s', _SQ_PLUGIN_NAME_), '<a href="http://stackoverflow.com/a/6918685" target="_blank">', '</a>');
25
+ echo '</p></div>';
26
+ }
27
+ } else {
28
+ echo '<div class="notice sq_message"><p>';
29
+ echo sprintf(__('To see the Google Ranking for each article you need to select how many pages to be checked by google rank every hour from %sSquirrly > Advanced > Google Rank Option%s. ', _SQ_PLUGIN_NAME_), '<a href="' . admin_url('admin.php?page=sq_settings') . '">', '</a>');
30
+ echo '</p></div>';
31
+
32
+ }
33
+ ?>
34
  <div id="sq_posts">
35
  <span class="sq_icon"></span>
36
 
37
+
38
  <div id="sq_posts_title"><?php _e('Squirrly Analytics', _SQ_PLUGIN_NAME_); ?> </div>
39
  <div id="sq_posts_subtitle"><?php _e('Don\'t see all your pages here? Make sure you optimize them with Squirrly, so that we can track them, and display you the analytics', _SQ_PLUGIN_NAME_); ?> </div>
40
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  <?php echo $view->getNavigationTop() ?>
43
  <table class="wp-list-table widefat fixed posts" cellspacing="0">
themes/default/SQ_BlockSettings.php CHANGED
@@ -3,7 +3,7 @@
3
  <div>
4
  <span class="sq_icon"></span>
5
 
6
- <div id="sq_settings_title"><?php _e('Settings', _SQ_PLUGIN_NAME_); ?> </div>
7
  <div id="sq_settings_title">
8
  <input type="submit" name="sq_update" value="<?php _e('Save settings', _SQ_PLUGIN_NAME_) ?> &raquo;"/>
9
  </div>
@@ -73,7 +73,7 @@
73
  <label for="sq_keyword_help0" class="sq_switch-label sq_switch-label-on"><?php _e('No', _SQ_PLUGIN_NAME_); ?></label>
74
  <span class="sq_switch-selection"></span>
75
  </div>
76
- <span><?php _e('Show <strong>Squirrly Tooltips</strong> posting a new article (e.g. "Enter a keyword").', _SQ_PLUGIN_NAME_); ?></span>
77
  </div>
78
 
79
  <div class="sq_option_content">
@@ -87,6 +87,16 @@
87
  <span><?php _e('Always show <strong>Keyword Research</strong> about the selected keyword.', _SQ_PLUGIN_NAME_); ?></span>
88
  </div>
89
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  <div class="sq_option_content">
92
  <div class="sq_switch">
@@ -108,7 +118,7 @@
108
  <label for="sq_keywordtag0" class="sq_switch-label sq_switch-label-on"><?php _e('No', _SQ_PLUGIN_NAME_); ?></label>
109
  <span class="sq_switch-selection"></span>
110
  </div>
111
- <span><?php _e('Add the Post tags in <strong>META keyword</strong>.', _SQ_PLUGIN_NAME_); ?></span>
112
  </div>
113
 
114
  <div class="sq_option_content">
@@ -140,6 +150,7 @@
140
  <legend>
141
  <span class="sq_legend_title"><?php _e('Google Rank Options', _SQ_PLUGIN_NAME_); ?></span>
142
  <span><?php echo sprintf(__('%sCountry targeting%s', _SQ_PLUGIN_NAME_), '<a href="https://support.google.com/webmasters/answer/62399?hl=en" target="_blank">', '</a>'); ?></span>
 
143
  </legend>
144
  <div>
145
  <div class="sq_option_content">
@@ -250,24 +261,31 @@
250
  <option value="com.ua"><?php _e('Ukraine', _SQ_PLUGIN_NAME_); ?> (http://www.google.com.ua/)</option>
251
  <option value="ae"><?php _e('United Arab Emirates', _SQ_PLUGIN_NAME_); ?> (http://www.google.ae/)</option>
252