SEO SQUIRRLY™ - Version 11.0.04

Version Description

  • 03/08/2021 = Update - Add Json-LD types for Automation and Snippet Update - Add new data in Json-LD Organizaztion like: Geo Location, Address, Country Update - Option in Json-LD to force the Json-LD author/person in all pages Update - Add Device Option (desktop, tablet, mobile) for Google Ranking check for each keyword Update - Add Google Language option on Ranking check for each keyword Fixed - Keyword Research javascript issue on Firefox browser Fixed - Decode URL for Json-LD to prevent invalid URLs Fixed - Deprecated functions and number of parameters Fixed - Small bugs
Download this release

Release Info

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

Code changes from version 11.0.03 to 11.0.04

Files changed (48) hide show
  1. classes/ActionController.php +3 -16
  2. classes/BlockController.php +5 -7
  3. classes/DisplayController.php +1 -0
  4. classes/Error.php +1 -2
  5. classes/FrontController.php +5 -7
  6. classes/HookController.php +1 -0
  7. classes/ObjController.php +1 -0
  8. classes/RemoteController.php +114 -91
  9. classes/helpers/DevKit.php +148 -8
  10. classes/helpers/Sanitize.php +51 -0
  11. classes/helpers/Tools.php +264 -118
  12. config.json +8 -1
  13. config/config.php +2 -1
  14. config/paths.php +1 -0
  15. controllers/Api.php +3 -0
  16. controllers/Assistant.php +2 -0
  17. controllers/Audits.php +29 -4
  18. controllers/BulkSeo.php +0 -2
  19. controllers/Dashboard.php +1 -0
  20. controllers/Features.php +32 -0
  21. controllers/FocusPages.php +39 -37
  22. controllers/Frontend.php +69 -46
  23. controllers/Menu.php +175 -233
  24. controllers/Onboarding.php +20 -5
  25. controllers/Overview.php +6 -1
  26. controllers/Patterns.php +1 -1
  27. controllers/Post.php +48 -18
  28. controllers/PostsList.php +17 -3
  29. controllers/Ranking.php +18 -10
  30. controllers/Research.php +30 -4
  31. controllers/SeoSettings.php +54 -9
  32. controllers/Sitemaps.php +22 -2
  33. controllers/Snippet.php +1 -1
  34. core/BlockAssistant.php +1 -1
  35. core/BlockConnect.php +1 -3
  36. core/BlockFeatures.php +602 -3
  37. core/BlockJorney.php +1 -1
  38. core/BlockKnowledgeBase.php +1 -1
  39. core/BlockSearch.php +1 -1
  40. core/BlockStats.php +3 -7
  41. core/BlockToolbar.php +0 -2
  42. core/Blocklogin.php +9 -0
  43. languages/squirrly-seo-cs_CZ.mo +0 -0
  44. languages/squirrly-seo-cs_CZ.po +1263 -12022
  45. languages/squirrly-seo-de_DE.mo +0 -0
  46. languages/squirrly-seo-de_DE.po +3957 -3450
  47. languages/squirrly-seo-ro_RO.mo +0 -0
  48. languages/squirrly-seo-ro_RO.po +331 -248
classes/ActionController.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  /**
4
  * Set the ajax action and call for wordpress
@@ -42,26 +43,12 @@ class SQ_Classes_ActionController extends SQ_Classes_FrontController {
42
  * @return void
43
  */
44
  public function hookHead() {
45
- echo '<script>
46
- var sqQuery = {
47
- "adminurl": "' . admin_url() . '",
48
- "ajaxurl": "' . admin_url('admin-ajax.php') . '",
49
- "adminposturl": "' . admin_url('post.php') . '",
50
- "adminlisturl": "' . admin_url('edit.php') . '",
51
- "nonce": "' . wp_create_nonce(_SQ_NONCE_ID_) . '"
52
- }
53
- </script>';
54
  }
55
 
56
  public function hookFronthead() {
57
  if (SQ_Classes_Helpers_Tools::isFrontAdmin()) {
58
- echo '<script>
59
- var sqQuery = {
60
- "adminurl": "' . admin_url() . '",
61
- "ajaxurl": "' . admin_url('admin-ajax.php') . '",
62
- "nonce": "' . wp_create_nonce(_SQ_NONCE_ID_) . '"
63
- }
64
- </script>';
65
  }
66
  }
67
 
1
  <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
 
4
  /**
5
  * Set the ajax action and call for wordpress
43
  * @return void
44
  */
45
  public function hookHead() {
46
+ echo '<script>var sqQuery = {"adminurl": "' . admin_url() . '","ajaxurl": "' . admin_url('admin-ajax.php') . '","adminposturl": "' . admin_url('post.php') . '","adminlisturl": "' . admin_url('edit.php') . '","nonce": "' . wp_create_nonce(_SQ_NONCE_ID_) . '"}</script>';
 
 
 
 
 
 
 
 
47
  }
48
 
49
  public function hookFronthead() {
50
  if (SQ_Classes_Helpers_Tools::isFrontAdmin()) {
51
+ echo '<script>var sqQuery = {"adminurl": "' . admin_url() . '","ajaxurl": "' . admin_url('admin-ajax.php') . '","nonce": "' . wp_create_nonce(_SQ_NONCE_ID_) . '"}</script>';
 
 
 
 
 
 
52
  }
53
  }
54
 
classes/BlockController.php CHANGED
@@ -42,15 +42,13 @@ class SQ_Classes_BlockController {
42
  //get the class path
43
  $class = SQ_Classes_ObjController::getClassPath($this->name);
44
 
45
- if ($this->flush) {
46
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia($class['name']);
47
-
48
- echo (string)$this->getView($class['name']);
49
- } else {
50
- return (string)$this->getView($class['name']);
51
  }
52
 
53
- return '';
 
 
54
  }
55
 
56
  /**
42
  //get the class path
43
  $class = SQ_Classes_ObjController::getClassPath($this->name);
44
 
45
+ if (!$this->flush) {
46
+ return $this->getView($class['name']);
 
 
 
 
47
  }
48
 
49
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia($class['name']);
50
+ echo (string)$this->getView($class['name']);
51
+
52
  }
53
 
54
  /**
classes/DisplayController.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  /**
4
  * The class handles the theme part in WP
1
  <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
 
4
  /**
5
  * The class handles the theme part in WP
classes/Error.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php
2
-
3
- defined('ABSPATH') || exit;
4
 
5
  class SQ_Classes_Error extends SQ_Classes_FrontController {
6
 
1
  <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
 
3
 
4
  class SQ_Classes_Error extends SQ_Classes_FrontController {
5
 
classes/FrontController.php CHANGED
@@ -57,15 +57,13 @@ class SQ_Classes_FrontController {
57
  public function init() {
58
  $class = SQ_Classes_ObjController::getClassPath($this->name);
59
 
60
- if ($this->flush) {
61
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia($class['name']);
62
-
63
- echo (string)$this->getView($class['name']);
64
- } else {
65
- return (string)$this->getView($class['name']);
66
  }
67
 
68
- return '';
 
 
69
  }
70
 
71
  /**
57
  public function init() {
58
  $class = SQ_Classes_ObjController::getClassPath($this->name);
59
 
60
+ if (!$this->flush) {
61
+ return $this->getView($class['name']);
 
 
 
 
62
  }
63
 
64
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia($class['name']);
65
+ echo $this->getView($class['name']);
66
+
67
  }
68
 
69
  /**
classes/HookController.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  /**
4
  * The class handles the actions in WP
1
  <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
 
4
  /**
5
  * The class handles the actions in WP
classes/ObjController.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  /**
4
  * The class creates object for plugin classes
1
  <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
 
4
  /**
5
  * The class creates object for plugin classes
classes/RemoteController.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  class SQ_Classes_RemoteController {
4
 
@@ -15,12 +16,19 @@ class SQ_Classes_RemoteController {
15
  public static function apiCall($module, $args = array(), $options = array()) {
16
  $parameters = "";
17
 
 
 
 
 
 
 
 
18
  //predefined options
19
  $options = array_merge(
20
  array(
21
  'method' => self::$apimethod,
22
  'sslverify' => SQ_CHECK_SSL,
23
- 'timeout' => 15,
24
  'headers' => array(
25
  'USER-TOKEN' => SQ_Classes_Helpers_Tools::getOption('sq_api'),
26
  'USER-URL' => apply_filters('sq_homeurl', get_bloginfo('url')),
@@ -86,11 +94,7 @@ class SQ_Classes_RemoteController {
86
  * @return string
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
- }
94
  }
95
 
96
  /**
@@ -175,6 +179,9 @@ class SQ_Classes_RemoteController {
175
  return (new WP_Error('api_error', $json->error));
176
  }
177
 
 
 
 
178
  return $json;
179
  }
180
 
@@ -195,6 +202,9 @@ class SQ_Classes_RemoteController {
195
  return (new WP_Error('api_error', 'no_data'));
196
  }
197
 
 
 
 
198
  if (!empty($json->data)) {
199
  return $json->data;
200
  }
@@ -219,6 +229,9 @@ class SQ_Classes_RemoteController {
219
  return (new WP_Error('api_error', 'no_data'));
220
  }
221
 
 
 
 
222
  if (!empty($json->data)) {
223
  return $json->data;
224
  }
@@ -253,6 +266,10 @@ class SQ_Classes_RemoteController {
253
  public static function checkin($args = array()) {
254
  self::$apimethod = 'get'; //call method
255
 
 
 
 
 
256
  $json = json_decode(self::apiCall('api/user/checkin', $args));
257
 
258
  if (isset($json->error) && $json->error <> '') {
@@ -289,6 +306,7 @@ class SQ_Classes_RemoteController {
289
  SQ_Classes_Helpers_Tools::saveOptions('connect', $connect);
290
  }
291
 
 
292
  return $json->data;
293
  }
294
 
@@ -318,76 +336,32 @@ class SQ_Classes_RemoteController {
318
 
319
  /**
320
  * Get the API stats for this blog
321
- * @return array
 
322
  */
323
  public static function getStats() {
324
  self::$apimethod = 'get'; //call method
325
 
326
- $args = $stats = array();
327
- if ($json = json_decode(self::apiCall('api/user/stats', $args))) {
328
-
329
- if (isset($json->error) && $json->error <> '') {
330
- self::connect(); //connect the website
331
 
332
- return (new WP_Error('api_error', $json->error));
333
- } elseif (!isset($json->data)) {
334
- return (new WP_Error('api_error', 'no_data'));
335
- }
336
 
337
- if (!isset($json->data)) {
338
- return (new WP_Error('api_error', 'no_data'));
339
- }
 
 
340
 
341
- $data = $json->data;
342
- if (isset($data->optimized_articles) && isset($data->average_optimization) && isset($data->kr_research) && isset($data->kr_in_briefcase)
343
- && isset($data->ranked_top) && isset($data->audits_made)) {
344
-
345
-
346
- //Get last month articles
347
- $stats['all_articles'] = array();
348
- $stats['all_articles']['value'] = ((int)$data->optimized_articles);
349
- $stats['all_articles']['text'] = esc_html__("Articles optimized so far", _SQ_PLUGIN_NAME_);
350
- $stats['all_articles']['link'] = SQ_Classes_Helpers_Tools::getAdminUrl('sq_assistant', 'assistant');
351
- $stats['all_articles']['linktext'] = esc_html__("add post", _SQ_PLUGIN_NAME_);
352
-
353
- //Get last month articles
354
- $stats['avg_articles'] = array();
355
- $stats['avg_articles']['value'] = ((int)$data->average_optimization);
356
- $stats['avg_articles']['text'] = esc_html__("Average optimization", _SQ_PLUGIN_NAME_);
357
- $stats['avg_articles']['link'] = SQ_Classes_Helpers_Tools::getAdminUrl('sq_assistant');
358
- $stats['avg_articles']['linktext'] = esc_html__("add post", _SQ_PLUGIN_NAME_);
359
-
360
- //Get all keyword researched
361
- $stats['all_researches'] = array();
362
- $stats['all_researches']['value'] = (int)$data->kr_research;
363
- $stats['all_researches']['text'] = esc_html__("Keyword Researches", _SQ_PLUGIN_NAME_);
364
- $stats['all_researches']['link'] = SQ_Classes_Helpers_Tools::getAdminUrl('sq_research');
365
- $stats['all_researches']['linktext'] = esc_html__("do research", _SQ_PLUGIN_NAME_);
366
-
367
- //Get all keywords from briefcase
368
- $stats['all_briefcase'] = array();
369
- $stats['all_briefcase']['value'] = (int)$data->kr_in_briefcase;
370
- $stats['all_briefcase']['text'] = esc_html__("Keywords stored in Squirrly Briefcase", _SQ_PLUGIN_NAME_);
371
- $stats['all_briefcase']['link'] = SQ_Classes_Helpers_Tools::getAdminUrl('sq_research', 'briefcase');
372
- $stats['all_briefcase']['linktext'] = esc_html__("add keyword", _SQ_PLUGIN_NAME_);
373
-
374
- //Get the top 100 ranking
375
- $stats['top_ranking'] = array();
376
- $stats['top_ranking']['value'] = (int)$data->ranked_top;
377
- $stats['top_ranking']['text'] = esc_html__("Pages ranking in top 100 Google", _SQ_PLUGIN_NAME_);
378
- $stats['top_ranking']['link'] = SQ_Classes_Helpers_Tools::getAdminUrl('sq_rankings');
379
- $stats['top_ranking']['linktext'] = esc_html__("see rankings", _SQ_PLUGIN_NAME_);
380
-
381
- //Get last month audits
382
- $stats['lm_audit'] = array();
383
- $stats['lm_audit']['value'] = (int)$data->audits_made;
384
- $stats['lm_audit']['text'] = esc_html__("SEO Audits", _SQ_PLUGIN_NAME_);
385
- $stats['lm_audit']['link'] = SQ_Classes_Helpers_Tools::getAdminUrl('sq_audits');
386
- $stats['lm_audit']['linktext'] = esc_html__("see audits", _SQ_PLUGIN_NAME_);
387
- }
388
  }
389
 
390
- return $stats;
 
391
  }
392
 
393
  /**
@@ -434,6 +408,29 @@ class SQ_Classes_RemoteController {
434
 
435
 
436
  /******************************** BRIEFCASE *********************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  public static function getBriefcase($args = array()) {
438
  self::$apimethod = 'get'; //call method
439
 
@@ -455,6 +452,9 @@ class SQ_Classes_RemoteController {
455
  public static function addBriefcaseKeyword($args = array()) {
456
  self::$apimethod = 'post'; //call method
457
 
 
 
 
458
  $json = json_decode(self::apiCall('api/briefcase/add', $args));
459
 
460
  if (isset($json->error) && $json->error <> '') {
@@ -480,14 +480,15 @@ class SQ_Classes_RemoteController {
480
  return false;
481
  }
482
 
483
- public static function getBriefcaseStats($args = array()) {
484
- self::$apimethod = 'get'; //call method
485
 
486
- $json = json_decode(self::apiCall('api/briefcase/stats', $args));
 
487
 
488
- if (isset($json->error) && $json->error <> '') {
489
- self::connect(); //connect the website
490
 
 
491
  return (new WP_Error('api_error', $json->error));
492
  } elseif (!isset($json->data)) {
493
  return (new WP_Error('api_error', 'no_data'));
@@ -500,10 +501,13 @@ class SQ_Classes_RemoteController {
500
  return false;
501
  }
502
 
503
- public static function saveBriefcaseKeywordLabel($args = array()) {
504
  self::$apimethod = 'post'; //call method
505
 
506
- $json = json_decode(self::apiCall('api/briefcase/label/keyword', $args));
 
 
 
507
 
508
  if (isset($json->error) && $json->error <> '') {
509
  return (new WP_Error('api_error', $json->error));
@@ -518,11 +522,13 @@ class SQ_Classes_RemoteController {
518
  return false;
519
  }
520
 
521
-
522
- public static function addBriefcaseLabel($args = array()) {
523
  self::$apimethod = 'post'; //call method
524
 
525
- $json = json_decode(self::apiCall('api/briefcase/label/add', $args));
 
 
 
526
 
527
  if (isset($json->error) && $json->error <> '') {
528
  return (new WP_Error('api_error', $json->error));
@@ -537,10 +543,10 @@ class SQ_Classes_RemoteController {
537
  return false;
538
  }
539
 
540
- public static function saveBriefcaseLabel($args = array()) {
541
  self::$apimethod = 'post'; //call method
542
 
543
- $json = json_decode(self::apiCall('api/briefcase/label/save', $args));
544
 
545
  if (isset($json->error) && $json->error <> '') {
546
  return (new WP_Error('api_error', $json->error));
@@ -555,10 +561,10 @@ class SQ_Classes_RemoteController {
555
  return false;
556
  }
557
 
558
- public static function removeBriefcaseLabel($args = array()) {
559
  self::$apimethod = 'post'; //call method
560
 
561
- $json = json_decode(self::apiCall('api/briefcase/label/delete', $args));
562
 
563
  if (isset($json->error) && $json->error <> '') {
564
  return (new WP_Error('api_error', $json->error));
@@ -573,6 +579,7 @@ class SQ_Classes_RemoteController {
573
  return false;
574
  }
575
 
 
576
  /******************************** KEYWORD RESEARCH ****************/
577
 
578
  /**
@@ -625,6 +632,10 @@ class SQ_Classes_RemoteController {
625
  public static function setKRSuggestion($args = array()) {
626
  self::$apimethod = 'post'; //call method
627
 
 
 
 
 
628
  $json = json_decode(self::apiCall('api/kr/suggestion', $args));
629
 
630
  if (isset($json->error) && $json->error <> '') {
@@ -737,6 +748,9 @@ class SQ_Classes_RemoteController {
737
  public static function savePost($args = array()) {
738
  self::$apimethod = 'post'; //call method
739
 
 
 
 
740
  $json = json_decode(self::apiCall('api/posts/update', $args, ['timeout' => 5]));
741
 
742
  if (isset($json->error) && $json->error <> '') {
@@ -1050,6 +1064,9 @@ class SQ_Classes_RemoteController {
1050
  return (new WP_Error('api_error', 'no_data'));
1051
  }
1052
 
 
 
 
1053
  if (!empty($json->data)) {
1054
  return $json->data;
1055
  }
@@ -1092,6 +1109,9 @@ class SQ_Classes_RemoteController {
1092
  return (new WP_Error('api_error', 'no_data'));
1093
  }
1094
 
 
 
 
1095
  if (!empty($json->data)) {
1096
  return $json->data;
1097
  }
@@ -1267,14 +1287,15 @@ class SQ_Classes_RemoteController {
1267
  public static function getFacebookApi($args) {
1268
  self::$apimethod = 'get'; //call method
1269
 
1270
- if ($json = json_decode(self::apiCall('api/tools/facebook', $args))) {
1271
 
1272
- if (isset($json->error) && $json->error <> '') {
1273
- return (new WP_Error('api_error', $json->error));
1274
- } elseif (!isset($json->data)) {
1275
- return (new WP_Error('api_error', 'no_data'));
1276
- }
1277
 
 
1278
  return $json->data;
1279
  }
1280
 
@@ -1292,6 +1313,7 @@ class SQ_Classes_RemoteController {
1292
  $metas = json_decode(wp_json_encode(SQ_Classes_Helpers_Tools::getOption('sq_metas')));
1293
  $sq_postID = (isset($post->ID) ? $post->ID : 0);
1294
 
 
1295
  if (SQ_Classes_Helpers_Tools::isPluginInstalled('elementor/elementor.php')) {
1296
  if (SQ_Classes_Helpers_Tools::getOption('sq_sla_frontend')) {
1297
  $referer = get_post_meta($sq_postID, '_sq_sla', true);
@@ -1319,6 +1341,7 @@ class SQ_Classes_RemoteController {
1319
  prevNonce: "' . wp_create_nonce('post_preview_' . $sq_postID) . '",
1320
  __keyword: "' . esc_html__('Keyword:', _SQ_PLUGIN_NAME_) . '",
1321
  __date: "' . esc_html__('date', _SQ_PLUGIN_NAME_) . '",
 
1322
  __saved: "' . esc_html__('Saved!', _SQ_PLUGIN_NAME_) . '",
1323
  __readit: "' . esc_html__('Read it!', _SQ_PLUGIN_NAME_) . '",
1324
  __insertit: "' . esc_html__('Insert it!', _SQ_PLUGIN_NAME_) . '",
@@ -1345,8 +1368,8 @@ class SQ_Classes_RemoteController {
1345
  __orusesynonyms: "' . esc_html__('or use synonyms', _SQ_PLUGIN_NAME_) . '",
1346
  __addmorewords: "' . esc_html__('add %s more word(s)', _SQ_PLUGIN_NAME_) . '",
1347
  __removewords: "' . esc_html__('or remove %s word(s)', _SQ_PLUGIN_NAME_) . '",
1348
- __addmorekeywords: "' . esc_html__('add %s more keyword(s)', _SQ_PLUGIN_NAME_) . '",
1349
- __addminimumwords: "' . esc_html__('write %s more words to start calculating', _SQ_PLUGIN_NAME_) . '",
1350
  __add_to_briefcase: "' . esc_html__('Add to Briefcase', _SQ_PLUGIN_NAME_) . '",
1351
  __add_keyword_briefcase: "' . esc_html__('Add Keyword to Briefcase', _SQ_PLUGIN_NAME_) . '",
1352
  __usekeyword: "' . esc_html__('Select', _SQ_PLUGIN_NAME_) . '",
@@ -1354,8 +1377,8 @@ class SQ_Classes_RemoteController {
1354
  __frontend_optimized: "' . esc_html__('You’ve already used the Live Assistant to optimize this post when creating it in your Page Builder. Please go back and resume your optimization work there.', _SQ_PLUGIN_NAME_) . '",
1355
  };
1356
  $.sq_params = {
1357
- max_length_title: '.(int)$metas->title_maxlength.',
1358
- max_length_description: '.(int)$metas->description_maxlength.',
1359
  };
1360
  })(jQuery);
1361
  </script>';
1
  <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
 
4
  class SQ_Classes_RemoteController {
5
 
16
  public static function apiCall($module, $args = array(), $options = array()) {
17
  $parameters = "";
18
 
19
+ //Don't make API calls without the token unless it's login or register
20
+ if (!SQ_Classes_Helpers_Tools::getOption('sq_api')) {
21
+ if (!in_array($module, array('api/user/login', 'api/user/register'))) {
22
+ return '';
23
+ }
24
+ }
25
+
26
  //predefined options
27
  $options = array_merge(
28
  array(
29
  'method' => self::$apimethod,
30
  'sslverify' => SQ_CHECK_SSL,
31
+ 'timeout' => 20,
32
  'headers' => array(
33
  'USER-TOKEN' => SQ_Classes_Helpers_Tools::getOption('sq_api'),
34
  'USER-URL' => apply_filters('sq_homeurl', get_bloginfo('url')),
94
  * @return string
95
  */
96
  public static function getMySquirrlyLink($path) {
97
+ return apply_filters('sq_cloudmenu', _SQ_DASH_URL_, $path);
 
 
 
 
98
  }
99
 
100
  /**
179
  return (new WP_Error('api_error', $json->error));
180
  }
181
 
182
+ //Refresh the checkin on login
183
+ delete_transient('sq_checkin');
184
+
185
  return $json;
186
  }
187
 
202
  return (new WP_Error('api_error', 'no_data'));
203
  }
204
 
205
+ //Refresh the checkin on login
206
+ delete_transient('sq_checkin');
207
+
208
  if (!empty($json->data)) {
209
  return $json->data;
210
  }
229
  return (new WP_Error('api_error', 'no_data'));
230
  }
231
 
232
+ //Refresh the checkin on login
233
+ delete_transient('sq_checkin');
234
+
235
  if (!empty($json->data)) {
236
  return $json->data;
237
  }
266
  public static function checkin($args = array()) {
267
  self::$apimethod = 'get'; //call method
268
 
269
+ if (get_transient('sq_checkin')) {
270
+ return get_transient('sq_checkin');
271
+ }
272
+
273
  $json = json_decode(self::apiCall('api/user/checkin', $args));
274
 
275
  if (isset($json->error) && $json->error <> '') {
306
  SQ_Classes_Helpers_Tools::saveOptions('connect', $connect);
307
  }
308
 
309
+ set_transient('sq_checkin', $json->data, 60);
310
  return $json->data;
311
  }
312
 
336
 
337
  /**
338
  * Get the API stats for this blog
339
+ *
340
+ * @return array|WP_Error|false
341
  */
342
  public static function getStats() {
343
  self::$apimethod = 'get'; //call method
344
 
345
+ if (get_transient('sq_stats')) {
346
+ return get_transient('sq_stats');
347
+ }
 
 
348
 
349
+ $args = array();
350
+ $json = json_decode(self::apiCall('api/user/stats', $args));
 
 
351
 
352
+ if (isset($json->error) && $json->error <> '') {
353
+ return (new WP_Error('api_error', $json->error));
354
+ } elseif (!isset($json->data)) {
355
+ return (new WP_Error('api_error', 'no_data'));
356
+ }
357
 
358
+ if (!empty($json->data)) {
359
+ set_transient('sq_stats', $json->data, 60);
360
+ return $json->data;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  }
362
 
363
+ return false;
364
+
365
  }
366
 
367
  /**
408
 
409
 
410
  /******************************** BRIEFCASE *********************/
411
+ public static function getBriefcaseStats($args = array()) {
412
+ self::$apimethod = 'get'; //call method
413
+
414
+ if (get_transient('sq_briefcase_stats')) {
415
+ return get_transient('sq_briefcase_stats');
416
+ }
417
+
418
+ $json = json_decode(self::apiCall('api/briefcase/stats', $args));
419
+
420
+ if (isset($json->error) && $json->error <> '') {
421
+ return (new WP_Error('api_error', $json->error));
422
+ } elseif (!isset($json->data)) {
423
+ return (new WP_Error('api_error', 'no_data'));
424
+ }
425
+
426
+ if (!empty($json->data)) {
427
+ set_transient('sq_briefcase_stats', $json->data, 60);
428
+ return $json->data;
429
+ }
430
+
431
+ return false;
432
+ }
433
+
434
  public static function getBriefcase($args = array()) {
435
  self::$apimethod = 'get'; //call method
436
 
452
  public static function addBriefcaseKeyword($args = array()) {
453
  self::$apimethod = 'post'; //call method
454
 
455
+ //clear the briefcase stats
456
+ delete_transient('sq_briefcase_stats');
457
+
458
  $json = json_decode(self::apiCall('api/briefcase/add', $args));
459
 
460
  if (isset($json->error) && $json->error <> '') {
480
  return false;
481
  }
482
 
483
+ public static function saveBriefcaseKeywordLabel($args = array()) {
484
+ self::$apimethod = 'post'; //call method
485
 
486
+ //clear the briefcase stats
487
+ delete_transient('sq_briefcase_stats');
488
 
489
+ $json = json_decode(self::apiCall('api/briefcase/label/keyword', $args));
 
490
 
491
+ if (isset($json->error) && $json->error <> '') {
492
  return (new WP_Error('api_error', $json->error));
493
  } elseif (!isset($json->data)) {
494
  return (new WP_Error('api_error', 'no_data'));
501
  return false;
502
  }
503
 
504
+ public static function addBriefcaseLabel($args = array()) {
505
  self::$apimethod = 'post'; //call method
506
 
507
+ //clear the briefcase stats
508
+ delete_transient('sq_briefcase_stats');
509
+
510
+ $json = json_decode(self::apiCall('api/briefcase/label/add', $args));
511
 
512
  if (isset($json->error) && $json->error <> '') {
513
  return (new WP_Error('api_error', $json->error));
522
  return false;
523
  }
524
 
525
+ public static function saveBriefcaseLabel($args = array()) {
 
526
  self::$apimethod = 'post'; //call method
527
 
528
+ //clear the briefcase stats
529
+ delete_transient('sq_briefcase_stats');
530
+
531
+ $json = json_decode(self::apiCall('api/briefcase/label/save', $args));
532
 
533
  if (isset($json->error) && $json->error <> '') {
534
  return (new WP_Error('api_error', $json->error));
543
  return false;
544
  }
545
 
546
+ public static function removeBriefcaseLabel($args = array()) {
547
  self::$apimethod = 'post'; //call method
548
 
549
+ $json = json_decode(self::apiCall('api/briefcase/label/delete', $args));
550
 
551
  if (isset($json->error) && $json->error <> '') {
552
  return (new WP_Error('api_error', $json->error));
561
  return false;
562
  }
563
 
564
+ public static function saveBriefcaseMainKeyword($args = array()) {
565
  self::$apimethod = 'post'; //call method
566
 
567
+ $json = json_decode(self::apiCall('api/briefcase/main', $args));
568
 
569
  if (isset($json->error) && $json->error <> '') {
570
  return (new WP_Error('api_error', $json->error));
579
  return false;
580
  }
581
 
582
+
583
  /******************************** KEYWORD RESEARCH ****************/
584
 
585
  /**
632
  public static function setKRSuggestion($args = array()) {
633
  self::$apimethod = 'post'; //call method
634
 
635
+ //clear the briefcase stats
636
+ delete_transient('sq_stats');
637
+ delete_transient('sq_briefcase_stats');
638
+
639
  $json = json_decode(self::apiCall('api/kr/suggestion', $args));
640
 
641
  if (isset($json->error) && $json->error <> '') {
748
  public static function savePost($args = array()) {
749
  self::$apimethod = 'post'; //call method
750
 
751
+ //clear the briefcase stats
752
+ delete_transient('sq_stats');
753
+
754
  $json = json_decode(self::apiCall('api/posts/update', $args, ['timeout' => 5]));
755
 
756
  if (isset($json->error) && $json->error <> '') {
1064
  return (new WP_Error('api_error', 'no_data'));
1065
  }
1066
 
1067
+ //Refresh the checkin on login
1068
+ delete_transient('sq_checkin');
1069
+
1070
  if (!empty($json->data)) {
1071
  return $json->data;
1072
  }
1109
  return (new WP_Error('api_error', 'no_data'));
1110
  }
1111
 
1112
+ //Refresh the checkin on login
1113
+ delete_transient('sq_checkin');
1114
+
1115
  if (!empty($json->data)) {
1116
  return $json->data;
1117
  }
1287
  public static function getFacebookApi($args) {
1288
  self::$apimethod = 'get'; //call method
1289
 
1290
+ $json = json_decode(self::apiCall('api/tools/facebook', $args));
1291
 
1292
+ if (isset($json->error) && $json->error <> '') {
1293
+ return (new WP_Error('api_error', $json->error));
1294
+ } elseif (!isset($json->data)) {
1295
+ return (new WP_Error('api_error', 'no_data'));
1296
+ }
1297
 
1298
+ if (!empty($json->data)) {
1299
  return $json->data;
1300
  }
1301
 
1313
  $metas = json_decode(wp_json_encode(SQ_Classes_Helpers_Tools::getOption('sq_metas')));
1314
  $sq_postID = (isset($post->ID) ? $post->ID : 0);
1315
 
1316
+ //Load Squirrly Live Assistant for Elementor builder
1317
  if (SQ_Classes_Helpers_Tools::isPluginInstalled('elementor/elementor.php')) {
1318
  if (SQ_Classes_Helpers_Tools::getOption('sq_sla_frontend')) {
1319
  $referer = get_post_meta($sq_postID, '_sq_sla', true);
1341
  prevNonce: "' . wp_create_nonce('post_preview_' . $sq_postID) . '",
1342
  __keyword: "' . esc_html__('Keyword:', _SQ_PLUGIN_NAME_) . '",
1343
  __date: "' . esc_html__('date', _SQ_PLUGIN_NAME_) . '",
1344
+ __noconnection: "' . esc_html__("To load Squirrly Live Assistant and optimize this page, click to connect to Squirrly Data Cloud.", _SQ_PLUGIN_NAME_) . '",
1345
  __saved: "' . esc_html__('Saved!', _SQ_PLUGIN_NAME_) . '",
1346
  __readit: "' . esc_html__('Read it!', _SQ_PLUGIN_NAME_) . '",
1347
  __insertit: "' . esc_html__('Insert it!', _SQ_PLUGIN_NAME_) . '",
1368
  __orusesynonyms: "' . esc_html__('or use synonyms', _SQ_PLUGIN_NAME_) . '",
1369
  __addmorewords: "' . esc_html__('add %s more word(s)', _SQ_PLUGIN_NAME_) . '",
1370
  __removewords: "' . esc_html__('or remove %s word(s)', _SQ_PLUGIN_NAME_) . '",
1371
+ __addmorekeywords: "' . esc_html__('add the selected keyword %s more time(s) ', _SQ_PLUGIN_NAME_) . '",
1372
+ __addminimumwords: "' . esc_html__('write %s more words to start calculating', _SQ_PLUGIN_NAME_) . '",
1373
  __add_to_briefcase: "' . esc_html__('Add to Briefcase', _SQ_PLUGIN_NAME_) . '",
1374
  __add_keyword_briefcase: "' . esc_html__('Add Keyword to Briefcase', _SQ_PLUGIN_NAME_) . '",
1375
  __usekeyword: "' . esc_html__('Select', _SQ_PLUGIN_NAME_) . '",
1377
  __frontend_optimized: "' . esc_html__('You’ve already used the Live Assistant to optimize this post when creating it in your Page Builder. Please go back and resume your optimization work there.', _SQ_PLUGIN_NAME_) . '",
1378
  };
1379
  $.sq_params = {
1380
+ max_length_title: ' . (int)$metas->title_maxlength . ',
1381
+ max_length_description: ' . (int)$metas->description_maxlength . ',
1382
  };
1383
  })(jQuery);
1384
  </script>';
classes/helpers/DevKit.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  class SQ_Classes_Helpers_DevKit {
4
 
@@ -17,6 +18,151 @@ class SQ_Classes_Helpers_DevKit {
17
  }
18
  }
19
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
  /**
@@ -41,10 +187,6 @@ class SQ_Classes_Helpers_DevKit {
41
  if (isset(self::$package['settings']) && !empty(SQ_Classes_Helpers_Tools::$options) && function_exists('array_replace_recursive')) {
42
  SQ_Classes_Helpers_Tools::$options = array_replace_recursive((array)SQ_Classes_Helpers_Tools::$options, (array)self::$package['settings']);
43
 
44
- if (isset(self::$package['name']) && self::$package['name'] <> '') {
45
- SQ_Classes_Helpers_Tools::$options['sq_devkit_name'] = self::$package['name'];
46
- }
47
-
48
  SQ_Classes_Helpers_Tools::saveOptions();
49
  unlink($package_file);
50
 
@@ -60,20 +202,18 @@ class SQ_Classes_Helpers_DevKit {
60
  return true;
61
  }
62
 
63
-
64
  /**
65
  * Change the plugin name
66
  * @param $string
67
  * @return mixed
68
  */
69
  public function changeString($string) {
70
- if (isset(self::$plugin['name']) && SQ_Classes_Helpers_Tools::getOption('sq_devkit_name') <> '') {
71
- return str_replace(self::$plugin['name'], SQ_Classes_Helpers_Tools::getOption('sq_devkit_name'), $string);
72
  }
73
  return $string;
74
  }
75
 
76
-
77
  //Get the package info in case of custom details
78
  public function getPackageInfo($key) {
79
  if (isset(self::$package[$key])) {
1
  <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
 
4
  class SQ_Classes_Helpers_DevKit {
5
 
18
  }
19
  }
20
  }
21
+
22
+ //Hook DevKit options
23
+ add_filter('admin_head', array($this, 'hookHead'));
24
+ add_filter('sq_menu', array($this, 'manageMenu'));
25
+ add_filter('sq_features', array($this, 'manageFeatures'));
26
+ add_filter('sq_logo', array($this, 'getCustomLogo'));
27
+ add_filter('sq_name', array($this, 'getCustomName'));
28
+ add_filter('sq_menu_name', array($this, 'getCustomMenuName'));
29
+ add_filter('sq_audit_success_task', array($this, 'getCustomAuditSuccessTask'));
30
+ add_filter('sq_audit_fail_task', array($this, 'getCustomAuditFailTask'));
31
+
32
+ }
33
+
34
+ /**
35
+ * Customize the Audit task
36
+ * @param $task
37
+ * @return mixed
38
+ */
39
+ public function getCustomAuditSuccessTask($task){
40
+
41
+ if(SQ_Classes_Helpers_Tools::getOption('sq_devkit_audit_success')) {
42
+ if ($customTask = SQ_Classes_Helpers_Tools::getOption('sq_devkit_audit_success')) {
43
+ foreach ($customTask as $key => $value) {
44
+ if ($value <> ''|| $value === false) {
45
+ $task->$key = stripslashes($value);
46
+ }
47
+ }
48
+ }
49
+ }
50
+
51
+ return $task;
52
+ }
53
+
54
+ /**
55
+ * Customize the Audit task
56
+ * @param $task
57
+ * @return mixed
58
+ */
59
+ public function getCustomAuditFailTask($task){
60
+
61
+ if(SQ_Classes_Helpers_Tools::getOption('sq_devkit_audit_fail')) {
62
+ if ($customTask = SQ_Classes_Helpers_Tools::getOption('sq_devkit_audit_fail')) {
63
+ foreach ($customTask as $key => $value) {
64
+ if ($value <> ''|| $value === false) {
65
+ $task->$key = stripslashes($value);
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ return $task;
72
+ }
73
+
74
+ /**
75
+ * Hook the head
76
+ */
77
+ public function hookHead() {
78
+ //Hide the ads
79
+ if (!SQ_Classes_Helpers_Tools::getMenuVisible('show_ads')) {
80
+ echo '<style>.sq_offer {display: none !important;}</style>';
81
+ }
82
+
83
+ //Dev Kit images
84
+ if (SQ_Classes_Helpers_Tools::getOption('sq_devkit_logo')) {
85
+ echo '<style>.toplevel_page_sq_dashboard .wp-menu-image img{max-width: 24px !important;}.sq_logo{background-image:url("' . SQ_Classes_Helpers_Tools::getOption('sq_devkit_logo') . '") !important;background-size: 100%;}</style>';
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Change the Squirrly SEO logo in DevKit
91
+ * @param $logo
92
+ * @return mixed
93
+ */
94
+ public function getCustomLogo($logo) {
95
+
96
+ if (SQ_Classes_Helpers_Tools::getOption('sq_devkit_logo')) {
97
+ $logo = SQ_Classes_Helpers_Tools::getOption('sq_devkit_logo');
98
+ }
99
+
100
+ return $logo;
101
+ }
102
+
103
+ /**
104
+ * Get Plugin Custom Name
105
+ * @param $name
106
+ * @return string
107
+ */
108
+ public function getCustomName($name) {
109
+
110
+ if (SQ_Classes_Helpers_Tools::getOption('sq_devkit_name')) {
111
+ $name = SQ_Classes_Helpers_Tools::getOption('sq_devkit_name');
112
+ }
113
+
114
+ return $name;
115
+ }
116
+
117
+ /**
118
+ * Get Plugin Custom Menu Name
119
+ * @param $name
120
+ * @return string
121
+ */
122
+ public function getCustomMenuName($name) {
123
+
124
+ if (SQ_Classes_Helpers_Tools::getOption('sq_devkit_menu_name')) {
125
+ $name = SQ_Classes_Helpers_Tools::getOption('sq_devkit_menu_name');
126
+ }
127
+
128
+ return $name;
129
+ }
130
+
131
+ //Change the features
132
+ public function manageFeatures($features){
133
+ if (!SQ_Classes_Helpers_Tools::getMenuVisible('show_panel')) {
134
+ unset($features[0]); //remove the Cloud App features
135
+ }
136
+
137
+ return $features;
138
+ }
139
+
140
+ /**
141
+ * Manage the menu visibility
142
+ */
143
+ public function manageMenu($menu) {
144
+ if (!SQ_Classes_Helpers_Tools::getMenuVisible('show_tutorial')) {
145
+ $menu['sq_onboarding']['leftmenu'] = false;
146
+ $menu['sq_onboarding']['topmenu'] = false;
147
+ }
148
+ if (!SQ_Classes_Helpers_Tools::getMenuVisible('show_audit')) {
149
+ $menu['sq_audits']['leftmenu'] = false;
150
+ $menu['sq_audits']['topmenu'] = false;
151
+ }
152
+ if (!SQ_Classes_Helpers_Tools::getMenuVisible('show_rankings')) {
153
+ $menu['sq_rankings']['leftmenu'] = false;
154
+ $menu['sq_rankings']['topmenu'] = false;
155
+ }
156
+ if (!SQ_Classes_Helpers_Tools::getMenuVisible('show_focuspages')) {
157
+ $menu['sq_focuspages']['leftmenu'] = false;
158
+ $menu['sq_focuspages']['topmenu'] = false;
159
+ }
160
+ if (!SQ_Classes_Helpers_Tools::getMenuVisible('show_account_info')) {
161
+ $menu['sq_account']['leftmenu'] = false;
162
+ $menu['sq_account']['topmenu'] = false;
163
+ }
164
+
165
+ return $menu;
166
  }
167
 
168
  /**
187
  if (isset(self::$package['settings']) && !empty(SQ_Classes_Helpers_Tools::$options) && function_exists('array_replace_recursive')) {
188
  SQ_Classes_Helpers_Tools::$options = array_replace_recursive((array)SQ_Classes_Helpers_Tools::$options, (array)self::$package['settings']);
189
 
 
 
 
 
190
  SQ_Classes_Helpers_Tools::saveOptions();
191
  unlink($package_file);
192
 
202
  return true;
203
  }
204
 
 
205
  /**
206
  * Change the plugin name
207
  * @param $string
208
  * @return mixed
209
  */
210
  public function changeString($string) {
211
+ if (isset(self::$plugin['name'])) {
212
+ return str_replace(self::$plugin['name'], apply_filters('sq_name', self::$plugin['name']), $string);
213
  }
214
  return $string;
215
  }
216
 
 
217
  //Get the package info in case of custom details
218
  public function getPackageInfo($key) {
219
  if (isset(self::$package[$key])) {
classes/helpers/Sanitize.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  class SQ_Classes_Helpers_Sanitize {
4
  /**
@@ -312,6 +313,56 @@ class SQ_Classes_Helpers_Sanitize {
312
  return $code;
313
  }
314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  /**
316
  * Check the Alexa code saved at settings
317
  *
1
  <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
 
4
  class SQ_Classes_Helpers_Sanitize {
5
  /**
313
  return $code;
314
  }
315
 
316
+ /**
317
+ * Check the Baidu code saved at settings
318
+ *
319
+ * @return string
320
+ */
321
+ public static function checkBaiduWTCode($code) {
322
+ if ($code <> '') {
323
+ $code = stripslashes($code);
324
+
325
+
326
+ if (strpos($code, 'content') !== false) {
327
+ preg_match('/content\\s*=\\s*[\"]([^\"]+)[\"]/i', $code, $result);
328
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
329
+ }
330
+
331
+ if (strpos($code, '"') !== false) {
332
+ preg_match('/[\"]([^\"]+)[\"]/i', $code, $result);
333
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
334
+ }
335
+
336
+ if ($code == '') SQ_Classes_Error::setError(esc_html__("The code for Baidu is incorrect.", _SQ_PLUGIN_NAME_));
337
+ }
338
+ return $code;
339
+ }
340
+
341
+ /**
342
+ * Check the Yandex code saved at settings
343
+ *
344
+ * @return string
345
+ */
346
+ public static function checkYandexWTCode($code) {
347
+ if ($code <> '') {
348
+ $code = stripslashes($code);
349
+
350
+
351
+ if (strpos($code, 'content') !== false) {
352
+ preg_match('/content\\s*=\\s*[\"]([^\"]+)[\"]/i', $code, $result);
353
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
354
+ }
355
+
356
+ if (strpos($code, '"') !== false) {
357
+ preg_match('/[\"]([^\"]+)[\"]/i', $code, $result);
358
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
359
+ }
360
+
361
+ if ($code == '') SQ_Classes_Error::setError(esc_html__("The code for Yandex is incorrect.", _SQ_PLUGIN_NAME_));
362
+ }
363
+ return $code;
364
+ }
365
+
366
  /**
367
  * Check the Alexa code saved at settings
368
  *
classes/helpers/Tools.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  /**
4
  * Handles the parameters and url
@@ -8,7 +9,7 @@
8
  class SQ_Classes_Helpers_Tools {
9
 
10
  /** @var array Options, User Metas, Package and Plugin details */
11
- public static $options, $usermeta = array();
12
 
13
  public function __construct() {
14
  self::$options = $this->getOptions();
@@ -62,8 +63,7 @@ class SQ_Classes_Helpers_Tools {
62
  function hookInit() {
63
  //Load the languages pack
64
  $this->loadMultilanguage();
65
- //Check the Dev Kit settings
66
- SQ_Classes_ObjController::getClass('SQ_Classes_Helpers_DevKit');
67
  //add extra links to the plugin in the Plugins list
68
  add_filter("plugin_row_meta", array($this, 'hookExtraLinks'), 10, 4);
69
  //add setting link in plugin
@@ -127,26 +127,29 @@ class SQ_Classes_Helpers_Tools {
127
  'sq_offer' => false,
128
  'sq_alert_overview' => true,
129
  'sq_alert_journey' => true,
130
- // dev kit
131
- 'sq_devkit_logo' => false,
132
- 'sq_devkit_name' => false,
133
  //Advanced settings
134
  'sq_seoexpert' => 0,
135
  //later buffer load
136
  'sq_laterload' => 0,
137
  'sq_audit_email' => '',
 
138
  //SEO Journey
139
  'sq_seojourney' => 0,
140
  'sq_seojourney_congrats' => 1,
141
- 'sq_onboarding' => 0,
142
  'sq_menu_visited' => array(),
 
143
  //minify Squirrly Metas
144
  'sq_load_css' => 1,
145
  'sq_minify' => 0,
 
146
  //Settings Assistant
147
  'sq_assistant' => 1,
148
  'sq_complete_uninstall' => 0,
149
 
 
 
 
 
150
  //Live Assistant
151
  'sq_sla' => 1,
152
  'sq_sla_frontend' => 1,
@@ -155,25 +158,104 @@ class SQ_Classes_Helpers_Tools {
155
  'sq_keyword_help' => 1,
156
  'sq_local_images' => 1,
157
  'sq_img_licence' => 1,
 
158
 
159
  //JsonLD
160
  'sq_auto_jsonld' => 1,
161
  'sq_jsonld_type' => 'Organization',
 
162
  'sq_jsonld_breadcrumbs' => 1,
163
  'sq_jsonld_woocommerce' => 1,
164
  'sq_jsonld_clearcode' => 0,
165
  'sq_jsonld_product_defaults' => 1,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  'sq_jsonld' => array(
167
  'Organization' => array(
168
  'name' => '',
169
- 'logo' => '',
170
- 'telephone' => '',
171
- 'contactType' => '',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  'description' => ''
173
  ),
174
  'Person' => array(
175
  'name' => '',
176
- 'logo' => '',
 
 
 
177
  'telephone' => '',
178
  'jobTitle' => '',
179
  'description' => ''
@@ -188,7 +270,6 @@ class SQ_Classes_Helpers_Tools {
188
  ),
189
  'sq_sitemap_perpage' => 200,
190
  'sq_sitemap_frequency' => 'weekly',
191
- 'sq_url_fix' => 1,
192
  'sq_sitemap_combinelangs' => 0,
193
  'sq_sitemap' => array(
194
  'sitemap' => array('sitemap.xml', 1),
@@ -220,26 +301,30 @@ class SQ_Classes_Helpers_Tools {
220
  //Metas
221
  'sq_use' => 1,
222
  'sq_auto_metas' => 1,
 
223
  'sq_auto_title' => 1,
224
  'sq_auto_description' => 1,
225
  'sq_auto_keywords' => 1,
226
  'sq_keywordtag' => 0,
227
  'sq_auto_canonical' => 1,
228
- 'sq_auto_dublincore' => 1,
229
  'sq_auto_feed' => 0,
230
  'sq_auto_noindex' => 1,
231
  'sq_use_frontend' => 1,
232
  'sq_attachment_redirect' => 0,
233
  'sq_permalink_redirect' => 1,
 
 
 
234
  'sq_metas' => array(
235
  'title_maxlength' => 75,
236
  'description_maxlength' => 320,
237
  'og_title_maxlength' => 75,
238
- 'og_description_maxlength' => 110,
239
  'tw_title_maxlength' => 75,
240
  'tw_description_maxlength' => 280,
241
  'jsonld_title_maxlength' => 75,
242
- 'jsonld_description_maxlength' => 110,
243
  ),
244
 
245
  //favicon
@@ -250,16 +335,19 @@ class SQ_Classes_Helpers_Tools {
250
  //Ranking Option
251
  'sq_google_country' => 'com',
252
  'sq_google_language' => 'en',
 
253
  'sq_google_serpsperhour' => 500,
254
  'connect' => array(
255
  'google_analytics' => 0,
256
  'google_search_console' => 0,
257
  ),
258
 
259
- //pages visited
260
- 'sq_dashboard' => 0,
261
- 'sq_analytics' => 0,
262
-
 
 
263
  //menu restrictions
264
  'menu' => array(
265
  'show_account_info' => 1,
@@ -268,6 +356,7 @@ class SQ_Classes_Helpers_Tools {
268
  'show_audit' => 1,
269
  'show_rankings' => 1,
270
  'show_focuspages' => 1,
 
271
  'show_ads' => 1,
272
  ),
273
 
@@ -295,8 +384,9 @@ class SQ_Classes_Helpers_Tools {
295
  ),
296
 
297
  //Webmasters and Tracking
298
- 'sq_auto_amp' => 0,
299
  'sq_auto_tracking' => 1,
 
300
  'sq_tracking_logged_users' => 1,
301
  'sq_auto_webmasters' => 1,
302
  'sq_analytics_google_js' => 'analytics',
@@ -306,8 +396,11 @@ class SQ_Classes_Helpers_Tools {
306
  'facebook_pixel' => "",
307
 
308
  'bing_wt' => "",
 
 
309
  'pinterest_verify' => "",
310
  'alexa_verify' => "",
 
311
  ),
312
 
313
  //Patterns
@@ -321,6 +414,7 @@ class SQ_Classes_Helpers_Tools {
321
  'noindex' => 0,
322
  'nofollow' => 0,
323
  'og_type' => 'website',
 
324
  'do_metas' => 1,
325
  'do_sitemap' => 1,
326
  'do_jsonld' => 1,
@@ -338,7 +432,8 @@ class SQ_Classes_Helpers_Tools {
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,
@@ -357,6 +452,7 @@ class SQ_Classes_Helpers_Tools {
357
  'noindex' => 0,
358
  'nofollow' => 0,
359
  'og_type' => 'website',
 
360
  'do_metas' => 1,
361
  'do_sitemap' => 1,
362
  'do_jsonld' => 1,
@@ -367,32 +463,34 @@ class SQ_Classes_Helpers_Tools {
367
  'do_fpixel' => 1,
368
  'do_redirects' => 1,
369
  ),
370
- 'category' => array(
371
  'protected' => 1,
372
  'sep' => '|',
373
- 'title' => '{{category}} {{page}} {{sep}} {{sitename}}',
374
- 'description' => '{{category_description}}',
375
  'noindex' => 0,
376
  'nofollow' => 0,
377
- 'og_type' => 'website',
 
378
  'do_metas' => 1,
379
  'do_sitemap' => 1,
380
- 'do_jsonld' => 0,
381
  'do_pattern' => 1,
382
  'do_og' => 1,
383
  'do_twc' => 1,
384
  'do_analytics' => 1,
385
  'do_fpixel' => 1,
386
- 'do_redirects' => 0,
387
  ),
388
- 'tag' => array(
389
  'protected' => 1,
390
  'sep' => '|',
391
- 'title' => '{{tag}} {{page}} {{sep}} {{sitename}}',
392
- 'description' => '{{excerpt}}',
393
  'noindex' => 0,
394
  'nofollow' => 0,
395
  'og_type' => 'website',
 
396
  'do_metas' => 1,
397
  'do_sitemap' => 1,
398
  'do_jsonld' => 0,
@@ -403,17 +501,18 @@ class SQ_Classes_Helpers_Tools {
403
  'do_fpixel' => 1,
404
  'do_redirects' => 0,
405
  ),
406
- 'tax-post_format' => array(
407
  'protected' => 1,
408
  'sep' => '|',
409
- 'title' => '{{term_title}} ' . esc_html__("Format", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
410
  'description' => '{{excerpt}}',
411
  'noindex' => 0,
412
  'nofollow' => 0,
413
  'og_type' => 'website',
 
414
  'do_metas' => 1,
415
  'do_sitemap' => 1,
416
- 'do_jsonld' => 1,
417
  'do_pattern' => 1,
418
  'do_og' => 1,
419
  'do_twc' => 1,
@@ -421,7 +520,7 @@ class SQ_Classes_Helpers_Tools {
421
  'do_fpixel' => 1,
422
  'do_redirects' => 0,
423
  ),
424
- 'tax-category' => array(
425
  'protected' => 1,
426
  'sep' => '|',
427
  'title' => '{{term_title}} ' . esc_html__("Category", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
@@ -429,6 +528,7 @@ class SQ_Classes_Helpers_Tools {
429
  'noindex' => 0,
430
  'nofollow' => 0,
431
  'og_type' => 'website',
 
432
  'do_metas' => 1,
433
  'do_sitemap' => 1,
434
  'do_jsonld' => 1,
@@ -439,7 +539,7 @@ class SQ_Classes_Helpers_Tools {
439
  'do_fpixel' => 1,
440
  'do_redirects' => 0,
441
  ),
442
- 'tax-post_tag' => array(
443
  'protected' => 1,
444
  'sep' => '|',
445
  'title' => '{{term_title}} ' . esc_html__("Tag", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
@@ -447,6 +547,7 @@ class SQ_Classes_Helpers_Tools {
447
  'noindex' => 0,
448
  'nofollow' => 0,
449
  'og_type' => 'website',
 
450
  'do_metas' => 1,
451
  'do_sitemap' => 1,
452
  'do_jsonld' => 1,
@@ -457,14 +558,15 @@ class SQ_Classes_Helpers_Tools {
457
  'do_fpixel' => 1,
458
  'do_redirects' => 0,
459
  ),
460
- 'tax-product_cat' => array(
461
  'protected' => 1,
462
  'sep' => '|',
463
- 'title' => '{{term_title}} ' . esc_html__("Category", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
464
  'description' => '{{excerpt}}',
465
  'noindex' => 0,
466
  'nofollow' => 0,
467
  'og_type' => 'website',
 
468
  'do_metas' => 1,
469
  'do_sitemap' => 1,
470
  'do_jsonld' => 1,
@@ -475,14 +577,15 @@ class SQ_Classes_Helpers_Tools {
475
  'do_fpixel' => 1,
476
  'do_redirects' => 0,
477
  ),
478
- 'tax-product_tag' => array(
479
  'protected' => 1,
480
  'sep' => '|',
481
- 'title' => '{{term_title}} ' . esc_html__("Tag", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
482
  'description' => '{{excerpt}}',
483
  'noindex' => 0,
484
  'nofollow' => 0,
485
  'og_type' => 'website',
 
486
  'do_metas' => 1,
487
  'do_sitemap' => 1,
488
  'do_jsonld' => 1,
@@ -493,14 +596,15 @@ class SQ_Classes_Helpers_Tools {
493
  'do_fpixel' => 1,
494
  'do_redirects' => 0,
495
  ),
496
- 'tax-product_shipping_class' => array(
497
  'protected' => 1,
498
  'sep' => '|',
499
- 'title' => '{{term_title}} ' . esc_html__("Shipping Option", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
500
  'description' => '{{excerpt}}',
501
  'noindex' => 0,
502
  'nofollow' => 0,
503
  'og_type' => 'website',
 
504
  'do_metas' => 1,
505
  'do_sitemap' => 1,
506
  'do_jsonld' => 1,
@@ -511,14 +615,15 @@ class SQ_Classes_Helpers_Tools {
511
  'do_fpixel' => 1,
512
  'do_redirects' => 0,
513
  ),
514
- 'profile' => array(
515
  'protected' => 1,
516
  'sep' => '|',
517
- 'title' => '{{name}}, ' . esc_html__("Author at", _SQ_PLUGIN_NAME_) . ' {{sitename}} {{page}}',
518
  'description' => '{{excerpt}}',
519
  'noindex' => 0,
520
  'nofollow' => 0,
521
- 'og_type' => 'profile',
 
522
  'do_metas' => 1,
523
  'do_sitemap' => 1,
524
  'do_jsonld' => 1,
@@ -537,6 +642,7 @@ class SQ_Classes_Helpers_Tools {
537
  'noindex' => 0,
538
  'nofollow' => 0,
539
  'og_type' => 'website',
 
540
  'do_metas' => 1,
541
  'do_sitemap' => 1,
542
  'do_jsonld' => 1,
@@ -547,14 +653,15 @@ class SQ_Classes_Helpers_Tools {
547
  'do_fpixel' => 1,
548
  'do_redirects' => 0,
549
  ),
550
- 'product' => array(
551
  'protected' => 1,
552
  'sep' => '|',
553
- 'title' => '{{title}} {{page}} {{sep}} {{sitename}}',
554
  'description' => '{{excerpt}}',
555
  'noindex' => 0,
556
  'nofollow' => 0,
557
- 'og_type' => 'product',
 
558
  'do_metas' => 1,
559
  'do_sitemap' => 1,
560
  'do_jsonld' => 1,
@@ -563,7 +670,7 @@ class SQ_Classes_Helpers_Tools {
563
  'do_twc' => 1,
564
  'do_analytics' => 1,
565
  'do_fpixel' => 1,
566
- 'do_redirects' => 1,
567
  ),
568
  'archive' => array(
569
  'protected' => 1,
@@ -573,6 +680,7 @@ class SQ_Classes_Helpers_Tools {
573
  'noindex' => 0,
574
  'nofollow' => 0,
575
  'og_type' => 'website',
 
576
  'do_metas' => 1,
577
  'do_sitemap' => 1,
578
  'do_jsonld' => 1,
@@ -591,6 +699,7 @@ class SQ_Classes_Helpers_Tools {
591
  'noindex' => 1,
592
  'nofollow' => 0,
593
  'og_type' => 'website',
 
594
  'do_metas' => 1,
595
  'do_sitemap' => 0,
596
  'do_jsonld' => 1,
@@ -608,6 +717,7 @@ class SQ_Classes_Helpers_Tools {
608
  'noindex' => 0,
609
  'nofollow' => 0,
610
  'og_type' => 'website',
 
611
  'do_metas' => 1,
612
  'do_sitemap' => 1,
613
  'do_jsonld' => 1,
@@ -626,6 +736,7 @@ class SQ_Classes_Helpers_Tools {
626
  'noindex' => 1,
627
  'nofollow' => 1,
628
  'og_type' => 'website',
 
629
  'do_metas' => 1,
630
  'do_sitemap' => 0,
631
  'do_jsonld' => 0,
@@ -644,6 +755,7 @@ class SQ_Classes_Helpers_Tools {
644
  'noindex' => 0,
645
  'nofollow' => 0,
646
  'og_type' => 'website',
 
647
  'do_metas' => 1,
648
  'do_sitemap' => 1,
649
  'do_jsonld' => 1,
@@ -659,6 +771,35 @@ class SQ_Classes_Helpers_Tools {
659
  );
660
  $options = json_decode(get_option(SQ_OPTION), true);
661
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
662
  if ($action == 'reset') {
663
  $init['sq_api'] = $options['sq_api'];
664
  return $init;
@@ -789,7 +930,7 @@ class SQ_Classes_Helpers_Tools {
789
  }
790
  }
791
 
792
- return apply_filters('sq_menu_visible', self::$options['menu'][$key]);
793
 
794
  }
795
 
@@ -936,13 +1077,11 @@ class SQ_Classes_Helpers_Tools {
936
  load_plugin_textdomain(_SQ_PLUGIN_NAME_, false, _SQ_PLUGIN_NAME_ . '/languages/');
937
  }
938
 
939
-
940
  /**
941
  * Hook the activate process
942
  */
943
  public function sq_activate() {
944
  set_transient('sq_activate', true);
945
- set_transient('sq_rewrite', true);
946
  set_transient('sq_import', true);
947
  SQ_Classes_ObjController::getClass('SQ_Models_RoleManager')->addSQRoles();
948
  }
@@ -955,48 +1094,32 @@ class SQ_Classes_Helpers_Tools {
955
  SQ_Classes_ObjController::getClass('SQ_Models_RoleManager')->removeSQRoles();
956
  }
957
 
958
- /**
959
- * Triggered when a plugin update is made
960
- */
961
- public static function checkUpgrade($upgrader_object, $options) {
962
- // If an update has taken place and the updated type is plugins and the plugins element exists
963
- if ($options['action'] == 'update' && $options['type'] == 'plugin' && isset($options['plugins'])) {
964
- // Iterate through the plugins being updated and check if ours is there
965
- foreach ($options['plugins'] as $plugin) {
966
- if ($plugin == _SQ_PLUGIN_NAME_ . '/squirrly.php') {
967
- //Create Qss table if not exists
968
- SQ_Classes_ObjController::getClass('SQ_Models_Qss')->checkTableExists();
969
- }
970
- }
971
- }
972
- }
973
-
974
  /**
975
  * Empty the cache from other plugins
976
  */
977
  public static function emptyCache() {
978
  try {
979
  //////////////////////////////////////////////////////////////////////////////
980
- if ( function_exists( 'w3tc_pgcache_flush' ) ) {
981
  w3tc_pgcache_flush();
982
  }
983
 
984
- if ( function_exists( 'w3tc_minify_flush' ) ) {
985
  w3tc_minify_flush();
986
  }
987
- if ( function_exists( 'w3tc_dbcache_flush' ) ) {
988
  w3tc_dbcache_flush();
989
  }
990
- if ( function_exists( 'w3tc_objectcache_flush' ) ) {
991
  w3tc_objectcache_flush();
992
  }
993
  //////////////////////////////////////////////////////////////////////////////
994
 
995
- if ( function_exists( 'wp_cache_clear_cache' ) ) {
996
  wp_cache_clear_cache();
997
  }
998
 
999
- if ( function_exists( 'rocket_clean_domain' ) && function_exists( 'rocket_clean_minify' ) && function_exists( 'rocket_clean_cache_busting' ) ) {
1000
  // Remove all cache files
1001
  rocket_clean_domain();
1002
  rocket_clean_minify();
@@ -1004,43 +1127,43 @@ class SQ_Classes_Helpers_Tools {
1004
  }
1005
  //////////////////////////////////////////////////////////////////////////////
1006
 
1007
- if ( function_exists( 'apc_clear_cache' ) ) {
1008
  // Remove all apc if enabled
1009
  apc_clear_cache();
1010
  }
1011
  //////////////////////////////////////////////////////////////////////////////
1012
 
1013
- if ( class_exists( 'Cache_Enabler_Disk' ) && method_exists( 'Cache_Enabler_Disk', 'clear_cache' ) ) {
1014
  // clear disk cache
1015
  Cache_Enabler_Disk::clear_cache();
1016
  }
1017
  //////////////////////////////////////////////////////////////////////////////
1018
 
1019
- if ( class_exists( 'LiteSpeed_Cache' ) ) {
1020
  LiteSpeed_Cache::get_instance()->purge_all();
1021
  }
1022
  //////////////////////////////////////////////////////////////////////////////
1023
 
1024
- if ( self::isPluginInstalled( 'hummingbird-performance/wp-hummingbird.php' ) ) {
1025
- do_action( 'wphb_clear_page_cache' );
1026
  }
1027
  //////////////////////////////////////////////////////////////////////////////
1028
 
1029
- if ( class_exists( 'WpeCommon' ) ) {
1030
- if ( method_exists( 'WpeCommon', 'purge_memcached' ) ) {
1031
  WpeCommon::purge_memcached();
1032
  }
1033
- if ( method_exists( 'WpeCommon', 'clear_maxcdn_cache' ) ) {
1034
  WpeCommon::clear_maxcdn_cache();
1035
  }
1036
- if ( method_exists( 'WpeCommon', 'purge_varnish_cache' ) ) {
1037
  WpeCommon::purge_varnish_cache();
1038
  }
1039
  }
1040
  //////////////////////////////////////////////////////////////////////////////
1041
 
1042
- if ( self::isPluginInstalled( 'sg-cachepress/sg-cachepress.php' ) && class_exists( 'Supercacher' ) ) {
1043
- if ( method_exists( 'Supercacher', 'purge_cache' ) && method_exists( 'Supercacher', 'delete_assets' ) ) {
1044
  Supercacher::purge_cache();
1045
  Supercacher::delete_assets();
1046
  }
@@ -1048,39 +1171,34 @@ class SQ_Classes_Helpers_Tools {
1048
 
1049
  //Clear the fastest cache
1050
  global $wp_fastest_cache;
1051
- if ( isset( $wp_fastest_cache ) && method_exists( $wp_fastest_cache, 'deleteCache' ) ) {
1052
  $wp_fastest_cache->deleteCache();
1053
  }
1054
  //////////////////////////////////////////////////////////////////////////////
1055
- }catch (Exception $e){
1056
 
1057
  }
1058
  }
1059
 
1060
-
1061
  /**
1062
  * Check if a plugin is installed
1063
  * @param $name
1064
  * @return bool
1065
  */
1066
  public static function isPluginInstalled($name) {
1067
- switch ($name) {
1068
- case 'instapage':
1069
- return defined('INSTAPAGE_PLUGIN_PATH');
1070
- case 'quick-seo':
1071
- return defined('QSS_VERSION') && defined('_QSS_ROOT_DIR_');
1072
- case 'premium-seo-pack':
1073
- return defined('PSP_VERSION') && defined('_PSP_ROOT_DIR_');
1074
- default:
1075
- $plugins = (array)get_option('active_plugins', array());
1076
-
1077
- if (is_multisite()) {
1078
- $plugins = array_merge(array_values($plugins), array_keys(get_site_option('active_sitewide_plugins')));
1079
- }
1080
 
1081
- return in_array($name, $plugins, true);
 
 
 
1082
 
 
1083
  }
 
 
1084
  }
1085
 
1086
  /**
@@ -1116,6 +1234,34 @@ class SQ_Classes_Helpers_Tools {
1116
  return false;
1117
  }
1118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1119
  /**
1120
  * Get the admin url for the specific age
1121
  *
@@ -1158,35 +1304,35 @@ class SQ_Classes_Helpers_Tools {
1158
  // The WordPress filesystem.
1159
  global $wp_filesystem;
1160
 
1161
- if ( !$wp_filesystem || empty( $wp_filesystem ) ) {
1162
  $credentials = array();
1163
 
1164
- if ( !defined( 'FS_METHOD' ) ) {
1165
- define( 'FS_METHOD', 'direct' );
1166
  }
1167
 
1168
- $method = defined( 'FS_METHOD' ) ? FS_METHOD : false;
1169
 
1170
- if ( 'ftpext' === $method ) {
1171
  // If defined, set it to that, Else, set to NULL.
1172
- $credentials['hostname'] = defined( 'FTP_HOST' ) ? preg_replace( '|\w+://|', '', FTP_HOST ) : null;
1173
- $credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : null;
1174
- $credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : null;
1175
 
1176
  // Set FTP port.
1177
- if ( strpos( $credentials['hostname'], ':' ) && null !== $credentials['hostname'] ) {
1178
- list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 );
1179
- if ( !is_numeric( $credentials['port'] ) ) {
1180
- unset( $credentials['port'] );
1181
  }
1182
  } else {
1183
- unset( $credentials['port'] );
1184
  }
1185
 
1186
  // Set connection type.
1187
- if ( (defined( 'FTP_SSL' ) && FTP_SSL) && 'ftpext' === $method ) {
1188
  $credentials['connection_type'] = 'ftps';
1189
- } elseif ( !array_filter( $credentials ) ) {
1190
  $credentials['connection_type'] = null;
1191
  } else {
1192
  $credentials['connection_type'] = 'ftp';
@@ -1194,8 +1340,8 @@ class SQ_Classes_Helpers_Tools {
1194
  }
1195
 
1196
 
1197
- require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
1198
- WP_Filesystem( $credentials );
1199
  }
1200
 
1201
  return $wp_filesystem;
1
  <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
 
4
  /**
5
  * Handles the parameters and url
9
  class SQ_Classes_Helpers_Tools {
10
 
11
  /** @var array Options, User Metas, Package and Plugin details */
12
+ public static $options, $usermeta, $allplugins = array();
13
 
14
  public function __construct() {
15
  self::$options = $this->getOptions();
63
  function hookInit() {
64
  //Load the languages pack
65
  $this->loadMultilanguage();
66
+
 
67
  //add extra links to the plugin in the Plugins list
68
  add_filter("plugin_row_meta", array($this, 'hookExtraLinks'), 10, 4);
69
  //add setting link in plugin
127
  'sq_offer' => false,
128
  'sq_alert_overview' => true,
129
  'sq_alert_journey' => true,
 
 
 
130
  //Advanced settings
131
  'sq_seoexpert' => 0,
132
  //later buffer load
133
  'sq_laterload' => 0,
134
  'sq_audit_email' => '',
135
+
136
  //SEO Journey
137
  'sq_seojourney' => 0,
138
  'sq_seojourney_congrats' => 1,
 
139
  'sq_menu_visited' => array(),
140
+
141
  //minify Squirrly Metas
142
  'sq_load_css' => 1,
143
  'sq_minify' => 0,
144
+
145
  //Settings Assistant
146
  'sq_assistant' => 1,
147
  'sq_complete_uninstall' => 0,
148
 
149
+ //Onboarding
150
+ 'sq_onboarding' => 0,
151
+ 'sq_onboarding_data' => array(),
152
+
153
  //Live Assistant
154
  'sq_sla' => 1,
155
  'sq_sla_frontend' => 1,
158
  'sq_keyword_help' => 1,
159
  'sq_local_images' => 1,
160
  'sq_img_licence' => 1,
161
+ 'sq_sla_social_fetch' => 1,
162
 
163
  //JsonLD
164
  'sq_auto_jsonld' => 1,
165
  'sq_jsonld_type' => 'Organization',
166
+ 'sq_jsonld_global_person' => 0,
167
  'sq_jsonld_breadcrumbs' => 1,
168
  'sq_jsonld_woocommerce' => 1,
169
  'sq_jsonld_clearcode' => 0,
170
  'sq_jsonld_product_defaults' => 1,
171
+ 'sq_jsonld_local' => array(
172
+ 'priceRange' => '',
173
+ 'servesCuisine' => '',
174
+ 'menu' => '',
175
+ 'acceptsReservations' => '',
176
+ 'openingHoursSpecification' => array(
177
+ array(
178
+ '@type' => 'OpeningHoursSpecification',
179
+ 'dayOfWeek' => 'Monday',
180
+ 'opens' => '',
181
+ 'closes' => '',
182
+ ),
183
+ array(
184
+ '@type' => 'OpeningHoursSpecification',
185
+ 'dayOfWeek' => 'Tuesday',
186
+ 'opens' => '',
187
+ 'closes' => '',
188
+ ),
189
+ array(
190
+ '@type' => 'OpeningHoursSpecification',
191
+ 'dayOfWeek' => 'Wednesday',
192
+ 'opens' => '',
193
+ 'closes' => '',
194
+ ),
195
+ array(
196
+ '@type' => 'OpeningHoursSpecification',
197
+ 'dayOfWeek' => 'Thursday',
198
+ 'opens' => '',
199
+ 'closes' => '',
200
+ ),
201
+ array(
202
+ '@type' => 'OpeningHoursSpecification',
203
+ 'dayOfWeek' => 'Friday',
204
+ 'opens' => '',
205
+ 'closes' => '',
206
+ ),
207
+ array(
208
+ '@type' => 'OpeningHoursSpecification',
209
+ 'dayOfWeek' => 'Saturday',
210
+ 'opens' => '',
211
+ 'closes' => '',
212
+ ),
213
+ array(
214
+ '@type' => 'OpeningHoursSpecification',
215
+ 'dayOfWeek' => 'Sunday',
216
+ 'opens' => '',
217
+ 'closes' => '',
218
+ ),
219
+
220
+ ),
221
+ ),
222
  'sq_jsonld' => array(
223
  'Organization' => array(
224
  'name' => '',
225
+ 'logo' => array(
226
+ '@type' => 'ImageObject',
227
+ 'url' => '',
228
+ ),
229
+ 'contactPoint' => array(
230
+ '@type' => 'ContactPoint',
231
+ 'telephone' => '',
232
+ 'contactType' => '',
233
+ ),
234
+ 'address' => array(
235
+ '@type' => 'PostalAddress',
236
+ 'streetAddress' => '',
237
+ 'addressLocality' => '',
238
+ 'postalCode' => '',
239
+ 'addressCountry' => '',
240
+ ),
241
+ 'place' => array(
242
+ '@type' => 'Place',
243
+ 'geo' => array(
244
+ '@type' => 'GeoCoordinates',
245
+ 'latitude' => '',
246
+ 'longitude' => '',
247
+ ),
248
+
249
+ ),
250
+
251
  'description' => ''
252
  ),
253
  'Person' => array(
254
  'name' => '',
255
+ 'image' => array(
256
+ '@type' => 'ImageObject',
257
+ 'url' => '',
258
+ ),
259
  'telephone' => '',
260
  'jobTitle' => '',
261
  'description' => ''
270
  ),
271
  'sq_sitemap_perpage' => 200,
272
  'sq_sitemap_frequency' => 'weekly',
 
273
  'sq_sitemap_combinelangs' => 0,
274
  'sq_sitemap' => array(
275
  'sitemap' => array('sitemap.xml', 1),
301
  //Metas
302
  'sq_use' => 1,
303
  'sq_auto_metas' => 1,
304
+ 'sq_auto_links' => 0,
305
  'sq_auto_title' => 1,
306
  'sq_auto_description' => 1,
307
  'sq_auto_keywords' => 1,
308
  'sq_keywordtag' => 0,
309
  'sq_auto_canonical' => 1,
310
+ 'sq_auto_dublincore' => 0,
311
  'sq_auto_feed' => 0,
312
  'sq_auto_noindex' => 1,
313
  'sq_use_frontend' => 1,
314
  'sq_attachment_redirect' => 0,
315
  'sq_permalink_redirect' => 1,
316
+ 'sq_external_nofollow' => 1,
317
+ 'sq_external_exception' => array(),
318
+ 'sq_external_blank' => 1,
319
  'sq_metas' => array(
320
  'title_maxlength' => 75,
321
  'description_maxlength' => 320,
322
  'og_title_maxlength' => 75,
323
+ 'og_description_maxlength' => 200,
324
  'tw_title_maxlength' => 75,
325
  'tw_description_maxlength' => 280,
326
  'jsonld_title_maxlength' => 75,
327
+ 'jsonld_description_maxlength' => 320,
328
  ),
329
 
330
  //favicon
335
  //Ranking Option
336
  'sq_google_country' => 'com',
337
  'sq_google_language' => 'en',
338
+ 'sq_google_device' => 'desktop',
339
  'sq_google_serpsperhour' => 500,
340
  'connect' => array(
341
  'google_analytics' => 0,
342
  'google_search_console' => 0,
343
  ),
344
 
345
+ // dev kit
346
+ 'sq_devkit_logo' => false,
347
+ 'sq_devkit_name' => false,
348
+ 'sq_devkit_menu_name' => false,
349
+ 'sq_devkit_audit_success' => false,
350
+ 'sq_devkit_audit_fail' => false,
351
  //menu restrictions
352
  'menu' => array(
353
  'show_account_info' => 1,
356
  'show_audit' => 1,
357
  'show_rankings' => 1,
358
  'show_focuspages' => 1,
359
+ 'show_seogoals' => 1,
360
  'show_ads' => 1,
361
  ),
362
 
384
  ),
385
 
386
  //Webmasters and Tracking
387
+ 'sq_auto_amp' => 1,
388
  'sq_auto_tracking' => 1,
389
+ 'sq_auto_pixels' => 1,
390
  'sq_tracking_logged_users' => 1,
391
  'sq_auto_webmasters' => 1,
392
  'sq_analytics_google_js' => 'analytics',
396
  'facebook_pixel' => "",
397
 
398
  'bing_wt' => "",
399
+ 'baidu_wt' => "",
400
+ 'yandex_wt' => "",
401
  'pinterest_verify' => "",
402
  'alexa_verify' => "",
403
+ 'norton_verify' => "",
404
  ),
405
 
406
  //Patterns
414
  'noindex' => 0,
415
  'nofollow' => 0,
416
  'og_type' => 'website',
417
+ 'jsonld_types' => array('website'),
418
  'do_metas' => 1,
419
  'do_sitemap' => 1,
420
  'do_jsonld' => 1,
432
  'description' => '{{excerpt}}',
433
  'noindex' => 0,
434
  'nofollow' => 0,
435
+ 'og_type' => 'article',
436
+ 'jsonld_types' => array('newsarticle'),
437
  'do_metas' => 1,
438
  'do_sitemap' => 1,
439
  'do_jsonld' => 1,
452
  'noindex' => 0,
453
  'nofollow' => 0,
454
  'og_type' => 'website',
455
+ 'jsonld_types' => array('website'),
456
  'do_metas' => 1,
457
  'do_sitemap' => 1,
458
  'do_jsonld' => 1,
463
  'do_fpixel' => 1,
464
  'do_redirects' => 1,
465
  ),
466
+ 'product' => array(
467
  'protected' => 1,
468
  'sep' => '|',
469
+ 'title' => '{{title}} {{page}} {{sep}} {{sitename}}',
470
+ 'description' => '{{excerpt}}',
471
  'noindex' => 0,
472
  'nofollow' => 0,
473
+ 'og_type' => 'product',
474
+ 'jsonld_types' => array('product'),
475
  'do_metas' => 1,
476
  'do_sitemap' => 1,
477
+ 'do_jsonld' => 1,
478
  'do_pattern' => 1,
479
  'do_og' => 1,
480
  'do_twc' => 1,
481
  'do_analytics' => 1,
482
  'do_fpixel' => 1,
483
+ 'do_redirects' => 1,
484
  ),
485
+ 'category' => array(
486
  'protected' => 1,
487
  'sep' => '|',
488
+ 'title' => '{{category}} {{page}} {{sep}} {{sitename}}',
489
+ 'description' => '{{category_description}}',
490
  'noindex' => 0,
491
  'nofollow' => 0,
492
  'og_type' => 'website',
493
+ 'jsonld_types' => array('website'),
494
  'do_metas' => 1,
495
  'do_sitemap' => 1,
496
  'do_jsonld' => 0,
501
  'do_fpixel' => 1,
502
  'do_redirects' => 0,
503
  ),
504
+ 'tag' => array(
505
  'protected' => 1,
506
  'sep' => '|',
507
+ 'title' => '{{tag}} {{page}} {{sep}} {{sitename}}',
508
  'description' => '{{excerpt}}',
509
  'noindex' => 0,
510
  'nofollow' => 0,
511
  'og_type' => 'website',
512
+ 'jsonld_types' => array('website'),
513
  'do_metas' => 1,
514
  'do_sitemap' => 1,
515
+ 'do_jsonld' => 0,
516
  'do_pattern' => 1,
517
  'do_og' => 1,
518
  'do_twc' => 1,
520
  'do_fpixel' => 1,
521
  'do_redirects' => 0,
522
  ),
523
+ 'tax-product_cat' => array(
524
  'protected' => 1,
525
  'sep' => '|',
526
  'title' => '{{term_title}} ' . esc_html__("Category", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
528
  'noindex' => 0,
529
  'nofollow' => 0,
530
  'og_type' => 'website',
531
+ 'jsonld_types' => array('website'),
532
  'do_metas' => 1,
533
  'do_sitemap' => 1,
534
  'do_jsonld' => 1,
539
  'do_fpixel' => 1,
540
  'do_redirects' => 0,
541
  ),
542
+ 'tax-product_tag' => array(
543
  'protected' => 1,
544
  'sep' => '|',
545
  'title' => '{{term_title}} ' . esc_html__("Tag", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
547
  'noindex' => 0,
548
  'nofollow' => 0,
549
  'og_type' => 'website',
550
+ 'jsonld_types' => array('website'),
551
  'do_metas' => 1,
552
  'do_sitemap' => 1,
553
  'do_jsonld' => 1,
558
  'do_fpixel' => 1,
559
  'do_redirects' => 0,
560
  ),
561
+ 'tax-post_format' => array(
562
  'protected' => 1,
563
  'sep' => '|',
564
+ 'title' => '{{term_title}} ' . esc_html__("Format", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
565
  'description' => '{{excerpt}}',
566
  'noindex' => 0,
567
  'nofollow' => 0,
568
  'og_type' => 'website',
569
+ 'jsonld_types' => array('website'),
570
  'do_metas' => 1,
571
  'do_sitemap' => 1,
572
  'do_jsonld' => 1,
577
  'do_fpixel' => 1,
578
  'do_redirects' => 0,
579
  ),
580
+ 'tax-category' => array(
581
  'protected' => 1,
582
  'sep' => '|',
583
+ 'title' => '{{term_title}} ' . esc_html__("Category", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
584
  'description' => '{{excerpt}}',
585
  'noindex' => 0,
586
  'nofollow' => 0,
587
  'og_type' => 'website',
588
+ 'jsonld_types' => array('website'),
589
  'do_metas' => 1,
590
  'do_sitemap' => 1,
591
  'do_jsonld' => 1,
596
  'do_fpixel' => 1,
597
  'do_redirects' => 0,
598
  ),
599
+ 'tax-post_tag' => array(
600
  'protected' => 1,
601
  'sep' => '|',
602
+ 'title' => '{{term_title}} ' . esc_html__("Tag", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
603
  'description' => '{{excerpt}}',
604
  'noindex' => 0,
605
  'nofollow' => 0,
606
  'og_type' => 'website',
607
+ 'jsonld_types' => array('website'),
608
  'do_metas' => 1,
609
  'do_sitemap' => 1,
610
  'do_jsonld' => 1,
615
  'do_fpixel' => 1,
616
  'do_redirects' => 0,
617
  ),
618
+ 'tax-product_shipping_class' => array(
619
  'protected' => 1,
620
  'sep' => '|',
621
+ 'title' => '{{term_title}} ' . esc_html__("Shipping Option", _SQ_PLUGIN_NAME_) . ' {{page}} {{sep}} {{sitename}}',
622
  'description' => '{{excerpt}}',
623
  'noindex' => 0,
624
  'nofollow' => 0,
625
+ 'og_type' => 'website',
626
+ 'jsonld_types' => array('website'),
627
  'do_metas' => 1,
628
  'do_sitemap' => 1,
629
  'do_jsonld' => 1,
642
  'noindex' => 0,
643
  'nofollow' => 0,
644
  'og_type' => 'website',
645
+ 'jsonld_types' => array('website'),
646
  'do_metas' => 1,
647
  'do_sitemap' => 1,
648
  'do_jsonld' => 1,
653
  'do_fpixel' => 1,
654
  'do_redirects' => 0,
655
  ),
656
+ 'profile' => array(
657
  'protected' => 1,
658
  'sep' => '|',
659
+ 'title' => '{{name}}, ' . esc_html__("Author at", _SQ_PLUGIN_NAME_) . ' {{sitename}} {{page}}',
660
  'description' => '{{excerpt}}',
661
  'noindex' => 0,
662
  'nofollow' => 0,
663
+ 'og_type' => 'profile',
664
+ 'jsonld_types' => array('profile'),
665
  'do_metas' => 1,
666
  'do_sitemap' => 1,
667
  'do_jsonld' => 1,
670
  'do_twc' => 1,
671
  'do_analytics' => 1,
672
  'do_fpixel' => 1,
673
+ 'do_redirects' => 0,
674
  ),
675
  'archive' => array(
676
  'protected' => 1,
680
  'noindex' => 0,
681
  'nofollow' => 0,
682
  'og_type' => 'website',
683
+ 'jsonld_types' => array('website'),
684
  'do_metas' => 1,
685
  'do_sitemap' => 1,
686
  'do_jsonld' => 1,
699
  'noindex' => 1,
700
  'nofollow' => 0,
701
  'og_type' => 'website',
702
+ 'jsonld_types' => array('website'),
703
  'do_metas' => 1,
704
  'do_sitemap' => 0,
705
  'do_jsonld' => 1,
717
  'noindex' => 0,
718
  'nofollow' => 0,
719
  'og_type' => 'website',
720
+ 'jsonld_types' => array('website'),
721
  'do_metas' => 1,
722
  'do_sitemap' => 1,
723
  'do_jsonld' => 1,
736
  'noindex' => 1,
737
  'nofollow' => 1,
738
  'og_type' => 'website',
739
+ 'jsonld_types' => array('website'),
740
  'do_metas' => 1,
741
  'do_sitemap' => 0,
742
  'do_jsonld' => 0,
755
  'noindex' => 0,
756
  'nofollow' => 0,
757
  'og_type' => 'website',
758
+ 'jsonld_types' => array('website'),
759
  'do_metas' => 1,
760
  'do_sitemap' => 1,
761
  'do_jsonld' => 1,
771
  );
772
  $options = json_decode(get_option(SQ_OPTION), true);
773
 
774
+ //Update the Json-LD for Organization Logo
775
+ if (isset($options['sq_jsonld']['Organization']['logo']) && !is_array($options['sq_jsonld']['Organization']['logo'])) {
776
+ $options['sq_jsonld']['Organization']['logo'] = array(
777
+ '@type' => 'ImageObject',
778
+ 'url' => $options['sq_jsonld']['Organization']['logo'],
779
+ );
780
+ }
781
+
782
+ if (isset($options['sq_jsonld']['Organization']['telephone']) && isset($options['sq_jsonld']['Organization']['contactType'])) {
783
+ $options['sq_jsonld']['Organization']['contactPoint'] = array(
784
+ '@type' => 'ContactPoint',
785
+ 'telephone' => $options['sq_jsonld']['Organization']['telephone'],
786
+ 'contactType' => $options['sq_jsonld']['Organization']['contactType']
787
+ );
788
+
789
+ unset($options['sq_jsonld']['Organization']['telephone']);
790
+ unset($options['sq_jsonld']['Organization']['contactType']);
791
+ }
792
+
793
+ //Update the Json-LD for Person Image
794
+ if (isset($options['sq_jsonld']['Person']['logo'])) {
795
+ $options['sq_jsonld']['Person']['image'] = array(
796
+ '@type' => 'ImageObject',
797
+ 'url' => $options['sq_jsonld']['Person']['logo'],
798
+ );
799
+
800
+ unset($options['sq_jsonld']['Person']['logo']);
801
+ }
802
+
803
  if ($action == 'reset') {
804
  $init['sq_api'] = $options['sq_api'];
805
  return $init;
930
  }
931
  }
932
 
933
+ return apply_filters('sq_menu_visible', self::$options['menu'][$key], $key);
934
 
935
  }
936
 
1077
  load_plugin_textdomain(_SQ_PLUGIN_NAME_, false, _SQ_PLUGIN_NAME_ . '/languages/');
1078
  }
1079
 
 
1080
  /**
1081
  * Hook the activate process
1082
  */
1083
  public function sq_activate() {
1084
  set_transient('sq_activate', true);
 
1085
  set_transient('sq_import', true);
1086
  SQ_Classes_ObjController::getClass('SQ_Models_RoleManager')->addSQRoles();
1087
  }
1094
  SQ_Classes_ObjController::getClass('SQ_Models_RoleManager')->removeSQRoles();
1095
  }
1096
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1097
  /**
1098
  * Empty the cache from other plugins
1099
  */
1100
  public static function emptyCache() {
1101
  try {
1102
  //////////////////////////////////////////////////////////////////////////////
1103
+ if (function_exists('w3tc_pgcache_flush')) {
1104
  w3tc_pgcache_flush();
1105
  }
1106
 
1107
+ if (function_exists('w3tc_minify_flush')) {
1108
  w3tc_minify_flush();
1109
  }
1110
+ if (function_exists('w3tc_dbcache_flush')) {
1111
  w3tc_dbcache_flush();
1112
  }
1113
+ if (function_exists('w3tc_objectcache_flush')) {
1114
  w3tc_objectcache_flush();
1115
  }
1116
  //////////////////////////////////////////////////////////////////////////////
1117
 
1118
+ if (function_exists('wp_cache_clear_cache')) {
1119
  wp_cache_clear_cache();
1120
  }
1121
 
1122
+ if (function_exists('rocket_clean_domain') && function_exists('rocket_clean_minify') && function_exists('rocket_clean_cache_busting')) {
1123
  // Remove all cache files
1124
  rocket_clean_domain();
1125
  rocket_clean_minify();
1127
  }
1128
  //////////////////////////////////////////////////////////////////////////////
1129
 
1130
+ if (function_exists('apc_clear_cache')) {
1131
  // Remove all apc if enabled
1132
  apc_clear_cache();
1133
  }
1134
  //////////////////////////////////////////////////////////////////////////////
1135
 
1136
+ if (class_exists('Cache_Enabler_Disk') && method_exists('Cache_Enabler_Disk', 'clear_cache')) {
1137
  // clear disk cache
1138
  Cache_Enabler_Disk::clear_cache();
1139
  }
1140
  //////////////////////////////////////////////////////////////////////////////
1141
 
1142
+ if (class_exists('LiteSpeed_Cache')) {
1143
  LiteSpeed_Cache::get_instance()->purge_all();
1144
  }
1145
  //////////////////////////////////////////////////////////////////////////////
1146
 
1147
+ if (self::isPluginInstalled('hummingbird-performance/wp-hummingbird.php')) {
1148
+ do_action('wphb_clear_page_cache');
1149
  }
1150
  //////////////////////////////////////////////////////////////////////////////
1151
 
1152
+ if (class_exists('WpeCommon')) {
1153
+ if (method_exists('WpeCommon', 'purge_memcached')) {
1154
  WpeCommon::purge_memcached();
1155
  }
1156
+ if (method_exists('WpeCommon', 'clear_maxcdn_cache')) {
1157
  WpeCommon::clear_maxcdn_cache();
1158
  }
1159
+ if (method_exists('WpeCommon', 'purge_varnish_cache')) {
1160
  WpeCommon::purge_varnish_cache();
1161
  }
1162
  }
1163
  //////////////////////////////////////////////////////////////////////////////
1164
 
1165
+ if (self::isPluginInstalled('sg-cachepress/sg-cachepress.php') && class_exists('Supercacher')) {
1166
+ if (method_exists('Supercacher', 'purge_cache') && method_exists('Supercacher', 'delete_assets')) {
1167
  Supercacher::purge_cache();
1168
  Supercacher::delete_assets();
1169
  }
1171
 
1172
  //Clear the fastest cache
1173
  global $wp_fastest_cache;
1174
+ if (isset($wp_fastest_cache) && method_exists($wp_fastest_cache, 'deleteCache')) {
1175
  $wp_fastest_cache->deleteCache();
1176
  }
1177
  //////////////////////////////////////////////////////////////////////////////
1178
+ } catch (Exception $e) {
1179
 
1180
  }
1181
  }
1182
 
 
1183
  /**
1184
  * Check if a plugin is installed
1185
  * @param $name
1186
  * @return bool
1187
  */
1188
  public static function isPluginInstalled($name) {
1189
+ if (empty(self::$allplugins)) {
1190
+ self::$allplugins = (array)get_option('active_plugins', array());
1191
+ }
 
 
 
 
 
 
 
 
 
 
1192
 
1193
+ if (!empty(self::$allplugins)) {
1194
+ if (is_multisite()) {
1195
+ self::$allplugins = array_merge(array_values(self::$allplugins), array_keys(get_site_option('active_sitewide_plugins')));
1196
+ }
1197
 
1198
+ return in_array($name, self::$allplugins, true);
1199
  }
1200
+
1201
+ return false;
1202
  }
1203
 
1204
  /**
1234
  return false;
1235
  }
1236
 
1237
+ /**
1238
+ * Check if it's an AMP Endpoint
1239
+ * @return bool|void
1240
+ */
1241
+ public static function isAMPEndpoint() {
1242
+ if (defined('AMPFORWP_AMP_QUERY_VAR')) {
1243
+ $url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH), '/');
1244
+ $explode_path = explode('/', $url_path);
1245
+ if (AMPFORWP_AMP_QUERY_VAR === end($explode_path)) {
1246
+ return true;
1247
+ }
1248
+ }
1249
+
1250
+ if (function_exists('is_amp_endpoint')) {
1251
+ return is_amp_endpoint();
1252
+ }
1253
+
1254
+ if (function_exists('is_amp') && is_amp()) {
1255
+ return is_amp();
1256