SEO SQUIRRLY™ - Version 11.0.02

Version Description

  • 02/17/2021 = Update - Added the option to delete keywords from Keyword Suggestion Update - Changed the Ranking column in Briefcase Update - Added a new menu in Ranking Page for Keyword Sync with GSC Update - Show more results in Keyword Research Tool Update - Select up to 3 keyword suggestions in the Research Process Update - Make the main keyword more visible in the Focus Page section Update - The limit for Google News to match the number of Posts per Page from Sitemap XML Fixed - UI in Briefcase to look more friendly Fixed - Already in SERP Checker button to show when a keyword is already added in Rankings Fixed - Make sure to save the optimizations for all keywords in Live Assistant > Briefcase Fixed - Corrected te Article Word Count with Readability in Focus Pages Increased plugin security and update compatibilities
Download this release

Release Info

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

Code changes from version 11.0.01 to 11.0.02

Files changed (48) hide show
  1. classes/RemoteController.php +30 -8
  2. classes/helpers/Sanitize.php +0 -22
  3. classes/helpers/Tools.php +4 -8
  4. config.json +1 -0
  5. config/config.php +1 -1
  6. controllers/Api.php +2 -2
  7. controllers/Audits.php +2 -4
  8. controllers/CheckSeo.php +21 -4
  9. controllers/Menu.php +13 -11
  10. controllers/Overview.php +1 -1
  11. controllers/PostsList.php +17 -9
  12. controllers/Research.php +29 -0
  13. controllers/SeoSettings.php +3 -2
  14. controllers/Sitemaps.php +13 -10
  15. core/Blocklogin.php +2 -2
  16. models/CheckSeo.php +21 -19
  17. models/Frontend.php +1 -1
  18. models/ImportExport.php +42 -39
  19. models/Menu.php +6 -0
  20. models/Post.php +5 -5
  21. models/Qss.php +16 -23
  22. models/focuspages/Clicks.php +1 -1
  23. models/focuspages/Content.php +1 -1
  24. models/focuspages/Ctr.php +1 -1
  25. models/focuspages/Image.php +1 -1
  26. models/focuspages/Impressions.php +1 -1
  27. models/focuspages/Innerlinks.php +1 -1
  28. models/focuspages/Keyword.php +2 -2
  29. models/focuspages/Snippet.php +1 -1
  30. models/focuspages/Strategy.php +1 -1
  31. models/services/JsonLD.php +114 -0
  32. models/services/Pixel.php +3 -6
  33. readme.txt +15 -1
  34. squirrly.php +2 -2
  35. uninstall.php +2 -1
  36. view/Blocks/Dashboard.php +3 -3
  37. view/Blocks/Login.php +0 -2
  38. view/Blocks/Snippet.php +2 -2
  39. view/Blocks/Stats.php +1 -13
  40. view/Ranking/Gscsync.php +7 -5
  41. view/Research/Briefcase.php +12 -5
  42. view/Research/Research.php +5 -6
  43. view/Research/ResearchDetails.php +2 -2
  44. view/Research/Suggested.php +10 -16
  45. view/SeoSettings/Sitemap.php +2 -0
  46. view/assets/img/settings/banner.png +0 -0
  47. view/assets/js/briefcase.min.js +1 -1
  48. view/assets/js/research.min.js +1 -1
classes/RemoteController.php CHANGED
@@ -87,7 +87,7 @@ class SQ_Classes_RemoteController {
87
  */
88
  public static function getMySquirrlyLink($path) {
89
  if (SQ_Classes_Helpers_Tools::getMenuVisible('show_panel') && current_user_can('sq_manage_settings')) {
90
- return _SQ_DASH_URL_ . 'login/?token=' . SQ_Classes_Helpers_Tools::getOption('sq_api') . '&user_url=' . get_bloginfo('url') . '&redirect_to=' . _SQ_DASH_URL_ . 'user/' . $path;
91
  } else {
92
  return _SQ_DASH_URL_;
93
  }
@@ -101,7 +101,7 @@ class SQ_Classes_RemoteController {
101
  * @return string
102
  */
103
  public static function getApiLink($path) {
104
- return _SQ_APIV2_URL_ . $path . '?token=' . SQ_Classes_Helpers_Tools::getOption('sq_api') . '&url=' . get_bloginfo('url');
105
  }
106
 
107
  /**
@@ -575,6 +575,29 @@ class SQ_Classes_RemoteController {
575
 
576
  /******************************** KEYWORD RESEARCH ****************/
577
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
578
  public static function getKROthers($args = array()) {
579
  self::$apimethod = 'get'; //call method
580
 
@@ -635,6 +658,7 @@ class SQ_Classes_RemoteController {
635
  return false;
636
  }
637
 
 
638
 
639
  /**
640
  * Get Keyword Research History
@@ -682,15 +706,14 @@ class SQ_Classes_RemoteController {
682
  return false;
683
  }
684
 
685
- /**
686
- * Get KR Countries
687
  * @param array $args
688
  * @return bool|WP_Error
689
  */
690
- public static function getKrCountries($args = array()) {
691
- self::$apimethod = 'get'; //call method
692
 
693
- $json = json_decode(self::apiCall('api/kr/countries', $args));
694
 
695
  if (isset($json->error) && $json->error <> '') {
696
  return (new WP_Error('api_error', $json->error));
@@ -704,7 +727,6 @@ class SQ_Classes_RemoteController {
704
 
705
  return false;
706
  }
707
-
708
  /******************** WP Posts ***************************/
709
  /**
710
  * Save the post status on API
87
  */
88
  public static function getMySquirrlyLink($path) {
89
  if (SQ_Classes_Helpers_Tools::getMenuVisible('show_panel') && current_user_can('sq_manage_settings')) {
90
+ return _SQ_DASH_URL_ . 'login/?token=' . SQ_Classes_Helpers_Tools::getOption('sq_api') . '&user_url=' . apply_filters('sq_homeurl', get_bloginfo('url')) . '&redirect_to=' . _SQ_DASH_URL_ . 'user/' . $path;
91
  } else {
92
  return _SQ_DASH_URL_;
93
  }
101
  * @return string
102
  */
103
  public static function getApiLink($path) {
104
+ return _SQ_APIV2_URL_ . $path . '?token=' . SQ_Classes_Helpers_Tools::getOption('sq_api') . '&url=' . apply_filters('sq_homeurl', get_bloginfo('url'));
105
  }
106
 
107
  /**
575
 
576
  /******************************** KEYWORD RESEARCH ****************/
577
 
578
+ /**
579
+ * Get KR Countries
580
+ * @param array $args
581
+ * @return bool|WP_Error
582
+ */
583
+ public static function getKrCountries($args = array()) {
584
+ self::$apimethod = 'get'; //call method
585
+
586
+ $json = json_decode(self::apiCall('api/kr/countries', $args));
587
+
588
+ if (isset($json->error) && $json->error <> '') {
589
+ return (new WP_Error('api_error', $json->error));
590
+ } elseif (!isset($json->data)) {
591
+ return (new WP_Error('api_error', 'no_data'));
592
+ }
593
+
594
+ if (!empty($json->data)) {
595
+ return $json->data;
596
+ }
597
+
598
+ return false;
599
+ }
600
+
601
  public static function getKROthers($args = array()) {
602
  self::$apimethod = 'get'; //call method
603
 
658
  return false;
659
  }
660
 
661
+ /******************************** KEYWORD HISTORY & FOUND ****************/
662
 
663
  /**
664
  * Get Keyword Research History
706
  return false;
707
  }
708
 
709
+ /** Remove Keyword from Suggestions
 
710
  * @param array $args
711
  * @return bool|WP_Error
712
  */
713
+ public static function removeKrFound($args = array()) {
714
+ self::$apimethod = 'post'; //call method
715
 
716
+ $json = json_decode(self::apiCall('api/kr/found/delete', $args));
717
 
718
  if (isset($json->error) && $json->error <> '') {
719
  return (new WP_Error('api_error', $json->error));
727
 
728
  return false;
729
  }
 
730
  /******************** WP Posts ***************************/
731
  /**
732
  * Save the post status on API
classes/helpers/Sanitize.php CHANGED
@@ -63,28 +63,6 @@ class SQ_Classes_Helpers_Sanitize {
63
  return self::clearTitle($keywords);
64
  }
65
 
66
- /**
67
- * Escape the keyword for tags and urls
68
- * @param $str
69
- * @return string
70
- */
71
- public static function escapeAttr($str) {
72
- $str = esc_attr($str);
73
-
74
- return $str;
75
- }
76
-
77
- /**
78
- * Escape the keyword for tags and urls
79
- * @param $str
80
- * @return string
81
- */
82
- public static function escapeHtml($str) {
83
- $str = esc_attr($str);
84
-
85
- return $str;
86
- }
87
-
88
  /**
89
  * Escape the keyword for tags and urls
90
  * @param $keyword
63
  return self::clearTitle($keywords);
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * Escape the keyword for tags and urls
68
  * @param $keyword
classes/helpers/Tools.php CHANGED
@@ -338,7 +338,7 @@ class SQ_Classes_Helpers_Tools {
338
  'description' => '{{excerpt}}',
339
  'noindex' => 0,
340
  'nofollow' => 0,
341
- 'og_type' => 'article',
342
  'do_metas' => 1,
343
  'do_sitemap' => 1,
344
  'do_jsonld' => 1,
@@ -910,11 +910,11 @@ class SQ_Classes_Helpers_Tools {
910
  * @return bool|false|int
911
  */
912
  public static function findStr($content, $string, $normalize = false) {
913
- if($normalize) {
914
  //Check if the search requires char normalization
915
  $content = SQ_Classes_Helpers_Sanitize::normalizeChars($content);
916
  $string = SQ_Classes_Helpers_Sanitize::normalizeChars($string);
917
- }else{
918
  //decode the content to match quotes and special chars
919
  $content = html_entity_decode($content, ENT_QUOTES);
920
  $string = html_entity_decode($string, ENT_QUOTES);
@@ -933,11 +933,7 @@ class SQ_Classes_Helpers_Tools {
933
  * Load the multilanguage support from .mo
934
  */
935
  private function loadMultilanguage() {
936
- if (!defined('WP_PLUGIN_DIR')) {
937
- load_plugin_textdomain(_SQ_PLUGIN_NAME_, _SQ_PLUGIN_NAME_ . '/languages/');
938
- } else {
939
- load_plugin_textdomain(_SQ_PLUGIN_NAME_, null, _SQ_PLUGIN_NAME_ . '/languages/');
940
- }
941
  }
942
 
943
 
338
  'description' => '{{excerpt}}',
339
  'noindex' => 0,
340
  'nofollow' => 0,
341
+ 'og_type' => 'newsarticle',
342
  'do_metas' => 1,
343
  'do_sitemap' => 1,
344
  'do_jsonld' => 1,
910
  * @return bool|false|int
911
  */
912
  public static function findStr($content, $string, $normalize = false) {
913
+ if ($normalize) {
914
  //Check if the search requires char normalization
915
  $content = SQ_Classes_Helpers_Sanitize::normalizeChars($content);
916
  $string = SQ_Classes_Helpers_Sanitize::normalizeChars($string);
917
+ } else {
918
  //decode the content to match quotes and special chars
919
  $content = html_entity_decode($content, ENT_QUOTES);
920
  $string = html_entity_decode($string, ENT_QUOTES);
933
  * Load the multilanguage support from .mo
934
  */
935
  private function loadMultilanguage() {
936
+ load_plugin_textdomain(_SQ_PLUGIN_NAME_, false, _SQ_PLUGIN_NAME_ . '/languages/');
 
 
 
 
937
  }
938
 
939
 
config.json CHANGED
@@ -163,6 +163,7 @@
163
  "sq_briefcase_addkeyword",
164
  "sq_briefcase_deletekeyword",
165
  "sq_briefcase_deletelabel",
 
166
  "sq_briefcase_backup",
167
  "sq_briefcase_restore",
168
  "sq_ajax_briefcase_doserp",
163
  "sq_briefcase_addkeyword",
164
  "sq_briefcase_deletekeyword",
165
  "sq_briefcase_deletelabel",
166
+ "sq_briefcase_deletefound",
167
  "sq_briefcase_backup",
168
  "sq_briefcase_restore",
169
  "sq_ajax_briefcase_doserp",
config/config.php CHANGED
@@ -58,7 +58,7 @@ define('SQ_ALL_PATTERNS', wp_json_encode(array(
58
  '{{product_currency}}' => esc_html__("Adds the product price currency from Woocommerce for the current product", _SQ_PLUGIN_NAME_),
59
  )));
60
 
61
- define('SQ_ALL_JSONLD_TYPES', wp_json_encode(array('website','profile','article','book','music','product','video')));
62
 
63
  define('SQ_ALL_SEP', wp_json_encode(array(
64
  'sc-dash' => '-',
58
  '{{product_currency}}' => esc_html__("Adds the product price currency from Woocommerce for the current product", _SQ_PLUGIN_NAME_),
59
  )));
60
 
61
+ define('SQ_ALL_JSONLD_TYPES', wp_json_encode(array('website','profile','article','newsarticle','book','music','product','video')));
62
 
63
  define('SQ_ALL_SEP', wp_json_encode(array(
64
  'sc-dash' => '-',
controllers/Api.php CHANGED
@@ -152,10 +152,10 @@ class SQ_Controllers_Api extends SQ_Classes_FrontController {
152
  //get post inner links
153
  $total_posts = 0;
154
  $inner_links = array();
155
- if ($row = $wpdb->get_row("SELECT COUNT(`ID`) as count FROM " . $wpdb->posts . " WHERE `post_status` = 'publish'")) {
156
  $total_posts = $row->count;
157
  }
158
- if ($rows = $wpdb->get_results("SELECT `ID` FROM " . $wpdb->posts . " WHERE `post_content` LIKE '%" . $url . "%' AND `post_status` = 'publish'", OBJECT)) {
159
  if (!empty($rows)) {
160
  foreach ($rows as $row) {
161
  $post = SQ_Classes_ObjController::getClass('SQ_Models_Snippet')->setPostByID($row->ID);
152
  //get post inner links
153
  $total_posts = 0;
154
  $inner_links = array();
155
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT COUNT(`ID`) as count FROM `$wpdb->posts` WHERE `post_status` = %s", 'publish'))) {
156
  $total_posts = $row->count;
157
  }
158
+ if ($rows = $wpdb->get_results($wpdb->prepare("SELECT `ID` FROM `$wpdb->posts` WHERE `post_content` LIKE '%%%s%' AND `post_status` = %s", $url, 'publish'), OBJECT)) {
159
  if (!empty($rows)) {
160
  foreach ($rows as $row) {
161
  $post = SQ_Classes_ObjController::getClass('SQ_Models_Snippet')->setPostByID($row->ID);
controllers/Audits.php CHANGED
@@ -57,6 +57,8 @@ class SQ_Controllers_Audits extends SQ_Classes_FrontController {
57
  //@ob_flush();
58
  echo $this->getView('Audits/' . ucfirst($tab));
59
 
 
 
60
  }
61
 
62
  /**
@@ -142,8 +144,6 @@ class SQ_Controllers_Audits extends SQ_Classes_FrontController {
142
  SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('scrolltotop');
143
  SQ_Classes_Error::clearErrors();
144
 
145
- //get the modal window for the assistant popup
146
- echo SQ_Classes_ObjController::getClass('SQ_Models_Assistant')->getModal();
147
  }
148
 
149
  public function audits() {
@@ -153,8 +153,6 @@ class SQ_Controllers_Audits extends SQ_Classes_FrontController {
153
  SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('knob');
154
 
155
  $this->setAuditPages();
156
- //get the modal window for the assistant popup
157
- echo SQ_Classes_ObjController::getClass('SQ_Models_Assistant')->getModal();
158
  }
159
 
160
  /**
57
  //@ob_flush();
58
  echo $this->getView('Audits/' . ucfirst($tab));
59
 
60
+ //get the modal window for the assistant popup
61
+ echo SQ_Classes_ObjController::getClass('SQ_Models_Assistant')->getModal();
62
  }
63
 
64
  /**
144
  SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('scrolltotop');
145
  SQ_Classes_Error::clearErrors();
146
 
 
 
147
  }
148
 
149
  public function audits() {
153
  SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('knob');
154
 
155
  $this->setAuditPages();
 
 
156
  }
157
 
158
  /**
controllers/CheckSeo.php CHANGED
@@ -56,6 +56,7 @@ class SQ_Controllers_CheckSeo extends SQ_Classes_FrontController {
56
  $this->model->dbtasks['count_tasks_for_today'] = 3; //Show 3 goals per day
57
  }
58
 
 
59
  $tasks_for_today = isset($this->model->dbtasks['tasks_for_today']) ? $this->model->dbtasks['tasks_for_today'] : array();
60
  if (!isset($tasks_for_today[date('Y-m-d')]) || count($tasks_for_today[date('Y-m-d')]) < $this->model->dbtasks['count_tasks_for_today']) {
61
  //If the tasks for today are not yet set
@@ -63,11 +64,25 @@ class SQ_Controllers_CheckSeo extends SQ_Classes_FrontController {
63
  } else {
64
  //update the report to todays tasks
65
  foreach ($report as $function => $row) {
 
 
 
 
 
 
 
 
 
66
  if (isset($tasks_for_today[date('Y-m-d')][$function])) {
67
  $tasks_for_today[date('Y-m-d')][$function] = $row;
68
  }
69
  }
70
 
 
 
 
 
 
71
  //get the report from todays tasks
72
  $report = $tasks_for_today[date('Y-m-d')];
73
  }
@@ -153,6 +168,7 @@ class SQ_Controllers_CheckSeo extends SQ_Classes_FrontController {
153
  }
154
  }
155
 
 
156
  //Set the todays tasks if empty
157
  if (empty($tasks_for_today[date('Y-m-d')])) {
158
  $count = 1;
@@ -169,12 +185,12 @@ class SQ_Controllers_CheckSeo extends SQ_Classes_FrontController {
169
  }
170
 
171
  //Verify the goals gor today completion and progress
172
- if(!empty($tasks_for_today[date('Y-m-d')])) {
173
 
174
  $countdone = 0;
175
  foreach ($tasks_for_today[date('Y-m-d')] as $function => $task) {
176
 
177
- if(!isset($report[$function])){ //in case the goal was removed from API
178
  //remove the daily goal and move on
179
  unset($tasks_for_today[date('Y-m-d')][$function]);
180
  continue;
@@ -187,8 +203,9 @@ class SQ_Controllers_CheckSeo extends SQ_Classes_FrontController {
187
  }
188
 
189
  //Calculate today's progress
190
- $this->score = number_format((100 * $countdone) / count($tasks_for_today[date('Y-m-d')]), 0);
191
-
 
192
 
193
  }
194
 
56
  $this->model->dbtasks['count_tasks_for_today'] = 3; //Show 3 goals per day
57
  }
58
 
59
+ $urgent_tasks = array();
60
  $tasks_for_today = isset($this->model->dbtasks['tasks_for_today']) ? $this->model->dbtasks['tasks_for_today'] : array();
61
  if (!isset($tasks_for_today[date('Y-m-d')]) || count($tasks_for_today[date('Y-m-d')]) < $this->model->dbtasks['count_tasks_for_today']) {
62
  //If the tasks for today are not yet set
64
  } else {
65
  //update the report to todays tasks
66
  foreach ($report as $function => $row) {
67
+ //Limit today tasks
68
+ if (isset($tasks[$function]['priority']) && $tasks[$function]['priority'] == 1) {
69
+ if (!isset($tasks[$function]['positive'])) $tasks[$function]['positive'] = false;
70
+
71
+ if (!$tasks[$function]['positive'] && isset($row['completed']) && !$row['completed']) {
72
+ $urgent_tasks[$function] = $row;
73
+ }
74
+ }
75
+
76
  if (isset($tasks_for_today[date('Y-m-d')][$function])) {
77
  $tasks_for_today[date('Y-m-d')][$function] = $row;
78
  }
79
  }
80
 
81
+ //add the urgent tasks first in the todays tasks
82
+ if (!empty($urgent_tasks)) {
83
+ $tasks_for_today[date('Y-m-d')] = array_merge($urgent_tasks, $tasks_for_today[date('Y-m-d')]);
84
+ }
85
+
86
  //get the report from todays tasks
87
  $report = $tasks_for_today[date('Y-m-d')];
88
  }
168
  }
169
  }
170
 
171
+
172
  //Set the todays tasks if empty
173
  if (empty($tasks_for_today[date('Y-m-d')])) {
174
  $count = 1;
185
  }
186
 
187
  //Verify the goals gor today completion and progress
188
+ if (!empty($tasks_for_today[date('Y-m-d')])) {
189
 
190
  $countdone = 0;
191
  foreach ($tasks_for_today[date('Y-m-d')] as $function => $task) {
192
 
193
+ if (!isset($report[$function])) { //in case the goal was removed from API
194
  //remove the daily goal and move on
195
  unset($tasks_for_today[date('Y-m-d')][$function]);
196
  continue;
203
  }
204
 
205
  //Calculate today's progress
206
+ if (count($tasks_for_today[date('Y-m-d')]) > 0) {
207
+ $this->score = number_format((100 * $countdone) / count($tasks_for_today[date('Y-m-d')]), 0);
208
+ }
209
 
210
  }
211
 
controllers/Menu.php CHANGED
@@ -49,7 +49,7 @@ class SQ_Controllers_Menu extends SQ_Classes_FrontController {
49
 
50
  if ($page <> 'sq_dashboard' && in_array($page, array_keys($menus))) {
51
  //redirect to dashboard to login
52
- wp_safe_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
53
  exit();
54
  }
55
  }
@@ -62,7 +62,7 @@ class SQ_Controllers_Menu extends SQ_Classes_FrontController {
62
  //redirect users to onboarding if necessary
63
  if (!$onboarding = SQ_Classes_Helpers_Tools::getOption('sq_onboarding')) {
64
  if ($page !== 'sq_onboarding') {
65
- wp_safe_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_onboarding'));
66
  die();
67
  }
68
  }
@@ -92,7 +92,7 @@ class SQ_Controllers_Menu extends SQ_Classes_FrontController {
92
  if (SQ_Classes_Helpers_Tools::getIsset('page')) {
93
  if (current_user_can('sq_manage_settings')) {
94
  if (SQ_Classes_Helpers_Tools::getValue('page') == 'sq_import') {
95
- wp_safe_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_seosettings', 'backup'));
96
  die();
97
  }
98
  }
@@ -115,7 +115,7 @@ class SQ_Controllers_Menu extends SQ_Classes_FrontController {
115
  SQ_Classes_ObjController::getClass('SQ_Classes_Helpers_DevKit')->updatePluginData();
116
 
117
  if (SQ_Classes_Helpers_Tools::getOption('sq_api') == '') {
118
- wp_safe_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
119
  die();
120
  }
121
  }
@@ -343,13 +343,15 @@ class SQ_Controllers_Menu extends SQ_Classes_FrontController {
343
  (SQ_Classes_Helpers_Tools::getOption('sq_devkit_logo') ? SQ_Classes_Helpers_Tools::getOption('sq_devkit_logo') : _SQ_ASSETS_URL_ . 'img/logos/menu_icon_16.png')
344
  ));
345
 
346
- $this->model->addSubmenu(array('sq_none',
347
- esc_html__("Squirrly Onboarding", _SQ_PLUGIN_NAME_),
348
- esc_html__("Onboarding", _SQ_PLUGIN_NAME_),
349
- 'edit_posts',
350
- 'sq_onboarding',
351
- array(SQ_Classes_ObjController::getClass('SQ_Controllers_Onboarding'), 'init')
352
- ));
 
 
353
 
354
  $mainmenu = $this->model->getMainMenu();
355
  foreach ($mainmenu as $name => $item) {
49
 
50
  if ($page <> 'sq_dashboard' && in_array($page, array_keys($menus))) {
51
  //redirect to dashboard to login
52
+ wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
53
  exit();
54
  }
55
  }
62
  //redirect users to onboarding if necessary
63
  if (!$onboarding = SQ_Classes_Helpers_Tools::getOption('sq_onboarding')) {
64
  if ($page !== 'sq_onboarding') {
65
+ wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_onboarding'));
66
  die();
67
  }
68
  }
92
  if (SQ_Classes_Helpers_Tools::getIsset('page')) {
93
  if (current_user_can('sq_manage_settings')) {
94
  if (SQ_Classes_Helpers_Tools::getValue('page') == 'sq_import') {
95
+ wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_seosettings', 'backup'));
96
  die();
97
  }
98
  }
115
  SQ_Classes_ObjController::getClass('SQ_Classes_Helpers_DevKit')->updatePluginData();
116
 
117
  if (SQ_Classes_Helpers_Tools::getOption('sq_api') == '') {
118
+ wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
119
  die();
120
  }
121
  }
343
  (SQ_Classes_Helpers_Tools::getOption('sq_devkit_logo') ? SQ_Classes_Helpers_Tools::getOption('sq_devkit_logo') : _SQ_ASSETS_URL_ . 'img/logos/menu_icon_16.png')
344
  ));
345
 
346
+ if (SQ_Classes_Helpers_Tools::getValue('page', '') == 'sq_onboarding' || !SQ_Classes_Helpers_Tools::getOption('sq_onboarding')) {
347
+ $this->model->addSubmenu(array('sq_dashboard',
348
+ esc_html__("Squirrly Onboarding", _SQ_PLUGIN_NAME_),
349
+ esc_html__("Onboarding", _SQ_PLUGIN_NAME_),
350
+ 'read',
351
+ 'sq_onboarding',
352
+ array(SQ_Classes_ObjController::getClass('SQ_Controllers_Onboarding'), 'init')
353
+ ));
354
+ }
355
 
356
  $mainmenu = $this->model->getMainMenu();
357
  foreach ($mainmenu as $name => $item) {
controllers/Overview.php CHANGED
@@ -70,7 +70,7 @@ class SQ_Controllers_Overview extends SQ_Classes_FrontController {
70
 
71
 
72
  public function getNotificationCompatibility() {
73
- if (SQ_Classes_Helpers_Tools::getOption('sq_alert_overview')) {
74
  add_filter('sq_plugins', array(SQ_Classes_ObjController::getClass('SQ_Models_ImportExport'), 'getActivePlugins'));
75
  $platforms = apply_filters('sq_importList', false);
76
  if ($platforms && count((array)$platforms) > 0) {
70
 
71
 
72
  public function getNotificationCompatibility() {
73
+ if (SQ_Classes_Helpers_Tools::getOption('sq_alert_overview') && SQ_Classes_Helpers_Tools::getOption('sq_api')) {
74
  add_filter('sq_plugins', array(SQ_Classes_ObjController::getClass('SQ_Models_ImportExport'), 'getActivePlugins'));
75
  $platforms = apply_filters('sq_importList', false);
76
  if ($platforms && count((array)$platforms) > 0) {
controllers/PostsList.php CHANGED
@@ -89,15 +89,23 @@ class SQ_Controllers_PostsList extends SQ_Classes_FrontController {
89
  }
90
 
91
  if ($column == $this->_slacolumn_id) {
92
- $cached = false;
93
- if (isset($_COOKIE[$this->_slacolumn_id . $post_id]) && $_COOKIE[$this->_slacolumn_id . $post_id] <> '') {
94
- $cached = true;
 
 
 
 
 
 
 
 
95
  } else {
96
  if (get_post_status($post_id) == 'publish')
97
  array_push($this->posts, $post_id);
98
  }
99
 
100
- echo '<div class="' . $this->_slacolumn_id . '_row" ref="' . $post_id . '">' . (($cached) ? $_COOKIE[$this->_slacolumn_id . $post_id] : 'loading ...') . '</div>';
101
  }
102
 
103
  if ($column == $this->_column_id) {
@@ -126,7 +134,7 @@ class SQ_Controllers_PostsList extends SQ_Classes_FrontController {
126
  * @param integer $post_id
127
  */
128
  public function add_tax_row($html = '', $column = 0, $tax_id = 0) {
129
- if((int)$tax_id > 0 && (int)$column > 0 ) {
130
  $term = get_term($tax_id);
131
 
132
  if (!is_wp_error($term) && $column == $this->_column_id) {
@@ -197,13 +205,13 @@ class SQ_Controllers_PostsList extends SQ_Classes_FrontController {
197
  if ($json = SQ_Classes_RemoteController::getPostOptimization($args)) {
198
  if (is_wp_error($json)) {
199
  $array = array();
200
- if($json->get_error_message() == 'no_data') {
201
  foreach ($posts as $post_id) {
202
- $array[$post_id] = esc_html__("Network Error. Please Refresh.",_SQ_PLUGIN_NAME_);
203
  }
204
- }elseif($json->get_error_message() == 'maintenance') {
205
  foreach ($posts as $post_id) {
206
- $array[$post_id] = sprintf(esc_html__("Maintenance. %sWe'll be back in a minute.",_SQ_PLUGIN_NAME_),'<br />');
207
  }
208
  }
209
 
89
  }
90
 
91
  if ($column == $this->_slacolumn_id) {
92
+ $html = false;
93
+ if (SQ_Classes_Helpers_Tools::isAjax()) {
94
+ $args = array();
95
+ $args['posts'] = $post_id;
96
+
97
+ if ($json = SQ_Classes_RemoteController::getPostOptimization($args)) {
98
+ if (!is_wp_error($json)) {
99
+ $posts = $this->model->processPost($json, $post_type);
100
+ $html = $posts[$post_id];
101
+ }
102
+ }
103
  } else {
104
  if (get_post_status($post_id) == 'publish')
105
  array_push($this->posts, $post_id);
106
  }
107
 
108
+ echo '<div class="' . $this->_slacolumn_id . '_row" ref="' . $post_id . '">' . (($html) ? $html: 'loading ...') . '</div>';
109
  }
110
 
111
  if ($column == $this->_column_id) {
134
  * @param integer $post_id
135
  */
136
  public function add_tax_row($html = '', $column = 0, $tax_id = 0) {
137
+ if ((int)$tax_id > 0 && (int)$column > 0) {
138
  $term = get_term($tax_id);
139
 
140
  if (!is_wp_error($term) && $column == $this->_column_id) {
205
  if ($json = SQ_Classes_RemoteController::getPostOptimization($args)) {
206
  if (is_wp_error($json)) {
207
  $array = array();
208
+ if ($json->get_error_message() == 'no_data') {
209
  foreach ($posts as $post_id) {
210
+ $array[$post_id] = esc_html__("Network Error. Please Refresh.", _SQ_PLUGIN_NAME_);
211
  }
212
+ } elseif ($json->get_error_message() == 'maintenance') {
213
  foreach ($posts as $post_id) {
214
+ $array[$post_id] = sprintf(esc_html__("Maintenance. %sWe'll be back in a minute.", _SQ_PLUGIN_NAME_), '<br />');
215
  }
216
  }
217
 
controllers/Research.php CHANGED
@@ -112,6 +112,7 @@ class SQ_Controllers_Research extends SQ_Classes_FrontController {
112
 
113
  wp_enqueue_style('wp-color-picker');
114
  wp_enqueue_script('wp-color-picker');
 
115
  SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('briefcase');
116
 
117
  }
@@ -134,6 +135,7 @@ class SQ_Controllers_Research extends SQ_Classes_FrontController {
134
 
135
  wp_enqueue_style('wp-color-picker');
136
  wp_enqueue_script('wp-color-picker');
 
137
  SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('briefcase');
138
 
139
  }
@@ -152,6 +154,11 @@ class SQ_Controllers_Research extends SQ_Classes_FrontController {
152
 
153
  $this->suggested = SQ_Classes_RemoteController::getKrFound();
154
 
 
 
 
 
 
155
  }
156
 
157
  function history() {
@@ -240,6 +247,28 @@ class SQ_Controllers_Research extends SQ_Classes_FrontController {
240
  echo wp_json_encode(array('error' => esc_html__("Invalid params!", _SQ_PLUGIN_NAME_)));
241
  }
242
  exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  /**********************************/
244
  case 'sq_briefcase_addlabel':
245
  if (!current_user_can('sq_manage_snippet')) {
112
 
113
  wp_enqueue_style('wp-color-picker');
114
  wp_enqueue_script('wp-color-picker');
115
+
116
  SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('briefcase');
117
 
118
  }
135
 
136
  wp_enqueue_style('wp-color-picker');
137
  wp_enqueue_script('wp-color-picker');
138
+
139
  SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('briefcase');
140
 
141
  }
154
 
155
  $this->suggested = SQ_Classes_RemoteController::getKrFound();
156
 
157
+ wp_enqueue_style('wp-color-picker');
158
+ wp_enqueue_script('wp-color-picker');
159
+
160
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('briefcase');
161
+
162
  }
163
 
164
  function history() {
247
  echo wp_json_encode(array('error' => esc_html__("Invalid params!", _SQ_PLUGIN_NAME_)));
248
  }
249
  exit();
250
+ case 'sq_briefcase_deletefound':
251
+ if (!current_user_can('sq_manage_settings')) {
252
+ $response['error'] = SQ_Classes_Error::showNotices(esc_html__("You do not have permission to perform this action", _SQ_PLUGIN_NAME_), 'sq_error');
253
+ SQ_Classes_Helpers_Tools::setHeader('json');
254
+ echo wp_json_encode($response);
255
+ exit();
256
+ }
257
+
258
+ SQ_Classes_Helpers_Tools::setHeader('json');
259
+ $keyword = (string)SQ_Classes_Helpers_Tools::getValue('keyword', '');
260
+
261
+ if ($keyword <> '') {
262
+ //set ignore on API
263
+ $args = array();
264
+ $args['keyword'] = stripslashes($keyword);
265
+ SQ_Classes_RemoteController::removeKrFound($args);
266
+
267
+ echo wp_json_encode(array('message' => esc_html__("Deleted!", _SQ_PLUGIN_NAME_)));
268
+ } else {
269
+ echo wp_json_encode(array('error' => esc_html__("Invalid params!", _SQ_PLUGIN_NAME_)));
270
+ }
271
+ exit();
272
  /**********************************/
273
  case 'sq_briefcase_addlabel':
274
  if (!current_user_can('sq_manage_snippet')) {
controllers/SeoSettings.php CHANGED
@@ -450,7 +450,8 @@ class SQ_Controllers_SeoSettings extends SQ_Classes_FrontController {
450
 
451
  if ($sql_file <> '' && strpos($sql_file, 'CREATE TABLE IF NOT EXISTS') !== false) {
452
  try {
453
- $queries = explode(";\n", $sql_file);
 
454
  SQ_Classes_ObjController::getClass('SQ_Models_ImportExport')->executeSql($queries);
455
  SQ_Classes_Error::setError(esc_html__("Great! The SEO backup is restored.", _SQ_PLUGIN_NAME_) . " <br /> ", 'success');
456
 
@@ -565,7 +566,7 @@ class SQ_Controllers_SeoSettings extends SQ_Classes_FrontController {
565
  case 'sq_alerts_close':
566
  //remove the specified alert from showing again
567
  if ($alert = SQ_Classes_Helpers_Tools::getValue('alert', false)) {
568
- if (in_array($alert, array('sq_alert_overview','sq_alert_journey'))) {
569
  SQ_Classes_Helpers_Tools::saveOptions($alert, false);
570
  }
571
  }
450
 
451
  if ($sql_file <> '' && strpos($sql_file, 'CREATE TABLE IF NOT EXISTS') !== false) {
452
  try {
453
+ $queries = explode(";" . PHP_EOL, $sql_file);
454
+ $queries = str_replace(PHP_EOL, "", $queries);
455
  SQ_Classes_ObjController::getClass('SQ_Models_ImportExport')->executeSql($queries);
456
  SQ_Classes_Error::setError(esc_html__("Great! The SEO backup is restored.", _SQ_PLUGIN_NAME_) . " <br /> ", 'success');
457
 
566
  case 'sq_alerts_close':
567
  //remove the specified alert from showing again
568
  if ($alert = SQ_Classes_Helpers_Tools::getValue('alert', false)) {
569
+ if (in_array($alert, array('sq_alert_overview', 'sq_alert_journey'))) {
570
  SQ_Classes_Helpers_Tools::saveOptions($alert, false);
571
  }
572
  }
controllers/Sitemaps.php CHANGED
@@ -10,11 +10,12 @@ class SQ_Controllers_Sitemaps extends SQ_Classes_FrontController {
10
  var $root = 'sitemap';
11
  /* @var string post limit */
12
  var $posts_limit;
13
- var $news_limit = 10;
14
 
15
  public function __construct() {
16
  parent::__construct();
17
  $this->posts_limit = SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage');
 
18
  add_filter('sq_sitemap_style', array($this, 'getFeedStyle'));
19
  add_action('wp', array($this, 'hookPreventRedirect'), 9);
20
 
@@ -538,14 +539,14 @@ class SQ_Controllers_Sitemaps extends SQ_Classes_FrontController {
538
  */
539
  public function customTaxFilter($query, $args) {
540
  global $wpdb;
541
- $query[] = "(SELECT
542
  UNIX_TIMESTAMP(MAX(p.post_date_gmt)) as _mod_date
543
- FROM {$wpdb->posts} p, {$wpdb->term_relationships} r
544
  WHERE p.ID = r.object_id
545
- AND p.post_status = 'publish'
546
  AND p.post_password = ''
547
  AND r.term_taxonomy_id = tt.term_taxonomy_id
548
- ) as lastmod";
549
 
550
 
551
  return $query;
@@ -563,10 +564,12 @@ class SQ_Controllers_Sitemaps extends SQ_Classes_FrontController {
563
  }
564
 
565
  public function userFilter($query) {
 
 
566
  $query->query_fields .= ',p.lastmod';
567
  $query->query_from .= ' LEFT OUTER JOIN (
568
  SELECT MAX(post_modified) as lastmod, post_author, COUNT(*) as post_count
569
- FROM wp_posts
570
  WHERE post_type = "post" AND post_status = "publish"
571
  GROUP BY post_author
572
  ) p ON (wp_users.ID = p.post_author)';
@@ -608,13 +611,13 @@ class SQ_Controllers_Sitemaps extends SQ_Classes_FrontController {
608
 
609
  public function archiveFilter() {
610
  global $wpdb;
611
- $archives = $wpdb->get_results("
612
  SELECT DISTINCT YEAR(post_date_gmt) as `year`, MONTH(post_date_gmt) as `month`, max(post_date_gmt) as lastmod, count(ID) as posts
613
- FROM $wpdb->posts
614
- WHERE post_date_gmt < NOW() AND post_status = 'publish' AND post_type = 'post'
615
  GROUP BY YEAR(post_date_gmt), MONTH(post_date_gmt)
616
  ORDER BY post_date_gmt DESC
617
- ");
618
  return $archives;
619
  }
620
 
10
  var $root = 'sitemap';
11
  /* @var string post limit */
12
  var $posts_limit;
13
+ var $news_limit;
14
 
15
  public function __construct() {
16
  parent::__construct();
17
  $this->posts_limit = SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage');
18
+ $this->news_limit = SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage');
19
  add_filter('sq_sitemap_style', array($this, 'getFeedStyle'));
20
  add_action('wp', array($this, 'hookPreventRedirect'), 9);
21
 
539
  */
540
  public function customTaxFilter($query, $args) {
541
  global $wpdb;
542
+ $query[] = $wpdb->prepare("(SELECT
543
  UNIX_TIMESTAMP(MAX(p.post_date_gmt)) as _mod_date
544
+ FROM `$wpdb->posts` p, `$wpdb->term_relationships` r
545
  WHERE p.ID = r.object_id
546
+ AND p.post_status = %s
547
  AND p.post_password = ''
548
  AND r.term_taxonomy_id = tt.term_taxonomy_id
549
+ ) as lastmod", 'publish');
550
 
551
 
552
  return $query;
564
  }
565
 
566
  public function userFilter($query) {
567
+ global $wpdb;
568
+
569
  $query->query_fields .= ',p.lastmod';
570
  $query->query_from .= ' LEFT OUTER JOIN (
571
  SELECT MAX(post_modified) as lastmod, post_author, COUNT(*) as post_count
572
+ FROM `'.$wpdb->posts.'`
573
  WHERE post_type = "post" AND post_status = "publish"
574
  GROUP BY post_author
575
  ) p ON (wp_users.ID = p.post_author)';
611
 
612
  public function archiveFilter() {
613
  global $wpdb;
614
+ $archives = $wpdb->get_results($wpdb->prepare("
615
  SELECT DISTINCT YEAR(post_date_gmt) as `year`, MONTH(post_date_gmt) as `month`, max(post_date_gmt) as lastmod, count(ID) as posts
616
+ FROM `$wpdb->posts`
617
+ WHERE post_date_gmt < NOW() AND post_status = %s AND post_type = %s
618
  GROUP BY YEAR(post_date_gmt), MONTH(post_date_gmt)
619
  ORDER BY post_date_gmt DESC
620
+ ",'publish','post'));
621
  return $archives;
622
  }
623
 
core/Blocklogin.php CHANGED
@@ -68,7 +68,7 @@ class SQ_Core_Blocklogin extends SQ_Classes_BlockController {
68
 
69
  //redirect users to onboarding if necessary
70
  if (!$onboarding = SQ_Classes_Helpers_Tools::getOption('sq_onboarding')) {
71
- wp_safe_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_onboarding'));
72
  die();
73
  }
74
 
@@ -119,7 +119,7 @@ class SQ_Core_Blocklogin extends SQ_Classes_BlockController {
119
 
120
  //redirect users to onboarding if necessary
121
  if (!$onboarding = SQ_Classes_Helpers_Tools::getOption('sq_onboarding')) {
122
- wp_safe_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_onboarding'));
123
  die();
124
  }
125
 
68
 
69
  //redirect users to onboarding if necessary
70
  if (!$onboarding = SQ_Classes_Helpers_Tools::getOption('sq_onboarding')) {
71
+ wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_onboarding'));
72
  die();
73
  }
74
 
119
 
120
  //redirect users to onboarding if necessary
121
  if (!$onboarding = SQ_Classes_Helpers_Tools::getOption('sq_onboarding')) {
122
+ wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_onboarding'));
123
  die();
124
  }
125
 
models/CheckSeo.php CHANGED
@@ -36,8 +36,8 @@ class SQ_Models_CheckSeo {
36
  'getPrivateBlog' => array(
37
  'completed' => false,
38
  'warning' => esc_html__("Make your site Visible asap", _SQ_PLUGIN_NAME_),
39
- 'message' => sprintf(esc_html__("If you want Google (or any other search engine) to Display your pages and then Rank them higher in search results, your website needs to be Public and the pages indexable. Currently, a setting in your WordPress makes this impossible. You selected '%s' in %sSettings > Reading%s. You need to UNCHECK that option.", _SQ_PLUGIN_NAME_), esc_html__("Discourage search engines from indexing this site",_SQ_PLUGIN_NAME_), '<a href="' . SQ_Classes_Helpers_Tools::getAdminUrl('options-reading.php') . '" >', '</a>'),
40
- 'solution' => sprintf(esc_html__("Uncheck the option: %s in %sSettings > Reading%s.", _SQ_PLUGIN_NAME_), '<strong>' . esc_html__("Discourage search engines from indexing this site",_SQ_PLUGIN_NAME_) . '</strong>', '<a href="' . SQ_Classes_Helpers_Tools::getAdminUrl('options-reading.php') . '" >', '</a>'),
41
  'goal' => esc_html__("Google can't show your site to anybody, because you haven't made your site public and indexable. You must fix this today.", _SQ_PLUGIN_NAME_),
42
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('options-reading.php'),
43
  'color' => 'red',
@@ -343,7 +343,7 @@ class SQ_Models_CheckSeo {
343
  'completed' => false,
344
  'warning' => esc_html__("Prepare Full Google Search Console Connection", _SQ_PLUGIN_NAME_),
345
  'message' => esc_html__("Get access to data about impressions, clicks and CTR without leaving WordPress by connecting Google Search Console to Squirrly. This is an API-level connection and goes beyond just allowing GSC to track your site. Enhance your Squirrly SEO with powerful data that comes directly from Google.", _SQ_PLUGIN_NAME_),
346
- 'solution' => sprintf(esc_html__("Need Help Connecting Google Search Console? %sClick Here%s", _SQ_PLUGIN_NAME_),'<a href="https://howto.squirrly.co/faq/need-help-connecting-google-search-console-both-tracking-code-and-api-connection/" target="_blank">','</a>'),
347
  'goal' => esc_html__("You must connect Google Search Console to your Squirrly SEO. As soon as possible. It's quick to do and helps you see impressions, clicks, and CTR, so you can become an SEO Star.", _SQ_PLUGIN_NAME_),
348
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('sq_audits', 'settings'),
349
  'color' => '#4f1440',
@@ -356,7 +356,7 @@ class SQ_Models_CheckSeo {
356
  'completed' => false,
357
  'warning' => esc_html__("Make a Manual Index Request for your Focus Pages With GSC", _SQ_PLUGIN_NAME_),
358
  'message' => esc_html__("Whenever you've added or made changes to a page on your site, you should ask for Google to re-index your page. This will help getting the new content in Google's index. Don't expect Google to index the latest version of your page if you skip doing this. As a SEO Star you need to start building a strong muscle for doing this. Requesting re-index will need to become a habit to you.", _SQ_PLUGIN_NAME_),
359
- 'solution' => sprintf(esc_html__("Go to %sSquirrly > Focus Pages%s - identify the page that hasn't had a new index request and use the button to go to GSC and request re-index. %sLearn how to manually index the URL on Google Search Console%s", _SQ_PLUGIN_NAME_), '<a href="' . SQ_Classes_Helpers_Tools::getAdminUrl('sq_focuspages', 'pagelist', array('slabel=indexability')) . '" >', '</a>', '<br /><br /><a href="https://howto.squirrly.co/kb/focus-pages-page-audits/#visibility" target="_blank">','</a>'),
360
  'goal' => esc_html__("Let Google know you've made changes to your Focus Pages. Otherwise, nothing will change in search results. This is mandatory.", _SQ_PLUGIN_NAME_),
361
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('sq_focuspages', 'pagelist', array('slabel=indexability')),
362
  'color' => '#4f1440',
@@ -427,7 +427,7 @@ class SQ_Models_CheckSeo {
427
  'completed' => false,
428
  'warning' => esc_html__("Connect Google Analytics Data to Squirrly", _SQ_PLUGIN_NAME_),
429
  'message' => esc_html__("As a future SEO star, you need to be able to make decisions based on what the data tells you. By connecting Google Analytics to Squirrly, you can monitor the traffic that your Focus Pages are getting, and figure your next steps based on that. Also, much of SEO these days is based on how much time people spend on your site, so to give you accurate Chances of Ranking, Squirrly's SML needs to see this data. To ensure Google gets 100% accuracy on how people spend time on your site, use the plugin we recommend in [link]https://squirrly.co/seo/kit[/link]", _SQ_PLUGIN_NAME_),
430
- 'solution' => sprintf(esc_html__("Need Help Connecting Google Analytics? %sClick Here%s", _SQ_PLUGIN_NAME_),'<a href="https://howto.squirrly.co/faq/how-do-i-connect-google-analytics-both-tracking-code-and-the-api-connection/" target="_blank">','</a>'),
431
  'goal' => esc_html__("Connect Google Analytics to Squirrly so that you see how much traffic your Focus Pages are getting.", _SQ_PLUGIN_NAME_),
432
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('sq_audits', 'settings'),
433
  'color' => '#4f1440',
@@ -1319,7 +1319,7 @@ class SQ_Models_CheckSeo {
1319
  $tasks = $this->getTasks();
1320
  foreach ($tasks as $function => $task) {
1321
  //For Dev Kit
1322
- if(isset($task['tools']) && is_array($task['tools']) && !empty($task['tools'])) {
1323
  if (in_array('Audits', $task['tools']) && !SQ_Classes_Helpers_Tools::getMenuVisible('show_audit')) {
1324
  continue;
1325
  } elseif (in_array('Rankings', $task['tools']) && !SQ_Classes_Helpers_Tools::getMenuVisible('show_rankings')) {
@@ -1338,7 +1338,7 @@ class SQ_Models_CheckSeo {
1338
  if (!isset($remote_tasks[$function]['completed'])) {
1339
  $remote_tasks[$function]['completed'] = false;
1340
 
1341
- if (method_exists($this, $function)){
1342
  if ($result = call_user_func(array($this, $function))) {
1343
  $remote_tasks[$function]['completed'] = $result['completed'];
1344
  }
@@ -1349,7 +1349,7 @@ class SQ_Models_CheckSeo {
1349
  $this->dbtasks[$this->category_name][$function] = array();
1350
  }
1351
  //merge the local and remote task
1352
- if(is_array($remote_tasks[$function]) && !empty($remote_tasks[$function])) {
1353
  $this->dbtasks[$this->category_name][$function] = array_merge($this->dbtasks[$this->category_name][$function], $remote_tasks[$function]);
1354
  }
1355
  } elseif (method_exists($this, $function)) {
@@ -1358,7 +1358,7 @@ class SQ_Models_CheckSeo {
1358
  if (!isset($this->dbtasks[$this->category_name][$function]) || !is_array($this->dbtasks[$this->category_name][$function])) {
1359
  $this->dbtasks[$this->category_name][$function] = array();
1360
  }
1361
- if(is_array($result) && !empty($result)) {
1362
  $this->dbtasks[$this->category_name][$function] = array_merge($this->dbtasks[$this->category_name][$function], $result);
1363
  }
1364
  }
@@ -1387,13 +1387,13 @@ class SQ_Models_CheckSeo {
1387
  $stats = array();
1388
 
1389
  $stats['post_count'] = 0;
1390
- if ($row = $wpdb->get_row("SELECT COUNT(`ID`) as count FROM " . $wpdb->posts . " WHERE `post_status` = 'publish'")) {
1391
  $stats['post_count'] = $row->count;
1392
  $stats['all_post_count'] = $row->count;
1393
  }
1394
 
1395
  $removed_posts = 0;
1396
- if ($rows = $wpdb->get_results("SELECT `seo` FROM " . $wpdb->prefix . _SQ_DB_)) {
1397
  foreach ($rows as $row) {
1398
  $metas = SQ_Classes_ObjController::getDomain('SQ_Models_Domain_Sq', maybe_unserialize($row->seo));
1399
 
@@ -1838,8 +1838,10 @@ class SQ_Models_CheckSeo {
1838
  * @return array
1839
  */
1840
  public function getBadLinkStructure() {
 
 
1841
  return array(
1842
- 'completed' => (get_option('permalink_structure'))
1843
  );
1844
  }
1845
 
@@ -1856,8 +1858,8 @@ class SQ_Models_CheckSeo {
1856
  * Check Local Robots
1857
  * @return array
1858
  */
1859
- public function getRobots(){
1860
- if(SQ_Classes_Helpers_Tools::getOption('sq_auto_robots')) {
1861
  return array(
1862
  'completed' => 1
1863
  );
@@ -1870,8 +1872,8 @@ class SQ_Models_CheckSeo {
1870
  * Check Local Sitemap
1871
  * @return array
1872
  */
1873
- public function getSitemap(){
1874
- if(SQ_Classes_Helpers_Tools::getOption('sq_auto_sitemap')) {
1875
  return array(
1876
  'completed' => 1
1877
  );
@@ -2383,7 +2385,7 @@ class SQ_Models_CheckSeo {
2383
  if (!isset($audit->data->sq_seo_innerlinks->inner_links)) {
2384
  global $wpdb;
2385
 
2386
- if ($row = $wpdb->get_row("SELECT COUNT(`ID`) as count FROM " . $wpdb->posts . " WHERE `post_content` LIKE '%" . $path . "%' AND `post_status` = 'publish'")) {
2387
  $valid = ($row->count >= 1);
2388
  }
2389
 
@@ -2427,7 +2429,7 @@ class SQ_Models_CheckSeo {
2427
  if (!isset($audit->data->sq_seo_innerlinks->inner_links)) {
2428
  global $wpdb;
2429
 
2430
- if ($row = $wpdb->get_row("SELECT COUNT(`ID`) as count FROM " . $wpdb->posts . " WHERE `post_content` LIKE '%" . $path . "%' AND `post_status` = 'publish'")) {
2431
  $valid = ($row->count >= 3);
2432
  }
2433
 
@@ -2471,7 +2473,7 @@ class SQ_Models_CheckSeo {
2471
  if (!isset($audit->data->sq_seo_innerlinks->inner_links)) {
2472
  global $wpdb;
2473
 
2474
- if ($row = $wpdb->get_row("SELECT COUNT(`ID`) as count FROM " . $wpdb->posts . " WHERE `post_content` LIKE '%" . $path . "%' AND `post_status` = 'publish'")) {
2475
  $valid = ($row->count >= 5);
2476
  }
2477
 
36
  'getPrivateBlog' => array(
37
  'completed' => false,
38
  'warning' => esc_html__("Make your site Visible asap", _SQ_PLUGIN_NAME_),
39
+ 'message' => sprintf(esc_html__("If you want Google (or any other search engine) to Display your pages and then Rank them higher in search results, your website needs to be Public and the pages indexable. Currently, a setting in your WordPress makes this impossible. You selected '%s' in %sSettings > Reading%s. You need to UNCHECK that option.", _SQ_PLUGIN_NAME_), esc_html__("Discourage search engines from indexing this site", _SQ_PLUGIN_NAME_), '<a href="' . SQ_Classes_Helpers_Tools::getAdminUrl('options-reading.php') . '" >', '</a>'),
40
+ 'solution' => sprintf(esc_html__("Uncheck the option: %s in %sSettings > Reading%s.", _SQ_PLUGIN_NAME_), '<strong>' . esc_html__("Discourage search engines from indexing this site", _SQ_PLUGIN_NAME_) . '</strong>', '<a href="' . SQ_Classes_Helpers_Tools::getAdminUrl('options-reading.php') . '" >', '</a>'),
41
  'goal' => esc_html__("Google can't show your site to anybody, because you haven't made your site public and indexable. You must fix this today.", _SQ_PLUGIN_NAME_),
42
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('options-reading.php'),
43
  'color' => 'red',
343
  'completed' => false,
344
  'warning' => esc_html__("Prepare Full Google Search Console Connection", _SQ_PLUGIN_NAME_),
345
  'message' => esc_html__("Get access to data about impressions, clicks and CTR without leaving WordPress by connecting Google Search Console to Squirrly. This is an API-level connection and goes beyond just allowing GSC to track your site. Enhance your Squirrly SEO with powerful data that comes directly from Google.", _SQ_PLUGIN_NAME_),
346
+ 'solution' => sprintf(esc_html__("Need Help Connecting Google Search Console? %sClick Here%s", _SQ_PLUGIN_NAME_), '<a href="https://howto.squirrly.co/faq/need-help-connecting-google-search-console-both-tracking-code-and-api-connection/" target="_blank">', '</a>'),
347
  'goal' => esc_html__("You must connect Google Search Console to your Squirrly SEO. As soon as possible. It's quick to do and helps you see impressions, clicks, and CTR, so you can become an SEO Star.", _SQ_PLUGIN_NAME_),
348
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('sq_audits', 'settings'),
349
  'color' => '#4f1440',
356
  'completed' => false,
357
  'warning' => esc_html__("Make a Manual Index Request for your Focus Pages With GSC", _SQ_PLUGIN_NAME_),
358
  'message' => esc_html__("Whenever you've added or made changes to a page on your site, you should ask for Google to re-index your page. This will help getting the new content in Google's index. Don't expect Google to index the latest version of your page if you skip doing this. As a SEO Star you need to start building a strong muscle for doing this. Requesting re-index will need to become a habit to you.", _SQ_PLUGIN_NAME_),
359
+ 'solution' => sprintf(esc_html__("Go to %sSquirrly > Focus Pages%s - identify the page that hasn't had a new index request and use the button to go to GSC and request re-index. %sLearn how to manually index the URL on Google Search Console%s", _SQ_PLUGIN_NAME_), '<a href="' . SQ_Classes_Helpers_Tools::getAdminUrl('sq_focuspages', 'pagelist', array('slabel=indexability')) . '" >', '</a>', '<br /><br /><a href="https://howto.squirrly.co/kb/focus-pages-page-audits/#visibility" target="_blank">', '</a>'),
360
  'goal' => esc_html__("Let Google know you've made changes to your Focus Pages. Otherwise, nothing will change in search results. This is mandatory.", _SQ_PLUGIN_NAME_),
361
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('sq_focuspages', 'pagelist', array('slabel=indexability')),
362
  'color' => '#4f1440',
427
  'completed' => false,
428
  'warning' => esc_html__("Connect Google Analytics Data to Squirrly", _SQ_PLUGIN_NAME_),
429
  'message' => esc_html__("As a future SEO star, you need to be able to make decisions based on what the data tells you. By connecting Google Analytics to Squirrly, you can monitor the traffic that your Focus Pages are getting, and figure your next steps based on that. Also, much of SEO these days is based on how much time people spend on your site, so to give you accurate Chances of Ranking, Squirrly's SML needs to see this data. To ensure Google gets 100% accuracy on how people spend time on your site, use the plugin we recommend in [link]https://squirrly.co/seo/kit[/link]", _SQ_PLUGIN_NAME_),
430
+ 'solution' => sprintf(esc_html__("Need Help Connecting Google Analytics? %sClick Here%s", _SQ_PLUGIN_NAME_), '<a href="https://howto.squirrly.co/faq/how-do-i-connect-google-analytics-both-tracking-code-and-the-api-connection/" target="_blank">', '</a>'),
431
  'goal' => esc_html__("Connect Google Analytics to Squirrly so that you see how much traffic your Focus Pages are getting.", _SQ_PLUGIN_NAME_),
432
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('sq_audits', 'settings'),
433
  'color' => '#4f1440',
1319
  $tasks = $this->getTasks();
1320
  foreach ($tasks as $function => $task) {
1321
  //For Dev Kit
1322
+ if (isset($task['tools']) && is_array($task['tools']) && !empty($task['tools'])) {
1323
  if (in_array('Audits', $task['tools']) && !SQ_Classes_Helpers_Tools::getMenuVisible('show_audit')) {
1324
  continue;
1325
  } elseif (in_array('Rankings', $task['tools']) && !SQ_Classes_Helpers_Tools::getMenuVisible('show_rankings')) {
1338
  if (!isset($remote_tasks[$function]['completed'])) {
1339
  $remote_tasks[$function]['completed'] = false;
1340
 
1341
+ if (method_exists($this, $function)) {
1342
  if ($result = call_user_func(array($this, $function))) {
1343
  $remote_tasks[$function]['completed'] = $result['completed'];
1344
  }
1349
  $this->dbtasks[$this->category_name][$function] = array();
1350
  }
1351
  //merge the local and remote task
1352
+ if (is_array($remote_tasks[$function]) && !empty($remote_tasks[$function])) {
1353
  $this->dbtasks[$this->category_name][$function] = array_merge($this->dbtasks[$this->category_name][$function], $remote_tasks[$function]);
1354
  }
1355
  } elseif (method_exists($this, $function)) {
1358
  if (!isset($this->dbtasks[$this->category_name][$function]) || !is_array($this->dbtasks[$this->category_name][$function])) {
1359
  $this->dbtasks[$this->category_name][$function] = array();
1360
  }
1361
+ if (is_array($result) && !empty($result)) {
1362
  $this->dbtasks[$this->category_name][$function] = array_merge($this->dbtasks[$this->category_name][$function], $result);
1363
  }
1364
  }
1387
  $stats = array();
1388
 
1389
  $stats['post_count'] = 0;
1390
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT COUNT(`ID`) as count FROM `$wpdb->posts` WHERE `post_status` = %s", 'publish'))) {
1391
  $stats['post_count'] = $row->count;
1392
  $stats['all_post_count'] = $row->count;
1393
  }
1394
 
1395
  $removed_posts = 0;
1396
+ if ($rows = $wpdb->get_results("SELECT `seo` FROM `" . $wpdb->prefix . _SQ_DB_ . "`")) {
1397
  foreach ($rows as $row) {
1398
  $metas = SQ_Classes_ObjController::getDomain('SQ_Models_Domain_Sq', maybe_unserialize($row->seo));
1399
 
1838
  * @return array
1839
  */
1840
  public function getBadLinkStructure() {
1841
+ $structure = get_option('permalink_structure');
1842
+
1843
  return array(
1844
+ 'completed' => ($structure ? (strpos($structure, 'postname') !== false) : false)
1845
  );
1846
  }
1847
 
1858
  * Check Local Robots
1859
  * @return array
1860
  */
1861
+ public function getRobots() {
1862
+ if (SQ_Classes_Helpers_Tools::getOption('sq_auto_robots')) {
1863
  return array(
1864
  'completed' => 1
1865
  );
1872
  * Check Local Sitemap
1873
  * @return array
1874
  */
1875
+ public function getSitemap() {
1876
+ if (SQ_Classes_Helpers_Tools::getOption('sq_auto_sitemap')) {
1877
  return array(
1878
  'completed' => 1
1879
  );
2385
  if (!isset($audit->data->sq_seo_innerlinks->inner_links)) {
2386
  global $wpdb;
2387
 
2388
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT COUNT(`ID`) as count FROM `$wpdb->posts` WHERE `post_content` LIKE '%%%s%' AND `post_status` = %s", $path, 'publish'))) {
2389
  $valid = ($row->count >= 1);
2390
  }
2391
 
2429
  if (!isset($audit->data->sq_seo_innerlinks->inner_links)) {
2430
  global $wpdb;
2431
 
2432
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT COUNT(`ID`) as count FROM `$wpdb->posts` WHERE `post_content` LIKE '%%%s%' AND `post_status` = %s", $path, 'publish'))) {
2433
  $valid = ($row->count >= 3);
2434
  }
2435
 
2473
  if (!isset($audit->data->sq_seo_innerlinks->inner_links)) {
2474
  global $wpdb;
2475
 
2476
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT COUNT(`ID`) as count FROM `$wpdb->posts` WHERE `post_content` LIKE '%%%s%' AND `post_status` = %s", $path, 'publish'))) {
2477
  $valid = ($row->count >= 5);
2478
  }
2479
 
models/Frontend.php CHANGED
@@ -846,7 +846,7 @@ class SQ_Models_Frontend {
846
  $url_request = trim(parse_url($url_request, PHP_URL_PATH), '/');
847
 
848
  global $wpdb;
849
- if ($row = $wpdb->get_row("SELECT post_id FROM " . $wpdb->postmeta . " WHERE `meta_key` = '_sq_old_slug' AND `meta_value` = '" . $url_request . "'")) {
850
  if (get_post_status($row->post_id) == 'publish') {
851
  if ($permalink = get_permalink($row->post_id)) {
852
  $permalink = ($query_string) ? $permalink . "?" . $query_string : $permalink;
846
  $url_request = trim(parse_url($url_request, PHP_URL_PATH), '/');
847
 
848
  global $wpdb;
849
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT post_id FROM `$wpdb->postmeta` WHERE `meta_key` = %s AND `meta_value` = %s", '_sq_old_slug', $url_request))) {
850
  if (get_post_status($row->post_id) == 'publish') {
851
  if ($permalink = get_permalink($row->post_id)) {
852
  $permalink = ($query_string) ? $permalink . "?" . $query_string : $permalink;
models/ImportExport.php CHANGED
@@ -82,9 +82,6 @@ class SQ_Models_ImportExport {
82
  'description' => '_headspace_description',
83
  'keywords' => '_headspace_keywords',
84
  ),
85
- 'jetpack' => array(
86
- 'description' => 'advanced_seo_description',
87
- ),
88
  'platinum-seo-pack' => array(
89
  'title' => 'title',
90
  'description' => 'description',
@@ -422,10 +419,12 @@ class SQ_Models_ImportExport {
422
  $metas = array();
423
 
424
  if (!empty($meta_keys)) {
425
- $query = "SELECT * FROM " . $wpdb->postmeta . " WHERE meta_key IN ('" . join("','", array_values($meta_keys)) . "');";
 
 
426
  $meta_keys = array_flip($meta_keys);
427
 
428
- if ($rows = $wpdb->get_results($query, OBJECT)) {
429
  foreach ($rows as $row) {
430
 
431
  if (isset($meta_keys[$row->meta_key]) && $row->meta_value <> '') {
@@ -609,38 +608,13 @@ class SQ_Models_ImportExport {
609
 
610
  }
611
 
612
- if ($platform == 'quickseo-by-squirrly') {
613
- global $wpdb;
614
-
615
- $tables = $wpdb->get_col('SHOW TABLES');
616
- foreach ($tables as $table) {
617
- if ($table == $wpdb->prefix . strtolower('psp')) {
618
- $query = "SELECT * FROM " . $wpdb->prefix . "qss";
619
- if ($rows = $wpdb->get_results($query, OBJECT)) {
620
- foreach ($rows as $row) {
621
- if (isset($row->post_id)) {
622
- $metas[$row->url_hash]['post_id'] = $row->post_id;
623
- } else {
624
- $metas[$row->url_hash]['post_id'] = 0;
625
- }
626
- $metas[$row->url_hash]['url'] = $row->URL;
627
- $metas[$row->url_hash]['seo'] = $row->seo;
628
- }
629
- }
630
- break;
631
- }
632
- }
633
- return $metas;
634
- }
635
-
636
  if ($platform == 'premium-seo-pack') {
637
  global $wpdb;
638
 
639
  $tables = $wpdb->get_col('SHOW TABLES');
640
  foreach ($tables as $table) {
641
  if ($table == $wpdb->prefix . strtolower('psp')) {
642
- $query = "SELECT * FROM " . $wpdb->prefix . "psp";
643
- if ($rows = $wpdb->get_results($query, OBJECT)) {
644
  foreach ($rows as $row) {
645
  if (isset($row->post_id)) {
646
  $metas[$row->url_hash]['post_id'] = $row->post_id;
@@ -701,13 +675,13 @@ class SQ_Models_ImportExport {
701
  $output = '';
702
  foreach ($tables as $table) {
703
  if ($table == $wpdb->prefix . _SQ_DB_) {
704
- $result = $wpdb->get_results("SELECT * FROM {$table}", ARRAY_N);
705
- $columns = $wpdb->get_results('SHOW COLUMNS FROM ' . $table, ARRAY_N);
706
- $row2 = $wpdb->get_row('SHOW CREATE TABLE ' . $table, ARRAY_N);
707
  $output .= "\n\n" . str_replace('CREATE TABLE ', 'CREATE TABLE IF NOT EXISTS ', $row2[1]) . ";\n\n";
708
  for ($i = 0; $i < count((array)$result); $i++) {
709
  $row = $result[$i];
710
- $output .= 'INSERT INTO ' . $table . ' (';
711
  for ($col = 0; $col < count((array)$columns); $col++) {
712
  $output .= (isset($columns[$col][0]) ? $columns[$col][0] : "''");
713
  if ($col < (count((array)$columns) - 1)) {
@@ -745,12 +719,41 @@ class SQ_Models_ImportExport {
745
  if (is_array($queries) && !empty($queries)) {
746
  global $wpdb;
747
 
748
- for ($i = 0; $i < count((array)$queries); $i++) {
749
- if (strlen($queries[$i]) > 1) {
750
- $wpdb->query($queries[$i]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
751
  }
752
  }
753
- $wpdb->flush();
754
 
755
  return true;
756
  }
82
  'description' => '_headspace_description',
83
  'keywords' => '_headspace_keywords',
84
  ),
 
 
 
85
  'platinum-seo-pack' => array(
86
  'title' => 'title',
87
  'description' => 'description',
419
  $metas = array();
420
 
421
  if (!empty($meta_keys)) {
422
+ $placeholders = array_fill(0, count($meta_keys), '%s');
423
+ $query = "SELECT * FROM `$wpdb->postmeta` WHERE meta_key IN (" . join(",", $placeholders) . ");";
424
+
425
  $meta_keys = array_flip($meta_keys);
426
 
427
+ if ($rows = $wpdb->get_results($wpdb->prepare($query, array_keys($meta_keys)), OBJECT)) {
428
  foreach ($rows as $row) {
429
 
430
  if (isset($meta_keys[$row->meta_key]) && $row->meta_value <> '') {
608
 
609
  }
610
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
611
  if ($platform == 'premium-seo-pack') {
612
  global $wpdb;
613
 
614
  $tables = $wpdb->get_col('SHOW TABLES');
615
  foreach ($tables as $table) {
616
  if ($table == $wpdb->prefix . strtolower('psp')) {
617
+ if ($rows = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "psp`", OBJECT)) {
 
618
  foreach ($rows as $row) {
619
  if (isset($row->post_id)) {
620
  $metas[$row->url_hash]['post_id'] = $row->post_id;
675
  $output = '';
676
  foreach ($tables as $table) {
677
  if ($table == $wpdb->prefix . _SQ_DB_) {
678
+ $result = $wpdb->get_results("SELECT * FROM `$table`", ARRAY_N);
679
+ $columns = $wpdb->get_results("SHOW COLUMNS FROM `$table`", ARRAY_N);
680
+ $row2 = $wpdb->get_row("SHOW CREATE TABLE `$table`", ARRAY_N);
681
  $output .= "\n\n" . str_replace('CREATE TABLE ', 'CREATE TABLE IF NOT EXISTS ', $row2[1]) . ";\n\n";
682
  for ($i = 0; $i < count((array)$result); $i++) {
683
  $row = $result[$i];
684
+ $output .= "INSERT INTO `$table` (";
685
  for ($col = 0; $col < count((array)$columns); $col++) {
686
  $output .= (isset($columns[$col][0]) ? $columns[$col][0] : "''");
687
  if ($col < (count((array)$columns) - 1)) {
719
  if (is_array($queries) && !empty($queries)) {
720
  global $wpdb;
721
 
722
+ foreach ((array)$queries as $query) {
723
+ $query = trim($query, PHP_EOL);
724
+ if (strlen($query) > 1) {
725
+
726
+ if (strpos($query, 'CREATE TABLE') !== false) {
727
+
728
+ $wpdb->query(esc_sql($query));
729
+
730
+ } elseif (strpos($query, '(') !== false && strpos($query, ')') !== false && strpos($query, 'VALUES') !== false && strpos($query, 'ON DUPLICATE') !== false) {
731
+
732
+ $fields = substr($query, strpos($query, '(') + 1);
733
+ $fields = substr($fields, 0, strpos($fields, ')'));
734
+ $fields = explode(",", trim($fields));
735
+
736
+ $values = substr($query, strpos($query, 'VALUES') + 6);
737
+ $values = substr($values, 0, strpos($values, 'ON DUPLICATE'));
738
+ $values = explode(",", trim(trim($values), '()'));
739
+ $values = array_map(function ($value) { return trim($value, "'"); }, $values);
740
+
741
+ if (!empty($fields) && !empty($values) && count($fields) == count($values)) {
742
+
743
+ $placeholders = array_fill(0, count($values), '%s');
744
+
745
+ $query = "INSERT INTO `" . $wpdb->prefix . _SQ_DB_ . "` (" . join(",", $fields) . ")
746
+ VALUES (" . join(",", $placeholders) . ") ON DUPLICATE KEY
747
+ UPDATE " . join(" = %s,", $fields) . " = %s";
748
+
749
+ $wpdb->query($wpdb->prepare($query, array_merge($values, $values)));
750
+
751
+ }
752
+
753
+ }
754
+
755
  }
756
  }
 
757
 
758
  return true;
759
  }
models/Menu.php CHANGED
@@ -285,6 +285,12 @@ class SQ_Models_Menu {
285
  'capability' => 'sq_manage_focuspages',
286
  'icon' => 'addpage_92.png'
287
  ),
 
 
 
 
 
 
288
  'sq_rankings/settings' => array(
289
  'title' => esc_html__("Settings", _SQ_PLUGIN_NAME_),
290
  'description' => esc_html__("Ranking settings", _SQ_PLUGIN_NAME_),
285
  'capability' => 'sq_manage_focuspages',
286
  'icon' => 'addpage_92.png'
287
  ),
288
+ 'sq_rankings/gscsync' => array(
289
+ 'title' => esc_html__("Sync Keywords", _SQ_PLUGIN_NAME_),
290
+ 'description' => esc_html__("Sync Keywords from GSC", _SQ_PLUGIN_NAME_),
291
+ 'capability' => 'sq_manage_focuspages',
292
+ 'icon' => 'addpage_92.png'
293
+ ),
294
  'sq_rankings/settings' => array(
295
  'title' => esc_html__("Settings", _SQ_PLUGIN_NAME_),
296
  'description' => esc_html__("Ranking settings", _SQ_PLUGIN_NAME_),
models/Post.php CHANGED
@@ -26,7 +26,7 @@ class SQ_Models_Post {
26
  */
27
  function findAttachmentByUrl($image_url) {
28
  global $wpdb;
29
- return $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE `post_type` = 'attachment' AND `guid` like '%%%s';", $image_url));
30
  }
31
 
32
  /**
@@ -106,13 +106,13 @@ class SQ_Models_Post {
106
  if (is_multisite())
107
  $error_msg = esc_html__("File is empty. Please upload something more substantial.", _SQ_PLUGIN_NAME_);
108
  else
109
- $error_msg = esc_html__("File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.",_SQ_PLUGIN_NAME_);
110
  return call_user_func($upload_error_handler, $file, $error_msg);
111
  }
112
 
113
  // A properly uploaded file will pass this test. There should be no reason to override this one.
114
  if ($test_upload && !@ is_uploaded_file($file['tmp_name']))
115
- return call_user_func($upload_error_handler, $file, esc_html__("Specified file failed upload test.",_SQ_PLUGIN_NAME_));
116
 
117
  // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
118
  if ($test_type) {
@@ -125,7 +125,7 @@ class SQ_Models_Post {
125
  $file['name'] = $proper_filename;
126
 
127
  if ((!isset($type) || !isset($ext)) && !current_user_can('unfiltered_upload'))
128
- return call_user_func($upload_error_handler, $file, esc_html__("Sorry, this file type is not permitted for security reasons.",_SQ_PLUGIN_NAME_));
129
 
130
  if (!$ext)
131
  $ext = ltrim(strrchr($file['name'], '.'), '.');
@@ -150,7 +150,7 @@ class SQ_Models_Post {
150
  else
151
  $error_path = basename($uploads['basedir']) . $uploads['subdir'];
152
 
153
- return $upload_error_handler($file, sprintf(esc_html__("The uploaded file could not be moved to %s.",_SQ_PLUGIN_NAME_), $error_path));
154
  }
155
 
156
  // Set correct file permissions
26
  */
27
  function findAttachmentByUrl($image_url) {
28
  global $wpdb;
29
+ return $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE `post_type` = %s AND `guid` like '%%%s';", 'attachment', $image_url));
30
  }
31
 
32
  /**
106
  if (is_multisite())
107
  $error_msg = esc_html__("File is empty. Please upload something more substantial.", _SQ_PLUGIN_NAME_);
108
  else
109
+ $error_msg = esc_html__("File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.", _SQ_PLUGIN_NAME_);
110
  return call_user_func($upload_error_handler, $file, $error_msg);
111
  }
112
 
113
  // A properly uploaded file will pass this test. There should be no reason to override this one.
114
  if ($test_upload && !@ is_uploaded_file($file['tmp_name']))
115
+ return call_user_func($upload_error_handler, $file, esc_html__("Specified file failed upload test.", _SQ_PLUGIN_NAME_));
116
 
117
  // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
118
  if ($test_type) {
125
  $file['name'] = $proper_filename;
126
 
127
  if ((!isset($type) || !isset($ext)) && !current_user_can('unfiltered_upload'))
128
+ return call_user_func($upload_error_handler, $file, esc_html__("Sorry, this file type is not permitted for security reasons.", _SQ_PLUGIN_NAME_));
129
 
130
  if (!$ext)
131
  $ext = ltrim(strrchr($file['name'], '.'), '.');
150
  else
151
  $error_path = basename($uploads['basedir']) . $uploads['subdir'];
152
 
153
+ return $upload_error_handler($file, sprintf(esc_html__("The uploaded file could not be moved to %s.", _SQ_PLUGIN_NAME_), $error_path));
154
  }
155
 
156
  // Set correct file permissions
models/Qss.php CHANGED
@@ -20,9 +20,7 @@ class SQ_Models_Qss {
20
  if (isset($hash) && $hash <> '') {
21
  $blog_id = get_current_blog_id();
22
 
23
- $query = "SELECT * FROM " . $wpdb->prefix . _SQ_DB_ . " WHERE blog_id = '" . (int)$blog_id . "' AND url_hash = '" . $hash . "';";
24
-
25
- if ($row = $wpdb->get_row($query, OBJECT)) {
26
  $post = SQ_Classes_ObjController::getDomain('SQ_Models_Domain_Post', maybe_unserialize($row->post));
27
  $post->url = $row->URL; //set the URL for this post
28
  }
@@ -44,9 +42,7 @@ class SQ_Models_Qss {
44
  if (isset($hash) && $hash <> '') {
45
  $blog_id = get_current_blog_id();
46
 
47
- $query = "SELECT * FROM " . $wpdb->prefix . _SQ_DB_ . " WHERE blog_id = '" . (int)$blog_id . "' AND url_hash = '" . $hash . "';";
48
-
49
- if ($row = $wpdb->get_row($query, OBJECT)) {
50
  $metas = SQ_Classes_ObjController::getDomain('SQ_Models_Domain_Sq', maybe_unserialize($row->seo));
51
  }
52
  }
@@ -67,15 +63,14 @@ class SQ_Models_Qss {
67
  global $wpdb;
68
  $wpdb->hide_errors();
69
 
70
- $seo = addslashes($seo);
71
  $blog_id = get_current_blog_id();
72
 
73
- $sq_query = "INSERT INTO " . $wpdb->prefix . _SQ_DB_ . " (blog_id, URL, url_hash, post, seo, date_time)
74
- VALUES ('$blog_id','$url','$url_hash','$post','$seo','$date_time')
75
- ON DUPLICATE KEY
76
- UPDATE blog_id = '$blog_id', URL = '$url', url_hash = '$url_hash', post = '$post', seo = '$seo', date_time = '$date_time'";
 
77
 
78
- $result = $wpdb->query($sq_query);
79
  $wpdb->show_errors();
80
 
81
  return $result;
@@ -93,11 +88,10 @@ class SQ_Models_Qss {
93
  if (isset($hash) && $hash <> '') {
94
  $blog_id = get_current_blog_id();
95
 
96
- $query = "SELECT URL FROM " . $wpdb->prefix . _SQ_DB_ . " WHERE blog_id = '" . (int)$blog_id . "' AND url_hash = '" . $hash . "';";
97
-
98
- if ($row = $wpdb->get_row($query, OBJECT)) {
99
  $url = $row->URL;
100
  }
 
101
  }
102
 
103
  return $url;
@@ -107,16 +101,15 @@ class SQ_Models_Qss {
107
  * Check if the table exists
108
  * @return bool
109
  */
110
- public function checkTableExists(){
111
  global $wpdb;
112
 
113
  try {
114
  $wpdb->hide_errors();
115
- if(!$wpdb->get_var( 'SELECT COUNT(*) FROM ' . $wpdb->prefix . _SQ_DB_ )){
116
  $this->createTable();
117
- }else {
118
- $this->alterTable();
119
  }
 
120
  $wpdb->show_errors();
121
  } catch (Exception $e) {
122
  }
@@ -129,7 +122,7 @@ class SQ_Models_Qss {
129
  public static function createTable() {
130
  global $wpdb;
131
 
132
- $sq_table_query = 'CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . _SQ_DB_ . ' (
133
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
134
  `blog_id` INT(10) NOT NULL,
135
  `post` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
@@ -158,13 +151,13 @@ class SQ_Models_Qss {
158
 
159
  if (file_exists(ABSPATH . 'wp-admin/includes/upgrade.php')) {
160
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
161
- $count = $wpdb->get_row("SELECT count(*) as count
162
  FROM information_schema.columns
163
  WHERE table_name = '" . $wpdb->prefix . _SQ_DB_ . "'
164
- AND column_name = 'post';");
165
 
166
  if ($count->count == 0) {
167
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . _SQ_DB_ . " ADD COLUMN `post` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''");
168
  }
169
 
170
  }
20
  if (isset($hash) && $hash <> '') {
21
  $blog_id = get_current_blog_id();
22
 
23
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . $wpdb->prefix . _SQ_DB_ . "` WHERE blog_id = %d AND url_hash = %s", (int)$blog_id, $hash), OBJECT)) {
 
 
24
  $post = SQ_Classes_ObjController::getDomain('SQ_Models_Domain_Post', maybe_unserialize($row->post));
25
  $post->url = $row->URL; //set the URL for this post
26
  }
42
  if (isset($hash) && $hash <> '') {
43
  $blog_id = get_current_blog_id();
44
 
45
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . $wpdb->prefix . _SQ_DB_ . "` WHERE blog_id = %d AND url_hash = %s", (int)$blog_id, $hash), OBJECT)) {
 
 
46
  $metas = SQ_Classes_ObjController::getDomain('SQ_Models_Domain_Sq', maybe_unserialize($row->seo));
47
  }
48
  }
63
  global $wpdb;
64
  $wpdb->hide_errors();
65
 
 
66
  $blog_id = get_current_blog_id();
67
 
68
+ $result = $wpdb->query($wpdb->prepare("INSERT INTO `" . $wpdb->prefix . _SQ_DB_ . "`
69
+ (blog_id, URL, url_hash, post, seo, date_time)
70
+ VALUES (%d,%s,%s,%s,%s,%s) ON DUPLICATE KEY
71
+ UPDATE blog_id = %d, URL = %s, url_hash = %s, post = %s, seo = %s, date_time = %s"
72
+ , $blog_id, $url, $url_hash, $post, $seo, $date_time, $blog_id, $url, $url_hash, $post, $seo, $date_time));
73
 
 
74
  $wpdb->show_errors();
75
 
76
  return $result;
88
  if (isset($hash) && $hash <> '') {
89
  $blog_id = get_current_blog_id();
90
 
91
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT URL FROM `" . $wpdb->prefix . _SQ_DB_ . "` WHERE blog_id = %d AND url_hash = %s", (int)$blog_id, $hash), OBJECT)) {
 
 
92
  $url = $row->URL;
93
  }
94
+
95
  }
96
 
97
  return $url;
101
  * Check if the table exists
102
  * @return bool
103
  */
104
+ public function checkTableExists() {
105
  global $wpdb;
106
 
107
  try {
108
  $wpdb->hide_errors();
109
+ if (!$wpdb->get_var("SELECT COUNT(*) FROM `" . $wpdb->prefix . _SQ_DB_ . "`")) {
110
  $this->createTable();
 
 
111
  }
112
+ $this->alterTable();
113
  $wpdb->show_errors();
114
  } catch (Exception $e) {
115
  }
122
  public static function createTable() {
123
  global $wpdb;
124
 
125
+ $sq_table_query = 'CREATE TABLE IF NOT EXISTS `' . $wpdb->prefix . _SQ_DB_ . '` (
126
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
127
  `blog_id` INT(10) NOT NULL,
128
  `post` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
151
 
152
  if (file_exists(ABSPATH . 'wp-admin/includes/upgrade.php')) {
153
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
154
+ $count = $wpdb->get_row($wpdb->prepare("SELECT count(*) as count
155
  FROM information_schema.columns
156
  WHERE table_name = '" . $wpdb->prefix . _SQ_DB_ . "'
157
+ AND column_name = %s", 'post'));
158
 
159
  if ($count->count == 0) {
160
+ $wpdb->query("ALTER TABLE `" . $wpdb->prefix . _SQ_DB_ . "` ADD COLUMN post VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''");
161
  }
162
 
163
  }
models/focuspages/Clicks.php CHANGED
@@ -65,7 +65,7 @@ class SQ_Models_Focuspages_Clicks extends SQ_Models_Abstract_Assistant {
65
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
66
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
67
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
68
- $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
69
  }
70
  $header .= '</table></div>';
71
  }else {
65
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
66
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
67
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
68
+ $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">'. ($lsikeyword->main ? '<i class="fa fa-star text-black-50 small float-right"></i>' : '') . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
69
  }
70
  $header .= '</table></div>';
71
  }else {
models/focuspages/Content.php CHANGED
@@ -91,7 +91,7 @@ class SQ_Models_Focuspages_Content extends SQ_Models_Abstract_Assistant {
91
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
92
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
93
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
94
- $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
95
  }
96
  $header .= '</table></div>';
97
  }else {
91
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
92
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
93
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
94
+ $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' .($lsikeyword->main ? '<i class="fa fa-star text-black-50 small float-right"></i>' : '') . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
95
  }
96
  $header .= '</table></div>';
97
  }else {
models/focuspages/Ctr.php CHANGED
@@ -65,7 +65,7 @@ class SQ_Models_Focuspages_Ctr extends SQ_Models_Abstract_Assistant {
65
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
66
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
67
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
68
- $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
69
  }
70
  $header .= '</table></div>';
71
  }else {
65
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
66
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
67
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
68
+ $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' .($lsikeyword->main ? '<i class="fa fa-star text-black-50 small float-right"></i>' : ''). '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
69
  }
70
  $header .= '</table></div>';
71
  }else {
models/focuspages/Image.php CHANGED
@@ -97,7 +97,7 @@ class SQ_Models_Focuspages_Image extends SQ_Models_Abstract_Assistant {
97
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
98
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
99
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
100
- $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
101
  }
102
  $header .= '</table></div>';
103
  }else {
97
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
98
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
99
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
100
+ $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' .($lsikeyword->main ? '<i class="fa fa-star text-black-50 small float-right"></i>' : '') . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
101
  }
102
  $header .= '</table></div>';
103
  }else {
models/focuspages/Impressions.php CHANGED
@@ -65,7 +65,7 @@ class SQ_Models_Focuspages_Impressions extends SQ_Models_Abstract_Assistant {
65
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
66
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
67
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
68
- $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
69
  }
70
  $header .= '</table></div>';
71
  }else {
65
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
66
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
67
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
68
+ $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' .($lsikeyword->main ? '<i class="fa fa-star text-black-50 small float-right"></i>' : ''). '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
69
  }
70
  $header .= '</table></div>';
71
  }else {
models/focuspages/Innerlinks.php CHANGED
@@ -28,7 +28,7 @@ class SQ_Models_Focuspages_Innerlinks extends SQ_Models_Abstract_Assistant {
28
 
29
  if (!isset($this->_audit->data->sq_seo_innerlinks->inner_links)) {
30
 
31
- if ($row = $wpdb->get_row("SELECT COUNT(`ID`) as count FROM " . $wpdb->posts . " WHERE `post_content` LIKE '%" . $path . "%' AND `post_status` = 'publish'")) {
32
  $this->_inner_links = $row->count;
33
  }
34
 
28
 
29
  if (!isset($this->_audit->data->sq_seo_innerlinks->inner_links)) {
30
 
31
+ if ($row = $wpdb->get_row($wpdb->prepare("SELECT COUNT(`ID`) as count FROM `$wpdb->posts` WHERE `post_content` LIKE '%%%s%' AND `post_status` = %s", $path, 'publish'))) {
32
  $this->_inner_links = $row->count;
33
  }
34
 
models/focuspages/Keyword.php CHANGED
@@ -98,7 +98,7 @@ class SQ_Models_Focuspages_Keyword extends SQ_Models_Abstract_Assistant {
98
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
99
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
100
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
101
- $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
102
  }
103
  $header .= '</table></div>';
104
  }else {
@@ -110,7 +110,7 @@ class SQ_Models_Focuspages_Keyword extends SQ_Models_Abstract_Assistant {
110
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
111
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
112
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
113
- $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
114
  }
115
  $header .= '</table></div>';
116
  }else {
98
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
99
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
100
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
101
+ $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">'.($lsikeyword->main ? '<i class="fa fa-star text-black-50 small float-right"></i>' : '') . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
102
  }
103
  $header .= '</table></div>';
104
  }else {
110
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
111
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
112
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
113
+ $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' .($lsikeyword->main ? '<i class="fa fa-star text-black-50 small float-right"></i>' : ''). '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
114
  }
115
  $header .= '</table></div>';
116
  }else {
models/focuspages/Snippet.php CHANGED
@@ -183,7 +183,7 @@ class SQ_Models_Focuspages_Snippet extends SQ_Models_Abstract_Assistant {
183
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
184
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
185
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
186
- $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
187
  }
188
  $header .= '</table></div>';
189
  }else {
183
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
184
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
185
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
186
+ $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' .($lsikeyword->main ? '<i class="fa fa-star text-black-50 small float-right"></i>' : ''). '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
187
  }
188
  $header .= '</table></div>';
189
  }else {
models/focuspages/Strategy.php CHANGED
@@ -104,7 +104,7 @@ class SQ_Models_Focuspages_Strategy extends SQ_Models_Abstract_Assistant {
104
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
105
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
106
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
107
- $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' . '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
108
  }
109
  $header .= '</table></div>';
110
  }else {
104
  $header .= '<div class="sq_keywords" ><table class="table table-striped">';
105
  $header .= '<tr><th>'.esc_html__("Keywords", _SQ_PLUGIN_NAME_).'</th><th title="'.esc_html__("Squirrly Live Assistant Optimization", _SQ_PLUGIN_NAME_).'">'.esc_html__("SLA", _SQ_PLUGIN_NAME_).'</th></tr>';
106
  foreach ($this->_audit->data->sq_seo_briefcase as $lsikeyword) {
107
+ $header .= '<tr style="'.($lsikeyword->main ? 'background-color:#fafad2' : '').'"><td class="text-black-50 mb-2 text-left">' .($lsikeyword->main ? '<i class="fa fa-star text-black-50 small float-right"></i>' : ''). '<span class="text-info">' . $lsikeyword->keyword . '</span></td><td>'.$lsikeyword->optimized . '%' .'</td></tr>';
108
  }
109
  $header .= '</table></div>';
110
  }else {
models/services/JsonLD.php CHANGED
@@ -241,6 +241,120 @@ class SQ_Models_Services_JsonLD extends SQ_Models_Abstract_Seo {
241
  }
242
  //add current markup
243
  $this->set_data($markup);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  } elseif ($this->_post->post_type == 'post' || $this->_post->sq->og_type == 'article') {
245
  $markup['@type'] = 'Article';
246
  $markup['@id'] = $this->_post->url . '#' . 'Article';
241
  }
242
  //add current markup
243
  $this->set_data($markup);
244
+ }elseif ($this->_post->sq->og_type == 'newsarticle') {
245
+ $markup['@type'] = 'NewsArticle';
246
+ $markup['@id'] = $this->_post->url . '#' . 'NewsArticle';
247
+
248
+ $markup['mainEntityOfPage'] = array(
249
+ '@type' => 'WebPage',
250
+ 'url' => $this->_post->url
251
+ );
252
+
253
+ if (isset($this->_post->sq->description)) {
254
+ $markup['headline'] = $this->truncate($this->_post->sq->description, 0, $this->_post->sq->jsonld_description_maxlength);
255
+ $markup['headline'] = str_replace('&#034;', '"', $markup['headline']);
256
+ }
257
+
258
+ if ($this->_post->sq->og_media <> '') {
259
+ $markup['image'] = array(
260
+ "@type" => "ImageObject",
261
+ "url" => $this->_post->sq->og_media,
262
+ "height" => 500,
263
+ "width" => 700,
264
+ );
265
+ } else {
266
+ $this->_setMedia($markup);
267
+ }
268
+
269
+ if (isset($this->_post->post_date)) {
270
+ $markup['datePublished'] = date('c', strtotime($this->_post->post_date));
271
+ }
272
+ if (isset($this->_post->post_modified)) {
273
+ $markup['dateModified'] = date('c', strtotime($this->_post->post_modified));
274
+ }
275
+
276
+ $user_url = $this->getAuthor('user_url');
277
+ $display_name = $this->getAuthor('display_name');
278
+
279
+ if ($user_url <> '' && $display_name <> '') {
280
+ $markup['author'] = array(
281
+ "@type" => "Person",
282
+ "url" => $user_url,
283
+ "name" => $display_name,
284
+ );
285
+ } elseif (isset($jsonld['Person'])) {
286
+ $markup['publisher'] = array(
287
+ "@type" => 'Person',
288
+ "name" => $this->getAuthor('display_name'),
289
+ );
290
+
291
+ foreach ($jsonld['Person'] as $key => $value) {
292
+ if ($value <> '') {
293
+
294
+ if ($key == 'logo') {
295
+ $markup['publisher']['image'] = array(
296
+ "@type" => "ImageObject",
297
+ "url" => $value
298
+ );
299
+
300
+ } else {
301
+ $markup['publisher'][$key] = $value;
302
+ }
303
+ }
304
+ }
305
+ }
306
+
307
+ if (isset($jsonld['Organization'])) {
308
+ $markup['publisher'] = array(
309
+ "@type" => 'Organization',
310
+ "url" => $this->_post->url,
311
+ "name" => $this->getAuthor('display_name'),
312
+ );
313
+
314
+ foreach ($jsonld['Organization'] as $key => $value) {
315
+ if ($value <> '') {
316
+ if ($key == 'contactType' || $key == 'telephone' || $key == 'jobTitle') {
317
+ continue;
318
+ }
319
+
320
+ if ($key == 'logo') {
321
+ $markup['publisher']['logo'] = array(
322
+ "@type" => "ImageObject",
323
+ "url" => $value
324
+ );
325
+
326
+ } else {
327
+ $markup['publisher'][$key] = $value;
328
+ }
329
+ } else {
330
+ if ($key == 'logo') {
331
+ if (file_exists(ABSPATH . 'favicon.ico')) {
332
+ $logo = home_url() . '/favicon.ico';
333
+ } elseif ((SQ_Classes_Helpers_Tools::getOption('favicon') <> '' && file_exists(_SQ_CACHE_DIR_ . SQ_Classes_Helpers_Tools::getOption('favicon')))) {
334
+ if (!get_option('permalink_structure')) {
335
+ $logo = home_url() . '/index.php?sq_get=favicon';
336
+ } else {
337
+ $logo = home_url() . '/favicon.icon';
338
+ }
339
+ } else {
340
+ $logo = _SQ_ASSETS_URL_ . 'img/logo.png';
341
+ }
342
+
343
+ $markup['publisher']['logo'] = array(
344
+ "@type" => "ImageObject",
345
+ "url" => $logo
346
+ );
347
+
348
+ }
349
+ }
350
+ }
351
+ }
352
+
353
+ if ($this->_post->sq->keywords <> '') {
354
+ $markup['keywords'] = $this->_post->sq->keywords;
355
+ }
356
+ //add current markup
357
+ $this->set_data($markup);
358
  } elseif ($this->_post->post_type == 'post' || $this->_post->sq->og_type == 'article') {
359
  $markup['@type'] = 'Article';
360
  $markup['@id'] = $this->_post->url . '#' . 'Article';
models/services/Pixel.php CHANGED
@@ -14,7 +14,7 @@ class SQ_Models_Services_Pixel extends SQ_Models_Abstract_Seo {
14
  return;
15
  }
16
 
17
- if(function_exists('is_user_logged_in') && is_user_logged_in() && !SQ_Classes_Helpers_Tools::getOption('sq_tracking_logged_users') ){
18
  return;
19
  }
20
 
@@ -50,7 +50,6 @@ class SQ_Models_Services_Pixel extends SQ_Models_Abstract_Seo {
50
 
51
  public function generatePixel($events = array()) {
52
 
53
-
54
  $codes = json_decode(wp_json_encode(SQ_Classes_Helpers_Tools::getOption('codes')));
55
 
56
  if (isset($codes->facebook_pixel) && $codes->facebook_pixel <> '') {
@@ -127,11 +126,9 @@ class SQ_Models_Services_Pixel extends SQ_Models_Abstract_Seo {
127
  } elseif (SQ_Classes_Helpers_Tools::getIsset('key')) {
128
  $params['content_type'] = 'purchase';
129
  global $wpdb;
130
- $sql = "SELECT `post_id`
131
- FROM `" . $wpdb->postmeta . "`
132
- WHERE `meta_key` = '_order_key' AND `meta_value`='" . SQ_Classes_Helpers_Tools::getValue('key') . "'";
133
 
134
- if ($post = $wpdb->get_row($sql)) {
 
135
  if ($order = wc_get_order($post->post_id)) {
136
  $params['content_type'] = "checkout";
137
  $params['value'] = $order->get_total();
14
  return;
15
  }
16
 
17
+ if (function_exists('is_user_logged_in') && is_user_logged_in() && !SQ_Classes_Helpers_Tools::getOption('sq_tracking_logged_users')) {
18
  return;
19
  }
20
 
50
 
51
  public function generatePixel($events = array()) {
52
 
 
53
  $codes = json_decode(wp_json_encode(SQ_Classes_Helpers_Tools::getOption('codes')));
54
 
55
  if (isset($codes->facebook_pixel) && $codes->facebook_pixel <> '') {
126
  } elseif (SQ_Classes_Helpers_Tools::getIsset('key')) {
127
  $params['content_type'] = 'purchase';
128
  global $wpdb;
 
 
 
129
 
130
+ if ($post = $wpdb->get_row($wpdb->prepare("SELECT `post_id` FROM `$wpdb->postmeta` WHERE `meta_key` = %s AND `meta_value`= %s", '_order_key', SQ_Classes_Helpers_Tools::getValue('key')))) {
131
+
132
  if ($order = wc_get_order($post->post_id)) {
133
  $params['content_type'] = "checkout";
134
  $params['value'] = $order->get_total();
readme.txt CHANGED
@@ -123,7 +123,7 @@ It's a freemium software (like MailChimp). The PRO features come from our server
123
 
124
  You need to gain an edge over all the ranking factors (at least 60 such factors) that aren't covered by WordPress SEO Plugins.
125
 
126
- Focus Pages by Squirrly, the SEO Live Assistant, the Keyword Research, the Audit Suite (does 6 types of audits for you weekly), the Briefcase (an overview on your current SEO strategy) and the SERP Checker inside Squirrly SEO will make all the difference in the world.
127
 
128
  = SEMrush and MOZ don't even come close to offering the analysis and clear navigation that Focus Pages by Squirrly offers you. =
129
 
@@ -417,6 +417,20 @@ Type a keyword to the right of the screen and start using Squirrly Seo. Enjoy!
417
  28. Wp Seo - Facebook Pixel, Google Analytics and Google Search Console
418
 
419
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  = 11.0.01 - 01/19/2021 =
421
  * Update - Compatibility with PHP 8
422
  * Update - Verify the local SEO Snippet in Focus Pages
123
 
124
  You need to gain an edge over all the ranking factors (at least 60 such factors) that aren't covered by WordPress SEO Plugins.
125
 
126
+ Focus Pages by Squirrly, the SEO Live Assistant, the Keyword Research, the Audit Suite (does 6 types of audits for you weekly), the Briefcase (an overview on your current SEO strategy) and the Google Ranking inside Squirrly SEO will make all the difference in the world.
127
 
128
  = SEMrush and MOZ don't even come close to offering the analysis and clear navigation that Focus Pages by Squirrly offers you. =
129
 
417
  28. Wp Seo - Facebook Pixel, Google Analytics and Google Search Console
418
 
419
  == Changelog ==
420
+ = 11.0.02 - 02/17/2021 =
421
+ Update - Added the option to delete keywords from Keyword Suggestion
422
+ Update - Changed the Ranking column in Briefcase
423
+ Update - Added a new menu in Ranking Page for Keyword Sync with GSC
424
+ Update - Show more results in Keyword Research Tool
425
+ Update - Select up to 3 keyword suggestions in the Research Process
426
+ Update - Make the main keyword more visible in the Focus Page section
427
+ Update - The limit for Google News to match the number of Posts per Page from Sitemap XML
428
+ Fixed - UI in Briefcase to look more friendly
429
+ Fixed - Already in SERP Checker button to show when a keyword is already added in Rankings
430
+ Fixed - Make sure to save the optimizations for all keywords in Live Assistant > Briefcase
431
+ Fixed - Corrected te Article Word Count with Readability in Focus Pages
432
+ Increased plugin security and update compatibilities
433
+
434
  = 11.0.01 - 01/19/2021 =
435
  * Update - Compatibility with PHP 8
436
  * Update - Verify the local SEO Snippet in Focus Pages
squirrly.php CHANGED
@@ -8,7 +8,7 @@
8
  * Description: A.I.-based Private SEO Consultant. In a Plugin. Powered by Machine Learning and Cloud Services. Over 300 functionalities for SEO available when you need them.<BR> <a href="http://cloud.squirrly.co/user" target="_blank"><strong>Account Info</strong></a>
9
  * Author: Squirrly SEO
10
  * Author URI: https://plugin.squirrly.co
11
- * Version: 10.2.06
12
  * License: GPLv2 or later
13
  * License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
14
  * Text Domain: squirrly-seo
@@ -17,7 +17,7 @@
17
 
18
  if (!defined('SQ_VERSION')) {
19
  /* SET THE CURRENT VERSION ABOVE AND BELOW */
20
- define('SQ_VERSION', '10.2.06');
21
  //The last stable version
22
  define('SQ_STABLE_VERSION', '10.2.05');
23
  // Call config files
8
  * Description: A.I.-based Private SEO Consultant. In a Plugin. Powered by Machine Learning and Cloud Services. Over 300 functionalities for SEO available when you need them.<BR> <a href="http://cloud.squirrly.co/user" target="_blank"><strong>Account Info</strong></a>
9
  * Author: Squirrly SEO
10
  * Author URI: https://plugin.squirrly.co
11
+ * Version: 11.0.02
12
  * License: GPLv2 or later
13
  * License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
14
  * Text Domain: squirrly-seo
17
 
18
  if (!defined('SQ_VERSION')) {
19
  /* SET THE CURRENT VERSION ABOVE AND BELOW */
20
+ define('SQ_VERSION', '11.0.02');
21
  //The last stable version
22
  define('SQ_STABLE_VERSION', '10.2.05');
23
  // Call config files
uninstall.php CHANGED
@@ -24,7 +24,8 @@ try {
24
  }
25
 
26
  global $wpdb;
27
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . _SQ_DB_);
 
28
  }
29
 
30
  } catch (Exception $e) {
24
  }
25
 
26
  global $wpdb;
27
+ $dbname = $wpdb->prefix . _SQ_DB_;
28
+ $wpdb->query("DROP TABLE IF EXISTS `$dbname`");
29
  }
30
 
31
  } catch (Exception $e) {
view/Blocks/Dashboard.php CHANGED
@@ -11,7 +11,7 @@ $tasks_incompleted = SQ_Classes_ObjController::getClass('SQ_Controllers_CheckSeo
11
  <td class="sq_strength-meter" style="display: none">
12
  <div class="sq_strength-data">
13
  <div class="sq_level-indicator">
14
- <span class="sq_fill"> <img class="sq_mask" alt="" src="<?php echo _SQ_ASSETS_URL_ . 'img/squirrly_filled.png' ?>" ></span>
15
  <em class="sq_level-separator" style="height:135px;"></em>
16
  </div>
17
  </div>
@@ -36,7 +36,7 @@ $tasks_incompleted = SQ_Classes_ObjController::getClass('SQ_Controllers_CheckSeo
36
  foreach ($tasks_completed as $index => $row) { ?>
37
  <li>
38
  <span style="<?php echo($row['color'] ? 'color:' . esc_attr($row['color']) . ';' : 'color:darkgreen;') ?>">
39
- <img src="<?php echo _SQ_ASSETS_URL_ . 'img/settings/' . esc_attr($row['image']) ?>" alt=""/>
40
  <?php echo(isset($row['message']) ? (string)$row['message'] : '') ?>
41
  </span>
42
  </li>
@@ -75,7 +75,7 @@ $tasks_incompleted = SQ_Classes_ObjController::getClass('SQ_Controllers_CheckSeo
75
  foreach ($tasks_incompleted as $index => $row) { ?>
76
  <li>
77
  <span style="<?php echo($row['color'] ? 'color:' . esc_attr($row['color']) . ';' : 'color:orangered;') ?>">
78
- <?php echo(isset($row['warning']) ? (string)$row['warning'] : '') ?>
79
  </span>
80
  </li>
81
  <?php
11
  <td class="sq_strength-meter" style="display: none">
12
  <div class="sq_strength-data">
13
  <div class="sq_level-indicator">
14
+ <span class="sq_fill"> <img class="sq_mask" alt="" src="<?php echo _SQ_ASSETS_URL_ . 'img/squirrly_filled.png' ?>"></span>
15
  <em class="sq_level-separator" style="height:135px;"></em>
16
  </div>
17
  </div>
36
  foreach ($tasks_completed as $index => $row) { ?>
37
  <li>
38
  <span style="<?php echo($row['color'] ? 'color:' . esc_attr($row['color']) . ';' : 'color:darkgreen;') ?>">
39
+ <img src="<?php echo _SQ_ASSETS_URL_ . 'img/settings/' . esc_attr($row['image']) ?>" alt="" style="max-width: 20px; vertical-align: middle" />
40
  <?php echo(isset($row['message']) ? (string)$row['message'] : '') ?>
41
  </span>
42
  </li>
75
  foreach ($tasks_incompleted as $index => $row) { ?>
76
  <li>
77
  <span style="<?php echo($row['color'] ? 'color:' . esc_attr($row['color']) . ';' : 'color:orangered;') ?>">
78
+ <?php echo(isset($row['warning']) ? (string)$row['warning'] : '') ?>
79
  </span>
80
  </li>
81
  <?php
view/Blocks/Login.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php $tab = SQ_Classes_Helpers_Tools::getValue('tab', 'register'); ?>
2
  <div class="card col-sm-12 p-0 border-0">
3
  <div class="card-body">
4
- <div class="col-sm-12 p-0 m-0"><?php echo apply_filters('sq_form_notices', $view->message); ?></div>
5
-
6
  <?php if ($tab == 'login') { ?>
7
  <form method="post" action="<?php echo SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard', 'login') ?>">
8
  <?php SQ_Classes_Helpers_Tools::setNonce('sq_login', 'sq_nonce'); ?>
1
  <?php $tab = SQ_Classes_Helpers_Tools::getValue('tab', 'register'); ?>
2
  <div class="card col-sm-12 p-0 border-0">
3
  <div class="card-body">
 
 
4
  <?php if ($tab == 'login') { ?>
5
  <form method="post" action="<?php echo SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard', 'login') ?>">
6
  <?php SQ_Classes_Helpers_Tools::setNonce('sq_login', 'sq_nonce'); ?>
view/Blocks/Snippet.php CHANGED
@@ -439,11 +439,11 @@ if (SQ_Classes_Helpers_Tools::getOption('sq_api') <> '') {
439
  <div class="sq-form-control sq-m-0 " style="min-height: 135px; height: auto; border: none; background-color: lightgrey;font-size: 12px !important;" disabled="disabled"><?php echo (string)$jsonld_data; ?></div>
440
  </div>
441
  <div class="sq-col-sm-12 sq-p-0 sq-py-1 sq-small">
442
- <form method="post" target="_blank" action="https://search.google.com/structured-data/testing-tool">
443
  <button type="submit" class="sq-btn sq-btn-secondary sq-btn-block">
444
  <i class="fa fa-google"></i><?php echo esc_html__("Validate", _SQ_PLUGIN_NAME_) ?>
445
  </button>
446
- <textarea name="code" style="display: none"><script type="application/ld+json"><?php echo (string)$jsonld_data; ?></script></textarea>
447
  </form>
448
  </div>
449
  </div>
439
  <div class="sq-form-control sq-m-0 " style="min-height: 135px; height: auto; border: none; background-color: lightgrey;font-size: 12px !important;" disabled="disabled"><?php echo (string)$jsonld_data; ?></div>
440
  </div>
441
  <div class="sq-col-sm-12 sq-p-0 sq-py-1 sq-small">
442
+ <form method="post" target="_blank" action="https://search.google.com/test/rich-results">
443
  <button type="submit" class="sq-btn sq-btn-secondary sq-btn-block">
444
  <i class="fa fa-google"></i><?php echo esc_html__("Validate", _SQ_PLUGIN_NAME_) ?>
445
  </button>
446
+ <textarea name="code_snippet" style="display: none"><?php echo (string)$jsonld_data; ?></textarea>
447
  </form>
448
  </div>
449
  </div>
view/Blocks/Stats.php CHANGED
@@ -32,19 +32,7 @@
32
  }
33
  }
34
  ////////////////////////////////////////////////////////////
35
-
36
- if (!isset($dbtasks['sq_onboarding']['OnboardingBanner']) || $dbtasks['sq_onboarding']['OnboardingBanner']['active']) {
37
- ?>
38
- <div id="OnboardingBanner" class="banner col-sm-12 m-0 mt-2 p-0">
39
- <div class="sq_save_ajax">
40
- <input type="hidden" id="sq_ignore_OnboardingBanner" value="0">
41
- <button type="button" class="float-right btn btn-sm btn-link text-black-50 p-2 px-3 m-0" id="sq_onboarding_banner" data-input="sq_ignore_OnboardingBanner" data-name="sq_onboarding|OnboardingBanner" data-action="sq_ajax_assistant" data-javascript="$('#OnboardingBanner').hide();">
42
- <i class="fa fa-close"></i>
43
- </button>
44
- </div>
45
- <img src="<?php echo _SQ_ASSETS_URL_ . 'img/settings/banner.png' ?>" style="width: 100%">
46
- </div>
47
- <?php } ?>
48
  <div class="card col-sm-12 m-0 mt-2 p-0" style="box-shadow: 0 0 10px -3px #994525;">
49
  <div class="card-body m-0 p-0 bg-title">
50
  <div class="row text-left m-0 p-0">
32
  }
33
  }
34
  ////////////////////////////////////////////////////////////
35
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
36
  <div class="card col-sm-12 m-0 mt-2 p-0" style="box-shadow: 0 0 10px -3px #994525;">
37
  <div class="card-body m-0 p-0 bg-title">
38
  <div class="row text-left m-0 p-0">
view/Ranking/Gscsync.php CHANGED
@@ -39,17 +39,19 @@
39
  <tbody>
40
  <?php
41
  foreach ($view->suggested as $key => $row) {
42
- $in_briefcase = false;
43
  if (!empty($view->keywords))
44
  foreach ($view->keywords as $krow) {
45
  if (trim(strtolower($krow->keyword)) == trim(strtolower($row->keywords))) {
46
- $in_briefcase = true;
 
 
47
  break;
48
  }
49
  }
50
 
51
  ?>
52
- <tr class="<?php echo($in_briefcase ? 'bg-briefcase' : '') ?>">
53
  <td style="width: 280px;">
54
  <span style="display: block; clear: left; float: left;"><?php echo SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keywords) ?></span>
55
  </td>
@@ -72,10 +74,10 @@
72
  </div>
73
  <div class="sq_sm_dropdown">
74
  <ul class="text-left p-2 m-0 ">
75
- <?php if ($in_briefcase) { ?>
76
  <li class="bg-briefcase m-0 p-1 py-2 text-black-50">
77
  <i class="sq_icons_small sq_briefcase_icon"></i>
78
- <?php echo esc_html__("Already in briefcase", _SQ_PLUGIN_NAME_); ?>
79
  </li>
80
  <?php } else { ?>
81
  <li class="sq_research_add_briefcase m-0 p-1 py-2" data-hidden="0" data-doserp="1" data-keyword="<?php echo SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keywords) ?>">
39
  <tbody>
40
  <?php
41
  foreach ($view->suggested as $key => $row) {
42
+ $in_ranking = false;
43
  if (!empty($view->keywords))
44
  foreach ($view->keywords as $krow) {
45
  if (trim(strtolower($krow->keyword)) == trim(strtolower($row->keywords))) {
46
+ if($krow->do_serp){
47
+ $in_ranking = true;
48
+ }
49
  break;
50
  }
51
  }
52
 
53
  ?>
54
+ <tr class="<?php echo($in_ranking ? 'bg-briefcase' : '') ?>">
55
  <td style="width: 280px;">
56
  <span style="display: block; clear: left; float: left;"><?php echo SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keywords) ?></span>
57
  </td>
74
  </div>
75
  <div class="sq_sm_dropdown">
76
  <ul class="text-left p-2 m-0 ">
77
+ <?php if ($in_ranking) { ?>
78
  <li class="bg-briefcase m-0 p-1 py-2 text-black-50">
79
  <i class="sq_icons_small sq_briefcase_icon"></i>
80
+ <?php echo esc_html__("Already in Rank Checker", _SQ_PLUGIN_NAME_); ?>
81
  </li>
82
  <?php } else { ?>
83
  <li class="sq_research_add_briefcase m-0 p-1 py-2" data-hidden="0" data-doserp="1" data-keyword="<?php echo SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keywords) ?>">
view/Research/Briefcase.php CHANGED
@@ -165,14 +165,21 @@
165
  </td>
166
  <td style="width: 130px;">
167
  <?php if (!$row->rank) { ?>
168
- <?php echo 'N/A' ?>
169
- <?php } else { ?>
 
 
 
 
 
 
 
170
  <a href="<?php echo SQ_Classes_Helpers_Tools::getAdminUrl('sq_rankings', 'rankings', array('strict=1', 'skeyword=' . SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword))) ?>" target="_blank" style="font-weight: bold;font-size: 15px;"><?php echo (int)$row->rank ?></a>
171
  <?php } ?>
172
  </td>
173
  <td>
174
- <?php if (isset($row->research->sv)) {
175
- echo($row->research->sv->absolute <> '' ? '<span data-value="' . (int)$row->research->sv->absolute . '">' . ((isset($row->research->sv->absolute) && is_numeric($row->research->sv->absolute)) ? number_format($row->research->sv->absolute, 0, '.', ',') : $row->research->sv->absolute) . '</span>' : 0);
176
  } else {
177
  echo '<span data-value="0">' . "-" . '</span>';
178
  } ?>
@@ -221,7 +228,7 @@
221
  </li>
222
  <?php if (current_user_can('sq_manage_settings')) { ?>
223
  <?php if (isset($row->do_serp) && !$row->do_serp) { ?>
224
- <li class="sq_research_doserp border-bottom m-0 p-1 py-2" data-keyword="<?php echo SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword) ?>">
225
  <i class="sq_icons_small sq_ranks_icon"></i>
226
  <span><?php echo esc_html__("Send to Rank Checker", _SQ_PLUGIN_NAME_) ?></span>
227
  </li>
165
  </td>
166
  <td style="width: 130px;">
167
  <?php if (!$row->rank) { ?>
168
+ <?php if (isset($row->do_serp) && !$row->do_serp) { ?>
169
+ <button class="sq_research_doserp btn btn-sm btn-link text-black-50 p-0 m-0 text-nowrap" data-success="<?php echo esc_html__("Check Rankings", _SQ_PLUGIN_NAME_) ?>" data-link="<?php echo SQ_Classes_Helpers_Tools::getAdminUrl('sq_rankings', 'rankings', array('strict=1', 'skeyword=' . SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword))) ?>" data-keyword="<?php echo SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword) ?>">
170
+ <?php echo esc_html__("Send to Rank Check", _SQ_PLUGIN_NAME_) ?>
171
+ </button>
172
+ <?php } elseif ($view->checkin->subscription_serpcheck) { ?>
173
+ <a href="<?php echo SQ_Classes_Helpers_Tools::getAdminUrl('sq_rankings', 'rankings', array('strict=1', 'skeyword=' . SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword))) ?>" style="font-weight: bold;font-size: 15px;"><?php echo esc_html__("Not indexed", _SQ_PLUGIN_NAME_) ?></a>
174
+ <?php } else { ?>
175
+ <a href="<?php echo SQ_Classes_Helpers_Tools::getAdminUrl('sq_rankings', 'rankings', array('strict=1', 'skeyword=' . SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword))) ?>" style="font-weight: bold;font-size: 15px;"><?php echo esc_html__("GSC", _SQ_PLUGIN_NAME_) ?></a>
176
+ <?php } ?> <?php } else { ?>
177
  <a href="<?php echo SQ_Classes_Helpers_Tools::getAdminUrl('sq_rankings', 'rankings', array('strict=1', 'skeyword=' . SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword))) ?>" target="_blank" style="font-weight: bold;font-size: 15px;"><?php echo (int)$row->rank ?></a>
178
  <?php } ?>
179
  </td>
180
  <td>
181
+ <?php if (isset($row->research->sv) && isset($row->research->sv->absolute)) {
182
+ echo '<span data-value="' . (int)$row->research->sv->absolute . '">' . ((isset($row->research->sv->absolute) && is_numeric($row->research->sv->absolute)) ? number_format($row->research->sv->absolute, 0, '.', ',') : $row->research->sv->absolute) . '</span>' ;
183
  } else {
184
  echo '<span data-value="0">' . "-" . '</span>';
185
  } ?>
228
  </li>
229
  <?php if (current_user_can('sq_manage_settings')) { ?>
230
  <?php if (isset($row->do_serp) && !$row->do_serp) { ?>
231
+ <li class="sq_research_doserp border-bottom m-0 p-1 py-2" data-success="<?php echo esc_html__("Check Rankings", _SQ_PLUGIN_NAME_) ?>" data-link="<?php echo SQ_Classes_Helpers_Tools::getAdminUrl('sq_rankings', 'rankings', array('strict=1', 'skeyword=' . SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword))) ?>" data-keyword="<?php echo SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword) ?>">
232
  <i class="sq_icons_small sq_ranks_icon"></i>
233
  <span><?php echo esc_html__("Send to Rank Checker", _SQ_PLUGIN_NAME_) ?></span>
234
  </li>
view/Research/Research.php CHANGED
@@ -87,7 +87,7 @@
87
  <?php
88
  if (isset($view->countries) && !empty($view->countries)) {
89
  foreach ($view->countries as $key => $country) {
90
- echo '<option value="' . $key . '" ' . (isset($_COOKIE['sq_country']) && $_COOKIE['sq_country'] == $key ? 'selected="selected"' : '') . '>' . $country . '</option>';
91
  }
92
  }
93
  ?>
@@ -105,9 +105,8 @@
105
  </div>
106
  </div>
107
  <div class="sq_step sq_step3 my-2" style="display: none; min-height: 250px">
108
- <h4 class="text-success text-center my-4"><?php echo esc_html__("Step 3/4: Select similar keywords from below", _SQ_PLUGIN_NAME_) ?>
109
- <div class="text-center small my-2"><?php echo esc_html__("Each selected keyword will consume 1 credit from your keyword research credits.", _SQ_PLUGIN_NAME_) ?></div>
110
- </h4>
111
  <div class="col-sm-10 offset-1">
112
  <div class="custom-control custom-checkbox">
113
  <div class="row">
@@ -161,13 +160,13 @@
161
  <div class="small text-black-50">(may take 2-3 minutes)</div>
162
  </div>
163
  <div class="col-sm-6 m-0 p-0 text-right">
164
- <button type="button" class="sqd-submit btn btn-success px-5" onclick="jQuery('.sq_step4').sq_getResearch(10);"><?php echo esc_html__("Do research", _SQ_PLUGIN_NAME_) ?> >></button>
165
  </div>
166
  </div>
167
  </div>
168
  <?php } else { ?>
169
  <div class="col-sm-8 text-right">
170
- <button type="button" class="sqd-submit btn btn-success px-5" onclick="jQuery('.sq_step4').sq_getResearch(10);"><?php echo esc_html__("Do research", _SQ_PLUGIN_NAME_) ?> >></button>
171
  </div>
172
  <?php } ?>
173
 
87
  <?php
88
  if (isset($view->countries) && !empty($view->countries)) {
89
  foreach ($view->countries as $key => $country) {
90
+ echo '<option value="' . $key . '" ' . (isset($_COOKIE['sq_country']) && sanitize_text_field($_COOKIE['sq_country']) == $key ? 'selected="selected"' : '') . '>' . $country . '</option>';
91
  }
92
  }
93
  ?>
105
  </div>
106
  </div>
107
  <div class="sq_step sq_step3 my-2" style="display: none; min-height: 250px">
108
+ <h4 class="text-success text-center my-4"><?php echo esc_html__("Step 3/4: Select similar keywords from below", _SQ_PLUGIN_NAME_) ?></h4>
109
+ <div class="text-danger text-center my-4" style="display: none"><?php echo esc_html__("Select up to 3 similar keywords and start the research", _SQ_PLUGIN_NAME_) ?></div>
 
110
  <div class="col-sm-10 offset-1">
111
  <div class="custom-control custom-checkbox">
112
  <div class="row">
160
  <div class="small text-black-50">(may take 2-3 minutes)</div>
161
  </div>
162
  <div class="col-sm-6 m-0 p-0 text-right">
163
+ <button type="button" class="sqd-submit btn btn-success px-5" onclick="jQuery('.sq_step4').sq_getResearch(20);"><?php echo esc_html__("Do research", _SQ_PLUGIN_NAME_) ?> >></button>
164
  </div>
165
  </div>
166
  </div>
167
  <?php } else { ?>
168
  <div class="col-sm-8 text-right">
169
+ <button type="button" class="sqd-submit btn btn-success px-5" onclick="jQuery('.sq_step4').sq_getResearch(20);"><?php echo esc_html__("Do research", _SQ_PLUGIN_NAME_) ?> >></button>
170
  </div>
171
  <?php } ?>
172
 
view/Research/ResearchDetails.php CHANGED
@@ -2,7 +2,7 @@
2
  if (!empty($view->kr)) {
3
  //For teh saved country
4
  if (isset($_COOKIE['sq_country'])) {
5
- $view->country = $_COOKIE['sq_country'];
6
  }
7
 
8
  foreach ($view->kr as $nr => $row) {
@@ -22,7 +22,7 @@ if (!empty($view->kr)) {
22
  <td style="width: 33%;"><?php echo(isset($row->keyword) ? SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword) : '') ?></td>
23
  <td style="width: 1%;"><?php echo(isset($view->country) ? esc_html($view->country) : 'com') ?></td>
24
  <td style="width: 20%; color: <?php echo esc_attr($row->stats->sc->color) ?>"><?php echo(isset($row->stats->sc->text) ? '<span data-value="' . esc_attr($row->stats->sc->value) . '">' . esc_html($row->stats->sc->text) . '</span>' : '') ?></td>
25
- <td style="width: 13%; color: <?php echo esc_attr($row->stats->sv->color) ?>"><?php echo(isset($row->stats->sv) ? '<span data-value="' . esc_attr($row->stats->sv->value) . '">' . (is_numeric($row->stats->sv->absolute) ? number_format($row->stats->sv->absolute, 0, '.', ',') . '</span>' : esc_html($row->stats->sv->absolute)) : '') ?></td>
26
  <td style="width: 15%; color: <?php echo esc_attr($row->stats->tw->color) ?>"><?php echo(isset($row->stats->tw) ? '<span data-value="' . esc_attr($row->stats->tw->value) . '">' . esc_html($row->stats->tw->text) . '</span>' : '') ?></td>
27
  <td style="width: 12%; color: <?php echo esc_attr($row->stats->td->color) ?>">
28
  <?php if (isset($row->stats->td)) { ?>
2
  if (!empty($view->kr)) {
3
  //For teh saved country
4
  if (isset($_COOKIE['sq_country'])) {
5
+ $view->country = sanitize_text_field($_COOKIE['sq_country']);
6
  }
7
 
8
  foreach ($view->kr as $nr => $row) {
22
  <td style="width: 33%;"><?php echo(isset($row->keyword) ? SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword) : '') ?></td>
23
  <td style="width: 1%;"><?php echo(isset($view->country) ? esc_html($view->country) : 'com') ?></td>
24
  <td style="width: 20%; color: <?php echo esc_attr($row->stats->sc->color) ?>"><?php echo(isset($row->stats->sc->text) ? '<span data-value="' . esc_attr($row->stats->sc->value) . '">' . esc_html($row->stats->sc->text) . '</span>' : '') ?></td>
25
+ <td style="width: 13%; color: <?php echo esc_attr($row->stats->sv->color) ?>"><?php echo(isset($row->stats->sv) ? '<span data-value="' . (int)$row->stats->sv->absolute . '">' . (is_numeric($row->stats->sv->absolute) ? number_format($row->stats->sv->absolute, 0, '.', ',') . '</span>' : esc_html($row->stats->sv->absolute)) : '') ?></td>
26
  <td style="width: 15%; color: <?php echo esc_attr($row->stats->tw->color) ?>"><?php echo(isset($row->stats->tw) ? '<span data-value="' . esc_attr($row->stats->tw->value) . '">' . esc_html($row->stats->tw->text) . '</span>' : '') ?></td>
27
  <td style="width: 12%; color: <?php echo esc_attr($row->stats->td->color) ?>">
28
  <?php if (isset($row->stats->td)) { ?>
view/Research/Suggested.php CHANGED
@@ -20,7 +20,7 @@
20
 
21
  <div class="card-body p-0">
22
  <div class="col-sm-12 m-0 p-0">
23
- <div class="card col-sm-12 my-4 p-0 px-3 border-0 ">
24
  <?php if (is_array($view->suggested) && !empty($view->suggested)) { ?>
25
  <table class="table table-striped table-hover">
26
  <thead>
@@ -76,21 +76,9 @@
76
  <td>
77
  <span style="display: block; clear: left; float: left;"><?php echo esc_html($row->country) ?></span>
78
  </td>
79
- <td style="width: 150px;">
80
- <?php if (isset($research->sc)) { ?>
81
- <span style="color: <?php echo esc_attr($research->sc->color) ?>" title="<?php echo esc_html__("Competition", _SQ_PLUGIN_NAME_) ?>"><?php echo($research->sc->text <> '' ? esc_html($research->sc->text) : '-') ?></span>
82
- <?php } ?>
83
- </td>
84
- <td style="width: 80px;">
85
- <?php if (isset($research->sv)) { ?>
86
- <span style="color: <?php echo esc_attr($research->sv->color) ?>" title="<?php echo esc_html__("SEO Search Volume", _SQ_PLUGIN_NAME_) ?>"><?php echo($research->sv->absolute <> '' ? esc_html($research->sv->absolute) : '-') ?></span>
87
- <?php } ?>
88
- </td>
89
- <td style="width: 130px;">
90
- <?php if (isset($research->tw)) { ?>
91
- <span style="color: <?php echo esc_attr($research->tw->color) ?>" title="<?php echo esc_html__("Recent discussions", _SQ_PLUGIN_NAME_) ?>"><?php echo($research->tw->text <> '' ? esc_html($research->tw->text) : '-') ?></span>
92
- <?php } ?>
93
- </td>
94
  <td style="width: 100px;">
95
  <?php if (isset($research->td)) { ?>
96
  <?php
@@ -136,6 +124,12 @@
136
  <?php echo esc_html__("Add to briefcase", _SQ_PLUGIN_NAME_); ?>
137
  </li>
138
  <?php } ?>
 
 
 
 
 
 
139
  </ul>
140
  </div>
141
  </div>
20
 
21
  <div class="card-body p-0">
22
  <div class="col-sm-12 m-0 p-0">
23
+ <div class="card col-sm-12 my-4 py-0 px-1 border-0 ">
24
  <?php if (is_array($view->suggested) && !empty($view->suggested)) { ?>
25
  <table class="table table-striped table-hover">
26
  <thead>
76
  <td>
77
  <span style="display: block; clear: left; float: left;"><?php echo esc_html($row->country) ?></span>
78
  </td>
79
+ <td style="width: 20%; color: <?php echo esc_attr($research->sc->color) ?>"><?php echo(isset($research->sc->text) ? '<span data-value="' . esc_attr($research->sc->value) . '">' . esc_html($research->sc->text) . '</span>' : '') ?></td>
80
+ <td style="width: 13%; color: <?php echo esc_attr($research->sv->color) ?>"><?php echo(isset($research->sv) ? '<span data-value="' . (int)$research->sv->absolute . '">' . (is_numeric($research->sv->absolute) ? number_format($research->sv->absolute, 0, '.', ',') . '</span>' : esc_html($research->sv->absolute)) : '') ?></td>
81
+ <td style="width: 15%; color: <?php echo esc_attr($research->tw->color) ?>"><?php echo(isset($research->tw) ? '<span data-value="' . esc_attr($research->tw->value) . '">' . esc_html($research->tw->text) . '</span>' : '') ?></td>
 
 
 
 
 
 
 
 
 
 
 
 
82
  <td style="width: 100px;">
83
  <?php if (isset($research->td)) { ?>
84
  <?php
124
  <?php echo esc_html__("Add to briefcase", _SQ_PLUGIN_NAME_); ?>
125
  </li>
126
  <?php } ?>
127
+ <?php if (current_user_can('sq_manage_settings')) { ?>
128
+ <li class="sq_delete_found m-0 p-1 py-2" data-id="<?php echo (int)$row->id ?>" data-keyword="<?php echo SQ_Classes_Helpers_Sanitize::escapeKeyword($row->keyword) ?>">
129
+ <i class="sq_icons_small fa fa-trash-o"></i>
130
+ <?php echo esc_html__("Delete Keyword", _SQ_PLUGIN_NAME_) ?>
131
+ </li>
132
+ <?php } ?>
133
  </ul>
134
  </div>
135
  </div>
view/SeoSettings/Sitemap.php CHANGED
@@ -270,6 +270,8 @@
270
  </div>
271
  <div class="col-sm-5 p-0 input-group">
272
  <select name="sq_sitemap_perpage" class="form-control bg-input mb-1">
 
 
273
  <option value="100" <?php echo((SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage') == '100') ? 'selected="selected"' : ''); ?>>100</option>
274
  <option value="500" <?php echo((SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage') == '500') ? 'selected="selected"' : ''); ?>>500</option>
275
  <option value="1000" <?php echo((SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage') == '1000') ? 'selected="selected"' : ''); ?>>1000</option>
270
  </div>
271
  <div class="col-sm-5 p-0 input-group">
272
  <select name="sq_sitemap_perpage" class="form-control bg-input mb-1">
273
+ <option value="10" <?php echo((SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage') == '10') ? 'selected="selected"' : ''); ?>>10</option>
274
+ <option value="50" <?php echo((SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage') == '50') ? 'selected="selected"' : ''); ?>>50</option>
275
  <option value="100" <?php echo((SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage') == '100') ? 'selected="selected"' : ''); ?>>100</option>
276
  <option value="500" <?php echo((SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage') == '500') ? 'selected="selected"' : ''); ?>>500</option>
277
  <option value="1000" <?php echo((SQ_Classes_Helpers_Tools::getOption('sq_sitemap_perpage') == '1000') ? 'selected="selected"' : ''); ?>>1000</option>
view/assets/img/settings/banner.png DELETED
Binary file
view/assets/js/briefcase.min.js CHANGED
@@ -1 +1 @@
1
- if(typeof SQ_DEBUG==="undefined")var SQ_DEBUG=false;(function($){"use strict";var briefcaseTable;var briefcaseLabelTable;$.fn.sq_Briefcase=function(){var $this=this;var $popupAddKeyword=$this.find(".sq_add_keyword_dialog");var $popupAddLabel=$this.find(".sq_add_labels_dialog");var $popupEditLabel=$this.find(".sq_edit_label_dialog");$this.listenAdd=function(){$popupAddLabel.find("#sq_labelcolor").wpColorPicker();$popupAddLabel.find("#sq_save_label").on("click",function(){var $button=$(this);var $name=$popupAddLabel.find("input#sq_labelname").val();var $color=$popupAddLabel.find("input#sq_labelcolor").val();$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_addlabel",name:$name,color:$color,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.saved!=="undefined"){location.reload();$button.removeClass("sq_minloading")}else if(typeof response.error!=="undefined"){$button.removeClass("sq_minloading");$.sq_showMessage(response.error).addClass("sq_error")}}).fail(function(){$button.removeClass("sq_minloading")},"json")});$this.find(".sq_save_keyword_labels").on("click",function(){var $popup=$(this).parents(".sq_label_manage_popup:last");var $button=$(this);var $keyword=$(this).data("keyword");var $labels=[];$popup.find('input[name="sq_labels"]:checked').each(function(){$labels.push(this.value)});$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_keywordlabel",keyword:$keyword,labels:$labels,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.saved!=="undefined"){location.reload();$button.removeClass("sq_minloading")}else if(typeof response.error!=="undefined"){$button.removeClass("sq_minloading");$.sq_showMessage(response.error).addClass("sq_error")}}).fail(function(){$button.removeClass("sq_minloading")},"json")})};$this.listenEdit=function(){$popupEditLabel.find("#sq_labelcolor").wpColorPicker();$this.find(".sq_edit_label").on("click",function(){$("#element .wp-picker-clear").trigger("click");$popupEditLabel.find("input#sq_labelid").val($(this).attr("data-id"));$popupEditLabel.find("input#sq_labelname").val($(this).attr("data-name"));$popupEditLabel.find("input#sq_labelcolor").val($(this).attr("data-color"));$popupEditLabel.find("input#sq_labelcolor").trigger("change");$popupAddKeyword.modal("hide");$popupAddLabel.modal("hide");$popupEditLabel.modal("show")});$popupEditLabel.find("#sq_save_label").on("click",function(){var $button=$(this);var $id=$popupEditLabel.find("#sq_labelid").val();var $name=$popupEditLabel.find("#sq_labelname").val();var $color=$popupEditLabel.find("#sq_labelcolor").val();$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_editlabel",id:$id,name:$name,color:$color,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.saved!=="undefined"){location.reload();$button.removeClass("sq_minloading")}else if(typeof response.error!=="undefined"){$button.removeClass("sq_minloading");$.sq_showMessage(response.error).addClass("sq_error")}}).fail(function(){$button.removeClass("sq_minloading")},"json")})};$this.listenDelete=function(){$this.find(".sq_delete").on("click",function(){if(confirm("Are you sure ?")){var $button=$(this);var $keyword=$(this).data("keyword");var $id=$(this).data("id");$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_deletekeyword",keyword:$keyword,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.message!=="undefined"){$this.find("#sq_row_"+$id).remove();$this.find("#sq_subrow_"+$id).remove()}else if(typeof response.error!=="undefined"){$.sq_showMessage(response.error).addClass("sq_error")}$button.removeClass("sq_minloading")}).fail(function(){$button.removeClass("sq_minloading")},"json")}});$this.find(".sq_delete_label").on("click",function(){if(confirm("Are you sure ?")){var $button=$(this).parents(".sq_saved_label:last");var $id=$(this).data("id");$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_deletelabel",id:$id,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.deleted!=="undefined"){location.reload();$button.remove();$this.find("label[data-id="+$id+"]").remove();$this.find(".sq_circle_label[data-id="+$id+"]").remove()}else if(typeof response.error!=="undefined"){$.sq_showMessage(response.error).addClass("sq_error")}$button.removeClass("sq_minloading")}).fail(function(){$button.removeClass("sq_minloading")},"json")}})};$this.listenDoSerp=function(){$this.find(".sq_research_doserp").on("click",function(){var $button=$(this);var $keyword=$(this).data("keyword");$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_ajax_briefcase_doserp",keyword:$keyword,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.message!=="undefined"){$.sq_showMessage(response.message).addClass("sq_success");$button.hide()}else if(typeof response.error!=="undefined"){$.sq_showMessage(response.error)}$button.removeClass("sq_minloading")}).fail(function(){$button.removeClass("sq_minloading")},"json")})};$this.listenOptions=function(){$("#sq_briefcase .sq_filter_label input[type=checkbox]").click(function(){$("#sq_briefcase .sq_filter_label input[type=checkbox]").each(function(){if(!$(this).is(":checked")){$(this).next("label").removeClass("sq_active")}});if($(this).is(":checked")){$(this).next("label").addClass("sq_active")}});$("#sq_briefcase .sq_add_keyword_dialog input[type=checkbox]").click(function(){$("#sq_briefcase .sq_add_keyword_dialog input[type=checkbox]").each(function(){if(!$(this).is(":checked")){$(this).next("label").removeClass("sq_active")}});if($(this).is(":checked")){$(this).next("label").addClass("sq_active")}});$("#sq_briefcase .sq_label_manage_popup input[type=checkbox]").click(function(){var $popup=$(this).parents(".sq_label_manage_popup:last");$popup.find("input[type=checkbox]").each(function(){if(!$(this).is(":checked")){$(this).next("label").removeClass("sq_active")}});if($(this).is(":checked")){$(this).next("label").addClass("sq_active")}})};$this.bulkAction=function(){$this.find(".sq_bulk_submit").on("click",function(){var $button=$(this);if($this.find(".sq_bulk_action").find(":selected").val()!==""){if(!$button.hasClass("btn-modal")&&$this.find(".sq_bulk_action").find(":selected").val()==="sq_ajax_briefcase_bulk_label"){$this.find("#sq_label_manage_popup_bulk").modal("show");return}if($this.find(".sq_bulk_action").find(":selected").data("confirm")){if(!confirm($this.find(".sq_bulk_action").find(":selected").data("confirm"))){return}}var $sq_bulk_input=[];jQuery($this.find(".sq_bulk_input").serializeArray()).each(function(){$sq_bulk_input.push($(this).attr("value"))});var $sq_bulk_labels=[];jQuery($this.find(".sq_bulk_labels").serializeArray()).each(function(){$sq_bulk_labels.push($(this).attr("value"))});$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:$this.find(".sq_bulk_action").find(":selected").val(),inputs:$sq_bulk_input,labels:$sq_bulk_labels,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.message!=="undefined"){$.sq_showMessage(response.message).addClass("sq_success");if($this.find(".sq_bulk_action").find(":selected").val()==="sq_ajax_briefcase_bulk_doserp"){$this.find(".sq_bulk_input").each(function(){if($(this).is(":checked")){$(this).parents("tr:last").find(".sq_research_doserp").remove();$(this).prop("checked",false)}})}else if($this.find(".sq_bulk_action").find(":selected").val()==="sq_ajax_briefcase_bulk_delete"){$this.find(".sq_bulk_input").each(function(){if($(this).is(":checked")){briefcaseTable.row($(this).parents("tr:last")).remove().draw()}})}else{location.reload()}}else if(typeof response.error!=="undefined"){$.sq_showMessage(response.error)}$button.removeClass("sq_minloading")}).fail(function(){$button.removeClass("sq_minloading")},"json")}})};$("#dataTables tbody tr").on("click","td",function(event){});$this.listenAdd();$this.listenEdit();$this.listenDelete();$this.listenDoSerp();$this.listenOptions();$this.bulkAction();return $this};$.fn.loadTable=function(){$.extend($.fn.dataTableExt.oSort,{"formatted-posts-pre":function(a){return parseInt($("<div></div>").append(a).find("span").data("value"))},"formatted-posts-asc":function(a,b){return a-b},"formatted-posts-desc":function(a,b){return b-a},"formatted-value-pre":function(a){return $("<div></div>").append(a).find("span").data("value")},"formatted-value-asc":function(a,b){return a-b},"formatted-value-desc":function(a,b){return b-a},"formatted-progress-pre":function(a){return $("<div></div>").append(a).find("button").data("value")},"formatted-progress-asc":function(a,b){return a-b},"formatted-progress-desc":function(a,b){return b-a},"formatted-num-pre":function(a){return parseInt(a.replace(/[^\d\-\.]/g,""))},"formatted-num-asc":function(a,b){return a-b},"formatted-num-desc":function(a,b){return b-a},"formatted-rank-pre":function(a){var div=$("<div>"+a+"</div>");div.find(".badge").remove();if(div.text()==="N/A"||div.text()==="GSC")return 999;return parseFloat(div.text())},"formatted-rank-asc":function(a,b){return a-b},"formatted-rank-desc":function(a,b){return b-a}});return $(this).DataTable({columnDefs:[{targets:2,sortable:true,type:"formatted-posts"},{targets:3,sortable:true,type:"formatted-rank"},{targets:4,sortable:true,type:"formatted-value"},{targets:5,sortable:true,type:"formatted-progress"},{targets:[0,6],sortable:false}],bPaginate:true,bLengthChange:false,bFilter:false,iDisplayLength:10,aaSorting:[3,"asc",2,"desc"]})};$.fn.loadLabelTable=function(){return $(this).DataTable({columnDefs:[{targets:[1],searchable:true,sortable:true},{targets:[0,2,3],sortable:false}],bPaginate:true,bLengthChange:false,bFilter:false,iDisplayLength:10,aaSorting:[1,"desc"],fixedColumns:true})};$(document).ready(function(){$("#sq_briefcase").sq_Briefcase();$("#sq_briefcaselabels").sq_Briefcase();briefcaseTable=$("#sq_briefcase table.table").loadTable();briefcaseLabelTable=$("#sq_briefcaselabels table.table").loadLabelTable()})})(jQuery);
1
+ if(typeof SQ_DEBUG==="undefined")var SQ_DEBUG=false;(function($){"use strict";var briefcaseTable;var briefcaseLabelTable;var suggestTable;$.fn.sq_Briefcase=function(){var $this=this;var $popupAddKeyword=$this.find(".sq_add_keyword_dialog");var $popupAddLabel=$this.find(".sq_add_labels_dialog");var $popupEditLabel=$this.find(".sq_edit_label_dialog");$this.listenAdd=function(){$popupAddLabel.find("#sq_labelcolor").wpColorPicker();$popupAddLabel.find("#sq_save_label").on("click",function(){var $button=$(this);var $name=$popupAddLabel.find("input#sq_labelname").val();var $color=$popupAddLabel.find("input#sq_labelcolor").val();$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_addlabel",name:$name,color:$color,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.saved!=="undefined"){location.reload();$button.removeClass("sq_minloading")}else if(typeof response.error!=="undefined"){$button.removeClass("sq_minloading");$.sq_showMessage(response.error).addClass("sq_error")}}).fail(function(){$button.removeClass("sq_minloading")},"json")});$this.find(".sq_save_keyword_labels").on("click",function(){var $popup=$(this).parents(".sq_label_manage_popup:last");var $button=$(this);var $keyword=$(this).data("keyword");var $labels=[];$popup.find('input[name="sq_labels"]:checked').each(function(){$labels.push(this.value)});$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_keywordlabel",keyword:$keyword,labels:$labels,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.saved!=="undefined"){location.reload();$button.removeClass("sq_minloading")}else if(typeof response.error!=="undefined"){$button.removeClass("sq_minloading");$.sq_showMessage(response.error).addClass("sq_error")}}).fail(function(){$button.removeClass("sq_minloading")},"json")})};$this.listenEdit=function(){$popupEditLabel.find("#sq_labelcolor").wpColorPicker();$this.find(".sq_edit_label").on("click",function(){$("#element .wp-picker-clear").trigger("click");$popupEditLabel.find("input#sq_labelid").val($(this).attr("data-id"));$popupEditLabel.find("input#sq_labelname").val($(this).attr("data-name"));$popupEditLabel.find("input#sq_labelcolor").val($(this).attr("data-color"));$popupEditLabel.find("input#sq_labelcolor").trigger("change");$popupAddKeyword.modal("hide");$popupAddLabel.modal("hide");$popupEditLabel.modal("show")});$popupEditLabel.find("#sq_save_label").on("click",function(){var $button=$(this);var $id=$popupEditLabel.find("#sq_labelid").val();var $name=$popupEditLabel.find("#sq_labelname").val();var $color=$popupEditLabel.find("#sq_labelcolor").val();$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_editlabel",id:$id,name:$name,color:$color,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.saved!=="undefined"){location.reload();$button.removeClass("sq_minloading")}else if(typeof response.error!=="undefined"){$button.removeClass("sq_minloading");$.sq_showMessage(response.error).addClass("sq_error")}}).fail(function(){$button.removeClass("sq_minloading")},"json")})};$this.listenDelete=function(){$this.find(".sq_delete").on("click",function(){if(confirm("Are you sure ?")){var $button=$(this);var $keyword=$(this).data("keyword");var $id=$(this).data("id");$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_deletekeyword",keyword:$keyword,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.message!=="undefined"){$this.find("#sq_row_"+$id).remove();$this.find("#sq_subrow_"+$id).remove()}else if(typeof response.error!=="undefined"){$.sq_showMessage(response.error).addClass("sq_error")}$button.removeClass("sq_minloading")}).fail(function(){$button.removeClass("sq_minloading")},"json")}});$this.find(".sq_delete_label").on("click",function(){if(confirm("Are you sure ?")){var $button=$(this).parents(".sq_saved_label:last");var $id=$(this).data("id");$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_deletelabel",id:$id,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.deleted!=="undefined"){location.reload();$button.remove();$this.find("label[data-id="+$id+"]").remove();$this.find(".sq_circle_label[data-id="+$id+"]").remove()}else if(typeof response.error!=="undefined"){$.sq_showMessage(response.error).addClass("sq_error")}$button.removeClass("sq_minloading")}).fail(function(){$button.removeClass("sq_minloading")},"json")}});$this.find(".sq_delete_found").on("click",function(){if(confirm("Are you sure ?")){var $button=$(this);var $keyword=$(this).data("keyword");var $id=$(this).data("id");$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_briefcase_deletefound",keyword:$keyword,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.message!=="undefined"){$this.find("#sq_row_"+$id).remove();$this.find("#sq_subrow_"+$id).remove()}else if(typeof response.error!=="undefined"){$.sq_showMessage(response.error).addClass("sq_error")}$button.removeClass("sq_minloading")}).fail(function(){$button.removeClass("sq_minloading")},"json")}})};$this.listenDoSerp=function(){$this.find(".sq_research_doserp").on("click",function(){var $button=$(this);var $keyword=$(this).data("keyword");var $success=$(this).data("success");var $link=$(this).data("link");$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_ajax_briefcase_doserp",keyword:$keyword,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.message!=="undefined"){$.sq_showMessage(response.message).addClass("sq_success");$button.html('<a href="'+$link+'">'+$success+"</a>");$button.off("click")}else if(typeof response.error!=="undefined"){$.sq_showMessage(response.error)}$button.removeClass("sq_minloading")}).fail(function(){$button.removeClass("sq_minloading")},"json")})};$this.listenOptions=function(){$("#sq_briefcase .sq_filter_label input[type=checkbox]").click(function(){$("#sq_briefcase .sq_filter_label input[type=checkbox]").each(function(){if(!$(this).is(":checked")){$(this).next("label").removeClass("sq_active")}});if($(this).is(":checked")){$(this).next("label").addClass("sq_active")}});$("#sq_briefcase .sq_add_keyword_dialog input[type=checkbox]").click(function(){$("#sq_briefcase .sq_add_keyword_dialog input[type=checkbox]").each(function(){if(!$(this).is(":checked")){$(this).next("label").removeClass("sq_active")}});if($(this).is(":checked")){$(this).next("label").addClass("sq_active")}});$("#sq_briefcase .sq_label_manage_popup input[type=checkbox]").click(function(){var $popup=$(this).parents(".sq_label_manage_popup:last");$popup.find("input[type=checkbox]").each(function(){if(!$(this).is(":checked")){$(this).next("label").removeClass("sq_active")}});if($(this).is(":checked")){$(this).next("label").addClass("sq_active")}})};$this.bulkAction=function(){$this.find(".sq_bulk_submit").on("click",function(){var $button=$(this);if($this.find(".sq_bulk_action").find(":selected").val()!==""){if(!$button.hasClass("btn-modal")&&$this.find(".sq_bulk_action").find(":selected").val()==="sq_ajax_briefcase_bulk_label"){$this.find("#sq_label_manage_popup_bulk").modal("show");return}if($this.find(".sq_bulk_action").find(":selected").data("confirm")){if(!confirm($this.find(".sq_bulk_action").find(":selected").data("confirm"))){return}}var $sq_bulk_input=[];jQuery($this.find(".sq_bulk_input").serializeArray()).each(function(){$sq_bulk_input.push($(this).attr("value"))});var $sq_bulk_labels=[];jQuery($this.find(".sq_bulk_labels").serializeArray()).each(function(){$sq_bulk_labels.push($(this).attr("value"))});$button.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:$this.find(".sq_bulk_action").find(":selected").val(),inputs:$sq_bulk_input,labels:$sq_bulk_labels,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.message!=="undefined"){$.sq_showMessage(response.message).addClass("sq_success");if($this.find(".sq_bulk_action").find(":selected").val()==="sq_ajax_briefcase_bulk_doserp"){$this.find(".sq_bulk_input").each(function(){if($(this).is(":checked")){$(this).parents("tr:last").find(".sq_research_doserp").remove();$(this).prop("checked",false)}})}else if($this.find(".sq_bulk_action").find(":selected").val()==="sq_ajax_briefcase_bulk_delete"){$this.find(".sq_bulk_input").each(function(){if($(this).is(":checked")){briefcaseTable.row($(this).parents("tr:last")).remove().draw()}})}else{location.reload()}}else if(typeof response.error!=="undefined"){$.sq_showMessage(response.error)}$button.removeClass("sq_minloading")}).fail(function(){$button.removeClass("sq_minloading")},"json")}})};$("#dataTables tbody tr").on("click","td",function(event){});$this.listenAdd();$this.listenEdit();$this.listenDelete();$this.listenDoSerp();$this.listenOptions();$this.bulkAction();return $this};$.fn.loadTable=function(){$.extend($.fn.dataTableExt.oSort,{"formatted-posts-pre":function(a){return parseInt($("<div></div>").append(a).find("span").data("value"))},"formatted-posts-asc":function(a,b){return a-b},"formatted-posts-desc":function(a,b){return b-a},"formatted-value-pre":function(a){return $("<div></div>").append(a).find("span").data("value")},"formatted-value-asc":function(a,b){return a-b},"formatted-value-desc":function(a,b){return b-a},"formatted-progress-pre":function(a){return $("<div></div>").append(a).find("button").data("value")},"formatted-progress-asc":function(a,b){return a-b},"formatted-progress-desc":function(a,b){return b-a},"formatted-num-pre":function(a){return parseInt(a.replace(/[^\d\-\.]/g,""))},"formatted-num-asc":function(a,b){return a-b},"formatted-num-desc":function(a,b){return b-a},"formatted-rank-pre":function(a){var div=$("<div>"+a+"</div>");div.find(".badge").remove();if(div.text()==="N/A"||div.text()==="GSC")return 999;return parseFloat(div.text())},"formatted-rank-asc":function(a,b){return a-b},"formatted-rank-desc":function(a,b){return b-a}});return $(this).DataTable({columnDefs:[{targets:2,sortable:true,type:"formatted-posts"},{targets:3,sortable:true,type:"formatted-rank"},{targets:4,sortable:true,type:"formatted-value"},{targets:5,sortable:true,type:"formatted-progress"},{targets:[0,6],sortable:false}],bPaginate:true,bLengthChange:false,bFilter:false,iDisplayLength:10,aaSorting:[3,"asc",2,"desc"]})};$.fn.loadLabelTable=function(){return $(this).DataTable({columnDefs:[{targets:[1],searchable:true,sortable:true},{targets:[0,2,3],sortable:false}],bPaginate:true,bLengthChange:false,bFilter:false,iDisplayLength:10,aaSorting:[1,"desc"],fixedColumns:true})};$.fn.loadSuggestTable=function(){$.extend($.fn.dataTableExt.oSort,{"formatted-value-pre":function(a){return $("<div></div>").append(a).find("span").data("value")},"formatted-value-asc":function(a,b){return a-b},"formatted-value-desc":function(a,b){return b-a}});$(this).DataTable({columnDefs:[{targets:[5,6],sortable:false},{targets:[2,3,4],sortable:true,type:"formatted-value"}],bPaginate:false,bLengthChange:false,bFilter:true,iDisplayLength:50,fixedColumns:true})};$(document).ready(function(){$("#sq_briefcase").sq_Briefcase();$("#sq_briefcaselabels").sq_Briefcase();$("#sq_suggested").sq_Briefcase();briefcaseTable=$("#sq_briefcase table.table").loadTable();briefcaseLabelTable=$("#sq_briefcaselabels table.table").loadLabelTable();suggestTable=$("#sq_suggested table.table").loadSuggestTable()})})(jQuery);
view/assets/js/research.min.js CHANGED
@@ -1 +1 @@
1
- if(typeof SQ_DEBUG==="undefined")var SQ_DEBUG=false;(function($){"use strict";var sqs_script="kr";$(document).keypress(function(event){var keycode=event.keyCode||event.which;if(keycode==13){$(".sqd-submit:visible").trigger("click")}});$.sq_steps=function(step){if(step===2&&$("input[name=sq_input_keyword]").val()===""){$.sq_showMessage("Add a keyword first",2e3);return}$(".sq_step").hide();$(".sq_step"+step).show()};$.fn.sq_getSuggested=function(){var $this=this;var $keywords=$("input[name=sq_input_keyword]").val();var $country=$("select[name=sq_select_country] option:selected").val();$.sq_setCookie("sq_country",$country);if($keywords!==""){$.sq_steps(3);$this.addClass("sq_loading");$.post(sqQuery.ajaxurl,{action:"sq_ajax_research_others",keyword:$keywords,country:$country,lang:"en",sq_nonce:sqQuery.nonce}).done(function(response){$this.removeClass("sq_loading");var $count=0;if(typeof response.keywords!=="undefined"&&response.keywords!==null&&response.keywords.length>0){$this.find(".sq_suggested").each(function(){if(typeof response.keywords[$count]!=="undefined"){$(this).html('<input type="checkbox" id="sq_input_keywords'+$count+'" name="sq_input_keywords[]" class="sq_input_keywords custom-control-input" value="'+response.keywords[$count]+'"><label class="custom-control-label" for="sq_input_keywords'+$count+'">'+response.keywords[$count]+"</label>");$count++}else{$(this).hide()}})}else if(typeof response.error!=="undefined"&&response.error==="limit_exceeded"){$this.find(".sq_limit_exceeded").show()}else{$this.find(".sq_research_error").show()}}).fail(function(){$this.removeClass("sq_loading").show();$this.prepend('<div class="text-center text-warning">Squirrly Library loading error. Please contact us at support@squirrly.co</div>')})}else{$(".sq_step2").find(".sq_research_error").show()}};$.fn.sq_getResearch=function($count){var $this=this;$.sq_steps(4);$this.find(".btn").hide();var $loadingdiv=$("div.sq_step4").find(".sq_loading_steps");var $keywords=$("input[name=sq_input_keyword]").val();var $post_id=$("input[name=post_id]").val();var $process=0;var $table=$("div.sq_step4 table");var $country=$("select[name=sq_select_country] option:selected").val();$.sq_setCookie("sq_country",$country);if(typeof $count==="undefined"){$count=10}$("input.sq_input_keywords:checked").each(function(){$keywords+=","+$(this).val()});if($.fn.DataTable.isDataTable($table)){$table.DataTable().destroy();$table.find("tbody").html("");$table.hide();$this.off("sq_research_loaded");$(".sq_research_success").hide();$loadingdiv.hide()}$this.addClass("sq_loading");var $loadingstep=1;$loadingdiv.show();$loadingdiv.find(".sq_loading_step").hide();$loadingdiv.find(".sq_loading_step"+$loadingstep).show();$.post(sqQuery.ajaxurl,{action:"sq_ajax_research_process",keywords:$keywords,country:$country,count:$count,lang:"en",sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.error!=="undefined"){$this.removeClass("sq_loading");$loadingdiv.hide();$.sq_showMessage(response.error,1e4).addClass("sq_error")}else{if(typeof response.id!=="undefined"){$process=response.id}$this.trigger("sq_research_loaded")}},"json");$this.on("sq_research_loaded",function(){if($process){$.post(sqQuery.ajaxurl,{action:"sq_ajax_research_process",id:$process,post_id:$post_id,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.error!=="undefined"){$this.off("sq_research_loaded");$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$.sq_showMessage(response.error,1e4).addClass("sq_error")}if(typeof response.done!=="undefined"&&response.done&&typeof response.html!=="undefined"){$this.off("sq_research_loaded");$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$table.find("tbody").html(response.html);$table.show();$(".sq_research_success").show();$table.find(".sq_trend:visible").each(function(){$.sq_loadChart($(this))});$table.find(".sq_research_add_briefcase").each(function(){$(this).on("click",function(){$(this).sq_addBriefcase()})});$.extend($.fn.dataTableExt.oSort,{"formatted-value-pre":function(a){return $("<div></div>").append(a).find("span").data("value")},"formatted-value-asc":function(a,b){return a-b},"formatted-value-desc":function(a,b){return b-a},"formatted-num-pre":function(a){return parseInt(a)>0?parseInt(a.replace(/[^\d\-\.]/g,"")):99},"formatted-num-asc":function(a,b){return a-b},"formatted-num-desc":function(a,b){return b-a}});$table.DataTable({columnDefs:[{targets:[5,6],sortable:false},{targets:[2,3],sortable:true,type:"formatted-value"},{targets:[4],sortable:true,type:"formatted-num"}],bPaginate:false,bLengthChange:false,bFilter:true,iDisplayLength:50,fixedColumns:true})}else{$loadingstep++;if($loadingstep<=9){$loadingdiv.find(".sq_loading_step").hide();$loadingdiv.find(".sq_loading_step"+$loadingstep).show()}if($loadingstep>50){$this.off("sq_research_loaded");$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$.sq_showMessage("Lost connection with the server. Please make sure you whitelisted the IP from https://api.squirrly.co",1e4).addClass("sq_error")}setTimeout(function(){$this.trigger("sq_research_loaded")},5e3)}}).fail(function(){$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$(".sq_research_timeout_error").show()},"json")}else{$this.off("sq_research_loaded");$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$.sq_showMessage("Could not start the research on our server. Please check again in a minute.",1e4).addClass("sq_error")}});return $this};$.fn.sq_getHistory=function(){var $this=this;var $id=$this.data("id");var $destination=$($this.data("destination"));if(!$destination.length){if(!$("#history"+$id).length){$destination=$('<tr id="history'+$id+'"></tr>');$this.parents("tr:last").after($destination);$destination.show()}}else{$($destination).remove();return}if($($destination).is(":visible")){$this.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_ajax_research_history",id:$this.data("id"),sq_nonce:sqQuery.nonce}).done(function(response){$this.removeClass("sq_minloading");if(typeof response.html!=="undefined"){$destination.html(response.html);$destination.find(".sq_trend:visible").each(function(){$.sq_loadChart($(this))})}$destination.find(".sq_research_add_briefcase").each(function(){$(this).on("click",function(){$(this).sq_addBriefcase()})})}).fail(function(){$this.removeClass("sq_minloading");$destination.html('<td colspan="4" class="col-sm-12 text-center my-3 text-danger">Could not find the records</td>')},"json")}};$(document).ready(function(){$(".sq_history_details").on("click",function(){$(this).sq_getHistory()});$(".sq_research_add_briefcase").each(function(){$(this).on("click",function(){$(this).sq_addBriefcase()})})})})(jQuery);
1
+ if(typeof SQ_DEBUG==="undefined")var SQ_DEBUG=false;(function($){"use strict";var sqs_script="kr";$(document).keypress(function(event){var keycode=event.keyCode||event.which;if(keycode==13){$(".sqd-submit:visible").trigger("click")}});$.sq_steps=function(step){if(step===2&&$("input[name=sq_input_keyword]").val()===""){$.sq_showMessage("Add a keyword first",2e3);return}$(".sq_step").hide();$(".sq_step"+step).show()};$.fn.sq_getSuggested=function(){var $this=this;var $keywords=$("input[name=sq_input_keyword]").val();var $country=$("select[name=sq_select_country] option:selected").val();$.sq_setCookie("sq_country",$country);if($keywords!==""){$.sq_steps(3);$this.addClass("sq_loading");$.post(sqQuery.ajaxurl,{action:"sq_ajax_research_others",keyword:$keywords,country:$country,lang:"en",sq_nonce:sqQuery.nonce}).done(function(response){$this.removeClass("sq_loading");var $count=0;if(typeof response.keywords!=="undefined"&&response.keywords!==null&&response.keywords.length>0){$this.find(".sq_suggested").each(function(){if(typeof response.keywords[$count]!=="undefined"){$(this).html('<input type="checkbox" id="sq_input_keywords'+$count+'" name="sq_input_keywords[]" class="sq_input_keywords custom-control-input" value="'+response.keywords[$count]+'"><label class="custom-control-label" for="sq_input_keywords'+$count+'">'+response.keywords[$count]+"</label>");$count++}else{$(this).hide()}});var limit=3;$this.find("input.sq_input_keywords").on("change",function(evt){if($this.find("input.sq_input_keywords:checked").length>limit){$(this).prop("checked",false);alert($this.find("div.text-danger").text())}})}else if(typeof response.error!=="undefined"&&response.error==="limit_exceeded"){$this.find(".sq_limit_exceeded").show()}else{$this.find(".sq_research_error").show()}}).fail(function(){$this.removeClass("sq_loading").show();$this.prepend('<div class="text-center text-warning">Squirrly Library loading error. Please contact us at support@squirrly.co</div>')})}else{$(".sq_step2").find(".sq_research_error").show()}};$.fn.sq_getResearch=function($count){var $this=this;$.sq_steps(4);$this.find(".btn").hide();var $loadingdiv=$("div.sq_step4").find(".sq_loading_steps");var $keywords=$("input[name=sq_input_keyword]").val();var $post_id=$("input[name=post_id]").val();var $process=0;var $table=$("div.sq_step4 table");var $country=$("select[name=sq_select_country] option:selected").val();$.sq_setCookie("sq_country",$country);if(typeof $count==="undefined"){$count=10}$("input.sq_input_keywords:checked").each(function(){$keywords+=","+$(this).val()});if($.fn.DataTable.isDataTable($table)){$table.DataTable().destroy();$table.find("tbody").html("");$table.hide();$this.off("sq_research_loaded");$(".sq_research_success").hide();$loadingdiv.hide()}$this.addClass("sq_loading");var $loadingstep=1;$loadingdiv.show();$loadingdiv.find(".sq_loading_step").hide();$loadingdiv.find(".sq_loading_step"+$loadingstep).show();$.post(sqQuery.ajaxurl,{action:"sq_ajax_research_process",keywords:$keywords,country:$country,count:$count,lang:"en",sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.error!=="undefined"){$this.removeClass("sq_loading");$loadingdiv.hide();$.sq_showMessage(response.error,1e4).addClass("sq_error")}else{if(typeof response.id!=="undefined"){$process=response.id}$this.trigger("sq_research_loaded")}},"json");$this.on("sq_research_loaded",function(){if($process){$.post(sqQuery.ajaxurl,{action:"sq_ajax_research_process",id:$process,post_id:$post_id,sq_nonce:sqQuery.nonce}).done(function(response){if(typeof response.error!=="undefined"){$this.off("sq_research_loaded");$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$.sq_showMessage(response.error,1e4).addClass("sq_error")}if(typeof response.done!=="undefined"&&response.done&&typeof response.html!=="undefined"){$this.off("sq_research_loaded");$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$table.find("tbody").html(response.html);$table.show();$(".sq_research_success").show();$table.find(".sq_trend:visible").each(function(){$.sq_loadChart($(this))});$table.find(".sq_research_add_briefcase").each(function(){$(this).on("click",function(){$(this).sq_addBriefcase()})});$.extend($.fn.dataTableExt.oSort,{"formatted-value-pre":function(a){return $("<div></div>").append(a).find("span").data("value")},"formatted-value-asc":function(a,b){return a-b},"formatted-value-desc":function(a,b){return b-a}});$table.DataTable({columnDefs:[{targets:[5,6],sortable:false},{targets:[2,3,4],sortable:true,type:"formatted-value"}],bPaginate:false,bLengthChange:false,bFilter:true,iDisplayLength:50,fixedColumns:true})}else{$loadingstep++;if($loadingstep<=9){$loadingdiv.find(".sq_loading_step").hide();$loadingdiv.find(".sq_loading_step"+$loadingstep).show()}if($loadingstep>50){$this.off("sq_research_loaded");$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$.sq_showMessage("Lost connection with the server. Please make sure you whitelisted the IP from https://api.squirrly.co",1e4).addClass("sq_error")}setTimeout(function(){$this.trigger("sq_research_loaded")},5e3)}}).fail(function(){$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$(".sq_research_timeout_error").show()},"json")}else{$this.off("sq_research_loaded");$this.removeClass("sq_loading");$loadingdiv.hide();$this.find(".btn").show();$.sq_showMessage("Could not start the research on our server. Please check again in a minute.",1e4).addClass("sq_error")}});return $this};$.fn.sq_getHistory=function(){var $this=this;var $id=$this.data("id");var $destination=$($this.data("destination"));if(!$destination.length){if(!$("#history"+$id).length){$destination=$('<tr id="history'+$id+'"></tr>');$this.parents("tr:last").after($destination);$destination.show()}}else{$($destination).remove();return}if($($destination).is(":visible")){$this.addClass("sq_minloading");$.post(sqQuery.ajaxurl,{action:"sq_ajax_research_history",id:$this.data("id"),sq_nonce:sqQuery.nonce}).done(function(response){$this.removeClass("sq_minloading");if(typeof response.html!=="undefined"){$destination.html(response.html);$destination.find(".sq_trend:visible").each(function(){$.sq_loadChart($(this))})}$destination.find(".sq_research_add_briefcase").each(function(){$(this).on("click",function(){$(this).sq_addBriefcase()})})}).fail(function(){$this.removeClass("sq_minloading");$destination.html('<td colspan="4" class="col-sm-12 text-center my-3 text-danger">Could not find the records</td>')},"json")}};$(document).ready(function(){$(".sq_history_details").on("click",function(){$(this).sq_getHistory()});$(".sq_research_add_briefcase").each(function(){$(this).on("click",function(){$(this).sq_addBriefcase()})})})})(jQuery);