SEO SQUIRRLY™ - Version 12.1.04

Version Description

  • 05/24/2022 = Update - The JSON-LD compatibility with Woocommerce on Products variant prices Update - Live Assistant layout for both floating and integrated version Update - Compatibility WP adminify plugin Fixed - SEO Links - External Nofollow Link Exception Fixed - SEO Automation - Add the post type in automation issue Fixed - PHP Warnings in Automation and JSON-LD when some features are not yet activated Fixed - Removed unused libraries from Live Assistant Fixed - Small Bugs
Download this release

Release Info

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

Code changes from version 12.1.03 to 12.1.04

Files changed (49) hide show
  1. classes/ActionController.php +14 -11
  2. classes/FrontController.php +4 -0
  3. classes/RemoteController.php +167 -3
  4. classes/helpers/DevKit.php +0 -1
  5. classes/helpers/Tools.php +62 -50
  6. controllers/Frontend.php +9 -14
  7. controllers/Menu.php +25 -33
  8. controllers/Post.php +146 -176
  9. controllers/PostsList.php +2 -2
  10. core/BlockFeatures.php +15 -0
  11. core/Blocklogin.php +0 -6
  12. models/Compatibility.php +146 -13
  13. models/LiveAssistant.php +158 -0
  14. models/Menu.php +1 -5
  15. models/Settings.php +4 -0
  16. models/Snippet.php +8 -9
  17. models/services/JsonLD.php +24 -22
  18. readme.txt +36 -17
  19. squirrly.php +2 -2
  20. view/Assistant/Settings.php +7 -2
  21. view/Audits/Addpage.php +1 -1
  22. view/Audits/Audit.php +1 -0
  23. view/Audits/AuditPageRow.php +0 -3
  24. view/Audits/AuditStats.php +11 -10
  25. view/Blocks/Account.php +8 -3
  26. view/Blocks/Features.php +5 -7
  27. view/Blocks/FrontendAssistant.php +25 -23
  28. view/Blocks/LiveAssistant.php +2 -2
  29. view/Blocks/Snippet.php +13 -13
  30. view/FocusPages/Addpage.php +1 -1
  31. view/Onboarding/Step4.php +33 -33
  32. view/Post.php +3 -2
  33. view/SeoSettings/Jsonld.php +26 -26
  34. view/assets/css/briefcase.min.css +1 -1
  35. view/assets/css/builders.css +41 -0
  36. view/assets/css/builders.min.css +1 -0
  37. view/assets/css/frontend.min.css +1 -1
  38. view/assets/css/fullwidth.min.css +1 -1
  39. view/assets/css/global.min.css +1 -1
  40. view/assets/css/post.min.css +1 -1
  41. view/assets/css/snippet.min.css +1 -1
  42. view/assets/img/noconnection.png +0 -0
  43. view/assets/js/assistant/sq_blocksearch.min.js +1 -1
  44. view/assets/js/assistant/sq_blockseo.min.js +1 -1
  45. view/assets/js/assistant/sq_briefcase.min.js +1 -1
  46. view/assets/js/assistant/sq_floating.min.js +1 -1
  47. view/assets/js/assistant/sq_frontend.min.js +1 -1
  48. view/assets/js/assistant/squirrly.min.js +1 -1
  49. view/assets/js/briefcase.min.js +1 -1
classes/ActionController.php CHANGED
@@ -72,17 +72,6 @@ class SQ_Classes_ActionController extends SQ_Classes_FrontController
72
  ),
73
  'active' => '1',
74
  ),
75
- array(
76
- 'name' => 'SQ_Core_BlockConnect',
77
- 'description' => 'Connection Block to API',
78
- 'actions' => array(
79
- 'action' => array(
80
- 'sq_cloud_connect',
81
- 'sq_cloud_disconnect',
82
- ),
83
- ),
84
- 'active' => '1',
85
- ),
86
  array(
87
  'name' => 'SQ_Controllers_Account',
88
  'description' => 'Account Class',
@@ -128,6 +117,20 @@ class SQ_Classes_ActionController extends SQ_Classes_FrontController
128
  'sq_ajax_save_post',
129
  'sq_ajax_type_click',
130
  'sq_ajax_search_blog',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  ),
132
  ),
133
  'active' => '1',
72
  ),
73
  'active' => '1',
74
  ),
 
 
 
 
 
 
 
 
 
 
 
75
  array(
76
  'name' => 'SQ_Controllers_Account',
77
  'description' => 'Account Class',
117
  'sq_ajax_save_post',
118
  'sq_ajax_type_click',
119
  'sq_ajax_search_blog',
120
+ 'sla_checkin',
121
+ 'sla_keywords',
122
+ 'sla_tasks',
123
+ 'sla_preview',
124
+ 'sla_customcall',
125
+ //--
126
+ 'sla_briefcase_get',
127
+ 'sla_briefcase_add',
128
+ 'sla_briefcase_save',
129
+ 'sla_briefcase_delete',
130
+ //--
131
+ 'sla_get_freeimages',
132
+ 'sla_get_googleimages',
133
+
134
  ),
135
  ),
136
  'active' => '1',
classes/FrontController.php CHANGED
@@ -151,6 +151,8 @@ class SQ_Classes_FrontController
151
  SQ_Classes_ObjController::getClass('SQ_Controllers_Menu');
152
  SQ_Classes_ObjController::getClass('SQ_Models_RoleManager');
153
 
 
 
154
  }
155
 
156
  /**
@@ -167,6 +169,8 @@ class SQ_Classes_FrontController
167
  /* call the API for save posts */
168
  SQ_Classes_ObjController::getClass('SQ_Controllers_Api');
169
 
 
 
170
  }
171
 
172
  /**
151
  SQ_Classes_ObjController::getClass('SQ_Controllers_Menu');
152
  SQ_Classes_ObjController::getClass('SQ_Models_RoleManager');
153
 
154
+ //Check cache plugin compatibility
155
+ SQ_Classes_ObjController::getClass('SQ_Models_Compatibility')->hookBuildersBackend();
156
  }
157
 
158
  /**
169
  /* call the API for save posts */
170
  SQ_Classes_ObjController::getClass('SQ_Controllers_Api');
171
 
172
+ //Check cache plugin compatibility
173
+ SQ_Classes_ObjController::getClass('SQ_Models_Compatibility')->hookBuildersFrontend();
174
  }
175
 
176
  /**
classes/RemoteController.php CHANGED
@@ -302,13 +302,34 @@ class SQ_Classes_RemoteController
302
  return (new WP_Error('maintenance', $json->error));
303
  }
304
 
305
- self::connect(); //connect the website
306
  return (new WP_Error('api_error', $json->error));
307
 
308
  } elseif (!isset($json->data)) {
309
  return (new WP_Error('api_error', 'no_data'));
310
  }
311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  if (isset($json->data->offer) && $json->data->offer <> '') {
313
  SQ_Classes_Helpers_Tools::saveOptions('sq_offer', $json->data->offer);
314
  } else {
@@ -437,8 +458,151 @@ class SQ_Classes_RemoteController
437
 
438
 
439
  /********************************
440
- *
441
- * BRIEFCASE
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
  *********************/
443
  public static function getBriefcaseStats($args = array())
444
  {
302
  return (new WP_Error('maintenance', $json->error));
303
  }
304
 
305
+ SQ_Classes_RemoteController::connect(); //connect the website
306
  return (new WP_Error('api_error', $json->error));
307
 
308
  } elseif (!isset($json->data)) {
309
  return (new WP_Error('api_error', 'no_data'));
310
  }
311
 
312
+ //Connect the website if not yet connected
313
+ if (isset($json->data->connected) && !$json->data->connected) {
314
+ SQ_Classes_Helpers_Tools::saveOptions('sq_cloud_connect', 0);
315
+
316
+ if(function_exists('rest_get_url_prefix')) {
317
+ $apiUrl = trim(rest_get_url_prefix(), '/');
318
+ }elseif(function_exists('rest_url')) {
319
+ $apiUrl = trim(parse_url(rest_url(), PHP_URL_PATH), '/');
320
+ }
321
+
322
+ //Make sure the website exists on the Cloud
323
+ SQ_Classes_RemoteController::connect();
324
+
325
+ if ($token = SQ_Classes_RemoteController::getCloudToken(array('wp-json' => $apiUrl))) {
326
+ if(isset($token->token) && $token->token <> '') {
327
+ SQ_Classes_Helpers_Tools::saveOptions('sq_cloud_token', $token->token);
328
+ SQ_Classes_Helpers_Tools::saveOptions('sq_cloud_connect', 1);
329
+ }
330
+ }
331
+ }
332
+
333
  if (isset($json->data->offer) && $json->data->offer <> '') {
334
  SQ_Classes_Helpers_Tools::saveOptions('sq_offer', $json->data->offer);
335
  } else {
458
 
459
 
460
  /********************************
461
+ * LIVE ASSISTANT
462
+ *********************/
463
+ public static function getSLAKeywords($args = array())
464
+ {
465
+ self::$apimethod = 'get'; //call method
466
+
467
+ $json = json_decode(self::apiCall('api/posts/keyword', $args));
468
+
469
+ if (isset($json->error) && $json->error <> '') {
470
+ return (new WP_Error('api_error', $json->error));
471
+ } elseif (!isset($json->data)) {
472
+ return (new WP_Error('api_error', 'no_data'));
473
+ }
474
+
475
+ if (!empty($json->data)) {
476
+ return $json->data;
477
+ }
478
+
479
+ return false;
480
+ }
481
+
482
+ public static function getSLAPreview($args = array())
483
+ {
484
+ self::$apimethod = 'get'; //call method
485
+
486
+ $json = json_decode(self::apiCall('api/research/ib/preview', $args));
487
+
488
+ if (isset($json->error) && $json->error <> '') {
489
+ return (new WP_Error('api_error', $json->error));
490
+ } elseif (!isset($json->data)) {
491
+ return (new WP_Error('api_error', 'no_data'));
492
+ }
493
+
494
+ if (!empty($json->data)) {
495
+ return $json->data;
496
+ }
497
+
498
+ return false;
499
+ }
500
+
501
+ public static function getSLATasks($args = array())
502
+ {
503
+ self::$apimethod = 'get'; //call method
504
+
505
+ $json = json_decode(self::apiCall('api/posts/seo/tasks', $args));
506
+
507
+ if (isset($json->error) && $json->error <> '') {
508
+ return (new WP_Error('api_error', $json->error));
509
+ } elseif (!isset($json->data)) {
510
+ return (new WP_Error('api_error', 'no_data'));
511
+ }
512
+
513
+ if (!empty($json->data)) {
514
+ return $json->data;
515
+ }
516
+
517
+ return false;
518
+ }
519
+
520
+ public static function getSLABriefcase($args = array())
521
+ {
522
+ self::$apimethod = 'get'; //call method
523
+
524
+ $json = json_decode(self::apiCall('api/briefcase/optimize/get', $args));
525
+
526
+ if (isset($json->error) && $json->error <> '') {
527
+ return (new WP_Error('api_error', $json->error));
528
+ } elseif (!isset($json->data)) {
529
+ return (new WP_Error('api_error', 'no_data'));
530
+ }
531
+
532
+ if (!empty($json->data)) {
533
+ return $json->data;
534
+ }
535
+
536
+ return false;
537
+ }
538
+
539
+ public static function addSLABriefcase($args = array())
540
+ {
541
+ self::$apimethod = 'get'; //call method
542
+
543
+ $json = json_decode(self::apiCall('api/briefcase/optimize/add', $args));
544
+
545
+ if (isset($json->error) && $json->error <> '') {
546
+ return (new WP_Error('api_error', $json->error));
547
+ } elseif (!isset($json->data)) {
548
+ return (new WP_Error('api_error', 'no_data'));
549
+ }
550
+
551
+ if (!empty($json->data)) {
552
+ return $json->data;
553
+ }
554
+
555
+ return false;
556
+ }
557
+
558
+ public static function saveSLABriefcase($args = array())
559
+ {
560
+ self::$apimethod = 'get'; //call method
561
+
562
+ $json = json_decode(self::apiCall('api/briefcase/optimize/save', $args));
563
+
564
+ if (isset($json->error) && $json->error <> '') {
565
+ return (new WP_Error('api_error', $json->error));
566
+ } elseif (!isset($json->data)) {
567
+ return (new WP_Error('api_error', 'no_data'));
568
+ }
569
+
570
+ if (!empty($json->data)) {
571
+ return $json->data;
572
+ }
573
+
574
+ return false;
575
+ }
576
+
577
+ public static function deleteSLABriefcase($args = array())
578
+ {
579
+ self::$apimethod = 'get'; //call method
580
+
581
+ $json = json_decode(self::apiCall('api/briefcase/optimize/delete', $args));
582
+
583
+ if (isset($json->error) && $json->error <> '') {
584
+ return (new WP_Error('api_error', $json->error));
585
+ } elseif (!isset($json->data)) {
586
+ return (new WP_Error('api_error', 'no_data'));
587
+ }
588
+
589
+ if (!empty($json->data)) {
590
+ return $json->data;
591
+ }
592
+
593
+ return false;
594
+ }
595
+
596
+ public static function getCustomCall($url, $args = array())
597
+ {
598
+ self::$apimethod = 'get'; //call method
599
+
600
+ return self::apiCall($url, $args);
601
+
602
+ }
603
+
604
+ /********************************
605
+ * BRIEFCASE
606
  *********************/
607
  public static function getBriefcaseStats($args = array())
608
  {
classes/helpers/DevKit.php CHANGED
@@ -289,7 +289,6 @@ class SQ_Classes_Helpers_DevKit
289
  }
290
 
291
  } catch (Exception $e) {
292
- SQ_Classes_Error::setMessage(sprintf(esc_html__("An error occurred during DevKit. If this error persists, please contact us at: %s", 'squirrly-seo'), _SQ_SUPPORT_URL_));
293
  }
294
  }
295
 
289
  }
290
 
291
  } catch (Exception $e) {
 
292
  }
293
  }
294
 
classes/helpers/Tools.php CHANGED
@@ -20,45 +20,9 @@ class SQ_Classes_Helpers_Tools
20
  {
21
  self::$options = $this->getOptions();
22
 
23
- // $maxmemory = self::getMaxMemory();
24
- // if ($maxmemory && $maxmemory < 60) {
25
- // @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
26
- // }
27
-
28
  SQ_Classes_ObjController::getClass('SQ_Classes_HookController')->setHooks($this);
29
  }
30
 
31
- public static function getMaxMemory()
32
- {
33
- try {
34
- $memory_limit = @ini_get('memory_limit');
35
- if ((int)$memory_limit > 0) {
36
- if (preg_match('/^(\d+)(.)$/', $memory_limit, $matches)) {
37
- if ($matches[2] == 'G') {
38
- $memory_limit = $matches[1] * 1024 * 1024 * 1024; // nnnM -> nnn MB
39
- } elseif ($matches[2] == 'M') {
40
- $memory_limit = $matches[1] * 1024 * 1024; // nnnM -> nnn MB
41
- } elseif ($matches[2] == 'K') {
42
- $memory_limit = $matches[1] * 1024; // nnnK -> nnn KB
43
- }
44
- }
45
-
46
- if ((int)$memory_limit > 0) {
47
- return number_format($memory_limit / 1024 / 1024, 0, '', '');
48
- }
49
- }
50
- } catch (Exception $e) {
51
- }
52
-
53
- return false;
54
-
55
- }
56
-
57
- public static function isAjax()
58
- {
59
- return (defined('DOING_AJAX') && DOING_AJAX);
60
- }
61
-
62
  /**
63
  * This hook will save the current version in database
64
  *
@@ -69,12 +33,37 @@ class SQ_Classes_Helpers_Tools
69
  //Load the languages pack
70
  $this->loadMultilanguage();
71
 
 
 
 
 
 
 
72
  //add extra links to the plugin in the Plugins list
73
  add_filter("plugin_row_meta", array($this, 'hookExtraLinks'), 10, 4);
74
  //add setting link in plugin
75
  add_filter('plugin_action_links', array($this, 'hookActionlink'), 5, 2);
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  /**
79
  * Add a link to settings in the plugin list
80
  *
@@ -800,9 +789,7 @@ class SQ_Classes_Helpers_Tools
800
  $options = json_decode(get_option(SQ_OPTION), true);
801
 
802
  //Check the updates from old versions of the plugin
803
- self::checkUpdates();
804
-
805
-
806
 
807
  //Replace the default options with the database data
808
  if (is_array($options)) {
@@ -857,9 +844,9 @@ class SQ_Classes_Helpers_Tools
857
 
858
  /**
859
  * Check the updates
860
- * @return void
861
  */
862
- public static function checkUpdates(){
863
  //Update the Json-LD for Organization Logo
864
  if (isset($options['sq_jsonld']['Organization']['logo']) && !is_array($options['sq_jsonld']['Organization']['logo'])) {
865
  $options['sq_jsonld']['Organization']['logo'] = array(
@@ -888,6 +875,9 @@ class SQ_Classes_Helpers_Tools
888
 
889
  unset($options['sq_jsonld']['Person']['logo']);
890
  }
 
 
 
891
  }
892
 
893
  /**
@@ -1196,15 +1186,8 @@ class SQ_Classes_Helpers_Tools
1196
  set_transient('sq_activate', true);
1197
  set_transient('sq_import', true);
1198
 
1199
- //Add the Squirrly User Role
1200
- SQ_Classes_ObjController::getClass('SQ_Models_RoleManager')->addSQRoles();
1201
-
1202
- //Create Qss table if not exists
1203
- SQ_Classes_ObjController::getClass('SQ_Models_Qss')->checkTableExists();
1204
-
1205
- //This option is use for custom Package installs
1206
- //update text in case of devkit
1207
- SQ_Classes_ObjController::getClass('SQ_Classes_Helpers_DevKit')->checkPluginData();
1208
 
1209
  }
1210
 
@@ -1304,6 +1287,15 @@ class SQ_Classes_Helpers_Tools
1304
  }
1305
  }
1306
 
 
 
 
 
 
 
 
 
 
1307
  /**
1308
  * Check if a plugin is installed
1309
  *
@@ -1327,6 +1319,26 @@ class SQ_Classes_Helpers_Tools
1327
  return false;
1328
  }
1329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1330
  /**
1331
  * Check if frontend and user is logged in
1332
  *
20
  {
21
  self::$options = $this->getOptions();
22
 
 
 
 
 
 
23
  SQ_Classes_ObjController::getClass('SQ_Classes_HookController')->setHooks($this);
24
  }
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  /**
27
  * This hook will save the current version in database
28
  *
33
  //Load the languages pack
34
  $this->loadMultilanguage();
35
 
36
+ //If the token si not yet set, run the instalation process
37
+ //check the User Roles, DB and DevKit
38
+ if(!self::getOption('sq_api')){
39
+ self::install();
40
+ }
41
+
42
  //add extra links to the plugin in the Plugins list
43
  add_filter("plugin_row_meta", array($this, 'hookExtraLinks'), 10, 4);
44
  //add setting link in plugin
45
  add_filter('plugin_action_links', array($this, 'hookActionlink'), 5, 2);
46
  }
47
 
48
+ /**
49
+ * Install the required data
50
+ *
51
+ * @return void
52
+ */
53
+ public static function install(){
54
+
55
+ //Add the Squirrly User Role
56
+ SQ_Classes_ObjController::getClass('SQ_Models_RoleManager')->addSQRoles();
57
+
58
+ //Create Qss table if not exists
59
+ SQ_Classes_ObjController::getClass('SQ_Models_Qss')->checkTableExists();
60
+
61
+ //This option is use for custom Package installs
62
+ //update text in case of devkit
63
+ SQ_Classes_ObjController::getClass('SQ_Classes_Helpers_DevKit')->checkPluginData();
64
+
65
+ }
66
+
67
  /**
68
  * Add a link to settings in the plugin list
69
  *
789
  $options = json_decode(get_option(SQ_OPTION), true);
790
 
791
  //Check the updates from old versions of the plugin
792
+ $options = self::checkUpdates($options);
 
 
793
 
794
  //Replace the default options with the database data
795
  if (is_array($options)) {
844
 
845
  /**
846
  * Check the updates
847
+ * @return array
848
  */
849
+ public static function checkUpdates($options){
850
  //Update the Json-LD for Organization Logo
851
  if (isset($options['sq_jsonld']['Organization']['logo']) && !is_array($options['sq_jsonld']['Organization']['logo'])) {
852
  $options['sq_jsonld']['Organization']['logo'] = array(
875
 
876
  unset($options['sq_jsonld']['Person']['logo']);
877
  }
878
+
879
+
880
+ return $options;
881
  }
882
 
883
  /**
1186
  set_transient('sq_activate', true);
1187
  set_transient('sq_import', true);
1188
 
1189
+ //Install & Initialize
1190
+ self::install();
 
 
 
 
 
 
 
1191
 
1192
  }
1193
 
1287
  }
1288
  }
1289
 
1290
+ /**
1291
+ * Check if it's Ajax Call
1292
+ * @return bool
1293
+ */
1294
+ public static function isAjax()
1295
+ {
1296
+ return (defined('DOING_AJAX') && DOING_AJAX);
1297
+ }
1298
+
1299
  /**
1300
  * Check if a plugin is installed
1301
  *
1319
  return false;
1320
  }
1321
 
1322
+ /**
1323
+ * Check whether the theme is active.
1324
+ *
1325
+ * @param string $theme Theme folder/main file.
1326
+ *
1327
+ * @return boolean
1328
+ */
1329
+ public static function isThemeActive( $theme )
1330
+ {
1331
+ if (function_exists('wp_get_theme') ) {
1332
+ $themes = wp_get_theme();
1333
+
1334
+ if (isset($themes->name) && (strtolower($themes->name) == strtolower($theme) || strtolower($themes->name) == strtolower($theme) . ' child' || strtolower($themes->name) == strtolower($theme) . ' child theme') ) {
1335
+ return true;
1336
+ }
1337
+ }
1338
+
1339
+ return false;
1340
+ }
1341
+
1342
  /**
1343
  * Check if frontend and user is logged in
1344
  *
controllers/Frontend.php CHANGED
@@ -32,6 +32,10 @@ class SQ_Controllers_Frontend extends SQ_Classes_FrontController
32
  //Check cache plugin compatibility
33
  SQ_Classes_ObjController::getClass('SQ_Models_Compatibility')->checkCompatibility();
34
 
 
 
 
 
35
  //Check if late loading is on
36
  if (apply_filters('sq_lateloading', SQ_Classes_Helpers_Tools::getOption('sq_laterload'))) {
37
  //Hook the buffer on both actions in case one fails
@@ -67,9 +71,8 @@ class SQ_Controllers_Frontend extends SQ_Classes_FrontController
67
  return $buffer;
68
  });
69
 
70
- //Check if there is an editor loading
71
- //Don't load Squirrly METAs while in frontend editors
72
- if(!SQ_Classes_ObjController::getClass('SQ_Models_Compatibility')->isBuilderEditor()) {
73
  $this->model->startBuffer();
74
  }
75
  }
@@ -120,20 +123,12 @@ class SQ_Controllers_Frontend extends SQ_Classes_FrontController
120
  public function hookFronthead()
121
  {
122
 
123
- if (is_admin() || (defined('SQ_NOCSS') && SQ_NOCSS)) {
124
  return;
125
  }
126
 
127
- if (SQ_Classes_Helpers_Tools::isPluginInstalled('elementor/elementor.php')) {
128
- if (SQ_Classes_Helpers_Tools::getValue('elementor-preview')) {
129
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('elementor');
130
- }
131
- }
132
-
133
- if(SQ_Classes_Helpers_Tools::getOption('sq_load_css')) {
134
- if (!SQ_Classes_Helpers_Tools::isAjax()) {
135
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('frontend');
136
- }
137
  }
138
  }
139
 
32
  //Check cache plugin compatibility
33
  SQ_Classes_ObjController::getClass('SQ_Models_Compatibility')->checkCompatibility();
34
 
35
+ //Check if there is an editor loading
36
+ //Don't load Squirrly METAs while in frontend editors
37
+ SQ_Classes_ObjController::getClass('SQ_Models_Compatibility')->checkBuilderPreview();
38
+
39
  //Check if late loading is on
40
  if (apply_filters('sq_lateloading', SQ_Classes_Helpers_Tools::getOption('sq_laterload'))) {
41
  //Hook the buffer on both actions in case one fails
71
  return $buffer;
72
  });
73
 
74
+
75
+ if(apply_filters('sq_load_buffer', true)) {
 
76
  $this->model->startBuffer();
77
  }
78
  }
123
  public function hookFronthead()
124
  {
125
 
126
+ if (is_admin()) {
127
  return;
128
  }
129
 
130
+ if(apply_filters('sq_load_css', true)) {
131
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('frontend');
 
 
 
 
 
 
 
 
132
  }
133
  }
134
 
controllers/Menu.php CHANGED
@@ -56,8 +56,7 @@ class SQ_Controllers_Menu extends SQ_Classes_FrontController
56
  }
57
  }
58
 
59
- //Hook the Frontend Editors
60
- $this->hookBuilders();
61
  }
62
 
63
  add_action(
@@ -87,9 +86,6 @@ class SQ_Controllers_Menu extends SQ_Classes_FrontController
87
  wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
88
  die();
89
  }
90
-
91
- //Connect to cloud with an unique Token for API access
92
- SQ_Classes_ObjController::getClass('SQ_Core_BlockConnect')->connectToCloud();
93
  }
94
 
95
 
@@ -393,35 +389,38 @@ class SQ_Controllers_Menu extends SQ_Classes_FrontController
393
  //Add Live Assistant For Selected Post Types
394
  if (!empty($types)) {
395
  foreach ($types as $type) {
396
- if (is_string($type) && $type <> '' && $metabox = unserialize(SQ_Classes_Helpers_Tools::getUserMeta('meta-box-order_' . $type))) {
397
- extract($metabox);
398
-
399
- if (isset($side) && isset($normal) && is_string($side) && is_string($normal)) {
400
- $side = explode(',', $side);
401
- $normal = explode(',', $normal);
402
- if (in_array('post' . _SQ_NAME_, $normal)) {
403
- $side = array_merge(array('post' . _SQ_NAME_), $side);
404
- $metabox['side'] = join(',', array_unique($side));
405
-
406
- $normal = array_diff($normal, array('post' . _SQ_NAME_));
407
- $metabox['normal'] = join(',', array_unique($normal));
408
- SQ_Classes_Helpers_Tools::saveUserMeta('meta-box-order_' . $type, $metabox);
409
- }
 
 
410
 
411
- if (in_array('sq_blocksnippet', $side)) {
412
- $normal = array_merge(array('sq_blocksnippet'), $normal);
413
- $metabox['normal'] = join(',', array_unique($normal));
414
 
415
- $side = array_diff($side, array('sq_blocksnippet'));
416
- $metabox['side'] = join(',', array_unique($side));
417
- SQ_Classes_Helpers_Tools::saveUserMeta('meta-box-order_' . $type, $metabox);
 
418
  }
419
  }
420
  }
421
 
422
  //Load the SLA in Post
423
  $this->model->addMeta(
424
- array('post' . _SQ_NAME_,
425
  esc_html__('Squirrly Live Assistant', 'squirrly-seo'),
426
  array(SQ_Classes_ObjController::getClass('SQ_Controllers_Post'), 'init'),
427
  $type,
@@ -505,13 +504,6 @@ class SQ_Controllers_Menu extends SQ_Classes_FrontController
505
  }
506
  }
507
 
508
- /**
509
- * Hook the Elementor Builder
510
- */
511
- public function hookBuilders()
512
- {
513
- add_action('elementor/editor/footer', array(SQ_Classes_ObjController::getClass('SQ_Controllers_Post'), 'loadFrontentLiveAssistant'), 99);
514
- }
515
 
516
  /**
517
  * Count the SEO Errors from SEO Goals
56
  }
57
  }
58
 
59
+
 
60
  }
61
 
62
  add_action(
86
  wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
87
  die();
88
  }
 
 
 
89
  }
90
 
91
 
389
  //Add Live Assistant For Selected Post Types
390
  if (!empty($types)) {
391
  foreach ($types as $type) {
392
+ if (is_string($type) && $type <> '') {
393
+ $metas = SQ_Classes_Helpers_Tools::getUserMeta('meta-box-order_' . $type);
394
+ if(is_string($metas) && $metas <> '' && $metabox = unserialize($metas)) {
395
+ extract($metabox);
396
+
397
+ if (isset($side) && isset($normal) && is_string($side) && is_string($normal)) {
398
+ $side = explode(',', $side);
399
+ $normal = explode(',', $normal);
400
+ if (in_array('postsquirrly', $normal)) {
401
+ $side = array_merge(array('postsquirrly'), $side);
402
+ $metabox['side'] = join(',', array_unique($side));
403
+
404
+ $normal = array_diff($normal, array('postsquirrly'));
405
+ $metabox['normal'] = join(',', array_unique($normal));
406
+ SQ_Classes_Helpers_Tools::saveUserMeta('meta-box-order_' . $type, $metabox);
407
+ }
408
 
409
+ if (in_array('sq_blocksnippet', $side)) {
410
+ $normal = array_merge(array('sq_blocksnippet'), $normal);
411
+ $metabox['normal'] = join(',', array_unique($normal));
412
 
413
+ $side = array_diff($side, array('sq_blocksnippet'));
414
+ $metabox['side'] = join(',', array_unique($side));
415
+ SQ_Classes_Helpers_Tools::saveUserMeta('meta-box-order_' . $type, $metabox);
416
+ }
417
  }
418
  }
419
  }
420
 
421
  //Load the SLA in Post
422
  $this->model->addMeta(
423
+ array('postsquirrly',
424
  esc_html__('Squirrly Live Assistant', 'squirrly-seo'),
425
  array(SQ_Classes_ObjController::getClass('SQ_Controllers_Post'), 'init'),
426
  $type,
504
  }
505
  }
506
 
 
 
 
 
 
 
 
507
 
508
  /**
509
  * Count the SEO Errors from SEO Goals
controllers/Post.php CHANGED
@@ -418,35 +418,155 @@ class SQ_Controllers_Post extends SQ_Classes_FrontController
418
  SQ_Classes_Helpers_Tools::saveOptions('sq_img_licence', SQ_Classes_Helpers_Tools::getValue('licence'));
419
  exit();
420
  case 'sq_ajax_search_blog':
421
- $args = array();
422
- $args['post_type'] = 'post';
423
- $args['post_status'] = 'publish';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
 
425
- if (SQ_Classes_Helpers_Tools::getValue('exclude') && SQ_Classes_Helpers_Tools::getValue('exclude') <> 'undefined') {
426
- $args['post__not_in'] = array((int)SQ_Classes_Helpers_Tools::getValue('exclude'));
427
- }
428
- if (SQ_Classes_Helpers_Tools::getValue('start'))
429
- $args['start'] = array((int)SQ_Classes_Helpers_Tools::getValue('start'));
430
-
431
- if (SQ_Classes_Helpers_Tools::getValue('nrb'))
432
- $args['posts_per_page'] = (int)SQ_Classes_Helpers_Tools::getValue('nrb');
433
-
434
- if (SQ_Classes_Helpers_Tools::getValue('q') <> '')
435
- $args['s'] = SQ_Classes_Helpers_Tools::getValue('q');
436
-
437
- $responce = array();
438
- if ($posts = SQ_Classes_ObjController::getClass('SQ_Models_Post')->searchPost($args)) {
439
- foreach ($posts as $post) {
440
- $responce['results'][] = array('id' => $post->ID,
441
- 'url' => get_permalink($post->ID),
442
- 'title' => $post->post_title,
443
- 'content' => SQ_Classes_Helpers_Sanitize::truncate($post->post_content, 50),
444
- 'date' => $post->post_date_gmt);
445
  }
446
- }
447
 
448
- echo wp_json_encode($responce);
449
- exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  }
451
  }
452
 
@@ -523,156 +643,6 @@ class SQ_Controllers_Post extends SQ_Classes_FrontController
523
  return get_permalink($post->ID);
524
  }
525
 
526
- /**
527
- * Load Squirrly Assistant in frontend
528
- */
529
- public function loadFrontentLiveAssistant()
530
- {
531
- //Load the Frontend Assistant for the current post
532
- if (SQ_Classes_Helpers_Tools::getOption('sq_sla_frontend')) {
533
-
534
- $elementor = (SQ_Classes_Helpers_Tools::getValue('action', false) == 'elementor');
535
-
536
- if (($elementor && is_admin())) {
537
- global $post;
538
-
539
- if (isset($post->ID) && isset($post->post_type)) {
540
- $types = get_post_types(array('public' => true));
541
-
542
- //Exclude types for SLA
543
- $excludes = SQ_Classes_Helpers_Tools::getOption('sq_sla_exclude_post_types');
544
- if (!empty($types) && !empty($excludes)) {
545
- foreach ($excludes as $exclude) {
546
- if (in_array($exclude, $types)) {
547
- unset($types[$exclude]);
548
- }
549
- }
550
- }
551
-
552
- if (in_array($post->post_type, (array)$types)) {
553
- //Load the assistant for frontend
554
- if (!wp_script_is('jquery')) {
555
- wp_enqueue_script('jquery');
556
- }
557
-
558
- //load the draggable script in post edit for the floating SLA
559
- wp_enqueue_script("jquery-ui-core");
560
- wp_enqueue_script("jquery-ui-draggable");
561
-
562
- SQ_Classes_ObjController::getClass('SQ_Classes_RemoteController');
563
- SQ_Classes_ObjController::getClass('SQ_Classes_ActionController')->hookHead();
564
-
565
- $this->show_view('Blocks/FrontendAssistant');
566
- }
567
 
568
- }
569
- }
570
-
571
- }
572
- }
573
-
574
- /**
575
- * Load the JS for API
576
- */
577
- public static function loadLiveAssistant()
578
- {
579
- global $post;
580
- $referer = '';
581
-
582
- $metas = json_decode(wp_json_encode(SQ_Classes_Helpers_Tools::getOption('sq_metas')));
583
- $sq_postID = (isset($post->ID) ? $post->ID : 0);
584
-
585
- //Load Squirrly Live Assistant for Elementor builder
586
- if (SQ_Classes_Helpers_Tools::isPluginInstalled('elementor/elementor.php')) {
587
- if (SQ_Classes_Helpers_Tools::getOption('sq_sla_frontend')) {
588
- $referer = get_post_meta($sq_postID, '_sq_sla', true);
589
- }
590
- }
591
-
592
- echo '<script>
593
- var SQ_DEBUG = ' . (int)SQ_DEBUG . ';
594
- (function($){
595
- $.sq_config = {
596
- sq_version: "' . esc_attr(SQ_VERSION) . '",
597
- token: "' . esc_attr(SQ_Classes_Helpers_Tools::getOption('sq_api')) . '",
598
- url_token: "' . (SQ_Classes_Helpers_Tools::getOption('sq_cloud_connect') ? esc_attr(SQ_Classes_Helpers_Tools::getOption('sq_cloud_token')) : false) . '",
599
- sq_apiurl: "' . esc_url(_SQ_APIV2_URL_) . '",
600
- user_url: "' . esc_url(apply_filters('sq_homeurl', get_bloginfo('url'))) . '",
601
- language: "' . esc_attr(apply_filters('sq_language', get_bloginfo('language'))) . '",
602
- referer: "' . esc_attr($referer) . '",
603
- sq_keywordtag: ' . (int)SQ_Classes_Helpers_Tools::getOption('sq_keywordtag') . ',
604
- sq_keyword_help: ' . (int)SQ_Classes_Helpers_Tools::getOption('sq_keyword_help') . ',
605
- frontend_css: "' . esc_url(_SQ_ASSETS_URL_ . 'css/frontend' . (SQ_DEBUG ? '' : '.min') . '.css') . '",
606
- postID: "' . (int)$sq_postID . '",
607
- prevNonce: "' . esc_attr(wp_create_nonce('post_preview_' . $sq_postID)) . '",
608
- __keyword: "' . esc_html__('Keyword:', 'squirrly-seo') . '",
609
- __date: "' . esc_html__('date', 'squirrly-seo') . '",
610
- __noconnection: "' . esc_html__("To load the Live Assistant and optimize this page, click to connect to Squirrly Cloud.", 'squirrly-seo') . '",
611
- __saved: "' . esc_html__('Saved!', 'squirrly-seo') . '",
612
- __readit: "' . esc_html__('Read it!', 'squirrly-seo') . '",
613
- __insertit: "' . esc_html__('Insert it!', 'squirrly-seo') . '",
614
- __reference: "' . esc_html__('Reference', 'squirrly-seo') . '",
615
- __insertasbox: "' . esc_html__('Insert as box', 'squirrly-seo') . '",
616
- __addlink: "' . esc_html__('Insert Link', 'squirrly-seo') . '",
617
- __notrelevant: "' . esc_html__('Not relevant?', 'squirrly-seo') . '",
618
- __insertparagraph: "' . esc_html__('Insert in your article', 'squirrly-seo') . '",
619
- __ajaxerror: "' . esc_html__(':( An error occurred while processing your request. Please try again', 'squirrly-seo') . '",
620
- __nofound: "' . esc_html__('No results found!', 'squirrly-seo') . '",
621
- __sq_photo_copyright: "' . esc_html__('[ ATTRIBUTE: Please check: %s to find out how to attribute this image ]', 'squirrly-seo') . '",
622
- __has_attributes: "' . esc_html__('Has creative commons attributes', 'squirrly-seo') . '",
623
- __no_attributes: "' . esc_html__('No known copyright restrictions', 'squirrly-seo') . '",
624
- __noopt: "' . esc_html__('You haven`t used Squirrly SEO to optimize your article. Do you want to optimize for a keyword before publishing?', 'squirrly-seo') . '",
625
- __subscription_expired: "' . esc_html__('Your Subscription has Expired', 'squirrly-seo') . '",
626
- __no_briefcase: "' . esc_html__('There are no keywords saved in briefcase yet', 'squirrly-seo') . '",
627
- __fulloptimized: "' . esc_html__('Congratulations! Your article is 100% optimized!', 'squirrly-seo') . '",
628
- __toomanytimes: "' . esc_html__('appears too many times. Try to remove %s of them', 'squirrly-seo') . '",
629
- __writemorewords: "' . esc_html__('write %s more words', 'squirrly-seo') . '",
630
- __keywordinintroduction: "' . esc_html__('Add the keyword in the %s of your article', 'squirrly-seo') . '",
631
- __clicktohighlight: "' . esc_html__('Click to keep the highlight on', 'squirrly-seo') . '",
632
- __introduction: "' . esc_html__('introduction', 'squirrly-seo') . '",
633
- __morewordsafter: "' . esc_html__('Write more words after the %s keyword', 'squirrly-seo') . '",
634
- __orusesynonyms: "' . esc_html__('or use synonyms', 'squirrly-seo') . '",
635
- __addmorewords: "' . esc_html__('add %s more word(s)', 'squirrly-seo') . '",
636
- __removewords: "' . esc_html__('or remove %s word(s)', 'squirrly-seo') . '",
637
- __addmorekeywords: "' . esc_html__('add the selected keyword %s more time(s) ', 'squirrly-seo') . '",
638
- __addminimumwords: "' . esc_html__('write %s more words to start calculating', 'squirrly-seo') . '",
639
- __add_to_briefcase: "' . esc_html__('Add to Briefcase', 'squirrly-seo') . '",
640
- __add_keyword_briefcase: "' . esc_html__('Add Keyword to Briefcase', 'squirrly-seo') . '",
641
- __usekeyword: "' . esc_html__('Select', 'squirrly-seo') . '",
642
- __new_post_title: "' . esc_html__('Auto Draft') . '",
643
- __enter_keyword: "' . esc_html__('Enter keyword above and press ENTER', 'squirrly-seo') . '",
644
- __add_keyword: "' . esc_html__('Add Keywords from Briefcase', 'squirrly-seo') . '",
645
- __frontend_optimized: "' . esc_html__('Live Assistant was used to optimize this page with the Page Builder. Please go back and resume your optimization work there.', 'squirrly-seo') . '",
646
- };
647
- $.sq_params = {
648
- max_length_title: ' . (int)$metas->title_maxlength . ',
649
- max_length_description: ' . (int)$metas->description_maxlength . ',
650
- };
651
-
652
- })(jQuery);
653
- </script>';
654
-
655
- if (is_rtl()) {
656
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('sqbootstrap.rtl');
657
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('rtl');
658
- } else {
659
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('sqbootstrap');
660
- }
661
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('logo');
662
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('post');
663
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('fontawesome');
664
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/utils/mark'.(SQ_DEBUG ? '' : '.min').'.js');
665
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/utils/xregexp'.(SQ_DEBUG ? '' : '.min').'.js');
666
-
667
- if(SQ_Classes_Helpers_Tools::getOption('sq_sla_type') <> 'integrated') {
668
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_floating' . (SQ_DEBUG ? '' : '.min') . '.js');
669
- }
670
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_briefcase'.(SQ_DEBUG ? '' : '.min').'.js');
671
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_frontend'.(SQ_DEBUG ? '' : '.min').'.js');
672
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_blockseo'.(SQ_DEBUG ? '' : '.min').'.js');
673
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_blocksearch'.(SQ_DEBUG ? '' : '.min').'.js');
674
- SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/squirrly'.(SQ_DEBUG ? '' : '.min').'.js');
675
-
676
- }
677
 
678
  }
418
  SQ_Classes_Helpers_Tools::saveOptions('sq_img_licence', SQ_Classes_Helpers_Tools::getValue('licence'));
419
  exit();
420
  case 'sq_ajax_search_blog':
421
+ $args = array();
422
+ $args['post_type'] = 'post';
423
+ $args['post_status'] = 'publish';
424
+
425
+ parse_str(SQ_Classes_Helpers_Tools::getValue('params'), $args);
426
+ if (isset($args['exclude'])) $args['post__not_in'] = array((int)$args['exclude']);
427
+ if (isset($args['nrb'])) $args['posts_per_page'] = (int)$args['nrb'];
428
+
429
+ $responce = array();
430
+ if ($posts = SQ_Classes_ObjController::getClass('SQ_Models_Post')->searchPost($args)) {
431
+ foreach ($posts as $post) {
432
+ $responce['results'][] = array('id' => $post->ID,
433
+ 'url' => get_permalink($post->ID),
434
+ 'title' => $post->post_title,
435
+ 'content' => SQ_Classes_Helpers_Sanitize::truncate($post->post_content, 50),
436
+ 'date' => $post->post_date_gmt);
437
+ }
438
+ }
439
 
440
+ SQ_Classes_Helpers_Tools::setHeader('json');
441
+ echo wp_json_encode($responce);
442
+ exit();
443
+ ////////
444
+ case 'sla_checkin':
445
+ SQ_Classes_Helpers_Tools::setHeader('json');
446
+
447
+ $checkin = SQ_Classes_RemoteController::checkin();
448
+ if (is_wp_error($checkin)) {
449
+ echo wp_json_encode(array('error' => $checkin->get_error_message()));
450
+ }else{
451
+ echo wp_json_encode(array('data' => $checkin));
 
 
 
 
 
 
 
 
452
  }
 
453
 
454
+ exit();
455
+ case 'sla_keywords':
456
+ SQ_Classes_Helpers_Tools::setHeader('json');
457
+
458
+ $args = array(
459
+ 'post_id' => SQ_Classes_Helpers_Tools::getValue('post_id'),
460
+ );
461
+
462
+ $response = SQ_Classes_RemoteController::getSLAKeywords($args);
463
+ if (is_wp_error($response)) {
464
+ echo wp_json_encode(array('error' => $response->get_error_message()));
465
+ }else{
466
+ echo wp_json_encode(array('data' => $response));
467
+ }
468
+
469
+ exit();
470
+ case 'sla_preview':
471
+ SQ_Classes_Helpers_Tools::setHeader('json');
472
+
473
+ $args = array(
474
+ 'filter' => SQ_Classes_Helpers_Tools::getValue('filter'),
475
+ 'link' => SQ_Classes_Helpers_Tools::getValue('link'),
476
+ );
477
+
478
+ $response = SQ_Classes_RemoteController::getSLAPreview($args);
479
+ if (is_wp_error($response)) {
480
+ echo wp_json_encode(array('error' => $response->get_error_message()));
481
+ }else{
482
+ echo wp_json_encode(array('data' => $response));
483
+ }
484
+
485
+ exit();
486
+ case 'sla_tasks':
487
+ SQ_Classes_Helpers_Tools::setHeader('json');
488
+
489
+ $response = SQ_Classes_RemoteController::getSLATasks();
490
+ if (is_wp_error($response)) {
491
+ echo wp_json_encode(array('error' => $response->get_error_message()));
492
+ }else{
493
+ echo wp_json_encode(array('data' => $response));
494
+ }
495
+
496
+ exit();
497
+ case 'sla_briefcase_get':
498
+ SQ_Classes_Helpers_Tools::setHeader('json');
499
+
500
+ $args = array(
501
+ 'post_id' => SQ_Classes_Helpers_Tools::getValue('post_id'),
502
+ 'search' => SQ_Classes_Helpers_Tools::getValue('search'),
503
+ 'label' => SQ_Classes_Helpers_Tools::getValue('label'),
504
+ 'return' => SQ_Classes_Helpers_Tools::getValue('return'),
505
+ );
506
+
507
+ $response = SQ_Classes_RemoteController::getSLABriefcase($args);
508
+ if (is_wp_error($response)) {
509
+ echo wp_json_encode(array('error' => $response->get_error_message()));
510
+ }else{
511
+ echo wp_json_encode(array('data' => $response));
512
+ }
513
+
514
+ exit();
515
+ case 'sla_briefcase_add':
516
+ SQ_Classes_Helpers_Tools::setHeader('json');
517
+
518
+ $args = array(
519
+ 'post_id' => SQ_Classes_Helpers_Tools::getValue('post_id'),
520
+ 'keyword' => SQ_Classes_Helpers_Tools::getValue('keyword'),
521
+ );
522
+
523
+ $response = SQ_Classes_RemoteController::addSLABriefcase($args);
524
+ if (is_wp_error($response)) {
525
+ echo wp_json_encode(array('error' => $response->get_error_message()));
526
+ }else{
527
+ echo wp_json_encode(array('data' => $response));
528
+ }
529
+
530
+ exit();
531
+ case 'sla_briefcase_delete':
532
+ SQ_Classes_Helpers_Tools::setHeader('json');
533
+
534
+ $args = array(
535
+ 'id' => SQ_Classes_Helpers_Tools::getValue('id'),
536
+ );
537
+
538
+ $response = SQ_Classes_RemoteController::deleteSLABriefcase($args);
539
+ if (is_wp_error($response)) {
540
+ echo wp_json_encode(array('error' => $response->get_error_message()));
541
+ }else{
542
+ echo wp_json_encode(array('data' => $response));
543
+ }
544
+
545
+ exit();
546
+ case 'sla_briefcase_save':
547
+ SQ_Classes_Helpers_Tools::setHeader('json');
548
+
549
+ $args = array(
550
+ 'post_id' => SQ_Classes_Helpers_Tools::getValue('post_id'),
551
+ 'optimizations' => SQ_Classes_Helpers_Tools::getValue('optimizations'),
552
+ );
553
+
554
+ $response = SQ_Classes_RemoteController::saveSLABriefcase($args);
555
+ if (is_wp_error($response)) {
556
+ echo wp_json_encode(array('error' => $response->get_error_message()));
557
+ }else{
558
+ echo wp_json_encode(array('data' => $response));
559
+ }
560
+
561
+ exit();
562
+
563
+ case 'sla_customcall':
564
+ SQ_Classes_Helpers_Tools::setHeader('json');
565
+ $url = SQ_Classes_Helpers_Tools::getValue('url');
566
+ parse_str(SQ_Classes_Helpers_Tools::getValue('params'), $args);
567
+
568
+ echo SQ_Classes_RemoteController::getCustomCall($url, $args);
569
+ exit();
570
  }
571
  }
572
 
643
  return get_permalink($post->ID);
644
  }
645
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
646
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
 
648
  }
controllers/PostsList.php CHANGED
@@ -85,8 +85,8 @@ class SQ_Controllers_PostsList extends SQ_Classes_FrontController
85
 
86
  //Update post status on API
87
  add_action('before_delete_post', array($this->model, 'hookUpdateStatus'), 10, 1);
88
- add_action('untrashed_post', array($this->model, 'hookUpdateStatus'), 10, 1);
89
- add_action('trashed_post', array($this->model, 'hookUpdateStatus'), 10, 1);
90
 
91
  }
92
 
85
 
86
  //Update post status on API
87
  add_action('before_delete_post', array($this->model, 'hookUpdateStatus'), 10, 1);
88
+ // add_action('untrashed_post', array($this->model, 'hookUpdateStatus'), 10, 1);
89
+ // add_action('trashed_post', array($this->model, 'hookUpdateStatus'), 10, 1);
90
 
91
  }
92
 
core/BlockFeatures.php CHANGED
@@ -286,6 +286,20 @@ class SQ_Core_BlockFeatures extends SQ_Classes_BlockController
286
  'details' => 'https://howto12.squirrly.co/kb/squirrly-live-assistant/#elementor',
287
  'show' => (SQ_Classes_Helpers_Tools::isPluginInstalled('elementor/elementor.php') && SQ_Classes_Helpers_Tools::getMenuVisible('show_assistant')),
288
  ),//Live Assistant Elementor
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  array(
290
  'title' => "Blogging Assistant",
291
  'description' => "Add relevant <strong>Copyright-Free images, Tweets, Wikis, Blog Excerpts</strong> in your posts.",
@@ -722,6 +736,7 @@ class SQ_Core_BlockFeatures extends SQ_Classes_BlockController
722
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('sq_automation', 'automation'),
723
  'details' => 'https://howto12.squirrly.co/kb/seo-automation/',
724
  'show' => true,
 
725
  ),//SEO Automation
726
 
727
 
286
  'details' => 'https://howto12.squirrly.co/kb/squirrly-live-assistant/#elementor',
287
  'show' => (SQ_Classes_Helpers_Tools::isPluginInstalled('elementor/elementor.php') && SQ_Classes_Helpers_Tools::getMenuVisible('show_assistant')),
288
  ),//Live Assistant Elementor
289
+ array(
290
+ 'title' => "Oxygen Website Builder",
291
+ 'description' => "The SEO Live Assistant <strong>works on the front-end of Oxygen</strong>, just as you're creating or editing your Oxygen page.",
292
+ 'category' => "Assistants",
293
+ 'mainfeature' => false,
294
+ 'option' => 'sq_sla_frontend',
295
+ 'active' => SQ_Classes_Helpers_Tools::getOption('sq_sla_frontend'),
296
+ 'optional' => true,
297
+ 'connection' => false,
298
+ 'logo' => 'fa-solid fa-message',
299
+ 'link' => SQ_Classes_Helpers_Tools::getAdminUrl('sq_assistant', 'settings'),
300
+ 'details' => 'https://howto12.squirrly.co/kb/squirrly-live-assistant/#oxygen',
301
+ 'show' => (SQ_Classes_Helpers_Tools::isPluginInstalled('oxygen/functions.php') && SQ_Classes_Helpers_Tools::getMenuVisible('show_assistant')),
302
+ ),//Live Assistant Oxygen
303
  array(
304
  'title' => "Blogging Assistant",
305
  'description' => "Add relevant <strong>Copyright-Free images, Tweets, Wikis, Blog Excerpts</strong> in your posts.",
736
  'link' => SQ_Classes_Helpers_Tools::getAdminUrl('sq_automation', 'automation'),
737
  'details' => 'https://howto12.squirrly.co/kb/seo-automation/',
738
  'show' => true,
739
+ 'keywords' => 'pattern,patterns,automation,seo'
740
  ),//SEO Automation
741
 
742
 
core/Blocklogin.php CHANGED
@@ -73,9 +73,6 @@ class SQ_Core_Blocklogin extends SQ_Classes_BlockController
73
  } elseif (isset($responce->token)) { //check if token is set and save it
74
  SQ_Classes_Helpers_Tools::saveOptions('sq_api', $responce->token);
75
 
76
- //Connect to cloud with an unique blog Token for API access
77
- SQ_Classes_ObjController::getClass('SQ_Core_BlockConnect')->connectToCloud();
78
-
79
  //redirect users to onboarding if necessary
80
  wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
81
  die();
@@ -126,9 +123,6 @@ class SQ_Core_Blocklogin extends SQ_Classes_BlockController
126
  } elseif (isset($responce->token)) { //check if token is set and save it
127
  SQ_Classes_Helpers_Tools::saveOptions('sq_api', $responce->token);
128
 
129
- //Connect to cloud with an unique blog Token for API access
130
- SQ_Classes_ObjController::getClass('SQ_Core_BlockConnect')->connectToCloud();
131
-
132
  //redirect users to onboarding if necessary
133
  wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
134
  die();
73
  } elseif (isset($responce->token)) { //check if token is set and save it
74
  SQ_Classes_Helpers_Tools::saveOptions('sq_api', $responce->token);
75
 
 
 
 
76
  //redirect users to onboarding if necessary
77
  wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
78
  die();
123
  } elseif (isset($responce->token)) { //check if token is set and save it
124
  SQ_Classes_Helpers_Tools::saveOptions('sq_api', $responce->token);
125
 
 
 
 
126
  //redirect users to onboarding if necessary
127
  wp_redirect(SQ_Classes_Helpers_Tools::getAdminUrl('sq_dashboard'));
128
  die();
models/Compatibility.php CHANGED
@@ -82,30 +82,27 @@ class SQ_Models_Compatibility
82
  if (defined('SWIS_PLUGIN_VERSION')) {
83
  add_filter('sq_lateloading', '__return_true');
84
  }
 
 
 
 
 
 
85
  }
86
 
 
 
87
  /**
88
  * Check if there is an editor loading in frontend
89
  * Don't load Squirrly METAs while in frontend editors
90
  *
91
  * @return bool
92
  */
93
- public function isBuilderEditor()
94
  {
95
 
96
  if (function_exists('is_user_logged_in') && is_user_logged_in()) {
97
 
98
- if (SQ_Classes_Helpers_Tools::isPluginInstalled('oxygen/functions.php')) {
99
- if (SQ_Classes_Helpers_Tools::getValue('ct_builder', false) || SQ_Classes_Helpers_Tools::getValue('ct_template', false)) {
100
- return true;
101
- }
102
- }
103
- if (SQ_Classes_Helpers_Tools::isPluginInstalled('elementor/elementor.php')) {
104
- if (SQ_Classes_Helpers_Tools::getValue('elementor-preview', false)) {
105
- return true;
106
- }
107
- }
108
-
109
  $builder_paramas = array(
110
  'fl_builder', //Beaver Builder
111
  'fb-edit', //Fusion Builder
@@ -129,6 +126,8 @@ class SQ_Models_Compatibility
129
 
130
  foreach ($builder_paramas as $param) {
131
  if (SQ_Classes_Helpers_Tools::getIsset($param)) {
 
 
132
  return true;
133
  }
134
  }
@@ -138,6 +137,141 @@ class SQ_Models_Compatibility
138
  return false;
139
  }
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  /**
142
  * Remove the action for WP Bakery shortcodes for Sitemap XML
143
  */
@@ -156,7 +290,6 @@ class SQ_Models_Compatibility
156
  public function hookPostEditorBackend()
157
  {
158
  add_action('admin_footer', array($this, 'checkOxygenBuilder'), PHP_INT_MAX);
159
- //add_action('admin_footer', array($this, 'checkZionBuilder'), PHP_INT_MAX);
160
  }
161
 
162
  /**
82
  if (defined('SWIS_PLUGIN_VERSION')) {
83
  add_filter('sq_lateloading', '__return_true');
84
  }
85
+
86
+ //Check if frontend css should load
87
+ if(!SQ_Classes_Helpers_Tools::getOption('sq_load_css') || (defined('SQ_NOCSS') && SQ_NOCSS) || SQ_Classes_Helpers_Tools::isAjax()) {
88
+ add_filter('sq_load_css', '__return_false');
89
+ }
90
+
91
  }
92
 
93
+
94
+
95
  /**
96
  * Check if there is an editor loading in frontend
97
  * Don't load Squirrly METAs while in frontend editors
98
  *
99
  * @return bool
100
  */
101
+ public function checkBuilderPreview()
102
  {
103
 
104
  if (function_exists('is_user_logged_in') && is_user_logged_in()) {
105
 
 
 
 
 
 
 
 
 
 
 
 
106
  $builder_paramas = array(
107
  'fl_builder', //Beaver Builder
108
  'fb-edit', //Fusion Builder
126
 
127
  foreach ($builder_paramas as $param) {
128
  if (SQ_Classes_Helpers_Tools::getIsset($param)) {
129
+ add_filter('sq_load_buffer', '__return_false');
130
+ add_filter('sq_load_css', '__return_false');
131
  return true;
132
  }
133
  }
137
  return false;
138
  }
139
 
140
+
141
+ /**
142
+ * Hook the Builders and load SLA
143
+ */
144
+ public function hookBuildersBackend() {
145
+
146
+ //Check if SLA frontend is enabled
147
+ if (SQ_Classes_Helpers_Tools::getOption('sq_sla_frontend')) {
148
+
149
+ //Load SLA in Elementor Backend
150
+ if (SQ_Classes_Helpers_Tools::getValue('action') == 'elementor' && is_admin()) {
151
+ //activate frontend SLA
152
+ add_filter('sq_load_frontend_sla', '__return_true');
153
+
154
+ //activate SLA for elementor on frontend
155
+ add_action('elementor/editor/footer', array(SQ_Classes_ObjController::getClass('SQ_Models_LiveAssistant'), 'loadFrontent'), 99);
156
+ }
157
+
158
+ //Load SLA in WPBakery Frontend
159
+ // if (SQ_Classes_Helpers_Tools::isPluginInstalled('js_composer/js_composer.php')) {
160
+ // if (SQ_Classes_Helpers_Tools::getValue('vc_action') == 'vc_inline') {
161
+ // //activate frontend SLA
162
+ // add_filter('sq_load_frontend_sla', '__return_true');
163
+ //
164
+ // //hook the WPBakery editor
165
+ // add_action('vc_frontend_editor_render_template', array(SQ_Classes_ObjController::getClass('SQ_Models_LiveAssistant'), 'loadFrontent'), 99);
166
+ // }
167
+ // }
168
+
169
+ //Load SLA in Zion Backend
170
+ // if (SQ_Classes_Helpers_Tools::isPluginInstalled('zionbuilder/zionbuilder.php')) {
171
+ // if (SQ_Classes_Helpers_Tools::getValue('action') == 'zion_builder_active') {
172
+ // //activate frontend SLA
173
+ // add_filter('sq_load_frontend_sla', '__return_true');
174
+ //
175
+ // wp_enqueue_script('jquery');
176
+ // wp_enqueue_script('jquery-ui-core');
177
+ // wp_enqueue_script('jquery-ui-draggable');
178
+ // wp_print_scripts(array('jquery', 'jquery-ui-core', 'jquery-ui-draggable'));
179
+ //
180
+ // //activate SLA for elementor on frontend
181
+ // add_action('zionbuilder/editor/after_scripts', array(SQ_Classes_ObjController::getClass('SQ_Models_LiveAssistant'), 'loadFrontent'), 99);
182
+ // }
183
+ // }
184
+
185
+ }
186
+ }
187
+
188
+ /**
189
+ * Hook the Builders and load SLA
190
+ */
191
+ public function hookBuildersFrontend() {
192
+
193
+ if (function_exists('is_user_logged_in') && is_user_logged_in() && !SQ_Classes_Helpers_Tools::isAjax()) {
194
+
195
+ //Load the SLA for Oxygen Editor
196
+ if (SQ_Classes_Helpers_Tools::isPluginInstalled('oxygen/functions.php')) {
197
+ if (SQ_Classes_Helpers_Tools::getValue('ct_builder') || SQ_Classes_Helpers_Tools::getValue('ct_template')) {
198
+
199
+ //Check if SLA frontend is enabled
200
+ if (SQ_Classes_Helpers_Tools::getOption('sq_sla_frontend')) {
201
+
202
+ //activate frontend SLA
203
+ add_filter('sq_load_frontend_sla', '__return_true');
204
+
205
+ //load SLA in frontend for the page builder
206
+ add_action('ct_before_builder', array(SQ_Classes_ObjController::getClass('SQ_Models_LiveAssistant'), 'loadFrontent'), PHP_INT_MAX);
207
+
208
+ //Load the style for builders
209
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('builders');
210
+
211
+ }
212
+
213
+ return true;
214
+ }
215
+
216
+
217
+ //Load the SLA for Elementor Editor
218
+ if (SQ_Classes_Helpers_Tools::isPluginInstalled('elementor/elementor.php')) {
219
+ if (SQ_Classes_Helpers_Tools::getValue('elementor-preview')) {
220
+
221
+ //Load the style for builders
222
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('builders');
223
+
224
+ return true;
225
+ }
226
+ }
227
+
228
+ //Load the SLA for JS Composer / WPBakery
229
+ // if (SQ_Classes_Helpers_Tools::isPluginInstalled('js_composer/js_composer.php')) {
230
+ // if (SQ_Classes_Helpers_Tools::getValue('vc_editable')) {
231
+ //
232
+ // //Load the style for builders
233
+ // SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('builders');
234
+ // }
235
+ // }
236
+
237
+ //Load the SLA for Elementor Editor
238
+ // if (SQ_Classes_Helpers_Tools::isPluginInstalled('zionbuilder/zionbuilder.php')) {
239
+ // if (SQ_Classes_Helpers_Tools::getValue('zionbuilder-preview')) {
240
+ //
241
+ // //Load the style for builders
242
+ // SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('builders');
243
+ //
244
+ // return true;
245
+ // }
246
+ // }
247
+
248
+ }
249
+
250
+ }
251
+
252
+ //Load the SLA for Divi Editor
253
+ if (SQ_Classes_Helpers_Tools::isPluginInstalled('divi-builder/divi-builder.php') || SQ_Classes_Helpers_Tools::isThemeActive('Divi') ) {
254
+
255
+ if (SQ_Classes_Helpers_Tools::getValue('et_fb')) {
256
+ //activate frontend SLA
257
+ add_filter('sq_load_frontend_sla', '__return_true');
258
+
259
+ //load SLA in frontend for the page builder
260
+ add_action('admin_bar_menu', function ($wp_admin_bar) {
261
+ ob_start();
262
+ SQ_Classes_ObjController::getClass('SQ_Models_LiveAssistant')->loadFrontent();
263
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('builders');
264
+ $liveassistant = ob_get_clean();
265
+
266
+ $wp_admin_bar->add_menu(array('id' => 'sq_postsquirrly', 'parent' => false, 'meta' => array('html' => $liveassistant, 'tabindex' => PHP_INT_MAX,),));
267
+ });
268
+
269
+ }
270
+
271
+ }
272
+
273
+ }
274
+
275
  /**
276
  * Remove the action for WP Bakery shortcodes for Sitemap XML
277
  */
290
  public function hookPostEditorBackend()
291
  {
292
  add_action('admin_footer', array($this, 'checkOxygenBuilder'), PHP_INT_MAX);
 
293
  }
294
 
295
  /**
models/LiveAssistant.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
+
4
+ class SQ_Models_LiveAssistant
5
+ {
6
+
7
+
8
+ /**
9
+ * Load the JS for API
10
+ */
11
+ public static function init()
12
+ {
13
+ global $post;
14
+ $referer = '';
15
+
16
+ $metas = json_decode(wp_json_encode(SQ_Classes_Helpers_Tools::getOption('sq_metas')));
17
+ $sq_postID = ((isset($post->ID) && $post->ID > 0) ? $post->ID : 0);
18
+
19
+ //Load Squirrly Live Assistant for Elementor builder
20
+ if (SQ_Classes_Helpers_Tools::getOption('sq_sla_frontend')) {
21
+ $referer = get_post_meta($sq_postID, '_sq_sla', true);
22
+ }
23
+
24
+ echo '<script>
25
+ var SQ_DEBUG = ' . (int)SQ_DEBUG . ';
26
+ (function($){
27
+ $.sq_config = {
28
+ sq_version: "' . esc_attr(SQ_VERSION) . '",
29
+ token: "' . esc_attr(SQ_Classes_Helpers_Tools::getOption('sq_api')) . '",
30
+ url_token: "' . (SQ_Classes_Helpers_Tools::getOption('sq_cloud_connect') ? esc_attr(SQ_Classes_Helpers_Tools::getOption('sq_cloud_token')) : false) . '",
31
+ sq_apiurl: "' . esc_url(_SQ_APIV2_URL_) . '",
32
+ ajaxurl: "' . esc_url(admin_url('admin-ajax.php')) . '",
33
+ sq_nonce: "' . esc_attr(wp_create_nonce(_SQ_NONCE_ID_)) . '",
34
+ user_url: "' . esc_url(apply_filters('sq_homeurl', get_bloginfo('url'))) . '",
35
+ language: "' . esc_attr(apply_filters('sq_language', get_bloginfo('language'))) . '",
36
+ referer: "' . esc_attr($referer) . '",
37
+ sq_keywordtag: ' . (int)SQ_Classes_Helpers_Tools::getOption('sq_keywordtag') . ',
38
+ sq_keyword_help: ' . (int)SQ_Classes_Helpers_Tools::getOption('sq_keyword_help') . ',
39
+ frontend_css: "' . esc_url(_SQ_ASSETS_URL_ . 'css/frontend' . (SQ_DEBUG ? '' : '.min') . '.css') . '",
40
+ postID: "' . $sq_postID . '",
41
+ prevNonce: "' . esc_attr(wp_create_nonce('post_preview_' . $sq_postID)) . '",
42
+ __keyword: "' . esc_html__('Keyword:', 'squirrly-seo') . '",
43
+ __date: "' . esc_html__('date', 'squirrly-seo') . '",
44
+ __noconnection: "' . esc_html__("To load the Live Assistant and optimize this page, click to connect to Squirrly Cloud.", 'squirrly-seo') . '",
45
+ __saved: "' . esc_html__('Saved!', 'squirrly-seo') . '",
46
+ __readit: "' . esc_html__('Read it!', 'squirrly-seo') . '",
47
+ __insertit: "' . esc_html__('Insert it!', 'squirrly-seo') . '",
48
+ __reference: "' . esc_html__('Reference', 'squirrly-seo') . '",
49
+ __insertasbox: "' . esc_html__('Insert as box', 'squirrly-seo') . '",
50
+ __addlink: "' . esc_html__('Insert Link', 'squirrly-seo') . '",
51
+ __notrelevant: "' . esc_html__('Not relevant?', 'squirrly-seo') . '",
52
+ __insertparagraph: "' . esc_html__('Insert in your article', 'squirrly-seo') . '",
53
+ __ajaxerror: "' . esc_html__(':( An error occurred while processing your request. Please try again', 'squirrly-seo') . '",
54
+ __searching: "' . esc_html__('Searching ... ', 'squirrly-seo') . '",
55
+ __nofound: "' . esc_html__('No results found!', 'squirrly-seo') . '",
56
+ __sq_photo_copyright: "' . esc_html__('[ ATTRIBUTE: Please check: %s to find out how to attribute this image ]', 'squirrly-seo') . '",
57
+ __has_attributes: "' . esc_html__('Has creative commons attributes', 'squirrly-seo') . '",
58
+ __no_attributes: "' . esc_html__('No known copyright restrictions', 'squirrly-seo') . '",
59
+ __noopt: "' . esc_html__('You haven`t used Squirrly SEO to optimize your article. Do you want to optimize for a keyword before publishing?', 'squirrly-seo') . '",
60
+ __subscription_expired: "' . esc_html__('Your Subscription has Expired', 'squirrly-seo') . '",
61
+ __no_briefcase: "' . esc_html__('There are no keywords saved in briefcase yet', 'squirrly-seo') . '",
62
+ __fulloptimized: "' . esc_html__('Congratulations! Your article is 100% optimized!', 'squirrly-seo') . '",
63
+ __toomanytimes: "' . esc_html__('appears too many times. Try to remove %s of them', 'squirrly-seo') . '",
64
+ __writemorewords: "' . esc_html__('write %s more words', 'squirrly-seo') . '",
65
+ __keywordinintroduction: "' . esc_html__('Add the keyword in the %s of your article', 'squirrly-seo') . '",
66
+ __clicktohighlight: "' . esc_html__('Click to keep the highlight on', 'squirrly-seo') . '",
67
+ __introduction: "' . esc_html__('introduction', 'squirrly-seo') . '",
68
+ __morewordsafter: "' . esc_html__('Write more words after the %s keyword', 'squirrly-seo') . '",
69
+ __orusesynonyms: "' . esc_html__('or use synonyms', 'squirrly-seo') . '",
70
+ __addmorewords: "' . esc_html__('add %s more word(s)', 'squirrly-seo') . '",
71
+ __removewords: "' . esc_html__('or remove %s word(s)', 'squirrly-seo') . '",
72
+ __addmorekeywords: "' . esc_html__('add the selected keyword %s more time(s) ', 'squirrly-seo') . '",
73
+ __addminimumwords: "' . esc_html__('write %s more words to start calculating', 'squirrly-seo') . '",
74
+ __add_to_briefcase: "' . esc_html__('Add to Briefcase', 'squirrly-seo') . '",
75
+ __add_keyword_briefcase: "' . esc_html__('Add Keyword to Briefcase', 'squirrly-seo') . '",
76
+ __usekeyword: "' . esc_html__('Select', 'squirrly-seo') . '",
77
+ __new_post_title: "' . esc_html__('Auto Draft') . '",
78
+ __enter_keyword: "' . esc_html__('Enter keyword above and press ENTER', 'squirrly-seo') . '",
79
+ __add_keyword: "' . esc_html__('Add Keywords from Briefcase', 'squirrly-seo') . '",
80
+ __frontend_optimized: "' . esc_html__('Live Assistant was used to optimize this page with the Page Builder. Please go back and resume your optimization work there.', 'squirrly-seo') . '",
81
+ };
82
+ $.sq_params = {
83
+ max_length_title: ' . (int)$metas->title_maxlength . ',
84
+ max_length_description: ' . (int)$metas->description_maxlength . ',
85
+ };
86
+
87
+ })(jQuery);
88
+ </script>';
89
+
90
+ if (is_rtl()) {
91
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('sqbootstrap.rtl');
92
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('rtl');
93
+ } else {
94
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('sqbootstrap');
95
+ }
96
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('logo');
97
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('post');
98
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('fontawesome');
99
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/utils/mark'.(SQ_DEBUG ? '' : '.min').'.js');
100
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/utils/xregexp'.(SQ_DEBUG ? '' : '.min').'.js');
101
+
102
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_briefcase'.(SQ_DEBUG ? '' : '.min').'.js');
103
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_frontend'.(SQ_DEBUG ? '' : '.min').'.js');
104
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_blockseo'.(SQ_DEBUG ? '' : '.min').'.js');
105
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_blocksearch'.(SQ_DEBUG ? '' : '.min').'.js');
106
+ if(SQ_Classes_Helpers_Tools::getOption('sq_sla_type') <> 'integrated') {
107
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/sq_floating' . (SQ_DEBUG ? '' : '.min') . '.js');
108
+ }
109
+ SQ_Classes_ObjController::getClass('SQ_Classes_DisplayController')->loadMedia('assistant/squirrly'.(SQ_DEBUG ? '' : '.min').'.js');
110
+
111
+ }
112
+
113
+ /**
114
+ * Load Squirrly Assistant in frontend
115
+ */
116
+ public function loadFrontent()
117
+ {
118
+ //If squirrly should load on frontend
119
+ if (apply_filters('sq_load_frontend_sla', false)) {
120
+
121
+ global $post;
122
+
123
+ if (isset($post->ID) && isset($post->post_type)) {
124
+ $types = get_post_types(array('public' => true));
125
+
126
+ //Exclude types for SLA
127
+ $excludes = SQ_Classes_Helpers_Tools::getOption('sq_sla_exclude_post_types');
128
+ if (!empty($types) && !empty($excludes)) {
129
+ foreach ($excludes as $exclude) {
130
+ if (in_array($exclude, $types)) {
131
+ unset($types[$exclude]);
132
+ }
133
+ }
134
+ }
135
+
136
+ if (in_array($post->post_type, (array)$types)) {
137
+ //Load the assistant for frontend
138
+ if (!wp_script_is('jquery')) {
139
+ wp_enqueue_script('jquery');
140
+ }
141
+
142
+ //load the draggable script in post edit for the floating SLA
143
+ wp_enqueue_script("jquery-ui-core");
144
+ wp_enqueue_script("jquery-ui-draggable");
145
+
146
+ SQ_Classes_ObjController::getClass('SQ_Classes_RemoteController');
147
+ //SQ_Classes_ObjController::getClass('SQ_Classes_ActionController')->hookHead();
148
+
149
+ SQ_Classes_ObjController::getClass('SQ_Controllers_Post')->show_view('Blocks/FrontendAssistant');
150
+ }
151
+
152
+ }
153
+ }
154
+
155
+ }
156
+
157
+
158
+ }
models/Menu.php CHANGED
@@ -812,12 +812,8 @@ class SQ_Models_Menu
812
  //for PHP 7.3.1 version
813
  $tabs = array_filter($tabs);
814
 
815
- if (isset($tabs[$category])) {
816
- return apply_filters('sq_menu_' . $category, $tabs[$category]);
817
 
818
- }
819
-
820
- return array();
821
  }
822
 
823
  /**
812
  //for PHP 7.3.1 version
813
  $tabs = array_filter($tabs);
814
 
815
+ return apply_filters('sq_menu_' . $category, (isset($tabs[$category]) ? $tabs[$category] : array()), $category);
 
816
 
 
 
 
817
  }
818
 
819
  /**
models/Settings.php CHANGED
@@ -14,6 +14,10 @@ class SQ_Models_Settings
14
  $links = SQ_Classes_Helpers_Tools::getValue('links_permission', '', true);
15
  $links = explode(PHP_EOL, $links);
16
  $links = str_replace("\r", "", $links);
 
 
 
 
17
  }
18
 
19
  //Make sure we get the Sitemap data from the form
14
  $links = SQ_Classes_Helpers_Tools::getValue('links_permission', '', true);
15
  $links = explode(PHP_EOL, $links);
16
  $links = str_replace("\r", "", $links);
17
+
18
+ if (!empty($links)) {
19
+ SQ_Classes_Helpers_Tools::$options['sq_external_exception'] = array_unique($links);
20
+ }
21
  }
22
 
23
  //Make sure we get the Sitemap data from the form
models/Snippet.php CHANGED
@@ -34,7 +34,6 @@ class SQ_Models_Snippet
34
  $search_all = true;
35
  $search = trim(str_replace('#all', '', $search));
36
  }
37
- $post_per_page = 50;
38
  } else {
39
  $patterns = SQ_Classes_Helpers_Tools::getOption('patterns');
40
  if (!isset($patterns[$post_type])) {
@@ -58,6 +57,7 @@ class SQ_Models_Snippet
58
 
59
  //get all the public post types
60
  $types = get_post_types(array('public' => true));
 
61
  $statuses = array('draft', 'publish', 'pending', 'future', 'private');
62
  //push the shop page into post types to pass the filter
63
  if ($post_type == 'shop') array_push($types, 'shop');
@@ -69,8 +69,9 @@ class SQ_Models_Snippet
69
  //filter by page in case of shop post type
70
  $query = array(
71
  'post_type' => ($search_all || $post_id ? array_keys($types) : ($post_type <> 'shop' ? $post_type : 'page')),
 
72
  's' => (!$search_all ? (strpos($search, '/') === false ? $search : '') : ''),
73
- 'posts_per_page' => $post_per_page,
74
  'paged' => $paged,
75
  'orderby' => 'date',
76
  'order' => 'DESC',
@@ -98,18 +99,16 @@ class SQ_Models_Snippet
98
  if ($page->url <> '') {
99
  //Search the Squirrly Title, Description and URL if search is set
100
  if ($search <> '') {
101
- if (SQ_Classes_Helpers_Tools::findStr($page->sq->title, $search) === false && SQ_Classes_Helpers_Tools::findStr($page->sq->description, $search) === false) {
102
- continue;
103
- } elseif (strpos($search, '/') !== false && rtrim($page->url, '/') <> $search) {
104
  continue;
105
  }
106
  }
107
 
108
  //Don't let other post types to pass
109
- if (!$search_all) {
110
- if (!$post_id && isset($page->post_type) && $page->post_type <> $post_type) {
111
- continue;
112
- }
113
  }
114
 
115
  $pages[] = $page;
34
  $search_all = true;
35
  $search = trim(str_replace('#all', '', $search));
36
  }
 
37
  } else {
38
  $patterns = SQ_Classes_Helpers_Tools::getOption('patterns');
39
  if (!isset($patterns[$post_type])) {
57
 
58
  //get all the public post types
59
  $types = get_post_types(array('public' => true));
60
+
61
  $statuses = array('draft', 'publish', 'pending', 'future', 'private');
62
  //push the shop page into post types to pass the filter
63
  if ($post_type == 'shop') array_push($types, 'shop');
69
  //filter by page in case of shop post type
70
  $query = array(
71
  'post_type' => ($search_all || $post_id ? array_keys($types) : ($post_type <> 'shop' ? $post_type : 'page')),
72
+ 'post_status' => $statuses,
73
  's' => (!$search_all ? (strpos($search, '/') === false ? $search : '') : ''),
74
+ 'posts_per_page' => (!$search_all ? (strpos($search, '/') === false ? $post_per_page : 10000) : 10000),
75
  'paged' => $paged,
76
  'orderby' => 'date',
77
  'order' => 'DESC',
99
  if ($page->url <> '') {
100
  //Search the Squirrly Title, Description and URL if search is set
101
  if ($search <> '') {
102
+ if (SQ_Classes_Helpers_Tools::findStr($page->sq->title, $search) === false &&
103
+ SQ_Classes_Helpers_Tools::findStr($page->sq->description, $search) === false &&
104
+ strpos($page->url, trim($search, '/')) === false) {
105
  continue;
106
  }
107
  }
108
 
109
  //Don't let other post types to pass
110
+ if (!$search_all && !$post_id && isset($page->post_type) && $page->post_type <> $post_type) {
111
+ continue;
 
 
112
  }
113
 
114
  $pages[] = $page;
models/services/JsonLD.php CHANGED
@@ -1066,37 +1066,39 @@ class SQ_Models_Services_JsonLD extends SQ_Models_Abstract_Seo
1066
 
1067
  if (!empty($categories)) {
1068
  foreach ($categories as $category) {
1069
- $crumbs = [];
1070
- $parents = get_ancestors($category->term_id, $category->taxonomy);
 
1071
 
1072
- if (!empty($parents)) {
1073
- $parents = array_reverse($parents);
1074
 
1075
- foreach ($parents as $parent) {
1076
- $parent = get_term($parent);
1077
- if (isset($parent->name) && $parent->name <> '') {
 
 
 
 
 
 
 
 
1078
  $crumbs[] = array(
1079
- $parent->name,
1080
- get_term_link($parent->term_id, $category->taxonomy),
1081
  );
1082
  }
1083
- }
1084
 
1085
- if (isset($category->name) && $category->name <> '') {
 
1086
  $crumbs[] = array(
1087
  $category->name,
1088
  get_term_link($category->term_id, $category->taxonomy),
1089
  );
1090
- }
1091
-
1092
- $lists[] = $crumbs;
1093
- } elseif (isset($category->name) && $category->name <> '') {
1094
- $crumbs[] = array(
1095
- $category->name,
1096
- get_term_link($category->term_id, $category->taxonomy),
1097
- );
1098
 
1099
- $lists[] = $crumbs;
 
1100
  }
1101
  }
1102
  }
@@ -1182,7 +1184,7 @@ class SQ_Models_Services_JsonLD extends SQ_Models_Abstract_Seo
1182
  try {
1183
  $product = new WC_Product($this->_post->ID);
1184
 
1185
- if(class_exists('WC_Product_Variable')) {
1186
  $product = WC_Product_Variable::sync($this->_post->ID);
1187
  }
1188
 
@@ -1266,7 +1268,7 @@ class SQ_Models_Services_JsonLD extends SQ_Models_Abstract_Seo
1266
  if ($product->is_type('variable') && method_exists($product, 'get_variation_prices')
1267
  && method_exists($product, 'get_variation_regular_price') && method_exists($product, 'get_variation_sale_price')) {
1268
  $prices = $product->get_variation_prices();
1269
- $markup['aaaa'] = json_encode($prices);
1270
  if (isset($prices['price'])) {
1271
  //Get the product price
1272
  $price = $product->get_price();
1066
 
1067
  if (!empty($categories)) {
1068
  foreach ($categories as $category) {
1069
+ if(isset($category->term_id) && isset($category->taxonomy)){
1070
+ $crumbs = [];
1071
+ $parents = get_ancestors($category->term_id, $category->taxonomy);
1072
 
1073
+ if (!empty($parents)) {
1074
+ $parents = array_reverse($parents);
1075
 
1076
+ foreach ($parents as $parent) {
1077
+ $parent = get_term($parent);
1078
+ if (isset($parent->name) && $parent->name <> '') {
1079
+ $crumbs[] = array(
1080
+ $parent->name,
1081
+ get_term_link($parent->term_id, $category->taxonomy),
1082
+ );
1083
+ }
1084
+