Astra Starter Sites - Version 3.0.0

Version Description

Download this release

Release Info

Developer brainstormworg
Plugin Icon Astra Starter Sites
Version 3.0.0
Comparing to
See all releases

Code changes from version 2.7.5 to 3.0.0

Files changed (108) hide show
  1. .eslintignore +4 -0
  2. .eslintrc +50 -0
  3. admin/bsf-analytics/assets/css/unminified/style-rtl.css +20 -20
  4. admin/bsf-analytics/assets/css/unminified/style.css +20 -20
  5. admin/bsf-analytics/version.json +3 -3
  6. astra-sites.php +2 -2
  7. astra-sites/admin/bsf-analytics/assets/css/minified/style-rtl.min.css +1 -0
  8. astra-sites/admin/bsf-analytics/assets/css/minified/style.min.css +1 -0
  9. astra-sites/admin/bsf-analytics/assets/css/unminified/style-rtl.css +21 -0
  10. astra-sites/admin/bsf-analytics/assets/css/unminified/style.css +21 -0
  11. astra-sites/admin/bsf-analytics/class-bsf-analytics-loader.php +118 -0
  12. astra-sites/admin/bsf-analytics/class-bsf-analytics-stats.php +256 -0
  13. astra-sites/admin/bsf-analytics/class-bsf-analytics.php +508 -0
  14. astra-sites/admin/bsf-analytics/version.json +4 -0
  15. astra-sites/assets/css/admin.css +67 -0
  16. astra-sites/assets/css/astra-notices-rtl.css +31 -0
  17. astra-sites/assets/css/astra-notices.css +31 -0
  18. astra-sites/assets/js/admin.js +61 -0
  19. astra-sites/astra-sites.php +83 -0
  20. astra-sites/classes/class-astra-sites-admin.php +197 -0
  21. astra-sites/inc/assets/css/admin-rtl.css +3131 -0
  22. astra-sites/inc/assets/css/admin.css +3131 -0
  23. astra-sites/inc/assets/css/elementor-admin-common-rtl.css +247 -0
  24. astra-sites/inc/assets/css/elementor-admin-common.css +247 -0
  25. astra-sites/inc/assets/css/elementor-admin-dark-rtl.css +106 -0
  26. astra-sites/inc/assets/css/elementor-admin-dark.css +106 -0
  27. astra-sites/inc/assets/css/elementor-admin-rtl.css +1220 -0
  28. astra-sites/inc/assets/css/elementor-admin.css +1220 -0
  29. astra-sites/inc/assets/css/images-rtl.css +632 -0
  30. astra-sites/inc/assets/css/images.css +632 -0
  31. astra-sites/inc/assets/css/import-status-rtl.css +97 -0
  32. astra-sites/inc/assets/css/import-status.css +97 -0
  33. astra-sites/inc/assets/css/install-theme-rtl.css +21 -0
  34. astra-sites/inc/assets/css/install-theme.css +21 -0
  35. astra-sites/inc/assets/css/integration-rtl.css +304 -0
  36. astra-sites/inc/assets/css/integration.css +304 -0
  37. astra-sites/inc/assets/fonts/astra-sites.eot +0 -0
  38. astra-sites/inc/assets/fonts/astra-sites.svg +16 -0
  39. astra-sites/inc/assets/fonts/astra-sites.ttf +0 -0
  40. astra-sites/inc/assets/fonts/astra-sites.woff +0 -0
  41. astra-sites/inc/assets/images/arrow-blue.svg +12 -0
  42. astra-sites/inc/assets/images/beaver-builder.jpg +0 -0
  43. astra-sites/inc/assets/images/block-editor.png +0 -0
  44. astra-sites/inc/assets/images/brizy.jpg +0 -0
  45. astra-sites/inc/assets/images/elementor.jpg +0 -0
  46. astra-sites/inc/assets/images/empty-collection.svg +91 -0
  47. astra-sites/inc/assets/images/gutenberg.jpg +0 -0
  48. astra-sites/inc/assets/images/logo.svg +47 -0
  49. astra-sites/inc/assets/images/pixabay-logo.png +0 -0
  50. astra-sites/inc/assets/images/placeholder.png +0 -0
  51. astra-sites/inc/assets/images/premium-crown.svg +14 -0
  52. astra-sites/inc/assets/images/quick-link-logo.svg +14 -0
  53. astra-sites/inc/assets/js/admin-page.js +3982 -0
  54. astra-sites/inc/assets/js/common.js +337 -0
  55. astra-sites/inc/assets/js/dist/main.asset.php +1 -0
  56. astra-sites/inc/assets/js/dist/main.js +1 -0
  57. astra-sites/inc/assets/js/elementor-admin-page.js +1822 -0
  58. astra-sites/inc/assets/js/eventsource.js +675 -0
  59. astra-sites/inc/assets/js/eventsource.min.js +8 -0
  60. astra-sites/inc/assets/js/fetch.umd.js +538 -0
  61. astra-sites/inc/assets/js/helper.js +174 -0
  62. astra-sites/inc/assets/js/history.js +10 -0
  63. astra-sites/inc/assets/js/import-status.js +102 -0
  64. astra-sites/inc/assets/js/install-theme.js +126 -0
  65. astra-sites/inc/classes/batch-import/class-astra-sites-batch-import.php +67 -0
  66. astra-sites/inc/classes/batch-import/class-astra-sites-batch-site-import-batch.php +59 -0
  67. astra-sites/inc/classes/batch-import/class-astra-sites-batch-site-import.php +717 -0
  68. astra-sites/inc/classes/class-astra-sites-elementor-images.php +94 -0
  69. astra-sites/inc/classes/class-astra-sites-elementor-pages.php +102 -0
  70. astra-sites/inc/classes/class-astra-sites-importer-log.php +527 -0
  71. astra-sites/inc/classes/class-astra-sites-importer.php +930 -0
  72. astra-sites/inc/classes/class-astra-sites-page.php +666 -0
  73. astra-sites/inc/classes/class-astra-sites-white-label.php +311 -0
  74. astra-sites/inc/classes/class-astra-sites-wp-cli.php +773 -0
  75. astra-sites/inc/classes/class-astra-sites.php +2248 -0
  76. astra-sites/inc/classes/compatibility/astra-pro/class-astra-sites-compatibility-astra-pro.php +311 -0
  77. astra-sites/inc/classes/compatibility/class-astra-sites-compatibility.php +72 -0
  78. astra-sites/inc/classes/compatibility/elementor/class-astra-sites-compatibility-elementor.php +143 -0
  79. astra-sites/inc/classes/compatibility/learndash/class-astra-sites-compatibility-learndash.php +62 -0
  80. astra-sites/inc/classes/compatibility/sfwd-lms/class-astra-sites-compatibility-sfwd-lms.php +111 -0
  81. astra-sites/inc/classes/compatibility/woocommerce/class-astra-sites-compatibility-woocommerce.php +157 -0
  82. astra-sites/inc/classes/functions.php +136 -0
  83. astra-sites/inc/config/paths.js +21 -0
  84. astra-sites/inc/config/webpack.config.dev.js +88 -0
  85. astra-sites/inc/config/webpack.config.prod.js +92 -0
  86. astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-beaver-builder.php +306 -0
  87. astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-brizy.php +147 -0
  88. astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-elementor.php +152 -0
  89. astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-gutenberg.php +289 -0
  90. astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-importer.php +405 -0
  91. astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-misc.php +149 -0
  92. astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-widgets.php +167 -0
  93. astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing.php +988 -0
  94. astra-sites/inc/importers/batch-processing/helpers/class-astra-sites-image-importer.php +280 -0
  95. astra-sites/inc/importers/batch-processing/helpers/class-wp-async-request.php +168 -0
  96. astra-sites/inc/importers/batch-processing/helpers/class-wp-background-process-astra-single.php +71 -0
  97. astra-sites/inc/importers/batch-processing/helpers/class-wp-background-process-astra-site-importer.php +97 -0
  98. astra-sites/inc/importers/batch-processing/helpers/class-wp-background-process-astra.php +69 -0
  99. astra-sites/inc/importers/batch-processing/helpers/class-wp-background-process.php +524 -0
  100. astra-sites/inc/importers/class-astra-customizer-import.php +94 -0
  101. astra-sites/inc/importers/class-astra-site-options-import.php +340 -0
  102. astra-sites/inc/importers/class-astra-sites-helper.php +376 -0
  103. astra-sites/inc/importers/class-astra-widget-importer.php +289 -0
  104. astra-sites/inc/importers/wxr-importer/class-astra-wxr-importer.php +567 -0
  105. astra-sites/inc/importers/wxr-importer/class-wp-importer-logger-serversentevents.php +75 -0
  106. astra-sites/inc/importers/wxr-importer/class-wp-importer-logger.php +152 -0
  107. astra-sites/inc/importers/wxr-importer/class-wxr-import-info.php +94 -0
  108. astra-sites/inc/importers/wxr-importer/class-wxr-importer.php +1105 -0
.eslintignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ inc/onboarding/assets/dist
2
+ inc/onboarding/assets/images
3
+ inc/onboarding/assets/css
4
+ inc/onboarding/assets/src/onboarding/steps/customize-site/customize-steps/site-typography/font-svg-list.js
.eslintrc ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "root": true,
3
+ "extends": [
4
+ "plugin:@wordpress/eslint-plugin/recommended"
5
+ ],
6
+ "env": {
7
+ "browser": true
8
+ },
9
+ "globals": {
10
+ "starterTemplates": true,
11
+ "astraSitesVars": true,
12
+ "ajaxurl": true,
13
+ "starterTemplatesPreview":true,
14
+ "jQuery": true
15
+ },
16
+ "rules": {
17
+ "jsdoc/require-param": "off",
18
+ "jsdoc/valid-types": "error",
19
+ "jsx-a11y/no-static-element-interactions": "off", // Should be enabled.
20
+ "jsx-a11y/click-events-have-key-events": "off", // Should be enabled.
21
+ "jsx-a11y/alt-text": "error",
22
+ "eqeqeq": "error",
23
+ "jsx-a11y/iframe-has-title": "error",
24
+ "jsdoc/check-param-names": "error",
25
+ "jsx-a11y/no-noninteractive-element-interactions": "off", // Should be enabled.
26
+ "@wordpress/i18n-no-variables": "error",
27
+ "no-template-curly-in-string": "error",
28
+ "no-throw-literal": "error",
29
+ "no-unmodified-loop-condition": "error",
30
+ "no-useless-call": "error",
31
+ "no-useless-concat": "error",
32
+ "prefer-object-spread": "off", // Should be enabled.
33
+ "prefer-promise-reject-errors": "error",
34
+ "prefer-rest-params": "error",
35
+ "prefer-spread": "error",
36
+ "radix": [ "error", "as-needed" ],
37
+ "require-await": "error",
38
+ "rest-spread-spacing": [ "error", "never" ],
39
+ "react/prop-types": "off", // Should be enabled.
40
+ "react-hooks/exhaustive-deps": [ "off", { "additionalHooks": "useSelect" } ],
41
+ "react/jsx-closing-tag-location": "error",
42
+ "react/jsx-fragments": "error",
43
+ "react/self-closing-comp": "error",
44
+ "react/jsx-first-prop-new-line": "error",
45
+ "react/jsx-no-literals": "off", // Should be enabled.
46
+ "react/jsx-no-useless-fragment": "off", // Should be enabled.
47
+ "import/order": [ "error", { "groups": [ "builtin", [ "external", "unknown" ], "internal", "parent", "sibling", "index" ] } ],
48
+ "func-style": ["error", "expression"]
49
+ }
50
+ }
admin/bsf-analytics/assets/css/unminified/style-rtl.css CHANGED
@@ -1,21 +1,21 @@
1
- [ID*="-optin-notice"] {
2
- padding: 1px 12px;
3
- border-right-color: #007cba;
4
- }
5
-
6
- [ID*="-optin-notice"] .notice-container {
7
- padding-top: 10px;
8
- padding-bottom: 12px;
9
- }
10
-
11
- [ID*="-optin-notice"] .notice-content {
12
- margin: 0;
13
- }
14
-
15
- [ID*="-optin-notice"] .notice-heading {
16
- padding: 0 0 12px 20px;
17
- }
18
-
19
- [ID*="-optin-notice"] .button-primary {
20
- margin-left: 5px;
21
  }
1
+ [ID*="-optin-notice"] {
2
+ padding: 1px 12px;
3
+ border-right-color: #007cba;
4
+ }
5
+
6
+ [ID*="-optin-notice"] .notice-container {
7
+ padding-top: 10px;
8
+ padding-bottom: 12px;
9
+ }
10
+
11
+ [ID*="-optin-notice"] .notice-content {
12
+ margin: 0;
13
+ }
14
+
15
+ [ID*="-optin-notice"] .notice-heading {
16
+ padding: 0 0 12px 20px;
17
+ }
18
+
19
+ [ID*="-optin-notice"] .button-primary {
20
+ margin-left: 5px;
21
  }
admin/bsf-analytics/assets/css/unminified/style.css CHANGED
@@ -1,21 +1,21 @@
1
- [ID*="-optin-notice"] {
2
- padding: 1px 12px;
3
- border-left-color: #007cba;
4
- }
5
-
6
- [ID*="-optin-notice"] .notice-container {
7
- padding-top: 10px;
8
- padding-bottom: 12px;
9
- }
10
-
11
- [ID*="-optin-notice"] .notice-content {
12
- margin: 0;
13
- }
14
-
15
- [ID*="-optin-notice"] .notice-heading {
16
- padding: 0 20px 12px 0;
17
- }
18
-
19
- [ID*="-optin-notice"] .button-primary {
20
- margin-right: 5px;
21
  }
1
+ [ID*="-optin-notice"] {
2
+ padding: 1px 12px;
3
+ border-left-color: #007cba;
4
+ }
5
+
6
+ [ID*="-optin-notice"] .notice-container {
7
+ padding-top: 10px;
8
+ padding-bottom: 12px;
9
+ }
10
+
11
+ [ID*="-optin-notice"] .notice-content {
12
+ margin: 0;
13
+ }
14
+
15
+ [ID*="-optin-notice"] .notice-heading {
16
+ padding: 0 20px 12px 0;
17
+ }
18
+
19
+ [ID*="-optin-notice"] .button-primary {
20
+ margin-right: 5px;
21
  }
admin/bsf-analytics/version.json CHANGED
@@ -1,4 +1,4 @@
1
- {
2
- "bsf-analytics-ver": "1.1.1"
3
- }
4
 
1
+ {
2
+ "bsf-analytics-ver": "1.1.1"
3
+ }
4
 
astra-sites.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Starter Templates
4
  * Plugin URI: https://wpastra.com/
5
  * Description: Starter Templates is all in one solution for complete starter sites, single page templates, blocks & images. This plugin offers the premium library of ready templates & provides quick access to beautiful Pixabay images that can be imported in your website easily.
6
- * Version: 2.7.5
7
  * Author: Brainstorm Force
8
  * Author URI: https://www.brainstormforce.com
9
  * Text Domain: astra-sites
@@ -19,7 +19,7 @@ if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
19
  }
20
 
21
  if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
- define( 'ASTRA_SITES_VER', '2.7.5' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
3
  * Plugin Name: Starter Templates
4
  * Plugin URI: https://wpastra.com/
5
  * Description: Starter Templates is all in one solution for complete starter sites, single page templates, blocks & images. This plugin offers the premium library of ready templates & provides quick access to beautiful Pixabay images that can be imported in your website easily.
6
+ * Version: 3.0.0
7
  * Author: Brainstorm Force
8
  * Author URI: https://www.brainstormforce.com
9
  * Text Domain: astra-sites
19
  }
20
 
21
  if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
+ define( 'ASTRA_SITES_VER', '3.0.0' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
astra-sites/admin/bsf-analytics/assets/css/minified/style-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ [ID*="-optin-notice"]{padding:1px 12px;border-right-color:#007cba}[ID*="-optin-notice"] .notice-container{padding-top:10px;padding-bottom:12px}[ID*="-optin-notice"] .notice-content{margin:0}[ID*="-optin-notice"] .notice-heading{padding:0 0 12px 20px}[ID*="-optin-notice"] .button-primary{margin-left:5px}
astra-sites/admin/bsf-analytics/assets/css/minified/style.min.css ADDED
@@ -0,0 +1 @@
 
1
+ [ID*="-optin-notice"]{padding:1px 12px;border-left-color:#007cba}[ID*="-optin-notice"] .notice-container{padding-top:10px;padding-bottom:12px}[ID*="-optin-notice"] .notice-content{margin:0}[ID*="-optin-notice"] .notice-heading{padding:0 20px 12px 0}[ID*="-optin-notice"] .button-primary{margin-right:5px}
astra-sites/admin/bsf-analytics/assets/css/unminified/style-rtl.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [ID*="-optin-notice"] {
2
+ padding: 1px 12px;
3
+ border-right-color: #007cba;
4
+ }
5
+
6
+ [ID*="-optin-notice"] .notice-container {
7
+ padding-top: 10px;
8
+ padding-bottom: 12px;
9
+ }
10
+
11
+ [ID*="-optin-notice"] .notice-content {
12
+ margin: 0;
13
+ }
14
+
15
+ [ID*="-optin-notice"] .notice-heading {
16
+ padding: 0 0 12px 20px;
17
+ }
18
+
19
+ [ID*="-optin-notice"] .button-primary {
20
+ margin-left: 5px;
21
+ }
astra-sites/admin/bsf-analytics/assets/css/unminified/style.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [ID*="-optin-notice"] {
2
+ padding: 1px 12px;
3
+ border-left-color: #007cba;
4
+ }
5
+
6
+ [ID*="-optin-notice"] .notice-container {
7
+ padding-top: 10px;
8
+ padding-bottom: 12px;
9
+ }
10
+
11
+ [ID*="-optin-notice"] .notice-content {
12
+ margin: 0;
13
+ }
14
+
15
+ [ID*="-optin-notice"] .notice-heading {
16
+ padding: 0 20px 12px 0;
17
+ }
18
+
19
+ [ID*="-optin-notice"] .button-primary {
20
+ margin-right: 5px;
21
+ }
astra-sites/admin/bsf-analytics/class-bsf-analytics-loader.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BSF analytics loader file.
4
+ *
5
+ * @version 1.0.0
6
+ *
7
+ * @package bsf-analytics
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit();
12
+ }
13
+
14
+ /**
15
+ * Class BSF_Analytics_Loader.
16
+ */
17
+ class BSF_Analytics_Loader {
18
+
19
+ /**
20
+ * Analytics Entities.
21
+ *
22
+ * @access private
23
+ * @var array Entities array.
24
+ */
25
+ private $entities = array();
26
+
27
+ /**
28
+ * Analytics Version.
29
+ *
30
+ * @access private
31
+ * @var float analytics version.
32
+ */
33
+ private $analytics_version = '';
34
+
35
+ /**
36
+ * Analytics path.
37
+ *
38
+ * @access private
39
+ * @var string path array.
40
+ */
41
+ private $analytics_path = '';
42
+
43
+ /**
44
+ * Instance
45
+ *
46
+ * @access private
47
+ * @var object Class object.
48
+ */
49
+ private static $instance = null;
50
+
51
+ /**
52
+ * Get instace of class.
53
+ *
54
+ * @return object
55
+ */
56
+ public static function get_instance() {
57
+ if ( null === self::$instance ) {
58
+ self::$instance = new self();
59
+ }
60
+
61
+ return self::$instance;
62
+ }
63
+
64
+ /**
65
+ * Constructor
66
+ */
67
+ public function __construct() {
68
+ add_action( 'init', array( $this, 'load_analytics' ) );
69
+ }
70
+
71
+ /**
72
+ * Set entity for analytics.
73
+ *
74
+ * @param string $data Entity attributes data.
75
+ * @return void
76
+ */
77
+ public function set_entity( $data ) {
78
+ array_push( $this->entities, $data );
79
+ }
80
+
81
+ /**
82
+ * Load Analytics library.
83
+ *
84
+ * @return void
85
+ */
86
+ public function load_analytics() {
87
+ $unique_entities = array();
88
+
89
+ if ( ! empty( $this->entities ) ) {
90
+ foreach ( $this->entities as $entity ) {
91
+ foreach ( $entity as $key => $data ) {
92
+
93
+ if ( isset( $data['path'] ) ) {
94
+ if ( file_exists( $data['path'] . '/version.json' ) ) {
95
+ $file_contents = file_get_contents( $data['path'] . '/version.json' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
96
+ $analytics_version = json_decode( $file_contents, 1 );
97
+ $analytics_version = $analytics_version['bsf-analytics-ver'];
98
+
99
+ if ( version_compare( $analytics_version, $this->analytics_version, '>' ) ) {
100
+ $this->analytics_version = $analytics_version;
101
+ $this->analytics_path = $data['path'];
102
+ }
103
+ }
104
+ }
105
+
106
+ if ( ! isset( $unique_entities[ $key ] ) ) {
107
+ $unique_entities[ $key ] = $data;
108
+ }
109
+ }
110
+ }
111
+
112
+ if ( file_exists( $this->analytics_path ) && ! class_exists( 'BSF_Analytics' ) ) {
113
+ require_once $this->analytics_path . '/class-bsf-analytics.php';
114
+ new BSF_Analytics( $unique_entities, $this->analytics_path, $this->analytics_version );
115
+ }
116
+ }
117
+ }
118
+ }
astra-sites/admin/bsf-analytics/class-bsf-analytics-stats.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BSF analytics stat class file.
4
+ *
5
+ * @package bsf-analytics
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit; // Exit if accessed directly.
10
+ }
11
+
12
+ if ( ! class_exists( 'BSF_Analytics_Stats' ) ) {
13
+ /**
14
+ * BSF analytics stat class.
15
+ */
16
+ class BSF_Analytics_Stats {
17
+
18
+ /**
19
+ * Active plugins.
20
+ *
21
+ * Holds the sites active plugins list.
22
+ *
23
+ * @var array
24
+ */
25
+ private $plugins;
26
+
27
+ /**
28
+ * Instance of BSF_Analytics_Stats.
29
+ *
30
+ * Holds only the first object of class.
31
+ *
32
+ * @var object
33
+ */
34
+ private static $instance = null;
35
+
36
+ /**
37
+ * Create only once instance of a class.
38
+ *
39
+ * @return object
40
+ * @since 1.0.0
41
+ */
42
+ public static function instance() {
43
+ if ( null === self::$instance ) {
44
+ self::$instance = new self();
45
+ }
46
+
47
+ return self::$instance;
48
+ }
49
+
50
+ /**
51
+ * Get stats.
52
+ *
53
+ * @return array stats data.
54
+ * @since 1.0.0
55
+ */
56
+ public function get_stats() {
57
+ return apply_filters( 'bsf_core_stats', $this->get_default_stats() );
58
+ }
59
+
60
+ /**
61
+ * Retrieve stats for site.
62
+ *
63
+ * @return array stats data.
64
+ * @since 1.0.0
65
+ */
66
+ private function get_default_stats() {
67
+ return array(
68
+ 'graupi_version' => defined( 'BSF_UPDATER_VERSION' ) ? BSF_UPDATER_VERSION : false,
69
+ 'domain_name' => get_site_url(),
70
+ 'php_os' => PHP_OS,
71
+ 'server_software' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? filter_var( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ), FILTER_SANITIZE_STRING ) : '',
72
+ 'mysql_version' => $this->get_mysql_version(),
73
+ 'php_version' => $this->get_php_version(),
74
+ 'php_max_input_vars' => ini_get( 'max_input_vars' ), // phpcs:ignore:PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
75
+ 'php_post_max_size' => ini_get( 'post_max_size' ),
76
+ 'php_max_execution_time' => ini_get( 'max_execution_time' ),
77
+ 'php_memory_limit' => ini_get( 'memory_limit' ),
78
+ 'zip_installed' => extension_loaded( 'zip' ),
79
+ 'imagick_availabile' => extension_loaded( 'imagick' ),
80
+ 'xmlreader_exists' => class_exists( 'XMLReader' ),
81
+ 'gd_available' => extension_loaded( 'gd' ),
82
+ 'curl_version' => $this->get_curl_version(),
83
+ 'curl_ssl_version' => $this->get_curl_ssl_version(),
84
+ 'is_writable' => $this->is_content_writable(),
85
+
86
+ 'wp_version' => get_bloginfo( 'version' ),
87
+ 'user_count' => $this->get_user_count(),
88
+ 'site_language' => get_locale(),
89
+ 'timezone' => wp_timezone_string(),
90
+ 'is_ssl' => is_ssl(),
91
+ 'is_multisite' => is_multisite(),
92
+ 'network_url' => network_site_url(),
93
+ 'external_object_cache' => (bool) wp_using_ext_object_cache(),
94
+ 'wp_debug' => WP_DEBUG,
95
+ 'wp_debug_display' => WP_DEBUG_DISPLAY,
96
+ 'script_debug' => SCRIPT_DEBUG,
97
+
98
+ 'active_plugins' => $this->get_active_plugins(),
99
+
100
+ 'active_theme' => get_template(),
101
+ 'active_stylesheet' => get_stylesheet(),
102
+ );
103
+ }
104
+
105
+ /**
106
+ * Get installed PHP version.
107
+ *
108
+ * @return float PHP version.
109
+ * @since 1.0.0
110
+ */
111
+ private function get_php_version() {
112
+ if ( defined( 'PHP_MAJOR_VERSION' ) && defined( 'PHP_MINOR_VERSION' ) && defined( 'PHP_RELEASE_VERSION' ) ) { // phpcs:ignore
113
+ return PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
114
+ }
115
+
116
+ return phpversion();
117
+ }
118
+
119
+ /**
120
+ * User count on site.
121
+ *
122
+ * @return int User count.
123
+ * @since 1.0.0
124
+ */
125
+ private function get_user_count() {
126
+ if ( is_multisite() ) {
127
+ $user_count = get_user_count();
128
+ } else {
129
+ $count = count_users();
130
+ $user_count = $count['total_users'];
131
+ }
132
+
133
+ return $user_count;
134
+ }
135
+
136
+ /**
137
+ * Get active plugin's data.
138
+ *
139
+ * @return array active plugin's list.
140
+ * @since 1.0.0
141
+ */
142
+ private function get_active_plugins() {
143
+ if ( ! $this->plugins ) {
144
+ // Ensure get_plugin_data function is loaded.
145
+ if ( ! function_exists( 'get_plugin_data' ) ) {
146
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
147
+ }
148
+
149
+ $plugins = wp_get_active_and_valid_plugins();
150
+ $plugins = array_map( 'get_plugin_data', $plugins );
151
+ $this->plugins = array_map( array( $this, 'format_plugin' ), $plugins );
152
+ }
153
+
154
+ return $this->plugins;
155
+ }
156
+
157
+ /**
158
+ * Format plugin data.
159
+ *
160
+ * @param string $plugin plugin.
161
+ * @return array formatted plugin data.
162
+ * @since 1.0.0
163
+ */
164
+ public function format_plugin( $plugin ) {
165
+ return array(
166
+ 'name' => html_entity_decode( $plugin['Name'], ENT_COMPAT, 'UTF-8' ),
167
+ 'url' => $plugin['PluginURI'],
168
+ 'version' => $plugin['Version'],
169
+ 'slug' => $plugin['TextDomain'],
170
+ 'author_name' => html_entity_decode( wp_strip_all_tags( $plugin['Author'] ), ENT_COMPAT, 'UTF-8' ),
171
+ 'author_url' => $plugin['AuthorURI'],
172
+ );
173
+ }
174
+
175
+ /**
176
+ * Curl SSL version.
177
+ *
178
+ * @return float SSL version.
179
+ * @since 1.0.0
180
+ */
181
+ private function get_curl_ssl_version() {
182
+ $curl = array();
183
+ if ( function_exists( 'curl_version' ) ) {
184
+ $curl = curl_version(); // phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_version
185
+ }
186
+
187
+ return isset( $curl['ssl_version'] ) ? $curl['ssl_version'] : false;
188
+ }
189
+
190
+ /**
191
+ * Get cURL version.
192
+ *
193
+ * @return float cURL version.
194
+ * @since 1.0.0
195
+ */
196
+ private function get_curl_version() {
197
+ if ( function_exists( 'curl_version' ) ) {
198
+ $curl = curl_version(); // phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_version
199
+ }
200
+
201
+ return isset( $curl['version'] ) ? $curl['version'] : false;
202
+ }
203
+
204
+ /**
205
+ * Get MySQL version.
206
+ *
207
+ * @return float MySQL version.
208
+ * @since 1.0.0
209
+ */
210
+ private function get_mysql_version() {
211
+ global $wpdb;
212
+ return $wpdb->db_version();
213
+ }
214
+
215
+ /**
216
+ * Check if content directory is writable.
217
+ *
218
+ * @return bool
219
+ * @since 1.0.0
220
+ */
221
+ private function is_content_writable() {
222
+ $upload_dir = wp_upload_dir();
223
+ return wp_is_writable( $upload_dir['basedir'] );
224
+ }
225
+ }
226
+ }
227
+
228
+ /**
229
+ * Polyfill for sites using WP version less than 5.3
230
+ */
231
+ if ( ! function_exists( 'wp_timezone_string' ) ) {
232
+ /**
233
+ * Get timezone string.
234
+ *
235
+ * @return string timezone string.
236
+ * @since 1.0.0
237
+ */
238
+ function wp_timezone_string() {
239
+ $timezone_string = get_option( 'timezone_string' );
240
+
241
+ if ( $timezone_string ) {
242
+ return $timezone_string;
243
+ }
244
+
245
+ $offset = (float) get_option( 'gmt_offset' );
246
+ $hours = (int) $offset;
247
+ $minutes = ( $offset - $hours );
248
+
249
+ $sign = ( $offset < 0 ) ? '-' : '+';
250
+ $abs_hour = abs( $hours );
251
+ $abs_mins = abs( $minutes * 60 );
252
+ $tz_offset = sprintf( '%s%02d:%02d', $sign, $abs_hour, $abs_mins );
253
+
254
+ return $tz_offset;
255
+ }
256
+ }
astra-sites/admin/bsf-analytics/class-bsf-analytics.php ADDED
@@ -0,0 +1,508 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BSF analytics class file.
4
+ *
5
+ * @version 1.0.0
6
+ *
7
+ * @package bsf-analytics
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit; // Exit if accessed directly.
12
+ }
13
+
14
+ if ( ! class_exists( 'BSF_Analytics' ) ) {
15
+
16
+ /**
17
+ * BSF analytics
18
+ */
19
+ class BSF_Analytics {
20
+
21
+ /**
22
+ * Member Variable
23
+ *
24
+ * @var array Entities data.
25
+ */
26
+ private $entities;
27
+
28
+ /**
29
+ * Member Variable
30
+ *
31
+ * @var string Usage tracking document URL
32
+ */
33
+ public $usage_doc_link = 'https://store.brainstormforce.com/usage-tracking/?utm_source=wp_dashboard&utm_medium=general_settings&utm_campaign=usage_tracking';
34
+
35
+ /**
36
+ * Setup actions, load files.
37
+ *
38
+ * @param array $args entity data for analytics.
39
+ * @param string $analytics_path directory path to analytics library.
40
+ * @param float $analytics_version analytics library version.
41
+ * @since 1.0.0
42
+ */
43
+ public function __construct( $args, $analytics_path, $analytics_version ) {
44
+
45
+ // Bail when no analytics entities are registered.
46
+ if ( empty( $args ) ) {
47
+ return;
48
+ }
49
+
50
+ $this->entities = $args;
51
+
52
+ define( 'BSF_ANALYTICS_VERSION', $analytics_version );
53
+ define( 'BSF_ANALYTICS_URI', $this->get_analytics_url( $analytics_path ) );
54
+
55
+ add_action( 'admin_init', array( $this, 'handle_optin_optout' ) );
56
+ add_action( 'admin_notices', array( $this, 'option_notice' ) );
57
+ add_action( 'init', array( $this, 'maybe_track_analytics' ), 99 );
58
+
59
+ $this->set_actions();
60
+
61
+ add_action( 'admin_init', array( $this, 'register_usage_tracking_setting' ) );
62
+
63
+ $this->includes();
64
+ }
65
+
66
+ /**
67
+ * Setup actions for admin notice style and analytics cron event.
68
+ *
69
+ * @since 1.0.4
70
+ */
71
+ public function set_actions() {
72
+
73
+ foreach ( $this->entities as $key => $data ) {
74
+ add_action( 'astra_notice_before_markup_' . $key . '-optin-notice', array( $this, 'enqueue_assets' ) );
75
+ add_action( 'update_option_' . $key . '_analytics_optin', array( $this, 'update_analytics_option_callback' ), 10, 3 );
76
+ add_action( 'add_option_' . $key . '_analytics_optin', array( $this, 'add_analytics_option_callback' ), 10, 2 );
77
+ }
78
+ }
79
+
80
+ /**
81
+ * BSF Analytics URL
82
+ *
83
+ * @param string $analytics_path directory path to analytics library.
84
+ * @return String URL of bsf-analytics directory.
85
+ * @since 1.0.0
86
+ */
87
+ public function get_analytics_url( $analytics_path ) {
88
+
89
+ $content_dir_path = wp_normalize_path( WP_CONTENT_DIR );
90
+
91
+ $analytics_path = wp_normalize_path( $analytics_path );
92
+
93
+ return str_replace( $content_dir_path, content_url(), $analytics_path );
94
+ }
95
+
96
+ /**
97
+ * Get API URL for sending analytics.
98
+ *
99
+ * @return string API URL.
100
+ * @since 1.0.0
101
+ */
102
+ private function get_api_url() {
103
+ return defined( 'BSF_API_URL' ) ? BSF_API_URL : 'https://support.brainstormforce.com/';
104
+ }
105
+
106
+ /**
107
+ * Enqueue Scripts.
108
+ *
109
+ * @since 1.0.0
110
+ * @return void
111
+ */
112
+ public function enqueue_assets() {
113
+
114
+ /**
115
+ * Load unminified if SCRIPT_DEBUG is true.
116
+ *
117
+ * Directory and Extensions.
118
+ */
119
+ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
120
+ $file_rtl = ( is_rtl() ) ? '-rtl' : '';
121
+ $css_ext = ( SCRIPT_DEBUG ) ? '.css' : '.min.css';
122
+
123
+ $css_uri = BSF_ANALYTICS_URI . '/assets/css/' . $dir_name . '/style' . $file_rtl . $css_ext;
124
+
125
+ wp_enqueue_style( 'bsf-analytics-admin-style', $css_uri, false, BSF_ANALYTICS_VERSION, 'all' );
126
+ }
127
+
128
+ /**
129
+ * Send analytics API call.
130
+ *
131
+ * @since 1.0.0
132
+ */
133
+ public function send() {
134
+ wp_remote_post(
135
+ $this->get_api_url() . 'wp-json/bsf-core/v1/analytics/',
136
+ array(
137
+ 'body' => BSF_Analytics_Stats::instance()->get_stats(),
138
+ 'timeout' => 5,
139
+ 'blocking' => false,
140
+ )
141
+ );
142
+ }
143
+
144
+ /**
145
+ * Check if usage tracking is enabled.
146
+ *
147
+ * @return bool
148
+ * @since 1.0.0
149
+ */
150
+ public function is_tracking_enabled() {
151
+
152
+ foreach ( $this->entities as $key => $data ) {
153
+
154
+ $is_enabled = get_site_option( $key . '_analytics_optin' ) === 'yes' ? true : false;
155
+ $is_enabled = $this->is_white_label_enabled( $key ) ? false : $is_enabled;
156
+
157
+ if ( apply_filters( $key . '_tracking_enabled', $is_enabled ) ) {
158
+ return true;
159
+ }
160
+ }
161
+
162
+ return false;
163
+ }
164
+
165
+ /**
166
+ * Check if WHITE label is enabled for BSF products.
167
+ *
168
+ * @param string $source source of analytics.
169
+ * @return bool
170
+ * @since 1.0.0
171
+ */
172
+ public function is_white_label_enabled( $source ) {
173
+
174
+ $options = apply_filters( $source . '_white_label_options', array() );
175
+ $is_enabled = false;
176
+
177
+ if ( is_array( $options ) ) {
178
+ foreach ( $options as $option ) {
179
+ if ( true === $option ) {
180
+ $is_enabled = true;
181
+ break;
182
+ }
183
+ }
184
+ }
185
+
186
+ return $is_enabled;
187
+ }
188
+
189
+ /**
190
+ * Display admin notice for usage tracking.
191
+ *
192
+ * @since 1.0.0
193
+ */
194
+ public function option_notice() {
195
+
196
+ if ( ! current_user_can( 'manage_options' ) ) {
197
+ return;
198
+ }
199
+
200
+ foreach ( $this->entities as $key => $data ) {
201
+
202
+ $time_to_display = isset( $data['time_to_display'] ) ? $data['time_to_display'] : '+24 hours';
203
+ $usage_doc_link = isset( $data['usage_doc_link'] ) ? $data['usage_doc_link'] : $this->usage_doc_link;
204
+
205
+ // Don't display the notice if tracking is disabled or White Label is enabled for any of our plugins.
206
+ if ( false !== get_site_option( $key . '_analytics_optin', false ) || $this->is_white_label_enabled( $key ) ) {
207
+ continue;
208
+ }
209
+
210
+ // Show tracker consent notice after 24 hours from installed time.
211
+ if ( strtotime( $time_to_display, $this->get_analytics_install_time( $key ) ) > time() ) {
212
+ continue;
213
+ }
214
+
215
+ /* translators: %s product name */
216
+ $notice_string = __( 'Want to help make <strong>%1s</strong> even more awesome? Allow us to collect non-sensitive diagnostic data and usage information. ', 'astra-sites' );
217
+
218
+ if ( is_multisite() ) {
219
+ $notice_string .= __( 'This will be applicable for all sites from the network.', 'astra-sites' );
220
+ }
221
+
222
+ $language_dir = is_rtl() ? 'rtl' : 'ltr';
223
+
224
+ Astra_Notices::add_notice(
225
+ array(
226
+ 'id' => $key . '-optin-notice',
227
+ 'type' => '',
228
+ 'message' => sprintf(
229
+ '<div class="notice-content">
230
+ <div class="notice-heading">
231
+ %1$s
232
+ </div>
233
+ <div class="astra-notices-container">
234
+ <a href="%2$s" class="astra-notices button-primary">
235
+ %3$s
236
+ </a>
237
+ <a href="%4$s" data-repeat-notice-after="%5$s" class="astra-notices button-secondary">
238
+ %6$s
239
+ </a>
240
+ </div>
241
+ </div>',
242
+ /* translators: %s usage doc link */
243
+ sprintf( $notice_string . '<span dir="%2s"><a href="%3s" target="_blank" rel="noreferrer noopener">%4s</a><span>', esc_html( $data['product_name'] ), $language_dir, esc_url( $usage_doc_link ), __( ' Know More.', 'astra-sites' ) ),
244
+ add_query_arg(
245
+ array(
246
+ $key . '_analytics_optin' => 'yes',
247
+ $key . '_analytics_nonce' => wp_create_nonce( $key . '_analytics_optin' ),
248
+ 'bsf_analytics_source' => $key,
249
+ )
250
+ ),
251
+ __( 'Yes! Allow it', 'astra-sites' ),
252
+ add_query_arg(
253
+ array(
254
+ $key . '_analytics_optin' => 'no',
255
+ $key . '_analytics_nonce' => wp_create_nonce( $key . '_analytics_optin' ),
256
+ 'bsf_analytics_source' => $key,
257
+ )
258
+ ),
259
+ MONTH_IN_SECONDS,
260
+ __( 'No Thanks', 'astra-sites' )
261
+ ),
262
+ 'show_if' => true,
263
+ 'repeat-notice-after' => false,
264
+ 'priority' => 18,
265
+ 'display-with-other-notices' => true,
266
+ )
267
+ );
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Process usage tracking opt out.
273
+ *
274
+ * @since 1.0.0
275
+ */
276
+ public function handle_optin_optout() {
277
+
278
+ if ( ! current_user_can( 'manage_options' ) ) {
279
+ return;
280
+ }
281
+
282
+ $source = isset( $_GET['bsf_analytics_source'] ) ? sanitize_text_field( wp_unslash( $_GET['bsf_analytics_source'] ) ) : '';
283
+
284
+ if ( ! isset( $_GET[ $source . '_analytics_nonce' ] ) ) {
285
+ return;
286
+ }
287
+
288
+ if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET[ $source . '_analytics_nonce' ] ) ), $source . '_analytics_optin' ) ) {
289
+ return;
290
+ }
291
+
292
+ $optin_status = isset( $_GET[ $source . '_analytics_optin' ] ) ? sanitize_text_field( wp_unslash( $_GET[ $source . '_analytics_optin' ] ) ) : '';
293
+
294
+ if ( 'yes' === $optin_status ) {
295
+ $this->optin( $source );
296
+ } elseif ( 'no' === $optin_status ) {
297
+ $this->optout( $source );
298
+ }
299
+
300
+ wp_safe_redirect(
301
+ remove_query_arg(
302
+ array(
303
+ $source . '_analytics_optin',
304
+ $source . '_analytics_nonce',
305
+ 'bsf_analytics_source',
306
+ )
307
+ )
308
+ );
309
+ }
310
+
311
+ /**
312
+ * Opt in to usage tracking.
313
+ *
314
+ * @param string $source source of analytics.
315
+ * @since 1.0.0
316
+ */
317
+ private function optin( $source ) {
318
+ update_site_option( $source . '_analytics_optin', 'yes' );
319
+ }
320
+
321
+ /**
322
+ * Opt out to usage tracking.
323
+ *
324
+ * @param string $source source of analytics.
325
+ * @since 1.0.0
326
+ */
327
+ private function optout( $source ) {
328
+ update_site_option( $source . '_analytics_optin', 'no' );
329
+ }
330
+
331
+ /**
332
+ * Load analytics stat class.
333
+ *
334
+ * @since 1.0.0
335
+ */
336
+ private function includes() {
337
+ require_once __DIR__ . '/class-bsf-analytics-stats.php';
338
+ }
339
+
340
+ /**
341
+ * Register usage tracking option in General settings page.
342
+ *
343
+ * @since 1.0.0
344
+ */
345
+ public function register_usage_tracking_setting() {
346
+
347
+ foreach ( $this->entities as $key => $data ) {
348
+
349
+ if ( ! apply_filters( $key . '_tracking_enabled', true ) || $this->is_white_label_enabled( $key ) ) {
350
+ return;
351
+ }
352
+
353
+ $usage_doc_link = isset( $data['usage_doc_link'] ) ? $data['usage_doc_link'] : $this->usage_doc_link;
354
+ $author = isset( $data['author'] ) ? $data['author'] : 'Brainstorm Force';
355
+
356
+ register_setting(
357
+ 'general', // Options group.
358
+ $key . '_analytics_optin', // Option name/database.
359
+ array( 'sanitize_callback' => array( $this, 'sanitize_option' ) ) // sanitize callback function.
360
+ );
361
+
362
+ add_settings_field(
363
+ $key . '-analytics-optin', // Field ID.
364
+ __( 'Usage Tracking', 'astra-sites' ), // Field title.
365
+ array( $this, 'render_settings_field_html' ), // Field callback function.
366
+ 'general',
367
+ 'default', // Settings page slug.
368
+ array(
369
+ 'type' => 'checkbox',
370
+ 'title' => $author,
371
+ 'name' => $key . '_analytics_optin',
372
+ 'label_for' => $key . '-analytics-optin',
373
+ 'id' => $key . '-analytics-optin',
374
+ 'usage_doc_link' => $usage_doc_link,
375
+ )
376
+ );
377
+ }
378
+ }
379
+
380
+ /**
381
+ * Sanitize Callback Function
382
+ *
383
+ * @param bool $input Option value.
384
+ * @since 1.0.0
385
+ */
386
+ public function sanitize_option( $input ) {
387
+
388
+ if ( ! $input || 'no' === $input ) {
389
+ return 'no';
390
+ }
391
+
392
+ return 'yes';
393
+ }
394
+
395
+ /**
396
+ * Print settings field HTML.
397
+ *
398
+ * @param array $args arguments to field.
399
+ * @since 1.0.0
400
+ */
401
+ public function render_settings_field_html( $args ) {
402
+ ?>
403
+ <fieldset>
404
+ <label for="<?php echo esc_attr( $args['label_for'] ); ?>">
405
+ <input id="<?php echo esc_attr( $args['id'] ); ?>" type="checkbox" value="1" name="<?php echo esc_attr( $args['name'] ); ?>" <?php checked( get_site_option( $args['name'], 'no' ), 'yes' ); ?>>
406
+ <?php
407
+ /* translators: %s Product title */
408
+ echo esc_html( sprintf( __( 'Allow %s products to track non-sensitive usage tracking data.', 'astra-sites' ), $args['title'] ) );// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
409
+
410
+ if ( is_multisite() ) {
411
+ esc_html_e( ' This will be applicable for all sites from the network.', 'astra-sites' );
412
+ }
413
+ ?>
414
+ </label>
415
+ <?php
416
+ echo wp_kses_post( sprintf( '<a href="%1s" target="_blank" rel="noreferrer noopener">%2s</a>', esc_url( $args['usage_doc_link'] ), __( 'Learn More.', 'astra-sites' ) ) );
417
+ ?>
418
+ </fieldset>
419
+ <?php
420
+ }
421
+
422
+ /**
423
+ * Set analytics installed time in option.
424
+ *
425
+ * @param string $source source of analytics.
426
+ * @return string $time analytics installed time.
427
+ * @since 1.0.0
428
+ */
429
+ private function get_analytics_install_time( $source ) {
430
+
431
+ $time = get_site_option( $source . '_analytics_installed_time' );
432
+
433
+ if ( ! $time ) {
434
+ $time = time();
435
+ update_site_option( $source . '_analytics_installed_time', time() );
436
+ }
437
+
438
+ return $time;
439
+ }
440
+
441
+ /**
442
+ * Schedule/unschedule cron event on updation of option.
443
+ *
444
+ * @param string $old_value old value of option.
445
+ * @param string $value value of option.
446
+ * @param string $option Option name.
447
+ * @since 1.0.0
448
+ */
449
+ public function update_analytics_option_callback( $old_value, $value, $option ) {
450
+ if ( is_multisite() ) {
451
+ $this->add_option_to_network( $option, $value );
452
+ }
453
+ }
454
+
455
+ /**
456
+ * Analytics option add callback.
457
+ *
458
+ * @param string $option Option name.
459
+ * @param string $value value of option.
460
+ * @since 1.0.0
461
+ */
462
+ public function add_analytics_option_callback( $option, $value ) {
463
+ if ( is_multisite() ) {
464
+ $this->add_option_to_network( $option, $value );
465
+ }
466
+ }
467
+
468
+ /**
469
+ * Send analaytics track event if tracking is enabled.
470
+ *
471
+ * @since 1.0.0
472
+ */
473
+ public function maybe_track_analytics() {
474
+
475
+ if ( ! $this->is_tracking_enabled() ) {
476
+ return;
477
+ }
478
+
479
+ $analytics_track = get_site_transient( 'bsf_analytics_track' );
480
+
481
+ // If the last data sent is 2 days old i.e. transient is expired.
482
+ if ( ! $analytics_track ) {
483
+ $this->send();
484
+ set_site_transient( 'bsf_analytics_track', true, 2 * DAY_IN_SECONDS );
485
+ }
486
+ }
487
+
488
+ /**
489
+ * Save analytics option to network.
490
+ *
491
+ * @param string $option name of option.
492
+ * @param string $value value of option.
493
+ * @since 1.0.0
494
+ */
495
+ public function add_option_to_network( $option, $value ) {
496
+
497
+ // If action coming from general settings page.
498
+ if ( isset( $_POST['option_page'] ) && 'general' === $_POST['option_page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
499
+
500
+ if ( get_site_option( $option ) ) {
501
+ update_site_option( $option, $value );
502
+ } else {
503
+ add_site_option( $option, $value );
504
+ }
505
+ }
506
+ }
507
+ }
508
+ }
astra-sites/admin/bsf-analytics/version.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ {
2
+ "bsf-analytics-ver": "1.1.1"
3
+ }
4
+
astra-sites/assets/css/admin.css ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .astra-sites-custom-cta-wrap {
2
+ position: fixed;
3
+ bottom: 0;
4
+ left: 0;
5
+ right: 0;
6
+ padding: 8px;
7
+ background-color: transparent;
8
+ background-image: linear-gradient(342deg, #4A00E0 0%, #8E2DE2 100%);
9
+ transition: all 0.4s ease-in-out;
10
+ text-align: center;
11
+ margin-top: 0;
12
+ clear: both;
13
+ opacity: 0;
14
+ visibility: hidden;
15
+ margin-left: 160px;
16
+ z-index: 10;
17
+ }
18
+ .astra-sites-custom-cta-wrap.show {
19
+ opacity: 1;
20
+ visibility: visible;
21
+ }
22
+
23
+ .astra-sites-cta-title {
24
+ color: #FFFFFF;
25
+ font-size: 17px;
26
+ line-height: 1.4em;
27
+ vertical-align: middle;
28
+ }
29
+
30
+ .astra-sites-cta-btn {
31
+ display: inline-block;
32
+ }
33
+
34
+ .astra-sites-cta-btn a {
35
+ font-size: 14px;
36
+ font-weight: 600;
37
+ color: #181723;
38
+ background-color: #FFC300;
39
+ border-radius: 4px;
40
+ padding: 09px 30px;
41
+ line-height: 1.5em;
42
+ transition: none;
43
+ display: inline-block;
44
+ margin-left: 4rem;
45
+ text-decoration: none;
46
+ }
47
+ .astra-sites-cta-btn a:hover {
48
+ background-color: #FFB000;
49
+ }
50
+ .astra-previewing-single-pages .astra-sites-custom-cta-wrap {
51
+ visibility: hidden;
52
+ }
53
+
54
+ @media screen and (max-width: 768px) {
55
+ .astra-sites-custom-cta-wrap {
56
+ margin-left: 0;
57
+ }
58
+ .astra-sites-cta-title {
59
+ display: block;
60
+ margin-bottom: 10px;
61
+ }
62
+ .astra-sites-cta-btn a {
63
+ font-size: 14px;
64
+ padding: 8px 28px;
65
+ margin-left: unset;
66
+ }
67
+ }
astra-sites/assets/css/astra-notices-rtl.css ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #astra-sites-5-start-notice .notice-container {
2
+ padding-top: 10px;
3
+ padding-bottom: 10px;
4
+ display: flex;
5
+ justify-content: right;
6
+ align-items: center;
7
+ }
8
+
9
+ #astra-sites-5-start-notice .notice-content {
10
+ margin-right: 15px;
11
+ }
12
+
13
+ #astra-sites-5-start-notice .notice-image img {
14
+ width: 90px;
15
+ }
16
+
17
+ #astra-sites-5-start-notice .astra-review-notice-container {
18
+ display: flex;
19
+ align-items: center;
20
+ padding-top: 10px;
21
+ }
22
+
23
+ #astra-sites-5-start-notice .astra-review-notice-container .dashicons {
24
+ font-size: 1.4em;
25
+ padding-right: 10px;
26
+ }
27
+
28
+ #astra-sites-5-start-notice .astra-review-notice-container a {
29
+ padding-right: 5px;
30
+ text-decoration: none;
31
+ }
astra-sites/assets/css/astra-notices.css ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #astra-sites-5-start-notice .notice-container {
2
+ padding-top: 10px;
3
+ padding-bottom: 10px;
4
+ display: flex;
5
+ justify-content: left;
6
+ align-items: center;
7
+ }
8
+
9
+ #astra-sites-5-start-notice .notice-content {
10
+ margin-left: 15px;
11
+ }
12
+
13
+ #astra-sites-5-start-notice .notice-image img {
14
+ width: 90px;
15
+ }
16
+
17
+ #astra-sites-5-start-notice .astra-review-notice-container {
18
+ display: flex;
19
+ align-items: center;
20
+ padding-top: 10px;
21
+ }
22
+
23
+ #astra-sites-5-start-notice .astra-review-notice-container .dashicons {
24
+ font-size: 1.4em;
25
+ padding-left: 10px;
26
+ }
27
+
28
+ #astra-sites-5-start-notice .astra-review-notice-container a {
29
+ padding-left: 5px;
30
+ text-decoration: none;
31
+ }
astra-sites/assets/js/admin.js ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ /**
4
+ * Admin
5
+ *
6
+ * @since x.x.x
7
+ */
8
+ StarterTemplatesAdmin = {
9
+
10
+ /**
11
+ * Initializes Events.
12
+ *
13
+ * @since x.x.x
14
+ * @method init
15
+ */
16
+ init: function () {
17
+ this._bind();
18
+ },
19
+
20
+ /**
21
+ * Binds events for the BSF Quick Links
22
+ *
23
+ * @since x.x.x
24
+ * @access private
25
+ * @method _bind
26
+ */
27
+ _bind: function () {
28
+ $(window).on('scroll', StarterTemplatesAdmin._addCustomCTAInfobar);
29
+ $(document).on('astra-sites-change-page-builder', StarterTemplatesAdmin._changeCTALink);
30
+ },
31
+
32
+ _changeCTALink: function(event) {
33
+ if( AstraSitesAdmin.default_cta_link ) {
34
+ $('.astra-sites-cta-link').attr( 'href', AstraSitesAdmin.default_cta_link );
35
+ }
36
+
37
+ if( AstraSitesAdmin.quick_corner_cta_link ) {
38
+ $('.bsf-quick-link-item-upgrade').attr( 'href', AstraSitesAdmin.quick_corner_cta_link );
39
+ }
40
+
41
+ },
42
+
43
+ /**
44
+ * Show Custom CTA on scroll.
45
+ */
46
+ _addCustomCTAInfobar: function () {
47
+ var scroll = $(window).scrollTop();
48
+
49
+ if (scroll > 70) {
50
+ $(".astra-sites-custom-cta-wrap").addClass("show");
51
+ } else {
52
+ $(".astra-sites-custom-cta-wrap").removeClass("show");
53
+ }
54
+ },
55
+
56
+ };
57
+
58
+ $(function () {
59
+ StarterTemplatesAdmin.init();
60
+ });
61
+ })(jQuery);
astra-sites/astra-sites.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Starter Templates
4
+ * Plugin URI: https://wpastra.com/
5
+ * Description: Starter Templates is all in one solution for complete starter sites, single page templates, blocks & images. This plugin offers the premium library of ready templates & provides quick access to beautiful Pixabay images that can be imported in your website easily.
6
+ * Version: 3.0.0
7
+ * Author: Brainstorm Force
8
+ * Author URI: https://www.brainstormforce.com
9
+ * Text Domain: astra-sites
10
+ *
11
+ * @package Astra Sites
12
+ */
13
+
14
+ /**
15
+ * Set constants.
16
+ */
17
+ if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
18
+ define( 'ASTRA_SITES_NAME', __( 'Starter Templates', 'astra-sites' ) );
19
+ }
20
+
21
+ if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
+ define( 'ASTRA_SITES_VER', '3.0.0' );
23
+ }
24
+
25
+ if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
26
+ define( 'ASTRA_SITES_FILE', __FILE__ );
27
+ }
28
+
29
+ if ( ! defined( 'ASTRA_SITES_BASE' ) ) {
30
+ define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) );
31
+ }
32
+
33
+ if ( ! defined( 'ASTRA_SITES_DIR' ) ) {
34
+ define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) );
35
+ }
36
+
37
+ if ( ! defined( 'ASTRA_SITES_URI' ) ) {
38
+ define( 'ASTRA_SITES_URI', plugins_url( '/', ASTRA_SITES_FILE ) );
39
+ }
40
+
41
+ if ( ! function_exists( 'astra_sites_setup' ) ) :
42
+
43
+ /**
44
+ * Astra Sites Setup
45
+ *
46
+ * @since 1.0.5
47
+ */
48
+ function astra_sites_setup() {
49
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites.php';
50
+
51
+ // Admin.
52
+ require_once ASTRA_SITES_DIR . 'classes/class-astra-sites-admin.php';
53
+ }
54
+
55
+ add_action( 'plugins_loaded', 'astra_sites_setup' );
56
+
57
+ endif;
58
+
59
+ // Astra Notices.
60
+ require_once ASTRA_SITES_DIR . 'inc/lib/astra-notices/class-astra-notices.php';
61
+
62
+ // BSF Analytics Tracker.
63
+ if ( ! class_exists( 'BSF_Analytics_Loader' ) ) {
64
+ require_once ASTRA_SITES_DIR . 'admin/bsf-analytics/class-bsf-analytics-loader.php';
65
+ }
66
+
67
+ // BSF_Quick_Links.
68
+ if ( ! class_exists( 'BSF_Quick_Links' ) ) {
69
+ require_once ASTRA_SITES_DIR . 'inc/lib/bsf-quick-links/class-bsf-quick-links.php';
70
+ }
71
+
72
+ $bsf_analytics = BSF_Analytics_Loader::get_instance();
73
+
74
+ $bsf_analytics->set_entity(
75
+ array(
76
+ 'bsf' => array(
77
+ 'product_name' => __( 'Starter Templates', 'astra-sites' ),
78
+ 'path' => ASTRA_SITES_DIR . 'admin/bsf-analytics',
79
+ 'author' => 'Brainstorm Force',
80
+ 'time_to_display' => '+24 hours',
81
+ ),
82
+ )
83
+ );
astra-sites/classes/class-astra-sites-admin.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin Notices
4
+ *
5
+ * @since 2.3.7
6
+ * @package Astra Sites
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ if ( ! class_exists( 'Astra_Sites_Admin' ) ) :
14
+
15
+ /**
16
+ * Admin
17
+ */
18
+ class Astra_Sites_Admin {
19
+
20
+ /**
21
+ * Instance of Astra_Sites_Admin
22
+ *
23
+ * @since 2.3.7
24
+ * @var (Object) Astra_Sites_Admin
25
+ */
26
+ private static $instance = null;
27
+
28
+ /**
29
+ * Instance of Astra_Sites_Admin.
30
+ *
31
+ * @since 2.3.7
32
+ *
33
+ * @return object Class object.
34
+ */
35
+ public static function get_instance() {
36
+ if ( ! isset( self::$instance ) ) {
37
+ self::$instance = new self();
38
+ }
39
+
40
+ return self::$instance;
41
+ }
42
+
43
+ /**
44
+ * Constructor.
45
+ *
46
+ * @since 2.3.7
47
+ */
48
+ private function __construct() {
49
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
50
+ add_action( 'astra_notice_before_markup', array( $this, 'notice_assets' ) );
51
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_assets' ) );
52
+ add_action( 'astra_sites_after_site_grid', array( $this, 'custom_upgrade_cta' ) );
53
+ add_filter( 'astra_sites_quick_links', array( $this, 'change_quick_links' ) );
54
+ }
55
+
56
+ /**
57
+ * Change quick links
58
+ *
59
+ * @since 2.6.18
60
+ * @param array $links All quick links.
61
+ * @return array
62
+ */
63
+ public function change_quick_links( $links = array() ) {
64
+
65
+ if ( ! isset( $links['links']['upgrade'] ) ) {
66
+ return $links;
67
+ }
68
+
69
+ // Change default call to action link.
70
+ $links['links']['upgrade']['url'] = Astra_Sites::get_instance()->get_cta_link( 'quick-links-corner' );
71
+
72
+ return $links;
73
+ }
74
+
75
+ /**
76
+ * Admin Assets
77
+ */
78
+ public function admin_assets() {
79
+ $current_screen = get_current_screen();
80
+
81
+ if ( 'appearance_page_starter-templates' !== $current_screen->id ) {
82
+ return;
83
+ }
84
+
85
+ if ( Astra_Sites_White_Label::get_instance()->is_white_labeled() ) {
86
+ return;
87
+ }
88
+
89
+ wp_enqueue_style( 'astra-sites-admin-page', ASTRA_SITES_URI . 'assets/css/admin.css', ASTRA_SITES_VER, true );
90
+ wp_enqueue_script( 'astra-sites-admin-js', ASTRA_SITES_URI . 'assets/js/admin.js', array( 'astra-sites-admin-page', 'jquery' ), ASTRA_SITES_VER, true );
91
+ }
92
+
93
+ /**
94
+ * Add Custom CTA Infobar.
95
+ */
96
+ public function custom_upgrade_cta() {
97
+ $current_screen = get_current_screen();
98
+
99
+ if ( 'appearance_page_starter-templates' !== $current_screen->id ) {
100
+ return;
101
+ }
102
+
103
+ if ( Astra_Sites_White_Label::get_instance()->is_white_labeled() ) {
104
+ return;
105
+ }
106
+
107
+ $custom_cta_content_data = apply_filters(
108
+ 'astra_sites_custom_cta_vars',
109
+ array(
110
+ 'text' => __( 'Get unlimited access to all premium Starter Templates and more, at a single low cost!', 'astra-sites' ),
111
+ 'button_text' => __( 'Get Essential Bundle', 'astra-sites' ),
112
+ 'cta_link' => Astra_Sites::get_instance()->get_cta_link(),
113
+ )
114
+ );
115
+
116
+ $html = '<div class="astra-sites-custom-cta-wrap">';
117
+ $html .= '<span class="astra-sites-cta-title">' . esc_html( $custom_cta_content_data['text'] ) . '</span>';
118
+ $html .= '<span class="astra-sites-cta-btn">';
119
+ $html .= '<a class="astra-sites-cta-link" href="' . esc_url( $custom_cta_content_data['cta_link'] ) . '" target="_blank" >' . esc_html( $custom_cta_content_data['button_text'] ) . '</a>';
120
+ $html .= '</span>';
121
+ $html .= '</div>';
122
+ echo wp_kses_post( $html );
123
+ }
124
+
125
+ /**
126
+ * Admin Notices
127
+ *
128
+ * @since 2.3.7
129
+ * @return void
130
+ */
131
+ public function admin_notices() {
132
+
133
+ $image_path = esc_url( ASTRA_SITES_URI . 'inc/assets/images/logo.svg' );
134
+
135
+ $complete = get_option( 'astra_sites_import_complete', '' );
136
+
137
+ Astra_Notices::add_notice(
138
+ array(
139
+ 'id' => 'astra-sites-5-start-notice',
140
+ 'type' => 'info',
141
+ 'class' => 'astra-sites-5-star',
142
+ 'show_if' => ( 'yes' === $complete && false === Astra_Sites_White_Label::get_instance()->is_white_labeled() ),
143
+ /* translators: %1$s white label plugin name and %2$s deactivation link */
144
+ 'message' => sprintf(
145
+ '<div class="notice-image" style="display: flex;">
146
+ <img src="%1$s" class="custom-logo" alt="Starter Templates" itemprop="logo" style="max-width: 90px;"></div>
147
+ <div class="notice-content">
148
+ <div class="notice-heading">
149
+ %2$s
150
+ </div>
151
+ %3$s<br />
152
+ <div class="astra-review-notice-container">
153
+ <a href="%4$s" class="astra-notice-close astra-review-notice button-primary" target="_blank">
154
+ %5$s
155
+ </a>
156
+ <span class="dashicons dashicons-calendar"></span>
157
+ <a href="#" data-repeat-notice-after="%6$s" class="astra-notice-close astra-review-notice">
158
+ %7$s
159
+ </a>
160
+ <span class="dashicons dashicons-smiley"></span>
161
+ <a href="#" class="astra-notice-close astra-review-notice">
162
+ %8$s
163
+ </a>
164
+ </div>
165
+ </div>',
166
+ $image_path,
167
+ __( 'Hello! Seems like you have used Starter Templates to build this website &mdash; Thanks a ton!', 'astra-sites' ),
168
+ __( 'Could you please do us a BIG favor and give it a 5-star rating on WordPress? This would boost our motivation and help other users make a comfortable decision while choosing the Starter Templates.', 'astra-sites' ),
169
+ 'https://wordpress.org/support/plugin/astra-sites/reviews/?filter=5#new-post',
170
+ __( 'Ok, you deserve it', 'astra-sites' ),
171
+ MONTH_IN_SECONDS,
172
+ __( 'Nope, maybe later', 'astra-sites' ),
173
+ __( 'I already did', 'astra-sites' )
174
+ ),
175
+ )
176
+ );
177
+ }
178
+
179
+ /**
180
+ * Enqueue Astra Notices CSS.
181
+ *
182
+ * @since 2.3.7
183
+ *
184
+ * @return void
185
+ */
186
+ public static function notice_assets() {
187
+ $file = is_rtl() ? 'astra-notices-rtl.css' : 'astra-notices.css';
188
+ wp_enqueue_style( 'astra-sites-notices', ASTRA_SITES_URI . 'assets/css/' . $file, array(), ASTRA_SITES_VER );
189
+ }
190
+ }
191
+
192
+ /**
193
+ * Kicking this off by calling 'get_instance()' method
194
+ */
195
+ Astra_Sites_Admin::get_instance();
196
+
197
+ endif;
astra-sites/inc/assets/css/admin-rtl.css ADDED
@@ -0,0 +1,3131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'icomoon';
3
+ src: url('../fonts/astra-sites.eot?9i8jex');
4
+ src: url('../fonts/astra-sites.eot?9i8jex#iefix') format('embedded-opentype'),
5
+ url('../fonts/astra-sites.ttf?9i8jex') format('truetype'),
6
+ url('../fonts/astra-sites.woff?9i8jex') format('woff'),
7
+ url('../fonts/astra-sites.svg?9i8jex#icomoon') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ [class^="ast-icon-"], [class*=" ast-icon-"] {
13
+ /* use !important to prevent issues with browser extensions that change fonts */
14
+ font-family: 'icomoon' !important;
15
+ speak: none;
16
+ font-style: normal;
17
+ font-weight: normal;
18
+ font-variant: normal;
19
+ text-transform: none;
20
+ line-height: 1;
21
+
22
+ /* Better Font Rendering =========== */
23
+ -webkit-font-smoothing: antialiased;
24
+ -moz-osx-font-smoothing: grayscale;
25
+ }
26
+
27
+ .ast-icon-search:before {
28
+ content: "\e900";
29
+ }
30
+ .ast-icon-heart:before {
31
+ content: "\e901";
32
+ }
33
+ .ast-icon-refresh:before {
34
+ content: "\e902";
35
+ }
36
+ .ast-icon-chevron-left:before {
37
+ content: "\e904";
38
+ }
39
+ .ast-icon-file:before {
40
+ content: "\e903";
41
+ }
42
+ .ast-icon-layers:before {
43
+ content: "\e905";
44
+ }
45
+
46
+ .favorite-filters-wrap a {
47
+ font-size: 1rem;
48
+ }
49
+
50
+ .wrap .status,
51
+ .wrap .site-type {
52
+ position: absolute;
53
+ z-index: 1;
54
+ text-transform: uppercase;
55
+ color: #fff;
56
+ top: 15px;
57
+ left: 16px;
58
+ font-size: 10px;
59
+ letter-spacing: .7px;
60
+ font-weight: 500;
61
+ padding: 0.2em .7em;
62
+ border-radius: 4px;
63
+ }
64
+
65
+ .astra-sites-autocomplete-result {
66
+ position: absolute;
67
+ top: 46px !important;
68
+ right: 0;
69
+ left: 0;
70
+ bottom: 0;
71
+ }
72
+
73
+ .astra-sites-autocomplete-result .ui-autocomplete {
74
+ text-align: right;
75
+ right: 0 !important;
76
+ left: 0 !important;
77
+ width: calc( 100% - 2px ) !important;
78
+ z-index: 999999;
79
+ top: 0 !important;
80
+ }
81
+
82
+ .ast-white-label-flag {
83
+ opacity: 0;
84
+ visibility: hidden;
85
+ }
86
+
87
+ .single-site-footer .dashicons-editor-help {
88
+ cursor: pointer;
89
+ display: inline-block;
90
+ }
91
+
92
+ .preview-page-from-search-result .astra-sites-import-plugins .dashicons,
93
+ .astra-sites-page-import-popup .astra-sites-import-plugins .dashicons {
94
+ display: none;
95
+ }
96
+ .ast-sites-ps-msg {
97
+ bottom: 10px;
98
+ position: absolute;
99
+ color: #777;
100
+ margin-left: 1em;
101
+ }
102
+ #astra-sites__category-filter {
103
+ display: inline-block;
104
+ }
105
+ #astra-sites__category-filter .astra-sites__category-filter-anchor {
106
+ height: 44px;
107
+ position: relative;
108
+ cursor: pointer;
109
+ display: flex;
110
+ padding: 0 12px 0 12px;
111
+ border: 0;
112
+ width: 135px;
113
+ justify-content: space-between;
114
+ align-items: center;
115
+ font-weight: 500;
116
+ border-radius: 0 6px 6px 0;
117
+ }
118
+ #astra-sites__category-filter .astra-sites__category-filter-anchor:after {
119
+ position: absolute;
120
+ content: "";
121
+ border-right: 2px solid #555;
122
+ border-top: 2px solid #555;
123
+ padding: 3px;
124
+ left: 14px;
125
+ top: 38%;
126
+ -moz-transform: rotate(135deg);
127
+ -ms-transform: rotate(135deg);
128
+ -o-transform: rotate(135deg);
129
+ -webkit-transform: rotate(135deg);
130
+ transform: rotate(135deg);
131
+ }
132
+ #astra-sites__category-filter .ast-sites__filter-wrap-checkbox.first-wrap {
133
+ padding-top: 15px;
134
+ margin-top: 15px;
135
+ border-top: 1px solid #eee;
136
+ }
137
+ #astra-sites__category-filter ul.astra-sites__category-filter-items {
138
+ display: none;
139
+ margin: 0;
140
+ position: absolute;
141
+ width: 98px;
142
+ top: 40px;
143
+ box-sizing: content-box;
144
+ border: 1px solid #e4e4e4;
145
+ margin-top: 10px;
146
+ min-width: 135px;
147
+ background-color: #fff;
148
+ border-radius: 6px;
149
+ box-shadow: 0 3px 6px rgba(0,0,0,.1);
150
+ padding: 15px;
151
+ -webkit-transform-origin: 50% 0;
152
+ transform-origin: 50% 0;
153
+ -webkit-transition: all .2s ease;
154
+ transition: all .2s ease;
155
+ }
156
+ #astra-sites__category-filter li.ast-sites__filter-wrap.category-active:before {
157
+ content: "✓";
158
+ color: #1E8CBE;
159
+ position: absolute;
160
+ right: -15px;
161
+ font-size: 15px;
162
+ }
163
+
164
+ .astra-sites__category-filter-items label {
165
+ vertical-align: top;
166
+ }
167
+ #astra-sites__category-filter ul.astra-sites__category-filter-items li {
168
+ list-style: none;
169
+ margin-bottom: 8px;
170
+ margin-right: 14px;
171
+ cursor: pointer;
172
+ position: relative;
173
+ font-weight: 500;
174
+ }
175
+ #astra-sites__category-filter ul.astra-sites__category-filter-items li.ast-sites__filter-wrap-checkbox {
176
+ margin-right: 0;
177
+ }
178
+ #astra-sites .astra-theme:hover .inner {
179
+ transform: translate(0, -1px);
180
+ box-shadow: 0 6px 14px 0 rgba(0,0,0,.12)
181
+ }
182
+ #astra-sites .astra-theme .inner {
183
+ position: relative;
184
+ border-radius: 2px;
185
+ overflow: initial;
186
+ border: 1px solid #ddd;
187
+ transition: all 0.4s;
188
+ }
189
+ #single-pages .inner {
190
+ border: 1px solid #e2e2e2;
191
+ transition: all 250ms cubic-bezier(0.02, 0.01, 0.47, 1);
192
+ }
193
+ #single-pages .current_page .inner,
194
+ #single-pages .inner:hover {
195
+ box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14);
196
+ }
197
+ #astra-sites-admin.wrap .status,
198
+ #astra-sites-admin.wrap .site-type.premium {
199
+ background: #0073aa;
200
+ border: 2px solid #ffffff;
201
+ top: 17px;
202
+ left: 18px;
203
+ }
204
+ #astra-sites-admin .filter-links .current {
205
+ border-bottom: none;
206
+ color: #23282d;
207
+ }
208
+ #wp-filter-search-input {
209
+ font-weight: 400;
210
+ width: 100%;
211
+ opacity: 1;
212
+ height: 46px;
213
+ background: #fff;
214
+ line-height: 32px;
215
+ border-radius: 6px 0 0 6px;
216
+ font-size: 13px;
217
+ padding: 5px 20px;
218
+ border: 1px solid #DDDDDD;
219
+ border-right: 1px solid #DDDDDD;
220
+ box-shadow: none;
221
+ }
222
+
223
+ #astra-sites-filters .ui-widget.ui-widget-content {
224
+ border-top-right-radius: 0;
225
+ border-top-left-radius: 0;
226
+ border-bottom-right-radius: 6px;
227
+ border-bottom-left-radius: 6px;
228
+ border: 1px solid rgba(32,33,36,0.18);
229
+ border-top: none;
230
+ overflow: hidden;
231
+ box-shadow: 0 3px 4px 0 rgba(32,33,36,0.18);
232
+ background: transparent;
233
+ padding-top: 10px;
234
+ padding-bottom: 10px;
235
+ background: #fff;
236
+ }
237
+
238
+ #astra-sites-filters .ui-autocomplete li,
239
+ #astra-sites-filters .ui-autocomplete li:focus,
240
+ #astra-sites-filters .ui-autocomplete li:hover {
241
+ outline: none;
242
+ }
243
+ #astra-sites-filters .ui-autocomplete li {
244
+ padding: 3px 20px;
245
+ text-transform: capitalize;
246
+ }
247
+ #astra-sites-filters .ui-autocomplete li:hover {
248
+ background-color: #eeeeee;
249
+ }
250
+ .appearance_page_starter-templates .wp-filter .search-form.searching #astra-sites__category-filter {
251
+ border-bottom-right-radius: 0;
252
+ }
253
+ .searching #wp-filter-search-input {
254
+ border-bottom-left-radius: 0;
255
+ }
256
+
257
+ #wp-filter-search-input.has-input + .search-icon {
258
+ display: none;
259
+ }
260
+ .appearance_page_starter-templates .search-icon {
261
+ position: absolute;
262
+ top: 0;
263
+ left: 0;
264
+ color: #C3C3C3;
265
+ padding: 15px 12px 12px 19px;
266
+ }
267
+ .appearance_page_starter-templates .search-icon:before {
268
+ vertical-align: middle;
269
+ }
270
+ #astra-sites-admin .filter-links li > a {
271
+ border-bottom: none;
272
+ font-size: 12px;
273
+ padding: 2px 0;
274
+ text-transform: uppercase;
275
+ letter-spacing: 0.3px;
276
+ font-weight: 500;
277
+ }
278
+ #astra-sites-admin .filter-links li > a:focus {
279
+ box-shadow: none;
280
+ }
281
+ #astra-sites-admin .theme-actions {
282
+ box-shadow: none;
283
+ right: 0;
284
+ border-right: none;
285
+ background: #fafafa;
286
+ padding: 0;
287
+ margin-left: 20%;
288
+ }
289
+ .searching .pages-count,
290
+ .searching .page-title {
291
+ display: block;
292
+ }
293
+ .searching .no-pages .theme-name {
294
+ min-height: 36px;
295
+ }
296
+ #astra-sites-admin .theme-browser .theme .theme-name {
297
+ height: auto;
298
+ width: 90%;
299
+ align-self: center;
300
+ box-shadow: none;
301
+ background: none;
302
+ padding: 14px 15px;
303
+ font-size: 14px;
304
+ font-weight: 600;
305
+ display: flex;
306
+ align-items: center;
307
+ justify-content: space-between;
308
+ }
309
+ #astra-sites-admin .theme-id-container {
310
+ background: #fff;
311
+ border: none;
312
+ display: flex;
313
+ align-items: center;
314
+ justify-content: center;
315
+ border-bottom-right-radius: 2px;
316
+ border-bottom-left-radius: 2px;
317
+ border-top: 1px solid #eeeeee;
318
+ }
319
+ #astra-sites-admin .sites-page-count {
320
+ color: #888;
321
+ font-size: 12px;
322
+ display: block;
323
+ margin-top: 5px;
324
+ }
325
+ #astra-sites-admin .theme-action-wrap {
326
+ width: 100%;
327
+ padding: 8px 15px;
328
+ }
329
+ .filters-wrap-page-categories {
330
+ margin-left: 10px;
331
+ }
332
+ #astra-sites-admin .favorite-filters-wrap .filter-links a {
333
+ border: none;
334
+ }
335
+ .favorite-filters-wrap .current .dashicons {
336
+ color: #c34444;
337
+ }
338
+ .favorite-filters-wrap .dashicons {
339
+ color: #71777c;
340
+ font-size: 18px;
341
+ line-height: 18px;
342
+ width: 17px;
343
+ height: 17px;
344
+ }
345
+ .theme-browser .theme:hover,
346
+ .theme-browser .theme:focus {
347
+ cursor: initial;
348
+ }
349
+ .theme-browser .theme .inner:hover,
350
+ .theme-browser .theme .inner:focus {
351
+ cursor: pointer;
352
+ }
353
+
354
+ .searching .theme-browser .theme .inner:hover .type {
355
+ opacity: 1;
356
+ visibility: visible;
357
+ }
358
+
359
+ .astra-sites-sync-library-button.updating-message {
360
+ animation: rotation 2s infinite linear;
361
+ }
362
+
363
+ .astra-sites-sync-library,
364
+ .favorite-filters-title {
365
+ width: 10%;
366
+ padding: 15px 5px;
367
+ align-self: center;
368
+ justify-content: center;
369
+ text-align: center;
370
+ margin-right: 5px;
371
+ }
372
+ .astra-sites-sync-library a,
373
+ .favorite-filters-title a {
374
+ color: #666;
375
+ cursor: pointer;
376
+ }
377
+
378
+ .favorite-action-wrap {
379
+ padding-left: 15px;
380
+ padding-right: 10px;
381
+ }
382
+
383
+ .favorite-action-wrap i {
384
+ color: #666666;
385
+ height: 18px;
386
+ width: 18px;
387
+ font-size: 16px;
388
+ line-height: 1.5;
389
+ transition-property: border, background, color;
390
+ transition-duration: .05s;
391
+ transition-timing-function: ease-in-out;
392
+ }
393
+ .theme-id-container .ast-icon-star {
394
+ padding: 0 0 0 15px;
395
+ }
396
+ .wrap .status {
397
+ right: -0.5em;
398
+ }
399
+ .wrap .status.publish,
400
+ .wrap .site-type.free {
401
+ display: none;
402
+ }
403
+
404
+ .astra-sites-activate-license .astra-sites-import-content,
405
+ .astra-sites-get-agency-bundle .astra-sites-import-content {
406
+ height: auto;
407
+ }
408
+ .astra-sites-import-content {
409
+ display: block;
410
+ padding: 10px 35px 20px 35px;
411
+ background: #f1f3f5;
412
+ height: 200px;
413
+ overflow: auto;
414
+ position: relative;
415
+ }
416
+
417
+ .astra-sites-activate-license .astra-sites-import-content {
418
+ padding: 20px 35px 30px 35px;
419
+ }
420
+
421
+ #astra-sites-skip-and-import-notice-update-available ul {
422
+ list-style-type: disc;
423
+ margin-right: 15px;
424
+ }
425
+
426
+ .astra-sites-import-content .install-theme-info {
427
+ display: block;
428
+ padding: 0;
429
+ }
430
+
431
+ .install-theme-info .site-type {
432
+ display: none;
433
+ }
434
+
435
+ .theme {
436
+ position: relative;
437
+ }
438
+ .wrap .astra-sites-preview .site-type.premium {
439
+ display: block;
440
+ display: none;
441
+ position: relative;
442
+ margin: 0.5em 0em 1em 0em;
443
+ top: 0;
444
+ right: 0;
445
+ text-align: center;
446
+ }
447
+
448
+ .theme-details-read-more.open {
449
+ margin: 0.5em 0 0 0;
450
+ }
451
+
452
+ .astra-sites-preview .theme-screenshot {
453
+ width: 100%;
454
+ }
455
+
456
+ .install-theme-info .site-type.premium {
457
+ display: none;
458
+ }
459
+
460
+ /**
461
+ * Required Plugins
462
+ */
463
+ .required-plugins.loading {
464
+ text-align: center;
465
+ }
466
+ .required-plugins button {
467
+ float: left;
468
+ }
469
+ .required-plugins .plugin-card {
470
+ float: none;
471
+ width: 100%;
472
+ border: none;
473
+ margin: 0 0 0.8em 0;
474
+ display: flex;
475
+ justify-content: space-between;
476
+ align-items: center;
477
+ transition: background ease 0.8s;
478
+ }
479
+ .required-plugins .plugin-card.plugin-card-update-failed {
480
+ flex-wrap: wrap;
481
+ }
482
+ .required-plugins .spinner {
483
+ float: none;
484
+ margin: 0;
485
+ }
486
+
487
+ .expanded .wp-full-overlay-footer {
488
+ height: 111px;
489
+ }
490
+
491
+ .wp-full-overlay-footer .view-site,
492
+ .wp-full-overlay-footer .go-pro,
493
+ .wp-full-overlay-footer .astra-demo-import {
494
+ width: 100%;
495
+ text-align: center;
496
+ }
497
+
498
+ .wp-core-ui .wp-full-overlay-footer .button.button-hero,
499
+ .wp-core-ui .wp-full-overlay-footer .button-group.button-hero .button {
500
+ padding: 0 10px 1px;
501
+ }
502
+
503
+ .wp-full-overlay-footer .installing:before {
504
+ vertical-align: text-bottom;
505
+ }
506
+
507
+ .astra-sites-advanced-options-wrap h4 {
508
+ margin: 1em 0 0.5em 0;
509
+ padding: 0.5em 0;
510
+ transition: all ease 0.3s;
511
+ }
512
+
513
+ /**
514
+ * Read more link
515
+ */
516
+ .wp-core-ui .theme-details-read-more:focus,
517
+ .wp-core-ui .theme-details-read-more:hover {
518
+ outline: none;
519
+ box-shadow: none;
520
+ }
521
+ .wp-core-ui .theme-details-read-more {
522
+ margin: 10px 0;
523
+ display: none;
524
+ text-decoration: none;
525
+ }
526
+
527
+ /**
528
+ * Go pro.
529
+ */
530
+ .wp-core-ui .go-pro.button[disabled] {
531
+ background-color: #fcb92c !important;
532
+ color: white !important;
533
+ box-shadow: -1px 0 #eab23a !important;
534
+ text-shadow: -1px 0 #6b4e13 !important;
535
+ border-color: #e2a932 !important;
536
+ cursor: pointer;
537
+ }
538
+ .wp-core-ui .view-site .dashicons,
539
+ .wp-core-ui .go-pro .dashicons {
540
+ font-size: 1rem;
541
+ vertical-align: middle;
542
+ }
543
+
544
+ /**
545
+ * Errors
546
+ */
547
+ .plugin-card-update-failed .notice {
548
+ margin-top: 1.5em;
549
+ }
550
+
551
+ .no-themes {
552
+ margin-top: 40px;
553
+ }
554
+
555
+ .no-themes p {
556
+ font-size: 15px;
557
+ }
558
+
559
+ .no-themes .left-margin {
560
+ margin-right: 30px;
561
+ }
562
+
563
+ /**
564
+ *
565
+ */
566
+ .astra-sites-preview .wp-full-overlay-sidebar-content {
567
+ bottom: 100px;
568
+ }
569
+
570
+ .footer-import-button-wrap {
571
+ padding: 10px 20px;
572
+ }
573
+
574
+ .footer-import-button-wrap .button {
575
+ margin: 0;
576
+ }
577
+
578
+ .astra-sites-preview.expanded .wp-full-overlay-footer {
579
+ right: initial;
580
+ }
581
+
582
+ /**
583
+ * Menu Page
584
+ */
585
+ .astra-sites-title {
586
+ float: right;
587
+ font-size: 20px;
588
+ font-weight: 400;
589
+ margin: 0;
590
+ padding: 0;
591
+ color: #444;
592
+ }
593
+
594
+ #astra-sites-admin #single-pages .site-single .theme-name {
595
+ font-weight: 500;
596
+ font-size: 13px;
597
+ padding: 8px 14px;
598
+ background: #fff;
599
+ }
600
+
601
+ .astra-sites-logo-wrap {
602
+ width: 42px;
603
+ height: 42px;
604
+ }
605
+
606
+ .astra-sites-logo-wrap a,
607
+ .astra-sites-logo-wrap img {
608
+ width: inherit;
609
+ height: inherit;
610
+ display: inline-block;
611
+ }
612
+
613
+ /**
614
+ * API Error
615
+ */
616
+ .astra-api-error {
617
+ margin: 0 0 0.5em 0;
618
+ }
619
+
620
+ /**
621
+ * Grid
622
+ */
623
+ .appearance_page_starter-templates .wp-filter .search-form {
624
+ margin-right: 1em;
625
+ position: relative;
626
+ display: flex;
627
+ border-bottom: 1px solid #ccc;
628
+ }
629
+ .appearance_page_starter-templates .wp-filter .search-form #astra-sites__category-filter {
630
+ border: 1px solid #DDDDDD;
631
+ border-left: 0;
632
+ border-radius: 0 6px 6px 0;
633
+ }
634
+ .appearance_page_starter-templates .wp-filter .search-form input[type="search"] {
635
+ width: 20px;
636
+ font-size: 13px;
637
+ padding: 5px 10px;
638
+ opacity: 0;
639
+ -webkit-transition: width ease 0.3s;
640
+ -moz-transition: width ease 0.3s;
641
+ transition: width ease 0.3s;
642
+ }
643
+ .filter-count {
644
+ min-width: 3em;
645
+ margin-left: 14px;
646
+ }
647
+ .astra-site-preview-on {
648
+ overflow: hidden;
649
+ }
650
+
651
+ .filters-wrap {
652
+ display: inline-block;
653
+ }
654
+ .spinner-wrap {
655
+ text-align: center;
656
+ }
657
+ .spinner-wrap .spinner {
658
+ float: none;
659
+ }
660
+ .hide-me {
661
+ display: none !important;
662
+ }
663
+ #site-pages {
664
+ z-index: 10;
665
+ }
666
+
667
+ .install-theme-info > .notice {
668
+ margin: 5px 0 10px 0;
669
+ }
670
+
671
+ .astra-sites-suggestions:before {
672
+ border: 5px dashed #ccc;
673
+ position: absolute;
674
+ right: 0;
675
+ left: 0;
676
+ top: 0;
677
+ bottom: 0px;
678
+ }
679
+
680
+ .astra-sites-suggestions {
681
+ min-height: 390px;
682
+ border: none !important;
683
+ }
684
+
685
+ .astra-sites-suggestions a {
686
+ border: none;
687
+ outline: none;
688
+ }
689
+
690
+ .astra-sites-suggestions .inner {
691
+ border: 6px solid #ffffff !important;
692
+ background: #f1f1f1;
693
+ color: #63676b;
694
+ padding: 58% 10% 80% 10%;
695
+ text-align: center;
696
+ position: absolute;
697
+ right: 0;
698
+ left: 0;
699
+ top: 0;
700
+ bottom: 0;
701
+ cursor: auto;
702
+ }
703
+
704
+ .astra-sites-suggestions .inner a {
705
+ color: #00b9eb;
706
+ }
707
+
708
+ .astra-sites-suggestions p {
709
+ font-size: 1rem;
710
+ margin: 0;
711
+ }
712
+
713
+ .astra-notice {
714
+ margin: 2em 0em 0em 2em;
715
+ }
716
+
717
+ .no-themes .description {
718
+ display: block;
719
+ }
720
+
721
+ /**
722
+ * Responsive Button UI
723
+ */
724
+ .astra-sites-preview .wp-full-overlay-footer .devices button.active:before,
725
+ .astra-sites-preview .wp-full-overlay-footer .devices button:hover:before {
726
+ color: #0073aa;
727
+ }
728
+ .astra-sites-preview .wp-full-overlay-footer .devices button:before {
729
+ color: #c1c1c1;
730
+ }
731
+ .astra-sites-preview .wp-full-overlay-footer .devices button:hover {
732
+ background-color: transparent;
733
+ }
734
+ .astra-sites-preview .wp-full-overlay-footer .devices button {
735
+ border: none;
736
+ }
737
+ .astra-sites-preview .wp-full-overlay-footer .devices button:focus,
738
+ .astra-sites-preview .wp-full-overlay-footer .devices button.active:hover {
739
+ border-bottom-color: transparent;
740
+ background-color: transparent;
741
+ }
742
+ .not-click-able {
743
+ pointer-events: none !important;
744
+ }
745
+ body.page-builder-selected .select-page-builder,
746
+ body.loading-content .select-page-builder {
747
+ display: none;
748
+ }
749
+ .select-page-builder .up-arrow {
750
+ -webkit-transform: rotate(-90deg);
751
+ -moz-transform: rotate(-90deg);
752
+ -ms-transform: rotate(-90deg);
753
+ transform: rotate(-90deg);
754
+ display: inline-block;
755
+ font-size: 1.5em;
756
+ color: #797979;
757
+ vertical-align: middle;
758
+ margin-left: 10px;
759
+ -webkit-transition: all linear 0.6s;
760
+ -moz-transition: all linear 0.6s;
761
+ -ms-transition: all linear 0.6s;
762
+ transition: all linear 0.6s;
763
+ -webkit-animation-duration: 1s;
764
+ animation-duration: 1s;
765
+ -webkit-animation-fill-mode: both;
766
+ animation-fill-mode: both;
767
+ -webkit-animation-timing-function: ease-in-out;
768
+ animation-timing-function: ease-in-out;
769
+ animation-iteration-count: infinite;
770
+ -webkit-animation-iteration-count: infinite;
771
+ animation-name: bounce;
772
+ -moz-animation-name: bounce;
773
+ }
774
+ .select-page-builder {
775
+ margin-right: 6em;
776
+ }
777
+
778
+ .select-page-builder img {
779
+ max-width: 100%;
780
+ }
781
+
782
+ .select-page-builder .note-wrap {
783
+ position: absolute;
784
+ padding: 40px 0;
785
+ margin-right: 170px;
786
+ left: 0;
787
+ right: 0;
788
+ }
789
+
790
+ .select-page-builder h3 {
791
+ margin: 0;
792
+ font-size: 2em;
793
+ }
794
+ .select-page-builder {
795
+ margin: -20px -5px 0 0;
796
+ position: absolute;
797
+ }
798
+ .select-page-builder .note {
799
+ margin-right: 1.5em;
800
+ }
801
+
802
+ @keyframes bounce {
803
+ 0%,
804
+ 100%,
805
+ 20%,
806
+ 50%,
807
+ 80% {
808
+ -webkit-transform: translateY(-0px) rotate(-90deg);
809
+ -moz-transform: translateY(-0px) rotate(-90deg);
810
+ -ms-transform: translateY(-0px) rotate(-90deg);
811
+ transform: translateY(-0px) rotate(-90deg);
812
+ }
813
+ 40% {
814
+ -webkit-transform: translateY(-2px) rotate(-90deg);
815
+ -moz-transform: translateY(-2px) rotate(-90deg);
816
+ -ms-transform: translateY(-2px) rotate(-90deg);
817
+ transform: translateY(-2px) rotate(-90deg);
818
+ }
819
+ 60% {
820
+ -webkit-transform: translateY(-1px) rotate(-90deg);
821
+ -moz-transform: translateY(-1px) rotate(-90deg);
822
+ -ms-transform: translateY(-1px) rotate(-90deg);
823
+ transform: translateY(-1px) rotate(-90deg);
824
+ }
825
+ }
826
+
827
+ /**
828
+ * Processing Animation
829
+ */
830
+ .astra-demo-import.disabled {
831
+ pointer-events: none;
832
+ }
833
+ .astra-demo-import.button.updating-message:before,
834
+ .astra-demo-import.button.installing:before {
835
+ -webkit-animation: cssAnimation .72s ease infinite;
836
+ -moz-animation: cssAnimation .72s ease infinite;
837
+ -o-animation: cssAnimation .72s ease infinite;
838
+ -ms-animation: cssAnimation .72s ease infinite;
839
+ animation: cssAnimation .72s ease infinite;
840
+ }
841
+
842
+ @-webkit-keyframes cssAnimation {
843
+ from {
844
+ -webkit-transform: rotate(0);
845
+ -moz-transform: rotate(0);
846
+ -o-transform: rotate(0);
847
+ -ms-transform: rotate(0);
848
+ transform: rotate(0);
849
+ }
850
+ to {
851
+ -webkit-transform: rotate(-360deg);
852
+ -moz-transform: rotate(-360deg);
853
+ -o-transform: rotate(-360deg);
854
+ -ms-transform: rotate(-360deg);
855
+ transform: rotate(-360deg);
856
+ }
857
+ }
858
+ @-moz-keyframes cssAnimation {
859
+ from {
860
+ -webkit-transform: rotate(0);
861
+ -moz-transform: rotate(0);
862
+ -o-transform: rotate(0);
863
+ -ms-transform: rotate(0);
864
+ transform: rotate(0);
865
+ }
866
+ to {
867
+ -webkit-transform: rotate(-360deg);
868
+ -moz-transform: rotate(-360deg);
869
+ -o-transform: rotate(-360deg);
870
+ -ms-transform: rotate(-360deg);
871
+ transform: rotate(-360deg);
872
+ }
873
+ }
874
+ @-o-keyframes cssAnimation {
875
+ from {
876
+ -webkit-transform: rotate(0);
877
+ -moz-transform: rotate(0);
878
+ -o-transform: rotate(0);
879
+ -ms-transform: rotate(0);
880
+ transform: rotate(0);
881
+ }
882
+ to {
883
+ -webkit-transform: rotate(-360deg);
884
+ -moz-transform: rotate(-360deg);
885
+ -o-transform: rotate(-360deg);
886
+ -ms-transform: rotate(-360deg);
887
+ transform: rotate(-360deg);
888
+ }
889
+ }
890
+
891
+ #astra-sites-filters .wp-filter {
892
+ display: flex;
893
+ justify-content: space-between;
894
+ align-items: center;
895
+ }
896
+
897
+ .astra-pages-title {
898
+ color: #9e9e9e;
899
+ text-decoration: none;
900
+ font-weight: 500;
901
+ position: relative;
902
+ }
903
+ .single-site-pages-header .count {
904
+ opacity: 0.7;
905
+ }
906
+
907
+ .single-site-pages-header .astra-site-title {
908
+ font-size: 22px;
909
+ }
910
+ .astra-site-down {
911
+ padding: 1em 2em;
912
+ margin-top: 1em;
913
+ }
914
+
915
+ #astra-sites-menu-page .menu {
916
+ padding: 0;
917
+ }
918
+
919
+ .astra-sites-nav-items a:hover,
920
+ .astra-sites-nav-items a:focus {
921
+ outline: none;
922
+ border: none;
923
+ box-shadow: none;
924
+ }
925
+
926
+ .astra-sites-nav-items a {
927
+ background: #f1f1f1;
928
+ color: #4e555d;
929
+ font-size: 14px;
930
+ text-decoration: none;
931
+ padding: 21px 43px 24px 20px;
932
+ font-weight: 500;
933
+ }
934
+
935
+ .astra-sites-nav-items a:before {
936
+ content: "\f105";
937
+ }
938
+
939
+ #astra-sites-filters .search-form {
940
+ font-weight: normal;
941
+ border: none;
942
+ margin: 0;
943
+ border-radius: 6px;
944
+ display: flex;
945
+ align-items: center;
946
+ height: 46px;
947
+ }
948
+
949
+ .astra-sites-nav-items a:before {
950
+ font-family: dashicons;
951
+ display: inline-block;
952
+ line-height: 1;
953
+ font-weight: 400;
954
+ font-style: normal;
955
+ speak: none;
956
+ text-decoration: inherit;
957
+ text-transform: none;
958
+ text-rendering: auto;
959
+ -webkit-font-smoothing: antialiased;
960
+ -moz-osx-font-smoothing: grayscale;
961
+ font-size: 17px;
962
+ vertical-align: top;
963
+ text-align: center;
964
+ transition: color 0.1s ease-in;
965
+ position: absolute;
966
+ margin-right: -22px;
967
+ font-weight: normal;
968
+ }
969
+ .nav-tab-wrapper .button {
970
+ height: 30px;
971
+ }
972
+ .back-to-layout:before {
973
+ background: #fff;
974
+ color: #777;
975
+ padding: 3px;
976
+ border-radius: 100%;
977
+ font-size: 13px;
978
+ border: 1px solid #777;
979
+ }
980
+
981
+ .back-to-layout:hover:before {
982
+ background: #f7f7f7;
983
+ border-color: #0073aa;
984
+ color: #0073aa;
985
+ }
986
+
987
+ .back-to-layout {
988
+ border-left: 1px solid #eeeeee;
989
+ padding: 20px 14px;
990
+ text-align: center;
991
+ cursor: pointer;
992
+ visibility: hidden;
993
+ opacity: 0;
994
+ font-size: 24px;
995
+ line-height: normal;
996
+ }
997
+
998
+ .back-to-layout:hover {
999
+ background-color: #f7f7f7;
1000
+ }
1001
+
1002
+ .astra-sites-no-search-result .back-to-layout,
1003
+ .astra-sites-showing-favorites .back-to-layout,
1004
+ .astra-previewing-single-pages .back-to-layout {
1005
+ visibility: visible;
1006
+ opacity: 1;
1007
+ }
1008
+ .logo {
1009
+ cursor: pointer;
1010
+ }
1011
+ #astra-sites-menu-page .nav-tab-wrapper .logo {
1012
+ border-left: 1px solid #dddddd;
1013
+ padding: 13px 20px 14px 20px;
1014
+ }
1015
+ #astra-sites-menu-page .nav-tab-wrapper .logo,
1016
+ #astra-sites-menu-page .form {
1017
+ display: flex;
1018
+ align-items: center;
1019
+ }
1020
+
1021
+ #astra-sites-menu-page .nav-tab-wrapper {
1022
+ display: flex;
1023
+ justify-content: space-between;
1024
+ border: none;
1025
+ background: #fff;
1026
+ padding: 0;
1027
+ align-items: center;
1028
+ box-shadow: -25px 0 30px rgba(28, 39, 60, 0.09);
1029
+ border-bottom: 1px solid #dddddd;
1030
+ z-index: 88;
1031
+ }
1032
+ .theme-name .title,
1033
+ .theme-name .type {
1034
+ transition: all 0.4s linear;
1035
+ }
1036
+ .searching .theme-name .type {
1037
+ padding: 4px 8px;
1038
+ }
1039
+ .theme-name .type {
1040
+ font-size: 12px;
1041
+ opacity: 0;
1042
+ visibility: hidden;
1043
+ color: #555;
1044
+ border: 1px solid #cccccc;
1045
+ background: #f7f7f7;
1046
+ vertical-align: top;
1047
+ border-radius: 2px;
1048
+ font-weight: normal;
1049
+ }
1050
+ .theme-name .type .dashicons {
1051
+ font-size: 16px;
1052
+ }
1053
+ .favorite-filters-wrap {
1054
+ border-left: 1px solid #dddddd;
1055
+ padding: 10px;
1056
+ }
1057
+
1058
+ .header-actions a {
1059
+ text-decoration: none;
1060
+ font-size: 18px;
1061
+ line-height: 1;
1062
+ height: 15px;
1063
+ width: 18px;
1064
+ }
1065
+ .header-actions .filter-links li > a:hover,
1066
+ .header-actions .filter-links li > a:focus {
1067
+ outline: none;
1068
+ }
1069
+ .filter-links li > .astra-sites-show-favorite-button.current:hover,
1070
+ .filter-links li > .astra-sites-show-favorite-button.current,
1071
+ .filter-links li > .astra-sites-show-favorite-button:hover,
1072
+ .filter-links li > .astra-sites-show-favorite-button:focus,
1073
+ .astra-sites-show-favorite-button.active {
1074
+ color: transparent;
1075
+ }
1076
+ .filter-links li > .astra-sites-show-favorite-button.current:hover .ast-icon-heart,
1077
+ .filter-links li > .astra-sites-show-favorite-button.current .ast-icon-heart,
1078
+ .filter-links li > .astra-sites-show-favorite-button:hover .ast-icon-heart,
1079
+ .astra-sites-show-favorite-button.active .ast-icon-heart {
1080
+ color: #c34444;
1081
+ }
1082
+
1083
+ .ast-icon-heart {
1084
+ color: #666;
1085
+ }
1086
+ .header-actions a:focus {
1087
+ box-shadow: none;
1088
+ }
1089
+ #astra-sites-filters {
1090
+ flex: 1;
1091
+ }
1092
+
1093
+ #astra-sites-filters .wp-filter {
1094
+ margin-top: 0;
1095
+ justify-content: center;
1096
+ box-shadow: none;
1097
+ border: none;
1098
+ margin-bottom: 0;
1099
+ background: transparent;
1100
+ padding: 0;
1101
+ }
1102
+
1103
+ .is-favorite .favorite-action-wrap i {
1104
+ color : #c34444;
1105
+ }
1106
+
1107
+ .astra-sites-no-sites,
1108
+ .astra-sites-no-favorites {
1109
+ padding: 7em 0;
1110
+ }
1111
+
1112
+ .astra-sites-no-sites h3,
1113
+ .astra-sites-no-favorites h3 {
1114
+ font-size: 1.3rem;
1115
+ font-weight: normal;
1116
+ margin-top: 0;
1117
+ text-align: center;
1118
+ margin-bottom: 3em;
1119
+ color: #666;
1120
+ }
1121
+
1122
+ .astra-sites-no-sites .back-to-layout-button {
1123
+ margin-top: 25px;
1124
+ }
1125
+
1126
+ .back-to-layout-button {
1127
+ margin-top: 15px;
1128
+ }
1129
+
1130
+ .empty-collection-part {
1131
+ width: 220px;
1132
+ }
1133
+
1134
+ .astra-sites-no-sites .arrow-img,
1135
+ .astra-sites-no-favorites .arrow-img {
1136
+ width: 56px;
1137
+ margin-bottom: 1em;
1138
+ transform: rotate(18deg);
1139
+ }
1140
+
1141
+ .astra-sites-no-sites .content,
1142
+ .astra-sites-no-favorites .content {
1143
+ display: flex;
1144
+ align-items: center;
1145
+ }
1146
+
1147
+ .astra-sites-no-sites .description,
1148
+ .astra-sites-no-favorites .description {
1149
+ margin-right: 3em;
1150
+ }
1151
+
1152
+ .astra-sites-no-sites .inner,
1153
+ .astra-sites-no-favorites .inner {
1154
+ margin: 0 auto;
1155
+ width: 610px;
1156
+ }
1157
+
1158
+ /**
1159
+ * Welcome Screen
1160
+ */
1161
+ .astra-sites-welcome {
1162
+ position: relative;
1163
+ max-height: 100vh;
1164
+ height: calc( 100vh - 32px );
1165
+ }
1166
+ .appearance_page_starter-templates.astra-sites-change-page-builder #wpbody-content {
1167
+ padding: 0;
1168
+ }
1169
+ .astra-sites-welcome a {
1170
+ text-decoration: none;
1171
+ }
1172
+ .astra-sites-welcome a:focus,
1173
+ .astra-sites-welcome a {
1174
+ outline: none;
1175
+ box-shadow: none;
1176
+ }
1177
+ .astra-sites-welcome .header img {
1178
+ width: 30px;
1179
+ }
1180
+ .astra-sites-welcome .logo {
1181
+ display: flex;
1182
+ align-items: center;
1183
+ cursor: default;
1184
+ }
1185
+ .astra-sites-welcome .close {
1186
+ position: absolute;
1187
+ left: 0;
1188
+ top: 0;
1189
+ bottom: 0;
1190
+ width: 20px;
1191
+ text-align: center;
1192
+ padding: 15px;
1193
+ cursor: pointer;
1194
+ border-right: 1px solid #eee;
1195
+ color: #aaa;
1196
+ }
1197
+
1198
+ .astra-sites-welcome .close:hover {
1199
+ color: #0073aa;
1200
+ }
1201
+
1202
+ .astra-sites-welcome .close .dashicons {
1203
+ height: auto;
1204
+ width: auto;
1205
+ vertical-align: middle;
1206
+ font-size: 22px;
1207
+ }
1208
+
1209
+ .astra-sites-welcome .header {
1210
+ text-align: right;
1211
+ padding: 10px 15px;
1212
+ display: flex;
1213
+ align-items: center;
1214
+ border-bottom: 1px solid #e5e5e5;
1215
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
1216
+ justify-content: space-between;
1217
+ position: relative;
1218
+ }
1219
+ .astra-sites-welcome .header .title {
1220
+ margin: 0 10px 0 0;
1221
+ font-size: 13px;
1222
+ text-transform: uppercase;
1223
+ }
1224
+ .ast-importing-wrap {
1225
+ display: none;
1226
+ }
1227
+ .astra-sites-welcome .inner-wrap {
1228
+ position: absolute;
1229
+ right: 50%;
1230
+ top: 40%;
1231
+ transform: translate(50%, -40%);
1232
+ border-radius: 2px;
1233
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
1234
+ border: 1px solid #e5e5e5;
1235
+ overflow: hidden;
1236
+ }
1237
+ .astra-sites-welcome .inner {
1238
+ vertical-align: middle;
1239
+ margin: 0 auto;
1240
+ display: inline-block;
1241
+ width: 750px;
1242
+ background: #fff;
1243
+ text-align: center;
1244
+ }
1245
+
1246
+ .astra-sites-welcome h1 {
1247
+ margin-top: 0;
1248
+ font-size: 2em;
1249
+ margin-bottom: 1em;
1250
+ }
1251
+
1252
+ .astra-sites-welcome p {
1253
+ font-size: 14px;
1254
+ }
1255
+
1256
+ #astra-sites-welcome-form {
1257
+ padding: 6em 4em 2em 4em;
1258
+ }
1259
+
1260
+ .astra-sites-welcome select {
1261
+ padding: 5px;
1262
+ height: 100%;
1263
+ }
1264
+
1265
+ .astra-sites-welcome .submit {
1266
+ text-align: center;
1267
+ margin: 0;
1268
+ padding: 0;
1269
+ margin-right: .5em;
1270
+ }
1271
+
1272
+ .astra-sites-welcome .disabled {
1273
+ pointer-events: none;
1274
+ }
1275
+
1276
+ .astra-site-page-builder {
1277
+ opacity: 0;
1278
+ visibility: hidden;
1279
+ }
1280
+
1281
+ .required-plugins-list,
1282
+ .astra-sites-third-party-required-plugins {
1283
+ margin-right: 16px;
1284
+ margin-top: .5em;
1285
+ margin-bottom: .5em;
1286
+ list-style-type: disc;
1287
+ }
1288
+
1289
+ .astra-sites-tooltip-message {
1290
+ margin-right: 24px;
1291
+ }
1292
+
1293
+ .astra-sites-third-party-required-plugins .plugin-card,
1294
+ .required-plugins-list .plugin-card {
1295
+ background: transparent;
1296
+ border: none;
1297
+ margin: 0;
1298
+ line-height: 2;
1299
+ float: none;
1300
+ width: 100%;
1301
+ }
1302
+
1303
+ .required-plugins-list .spinner {
1304
+ float: none;
1305
+ margin: 0;
1306
+ }
1307
+
1308
+ .astra-site-import-process-wrap {
1309
+ display: flex;
1310
+ align-items: center;
1311
+ margin-top: -2px;
1312
+ z-index: 999999;
1313
+ position: relative;
1314
+ overflow: hidden;
1315
+ }
1316
+
1317
+ .astra-sites-result-preview .astra-site-import-process-wrap progress {
1318
+ background: #eeeeee;
1319
+ }
1320
+
1321
+ .astra-sites-result-preview .astra-site-import-process-wrap progress::-webkit-progress-value {
1322
+ background: #0185ba;
1323
+ }
1324
+
1325
+ .astra-site-import-process-wrap progress {
1326
+ padding: 0px;
1327
+ border: 0 none;
1328
+ background: #0085bd;
1329
+ border-radius: 5px;
1330
+ height: 4px;
1331
+ flex: 1;
1332
+ }
1333
+
1334
+ .astra-sites-result-preview .dashicons {
1335
+ font-size: 1rem;
1336
+ height: auto;
1337
+ vertical-align: middle;
1338
+ }
1339
+
1340
+ .astra-site-import-process-wrap progress::-webkit-progress-value {
1341
+ background: #00679b;
1342
+ }
1343
+
1344
+ .astra-site-import-process-wrap progress::-webkit-progress-bar {
1345
+ background: transparent;
1346
+ }
1347
+
1348
+ .theme-browser .theme .theme-screenshot {
1349
+ filter: blur(0);
1350
+ transition: filter 400ms linear;
1351
+ }
1352
+ .theme-browser .theme .site-preview > .theme-screenshot {
1353
+ background-position: center top;
1354
+ background-size: 100%;
1355
+ background-repeat: no-repeat;
1356
+ border-top-right-radius: 2px;
1357
+ border-top-left-radius: 2px;
1358
+ overflow: hidden;
1359
+ background-color: #e5e5e5;
1360
+ }
1361
+
1362
+ .astra-sites-tooltip-icon {
1363
+ cursor: pointer;
1364
+ }
1365
+
1366
+ .astra-sites-preview .disabled {
1367
+ pointer-events: none;
1368
+ }
1369
+
1370
+ .astra-sites-preview input[type="checkbox"].disabled {
1371
+ background: #eeeeee;
1372
+ opacity: 1;
1373
+ color: #fff;
1374
+ box-shadow: none;
1375
+ border-color: #b4b9be;
1376
+ }
1377
+
1378
+ .astra-sites-tooltip-icon .dashicons {
1379
+ color: #757575;
1380
+ font-size: 15px;
1381
+ vertical-align: middle;
1382
+ height: auto;
1383
+ }
1384
+ #astra-sites-admin {
1385
+ margin-left: 25px;
1386
+ margin-right: 25px;
1387
+ margin-top: 45px;
1388
+ }
1389
+ .astra-previewing-single-pages #wpfooter {
1390
+ display: none;
1391
+ }
1392
+
1393
+ .astra-previewing-single-pages #astra-sites-admin {
1394
+ margin-top: 58px;
1395
+ }
1396
+
1397
+ #astra-sites-welcome-form-inline select {
1398
+ text-align-last: left;
1399
+ }
1400
+
1401
+ #astra-sites-welcome-form-inline option {
1402
+ direction: ltr;
1403
+ }
1404
+ #astra-sites-admin .filter-links li > a:first-child {
1405
+ margin-right: 0;
1406
+ }
1407
+ #astra-sites-welcome-form-inline {
1408
+ margin-right: 0;
1409
+ border-radius: 3px;
1410
+ padding: 0px 5px 2px 5px;
1411
+ outline: 2px solid transparent;
1412
+ outline-offset: 0;
1413
+ background: #ffffff;
1414
+ color: #72777c;
1415
+ font-weight: normal;
1416
+ font-size: 13px;
1417
+ line-height: 26px;
1418
+ height: 28px;
1419
+ cursor: pointer;
1420
+ }
1421
+
1422
+ #astra-sites-welcome-form-inline select,
1423
+ #astra-sites-welcome-form-inline select:focus {
1424
+ border: none;
1425
+ outline: none;
1426
+ box-shadow: none;
1427
+ color: #72777c;
1428
+ }
1429
+
1430
+ #astra-sites-menu-page .wp-full-overlay-main:before {
1431
+ content: '';
1432
+ display: none;
1433
+ }
1434
+
1435
+ .theme-screenshot-wrap {
1436
+ overflow: hidden;
1437
+ max-height: 300px;
1438
+ margin: 15px 0;
1439
+ border: 1px solid #ccc;
1440
+ }
1441
+
1442
+ .astra-sites-preview .install-theme-info .theme-screenshot {
1443
+ width: 100%;
1444
+ border: none;
1445
+ margin: 0;
1446
+ }
1447
+
1448
+ #astra-sites-welcome-form .title {
1449
+ font-size: 14px;
1450
+ font-weight: 500;
1451
+ margin-top: 5px;
1452
+ }
1453
+
1454
+ #astra-sites-welcome-form #submit {
1455
+ padding: 0em 4rem;
1456
+ }
1457
+
1458
+ .page-builders {
1459
+ margin: 35px 0;
1460
+ }
1461
+
1462
+ .page-builders li {
1463
+ cursor: pointer;
1464
+ display: inline-block;
1465
+ padding: 1.2em;
1466
+ }
1467
+
1468
+ .page-builders [type=radio] {
1469
+ position: absolute;
1470
+ opacity: 0;
1471
+ width: 0;
1472
+ height: 0;
1473
+ }
1474
+
1475
+ .page-builders [type=radio] + img.active,
1476
+ .page-builders [type=radio] + img:hover {
1477
+ transform: translateY(-1px);
1478
+ box-shadow: 0 2px 6px rgba(0, 115, 170, 0.18);
1479
+ border-color: #0073aa;
1480
+ }
1481
+
1482
+ .page-builders [type=radio] + img {
1483
+ cursor: pointer;
1484
+ border: 1px solid #dcdcdc;
1485
+ border-radius: 4px;
1486
+ transition: all linear 0.2s;
1487
+ height: 100px;
1488
+ padding: 6px;
1489
+ }
1490
+
1491
+ .astra-demo-import.button.updating-message:before,
1492
+ .astra-demo-import.button.installing:before {
1493
+ vertical-align: text-top;
1494
+ margin: 0 0 0 5px;
1495
+ }
1496
+
1497
+ .current-importing-status-wrap hr {
1498
+ border-color: #f1f1f1;
1499
+ }
1500
+
1501
+ .astra-sites-result-preview {
1502
+ position: absolute;
1503
+ right: 0;
1504
+ left: 0;
1505
+ top: 0;
1506
+ bottom: 0;
1507
+ background: transparent;
1508
+ overflow-y: auto;
1509
+ }
1510
+
1511
+ .astra-sites-result-preview .button {
1512
+ margin-top: 1em;
1513
+ }
1514
+
1515
+ .preview-page-from-search-result #astra-sites-tooltip-plugins-settings,
1516
+ .astra-sites-page-import-popup #astra-sites-tooltip-plugins-settings {
1517
+ display: block !important;
1518
+ }
1519
+
1520
+ .astra-sites-result-preview h3 {
1521
+ font-size: 1.3em;
1522
+ margin: 0;
1523
+ }
1524
+ .astra-sites-result-preview .heading {
1525
+ background: #ffffff;
1526
+ padding: 16px 35px;
1527
+ margin-top: 0;
1528
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
1529
+ margin-bottom: 10px;
1530
+ display: flex;
1531
+ justify-content: space-between;
1532
+ }
1533
+ .astra-sites-result-preview .close {
1534
+ position: absolute;
1535
+ left: 0;
1536
+ top: 0;
1537
+ bottom: 0;
1538
+ height: 53px;
1539
+ line-height: 53px;
1540
+ width: 53px;
1541
+ cursor: pointer;
1542
+ border-right: 1px solid #eee;
1543
+ color: #aaa;
1544
+ font-size: 22px;
1545
+ opacity: 1;
1546
+ visibility: visible;
1547
+ }
1548
+ .astra-sites-result-preview .close:hover {
1549
+ color: #0073aa;
1550
+ }
1551
+ .astra-sites-result-preview .overlay {
1552
+ background: rgba(0, 0, 0, 0.7);
1553
+ filter: alpha(opacity=70);
1554
+ position: fixed;
1555
+ top: 0;
1556
+ left: 0;
1557
+ bottom: 0;
1558
+ right: 0;
1559
+ z-index: 100050;
1560
+ }
1561
+ .astra-sites-result-preview .inner {
1562
+ margin: 0 auto;
1563
+ width: 660px;
1564
+ max-height: 420px;
1565
+ -webkit-transform: translate(50%, -50%);
1566
+ -ms-transform: translate(50%, -50%);
1567
+ transform: translate(50%, -50%);
1568
+ -webkit-box-sizing: border-box;
1569
+ -moz-box-sizing: border-box;
1570
+ box-sizing: border-box;
1571
+ position: fixed;
1572
+ background-color: #f1f3f5;
1573
+ z-index: 100059;
1574
+ text-align: right;
1575
+ top: 50%;
1576
+ right: 50%;
1577
+ -webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
1578
+ box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
1579
+ border-radius: 2px;
1580
+ }
1581
+ .astra-sites-result-preview .button {
1582
+ line-height: 40px;
1583
+ }
1584
+
1585
+ #single-pages .astra-theme {
1586
+ padding: 0;
1587
+ }
1588
+
1589
+ .astra-sites-import-content > p:first-child,
1590
+ .ast-importing-wrap > p:first-child {
1591
+ margin-top: 0;
1592
+ }
1593
+
1594
+ .current-importing-status {
1595
+ background: #fff;
1596
+ padding: 1.3em;
1597
+ }
1598
+
1599
+ .current-importing-status ul {
1600
+ list-style-type: disc;
1601
+ margin: 1em 2em 0em 0em;
1602
+ }
1603
+
1604
+ .appearance_page_starter-templates .rotating {
1605
+ height: auto;
1606
+ animation: rotation 2s infinite linear;
1607
+ width: auto;
1608
+ color: #c1c1c1;
1609
+ }
1610
+
1611
+ .agency-ribbons {
1612
+ color: #000;
1613
+ text-align: center;
1614
+ display: flex;
1615
+ align-items: center;
1616
+ position: absolute;
1617
+ z-index: 9;
1618
+ top: -7px;
1619
+ text-transform: uppercase;
1620
+ font-weight: 600;
1621
+ font-size: 9.5px;
1622
+ letter-spacing: 0.2px;
1623
+ left: -7px;
1624
+ border-radius: 2px;
1625
+ line-height: 15px;
1626
+ padding: 4px 7px;
1627
+ background-color: #FCAF2A;
1628
+ cursor: default;
1629
+
1630
+ }
1631
+
1632
+ .premium-crown-icon {
1633
+ height: auto;
1634
+ width: 17px;
1635
+ margin-left: 5px;
1636
+ }
1637
+
1638
+ .theme-browser .theme:hover .theme-actions,
1639
+ .theme-browser .theme.focus .theme-actions,
1640
+ .theme-browser .theme:focus .theme-actions {
1641
+ opacity: 0;
1642
+ }
1643
+
1644
+ .theme-browser .theme .theme-screenshot:after {
1645
+ padding-top: 118%;
1646
+ }
1647
+
1648
+ @-webkit-keyframes rotation {
1649
+ from {
1650
+ -webkit-transform: rotate(0deg);
1651
+ }
1652
+ to {
1653
+ -webkit-transform: rotate(-359deg);
1654
+ }
1655
+ }
1656
+ .import-time {
1657
+ display: inline-block;
1658
+ background: #0185ba;
1659
+ color: #fff;
1660
+ padding: 2px 10px;
1661
+ border-radius: 3px;
1662
+ animation: astra-scale 0.5s alternate infinite ease-in;
1663
+ }
1664
+
1665
+ .theme-browser .theme:hover .theme-actions,
1666
+ .theme-browser .theme.focus .theme-actions,
1667
+ .theme-browser .theme:focus .theme-actions {
1668
+ opacity: 0;
1669
+ }
1670
+ @keyframes astra-scale {
1671
+ 0% {transform: scale(1);}
1672
+ 100% {transform: scale(1.03);}
1673
+ }
1674
+
1675
+ .current-importing-status p {
1676
+ margin: 0;
1677
+ }
1678
+
1679
+ @media (min-width: 960px) and (max-width: 1020px) {
1680
+ #astra-sites-admin .theme-action-wrap {
1681
+ padding: 5px;
1682
+ width: 100%;
1683
+ }
1684
+ }
1685
+
1686
+ @media (min-width: 781px) and (max-width: 920px) {
1687
+ #astra-sites-admin .theme-action-wrap {
1688
+ padding: 5px;
1689
+ width: 100%;
1690
+ }
1691
+ .theme-browser .theme .theme-actions button:first-child {
1692
+ margin-bottom: 5px;
1693
+ }
1694
+ }
1695
+
1696
+ .theme-browser .theme .site-preview > .theme-screenshot.two:hover,
1697
+ .theme-browser .theme .site-preview > .theme-screenshot.three:hover {
1698
+ background-position: center top;
1699
+ }
1700
+
1701
+ .theme-browser .theme .theme-screenshot.two,
1702
+ .theme-browser .theme .theme-screenshot.three {
1703
+ position: absolute;
1704
+ top: 0;
1705
+ left: 0;
1706
+ right: 0px;
1707
+ }
1708
+
1709
+ .theme-browser .theme .theme-screenshot.two {
1710
+ width: calc(100% - 10px);
1711
+ opacity: .8;
1712
+ right: 0px;
1713
+ transform: translate(-5px, -5px);
1714
+ }
1715
+
1716
+ .theme-browser .theme .theme-screenshot.three {
1717
+ width: calc(100% - 20px);
1718
+ opacity: .4;
1719
+ transform: translate(-10px, -10px);
1720
+ }
1721
+
1722
+ .theme-browser .theme {
1723
+ box-shadow: 0 1px 7px 0 rgba(0, 0, 0, 0.08);
1724
+ margin: 0 0 3.6% 3%;
1725
+ border: none;
1726
+ }
1727
+
1728
+ .single-site {
1729
+ display: flex;
1730
+ }
1731
+
1732
+ .single-site-pages {
1733
+ overflow-y: auto;
1734
+ height: 100vh;
1735
+ max-height: calc(100vh - 280px);
1736
+ }
1737
+
1738
+ .single-site-pages::-webkit-scrollbar {
1739
+ width: 5px;
1740
+ background-color: #f1f1f1;
1741
+ }
1742
+
1743
+ .single-site-pages::-webkit-scrollbar-thumb {
1744
+ border-radius: 0;
1745
+ background-color: #d8d8d8;
1746
+ }
1747
+
1748
+ .single-site-pages::-webkit-scrollbar-track {
1749
+ -webkit-box-shadow: inset 0 0 0 rgba(0,0,0,.3);
1750
+ width: 20px;
1751
+ }
1752
+
1753
+
1754
+ .astra-sites-import-content::-webkit-scrollbar,
1755
+ .single-site-preview::-webkit-scrollbar {
1756
+ width: 5px;
1757
+ background-color: #f1f1f1;
1758
+ }
1759
+
1760
+ .astra-sites-import-content::-webkit-scrollbar-thumb,
1761
+ .single-site-preview::-webkit-scrollbar-thumb {
1762
+ border-radius: 0;
1763
+ background-color: #d8d8d8;
1764
+ }
1765
+
1766
+ .astra-sites-import-content::-webkit-scrollbar-track,
1767
+ .single-site-preview::-webkit-scrollbar-track {
1768
+ -webkit-box-shadow: inset 0 0 0 rgba(0,0,0,.3);
1769
+ width: 20px;
1770
+ }
1771
+
1772
+ .single-site-preview {
1773
+ margin-left: 4em;
1774
+ max-height: calc(100vh - 280px);
1775
+ height: 100vh;
1776
+ overflow-y: auto;
1777
+ border-radius: 2px;
1778
+ box-shadow: 0 0 16px 0 rgba(0, 0, 0, 0.12);
1779
+ }
1780
+
1781
+ .single-site-preview img {
1782
+ width: 100%;
1783
+ vertical-align: middle;
1784
+ }
1785
+
1786
+ #astra-sites-menu-page .nav-tab-wrapper.stick {
1787
+ position: fixed;
1788
+ right: 0;
1789
+ left: 0;
1790
+ }
1791
+
1792
+ .single-site-footer {
1793
+ position: fixed;
1794
+ padding: 15px 35px 15px 50px;
1795
+ bottom: 0;
1796
+ background: #fff;
1797
+ left: 0;
1798
+ right: 0;
1799
+ z-index: 88;
1800
+ box-shadow: 0 -2px 8px rgb(0 0 0 / 5%);
1801
+ }
1802
+
1803
+ .site-action-buttons-wrap {
1804
+ display: flex;
1805
+ justify-content: center;
1806
+ }
1807
+
1808
+ .site-action-buttons-wrap .site-preview-button {
1809
+ margin-left: 5px;
1810
+ }
1811
+
1812
+ .single-site-pages-header {
1813
+ display: flex;
1814
+ justify-content: space-between;
1815
+ align-items: center;
1816
+ margin: 0 0 32px 0;
1817
+ }
1818
+
1819
+ .astra-site-title {
1820
+ margin: 0;
1821
+ }
1822
+
1823
+ .astra-pages-title-wrap {
1824
+ margin: 0 0 30px 0;
1825
+ display: flex;
1826
+ justify-content: space-between;
1827
+ }
1828
+
1829
+ .single-site-preview-wrap {
1830
+ width: 55%;
1831
+ }
1832
+
1833
+ .single-site-pages-wrap {
1834
+ width: 45%;
1835
+ }
1836
+
1837
+ @media only screen and (min-width: 768px) {
1838
+ #site-pages {
1839
+ padding: 0 24px 0 0;
1840
+ }
1841
+ }
1842
+
1843
+ /**
1844
+ * 3 Grid for Pages
1845
+ */
1846
+ @media only screen and (min-width: 1640px) {
1847
+ .theme-browser #site-pages .theme {
1848
+ width: 31.06%;
1849
+ margin: 0 0 3% 3%;
1850
+ }
1851
+ }
1852
+
1853
+ @media only screen and (min-width: 1640px) {
1854
+ .theme-browser #site-pages .theme:nth-child(3n) {
1855
+ margin-left: 0;
1856
+ }
1857
+ }
1858
+ #single-pages .astra-theme {
1859
+ border: none;
1860
+ }
1861
+
1862
+ #single-pages .current_page .inner {
1863
+ border-color: #5b9dd9;
1864
+ border-radius: 2px;
1865
+ }
1866
+ .theme-browser #site-pages .theme {
1867
+ margin: 0 0 3.4% 3.4%;
1868
+ border-radius: 2px;
1869
+ border: none;
1870
+ box-shadow: none;
1871
+ }
1872
+ .theme-browser #single-pages .site-single .theme-screenshot:after {
1873
+ padding-top: 100%;
1874
+ }
1875
+
1876
+ .site-action-buttons-wrap .dashicons {
1877
+ vertical-align: middle;
1878
+ font-size: 1rem;
1879
+ margin-right: .2em;
1880
+ }
1881
+
1882
+ .single-site-footer .dashicons-editor-help {
1883
+ font-size: 20px;
1884
+ color: #555d66;
1885
+ margin-right: 10px;
1886
+ }
1887
+ .site-action-buttons-right {
1888
+ display: flex;
1889
+ align-items: center;
1890
+ }
1891
+ .astra-sites-result-preview.astra-sites-import-complete .inner {
1892
+ overflow: hidden;
1893
+ height: auto;
1894
+ }
1895
+
1896
+ .site-action-buttons-wrap .button.button-primary.button-hero {
1897
+ box-shadow: none;
1898
+ }
1899
+ .wp-core-ui .astra-sites-result-preview .button.button-hero,
1900
+ .wp-core-ui .astra-sites-result-preview .button.button-hero:focus,
1901
+ .site-action-buttons-wrap .button.button-hero,
1902
+ .site-action-buttons-wrap .button.button-hero:focus {
1903
+ font-size: 13px;
1904
+ height: 34px;
1905
+ min-height: 34px;
1906
+ line-height: 33px;
1907
+ padding: 0 20px;
1908
+ box-shadow: none;
1909
+ }
1910
+
1911
+ .astra-hide-site {
1912
+ display: none;
1913
+ }
1914
+
1915
+ .astra-sites-no-sites .button.astra-sites-back,
1916
+ .astra-sites-no-favorites .button.astra-sites-back {
1917
+ box-shadow: none;
1918
+ height: 30px;
1919
+ }
1920
+
1921
+ .astra-sites-no-sites h3 {
1922
+ font-size: 1.3rem;
1923
+ font-weight: normal;
1924
+ color: #666;
1925
+ margin-top: 0;
1926
+ }
1927
+
1928
+ .astra-sites-import-plugins .disabled {
1929
+ pointer-events: none;
1930
+ }
1931
+ .theme-browser .theme .site-preview > .theme-screenshot.loading,
1932
+ .theme-browser .theme .theme-screenshot.loading {
1933
+ animation-duration: 2s;
1934
+ animation-fill-mode: forwards;
1935
+ animation-iteration-count: infinite;
1936
+ animation-name: image-placeholder;
1937
+ animation-timing-function: linear;
1938
+ background: #f6f7f8;
1939
+ background: linear-gradient(to left, #fafafa 8%, #f4f4f4 38%, #fafafa 54%);
1940
+ position: relative;
1941
+ }
1942
+ @keyframes image-placeholder{
1943
+ 0%{
1944
+ background-position: -150px 0;
1945
+ }
1946
+ 100%{
1947
+ background-position: 150px 0;
1948
+ }
1949
+ }
1950
+ .searching .theme-browser .theme .theme-screenshot.loading {
1951
+ opacity: .5;
1952
+ }
1953
+ .searching .theme-browser .theme .theme-screenshot {
1954
+ filter: blur(0);
1955
+ }
1956
+ .inner {
1957
+ overflow: hidden;
1958
+ }
1959
+ .site-import-layout-button.disabled {
1960
+ pointer-events: none;
1961
+ }
1962
+
1963
+ .theme-browser .themes {
1964
+ clear: both;
1965
+ margin: -1%;
1966
+ }
1967
+
1968
+
1969
+ @media only screen and (min-width: 768px) {
1970
+ .theme-browser .theme {
1971
+ width: 25%;
1972
+ padding: 1.1%;
1973
+ margin: 0 0em 1em 0;
1974
+ box-shadow: none;
1975
+ }
1976
+ }
1977
+
1978
+ @media only screen and (min-width: 1640px) {
1979
+ .theme-browser .theme:nth-child(3n) {
1980
+ margin-left: 0;
1981
+ }
1982
+ .theme-browser .theme:nth-child(4n) {
1983
+ margin-left: 0;
1984
+ }
1985
+ }
1986
+
1987
+ #astra-sites-filters .search-form {
1988
+ position: relative;
1989
+ }
1990
+
1991
+ .filters-wrap-page-categories {
1992
+ position: absolute;
1993
+ background: #fff;
1994
+ padding: 10px;
1995
+ z-index: 999;
1996
+ border: 1px solid #ccc;
1997
+ border-top: none;
1998
+ left: 0;
1999
+ right: 0;
2000
+ margin: 0;
2001
+ visibility: hidden;
2002
+ opacity: 0;
2003
+ }
2004
+
2005
+ .filters-wrap-page-categories.show {
2006
+ visibility: visible;
2007
+ opacity: 1;
2008
+ }
2009
+
2010
+ .filters-wrap-page-categories .filter-links li {
2011
+ display: list-item;
2012
+ }
2013
+
2014
+ #astra-sites-admin .filter-links .current {
2015
+ border: none;
2016
+ }
2017
+
2018
+ .filters-wrap-page-categories .filter-links {
2019
+ display: block;
2020
+ }
2021
+
2022
+ .filters-wrap-page-categories .filter-links li > a {
2023
+ display: block;
2024
+ margin: 0 5px 5px 0;
2025
+ }
2026
+
2027
+ .page-builder-icon .page-builders {
2028
+ position: absolute;
2029
+ top: 100%;
2030
+ background: #fff;
2031
+ z-index: 10;
2032
+ margin: 0;
2033
+ border: 1px solid #ddd;
2034
+ opacity: 0;
2035
+ visibility: hidden;
2036
+ box-shadow: 0px 9px 21px 0px rgba(0, 0, 0, 0.2);
2037
+ border-bottom-right-radius: 3px;
2038
+ border-bottom-left-radius: 3px;
2039
+ right: -1px;
2040
+ left: 0px;
2041
+ }
2042
+ .page-builder-icon.active .page-builders {
2043
+ opacity: 1;
2044
+ visibility: visible;
2045
+ }
2046
+ .page-builder-icon .page-builders img {
2047
+ height: 17px;
2048
+ width: 17px;
2049
+ border-radius: 50%;
2050
+ margin-left: 10px;
2051
+ }
2052
+
2053
+ .page-builder-icon .page-builders li {
2054
+ display: flex;
2055
+ padding: 10px 15px;
2056
+ margin: 0;
2057
+ }
2058
+
2059
+ .page-builder-icon {
2060
+ display: inline-block;
2061
+ font-size: 12px;
2062
+ padding: 23px 10px;
2063
+ width: 164px;
2064
+ position: relative;
2065
+ cursor: pointer;
2066
+ }
2067
+
2068
+ .page-builder-icon img {
2069
+ height: auto;
2070
+ width: 22px;
2071
+ border-radius: 50%;
2072
+ margin-left: 8px;
2073
+ }
2074
+
2075
+ .selected-page-builder {
2076
+ display: flex;
2077
+ justify-content: center;
2078
+ align-items: center;
2079
+ }
2080
+
2081
+ .selected-page-builder .dashicons {
2082
+ margin-right: 2px;
2083
+ }
2084
+
2085
+ .page-builder-icon .page-builders .active,
2086
+ .page-builder-icon .page-builders li:hover {
2087
+ background-color: #f7f7f7;
2088
+ }
2089
+
2090
+ .appearance_page_starter-templates .astra-sites-sync-library-message {
2091
+ margin-right: 25px;
2092
+ margin-left: 25px;
2093
+ }
2094
+
2095
+ .astra-sites-sync-library-message.notice .notice-dismiss:before {
2096
+ font-size: 14px;
2097
+ }
2098
+
2099
+ .astra-loading-wrap {
2100
+ position: absolute;
2101
+ right: 50%;
2102
+ top: 50%;
2103
+ transform: translate(60%, -60%);
2104
+ }
2105
+
2106
+ .ast-retry-text {
2107
+ position: absolute;
2108
+ right: 50%;
2109
+ top: 60%;
2110
+ transform: translate(50%, -50%);
2111
+ }
2112
+
2113
+ .astra-previewing-single-pages #wpbody-content {
2114
+ position: fixed;
2115
+ }
2116
+
2117
+ .appearance_page_starter-templates div#setting-error-tgmpa,
2118
+ .appearance_page_starter-templates .update-nag,
2119
+ .appearance_page_starter-templates .notice,
2120
+ .appearance_page_starter-templates div.error {
2121
+ display: none;
2122
+ }
2123
+
2124
+ .appearance_page_starter-templates .astra-sites-notice {
2125
+ display: block;
2126
+ top: 20px;
2127
+ position: relative;
2128
+ }
2129
+
2130
+ .astra-previewing-single-pages .astra-sites-menu-page-wrapper > .notice.astra-sites-sync-library-message.success,
2131
+ .astra-previewing-single-pages .astra-sites-menu-page-wrapper > .notice.astra-sites-sync-library-message.notice-success {
2132
+ display: none !important;
2133
+ }
2134
+
2135
+ .astra-previewing-single-pages .astra-sites-menu-page-wrapper > .notice.astra-sites-sync-library-message {
2136
+
2137
+ width: calc( 100% - 250px );
2138
+ }
2139
+
2140
+ .astra-previewing-single-pages.folded #wpbody-content > .notice.astra-sites-sync-library-message {
2141
+ width: calc( 100% - 150px );
2142
+ }
2143
+
2144
+ .appearance_page_starter-templates.astra-previewing-single-pages #wpbody-content {
2145
+ padding-top: 0;
2146
+ }
2147
+
2148
+ .astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-message,
2149
+ .astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-start-message {
2150
+ display: inline-block !important;
2151
+ top: 90px;
2152
+ left: 0;
2153
+ width: calc( 100% - 260px ) !important;
2154
+ }
2155
+
2156
+ .folded.astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-message,
2157
+ .folded.astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-start-message {
2158
+ width: calc( 100% - 140px ) !important;
2159
+ }
2160
+
2161
+ .appearance_page_starter-templates #wpcontent {
2162
+ padding-right: 0;
2163
+ }
2164
+
2165
+ .appearance_page_starter-templates.auto-fold #wpcontent {
2166
+ padding-right: 0;
2167
+ }
2168
+
2169
+ .pages-count,
2170
+ .page-title {
2171
+ font-weight: 300;
2172
+ font-size: 13px;
2173
+ display: none;
2174
+ }
2175
+
2176
+ .site-pages-not-import-notice {
2177
+ clear: both;
2178
+ }
2179
+
2180
+ .astra-loading-icon,
2181
+ .astra-loading-icon:after {
2182
+ border-radius: 50%;
2183
+ width: 20px;
2184
+ height: 20px;
2185
+ }
2186
+ .astra-loading-icon {
2187
+ border-top: 3px solid rgb(192, 192, 192);
2188
+ border-left: 3px solid rgb(192, 192, 192);
2189
+ border-bottom: 3px solid rgb(192, 192, 192);
2190
+ border-right: 3px solid #0185ba;
2191
+ -webkit-transform: translateZ(0);
2192
+ -ms-transform: translateZ(0);
2193
+ transform: translateZ(0);
2194
+ -webkit-animation: load8 1.1s infinite linear;
2195
+ animation: load8 1.1s infinite linear;
2196
+ }
2197
+ @-webkit-keyframes load8 {
2198
+ 0% {
2199
+ -webkit-transform: rotate(0deg);
2200
+ transform: rotate(0deg);
2201
+ }
2202
+ 100% {
2203
+ -webkit-transform: rotate(-360deg);
2204
+ transform: rotate(-360deg);
2205
+ }
2206
+ }
2207
+ @keyframes load8 {
2208
+ 0% {
2209
+ -webkit-transform: rotate(0deg);
2210
+ transform: rotate(0deg);
2211
+ }
2212
+ 100% {
2213
+ -webkit-transform: rotate(-360deg);
2214
+ transform: rotate(-360deg);
2215
+ }
2216
+ }
2217
+
2218
+ .preparing .install-theme-info {
2219
+ display: none !important;
2220
+ }
2221
+
2222
+ #astra-sites.temp .placeholder-site .theme-id-container .title {
2223
+ background: #f1f1f1;
2224
+ }
2225
+
2226
+ #astra-sites.temp .placeholder-site .theme-id-container .site-title {
2227
+ color: transparent;
2228
+ }
2229
+
2230
+ .ast-sites__filter-wrap-checkbox input[type="radio"].active:before {
2231
+ content: "";
2232
+ border-radius: 50%;
2233
+ width: 0.5rem;
2234
+ height: 0.5rem;
2235
+ margin: 0.1875rem;
2236
+ background-color: #1e8cbe;
2237
+ line-height: 1.14285714;
2238
+ float: right;
2239
+ display: inline-block;
2240
+ vertical-align: middle;
2241
+ speak: none;
2242
+ -webkit-font-smoothing: antialiased;
2243
+ -moz-osx-font-smoothing: grayscale;
2244
+ }
2245
+
2246
+ @media screen and (min-width: 783px and max-width: 1180px) {
2247
+
2248
+ #astra-sites-filters .search-form {
2249
+ width: 100%;
2250
+ }
2251
+ #astra-sites .theme {
2252
+ width: 50%;
2253
+ }
2254
+
2255
+ #astra-sites .theme:nth-child(odd) {
2256
+ margin: 0;
2257
+ }
2258
+ .theme-browser #site-pages .theme {
2259
+ width: 46%;
2260
+ }
2261
+ }
2262
+ @media screen and (max-width: 782px) {
2263
+ .ast-sites__filter-wrap-checkbox input[type="radio"] {
2264
+ height: 1rem;
2265
+ width: 1rem;
2266
+ }
2267
+ .ast-sites__filter-wrap-checkbox input[type="radio"]:checked:before {
2268
+ margin: .25rem;
2269
+ height: 0.4rem;
2270
+ width: 0.4rem;
2271
+ }
2272
+
2273
+ .page-builder-title {
2274
+ display: none;
2275
+ }
2276
+
2277
+ .page-builder-icon {
2278
+ width: 100px;
2279
+ }
2280
+
2281
+ .page-builder-icon .page-builders {
2282
+ width: 140px;
2283
+ margin-right: -20px;
2284
+ }
2285
+ .single-site-footer {
2286
+ margin-right: 0;
2287
+ }
2288
+ }
2289
+ @media only screen and (max-width: 768px) {
2290
+ .astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-message,
2291
+ .astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-start-message {
2292
+ top: 0;
2293
+ width: auto !important;
2294
+ }
2295
+ }
2296
+ @media only screen and (max-width: 767px) {
2297
+ .appearance_page_starter-templates #wpbody-content {
2298
+ padding-top: 0;
2299
+ }
2300
+
2301
+ #astra-sites-menu-page .nav-tab-wrapper .logo {
2302
+ padding: 10px;
2303
+ }
2304
+
2305
+ .back-to-layout {
2306
+ padding: 20px 5px;
2307
+ }
2308
+
2309
+ }
2310
+ @media only screen and (max-width: 1120px) {
2311
+ .theme-browser .theme:nth-child(odd) {
2312
+ margin-left: 0;
2313
+ }
2314
+ }
2315
+ @media only screen and (min-width: 780px) and (max-width: 1200px) {
2316
+ .theme-browser .theme:nth-child(odd) {
2317
+ margin-left: 0;
2318
+ }
2319
+ .theme-browser .theme {
2320
+ width: 33.33%;
2321
+ }
2322
+ }
2323
+
2324
+ @media only screen and (min-width: 1200px) {
2325
+ #astra-sites-filters .search-form {
2326
+ width: 600px;
2327
+ margin: 0 auto;
2328
+ }
2329
+ }
2330
+ @media only screen and (min-width: 1000px) and (max-width: 1200px) {
2331
+ .theme-browser #site-pages .theme:nth-child(3n) {
2332
+ margin-left: 0;
2333
+ }
2334
+
2335
+ .theme-browser #site-pages .theme {
2336
+ width: 30.33%;
2337
+ }
2338
+ }
2339
+
2340
+ @media only screen and (min-width: 780px) and (max-width: 999px) {
2341
+ .theme-browser #site-pages .theme:nth-child(2n) {
2342
+ margin-left: 0;
2343
+ }
2344
+
2345
+ .theme-browser #site-pages .theme {
2346
+ width: 48%;
2347
+ }
2348
+ }
2349
+
2350
+ @media only screen and (max-width: 960px) {
2351
+ #site-pages {
2352
+ position: relative;
2353
+ margin: 0 0 0 70px;
2354
+ }
2355
+ }
2356
+ @media only screen and (max-width: 1200px) {
2357
+ .back-to-layout {
2358
+ margin-left: 20px;
2359
+ }
2360
+ }
2361
+ @media screen and (max-width: 600px) {
2362
+ #astra-sites-filters .search-form {
2363
+ width: auto;
2364
+ }
2365
+ }
2366
+ @media screen and (max-width: 782px) {
2367
+ #site-pages {
2368
+ margin: 0;
2369
+ }
2370
+ .theme-browser #site-pages .theme {
2371
+ width: 46%;
2372
+ }
2373
+ .single-site-footer {
2374
+ padding: 10px 20px;
2375
+ }
2376
+ .single-site {
2377
+ flex-direction: column;
2378
+ }
2379
+
2380
+ .single-site-preview-wrap {
2381
+ width: 100%;
2382
+ }
2383
+
2384
+ .single-site-preview {
2385
+ margin: 0;
2386
+ height: 40vh;
2387
+ }
2388
+
2389
+ .single-site-pages-wrap {
2390
+ width: 100%;
2391
+ margin-top: 3em;
2392
+ }
2393
+ }
2394
+
2395
+ .astra-sites__category-filter-items {
2396
+ z-index: 99;
2397
+ }
2398
+
2399
+ @media screen and (min-width: 481px) {
2400
+ .hide-on-desktop {
2401
+ display: none;
2402
+ }
2403
+ .astra-sites__category-filter-items {
2404
+ z-index: 99;
2405
+ }
2406
+ }
2407
+ @media screen and (max-width: 480px) {
2408
+ #astra-sites-admin .astra-sites-popup .inner,
2409
+ .astra-sites-result-preview .inner {
2410
+ width: 95%;
2411
+ }
2412
+ .single-site-footer .button {
2413
+ text-align: center;
2414
+ width: 100%;
2415
+ }
2416
+ .single-site-pages {
2417
+ overflow: initial;
2418
+ }
2419
+
2420
+ #astra-sites-filters.hide-on-desktop {
2421
+ box-shadow: -25px 0 30px rgba(28, 39, 60, 0.09);
2422
+ border-bottom: 1px solid #dddddd;
2423
+ background: #fff;
2424
+ padding: 10px;
2425
+ }
2426
+
2427
+ #astra-sites-menu-page .form {
2428
+ flex: 1;
2429
+ }
2430
+
2431
+ .favorite-filters-wrap {
2432
+ flex: 1;
2433
+ text-align: left;
2434
+ padding: 5px 10px;
2435
+ }
2436
+
2437
+ .back-to-layout {padding: 13px 10px;}
2438
+
2439
+ .page-builder-icon {
2440
+ padding: 18px 15px 18px 8px;
2441
+ }
2442
+
2443
+ #astra-sites-menu-page .nav-tab-wrapper .logo {
2444
+ padding: 14px 10px;
2445
+ }
2446
+
2447
+ #astra-sites__category-filter .astra-sites__category-filter-anchor {
2448
+ width: 90px;
2449
+ }
2450
+
2451
+ .header-actions li > a {
2452
+ margin: 0 7px;
2453
+ }
2454
+
2455
+ .astra-previewing-single-pages #wpbody-content {
2456
+ position: relative;
2457
+ }
2458
+
2459
+ .astra-sites-no-sites .content, .astra-sites-no-favorites .content {
2460
+ flex-direction: column;
2461
+ }
2462
+
2463
+ .astra-sites-no-sites .inner, .astra-sites-no-favorites .inner {
2464
+ width: auto;
2465
+ }
2466
+
2467
+ .site-action-buttons-right {
2468
+ flex-direction: column;
2469
+ align-items: flex-start;
2470
+ }
2471
+
2472
+ .site-import-layout-button {
2473
+ margin-right: 0 !important;
2474
+ }
2475
+
2476
+ .astra-sites-no-sites .content, .astra-sites-no-favorites .content {
2477
+ flex-direction: column;
2478
+ }
2479
+
2480
+ .astra-sites-no-sites .inner, .astra-sites-no-favorites .inner {
2481
+ width: auto;
2482
+ }
2483
+
2484
+ .hide-on-mobile {
2485
+ display: none;
2486
+ }
2487
+ .astra-sites-logo-wrap {
2488
+ width: 30px;
2489
+ height: 30px;
2490
+ }
2491
+
2492
+ .header-actions li > a {
2493
+ margin: 0 5px;
2494
+ }
2495
+
2496
+ .page-builder-icon {
2497
+ width: auto;
2498
+ }
2499
+
2500
+ .page-builder-icon .page-builders {
2501
+ margin-right: -95%;
2502
+ }
2503
+
2504
+ .theme-browser .theme:nth-child(odd) {
2505
+ margin-left: 0;
2506
+ }
2507
+
2508
+ #astra-sites-admin {
2509
+ margin-top: 30px;
2510
+ margin-right: 20px;
2511
+ margin-left: 20px;
2512
+ }
2513
+ .appearance_page_starter-templates.auto-fold #wpcontent {
2514
+ padding-right: 0;
2515
+ }
2516
+
2517
+ .back-to-layout {
2518
+ margin-left: 10px;
2519
+ }
2520
+
2521
+ .single-site-footer {
2522
+ position: relative;
2523
+ }
2524
+
2525
+ #wpbody-content {
2526
+ padding-bottom: 30px;
2527
+ }
2528
+
2529
+ .site-action-buttons-wrap {
2530
+ flex-direction: column;
2531
+ }
2532
+
2533
+ .site-action-buttons-wrap > .button:first-child {
2534
+ margin-bottom: 5px;
2535
+ }
2536
+
2537
+ .appearance_page_starter-templates .astra-sites-sync-library-message {
2538
+ margin: 10px;
2539
+ }
2540
+ }
2541
+
2542
+ #astra-sites-filters .section-left {
2543
+ flex: 1;
2544
+ }
2545
+
2546
+ #astra-sites-filters .search-form {
2547
+ float: none;
2548
+ }
2549
+
2550
+ /**
2551
+ * Popup
2552
+ */
2553
+
2554
+ .ast-actioms-wrap {
2555
+ padding: 13px 35px 13px 35px;
2556
+ z-index: 30;
2557
+ box-sizing: border-box;
2558
+ border-top: 1px solid #dcdcdc;
2559
+ }
2560
+ .wp-core-ui .ast-actioms-wrap .button,
2561
+ .wp-core-ui .ast-actioms-wrap .button:focus {
2562
+ font-size: 13px;
2563
+ height: 36px;
2564
+ min-height: 36px;
2565
+ line-height: 34px;
2566
+ padding: 0 20px;
2567
+ box-shadow: none;
2568
+ }
2569
+ .ast-actioms-wrap .button {
2570
+ margin: 0;
2571
+ }
2572
+ .ast-actioms-wrap .button {
2573
+ margin-left: .5em;
2574
+ }
2575
+ .astra-site-contents > li {
2576
+ margin-bottom: 12px;
2577
+ }
2578
+
2579
+ .astra-sites-popup {
2580
+ position: absolute;
2581
+ right: 0;
2582
+ left: 0;
2583
+ top: 0;
2584
+ bottom: 0;
2585
+ background: #fff;
2586
+ overflow-y: auto;
2587
+ }
2588
+
2589
+ .astra-sites-popup .dashicons {
2590
+ vertical-align: middle;
2591
+ font-size: 1rem;
2592
+ }
2593
+ .astra-sites-popup .button {
2594
+ margin-top: 1em;
2595
+ }
2596
+
2597
+ .astra-sites-popup h3 {
2598
+ font-size: 1.4em;
2599
+ margin: 0;
2600
+ }
2601
+ .astra-sites-popup .heading {
2602
+ background: #ffffff;
2603
+ padding: 16px 35px;
2604
+ margin-top: 0;
2605
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
2606
+ margin-bottom: 10px;
2607
+ display: flex;
2608
+ justify-content: space-between;
2609
+ }
2610
+ .astra-sites-popup .close {
2611
+ position: absolute;
2612
+ left: 0;
2613
+ top: 0;
2614
+ bottom: 0;
2615
+ height: 53px;
2616
+ line-height: 53px;
2617
+ width: 53px;
2618
+ cursor: pointer;
2619
+ border-right: 1px solid #eee;
2620
+ color: #aaa;
2621
+ font-size: 21px;
2622
+ }
2623
+ .astra-sites-popup .close:hover {
2624
+ color: #444;
2625
+ }
2626
+ .astra-sites-popup .overlay {
2627
+ background: rgba(0, 0, 0, 0.7);
2628
+ filter: alpha(opacity=70);
2629
+ position: fixed;
2630
+ top: 0;
2631
+ left: 0;
2632
+ bottom: 0;
2633
+ right: 0;
2634
+ z-index: 100050;
2635
+ }
2636
+ .astra-sites-popup .inner {
2637
+ margin: 0 auto;
2638
+ width: 660px;
2639
+ max-height: 420px;
2640
+ -webkit-transform: translate(50%, -50%);
2641
+ -ms-transform: translate(50%, -50%);
2642
+ transform: translate(50%, -50%);
2643
+ -webkit-box-sizing: border-box;
2644
+ -moz-box-sizing: border-box;
2645
+ box-sizing: border-box;
2646
+ position: fixed;
2647
+ background-color: #f3f3f3;
2648
+ z-index: 100059;
2649
+ text-align: right;
2650
+ top: 50%;
2651
+ right: 50%;
2652
+ -webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
2653
+ box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
2654
+ border-radius: 2px;
2655
+ }
2656
+ .astra-sites-popup .button {
2657
+ line-height: 40px;
2658
+ }
2659
+
2660
+ .ast-sites__search-title {
2661
+ padding: 0 1.1%;
2662
+ font-size: 18px;
2663
+ margin-bottom: 10px;
2664
+ }
2665
+
2666
+ .ast-sites__search-wrap {
2667
+ display:flex;
2668
+ flex-wrap: wrap;
2669
+ }
2670
+
2671
+ /**
2672
+ * License Form
2673
+ */
2674
+ #astra-pro-sites-license-form p:first-child {
2675
+ margin-top: 0;
2676
+ }
2677
+
2678
+ #astra-pro-sites-license-form p {
2679
+ margin: .3em 0;
2680
+ }
2681
+
2682
+ #astra-pro-sites-license-form .bsf-license-key-registration {
2683
+ margin-top: 1em;
2684
+ }
2685
+
2686
+ #astra-pro-sites-license-form .inner {
2687
+ position: relative;
2688
+ box-shadow: none;
2689
+ height: auto;
2690
+ width: auto;
2691
+ min-height: auto;
2692
+ transition: none;
2693
+ top: 0;
2694
+ right: 0;
2695
+ transform: none;
2696
+ }
2697
+
2698
+ #astra-pro-sites-license-form h3 {
2699
+ display: none;
2700
+ }
2701
+
2702
+ #astra-pro-sites-license-form .astra-product-license {
2703
+ line-height: normal;
2704
+ margin-top: 0;
2705
+ margin-right: 0.5em;
2706
+ padding: .45em;
2707
+ }
2708
+
2709
+ #astra-pro-sites-license-form .license-form-field {
2710
+ float: right;
2711
+ width: 100%;
2712
+ width: calc( 100% - 140px );
2713
+ }
2714
+
2715
+ #astra-pro-sites-license-form .regular-text {
2716
+ width: 100%;
2717
+ }
2718
+
2719
+ #astra-pro-sites-license-form .submit-button-wrap p {
2720
+ margin-top: 1em;
2721
+ }
2722
+
2723
+ .appearance_page_starter-templates.astra-sites-change-page-builder .astra-sites-notice {
2724
+ display: none;
2725
+ }
2726
+
2727
+ .astra-sites-log p:first-child {
2728
+ margin-top: 0;
2729
+ }
2730
+
2731
+ .astra-sites-log p:last-child {
2732
+ margin-bottom: 0;
2733
+ }
2734
+
2735
+ .astra-sites-log .batch-log {
2736
+ background: #fff;
2737
+ padding: 2em;
2738
+ margin-bottom: 1em;
2739
+ }
2740
+
2741
+ .astra-sites-log table td {
2742
+ vertical-align: top;
2743
+ padding: 15px;
2744
+ text-align: right;
2745
+ }
2746
+
2747
+ .white-label-enabled .astra-sites-logo-wrap {
2748
+ width: auto;
2749
+ display: flex;
2750
+ align-items: center;
2751
+ font-size: 1.2rem;
2752
+ font-weight: 500;
2753
+ }
2754
+
2755
+ .appearance_page_starter-templates .notice.astra-sites-must-notices {
2756
+ display: block;
2757
+ }
2758
+
2759
+ .astra-previewing-single-pages.appearance_page_starter-templates .notice.astra-sites-must-notices {
2760
+ display: none;
2761
+ }
2762
+
2763
+ #astra-pro-sites-license-form .astra-pro-sites-fail-message {
2764
+ color: #F44336;
2765
+ }
2766
+
2767
+ #astra-pro-sites-license-form .bsf-current-license-success-astra-pro-sites,
2768
+ #astra-pro-sites-license-form .bsf-current-license-error-astra-pro-sites {
2769
+ display: none;
2770
+ }
2771
+
2772
+ .bsf-current-license-error-astra-pro-sites,
2773
+ .bsf-current-license-success-astra-pro-sites {
2774
+ display: block;
2775
+ margin-bottom: 0.5em;
2776
+ }
2777
+
2778
+ .astra-pro-sites-license-form-status-success .astra-product-license {
2779
+ display: none;
2780
+ }
2781
+
2782
+ #astra-pro-sites-license-form.astra-pro-sites-license-form-status-success .license-form-field {
2783
+ width: calc( 100% - 2px );
2784
+ }
2785
+
2786
+ #astra-pro-sites-license-form .astra-pro-sites-success-message {
2787
+ color: #008000;
2788
+ }
2789
+
2790
+ .bsf-current-license-error-astra-pro-sites {
2791
+ color: #F44336;
2792
+ }
2793
+
2794
+ .skip-and-import .astra-site-contents {
2795
+ list-style-type: circle;
2796
+ margin-right: 1.7em;
2797
+ }
2798
+
2799
+ .astra-site-contents .astra-theme-module {
2800
+ margin-right: 2em;
2801
+ }
2802
+
2803
+ .dont-use-astra-theme .plugin-card-astra-addon,
2804
+ .required-plugins-count-1.dont-use-astra-theme .astra-sites-import-plugins {
2805
+ display: none;
2806
+ }
2807
+
2808
+ .subscription-popup {
2809
+ display: none;
2810
+ }
2811
+
2812
+ .subscription-form {
2813
+ margin-top: 2em;
2814
+ }
2815
+
2816
+ .subscription-field select,
2817
+ .subscription-field input[type="text"],
2818
+ .subscription-field input[type="email"] {
2819
+ width: 100%;
2820
+ border-radius: 3px;
2821
+ border: 1px solid #8b959d;
2822
+ font-size: 13px;
2823
+ height: 40px;
2824
+ padding: 0 10px;
2825
+ }
2826
+
2827
+ .subscription-fields .subscription-field {
2828
+ margin-bottom: 1.4em;
2829
+ }
2830
+
2831
+ .subscription-wp-user-type .label {
2832
+ margin-left: 1em;
2833
+ margin-right: 2px;
2834
+ }
2835
+
2836
+ .button-subscription-skip:focus {
2837
+ box-shadow: none;
2838
+ }
2839
+
2840
+ .button-subscription-skip {
2841
+ margin-top: .8em;
2842
+ display: inline-block;
2843
+ }
2844
+
2845
+ .import-page #astra-sites-subscription-form-two .subscription-field-wrap {
2846
+ margin-bottom: 5px;
2847
+ }
2848
+
2849
+ #astra-sites-subscription-form-two .subscription-field-wrap {
2850
+ margin-bottom: .8em;
2851
+ }
2852
+
2853
+ .subscription-actions {
2854
+ display: flex;
2855
+ align-items: center;
2856
+ }
2857
+
2858
+ .subscription-wp-user-type {
2859
+ display: flex;
2860
+ margin-bottom: 2em;
2861
+ }
2862
+
2863
+ .subscription-field .subscription-input .error {
2864
+ border-color: red;
2865
+ }
2866
+
2867
+ .subscription-input input[type="email"] {
2868
+ width: 100%;
2869
+ }
2870
+
2871
+ .subscription-popup .astra-sites-import-content {
2872
+ height: 250px;
2873
+ padding: 20px 35px 20px 35px;
2874
+ }
2875
+
2876
+ .subscription-actions .submitting .dashicons,
2877
+ .subscription-actions .submitted .dashicons {
2878
+ opacity: 1;
2879
+ visibility: visible;
2880
+ }
2881
+
2882
+ .subscription-actions .dashicons {
2883
+ opacity: 0;
2884
+ visibility: hidden;
2885
+ }
2886
+
2887
+ .subscription-actions .submitting .dashicons {
2888
+ animation: rotation 2s infinite linear;
2889
+ }
2890
+
2891
+ .wp-core-ui .subscription-field select {
2892
+ background-position: left 7px top 55%;
2893
+ }
2894
+
2895
+ .wp-core-ui .astra-sites-result-preview .subscription-actions .button.button-hero {
2896
+ margin: 0;
2897
+ box-shadow: none;
2898
+ font-size: 14px;
2899
+ min-height: 44px;
2900
+ padding: 0 18px;
2901
+ width: 100%;
2902
+ }
2903
+
2904
+ .wp-core-ui .subscription-wp-user-type select:focus,
2905
+ .subscription-field input[type="text"]:focus,
2906
+ .subscription-field input[type="email"]:focus,
2907
+ .wp-core-ui .subscription-wp-user-type select:hover,
2908
+ .subscription-field input[type="text"]:hover,
2909
+ .subscription-field input[type="email"]:hover {
2910
+ border-color: #444C53;
2911
+ }
2912
+
2913
+ .subscription-input input[type="email"],
2914
+ .subscription-input input[type="text"] {
2915
+ color: #444;
2916
+ }
2917
+
2918
+ .wp-core-ui .subscription-wp-user-type select:focus,
2919
+ .subscription-field input[type="text"]:focus,
2920
+ .subscription-field input[type="email"]:focus {
2921
+ box-shadow: none;
2922
+ }
2923
+
2924
+ .wp-core-ui .subscription-wp-user-type select,
2925
+ .subscription-wp-user-type .subscription-input {
2926
+ width: 100%;
2927
+ color: #72777c;
2928
+ }
2929
+
2930
+ .subscription-actions + p {
2931
+ margin: 30px 0 0 0;
2932
+ }
2933
+
2934
+ .subscription-footer {
2935
+ margin-top: 0.8em;
2936
+ text-align: center;
2937
+ }
2938
+
2939
+ .subscription-footer p {
2940
+ margin: 0;
2941
+ }
2942
+
2943
+ .subscription-fields .subscription-input:focus {
2944
+ outline: none;
2945
+ box-shadow: none;
2946
+ }
2947
+
2948
+ .subscription-fields .subscription-input {
2949
+ width: 100%;
2950
+ max-width: 100%;
2951
+ border-radius: 3px;
2952
+ border: 1px solid #585F66;
2953
+ padding: 0 10px;
2954
+ padding: 14px 14px;
2955
+ box-shadow: none;
2956
+ padding: 6px 12px;
2957
+ min-height: 44px;
2958
+ font-size: 14px;
2959
+ font-weight: 400;
2960
+ outline: none;
2961
+ background-color: transparent;
2962
+ background-position: left 10px top 55%;
2963
+ margin: 0;
2964
+ }
2965
+
2966
+ .subscription-label {
2967
+ color: #585F66;
2968
+ margin: 12px 10px;
2969
+ position: absolute;
2970
+ top: 0;
2971
+ font-weight: 400;
2972
+ padding: 0 5px;
2973
+ font-size: 14px;
2974
+ right: 0;
2975
+ -webkit-transition: all 0.25s ease;
2976
+ transition: all 0.25s ease;
2977
+ pointer-events: none;
2978
+ }
2979
+
2980
+ .subscription-field-wrap {
2981
+ position: relative;
2982
+ }
2983
+
2984
+ .subscription-fields .subscription-field-wrap:not(.subscription-success, .subscription-error) .subscription-input:hover {
2985
+ border-color: #2271b1;
2986
+ }
2987
+
2988
+ .subscription-fields .subscription-input:hover,
2989
+ .subscription-fields .subscription-input:focus {
2990
+ color: #2c3338;
2991
+ }
2992
+
2993
+ .subscription-anim .subscription-label {
2994
+ background-color: #f1f3f5;
2995
+ font-size: 12px;
2996
+ line-height: 12px;
2997
+ margin-top: 0;
2998
+ padding: 0 4px;
2999
+ top: -5px;
3000
+ transition: all 0.125s ease;
3001
+ -webkit-transition: all 0.125s ease;
3002
+ color: #2271b1;
3003
+ }
3004
+
3005
+ .subscription-error .subscription-input,
3006
+ .subscription-error .subscription-input:focus {
3007
+ border-color: red;
3008
+ }
3009
+
3010
+ .subscription-error .subscription-desc {
3011
+ color: red;
3012
+ }
3013
+
3014
+ .subscription-anim.subscription-error .subscription-label {
3015
+ color: red;
3016
+ }
3017
+
3018
+
3019
+ .subscription-field-wrap .subscription-desc {
3020
+ padding-right: 2px;
3021
+ opacity: 0;
3022
+ visibility: hidden;
3023
+ }
3024
+
3025
+ .subscription-success .subscription-input,
3026
+ .subscription-success .subscription-input:focus {
3027
+ border-color: #66a700;
3028
+ }
3029
+
3030
+ .subscription-anim.subscription-success .subscription-label {
3031
+ color: #66a700;
3032
+ }
3033
+
3034
+ .subscription-field-wrap {
3035
+ margin-bottom: 1em;
3036
+ }
3037
+
3038
+ .subscription-field-wrap.subscription-error .subscription-desc {
3039
+ opacity: 1;
3040
+ visibility: visible;
3041
+ }
3042
+
3043
+ .subscription-fields {
3044
+ display: flex;
3045
+ }
3046
+
3047
+ .subscription-fields .subscription-field-wrap {
3048
+ flex: 1;
3049
+ }
3050
+
3051
+ .subscription-enabled .astra-sites-advanced-options {
3052
+ display: none;
3053
+ }
3054
+
3055
+ .astra-sites-advanced-options-heading {
3056
+ display: none;
3057
+ }
3058
+
3059
+ .subscription-enabled .astra-sites-advanced-options-heading {
3060
+ display: inline-block;
3061
+ margin: 0;
3062
+ cursor: pointer;
3063
+ font-size: 15px;
3064
+ }
3065
+
3066
+ .subscription-enabled .astra-sites-subscription-form-one {
3067
+ display: block;
3068
+ }
3069
+
3070
+ .astra-sites-subscription-form-one {
3071
+ display: none;
3072
+ }
3073
+
3074
+ .astra-sites-advanced-options-heading .dashicons {
3075
+ opacity: 1;
3076
+ visibility: visible;
3077
+ }
3078
+
3079
+ .astra-sites-subscription-form-one {
3080
+ margin-top: 1.8em;
3081
+ max-width: 580px;
3082
+ }
3083
+
3084
+ .import-page .subscription-field-wrap {
3085
+ margin-bottom: .5em;
3086
+ }
3087
+
3088
+ .import-page .subscription-popup .astra-sites-import-content {
3089
+ height: 285px;
3090
+ }
3091
+
3092
+ .highlighted-note {
3093
+ font-size: 14px;
3094
+ font-weight: 500;
3095
+ }
3096
+
3097
+ @media screen and (max-width: 768px) {
3098
+ .wp-core-ui .astra-sites-result-preview .subscription-actions .button.button-hero {
3099
+ height: auto;
3100
+ word-break: break-word;
3101
+ white-space: initial;
3102
+ line-height: 1.5;
3103
+ padding: 5px 18px;
3104
+ }
3105
+ .astra-sites-result-preview input[type="checkbox"] {
3106
+ height: 1rem;
3107
+ width: 1rem;
3108
+ }
3109
+ .astra-sites-result-preview input[type="checkbox"]:checked:before {
3110
+ height: 1.2rem;
3111
+ width: 1.2rem;
3112
+ margin: -0.1rem -0.2rem;
3113
+ }
3114
+ .subscription-popup .astra-sites-import-content {
3115
+ padding: 20px;
3116
+ }
3117
+ #astra-sites-subscription-form-one .subscription-field-wrap {
3118
+ margin-bottom: .8em;
3119
+ }
3120
+ .subscription-fields {
3121
+ flex-direction: column;
3122
+ }
3123
+ }
3124
+
3125
+ @media screen and (min-width: 768px) {
3126
+
3127
+ .subscription-fields .subscription-field-wrap:first-child {
3128
+ padding-left: 20px;
3129
+ }
3130
+
3131
+ }
astra-sites/inc/assets/css/admin.css ADDED
@@ -0,0 +1,3131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'icomoon';
3
+ src: url('../fonts/astra-sites.eot?9i8jex');
4
+ src: url('../fonts/astra-sites.eot?9i8jex#iefix') format('embedded-opentype'),
5
+ url('../fonts/astra-sites.ttf?9i8jex') format('truetype'),
6
+ url('../fonts/astra-sites.woff?9i8jex') format('woff'),
7
+ url('../fonts/astra-sites.svg?9i8jex#icomoon') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ [class^="ast-icon-"], [class*=" ast-icon-"] {
13
+ /* use !important to prevent issues with browser extensions that change fonts */
14
+ font-family: 'icomoon' !important;
15
+ speak: none;
16
+ font-style: normal;
17
+ font-weight: normal;
18
+ font-variant: normal;
19
+ text-transform: none;
20
+ line-height: 1;
21
+
22
+ /* Better Font Rendering =========== */
23
+ -webkit-font-smoothing: antialiased;
24
+ -moz-osx-font-smoothing: grayscale;
25
+ }
26
+
27
+ .ast-icon-search:before {
28
+ content: "\e900";
29
+ }
30
+ .ast-icon-heart:before {
31
+ content: "\e901";
32
+ }
33
+ .ast-icon-refresh:before {
34
+ content: "\e902";
35
+ }
36
+ .ast-icon-chevron-left:before {
37
+ content: "\e904";
38
+ }
39
+ .ast-icon-file:before {
40
+ content: "\e903";
41
+ }
42
+ .ast-icon-layers:before {
43
+ content: "\e905";
44
+ }
45
+
46
+ .favorite-filters-wrap a {
47
+ font-size: 1rem;
48
+ }
49
+
50
+ .wrap .status,
51
+ .wrap .site-type {
52
+ position: absolute;
53
+ z-index: 1;
54
+ text-transform: uppercase;
55
+ color: #fff;
56
+ top: 15px;
57
+ right: 16px;
58
+ font-size: 10px;
59
+ letter-spacing: .7px;
60
+ font-weight: 500;
61
+ padding: 0.2em .7em;
62
+ border-radius: 4px;
63
+ }
64
+
65
+ .astra-sites-autocomplete-result {
66
+ position: absolute;
67
+ top: 46px !important;
68
+ left: 0;
69
+ right: 0;
70
+ bottom: 0;
71
+ }
72
+
73
+ .astra-sites-autocomplete-result .ui-autocomplete {
74
+ text-align: left;
75
+ left: 0 !important;
76
+ right: 0 !important;
77
+ width: calc( 100% - 2px ) !important;
78
+ z-index: 999999;
79
+ top: 0 !important;
80
+ }
81
+
82
+ .ast-white-label-flag {
83
+ opacity: 0;
84
+ visibility: hidden;
85
+ }
86
+
87
+ .single-site-footer .dashicons-editor-help {
88
+ cursor: pointer;
89
+ display: inline-block;
90
+ }
91
+
92
+ .preview-page-from-search-result .astra-sites-import-plugins .dashicons,
93
+ .astra-sites-page-import-popup .astra-sites-import-plugins .dashicons {
94
+ display: none;
95
+ }
96
+ .ast-sites-ps-msg {
97
+ bottom: 10px;
98
+ position: absolute;
99
+ color: #777;
100
+ margin-right: 1em;
101
+ }
102
+ #astra-sites__category-filter {
103
+ display: inline-block;
104
+ }
105
+ #astra-sites__category-filter .astra-sites__category-filter-anchor {
106
+ height: 44px;
107
+ position: relative;
108
+ cursor: pointer;
109
+ display: flex;
110
+ padding: 0 12px 0 12px;
111
+ border: 0;
112
+ width: 135px;
113
+ justify-content: space-between;
114
+ align-items: center;
115
+ font-weight: 500;
116
+ border-radius: 6px 0 0 6px;
117
+ }
118
+ #astra-sites__category-filter .astra-sites__category-filter-anchor:after {
119
+ position: absolute;
120
+ content: "";
121
+ border-left: 2px solid #555;
122
+ border-top: 2px solid #555;
123
+ padding: 3px;
124
+ right: 14px;
125
+ top: 38%;
126
+ -moz-transform: rotate(-135deg);
127
+ -ms-transform: rotate(-135deg);
128
+ -o-transform: rotate(-135deg);
129
+ -webkit-transform: rotate(-135deg);
130
+ transform: rotate(-135deg);
131
+ }
132
+ #astra-sites__category-filter .ast-sites__filter-wrap-checkbox.first-wrap {
133
+ padding-top: 15px;
134
+ margin-top: 15px;
135
+ border-top: 1px solid #eee;
136
+ }
137
+ #astra-sites__category-filter ul.astra-sites__category-filter-items {
138
+ display: none;
139
+ margin: 0;
140
+ position: absolute;
141
+ width: 98px;
142
+ top: 40px;
143
+ box-sizing: content-box;
144
+ border: 1px solid #e4e4e4;
145
+ margin-top: 10px;
146
+ min-width: 135px;
147
+ background-color: #fff;
148
+ border-radius: 6px;
149
+ box-shadow: 0 3px 6px rgba(0,0,0,.1);
150
+ padding: 15px;
151
+ -webkit-transform-origin: 50% 0;
152
+ transform-origin: 50% 0;
153
+ -webkit-transition: all .2s ease;
154
+ transition: all .2s ease;
155
+ }
156
+ #astra-sites__category-filter li.ast-sites__filter-wrap.category-active:before {
157
+ content: "✓";
158
+ color: #1E8CBE;
159
+ position: absolute;
160
+ left: -15px;
161
+ font-size: 15px;
162
+ }
163
+
164
+ .astra-sites__category-filter-items label {
165
+ vertical-align: top;
166
+ }
167
+ #astra-sites__category-filter ul.astra-sites__category-filter-items li {
168
+ list-style: none;
169
+ margin-bottom: 8px;
170
+ margin-left: 14px;
171
+ cursor: pointer;
172
+ position: relative;
173
+ font-weight: 500;
174
+ }
175
+ #astra-sites__category-filter ul.astra-sites__category-filter-items li.ast-sites__filter-wrap-checkbox {
176
+ margin-left: 0;
177
+ }
178
+ #astra-sites .astra-theme:hover .inner {
179
+ transform: translate(0, -1px);
180
+ box-shadow: 0 6px 14px 0 rgba(0,0,0,.12)
181
+ }
182
+ #astra-sites .astra-theme .inner {
183
+ position: relative;
184
+ border-radius: 2px;
185
+ overflow: initial;
186
+ border: 1px solid #ddd;
187
+ transition: all 0.4s;
188
+ }
189
+ #single-pages .inner {
190
+ border: 1px solid #e2e2e2;
191
+ transition: all 250ms cubic-bezier(0.02, 0.01, 0.47, 1);
192
+ }
193
+ #single-pages .current_page .inner,
194
+ #single-pages .inner:hover {
195
+ box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14);
196
+ }
197
+ #astra-sites-admin.wrap .status,
198
+ #astra-sites-admin.wrap .site-type.premium {
199
+ background: #0073aa;
200
+ border: 2px solid #ffffff;
201
+ top: 17px;
202
+ right: 18px;
203
+ }
204
+ #astra-sites-admin .filter-links .current {
205
+ border-bottom: none;
206
+ color: #23282d;
207
+ }
208
+ #wp-filter-search-input {
209
+ font-weight: 400;
210
+ width: 100%;
211
+ opacity: 1;
212
+ height: 46px;
213
+ background: #fff;
214
+ line-height: 32px;
215
+ border-radius: 0 6px 6px 0;
216
+ font-size: 13px;
217
+ padding: 5px 20px;
218
+ border: 1px solid #DDDDDD;
219
+ border-left: 1px solid #DDDDDD;
220
+ box-shadow: none;
221
+ }
222
+
223
+ #astra-sites-filters .ui-widget.ui-widget-content {
224
+ border-top-left-radius: 0;
225
+ border-top-right-radius: 0;
226
+ border-bottom-left-radius: 6px;
227
+ border-bottom-right-radius: 6px;
228
+ border: 1px solid rgba(32,33,36,0.18);
229
+ border-top: none;
230
+ overflow: hidden;
231
+ box-shadow: 0 3px 4px 0 rgba(32,33,36,0.18);
232
+ background: transparent;
233
+ padding-top: 10px;
234
+ padding-bottom: 10px;
235
+ background: #fff;
236
+ }
237
+
238
+ #astra-sites-filters .ui-autocomplete li,
239
+ #astra-sites-filters .ui-autocomplete li:focus,
240
+ #astra-sites-filters .ui-autocomplete li:hover {
241
+ outline: none;
242
+ }
243
+ #astra-sites-filters .ui-autocomplete li {
244
+ padding: 3px 20px;
245
+ text-transform: capitalize;
246
+ }
247
+ #astra-sites-filters .ui-autocomplete li:hover {
248
+ background-color: #eeeeee;
249
+ }
250
+ .appearance_page_starter-templates .wp-filter .search-form.searching #astra-sites__category-filter {
251
+ border-bottom-left-radius: 0;
252
+ }
253
+ .searching #wp-filter-search-input {
254
+ border-bottom-right-radius: 0;
255
+ }
256
+
257
+ #wp-filter-search-input.has-input + .search-icon {
258
+ display: none;
259
+ }
260
+ .appearance_page_starter-templates .search-icon {
261
+ position: absolute;
262
+ top: 0;
263
+ right: 0;
264
+ color: #C3C3C3;
265
+ padding: 15px 19px 12px 12px;
266
+ }
267
+ .appearance_page_starter-templates .search-icon:before {
268
+ vertical-align: middle;
269
+ }
270
+ #astra-sites-admin .filter-links li > a {
271
+ border-bottom: none;
272
+ font-size: 12px;
273
+ padding: 2px 0;
274
+ text-transform: uppercase;
275
+ letter-spacing: 0.3px;
276
+ font-weight: 500;
277
+ }
278
+ #astra-sites-admin .filter-links li > a:focus {
279
+ box-shadow: none;
280
+ }
281
+ #astra-sites-admin .theme-actions {
282
+ box-shadow: none;
283
+ left: 0;
284
+ border-left: none;
285
+ background: #fafafa;
286
+ padding: 0;
287
+ margin-right: 20%;
288
+ }
289
+ .searching .pages-count,
290
+ .searching .page-title {
291
+ display: block;
292
+ }
293
+ .searching .no-pages .theme-name {
294
+ min-height: 36px;
295
+ }
296
+ #astra-sites-admin .theme-browser .theme .theme-name {
297
+ height: auto;
298
+ width: 90%;
299
+ align-self: center;
300
+ box-shadow: none;
301
+ background: none;
302
+ padding: 14px 15px;
303
+ font-size: 14px;
304
+ font-weight: 600;
305
+ display: flex;
306
+ align-items: center;
307
+ justify-content: space-between;
308
+ }
309
+ #astra-sites-admin .theme-id-container {
310
+ background: #fff;
311
+ border: none;
312
+ display: flex;
313
+ align-items: center;
314
+ justify-content: center;
315
+ border-bottom-left-radius: 2px;
316
+ border-bottom-right-radius: 2px;
317
+ border-top: 1px solid #eeeeee;
318
+ }
319
+ #astra-sites-admin .sites-page-count {
320
+ color: #888;
321
+ font-size: 12px;
322
+ display: block;
323
+ margin-top: 5px;
324
+ }
325
+ #astra-sites-admin .theme-action-wrap {
326
+ width: 100%;
327
+ padding: 8px 15px;
328
+ }
329
+ .filters-wrap-page-categories {
330
+ margin-right: 10px;
331
+ }
332
+ #astra-sites-admin .favorite-filters-wrap .filter-links a {
333
+ border: none;
334
+ }
335
+ .favorite-filters-wrap .current .dashicons {
336
+ color: #c34444;
337
+ }
338
+ .favorite-filters-wrap .dashicons {
339
+ color: #71777c;
340
+ font-size: 18px;
341
+ line-height: 18px;
342
+ width: 17px;
343
+ height: 17px;
344
+ }
345
+ .theme-browser .theme:hover,
346
+ .theme-browser .theme:focus {
347
+ cursor: initial;
348
+ }
349
+ .theme-browser .theme .inner:hover,
350
+ .theme-browser .theme .inner:focus {
351
+ cursor: pointer;
352
+ }
353
+
354
+ .searching .theme-browser .theme .inner:hover .type {
355
+ opacity: 1;
356
+ visibility: visible;
357
+ }
358
+
359
+ .astra-sites-sync-library-button.updating-message {
360
+ animation: rotation 2s infinite linear;
361
+ }
362
+
363
+ .astra-sites-sync-library,
364
+ .favorite-filters-title {
365
+ width: 10%;
366
+ padding: 15px 5px;
367
+ align-self: center;
368
+ justify-content: center;
369
+ text-align: center;
370
+ margin-left: 5px;
371
+ }
372
+ .astra-sites-sync-library a,
373
+ .favorite-filters-title a {
374
+ color: #666;
375
+ cursor: pointer;
376
+ }
377
+
378
+ .favorite-action-wrap {
379
+ padding-right: 15px;
380
+ padding-left: 10px;
381
+ }
382
+
383
+ .favorite-action-wrap i {
384
+ color: #666666;
385
+ height: 18px;
386
+ width: 18px;
387
+ font-size: 16px;
388
+ line-height: 1.5;
389
+ transition-property: border, background, color;
390
+ transition-duration: .05s;
391
+ transition-timing-function: ease-in-out;
392
+ }
393
+ .theme-id-container .ast-icon-star {
394
+ padding: 0 15px 0 0;
395
+ }
396
+ .wrap .status {
397
+ left: -0.5em;
398
+ }
399
+ .wrap .status.publish,
400
+ .wrap .site-type.free {
401
+ display: none;
402
+ }
403
+
404
+ .astra-sites-activate-license .astra-sites-import-content,
405
+ .astra-sites-get-agency-bundle .astra-sites-import-content {
406
+ height: auto;
407
+ }
408
+ .astra-sites-import-content {
409
+ display: block;
410
+ padding: 10px 35px 20px 35px;
411
+ background: #f1f3f5;
412
+ height: 200px;
413
+ overflow: auto;
414
+ position: relative;
415
+ }
416
+
417
+ .astra-sites-activate-license .astra-sites-import-content {
418
+ padding: 20px 35px 30px 35px;
419
+ }
420
+
421
+ #astra-sites-skip-and-import-notice-update-available ul {
422
+ list-style-type: disc;
423
+ margin-left: 15px;
424
+ }
425
+
426
+ .astra-sites-import-content .install-theme-info {
427
+ display: block;
428
+ padding: 0;
429
+ }
430
+
431
+ .install-theme-info .site-type {
432
+ display: none;
433
+ }
434
+
435
+ .theme {
436
+ position: relative;
437
+ }
438
+ .wrap .astra-sites-preview .site-type.premium {
439
+ display: block;
440
+ display: none;
441
+ position: relative;
442
+ margin: 0.5em 0em 1em 0em;
443
+ top: 0;
444
+ left: 0;
445
+ text-align: center;
446
+ }
447
+
448
+ .theme-details-read-more.open {
449
+ margin: 0.5em 0 0 0;
450
+ }
451
+
452
+ .astra-sites-preview .theme-screenshot {
453
+ width: 100%;
454
+ }
455
+
456
+ .install-theme-info .site-type.premium {
457
+ display: none;
458
+ }
459
+
460
+ /**
461
+ * Required Plugins
462
+ */
463
+ .required-plugins.loading {
464
+ text-align: center;
465
+ }
466
+ .required-plugins button {
467
+ float: right;
468
+ }
469
+ .required-plugins .plugin-card {
470
+ float: none;
471
+ width: 100%;
472
+ border: none;
473
+ margin: 0 0 0.8em 0;
474
+ display: flex;
475
+ justify-content: space-between;
476
+ align-items: center;
477
+ transition: background ease 0.8s;
478
+ }
479
+ .required-plugins .plugin-card.plugin-card-update-failed {
480
+ flex-wrap: wrap;
481
+ }
482
+ .required-plugins .spinner {
483
+ float: none;
484
+ margin: 0;
485
+ }
486
+
487
+ .expanded .wp-full-overlay-footer {
488
+ height: 111px;
489
+ }
490
+
491
+ .wp-full-overlay-footer .view-site,
492
+ .wp-full-overlay-footer .go-pro,
493
+ .wp-full-overlay-footer .astra-demo-import {
494
+ width: 100%;
495
+ text-align: center;
496
+ }
497
+
498
+ .wp-core-ui .wp-full-overlay-footer .button.button-hero,
499
+ .wp-core-ui .wp-full-overlay-footer .button-group.button-hero .button {
500
+ padding: 0 10px 1px;
501
+ }
502
+
503
+ .wp-full-overlay-footer .installing:before {
504
+ vertical-align: text-bottom;
505
+ }
506
+
507
+ .astra-sites-advanced-options-wrap h4 {
508
+ margin: 1em 0 0.5em 0;
509
+ padding: 0.5em 0;
510
+ transition: all ease 0.3s;
511
+ }
512
+
513
+ /**
514
+ * Read more link
515
+ */
516
+ .wp-core-ui .theme-details-read-more:focus,
517
+ .wp-core-ui .theme-details-read-more:hover {
518
+ outline: none;
519
+ box-shadow: none;
520
+ }
521
+ .wp-core-ui .theme-details-read-more {
522
+ margin: 10px 0;
523
+ display: none;
524
+ text-decoration: none;
525
+ }
526
+
527
+ /**
528
+ * Go pro.
529
+ */
530
+ .wp-core-ui .go-pro.button[disabled] {
531
+ background-color: #fcb92c !important;
532
+ color: white !important;
533
+ box-shadow: 1px 0 #eab23a !important;
534
+ text-shadow: 1px 0 #6b4e13 !important;
535
+ border-color: #e2a932 !important;
536
+ cursor: pointer;
537
+ }
538
+ .wp-core-ui .view-site .dashicons,
539
+ .wp-core-ui .go-pro .dashicons {
540
+ font-size: 1rem;
541
+ vertical-align: middle;
542
+ }
543
+
544
+ /**
545
+ * Errors
546
+ */
547
+ .plugin-card-update-failed .notice {
548
+ margin-top: 1.5em;
549
+ }
550
+
551
+ .no-themes {
552
+ margin-top: 40px;
553
+ }
554
+
555
+ .no-themes p {
556
+ font-size: 15px;
557
+ }
558
+
559
+ .no-themes .left-margin {
560
+ margin-left: 30px;
561
+ }
562
+
563
+ /**
564
+ *
565
+ */
566
+ .astra-sites-preview .wp-full-overlay-sidebar-content {
567
+ bottom: 100px;
568
+ }
569
+
570
+ .footer-import-button-wrap {
571
+ padding: 10px 20px;
572
+ }
573
+
574
+ .footer-import-button-wrap .button {
575
+ margin: 0;
576
+ }
577
+
578
+ .astra-sites-preview.expanded .wp-full-overlay-footer {
579
+ left: initial;
580
+ }
581
+
582
+ /**
583
+ * Menu Page
584
+ */
585
+ .astra-sites-title {
586
+ float: left;
587
+ font-size: 20px;
588
+ font-weight: 400;
589
+ margin: 0;
590
+ padding: 0;
591
+ color: #444;
592
+ }
593
+
594
+ #astra-sites-admin #single-pages .site-single .theme-name {
595
+ font-weight: 500;
596
+ font-size: 13px;
597
+ padding: 8px 14px;
598
+ background: #fff;
599
+ }
600
+
601
+ .astra-sites-logo-wrap {
602
+ width: 42px;
603
+ height: 42px;
604
+ }
605
+
606
+ .astra-sites-logo-wrap a,
607
+ .astra-sites-logo-wrap img {
608
+ width: inherit;
609
+ height: inherit;
610
+ display: inline-block;
611
+ }
612
+
613
+ /**
614
+ * API Error
615
+ */
616
+ .astra-api-error {
617
+ margin: 0 0 0.5em 0;
618
+ }
619
+
620
+ /**
621
+ * Grid
622
+ */
623
+ .appearance_page_starter-templates .wp-filter .search-form {
624
+ margin-left: 1em;
625
+ position: relative;
626
+ display: flex;
627
+ border-bottom: 1px solid #ccc;
628
+ }
629
+ .appearance_page_starter-templates .wp-filter .search-form #astra-sites__category-filter {
630
+ border: 1px solid #DDDDDD;
631
+ border-right: 0;
632
+ border-radius: 6px 0 0 6px;
633
+ }
634
+ .appearance_page_starter-templates .wp-filter .search-form input[type="search"] {
635
+ width: 20px;
636
+ font-size: 13px;
637
+ padding: 5px 10px;
638
+ opacity: 0;
639
+ -webkit-transition: width ease 0.3s;
640
+ -moz-transition: width ease 0.3s;
641
+ transition: width ease 0.3s;
642
+ }
643
+ .filter-count {
644
+ min-width: 3em;
645
+ margin-right: 14px;
646
+ }
647
+ .astra-site-preview-on {
648
+ overflow: hidden;
649
+ }
650
+
651
+ .filters-wrap {
652
+ display: inline-block;
653
+ }
654
+ .spinner-wrap {
655
+ text-align: center;
656
+ }
657
+ .spinner-wrap .spinner {
658
+ float: none;
659
+ }
660
+ .hide-me {
661
+ display: none !important;
662
+ }
663
+ #site-pages {
664
+ z-index: 10;
665
+ }
666
+
667
+ .install-theme-info > .notice {
668
+ margin: 5px 0 10px 0;
669
+ }
670
+
671
+ .astra-sites-suggestions:before {
672
+ border: 5px dashed #ccc;
673
+ position: absolute;
674
+ left: 0;
675
+ right: 0;
676
+ top: 0;
677
+ bottom: 0px;
678
+ }
679
+
680
+ .astra-sites-suggestions {
681
+ min-height: 390px;
682
+ border: none !important;
683
+ }
684
+
685
+ .astra-sites-suggestions a {
686
+ border: none;
687
+ outline: none;
688
+ }
689
+
690
+ .astra-sites-suggestions .inner {
691
+ border: 6px solid #ffffff !important;
692
+ background: #f1f1f1;
693
+ color: #63676b;
694
+ padding: 58% 10% 80% 10%;
695
+ text-align: center;
696
+ position: absolute;
697
+ left: 0;
698
+ right: 0;
699
+ top: 0;
700
+ bottom: 0;
701
+ cursor: auto;
702
+ }
703
+
704
+ .astra-sites-suggestions .inner a {
705
+ color: #00b9eb;
706
+ }
707
+
708
+ .astra-sites-suggestions p {
709
+ font-size: 1rem;
710
+ margin: 0;
711
+ }
712
+
713
+ .astra-notice {
714
+ margin: 2em 2em 0em 0em;
715
+ }
716
+
717
+ .no-themes .description {
718
+ display: block;
719
+ }
720
+
721
+ /**
722
+ * Responsive Button UI
723
+ */
724
+ .astra-sites-preview .wp-full-overlay-footer .devices button.active:before,
725
+ .astra-sites-preview .wp-full-overlay-footer .devices button:hover:before {
726
+ color: #0073aa;
727
+ }
728
+ .astra-sites-preview .wp-full-overlay-footer .devices button:before {
729
+ color: #c1c1c1;
730
+ }
731
+ .astra-sites-preview .wp-full-overlay-footer .devices button:hover {
732
+ background-color: transparent;
733
+ }
734
+ .astra-sites-preview .wp-full-overlay-footer .devices button {
735
+ border: none;
736
+ }
737
+ .astra-sites-preview .wp-full-overlay-footer .devices button:focus,
738
+ .astra-sites-preview .wp-full-overlay-footer .devices button.active:hover {
739
+ border-bottom-color: transparent;
740
+ background-color: transparent;
741
+ }
742
+ .not-click-able {
743
+ pointer-events: none !important;
744
+ }
745
+ body.page-builder-selected .select-page-builder,
746
+ body.loading-content .select-page-builder {
747
+ display: none;
748
+ }
749
+ .select-page-builder .up-arrow {
750
+ -webkit-transform: rotate(90deg);
751
+ -moz-transform: rotate(90deg);
752
+ -ms-transform: rotate(90deg);
753
+ transform: rotate(90deg);
754
+ display: inline-block;
755
+ font-size: 1.5em;
756
+ color: #797979;
757
+ vertical-align: middle;
758
+ margin-right: 10px;
759
+ -webkit-transition: all linear 0.6s;
760
+ -moz-transition: all linear 0.6s;
761
+ -ms-transition: all linear 0.6s;
762
+ transition: all linear 0.6s;
763
+ -webkit-animation-duration: 1s;
764
+ animation-duration: 1s;
765
+ -webkit-animation-fill-mode: both;
766
+ animation-fill-mode: both;
767
+ -webkit-animation-timing-function: ease-in-out;
768
+ animation-timing-function: ease-in-out;
769
+ animation-iteration-count: infinite;
770
+ -webkit-animation-iteration-count: infinite;
771
+ animation-name: bounce;
772
+ -moz-animation-name: bounce;
773
+ }
774
+ .select-page-builder {
775
+ margin-left: 6em;
776
+ }
777
+
778
+ .select-page-builder img {
779
+ max-width: 100%;
780
+ }
781
+
782
+ .select-page-builder .note-wrap {
783
+ position: absolute;
784
+ padding: 40px 0;
785
+ margin-left: 170px;
786
+ right: 0;
787
+ left: 0;
788
+ }
789
+
790
+ .select-page-builder h3 {
791
+ margin: 0;
792
+ font-size: 2em;
793
+ }
794
+ .select-page-builder {
795
+ margin: -20px 0 0 -5px;
796
+ position: absolute;
797
+ }
798
+ .select-page-builder .note {
799
+ margin-left: 1.5em;
800
+ }
801
+
802
+ @keyframes bounce {
803
+ 0%,
804
+ 100%,
805
+ 20%,
806
+ 50%,
807
+ 80% {
808
+ -webkit-transform: translateY(-0px) rotate(90deg);
809
+ -moz-transform: translateY(-0px) rotate(90deg);
810
+ -ms-transform: translateY(-0px) rotate(90deg);
811
+ transform: translateY(-0px) rotate(90deg);
812
+ }
813
+ 40% {
814
+ -webkit-transform: translateY(-2px) rotate(90deg);
815
+ -moz-transform: translateY(-2px) rotate(90deg);
816
+ -ms-transform: translateY(-2px) rotate(90deg);
817
+ transform: translateY(-2px) rotate(90deg);
818
+ }
819
+ 60% {
820
+ -webkit-transform: translateY(-1px) rotate(90deg);
821
+ -moz-transform: translateY(-1px) rotate(90deg);
822
+ -ms-transform: translateY(-1px) rotate(90deg);
823
+ transform: translateY(-1px) rotate(90deg);
824
+ }
825
+ }
826
+
827
+ /**
828
+ * Processing Animation
829
+ */
830
+ .astra-demo-import.disabled {
831
+ pointer-events: none;
832
+ }
833
+ .astra-demo-import.button.updating-message:before,
834
+ .astra-demo-import.button.installing:before {
835
+ -webkit-animation: cssAnimation .72s ease infinite;
836
+ -moz-animation: cssAnimation .72s ease infinite;
837
+ -o-animation: cssAnimation .72s ease infinite;
838
+ -ms-animation: cssAnimation .72s ease infinite;
839
+ animation: cssAnimation .72s ease infinite;
840
+ }
841
+
842
+ @-webkit-keyframes cssAnimation {
843
+ from {
844
+ -webkit-transform: rotate(0);
845
+ -moz-transform: rotate(0);
846
+ -o-transform: rotate(0);
847
+ -ms-transform: rotate(0);
848
+ transform: rotate(0);
849
+ }
850
+ to {
851
+ -webkit-transform: rotate(360deg);
852
+ -moz-transform: rotate(360deg);
853
+ -o-transform: rotate(360deg);
854
+ -ms-transform: rotate(360deg);
855
+ transform: rotate(360deg);
856
+ }
857
+ }
858
+ @-moz-keyframes cssAnimation {
859
+ from {
860
+ -webkit-transform: rotate(0);
861
+ -moz-transform: rotate(0);
862
+ -o-transform: rotate(0);
863
+ -ms-transform: rotate(0);
864
+ transform: rotate(0);
865
+ }
866
+ to {
867
+ -webkit-transform: rotate(360deg);
868
+ -moz-transform: rotate(360deg);
869
+ -o-transform: rotate(360deg);
870
+ -ms-transform: rotate(360deg);
871
+ transform: rotate(360deg);
872
+ }
873
+ }
874
+ @-o-keyframes cssAnimation {
875
+ from {
876
+ -webkit-transform: rotate(0);
877
+ -moz-transform: rotate(0);
878
+ -o-transform: rotate(0);
879
+ -ms-transform: rotate(0);
880
+ transform: rotate(0);
881
+ }
882
+ to {
883
+ -webkit-transform: rotate(360deg);
884
+ -moz-transform: rotate(360deg);
885
+ -o-transform: rotate(360deg);
886
+ -ms-transform: rotate(360deg);
887
+ transform: rotate(360deg);
888
+ }
889
+ }
890
+
891
+ #astra-sites-filters .wp-filter {
892
+ display: flex;
893
+ justify-content: space-between;
894
+ align-items: center;
895
+ }
896
+
897
+ .astra-pages-title {
898
+ color: #9e9e9e;
899
+ text-decoration: none;
900
+ font-weight: 500;
901
+ position: relative;
902
+ }
903
+ .single-site-pages-header .count {
904
+ opacity: 0.7;
905
+ }
906
+
907
+ .single-site-pages-header .astra-site-title {
908
+ font-size: 22px;
909
+ }
910
+ .astra-site-down {
911
+ padding: 1em 2em;
912
+ margin-top: 1em;
913
+ }
914
+
915
+ #astra-sites-menu-page .menu {
916
+ padding: 0;
917
+ }
918
+
919
+ .astra-sites-nav-items a:hover,
920
+ .astra-sites-nav-items a:focus {
921
+ outline: none;
922
+ border: none;
923
+ box-shadow: none;
924
+ }
925
+
926
+ .astra-sites-nav-items a {
927
+ background: #f1f1f1;
928
+ color: #4e555d;
929
+ font-size: 14px;
930
+ text-decoration: none;
931
+ padding: 21px 20px 24px 43px;
932
+ font-weight: 500;
933
+ }
934
+
935
+ .astra-sites-nav-items a:before {
936
+ content: "\f105";
937
+ }
938
+
939
+ #astra-sites-filters .search-form {
940
+ font-weight: normal;
941
+ border: none;
942
+ margin: 0;
943
+ border-radius: 6px;
944
+ display: flex;
945
+ align-items: center;
946
+ height: 46px;
947
+ }
948
+
949
+ .astra-sites-nav-items a:before {
950
+ font-family: dashicons;
951
+ display: inline-block;
952
+ line-height: 1;
953
+ font-weight: 400;
954
+ font-style: normal;
955
+ speak: none;
956
+ text-decoration: inherit;
957
+ text-transform: none;
958
+ text-rendering: auto;
959
+ -webkit-font-smoothing: antialiased;
960
+ -moz-osx-font-smoothing: grayscale;
961
+ font-size: 17px;
962
+ vertical-align: top;
963
+ text-align: center;
964
+ transition: color 0.1s ease-in;
965
+ position: absolute;
966
+ margin-left: -22px;
967
+ font-weight: normal;
968
+ }
969
+ .nav-tab-wrapper .button {
970
+ height: 30px;
971
+ }
972
+ .back-to-layout:before {
973
+ background: #fff;
974
+ color: #777;
975
+ padding: 3px;
976
+ border-radius: 100%;
977
+ font-size: 13px;
978
+ border: 1px solid #777;
979
+ }
980
+
981
+ .back-to-layout:hover:before {
982
+ background: #f7f7f7;
983
+ border-color: #0073aa;
984
+ color: #0073aa;
985
+ }
986
+
987
+ .back-to-layout {
988
+ border-right: 1px solid #eeeeee;
989
+ padding: 20px 14px;
990
+ text-align: center;
991
+ cursor: pointer;
992
+ visibility: hidden;
993
+ opacity: 0;
994
+ font-size: 24px;
995
+ line-height: normal;
996
+ }
997
+
998
+ .back-to-layout:hover {
999
+ background-color: #f7f7f7;
1000
+ }
1001
+
1002
+ .astra-sites-no-search-result .back-to-layout,
1003
+ .astra-sites-showing-favorites .back-to-layout,
1004
+ .astra-previewing-single-pages .back-to-layout {
1005
+ visibility: visible;
1006
+ opacity: 1;
1007
+ }
1008
+ .logo {
1009
+ cursor: pointer;
1010
+ }
1011
+ #astra-sites-menu-page .nav-tab-wrapper .logo {
1012
+ border-right: 1px solid #dddddd;
1013
+ padding: 13px 20px 14px 20px;
1014
+ }
1015
+ #astra-sites-menu-page .nav-tab-wrapper .logo,
1016
+ #astra-sites-menu-page .form {
1017
+ display: flex;
1018
+ align-items: center;
1019
+ }
1020
+
1021
+ #astra-sites-menu-page .nav-tab-wrapper {
1022
+ display: flex;
1023
+ justify-content: space-between;
1024
+ border: none;
1025
+ background: #fff;
1026
+ padding: 0;
1027
+ align-items: center;
1028
+ box-shadow: 25px 0 30px rgba(28, 39, 60, 0.09);
1029
+ border-bottom: 1px solid #dddddd;
1030
+ z-index: 88;
1031
+ }
1032
+ .theme-name .title,
1033
+ .theme-name .type {
1034
+ transition: all 0.4s linear;
1035
+ }
1036
+ .searching .theme-name .type {
1037
+ padding: 4px 8px;
1038
+ }
1039
+ .theme-name .type {
1040
+ font-size: 12px;
1041
+ opacity: 0;
1042
+ visibility: hidden;
1043
+ color: #555;
1044
+ border: 1px solid #cccccc;
1045
+ background: #f7f7f7;
1046
+ vertical-align: top;
1047
+ border-radius: 2px;
1048
+ font-weight: normal;
1049
+ }
1050
+ .theme-name .type .dashicons {
1051
+ font-size: 16px;
1052
+ }
1053
+ .favorite-filters-wrap {
1054
+ border-right: 1px solid #dddddd;
1055
+ padding: 10px;
1056
+ }
1057
+
1058
+ .header-actions a {
1059
+ text-decoration: none;
1060
+ font-size: 18px;
1061
+ line-height: 1;
1062
+ height: 15px;
1063
+ width: 18px;
1064
+ }
1065
+ .header-actions .filter-links li > a:hover,
1066
+ .header-actions .filter-links li > a:focus {
1067
+ outline: none;
1068
+ }
1069
+ .filter-links li > .astra-sites-show-favorite-button.current:hover,
1070
+ .filter-links li > .astra-sites-show-favorite-button.current,
1071
+ .filter-links li > .astra-sites-show-favorite-button:hover,
1072
+ .filter-links li > .astra-sites-show-favorite-button:focus,
1073
+ .astra-sites-show-favorite-button.active {
1074
+ color: transparent;
1075
+ }
1076
+ .filter-links li > .astra-sites-show-favorite-button.current:hover .ast-icon-heart,
1077
+ .filter-links li > .astra-sites-show-favorite-button.current .ast-icon-heart,
1078
+ .filter-links li > .astra-sites-show-favorite-button:hover .ast-icon-heart,
1079
+ .astra-sites-show-favorite-button.active .ast-icon-heart {
1080
+ color: #c34444;
1081
+ }
1082
+
1083
+ .ast-icon-heart {
1084
+ color: #666;
1085
+ }
1086
+ .header-actions a:focus {
1087
+ box-shadow: none;
1088
+ }
1089
+ #astra-sites-filters {
1090
+ flex: 1;
1091
+ }
1092
+
1093
+ #astra-sites-filters .wp-filter {
1094
+ margin-top: 0;
1095
+ justify-content: center;
1096
+ box-shadow: none;
1097
+ border: none;
1098
+ margin-bottom: 0;
1099
+ background: transparent;
1100
+ padding: 0;
1101
+ }
1102
+
1103
+ .is-favorite .favorite-action-wrap i {
1104
+ color : #c34444;
1105
+ }
1106
+
1107
+ .astra-sites-no-sites,
1108
+ .astra-sites-no-favorites {
1109
+ padding: 7em 0;
1110
+ }
1111
+
1112
+ .astra-sites-no-sites h3,
1113
+ .astra-sites-no-favorites h3 {
1114
+ font-size: 1.3rem;
1115
+ font-weight: normal;
1116
+ margin-top: 0;
1117
+ text-align: center;
1118
+ margin-bottom: 3em;
1119
+ color: #666;
1120
+ }
1121
+
1122
+ .astra-sites-no-sites .back-to-layout-button {
1123
+ margin-top: 25px;
1124
+ }
1125
+
1126
+ .back-to-layout-button {
1127
+ margin-top: 15px;
1128
+ }
1129
+
1130
+ .empty-collection-part {
1131
+ width: 220px;
1132
+ }
1133
+
1134
+ .astra-sites-no-sites .arrow-img,
1135
+ .astra-sites-no-favorites .arrow-img {
1136
+ width: 56px;
1137
+ margin-bottom: 1em;
1138
+ transform: rotate(-18deg);
1139
+ }
1140
+
1141
+ .astra-sites-no-sites .content,
1142
+ .astra-sites-no-favorites .content {
1143
+ display: flex;
1144
+ align-items: center;
1145
+ }
1146
+
1147
+ .astra-sites-no-sites .description,
1148
+ .astra-sites-no-favorites .description {
1149
+ margin-left: 3em;
1150
+ }
1151
+
1152
+ .astra-sites-no-sites .inner,
1153
+ .astra-sites-no-favorites .inner {
1154
+ margin: 0 auto;
1155
+ width: 610px;
1156
+ }
1157
+
1158
+ /**
1159
+ * Welcome Screen
1160
+ */
1161
+ .astra-sites-welcome {
1162
+ position: relative;
1163
+ max-height: 100vh;
1164
+ height: calc( 100vh - 32px );
1165
+ }
1166
+ .appearance_page_starter-templates.astra-sites-change-page-builder #wpbody-content {
1167
+ padding: 0;
1168
+ }
1169
+ .astra-sites-welcome a {
1170
+ text-decoration: none;
1171
+ }
1172
+ .astra-sites-welcome a:focus,
1173
+ .astra-sites-welcome a {
1174
+ outline: none;
1175
+ box-shadow: none;
1176
+ }
1177
+ .astra-sites-welcome .header img {
1178
+ width: 30px;
1179
+ }
1180
+ .astra-sites-welcome .logo {
1181
+ display: flex;
1182
+ align-items: center;
1183
+ cursor: default;
1184
+ }
1185
+ .astra-sites-welcome .close {
1186
+ position: absolute;
1187
+ right: 0;
1188
+ top: 0;
1189
+ bottom: 0;
1190
+ width: 20px;
1191
+ text-align: center;
1192
+ padding: 15px;
1193
+ cursor: pointer;
1194
+ border-left: 1px solid #eee;
1195
+ color: #aaa;
1196
+ }
1197
+
1198
+ .astra-sites-welcome .close:hover {
1199
+ color: #0073aa;
1200
+ }
1201
+
1202
+ .astra-sites-welcome .close .dashicons {
1203
+ height: auto;
1204
+ width: auto;
1205
+ vertical-align: middle;
1206
+ font-size: 22px;
1207
+ }
1208
+
1209
+ .astra-sites-welcome .header {
1210
+ text-align: left;
1211
+ padding: 10px 15px;
1212
+ display: flex;
1213
+ align-items: center;
1214
+ border-bottom: 1px solid #e5e5e5;
1215
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
1216
+ justify-content: space-between;
1217
+ position: relative;
1218
+ }
1219
+ .astra-sites-welcome .header .title {
1220
+ margin: 0 0 0 10px;
1221
+ font-size: 13px;
1222
+ text-transform: uppercase;
1223
+ }
1224
+ .ast-importing-wrap {
1225
+ display: none;
1226
+ }
1227
+ .astra-sites-welcome .inner-wrap {
1228
+ position: absolute;
1229
+ left: 50%;
1230
+ top: 40%;
1231
+ transform: translate(-50%, -40%);
1232
+ border-radius: 2px;
1233
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
1234
+ border: 1px solid #e5e5e5;
1235
+ overflow: hidden;
1236
+ }
1237
+ .astra-sites-welcome .inner {
1238
+ vertical-align: middle;
1239
+ margin: 0 auto;
1240
+ display: inline-block;
1241
+ width: 750px;
1242
+ background: #fff;
1243
+ text-align: center;
1244
+ }
1245
+
1246
+ .astra-sites-welcome h1 {
1247
+ margin-top: 0;
1248
+ font-size: 2em;
1249
+ margin-bottom: 1em;
1250
+ }
1251
+
1252
+ .astra-sites-welcome p {
1253
+ font-size: 14px;
1254
+ }
1255
+
1256
+ #astra-sites-welcome-form {
1257
+ padding: 6em 4em 2em 4em;
1258
+ }
1259
+
1260
+ .astra-sites-welcome select {
1261
+ padding: 5px;
1262
+ height: 100%;
1263
+ }
1264
+
1265
+ .astra-sites-welcome .submit {
1266
+ text-align: center;
1267
+ margin: 0;
1268
+ padding: 0;
1269
+ margin-left: .5em;
1270
+ }
1271
+
1272
+ .astra-sites-welcome .disabled {
1273
+ pointer-events: none;
1274
+ }
1275
+
1276
+ .astra-site-page-builder {
1277
+ opacity: 0;
1278
+ visibility: hidden;
1279
+ }
1280
+
1281
+ .required-plugins-list,
1282
+ .astra-sites-third-party-required-plugins {
1283
+ margin-left: 16px;
1284
+ margin-top: .5em;
1285
+ margin-bottom: .5em;
1286
+ list-style-type: disc;
1287
+ }
1288
+
1289
+ .astra-sites-tooltip-message {
1290
+ margin-left: 24px;
1291
+ }
1292
+
1293
+ .astra-sites-third-party-required-plugins .plugin-card,
1294
+ .required-plugins-list .plugin-card {
1295
+ background: transparent;
1296
+ border: none;
1297
+ margin: 0;
1298
+ line-height: 2;
1299
+ float: none;
1300
+ width: 100%;
1301
+ }
1302
+
1303
+ .required-plugins-list .spinner {
1304
+ float: none;
1305
+ margin: 0;
1306
+ }
1307
+
1308
+ .astra-site-import-process-wrap {
1309
+ display: flex;
1310
+ align-items: center;
1311
+ margin-top: -2px;
1312
+ z-index: 999999;
1313
+ position: relative;
1314
+ overflow: hidden;
1315
+ }
1316
+
1317
+ .astra-sites-result-preview .astra-site-import-process-wrap progress {
1318
+ background: #eeeeee;
1319
+ }
1320
+
1321
+ .astra-sites-result-preview .astra-site-import-process-wrap progress::-webkit-progress-value {
1322
+ background: #0185ba;
1323
+ }
1324
+
1325
+ .astra-site-import-process-wrap progress {
1326
+ padding: 0px;
1327
+ border: 0 none;
1328
+ background: #0085bd;
1329
+ border-radius: 5px;
1330
+ height: 4px;
1331
+ flex: 1;
1332
+ }
1333
+
1334
+ .astra-sites-result-preview .dashicons {
1335
+ font-size: 1rem;
1336
+ height: auto;
1337
+ vertical-align: middle;
1338
+ }
1339
+
1340
+ .astra-site-import-process-wrap progress::-webkit-progress-value {
1341
+ background: #00679b;
1342
+ }
1343
+
1344
+ .astra-site-import-process-wrap progress::-webkit-progress-bar {
1345
+ background: transparent;
1346
+ }
1347
+
1348
+ .theme-browser .theme .theme-screenshot {
1349
+ filter: blur(0);
1350
+ transition: filter 400ms linear;
1351
+ }
1352
+ .theme-browser .theme .site-preview > .theme-screenshot {
1353
+ background-position: center top;
1354
+ background-size: 100%;
1355
+ background-repeat: no-repeat;
1356
+ border-top-left-radius: 2px;
1357
+ border-top-right-radius: 2px;
1358
+ overflow: hidden;
1359
+ background-color: #e5e5e5;
1360
+ }
1361
+
1362
+ .astra-sites-tooltip-icon {
1363
+ cursor: pointer;
1364
+ }
1365
+
1366
+ .astra-sites-preview .disabled {
1367
+ pointer-events: none;
1368
+ }
1369
+
1370
+ .astra-sites-preview input[type="checkbox"].disabled {
1371
+ background: #eeeeee;
1372
+ opacity: 1;
1373
+ color: #fff;
1374
+ box-shadow: none;
1375
+ border-color: #b4b9be;
1376
+ }
1377
+
1378
+ .astra-sites-tooltip-icon .dashicons {
1379
+ color: #757575;
1380
+ font-size: 15px;
1381
+ vertical-align: middle;
1382
+ height: auto;
1383
+ }
1384
+ #astra-sites-admin {
1385
+ margin-right: 25px;
1386
+ margin-left: 25px;
1387
+ margin-top: 45px;
1388
+ }
1389
+ .astra-previewing-single-pages #wpfooter {
1390
+ display: none;
1391
+ }
1392
+
1393
+ .astra-previewing-single-pages #astra-sites-admin {
1394
+ margin-top: 58px;
1395
+ }
1396
+
1397
+ #astra-sites-welcome-form-inline select {
1398
+ text-align-last: right;
1399
+ }
1400
+
1401
+ #astra-sites-welcome-form-inline option {
1402
+ direction: rtl;
1403
+ }
1404
+ #astra-sites-admin .filter-links li > a:first-child {
1405
+ margin-left: 0;
1406
+ }
1407
+ #astra-sites-welcome-form-inline {
1408
+ margin-left: 0;
1409
+ border-radius: 3px;
1410
+ padding: 0px 5px 2px 5px;
1411
+ outline: 2px solid transparent;
1412
+ outline-offset: 0;
1413
+ background: #ffffff;
1414
+ color: #72777c;
1415
+ font-weight: normal;
1416
+ font-size: 13px;
1417
+ line-height: 26px;
1418
+ height: 28px;
1419
+ cursor: pointer;
1420
+ }
1421
+
1422
+ #astra-sites-welcome-form-inline select,
1423
+ #astra-sites-welcome-form-inline select:focus {
1424
+ border: none;
1425
+ outline: none;
1426
+ box-shadow: none;
1427
+ color: #72777c;
1428
+ }
1429
+
1430
+ #astra-sites-menu-page .wp-full-overlay-main:before {
1431
+ content: '';
1432
+ display: none;
1433
+ }
1434
+
1435
+ .theme-screenshot-wrap {
1436
+ overflow: hidden;
1437
+ max-height: 300px;
1438
+ margin: 15px 0;
1439
+ border: 1px solid #ccc;
1440
+ }
1441
+
1442
+ .astra-sites-preview .install-theme-info .theme-screenshot {
1443
+ width: 100%;
1444
+ border: none;
1445
+ margin: 0;
1446
+ }
1447
+
1448
+ #astra-sites-welcome-form .title {
1449
+ font-size: 14px;
1450
+ font-weight: 500;
1451
+ margin-top: 5px;
1452
+ }
1453
+
1454
+ #astra-sites-welcome-form #submit {
1455
+ padding: 0em 4rem;
1456
+ }
1457
+
1458
+ .page-builders {
1459
+ margin: 35px 0;
1460
+ }
1461
+
1462
+ .page-builders li {
1463
+ cursor: pointer;
1464
+ display: inline-block;
1465
+ padding: 1.2em;
1466
+ }
1467
+
1468
+ .page-builders [type=radio] {
1469
+ position: absolute;
1470
+ opacity: 0;
1471
+ width: 0;
1472
+ height: 0;
1473
+ }
1474
+
1475
+ .page-builders [type=radio] + img.active,
1476
+ .page-builders [type=radio] + img:hover {
1477
+ transform: translateY(-1px);
1478
+ box-shadow: 0 2px 6px rgba(0, 115, 170, 0.18);
1479
+ border-color: #0073aa;
1480
+ }
1481
+
1482
+ .page-builders [type=radio] + img {
1483
+ cursor: pointer;
1484
+ border: 1px solid #dcdcdc;
1485
+ border-radius: 4px;
1486
+ transition: all linear 0.2s;
1487
+ height: 100px;
1488
+ padding: 6px;
1489
+ }
1490
+
1491
+ .astra-demo-import.button.updating-message:before,
1492
+ .astra-demo-import.button.installing:before {
1493
+ vertical-align: text-top;
1494
+ margin: 0 5px 0 0;
1495
+ }
1496
+
1497
+ .current-importing-status-wrap hr {
1498
+ border-color: #f1f1f1;
1499
+ }
1500
+
1501
+ .astra-sites-result-preview {
1502
+ position: absolute;
1503
+ left: 0;
1504
+ right: 0;
1505
+ top: 0;
1506
+ bottom: 0;
1507
+ background: transparent;
1508
+ overflow-y: auto;
1509
+ }
1510
+
1511
+ .astra-sites-result-preview .button {
1512
+ margin-top: 1em;
1513
+ }
1514
+
1515
+ .preview-page-from-search-result #astra-sites-tooltip-plugins-settings,
1516
+ .astra-sites-page-import-popup #astra-sites-tooltip-plugins-settings {
1517
+ display: block !important;
1518
+ }
1519
+
1520
+ .astra-sites-result-preview h3 {
1521
+ font-size: 1.3em;
1522
+ margin: 0;
1523
+ }
1524
+ .astra-sites-result-preview .heading {
1525
+ background: #ffffff;
1526
+ padding: 16px 35px;
1527
+ margin-top: 0;
1528
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
1529
+ margin-bottom: 10px;
1530
+ display: flex;
1531
+ justify-content: space-between;
1532
+ }
1533
+ .astra-sites-result-preview .close {
1534
+ position: absolute;
1535
+ right: 0;
1536
+ top: 0;
1537
+ bottom: 0;
1538
+ height: 53px;
1539
+ line-height: 53px;
1540
+ width: 53px;
1541
+ cursor: pointer;
1542
+ border-left: 1px solid #eee;
1543
+ color: #aaa;
1544
+ font-size: 22px;
1545
+ opacity: 1;
1546
+ visibility: visible;
1547
+ }
1548
+ .astra-sites-result-preview .close:hover {
1549
+ color: #0073aa;
1550
+ }
1551
+ .astra-sites-result-preview .overlay {
1552
+ background: rgba(0, 0, 0, 0.7);
1553
+ filter: alpha(opacity=70);
1554
+ position: fixed;
1555
+ top: 0;
1556
+ right: 0;
1557
+ bottom: 0;
1558
+ left: 0;
1559
+ z-index: 100050;
1560
+ }
1561
+ .astra-sites-result-preview .inner {
1562
+ margin: 0 auto;
1563
+ width: 660px;
1564
+ max-height: 420px;
1565
+ -webkit-transform: translate(-50%, -50%);
1566
+ -ms-transform: translate(-50%, -50%);
1567
+ transform: translate(-50%, -50%);
1568
+ -webkit-box-sizing: border-box;
1569
+ -moz-box-sizing: border-box;
1570
+ box-sizing: border-box;
1571
+ position: fixed;
1572
+ background-color: #f1f3f5;
1573
+ z-index: 100059;
1574
+ text-align: left;
1575
+ top: 50%;
1576
+ left: 50%;
1577
+ -webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
1578
+ box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
1579
+ border-radius: 2px;
1580
+ }
1581
+ .astra-sites-result-preview .button {
1582
+ line-height: 40px;
1583
+ }
1584
+
1585
+ #single-pages .astra-theme {
1586
+ padding: 0;
1587
+ }
1588
+
1589
+ .astra-sites-import-content > p:first-child,
1590
+ .ast-importing-wrap > p:first-child {
1591
+ margin-top: 0;
1592
+ }
1593
+
1594
+ .current-importing-status {
1595
+ background: #fff;
1596
+ padding: 1.3em;
1597
+ }
1598
+
1599
+ .current-importing-status ul {
1600
+ list-style-type: disc;
1601
+ margin: 1em 0em 0em 2em;
1602
+ }
1603
+
1604
+ .appearance_page_starter-templates .rotating {
1605
+ height: auto;
1606
+ animation: rotation 2s infinite linear;
1607
+ width: auto;
1608
+ color: #c1c1c1;
1609
+ }
1610
+
1611
+ .agency-ribbons {
1612
+ color: #000;
1613
+ text-align: center;
1614
+ display: flex;
1615
+ align-items: center;
1616
+ position: absolute;
1617
+ z-index: 9;
1618
+ top: -7px;
1619
+ text-transform: uppercase;
1620
+ font-weight: 600;
1621
+ font-size: 9.5px;
1622
+ letter-spacing: 0.2px;
1623
+ right: -7px;
1624
+ border-radius: 2px;
1625
+ line-height: 15px;
1626
+ padding: 4px 7px;
1627
+ background-color: #FCAF2A;
1628
+ cursor: default;
1629
+
1630
+ }
1631
+
1632
+ .premium-crown-icon {
1633
+ height: auto;
1634
+ width: 17px;
1635
+ margin-right: 5px;
1636
+ }
1637
+
1638
+ .theme-browser .theme:hover .theme-actions,
1639
+ .theme-browser .theme.focus .theme-actions,
1640
+ .theme-browser .theme:focus .theme-actions {
1641
+ opacity: 0;
1642
+ }
1643
+
1644
+ .theme-browser .theme .theme-screenshot:after {
1645
+ padding-top: 118%;
1646
+ }
1647
+
1648
+ @-webkit-keyframes rotation {
1649
+ from {
1650
+ -webkit-transform: rotate(0deg);
1651
+ }
1652
+ to {
1653
+ -webkit-transform: rotate(359deg);
1654
+ }
1655
+ }
1656
+ .import-time {
1657
+ display: inline-block;
1658
+ background: #0185ba;
1659
+ color: #fff;
1660
+ padding: 2px 10px;
1661
+ border-radius: 3px;
1662
+ animation: astra-scale 0.5s alternate infinite ease-in;
1663
+ }
1664
+
1665
+ .theme-browser .theme:hover .theme-actions,
1666
+ .theme-browser .theme.focus .theme-actions,
1667
+ .theme-browser .theme:focus .theme-actions {
1668
+ opacity: 0;
1669
+ }
1670
+ @keyframes astra-scale {
1671
+ 0% {transform: scale(1);}
1672
+ 100% {transform: scale(1.03);}
1673
+ }
1674
+
1675
+ .current-importing-status p {
1676
+ margin: 0;
1677
+ }
1678
+
1679
+ @media (min-width: 960px) and (max-width: 1020px) {
1680
+ #astra-sites-admin .theme-action-wrap {
1681
+ padding: 5px;
1682
+ width: 100%;
1683
+ }
1684
+ }
1685
+
1686
+ @media (min-width: 781px) and (max-width: 920px) {
1687
+ #astra-sites-admin .theme-action-wrap {
1688
+ padding: 5px;
1689
+ width: 100%;
1690
+ }
1691
+ .theme-browser .theme .theme-actions button:first-child {
1692
+ margin-bottom: 5px;
1693
+ }
1694
+ }
1695
+
1696
+ .theme-browser .theme .site-preview > .theme-screenshot.two:hover,
1697
+ .theme-browser .theme .site-preview > .theme-screenshot.three:hover {
1698
+ background-position: center top;
1699
+ }
1700
+
1701
+ .theme-browser .theme .theme-screenshot.two,
1702
+ .theme-browser .theme .theme-screenshot.three {
1703
+ position: absolute;
1704
+ top: 0;
1705
+ right: 0;
1706
+ left: 0px;
1707
+ }
1708
+
1709
+ .theme-browser .theme .theme-screenshot.two {
1710
+ width: calc(100% - 10px);
1711
+ opacity: .8;
1712
+ left: 0px;
1713
+ transform: translate(5px, -5px);
1714
+ }
1715
+
1716
+ .theme-browser .theme .theme-screenshot.three {
1717
+ width: calc(100% - 20px);
1718
+ opacity: .4;
1719
+ transform: translate(10px, -10px);
1720
+ }
1721
+
1722
+ .theme-browser .theme {
1723
+ box-shadow: 0 1px 7px 0 rgba(0, 0, 0, 0.08);
1724
+ margin: 0 3% 3.6% 0;
1725
+ border: none;
1726
+ }
1727
+
1728
+ .single-site {
1729
+ display: flex;
1730
+ }
1731
+
1732
+ .single-site-pages {
1733
+ overflow-y: auto;
1734
+ height: 100vh;
1735
+ max-height: calc(100vh - 280px);
1736
+ }
1737
+
1738
+ .single-site-pages::-webkit-scrollbar {
1739
+ width: 5px;
1740
+ background-color: #f1f1f1;
1741
+ }
1742
+
1743
+ .single-site-pages::-webkit-scrollbar-thumb {
1744
+ border-radius: 0;
1745
+ background-color: #d8d8d8;
1746
+ }
1747
+
1748
+ .single-site-pages::-webkit-scrollbar-track {
1749
+ -webkit-box-shadow: inset 0 0 0 rgba(0,0,0,.3);
1750
+ width: 20px;
1751
+ }
1752
+
1753
+
1754
+ .astra-sites-import-content::-webkit-scrollbar,
1755
+ .single-site-preview::-webkit-scrollbar {
1756
+ width: 5px;
1757
+ background-color: #f1f1f1;
1758
+ }
1759
+
1760
+ .astra-sites-import-content::-webkit-scrollbar-thumb,
1761
+ .single-site-preview::-webkit-scrollbar-thumb {
1762
+ border-radius: 0;
1763
+ background-color: #d8d8d8;
1764
+ }
1765
+
1766
+ .astra-sites-import-content::-webkit-scrollbar-track,
1767
+ .single-site-preview::-webkit-scrollbar-track {
1768
+ -webkit-box-shadow: inset 0 0 0 rgba(0,0,0,.3);
1769
+ width: 20px;
1770
+ }
1771
+
1772
+ .single-site-preview {
1773
+ margin-right: 4em;
1774
+ max-height: calc(100vh - 280px);
1775
+ height: 100vh;
1776
+ overflow-y: auto;
1777
+ border-radius: 2px;
1778
+ box-shadow: 0 0 16px 0 rgba(0, 0, 0, 0.12);
1779
+ }
1780
+
1781
+ .single-site-preview img {
1782
+ width: 100%;
1783
+ vertical-align: middle;
1784
+ }
1785
+
1786
+ #astra-sites-menu-page .nav-tab-wrapper.stick {
1787
+ position: fixed;
1788
+ left: 0;
1789
+ right: 0;
1790
+ }
1791
+
1792
+ .single-site-footer {
1793
+ position: fixed;
1794
+ padding: 15px 50px 15px 35px;
1795
+ bottom: 0;
1796
+ background: #fff;
1797
+ right: 0;
1798
+ left: 0;
1799
+ z-index: 88;
1800
+ box-shadow: 0 -2px 8px rgb(0 0 0 / 5%);
1801
+ }
1802
+
1803
+ .site-action-buttons-wrap {
1804
+ display: flex;
1805
+ justify-content: center;
1806
+ }
1807
+
1808
+ .site-action-buttons-wrap .site-preview-button {
1809
+ margin-right: 5px;
1810
+ }
1811
+
1812
+ .single-site-pages-header {
1813
+ display: flex;
1814
+ justify-content: space-between;
1815
+ align-items: center;
1816
+ margin: 0 0 32px 0;
1817
+ }
1818
+
1819
+ .astra-site-title {
1820
+ margin: 0;
1821
+ }
1822
+
1823
+ .astra-pages-title-wrap {
1824
+ margin: 0 0 30px 0;
1825
+ display: flex;
1826
+ justify-content: space-between;
1827
+ }
1828
+
1829
+ .single-site-preview-wrap {
1830
+ width: 55%;
1831
+ }
1832
+
1833
+ .single-site-pages-wrap {
1834
+ width: 45%;
1835
+ }
1836
+
1837
+ @media only screen and (min-width: 768px) {
1838
+ #site-pages {
1839
+ padding: 0 0 0 24px;
1840
+ }
1841
+ }
1842
+
1843
+ /**
1844
+ * 3 Grid for Pages
1845
+ */
1846
+ @media only screen and (min-width: 1640px) {
1847
+ .theme-browser #site-pages .theme {
1848
+ width: 31.06%;
1849
+ margin: 0 3% 3% 0;
1850
+ }
1851
+ }
1852
+
1853
+ @media only screen and (min-width: 1640px) {
1854
+ .theme-browser #site-pages .theme:nth-child(3n) {
1855
+ margin-right: 0;
1856
+ }
1857
+ }
1858
+ #single-pages .astra-theme {
1859
+ border: none;
1860
+ }
1861
+
1862
+ #single-pages .current_page .inner {
1863
+ border-color: #5b9dd9;
1864
+ border-radius: 2px;
1865
+ }
1866
+ .theme-browser #site-pages .theme {
1867
+ margin: 0 3.4% 3.4% 0;
1868
+ border-radius: 2px;
1869
+ border: none;
1870
+ box-shadow: none;
1871
+ }
1872
+ .theme-browser #single-pages .site-single .theme-screenshot:after {
1873
+ padding-top: 100%;
1874
+ }
1875
+
1876
+ .site-action-buttons-wrap .dashicons {
1877
+ vertical-align: middle;
1878
+ font-size: 1rem;
1879
+ margin-left: .2em;
1880
+ }
1881
+
1882
+ .single-site-footer .dashicons-editor-help {
1883
+ font-size: 20px;
1884
+ color: #555d66;
1885
+ margin-left: 10px;
1886
+ }
1887
+ .site-action-buttons-right {
1888
+ display: flex;
1889
+ align-items: center;
1890
+ }
1891
+ .astra-sites-result-preview.astra-sites-import-complete .inner {
1892
+ overflow: hidden;
1893
+ height: auto;
1894
+ }
1895
+
1896
+ .site-action-buttons-wrap .button.button-primary.button-hero {
1897
+ box-shadow: none;
1898
+ }
1899
+ .wp-core-ui .astra-sites-result-preview .button.button-hero,
1900
+ .wp-core-ui .astra-sites-result-preview .button.button-hero:focus,
1901
+ .site-action-buttons-wrap .button.button-hero,
1902
+ .site-action-buttons-wrap .button.button-hero:focus {
1903
+ font-size: 13px;
1904
+ height: 34px;
1905
+ min-height: 34px;
1906
+ line-height: 33px;
1907
+ padding: 0 20px;
1908
+ box-shadow: none;
1909
+ }
1910
+
1911
+ .astra-hide-site {
1912
+ display: none;
1913
+ }
1914
+
1915
+ .astra-sites-no-sites .button.astra-sites-back,
1916
+ .astra-sites-no-favorites .button.astra-sites-back {
1917
+ box-shadow: none;
1918
+ height: 30px;
1919
+ }
1920
+
1921
+ .astra-sites-no-sites h3 {
1922
+ font-size: 1.3rem;
1923
+ font-weight: normal;
1924
+ color: #666;
1925
+ margin-top: 0;
1926
+ }
1927
+
1928
+ .astra-sites-import-plugins .disabled {
1929
+ pointer-events: none;
1930
+ }
1931
+ .theme-browser .theme .site-preview > .theme-screenshot.loading,
1932
+ .theme-browser .theme .theme-screenshot.loading {
1933
+ animation-duration: 2s;
1934
+ animation-fill-mode: forwards;
1935
+ animation-iteration-count: infinite;
1936
+ animation-name: image-placeholder;
1937
+ animation-timing-function: linear;
1938
+ background: #f6f7f8;
1939
+ background: linear-gradient(to right, #fafafa 8%, #f4f4f4 38%, #fafafa 54%);
1940
+ position: relative;
1941
+ }
1942
+ @keyframes image-placeholder{
1943
+ 0%{
1944
+ background-position: -150px 0;
1945
+ }
1946
+ 100%{
1947
+ background-position: 150px 0;
1948
+ }
1949
+ }
1950
+ .searching .theme-browser .theme .theme-screenshot.loading {
1951
+ opacity: .5;
1952
+ }
1953
+ .searching .theme-browser .theme .theme-screenshot {
1954
+ filter: blur(0);
1955
+ }
1956
+ .inner {
1957
+ overflow: hidden;
1958
+ }
1959
+ .site-import-layout-button.disabled {
1960
+ pointer-events: none;
1961
+ }
1962
+
1963
+ .theme-browser .themes {
1964
+ clear: both;
1965
+ margin: -1%;
1966
+ }
1967
+
1968
+
1969
+ @media only screen and (min-width: 768px) {
1970
+ .theme-browser .theme {
1971
+ width: 25%;
1972
+ padding: 1.1%;
1973
+ margin: 0 0 1em 0em;
1974
+ box-shadow: none;
1975
+ }
1976
+ }
1977
+
1978
+ @media only screen and (min-width: 1640px) {
1979
+ .theme-browser .theme:nth-child(3n) {
1980
+ margin-right: 0;
1981
+ }
1982
+ .theme-browser .theme:nth-child(4n) {
1983
+ margin-right: 0;
1984
+ }
1985
+ }
1986
+
1987
+ #astra-sites-filters .search-form {
1988
+ position: relative;
1989
+ }
1990
+
1991
+ .filters-wrap-page-categories {
1992
+ position: absolute;
1993
+ background: #fff;
1994
+ padding: 10px;
1995
+ z-index: 999;
1996
+ border: 1px solid #ccc;
1997
+ border-top: none;
1998
+ right: 0;
1999
+ left: 0;
2000
+ margin: 0;
2001
+ visibility: hidden;
2002
+ opacity: 0;
2003
+ }
2004
+
2005
+ .filters-wrap-page-categories.show {
2006
+ visibility: visible;
2007
+ opacity: 1;
2008
+ }
2009
+
2010
+ .filters-wrap-page-categories .filter-links li {
2011
+ display: list-item;
2012
+ }
2013
+
2014
+ #astra-sites-admin .filter-links .current {
2015
+ border: none;
2016
+ }
2017
+
2018
+ .filters-wrap-page-categories .filter-links {
2019
+ display: block;
2020
+ }
2021
+
2022
+ .filters-wrap-page-categories .filter-links li > a {
2023
+ display: block;
2024
+ margin: 0 0 5px 5px;
2025
+ }
2026
+
2027
+ .page-builder-icon .page-builders {
2028
+ position: absolute;
2029
+ top: 100%;
2030
+ background: #fff;
2031
+ z-index: 10;
2032
+ margin: 0;
2033
+ border: 1px solid #ddd;
2034
+ opacity: 0;
2035
+ visibility: hidden;
2036
+ box-shadow: 0px 9px 21px 0px rgba(0, 0, 0, 0.2);
2037
+ border-bottom-left-radius: 3px;
2038
+ border-bottom-right-radius: 3px;
2039
+ left: -1px;
2040
+ right: 0px;
2041
+ }
2042
+ .page-builder-icon.active .page-builders {
2043
+ opacity: 1;
2044
+ visibility: visible;
2045
+ }
2046
+ .page-builder-icon .page-builders img {
2047
+ height: 17px;
2048
+ width: 17px;
2049
+ border-radius: 50%;
2050
+ margin-right: 10px;
2051
+ }
2052
+
2053
+ .page-builder-icon .page-builders li {
2054
+ display: flex;
2055
+ padding: 10px 15px;
2056
+ margin: 0;
2057
+ }
2058
+
2059
+ .page-builder-icon {
2060
+ display: inline-block;
2061
+ font-size: 12px;
2062
+ padding: 23px 10px;
2063
+ width: 164px;
2064
+ position: relative;
2065
+ cursor: pointer;
2066
+ }
2067
+
2068
+ .page-builder-icon img {
2069
+ height: auto;
2070
+ width: 22px;
2071
+ border-radius: 50%;
2072
+ margin-right: 8px;
2073
+ }
2074
+
2075
+ .selected-page-builder {
2076
+ display: flex;
2077
+ justify-content: center;
2078
+ align-items: center;
2079
+ }
2080
+
2081
+ .selected-page-builder .dashicons {
2082
+ margin-left: 2px;
2083
+ }
2084
+
2085
+ .page-builder-icon .page-builders .active,
2086
+ .page-builder-icon .page-builders li:hover {
2087
+ background-color: #f7f7f7;
2088
+ }
2089
+
2090
+ .appearance_page_starter-templates .astra-sites-sync-library-message {
2091
+ margin-left: 25px;
2092
+ margin-right: 25px;
2093
+ }
2094
+
2095
+ .astra-sites-sync-library-message.notice .notice-dismiss:before {
2096
+ font-size: 14px;
2097
+ }
2098
+
2099
+ .astra-loading-wrap {
2100
+ position: absolute;
2101
+ left: 50%;
2102
+ top: 50%;
2103
+ transform: translate(-60%, -60%);
2104
+ }
2105
+
2106
+ .ast-retry-text {
2107
+ position: absolute;
2108
+ left: 50%;
2109
+ top: 60%;
2110
+ transform: translate(-50%, -50%);
2111
+ }
2112
+
2113
+ .astra-previewing-single-pages #wpbody-content {
2114
+ position: fixed;
2115
+ }
2116
+
2117
+ .appearance_page_starter-templates div#setting-error-tgmpa,
2118
+ .appearance_page_starter-templates .update-nag,
2119
+ .appearance_page_starter-templates .notice,
2120
+ .appearance_page_starter-templates div.error {
2121
+ display: none;
2122
+ }
2123
+
2124
+ .appearance_page_starter-templates .astra-sites-notice {
2125
+ display: block;
2126
+ top: 20px;
2127
+ position: relative;
2128
+ }
2129
+
2130
+ .astra-previewing-single-pages .astra-sites-menu-page-wrapper > .notice.astra-sites-sync-library-message.success,
2131
+ .astra-previewing-single-pages .astra-sites-menu-page-wrapper > .notice.astra-sites-sync-library-message.notice-success {
2132
+ display: none !important;
2133
+ }
2134
+
2135
+ .astra-previewing-single-pages .astra-sites-menu-page-wrapper > .notice.astra-sites-sync-library-message {
2136
+
2137
+ width: calc( 100% - 250px );
2138
+ }
2139
+
2140
+ .astra-previewing-single-pages.folded #wpbody-content > .notice.astra-sites-sync-library-message {
2141
+ width: calc( 100% - 150px );
2142
+ }
2143
+
2144
+ .appearance_page_starter-templates.astra-previewing-single-pages #wpbody-content {
2145
+ padding-top: 0;
2146
+ }
2147
+
2148
+ .astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-message,
2149
+ .astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-start-message {
2150
+ display: inline-block !important;
2151
+ top: 90px;
2152
+ right: 0;
2153
+ width: calc( 100% - 260px ) !important;
2154
+ }
2155
+
2156
+ .folded.astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-message,
2157
+ .folded.astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-start-message {
2158
+ width: calc( 100% - 140px ) !important;
2159
+ }
2160
+
2161
+ .appearance_page_starter-templates #wpcontent {
2162
+ padding-left: 0;
2163
+ }
2164
+
2165
+ .appearance_page_starter-templates.auto-fold #wpcontent {
2166
+ padding-left: 0;
2167
+ }
2168
+
2169
+ .pages-count,
2170
+ .page-title {
2171
+ font-weight: 300;
2172
+ font-size: 13px;
2173
+ display: none;
2174
+ }
2175
+
2176
+ .site-pages-not-import-notice {
2177
+ clear: both;
2178
+ }
2179
+
2180
+ .astra-loading-icon,
2181
+ .astra-loading-icon:after {
2182
+ border-radius: 50%;
2183
+ width: 20px;
2184
+ height: 20px;
2185
+ }
2186
+ .astra-loading-icon {
2187
+ border-top: 3px solid rgb(192, 192, 192);
2188
+ border-right: 3px solid rgb(192, 192, 192);
2189
+ border-bottom: 3px solid rgb(192, 192, 192);
2190
+ border-left: 3px solid #0185ba;
2191
+ -webkit-transform: translateZ(0);
2192
+ -ms-transform: translateZ(0);
2193
+ transform: translateZ(0);
2194
+ -webkit-animation: load8 1.1s infinite linear;
2195
+ animation: load8 1.1s infinite linear;
2196
+ }
2197
+ @-webkit-keyframes load8 {
2198
+ 0% {
2199
+ -webkit-transform: rotate(0deg);
2200
+ transform: rotate(0deg);
2201
+ }
2202
+ 100% {
2203
+ -webkit-transform: rotate(360deg);
2204
+ transform: rotate(360deg);
2205
+ }
2206
+ }
2207
+ @keyframes load8 {
2208
+ 0% {
2209
+ -webkit-transform: rotate(0deg);
2210
+ transform: rotate(0deg);
2211
+ }
2212
+ 100% {
2213
+ -webkit-transform: rotate(360deg);
2214
+ transform: rotate(360deg);
2215
+ }
2216
+ }
2217
+
2218
+ .preparing .install-theme-info {
2219
+ display: none !important;
2220
+ }
2221
+
2222
+ #astra-sites.temp .placeholder-site .theme-id-container .title {
2223
+ background: #f1f1f1;
2224
+ }
2225
+
2226
+ #astra-sites.temp .placeholder-site .theme-id-container .site-title {
2227
+ color: transparent;
2228
+ }
2229
+
2230
+ .ast-sites__filter-wrap-checkbox input[type="radio"].active:before {
2231
+ content: "";
2232
+ border-radius: 50%;
2233
+ width: 0.5rem;
2234
+ height: 0.5rem;
2235
+ margin: 0.1875rem;
2236
+ background-color: #1e8cbe;
2237
+ line-height: 1.14285714;
2238
+ float: left;
2239
+ display: inline-block;
2240
+ vertical-align: middle;
2241
+ speak: none;
2242
+ -webkit-font-smoothing: antialiased;
2243
+ -moz-osx-font-smoothing: grayscale;
2244
+ }
2245
+
2246
+ @media screen and (min-width: 783px and max-width: 1180px) {
2247
+
2248
+ #astra-sites-filters .search-form {
2249
+ width: 100%;
2250
+ }
2251
+ #astra-sites .theme {
2252
+ width: 50%;
2253
+ }
2254
+
2255
+ #astra-sites .theme:nth-child(odd) {
2256
+ margin: 0;
2257
+ }
2258
+ .theme-browser #site-pages .theme {
2259
+ width: 46%;
2260
+ }
2261
+ }
2262
+ @media screen and (max-width: 782px) {
2263
+ .ast-sites__filter-wrap-checkbox input[type="radio"] {
2264
+ height: 1rem;
2265
+ width: 1rem;
2266
+ }
2267
+ .ast-sites__filter-wrap-checkbox input[type="radio"]:checked:before {
2268
+ margin: .25rem;
2269
+ height: 0.4rem;
2270
+ width: 0.4rem;
2271
+ }
2272
+
2273
+ .page-builder-title {
2274
+ display: none;
2275
+ }
2276
+
2277
+ .page-builder-icon {
2278
+ width: 100px;
2279
+ }
2280
+
2281
+ .page-builder-icon .page-builders {
2282
+ width: 140px;
2283
+ margin-left: -20px;
2284
+ }
2285
+ .single-site-footer {
2286
+ margin-left: 0;
2287
+ }
2288
+ }
2289
+ @media only screen and (max-width: 768px) {
2290
+ .astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-message,
2291
+ .astra-previewing-single-pages #wpbody-content > .notice.astra-sites-sync-library-start-message {
2292
+ top: 0;
2293
+ width: auto !important;
2294
+ }
2295
+ }
2296
+ @media only screen and (max-width: 767px) {
2297
+ .appearance_page_starter-templates #wpbody-content {
2298
+ padding-top: 0;
2299
+ }
2300
+
2301
+ #astra-sites-menu-page .nav-tab-wrapper .logo {
2302
+ padding: 10px;
2303
+ }
2304
+
2305
+ .back-to-layout {
2306
+ padding: 20px 5px;
2307
+ }
2308
+
2309
+ }
2310
+ @media only screen and (max-width: 1120px) {
2311
+ .theme-browser .theme:nth-child(odd) {
2312
+ margin-right: 0;
2313
+ }
2314
+ }
2315
+ @media only screen and (min-width: 780px) and (max-width: 1200px) {
2316
+ .theme-browser .theme:nth-child(odd) {
2317
+ margin-right: 0;
2318
+ }
2319
+ .theme-browser .theme {
2320
+ width: 33.33%;
2321
+ }
2322
+ }
2323
+
2324
+ @media only screen and (min-width: 1200px) {
2325
+ #astra-sites-filters .search-form {
2326
+ width: 600px;
2327
+ margin: 0 auto;
2328
+ }
2329
+ }
2330
+ @media only screen and (min-width: 1000px) and (max-width: 1200px) {
2331
+ .theme-browser #site-pages .theme:nth-child(3n) {
2332
+ margin-right: 0;
2333
+ }
2334
+
2335
+ .theme-browser #site-pages .theme {
2336
+ width: 30.33%;
2337
+ }
2338
+ }
2339
+
2340
+ @media only screen and (min-width: 780px) and (max-width: 999px) {
2341
+ .theme-browser #site-pages .theme:nth-child(2n) {
2342
+ margin-right: 0;
2343
+ }
2344
+
2345
+ .theme-browser #site-pages .theme {
2346
+ width: 48%;
2347
+ }
2348
+ }
2349
+
2350
+ @media only screen and (max-width: 960px) {
2351
+ #site-pages {
2352
+ position: relative;
2353
+ margin: 0 70px 0 0;
2354
+ }
2355
+ }
2356
+ @media only screen and (max-width: 1200px) {
2357
+ .back-to-layout {
2358
+ margin-right: 20px;
2359
+ }
2360
+ }
2361
+ @media screen and (max-width: 600px) {
2362
+ #astra-sites-filters .search-form {
2363
+ width: auto;
2364
+ }
2365
+ }
2366
+ @media screen and (max-width: 782px) {
2367
+ #site-pages {
2368
+ margin: 0;
2369
+ }
2370
+ .theme-browser #site-pages .theme {
2371
+ width: 46%;
2372
+ }
2373
+ .single-site-footer {
2374
+ padding: 10px 20px;
2375
+ }
2376
+ .single-site {
2377
+ flex-direction: column;
2378
+ }
2379
+
2380
+ .single-site-preview-wrap {
2381
+ width: 100%;
2382
+ }
2383
+
2384
+ .single-site-preview {
2385
+ margin: 0;
2386
+ height: 40vh;
2387
+ }
2388
+
2389
+ .single-site-pages-wrap {
2390
+ width: 100%;
2391
+ margin-top: 3em;
2392
+ }
2393
+ }
2394
+
2395
+ .astra-sites__category-filter-items {
2396
+ z-index: 99;
2397
+ }
2398
+
2399
+ @media screen and (min-width: 481px) {
2400
+ .hide-on-desktop {
2401
+ display: none;
2402
+ }
2403
+ .astra-sites__category-filter-items {
2404
+ z-index: 99;
2405
+ }
2406
+ }
2407
+ @media screen and (max-width: 480px) {
2408
+ #astra-sites-admin .astra-sites-popup .inner,
2409
+ .astra-sites-result-preview .inner {
2410
+ width: 95%;
2411
+ }
2412
+ .single-site-footer .button {
2413
+ text-align: center;
2414
+ width: 100%;
2415
+ }
2416
+ .single-site-pages {
2417
+ overflow: initial;
2418
+ }
2419
+
2420
+ #astra-sites-filters.hide-on-desktop {
2421
+ box-shadow: 25px 0 30px rgba(28, 39, 60, 0.09);
2422
+ border-bottom: 1px solid #dddddd;
2423
+ background: #fff;
2424
+ padding: 10px;
2425
+ }
2426
+
2427
+ #astra-sites-menu-page .form {
2428
+ flex: 1;
2429
+ }
2430
+
2431
+ .favorite-filters-wrap {
2432
+ flex: 1;
2433
+ text-align: right;
2434
+ padding: 5px 10px;
2435
+ }
2436
+
2437
+ .back-to-layout {padding: 13px 10px;}
2438
+
2439
+ .page-builder-icon {
2440
+ padding: 18px 8px 18px 15px;
2441
+ }
2442
+
2443
+ #astra-sites-menu-page .nav-tab-wrapper .logo {
2444
+ padding: 14px 10px;
2445
+ }
2446
+
2447
+ #astra-sites__category-filter .astra-sites__category-filter-anchor {
2448
+ width: 90px;
2449
+ }
2450
+
2451
+ .header-actions li > a {
2452
+ margin: 0 7px;
2453
+ }
2454
+
2455
+ .astra-previewing-single-pages #wpbody-content {
2456
+ position: relative;
2457
+ }
2458
+
2459
+ .astra-sites-no-sites .content, .astra-sites-no-favorites .content {
2460
+ flex-direction: column;
2461
+ }
2462
+
2463
+ .astra-sites-no-sites .inner, .astra-sites-no-favorites .inner {
2464
+ width: auto;
2465
+ }
2466
+
2467
+ .site-action-buttons-right {
2468
+ flex-direction: column;
2469
+ align-items: flex-start;
2470
+ }
2471
+
2472
+ .site-import-layout-button {
2473
+ margin-left: 0 !important;
2474
+ }
2475
+
2476
+ .astra-sites-no-sites .content, .astra-sites-no-favorites .content {
2477
+ flex-direction: column;
2478
+ }
2479
+
2480
+ .astra-sites-no-sites .inner, .astra-sites-no-favorites .inner {
2481
+ width: auto;
2482
+ }
2483
+
2484
+ .hide-on-mobile {
2485
+ display: none;
2486
+ }
2487
+ .astra-sites-logo-wrap {
2488
+ width: 30px;
2489
+ height: 30px;
2490
+ }
2491
+
2492
+ .header-actions li > a {
2493
+ margin: 0 5px;
2494
+ }
2495
+
2496
+ .page-builder-icon {
2497
+ width: auto;
2498
+ }
2499
+
2500
+ .page-builder-icon .page-builders {
2501
+ margin-left: -95%;
2502
+ }
2503
+
2504
+ .theme-browser .theme:nth-child(odd) {
2505
+ margin-right: 0;
2506
+ }
2507
+
2508
+ #astra-sites-admin {
2509
+ margin-top: 30px;
2510
+ margin-left: 20px;
2511
+ margin-right: 20px;
2512
+ }
2513
+ .appearance_page_starter-templates.auto-fold #wpcontent {
2514
+ padding-left: 0;
2515
+ }
2516
+
2517
+ .back-to-layout {
2518
+ margin-right: 10px;
2519
+ }
2520
+
2521
+ .single-site-footer {
2522
+ position: relative;
2523
+ }
2524
+
2525
+ #wpbody-content {
2526
+ padding-bottom: 30px;
2527
+ }
2528
+
2529
+ .site-action-buttons-wrap {
2530
+ flex-direction: column;
2531
+ }
2532
+
2533
+ .site-action-buttons-wrap > .button:first-child {
2534
+ margin-bottom: 5px;
2535
+ }
2536
+
2537
+ .appearance_page_starter-templates .astra-sites-sync-library-message {
2538
+ margin: 10px;
2539
+ }
2540
+ }
2541
+
2542
+ #astra-sites-filters .section-left {
2543
+ flex: 1;
2544
+ }
2545
+
2546
+ #astra-sites-filters .search-form {
2547
+ float: none;
2548
+ }
2549
+
2550
+ /**
2551
+ * Popup
2552
+ */
2553
+
2554
+ .ast-actioms-wrap {
2555
+ padding: 13px 35px 13px 35px;
2556
+ z-index: 30;
2557
+ box-sizing: border-box;
2558
+ border-top: 1px solid #dcdcdc;
2559
+ }
2560
+ .wp-core-ui .ast-actioms-wrap .button,
2561
+ .wp-core-ui .ast-actioms-wrap .button:focus {
2562
+ font-size: 13px;
2563
+ height: 36px;
2564
+ min-height: 36px;
2565
+ line-height: 34px;
2566
+ padding: 0 20px;
2567
+ box-shadow: none;
2568
+ }
2569
+ .ast-actioms-wrap .button {
2570
+ margin: 0;
2571
+ }
2572
+ .ast-actioms-wrap .button {
2573
+ margin-right: .5em;
2574
+ }
2575
+ .astra-site-contents > li {
2576
+ margin-bottom: 12px;
2577
+ }
2578
+
2579
+ .astra-sites-popup {
2580
+ position: absolute;
2581
+ left: 0;
2582
+ right: 0;
2583
+ top: 0;
2584
+ bottom: 0;
2585
+ background: #fff;
2586
+ overflow-y: auto;
2587
+ }
2588
+
2589
+ .astra-sites-popup .dashicons {
2590
+ vertical-align: middle;
2591
+ font-size: 1rem;
2592
+ }
2593
+ .astra-sites-popup .button {
2594
+ margin-top: 1em;
2595
+ }
2596
+
2597
+ .astra-sites-popup h3 {
2598
+ font-size: 1.4em;
2599
+ margin: 0;
2600
+ }
2601
+ .astra-sites-popup .heading {
2602
+ background: #ffffff;
2603
+ padding: 16px 35px;
2604
+ margin-top: 0;
2605
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
2606
+ margin-bottom: 10px;
2607
+ display: flex;
2608
+ justify-content: space-between;
2609
+ }
2610
+ .astra-sites-popup .close {
2611
+ position: absolute;
2612
+ right: 0;
2613
+ top: 0;
2614
+ bottom: 0;
2615
+ height: 53px;
2616
+ line-height: 53px;
2617
+ width: 53px;
2618
+ cursor: pointer;
2619
+ border-left: 1px solid #eee;
2620
+ color: #aaa;
2621
+ font-size: 21px;
2622
+ }
2623
+ .astra-sites-popup .close:hover {
2624
+ color: #444;
2625
+ }
2626
+ .astra-sites-popup .overlay {
2627
+ background: rgba(0, 0, 0, 0.7);
2628
+ filter: alpha(opacity=70);
2629
+ position: fixed;
2630
+ top: 0;
2631
+ right: 0;
2632
+ bottom: 0;
2633
+ left: 0;
2634
+ z-index: 100050;
2635
+ }
2636
+ .astra-sites-popup .inner {
2637
+ margin: 0 auto;
2638
+ width: 660px;
2639
+ max-height: 420px;
2640
+ -webkit-transform: translate(-50%, -50%);
2641
+ -ms-transform: translate(-50%, -50%);
2642
+ transform: translate(-50%, -50%);
2643
+ -webkit-box-sizing: border-box;
2644
+ -moz-box-sizing: border-box;
2645
+ box-sizing: border-box;
2646
+ position: fixed;
2647
+ background-color: #f3f3f3;
2648
+ z-index: 100059;
2649
+ text-align: left;
2650
+ top: 50%;
2651
+ left: 50%;
2652
+ -webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
2653
+ box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
2654
+ border-radius: 2px;
2655
+ }
2656
+ .astra-sites-popup .button {
2657
+ line-height: 40px;
2658
+ }
2659
+
2660
+ .ast-sites__search-title {
2661
+ padding: 0 1.1%;
2662
+ font-size: 18px;
2663
+ margin-bottom: 10px;
2664
+ }
2665
+
2666
+ .ast-sites__search-wrap {
2667
+ display:flex;
2668
+ flex-wrap: wrap;
2669
+ }
2670
+
2671
+ /**
2672
+ * License Form
2673
+ */
2674
+ #astra-pro-sites-license-form p:first-child {
2675
+ margin-top: 0;
2676
+ }
2677
+
2678
+ #astra-pro-sites-license-form p {
2679
+ margin: .3em 0;
2680
+ }
2681
+
2682
+ #astra-pro-sites-license-form .bsf-license-key-registration {
2683
+ margin-top: 1em;
2684
+ }
2685
+
2686
+ #astra-pro-sites-license-form .inner {
2687
+ position: relative;
2688
+ box-shadow: none;
2689
+ height: auto;
2690
+ width: auto;
2691
+ min-height: auto;
2692
+ transition: none;
2693
+ top: 0;
2694
+ left: 0;
2695
+ transform: none;
2696
+ }
2697
+
2698
+ #astra-pro-sites-license-form h3 {
2699
+ display: none;
2700
+ }
2701
+
2702
+ #astra-pro-sites-license-form .astra-product-license {
2703
+ line-height: normal;
2704
+ margin-top: 0;
2705
+ margin-left: 0.5em;
2706
+ padding: .45em;
2707
+ }
2708
+
2709
+ #astra-pro-sites-license-form .license-form-field {
2710
+ float: left;
2711
+ width: 100%;
2712
+ width: calc( 100% - 140px );
2713
+ }
2714
+
2715
+ #astra-pro-sites-license-form .regular-text {
2716
+ width: 100%;
2717
+ }
2718
+
2719
+ #astra-pro-sites-license-form .submit-button-wrap p {
2720
+ margin-top: 1em;
2721
+ }
2722
+
2723
+ .appearance_page_starter-templates.astra-sites-change-page-builder .astra-sites-notice {
2724
+ display: none;
2725
+ }
2726
+
2727
+ .astra-sites-log p:first-child {
2728
+ margin-top: 0;
2729
+ }
2730
+
2731
+ .astra-sites-log p:last-child {
2732
+ margin-bottom: 0;
2733
+ }
2734
+
2735
+ .astra-sites-log .batch-log {
2736
+ background: #fff;
2737
+ padding: 2em;
2738
+ margin-bottom: 1em;
2739
+ }
2740
+
2741
+ .astra-sites-log table td {
2742
+ vertical-align: top;
2743
+ padding: 15px;
2744
+ text-align: left;
2745
+ }
2746
+
2747
+ .white-label-enabled .astra-sites-logo-wrap {
2748
+ width: auto;
2749
+ display: flex;
2750
+ align-items: center;
2751
+ font-size: 1.2rem;
2752
+ font-weight: 500;
2753
+ }
2754
+
2755
+ .appearance_page_starter-templates .notice.astra-sites-must-notices {
2756
+ display: block;
2757
+ }
2758
+
2759
+ .astra-previewing-single-pages.appearance_page_starter-templates .notice.astra-sites-must-notices {
2760
+ display: none;
2761
+ }
2762
+
2763
+ #astra-pro-sites-license-form .astra-pro-sites-fail-message {
2764
+ color: #F44336;
2765
+ }
2766
+
2767
+ #astra-pro-sites-license-form .bsf-current-license-success-astra-pro-sites,
2768
+ #astra-pro-sites-license-form .bsf-current-license-error-astra-pro-sites {
2769
+ display: none;
2770
+ }
2771
+
2772
+ .bsf-current-license-error-astra-pro-sites,
2773
+ .bsf-current-license-success-astra-pro-sites {
2774
+ display: block;
2775
+ margin-bottom: 0.5em;
2776
+ }
2777
+
2778
+ .astra-pro-sites-license-form-status-success .astra-product-license {
2779
+ display: none;
2780
+ }
2781
+
2782
+ #astra-pro-sites-license-form.astra-pro-sites-license-form-status-success .license-form-field {
2783
+ width: calc( 100% - 2px );
2784
+ }
2785
+
2786
+ #astra-pro-sites-license-form .astra-pro-sites-success-message {
2787
+ color: #008000;
2788
+ }
2789
+
2790
+ .bsf-current-license-error-astra-pro-sites {
2791
+ color: #F44336;
2792
+ }
2793
+
2794
+ .skip-and-import .astra-site-contents {
2795
+ list-style-type: circle;
2796
+ margin-left: 1.7em;
2797
+ }
2798
+
2799
+ .astra-site-contents .astra-theme-module {
2800
+ margin-left: 2em;
2801
+ }
2802
+
2803
+ .dont-use-astra-theme .plugin-card-astra-addon,
2804
+ .required-plugins-count-1.dont-use-astra-theme .astra-sites-import-plugins {
2805
+ display: none;
2806
+ }
2807
+
2808
+ .subscription-popup {
2809
+ display: none;
2810
+ }
2811
+
2812
+ .subscription-form {
2813
+ margin-top: 2em;
2814
+ }
2815
+
2816
+ .subscription-field select,
2817
+ .subscription-field input[type="text"],
2818
+ .subscription-field input[type="email"] {
2819
+ width: 100%;
2820
+ border-radius: 3px;
2821
+ border: 1px solid #8b959d;
2822
+ font-size: 13px;
2823
+ height: 40px;
2824
+ padding: 0 10px;
2825
+ }
2826
+
2827
+ .subscription-fields .subscription-field {
2828
+ margin-bottom: 1.4em;
2829
+ }
2830
+
2831
+ .subscription-wp-user-type .label {
2832
+ margin-right: 1em;
2833
+ margin-left: 2px;
2834
+ }
2835
+
2836
+ .button-subscription-skip:focus {
2837
+ box-shadow: none;
2838
+ }
2839
+
2840
+ .button-subscription-skip {
2841
+ margin-top: .8em;
2842
+ display: inline-block;
2843
+ }
2844
+
2845
+ .import-page #astra-sites-subscription-form-two .subscription-field-wrap {
2846
+ margin-bottom: 5px;
2847
+ }
2848
+
2849
+ #astra-sites-subscription-form-two .subscription-field-wrap {
2850
+ margin-bottom: .8em;
2851
+ }
2852
+
2853
+ .subscription-actions {
2854
+ display: flex;
2855
+ align-items: center;
2856
+ }
2857
+
2858
+ .subscription-wp-user-type {
2859
+ display: flex;
2860
+ margin-bottom: 2em;
2861
+ }
2862
+
2863
+ .subscription-field .subscription-input .error {
2864
+ border-color: red;
2865
+ }
2866
+
2867
+ .subscription-input input[type="email"] {
2868
+ width: 100%;
2869
+ }
2870
+
2871
+ .subscription-popup .astra-sites-import-content {
2872
+ height: 250px;
2873
+ padding: 20px 35px 20px 35px;
2874
+ }
2875
+
2876
+ .subscription-actions .submitting .dashicons,
2877
+ .subscription-actions .submitted .dashicons {
2878
+ opacity: 1;
2879
+ visibility: visible;
2880
+ }
2881
+
2882
+ .subscription-actions .dashicons {
2883
+ opacity: 0;
2884
+ visibility: hidden;
2885
+ }
2886
+
2887
+ .subscription-actions .submitting .dashicons {
2888
+ animation: rotation 2s infinite linear;
2889
+ }
2890
+
2891
+ .wp-core-ui .subscription-field select {
2892
+ background-position: right 7px top 55%;
2893
+ }
2894
+
2895
+ .wp-core-ui .astra-sites-result-preview .subscription-actions .button.button-hero {
2896
+ margin: 0;
2897
+ box-shadow: none;
2898
+ font-size: 14px;
2899
+ min-height: 44px;
2900
+ padding: 0 18px;
2901
+ width: 100%;
2902
+ }
2903
+
2904
+ .wp-core-ui .subscription-wp-user-type select:focus,
2905
+ .subscription-field input[type="text"]:focus,
2906
+ .subscription-field input[type="email"]:focus,
2907
+ .wp-core-ui .subscription-wp-user-type select:hover,
2908
+ .subscription-field input[type="text"]:hover,
2909
+ .subscription-field input[type="email"]:hover {
2910
+ border-color: #444C53;
2911
+ }
2912
+
2913
+ .subscription-input input[type="email"],
2914
+ .subscription-input input[type="text"] {
2915
+ color: #444;
2916
+ }
2917
+
2918
+ .wp-core-ui .subscription-wp-user-type select:focus,
2919
+ .subscription-field input[type="text"]:focus,
2920
+ .subscription-field input[type="email"]:focus {
2921
+ box-shadow: none;
2922
+ }
2923
+
2924
+ .wp-core-ui .subscription-wp-user-type select,
2925
+ .subscription-wp-user-type .subscription-input {
2926
+ width: 100%;
2927
+ color: #72777c;
2928
+ }
2929
+
2930
+ .subscription-actions + p {
2931
+ margin: 30px 0 0 0;
2932
+ }
2933
+
2934
+ .subscription-footer {
2935
+ margin-top: 0.8em;
2936
+ text-align: center;
2937
+ }
2938
+
2939
+ .subscription-footer p {
2940
+ margin: 0;
2941
+ }
2942
+
2943
+ .subscription-fields .subscription-input:focus {
2944
+ outline: none;
2945
+ box-shadow: none;
2946
+ }
2947
+
2948
+ .subscription-fields .subscription-input {
2949
+ width: 100%;
2950
+ max-width: 100%;
2951
+ border-radius: 3px;
2952
+ border: 1px solid #585F66;
2953
+ padding: 0 10px;
2954
+ padding: 14px 14px;
2955
+ box-shadow: none;
2956
+ padding: 6px 12px;
2957
+ min-height: 44px;
2958
+ font-size: 14px;
2959
+ font-weight: 400;
2960
+ outline: none;
2961
+ background-color: transparent;
2962
+ background-position: right 10px top 55%;
2963
+ margin: 0;
2964
+ }
2965
+
2966
+ .subscription-label {
2967
+ color: #585F66;
2968
+ margin: 12px 10px;
2969
+ position: absolute;
2970
+ top: 0;
2971
+ font-weight: 400;
2972
+ padding: 0 5px;
2973
+ font-size: 14px;
2974
+ left: 0;
2975
+ -webkit-transition: all 0.25s ease;
2976
+ transition: all 0.25s ease;
2977
+ pointer-events: none;
2978
+ }
2979
+
2980
+ .subscription-field-wrap {
2981
+ position: relative;
2982
+ }
2983
+
2984
+ .subscription-fields .subscription-field-wrap:not(.subscription-success, .subscription-error) .subscription-input:hover {
2985
+ border-color: #2271b1;
2986
+ }
2987
+
2988
+ .subscription-fields .subscription-input:hover,
2989
+ .subscription-fields .subscription-input:focus {
2990
+ color: #2c3338;
2991
+ }
2992
+
2993
+ .subscription-anim .subscription-label {
2994
+ background-color: #f1f3f5;
2995
+ font-size: 12px;
2996
+ line-height: 12px;
2997
+ margin-top: 0;
2998
+ padding: 0 4px;
2999
+ top: -5px;
3000
+ transition: all 0.125s ease;
3001
+ -webkit-transition: all 0.125s ease;
3002
+ color: #2271b1;
3003
+ }
3004
+
3005
+ .subscription-error .subscription-input,
3006
+ .subscription-error .subscription-input:focus {
3007
+ border-color: red;
3008
+ }
3009
+
3010
+ .subscription-error .subscription-desc {
3011
+ color: red;
3012
+ }
3013
+
3014
+ .subscription-anim.subscription-error .subscription-label {
3015
+ color: red;
3016
+ }
3017
+
3018
+
3019
+ .subscription-field-wrap .subscription-desc {
3020
+ padding-left: 2px;
3021
+ opacity: 0;
3022
+ visibility: hidden;
3023
+ }
3024
+
3025
+ .subscription-success .subscription-input,
3026
+ .subscription-success .subscription-input:focus {
3027
+ border-color: #66a700;
3028
+ }
3029
+
3030
+ .subscription-anim.subscription-success .subscription-label {
3031
+ color: #66a700;
3032
+ }
3033
+
3034
+ .subscription-field-wrap {
3035
+ margin-bottom: 1em;
3036
+ }
3037
+
3038
+ .subscription-field-wrap.subscription-error .subscription-desc {
3039
+ opacity: 1;
3040
+ visibility: visible;
3041
+ }
3042
+
3043
+ .subscription-fields {
3044
+ display: flex;
3045
+ }
3046
+
3047
+ .subscription-fields .subscription-field-wrap {
3048
+ flex: 1;
3049
+ }
3050
+
3051
+ .subscription-enabled .astra-sites-advanced-options {
3052
+ display: none;
3053
+ }
3054
+
3055
+ .astra-sites-advanced-options-heading {
3056
+ display: none;
3057
+ }
3058
+
3059
+ .subscription-enabled .astra-sites-advanced-options-heading {
3060
+ display: inline-block;
3061
+ margin: 0;
3062
+ cursor: pointer;
3063
+ font-size: 15px;
3064
+ }
3065
+
3066
+ .subscription-enabled .astra-sites-subscription-form-one {
3067
+ display: block;
3068
+ }
3069
+
3070
+ .astra-sites-subscription-form-one {
3071
+ display: none;
3072
+ }
3073
+
3074
+ .astra-sites-advanced-options-heading .dashicons {
3075
+ opacity: 1;
3076
+ visibility: visible;
3077
+ }
3078
+
3079
+ .astra-sites-subscription-form-one {
3080
+ margin-top: 1.8em;
3081
+ max-width: 580px;
3082
+ }
3083
+
3084
+ .import-page .subscription-field-wrap {
3085
+ margin-bottom: .5em;
3086
+ }
3087
+
3088
+ .import-page .subscription-popup .astra-sites-import-content {
3089
+ height: 285px;
3090
+ }
3091
+
3092
+ .highlighted-note {
3093
+ font-size: 14px;
3094
+ font-weight: 500;
3095
+ }
3096
+
3097
+ @media screen and (max-width: 768px) {
3098
+ .wp-core-ui .astra-sites-result-preview .subscription-actions .button.button-hero {
3099
+ height: auto;
3100
+ word-break: break-word;
3101
+ white-space: initial;
3102
+ line-height: 1.5;
3103
+ padding: 5px 18px;
3104
+ }
3105
+ .astra-sites-result-preview input[type="checkbox"] {
3106
+ height: 1rem;
3107
+ width: 1rem;
3108
+ }
3109
+ .astra-sites-result-preview input[type="checkbox"]:checked:before {
3110
+ height: 1.2rem;
3111
+ width: 1.2rem;
3112
+ margin: -0.1rem -0.2rem;
3113
+ }
3114
+ .subscription-popup .astra-sites-import-content {
3115
+ padding: 20px;
3116
+ }
3117
+ #astra-sites-subscription-form-one .subscription-field-wrap {
3118
+ margin-bottom: .8em;
3119
+ }
3120
+ .subscription-fields {
3121
+ flex-direction: column;
3122
+ }
3123
+ }
3124
+
3125
+ @media screen and (min-width: 768px) {
3126
+
3127
+ .subscription-fields .subscription-field-wrap:first-child {
3128
+ padding-right: 20px;
3129
+ }
3130
+
3131
+ }
astra-sites/inc/assets/css/elementor-admin-common-rtl.css ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .dialog-widget-content {
2
+ background-color: #fff;
3
+ position: absolute;
4
+ -webkit-border-radius: 3px;
5
+ border-radius: 3px;
6
+ -webkit-box-shadow: -2px 8px 23px 3px rgba(0, 0, 0, 0.2);
7
+ box-shadow: -2px 8px 23px 3px rgba(0, 0, 0, 0.2);
8
+ overflow: hidden;
9
+ }
10
+
11
+ .dialog-message {
12
+ font-size: 12px;
13
+ line-height: 1.5;
14
+ -webkit-box-sizing: border-box;
15
+ box-sizing: border-box;
16
+ }
17
+
18
+ .dialog-type-lightbox {
19
+ position: fixed;
20
+ height: 100%;
21
+ width: 100%;
22
+ top: 0;
23
+ right: 0;
24
+ background-color: rgba(0, 0, 0, 0.8);
25
+ z-index: 9999;
26
+ -webkit-user-select: none;
27
+ -moz-user-select: none;
28
+ -ms-user-select: none;
29
+ user-select: none;
30
+ }
31
+
32
+ .dialog-type-lightbox .dialog-widget-content {
33
+ margin: auto;
34
+ }
35
+
36
+ .dialog-type-lightbox .dialog-header {
37
+ font-size: 15px;
38
+ color: #495157;
39
+ padding: 30px 0 10px;
40
+ font-weight: 500;
41
+ }
42
+
43
+ .dialog-type-lightbox .dialog-message {
44
+ padding: 0 30px 30px;
45
+ min-height: 50px;
46
+ }
47
+
48
+ .dialog-type-lightbox:not(.elementor-popup-modal) .dialog-header,
49
+ .dialog-type-lightbox:not(.elementor-popup-modal) .dialog-message {
50
+ text-align: center;
51
+ }
52
+
53
+ .dialog-type-lightbox .dialog-buttons-wrapper {
54
+ border-top: 1px solid #e6e9ec;
55
+ text-align: center;
56
+ }
57
+
58
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button {
59
+ font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
60
+ width: 50%;
61
+ border: none;
62
+ background: none;
63
+ font-size: 15px;
64
+ cursor: pointer;
65
+ padding: 13px 0;
66
+ outline: 0;
67
+ }
68
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button:hover {
69
+ background-color: #f4f6f7; }
70
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button.dialog-ok {
71
+ color: #b01b1b; }
72
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button.dialog-take_over {
73
+ color: #39b54a; }
74
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button:active {
75
+ background-color: rgba(230, 233, 236, 0.5); }
76
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button::-moz-focus-inner {
77
+ border: 0; }
78
+
79
+ .ast-sites-modal .dialog-widget-content {
80
+ font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
81
+ background-color: #f1f3f5;
82
+ width: 100%; }
83
+ @media (max-width: 1439px) {
84
+ .ast-sites-modal .dialog-widget-content {
85
+ max-width: 990px; } }
86
+ @media (min-width: 1440px) {
87
+ .ast-sites-modal .dialog-widget-content {
88
+ max-width: 1200px; } }
89
+
90
+ .ast-sites-modal .dialog-header {
91
+ padding: 0;
92
+ background-color: #fff;
93
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
94
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
95
+ position: relative;
96
+ z-index: 1; }
97
+
98
+ .ast-sites-modal .dialog-buttons-wrapper {
99
+ background-color: #fff;
100
+ border: none;
101
+ display: none;
102
+ -webkit-box-pack: end;
103
+ -webkit-justify-content: flex-end;
104
+ -ms-flex-pack: end;
105
+ justify-content: flex-end;
106
+ padding: 5px;
107
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
108
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
109
+ position: relative; }
110
+ .ast-sites-modal .dialog-buttons-wrapper .elementor-button {
111
+ height: 40px;
112
+ margin-right: 5px; }
113
+ .ast-sites-modal .dialog-buttons-wrapper .elementor-button-success {
114
+ padding: 12px 36px;
115
+ color: #fff;
116
+ width: initial;
117
+ font-size: 15px; }
118
+ .ast-sites-modal .dialog-buttons-wrapper .elementor-button-success:hover {
119
+ background-color: #39b54a; }
120
+
121
+ .ast-sites-modal .dialog-message {
122
+ height: 750px;
123
+ max-height: 85vh;
124
+ overflow: auto;
125
+ padding-top: 25px; }
126
+
127
+ .ast-sites-modal .dialog-content {
128
+ height: 100%; }
129
+
130
+ .ast-sites-modal .dialog-loading {
131
+ display: none; }
132
+
133
+ .ast-sites-modal__header {
134
+ display: -webkit-box;
135
+ display: -webkit-flex;
136
+ display: -ms-flexbox;
137
+ display: flex;
138
+ -webkit-box-align: center;
139
+ -webkit-align-items: center;
140
+ -ms-flex-align: center;
141
+ align-items: center;
142
+ -webkit-box-pack: justify;
143
+ -webkit-justify-content: space-between;
144
+ -ms-flex-pack: justify;
145
+ justify-content: space-between;
146
+ height: 50px; }
147
+ .ast-sites-modal__header__logo {
148
+ line-height: 1;
149
+ text-transform: uppercase;
150
+ font-weight: bold;
151
+ cursor: pointer; }
152
+ .ast-sites-modal__header__logo-area {
153
+ text-align: right;
154
+ padding-right: 15px; }
155
+ .ast-sites-modal__header__logo-area > * {
156
+ display: -webkit-box;
157
+ display: -webkit-flex;
158
+ display: -ms-flexbox;
159
+ display: flex;
160
+ -webkit-box-align: center;
161
+ -webkit-align-items: center;
162
+ -ms-flex-align: center;
163
+ align-items: center; }
164
+ .ast-sites-modal__header__logo__icon-wrapper {
165
+ padding: 4px 7px 6px;
166
+ background-image: -webkit-linear-gradient(-225deg, #f2295b, #434363);
167
+ background-image: -o-linear-gradient(-225deg, #f2295b, #434363);
168
+ background-image: linear-gradient(135deg, #f2295b, #434363);
169
+ -webkit-border-radius: 2px;
170
+ border-radius: 2px;
171
+ margin-left: 10px; }
172
+ .ast-sites-modal__header__logo__title {
173
+ padding-top: 2px; }
174
+ .ast-sites-modal__header__logo i {
175
+ color: #fff;
176
+ font-size: 10px; }
177
+ .ast-sites-modal__header__items-area {
178
+ display: -webkit-box;
179
+ display: -webkit-flex;
180
+ display: -ms-flexbox;
181
+ display: flex;
182
+ -webkit-box-orient: horizontal;
183
+ -webkit-box-direction: reverse;
184
+ -webkit-flex-direction: row-reverse;
185
+ -ms-flex-direction: row-reverse;
186
+ flex-direction: row-reverse; }
187
+ .ast-sites-modal__header__item {
188
+ position: relative;
189
+ display: -webkit-box;
190
+ display: -webkit-flex;
191
+ display: -ms-flexbox;
192
+ display: flex;
193
+ -webkit-box-align: center;
194
+ -webkit-align-items: center;
195
+ -ms-flex-align: center;
196
+ align-items: center;
197
+ -webkit-box-pack: center;
198
+ -webkit-justify-content: center;
199
+ -ms-flex-pack: center;
200
+ justify-content: center;
201
+ -webkit-box-sizing: content-box;
202
+ box-sizing: content-box; }
203
+ .ast-sites-modal__header__item > i {
204
+ font-size: 20px;
205
+ -webkit-transition: all 0.3s;
206
+ -o-transition: all 0.3s;
207
+ transition: all 0.3s;
208
+ cursor: pointer; }
209
+ .ast-sites-modal__header__item > i:not(:hover) {
210
+ color: #a4afb7; }
211
+ .ast-sites-modal__header__close--normal {
212
+ width: 45px;
213
+ border-right: 1px solid #e6e9ec; }
214
+ .ast-sites-modal__header__close--normal i {
215
+ font-size: 18px; }
216
+ .ast-sites-modal__header__close--skip {
217
+ padding: 10px;
218
+ padding-right: 20px;
219
+ margin-left: 10px;
220
+ color: #fff;
221
+ background-color: #a4afb7;
222
+ font-size: 11px;
223
+ font-weight: normal;
224
+ line-height: 1;
225
+ text-transform: uppercase;
226
+ -webkit-border-radius: 2px;
227
+ border-radius: 2px;
228
+ cursor: pointer; }
229
+ .ast-sites-modal__header__close--skip > i {
230
+ font-size: inherit;
231
+ padding-right: 10px;
232
+ margin-right: 15px;
233
+ border-right: 1px solid; }
234
+ .ast-sites-modal__header__close--skip > i:not(:hover) {
235
+ color: #fff; }
236
+
237
+ .ast-sites-modal__sidebar {
238
+ width: 25%;
239
+ background-color: rgba(255, 255, 255, 0.3); }
240
+
241
+ .ast-sites-modal__content {
242
+ -webkit-box-flex: 1;
243
+ -webkit-flex-grow: 1;
244
+ -ms-flex-positive: 1;
245
+ flex-grow: 1;
246
+ -webkit-box-shadow: 0 0 13px inset rgba(0, 0, 0, 0.05);
247
+ box-shadow: 0 0 13px inset rgba(0, 0, 0, 0.05); }
astra-sites/inc/assets/css/elementor-admin-common.css ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .dialog-widget-content {
2
+ background-color: #fff;
3
+ position: absolute;
4
+ -webkit-border-radius: 3px;
5
+ border-radius: 3px;
6
+ -webkit-box-shadow: 2px 8px 23px 3px rgba(0, 0, 0, 0.2);
7
+ box-shadow: 2px 8px 23px 3px rgba(0, 0, 0, 0.2);
8
+ overflow: hidden;
9
+ }
10
+
11
+ .dialog-message {
12
+ font-size: 12px;
13
+ line-height: 1.5;
14
+ -webkit-box-sizing: border-box;
15
+ box-sizing: border-box;
16
+ }
17
+
18
+ .dialog-type-lightbox {
19
+ position: fixed;
20
+ height: 100%;
21
+ width: 100%;
22
+ top: 0;
23
+ left: 0;
24
+ background-color: rgba(0, 0, 0, 0.8);
25
+ z-index: 9999;
26
+ -webkit-user-select: none;
27
+ -moz-user-select: none;
28
+ -ms-user-select: none;
29
+ user-select: none;
30
+ }
31
+
32
+ .dialog-type-lightbox .dialog-widget-content {
33
+ margin: auto;
34
+ }
35
+
36
+ .dialog-type-lightbox .dialog-header {
37
+ font-size: 15px;
38
+ color: #495157;
39
+ padding: 30px 0 10px;
40
+ font-weight: 500;
41
+ }
42
+
43
+ .dialog-type-lightbox .dialog-message {
44
+ padding: 0 30px 30px;
45
+ min-height: 50px;
46
+ }
47
+
48
+ .dialog-type-lightbox:not(.elementor-popup-modal) .dialog-header,
49
+ .dialog-type-lightbox:not(.elementor-popup-modal) .dialog-message {
50
+ text-align: center;
51
+ }
52
+
53
+ .dialog-type-lightbox .dialog-buttons-wrapper {
54
+ border-top: 1px solid #e6e9ec;
55
+ text-align: center;
56
+ }
57
+
58
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button {
59
+ font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
60
+ width: 50%;
61
+ border: none;
62
+ background: none;
63
+ font-size: 15px;
64
+ cursor: pointer;
65
+ padding: 13px 0;
66
+ outline: 0;
67
+ }
68
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button:hover {
69
+ background-color: #f4f6f7; }
70
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button.dialog-ok {
71
+ color: #b01b1b; }
72
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button.dialog-take_over {
73
+ color: #39b54a; }
74
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button:active {
75
+ background-color: rgba(230, 233, 236, 0.5); }
76
+ .dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button::-moz-focus-inner {
77
+ border: 0; }
78
+
79
+ .ast-sites-modal .dialog-widget-content {
80
+ font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
81
+ background-color: #f1f3f5;
82
+ width: 100%; }
83
+ @media (max-width: 1439px) {
84
+ .ast-sites-modal .dialog-widget-content {
85
+ max-width: 990px; } }
86
+ @media (min-width: 1440px) {
87
+ .ast-sites-modal .dialog-widget-content {
88
+ max-width: 1200px; } }
89
+
90
+ .ast-sites-modal .dialog-header {
91
+ padding: 0;
92
+ background-color: #fff;
93
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
94
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
95
+ position: relative;
96
+ z-index: 1; }
97
+
98
+ .ast-sites-modal .dialog-buttons-wrapper {
99
+ background-color: #fff;
100
+ border: none;
101
+ display: none;
102
+ -webkit-box-pack: end;
103
+ -webkit-justify-content: flex-end;
104
+ -ms-flex-pack: end;
105
+ justify-content: flex-end;
106
+ padding: 5px;
107
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
108
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
109
+ position: relative; }
110
+ .ast-sites-modal .dialog-buttons-wrapper .elementor-button {
111
+ height: 40px;
112
+ margin-left: 5px; }
113
+ .ast-sites-modal .dialog-buttons-wrapper .elementor-button-success {
114
+ padding: 12px 36px;
115
+ color: #fff;
116
+ width: initial;
117
+ font-size: 15px; }
118
+ .ast-sites-modal .dialog-buttons-wrapper .elementor-button-success:hover {
119
+ background-color: #39b54a; }
120
+
121
+ .ast-sites-modal .dialog-message {
122
+ height: 750px;
123
+ max-height: 85vh;
124
+ overflow: auto;
125
+ padding-top: 25px; }
126
+
127
+ .ast-sites-modal .dialog-content {
128
+ height: 100%; }
129
+
130
+ .ast-sites-modal .dialog-loading {
131
+ display: none; }
132
+
133
+ .ast-sites-modal__header {
134
+ display: -webkit-box;
135
+ display: -webkit-flex;
136
+ display: -ms-flexbox;
137
+ display: flex;
138
+ -webkit-box-align: center;
139
+ -webkit-align-items: center;
140
+ -ms-flex-align: center;
141
+ align-items: center;
142
+ -webkit-box-pack: justify;
143
+ -webkit-justify-content: space-between;
144
+ -ms-flex-pack: justify;
145
+ justify-content: space-between;
146
+ height: 50px; }
147
+ .ast-sites-modal__header__logo {
148
+ line-height: 1;
149
+ text-transform: uppercase;
150
+ font-weight: bold;
151
+ cursor: pointer; }
152
+ .ast-sites-modal__header__logo-area {
153
+ text-align: left;
154
+ padding-left: 15px; }
155
+ .ast-sites-modal__header__logo-area > * {
156
+ display: -webkit-box;
157
+ display: -webkit-flex;
158
+ display: -ms-flexbox;
159
+ display: flex;
160
+ -webkit-box-align: center;
161
+ -webkit-align-items: center;
162
+ -ms-flex-align: center;
163
+ align-items: center; }
164
+ .ast-sites-modal__header__logo__icon-wrapper {
165
+ padding: 4px 7px 6px;
166
+ background-image: -webkit-linear-gradient(225deg, #f2295b, #434363);
167
+ background-image: -o-linear-gradient(225deg, #f2295b, #434363);
168
+ background-image: linear-gradient(-135deg, #f2295b, #434363);
169
+ -webkit-border-radius: 2px;
170
+ border-radius: 2px;
171
+ margin-right: 10px; }
172
+ .ast-sites-modal__header__logo__title {
173
+ padding-top: 2px; }
174
+ .ast-sites-modal__header__logo i {
175
+ color: #fff;
176
+ font-size: 10px; }
177
+ .ast-sites-modal__header__items-area {
178
+ display: -webkit-box;
179
+ display: -webkit-flex;
180
+ display: -ms-flexbox;
181
+ display: flex;
182
+ -webkit-box-orient: horizontal;
183
+ -webkit-box-direction: reverse;
184
+ -webkit-flex-direction: row-reverse;
185
+ -ms-flex-direction: row-reverse;
186
+ flex-direction: row-reverse; }
187
+ .ast-sites-modal__header__item {
188
+ position: relative;
189
+ display: -webkit-box;
190
+ display: -webkit-flex;
191
+ display: -ms-flexbox;
192
+ display: flex;
193
+ -webkit-box-align: center;
194
+ -webkit-align-items: center;
195
+ -ms-flex-align: center;
196
+ align-items: center;
197
+ -webkit-box-pack: center;
198
+ -webkit-justify-content: center;
199
+ -ms-flex-pack: center;
200
+ justify-content: center;
201
+ -webkit-box-sizing: content-box;
202
+ box-sizing: content-box; }
203
+ .ast-sites-modal__header__item > i {
204
+ font-size: 20px;
205
+ -webkit-transition: all 0.3s;
206
+ -o-transition: all 0.3s;
207
+ transition: all 0.3s;
208
+ cursor: pointer; }
209
+ .ast-sites-modal__header__item > i:not(:hover) {
210
+ color: #a4afb7; }
211
+ .ast-sites-modal__header__close--normal {
212
+ width: 45px;
213
+ border-left: 1px solid #e6e9ec; }
214
+ .ast-sites-modal__header__close--normal i {
215
+ font-size: 18px; }
216
+ .ast-sites-modal__header__close--skip {
217
+ padding: 10px;
218
+ padding-left: 20px;
219
+ margin-right: 10px;
220
+ color: #fff;
221
+ background-color: #a4afb7;
222
+ font-size: 11px;
223
+ font-weight: normal;
224
+ line-height: 1;
225
+ text-transform: uppercase;
226
+ -webkit-border-radius: 2px;
227
+ border-radius: 2px;
228
+ cursor: pointer; }
229
+ .ast-sites-modal__header__close--skip > i {
230
+ font-size: inherit;
231
+ padding-left: 10px;
232
+ margin-left: 15px;
233
+ border-left: 1px solid; }
234
+ .ast-sites-modal__header__close--skip > i:not(:hover) {
235
+ color: #fff; }
236
+
237
+ .ast-sites-modal__sidebar {
238
+ width: 25%;
239
+ background-color: rgba(255, 255, 255, 0.3); }
240
+
241
+ .ast-sites-modal__content {
242
+ -webkit-box-flex: 1;
243
+ -webkit-flex-grow: 1;
244
+ -ms-flex-positive: 1;
245
+ flex-grow: 1;
246
+ -webkit-box-shadow: 0 0 13px inset rgba(0, 0, 0, 0.05);
247
+ box-shadow: 0 0 13px inset rgba(0, 0, 0, 0.05); }
astra-sites/inc/assets/css/elementor-admin-dark-rtl.css ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-library-template-inner,
2
+ .ast-sites-dark-mode #ast-sites-modal .inner,
3
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-library-template:not(.elementor-template-library-template-page) .elementor-template-library-template-footer,
4
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input {
5
+ background-color: #404349;
6
+ }
7
+
8
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites__sync-wrap:hover span,
9
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__close--normal:hover i,
10
+ .ast-sites-dark-mode #ast-sites-modal .back-to-layout:hover i {
11
+ color: #ffffff;
12
+ }
13
+
14
+ .ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter,
15
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input {
16
+ border-color: #7d7e82;
17
+ }
18
+
19
+ .ast-sites-dark-mode .select2-container--default .select2-selection--single .select2-selection__arrow b {
20
+ border-color: #E0E1E3 transparent transparent transparent;
21
+ }
22
+
23
+ .ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar,
24
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar,
25
+ .ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar {
26
+ background-color: #34383C;
27
+ }
28
+
29
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar-thumb,
30
+ .ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar-thumb {
31
+ background-color: #7d7e82;
32
+ }
33
+
34
+ .ast-sites-dark-mode .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
35
+ border-color: transparent transparent #E0E1E3 transparent;
36
+ }
37
+
38
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-floating-notice-wrap {
39
+ background: #404349;
40
+ }
41
+
42
+ .ast-sites-dark-mode #ast-sites-modal .notice-dismiss:before {
43
+ color: #E0E1E3;
44
+ }
45
+
46
+ .ast-sites-dark-mode #ast-sites-modal .dialog-widget-content,
47
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-menu-item,
48
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-sync-library-button span,
49
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__item > i:not(:hover),
50
+ .ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter,
51
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input,
52
+ .ast-sites-dark-mode.astra-sites__elementor-open #ast-sites-modal .select2-container--default .select2-selection__rendered,
53
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-no-sites h3,
54
+ .ast-sites-dark-mode #ast-sites-modal .back-to-layout,
55
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip .dashicons-editor-help {
56
+ color: #E0E1E3;
57
+ }
58
+
59
+ .ast-sites-dark-mode #ast-sites-modal .dialog-widget-content,
60
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-no-sites .inner {
61
+ background-color: #34383C;
62
+ }
63
+
64
+ .ast-sites-dark-mode #ast-sites-modal .dialog-header {
65
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
66
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
67
+ }
68
+
69
+ .ast-sites-dark-mode #ast-sites-modal.dialog-type-lightbox .dialog-header {
70
+ background-color: #26292C;
71
+ }
72
+
73
+ .ast-sites-dark-mode #ast-sites-modal .ast-tooltip-wrap::before {
74
+ border: 8px solid #7d7e82;
75
+ border-bottom-style: solid;
76
+ border-right-color: transparent;
77
+ border-left-color: transparent;
78
+ border-top: none;
79
+ }
80
+
81
+ .ast-sites-dark-mode #ast-sites-modal .ast-tooltip-wrap {
82
+ background: #7d7e82;
83
+ }
84
+
85
+ .ast-sites-dark-mode #ast-sites-modal #wp-filter-search-input {
86
+ border-color: #d5dadf;
87
+ }
88
+
89
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__logo,
90
+ .ast-sites-dark-mode #ast-sites-modal .back-to-layout,
91
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip {
92
+ border-left: 1px solid #32363A;
93
+ }
94
+
95
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites__sync-wrap,
96
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__close--normal,
97
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip {
98
+ border-right: 1px solid #32363A;
99
+ }
100
+
101
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-menu-item.elementor-active {
102
+ background-image: -webkit-gradient(linear, right top, right bottom, from(#26292C), to(#4C4F56));
103
+ background-image: -webkit-linear-gradient(top, #26292C, #4C4F56);
104
+ background-image: -o-linear-gradient(top, #26292C, #4C4F56);
105
+ background-image: linear-gradient(to bottom, #26292C, #4C4F56);
106
+ }
astra-sites/inc/assets/css/elementor-admin-dark.css ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-library-template-inner,
2
+ .ast-sites-dark-mode #ast-sites-modal .inner,
3
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-library-template:not(.elementor-template-library-template-page) .elementor-template-library-template-footer,
4
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input {
5
+ background-color: #404349;
6
+ }
7
+
8
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites__sync-wrap:hover span,
9
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__close--normal:hover i,
10
+ .ast-sites-dark-mode #ast-sites-modal .back-to-layout:hover i {
11
+ color: #ffffff;
12
+ }
13
+
14
+ .ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter,
15
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input {
16
+ border-color: #7d7e82;
17
+ }
18
+
19
+ .ast-sites-dark-mode .select2-container--default .select2-selection--single .select2-selection__arrow b {
20
+ border-color: #E0E1E3 transparent transparent transparent;
21
+ }
22
+
23
+ .ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar,
24
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar,
25
+ .ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar {
26
+ background-color: #34383C;
27
+ }
28
+
29
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar-thumb,
30
+ .ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar-thumb {
31
+ background-color: #7d7e82;
32
+ }
33
+
34
+ .ast-sites-dark-mode .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
35
+ border-color: transparent transparent #E0E1E3 transparent;
36
+ }
37
+
38
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-floating-notice-wrap {
39
+ background: #404349;
40
+ }
41
+
42
+ .ast-sites-dark-mode #ast-sites-modal .notice-dismiss:before {
43
+ color: #E0E1E3;
44
+ }
45
+
46
+ .ast-sites-dark-mode #ast-sites-modal .dialog-widget-content,
47
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-menu-item,
48
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-sync-library-button span,
49
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__item > i:not(:hover),
50
+ .ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter,
51
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input,
52
+ .ast-sites-dark-mode.astra-sites__elementor-open #ast-sites-modal .select2-container--default .select2-selection__rendered,
53
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-no-sites h3,
54
+ .ast-sites-dark-mode #ast-sites-modal .back-to-layout,
55
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip .dashicons-editor-help {
56
+ color: #E0E1E3;
57
+ }
58
+
59
+ .ast-sites-dark-mode #ast-sites-modal .dialog-widget-content,
60
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-no-sites .inner {
61
+ background-color: #34383C;
62
+ }
63
+
64
+ .ast-sites-dark-mode #ast-sites-modal .dialog-header {
65
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
66
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
67
+ }
68
+
69
+ .ast-sites-dark-mode #ast-sites-modal.dialog-type-lightbox .dialog-header {
70
+ background-color: #26292C;
71
+ }
72
+
73
+ .ast-sites-dark-mode #ast-sites-modal .ast-tooltip-wrap::before {
74
+ border: 8px solid #7d7e82;
75
+ border-bottom-style: solid;
76
+ border-left-color: transparent;
77
+ border-right-color: transparent;
78
+ border-top: none;
79
+ }
80
+
81
+ .ast-sites-dark-mode #ast-sites-modal .ast-tooltip-wrap {
82
+ background: #7d7e82;
83
+ }
84
+
85
+ .ast-sites-dark-mode #ast-sites-modal #wp-filter-search-input {
86
+ border-color: #d5dadf;
87
+ }
88
+
89
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__logo,
90
+ .ast-sites-dark-mode #ast-sites-modal .back-to-layout,
91
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip {
92
+ border-right: 1px solid #32363A;
93
+ }
94
+
95
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites__sync-wrap,
96
+ .ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__close--normal,
97
+ .ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip {
98
+ border-left: 1px solid #32363A;
99
+ }
100
+
101
+ .ast-sites-dark-mode #ast-sites-modal .elementor-template-library-menu-item.elementor-active {
102
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#26292C), to(#4C4F56));
103
+ background-image: -webkit-linear-gradient(top, #26292C, #4C4F56);
104
+ background-image: -o-linear-gradient(top, #26292C, #4C4F56);
105
+ background-image: linear-gradient(to bottom, #26292C, #4C4F56);
106
+ }
astra-sites/inc/assets/css/elementor-admin-rtl.css ADDED
@@ -0,0 +1,1220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .elementor-add-new-section .elementor-add-ast-site-button:not(.ast-elementor-white-label) {
2
+ margin-right: 5px;
3
+ background-image: url( '../images/logo.svg' );
4
+ background-repeat: no-repeat;
5
+ background-position: center center;
6
+ background-size: contain;
7
+ }
8
+
9
+ .elementor-add-ast-site-button:not(.ast-elementor-white-label) .eicon-folder {
10
+ opacity: 0;
11
+ }
12
+
13
+ .elementor-add-new-section .elementor-add-ast-site-button.ast-elementor-white-label {
14
+ margin-right: 5px;
15
+ background-color: #6d7882;
16
+ }
17
+
18
+ .elementor-add-new-section .elementor-add-ast-site-button i.fa {
19
+ visibility: hidden
20
+ }
21
+
22
+ #ast-sites-modal {
23
+ display: none;
24
+ }
25
+
26
+ #ast-sites-modal .agency-icon {
27
+ width: 20px;
28
+ }
29
+
30
+ #ast-sites-modal.dialog-type-lightbox .dialog-header {
31
+ padding: 0;
32
+ }
33
+
34
+ #ast-sites-modal .ast-sites-modal__header__logo__text-wrapper {
35
+ width: auto;
36
+ padding: 0;
37
+ padding-left: 12px;
38
+ }
39
+
40
+ #ast-sites-modal .ast-sites-modal__header__logo__icon-wrapper {
41
+ background-image: url( '../images/logo.svg' );
42
+ -webkit-border-radius: 2px;
43
+ background-repeat: no-repeat;
44
+ background-position: center center;
45
+ background-size: contain;
46
+ width: 30px;
47
+ height: 30px;
48
+ padding: 4px 7px 6px;
49
+ -webkit-border-radius: 2px;
50
+ border-radius: 2px;
51
+ margin-left: 15px;
52
+ }
53
+
54
+ #ast-sites-modal .astra-blocks-category-wrap {
55
+ text-align: right;
56
+ padding: 0 10px 15px 10px;
57
+ display: flex;
58
+ justify-content: space-between;
59
+ }
60
+
61
+ #ast-sites-modal .elementor-template-library-filter-toolbar > div {
62
+ margin-left: 10px;
63
+ }
64
+
65
+ #ast-sites-modal .astra-blocks-filter {
66
+ border-radius: 3px;
67
+ }
68
+
69
+ #ast-sites-modal .astra-blocks-filter,
70
+ #ast-sites-modal .elementor-template-library-order-input {
71
+ background: #fff;
72
+ padding-right: 5px;
73
+ padding-left: 20px;
74
+ height: 28px;
75
+ color: #6d7882;
76
+ }
77
+
78
+ #ast-sites-modal .astra-blocks-category-inner-wrap .select2-container {
79
+ width: 120px !important;
80
+ }
81
+
82
+ #ast-sites-modal .required-plugins-list li.plugin-card-head {
83
+ list-style-type: none;
84
+ border-bottom: 1px solid #e4e7ea;
85
+ padding-bottom: 12px;
86
+ margin-bottom: 7px;
87
+ margin-right: -16px;
88
+ }
89
+
90
+ #ast-sites-modal .required-plugins-list li.plugin-card-head.no-plugin {
91
+ list-style-type: none;
92
+ border-bottom: none;
93
+ padding-bottom: 0;
94
+ margin-bottom: 0;
95
+ margin-right: -16px;
96
+ }
97
+
98
+ #ast-sites-modal .required-plugins-list {
99
+ margin: 0;
100
+ padding: 0;
101
+ margin-right: 16px;
102
+ margin-top: .5em;
103
+ margin-bottom: .5em;
104
+ list-style-type: disc;
105
+ }
106
+
107
+ #ast-sites-modal .astra-sites-library-template:not(:hover) .elementor-template-library-template-preview,
108
+ #ast-sites-modal .inner:not(:hover) .elementor-template-library-template-preview {
109
+ opacity: 0;
110
+ }
111
+ #ast-sites-modal .astra-sites-library-template .elementor-template-library-template-preview,
112
+ #ast-sites-modal .inner .elementor-template-library-template-preview {
113
+ position: absolute;
114
+ top: 0;
115
+ right: 0;
116
+ width: 100%;
117
+ height: 100%;
118
+ background-color: rgba(0, 0, 0, 0.5);
119
+ -webkit-transition: opacity .2s;
120
+ -o-transition: opacity .2s;
121
+ transition: opacity .2s;
122
+ cursor: pointer;
123
+ }
124
+ #ast-sites-modal .astra-sites-library-template .elementor-template-library-template-preview i,
125
+ #ast-sites-modal .inner .elementor-template-library-template-preview i {
126
+ color: #d5dadf;
127
+ position: absolute;
128
+ top: 50%;
129
+ right: 50%;
130
+ -webkit-transform: translateX(50%) translateY(-50%);
131
+ -ms-transform: translateX(50%) translateY(-50%);
132
+ transform: translateX(50%) translateY(-50%);
133
+ font-size: 34px;
134
+ }
135
+ #ast-sites-modal .astra-sites-library-template:not(.elementor-template-library-template-page) .elementor-template-library-template-footer {
136
+ padding-top: 5px;
137
+ padding-right: 5px;
138
+ background-color: #fff;
139
+ -webkit-transition: -webkit-transform .2s;
140
+ transition: -webkit-transform .2s;
141
+ -o-transition: transform .2s;
142
+ transition: transform .2s;
143
+ transition: transform .2s, -webkit-transform .2s;
144
+ }
145
+ #ast-sites-modal .astra-loading-icon, .astra-loading-icon:after {
146
+ width: 50px;
147
+ height: 50px;
148
+ }
149
+ #ast-sites-modal .astra-sites-library-template .elementor-template-library-template-footer {
150
+ display: -webkit-box;
151
+ display: -webkit-flex;
152
+ display: -ms-flexbox;
153
+ display: flex;
154
+ -webkit-box-pack: justify;
155
+ -webkit-justify-content: space-between;
156
+ -ms-flex-pack: justify;
157
+ justify-content: space-between;
158
+ margin-top: 4px;
159
+ font-size: 11px;
160
+ line-height: 1;
161
+ }
162
+ #ast-sites-modal .theme-browser .theme .theme-screenshot:after {
163
+ padding-top: 200px;
164
+ }
165
+ #ast-sites-modal .required-plugins-list li {
166
+ list-style-type: disc;
167
+ }
168
+ #ast-sites-modal .ast-tooltip-wrap {
169
+ position: absolute;
170
+ right: 0px;
171
+ top: 61px;
172
+ background: #fff;
173
+ box-shadow: 0 3px 10px rgba(25, 30, 35, 0.12);
174
+ padding: 14px;
175
+ border-radius: 2px;
176
+ opacity: 0;
177
+ }
178
+
179
+ #ast-sites-modal .ast-tooltip-wrap::before {
180
+ border: 8px solid #fff;
181
+ content: "";
182
+ position: absolute;
183
+ height: 0;
184
+ width: 0;
185
+ line-height: 0;
186
+ top: -8px;
187
+ right: 28%;
188
+ border-bottom-style: solid;
189
+ border-right-color: transparent;
190
+ border-left-color: transparent;
191
+ border-top: none;
192
+ margin-right: -10px;
193
+ }
194
+
195
+ #ast-sites-modal .ast-tooltip-wrap.ast-show-tooltip {
196
+ display: block;
197
+ }
198
+
199
+ #ast-sites-modal .ast-tooltip-wrap {
200
+ display: none;
201
+ }
202
+
203
+ #ast-sites-modal .required-plugins-list {
204
+ text-align: right;
205
+ font-size: 12px;
206
+ font-weight: 300;
207
+ }
208
+
209
+ #ast-sites-modal .dialog-background-lightbox {
210
+ position: fixed;
211
+ height: 100%;
212
+ width: 100%;
213
+ top: 0;
214
+ right: 0;
215
+ z-index: 1;
216
+ -webkit-user-select: none;
217
+ -moz-user-select: none;
218
+ -ms-user-select: none;
219
+ user-select: none;
220
+ }
221
+
222
+ #ast-sites-modal .dialog-widget-content {
223
+ background-color: #f1f3f5;
224
+ width: 95vw;
225
+ height: 760px;
226
+ max-width: 1200px;
227
+ max-height: 95vh;
228
+ overflow-y: auto;
229
+ overflow-x: hidden;
230
+ top: 50%;
231
+ right: 50%;
232
+ transform: translate(50%, -50%);
233
+ z-index: 9999;
234
+ font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
235
+ width: 100%;
236
+ }
237
+
238
+ #ast-sites-modal .select2-search__field {
239
+ width: 93% !important
240
+ }
241
+
242
+ #ast-sites-modal .dialog-header {
243
+ padding: 0;
244
+ background-color: #fff;
245
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
246
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
247
+ position: relative;
248
+ z-index: 1;
249
+ }
250
+
251
+ #ast-sites-modal .dialog-buttons-wrapper {
252
+ background-color: #fff;
253
+ border: none;
254
+ display: none;
255
+ -webkit-box-pack: end;
256
+ -webkit-justify-content: flex-end;
257
+ -ms-flex-pack: end;
258
+ justify-content: flex-end;
259
+ padding: 5px;
260
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
261
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
262
+ position: relative;
263
+ }
264
+
265
+ #ast-sites-modal .dialog-buttons-wrapper .elementor-button {
266
+ height: 40px;
267
+ margin-right: 5px;
268
+ }
269
+
270
+ #ast-sites-modal .dialog-buttons-wrapper .elementor-button-success {
271
+ padding: 12px 36px;
272
+ color: #fff;
273
+ width: initial;
274
+ font-size: 15px;
275
+ }
276
+
277
+ #ast-sites-modal .elementor-template-library-order {
278
+ display: -webkit-box;
279
+ display: -webkit-flex;
280
+ display: -ms-flexbox;
281
+ display: flex;
282
+ }
283
+
284
+ #ast-sites-modal .ast-sites-template-library-filter-text-wrapper {
285
+ width: 200px;
286
+ position: relative;
287
+ }
288
+
289
+ #ast-sites-modal .ast-sites-template-library-filter-text-wrapper input {
290
+ border-bottom: 1px solid #d5dadf;
291
+ -webkit-border-radius: 0;
292
+ border-radius: 0;
293
+ font-size: 11px;
294
+ padding: 0 0 0 15px;
295
+ -webkit-transition: border 0.5s;
296
+ -o-transition: border 0.5s;
297
+ transition: border 0.5s;
298
+ background-color: transparent;
299
+ }
300
+
301
+ #ast-sites-modal .ast-sites-template-library-filter-text-wrapper i {
302
+ position: absolute;
303
+ top: 50%;
304
+ left: 0;
305
+ -webkit-transform: translateY(-50%);
306
+ -ms-transform: translateY(-50%);
307
+ transform: translateY(-50%);
308
+ }
309
+
310
+ #ast-sites-modal .ast-template-library-toolbar {
311
+ padding: 10px 45px 0 45px;
312
+ display: -webkit-box;
313
+ display: -webkit-flex;
314
+ display: -ms-flexbox;
315
+ display: flex;
316
+ -webkit-box-pack: justify;
317
+ -webkit-justify-content: space-between;
318
+ -ms-flex-pack: justify;
319
+ justify-content: space-between;
320
+ -webkit-box-align: center;
321
+ -webkit-align-items: center;
322
+ -ms-flex-align: center;
323
+ align-items: center;
324
+ }
325
+
326
+ #ast-sites-modal .dialog-buttons-wrapper .elementor-button-success:hover {
327
+ background-color: #39b54a;
328
+ }
329
+
330
+ #ast-sites-modal .astra-sites-content-wrap {
331
+ height: 706px;
332
+ max-height: 85vh;
333
+ overflow: auto;
334
+ padding-top: 15px;
335
+ }
336
+
337
+ #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar,
338
+ #ast-sites-modal .single-site-pages::-webkit-scrollbar {
339
+ width: 5px;
340
+ background-color: #f1f1f1;
341
+ }
342
+
343
+ #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar-thumb,
344
+ #ast-sites-modal .single-site-pages::-webkit-scrollbar-thumb {
345
+ border-radius: 0;
346
+ background-color: #aaaaaa;
347
+ }
348
+
349
+ #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar-track,
350
+ #ast-sites-modal .single-site-pages::-webkit-scrollbar-track {
351
+ -webkit-box-shadow: inset 0 0 0 rgba(0,0,0,.3);
352
+ width: 20px;
353
+ }
354
+
355
+ #ast-sites-modal .dialog-content {
356
+ height: 100%;
357
+ }
358
+
359
+ #ast-sites-modal .dialog-loading {
360
+ display: none;
361
+ }
362
+
363
+ #ast-sites-modal .astra-sites-search-wrap {
364
+ padding: 0 30px 20px;
365
+ margin-right: 1em;
366
+ }
367
+
368
+ #ast-sites-modal .ast-sites-modal__header {
369
+ display: -webkit-box;
370
+ display: -webkit-flex;
371
+ display: -ms-flexbox;
372
+ display: flex;
373
+ -webkit-box-align: center;
374
+ -webkit-align-items: center;
375
+ -ms-flex-align: center;
376
+ align-items: center;
377
+ -webkit-box-pack: justify;
378
+ -webkit-justify-content: space-between;
379
+ -ms-flex-pack: justify;
380
+ justify-content: space-between;
381
+ height: 50px;
382
+ }
383
+
384
+ #ast-sites-modal .ast-sites-modal__header__logo {
385
+ line-height: 1;
386
+ text-transform: uppercase;
387
+ font-weight: bold;
388
+ cursor: pointer;
389
+ border-left: 1px solid #e6e9ec;
390
+ }
391
+
392
+ #ast-sites-modal .ast-block-insert i {
393
+ padding-left: 5px;
394
+ }
395
+
396
+ #ast-sites-modal .back-to-layout:before {
397
+ line-height: 21px;
398
+ width: 21px;
399
+ height: 21px;
400
+ }
401
+
402
+ #ast-sites-modal .ast-sites-modal__header__logo-area {
403
+ text-align: right;
404
+ padding-right: 12px;
405
+ display: -webkit-box;
406
+ display: -webkit-flex;
407
+ display: -ms-flexbox;
408
+ display: flex;
409
+ }
410
+
411
+ #ast-sites-modal .elementor-template-library-header-menu {
412
+ width: 100%;
413
+ display: flex;
414
+ display: -webkit-box;
415
+ display: -webkit-flex;
416
+ display: -ms-flexbox;
417
+ text-align: center;
418
+ color: #6d7882;
419
+ font-size: 13px;
420
+ }
421
+
422
+ #ast-sites-modal .ast-sites-modal__options .elementor-template-library-header-menu {
423
+ height: 50px;
424
+ }
425
+
426
+ #ast-sites-modal .astra-sites__sync-wrap {
427
+ padding: 17px;
428
+ border-right: 1px solid #e6e9ec;
429
+ cursor: pointer;
430
+ }
431
+
432
+ #ast-sites-modal .astra-sites__sync-wrap:hover span {
433
+ color: #6d7882;
434
+ }
435
+
436
+ #ast-sites-modal .back-to-layout:hover {
437
+ background-color: transparent;
438
+ }
439
+
440
+ #ast-sites-modal .back-to-layout i {
441
+ font-size: 24px;
442
+ width: 24px;
443
+ height: 24px;
444
+ }
445
+
446
+ #ast-sites-modal .theme-browser .theme {
447
+ width: 20%;
448
+ padding: 15px;
449
+ margin: 0;
450
+ }
451
+
452
+ #ast-sites-modal .dialog-message {
453
+ height: calc( 100% - 30px );
454
+ padding: 10px 30px 30px 30px;
455
+ }
456
+
457
+ #ast-sites-modal .dialog-lightbox-content-block .theme {
458
+ width: 33.3%;
459
+ }
460
+
461
+ #ast-sites-modal .dialog-lightbox-content-block.theme-browser .theme .theme-screenshot:after {
462
+ padding-top: 40%;
463
+ }
464
+
465
+ #ast-sites-modal .ast-sites-modal__header__logo-area > * {
466
+ display: -webkit-box;
467
+ display: -webkit-flex;
468
+ display: -ms-flexbox;
469
+ display: flex;
470
+ -webkit-box-align: center;
471
+ -webkit-align-items: center;
472
+ -ms-flex-align: center;
473
+ align-items: center;
474
+ }
475
+
476
+ #ast-sites-modal .ast-sites-modal__header__logo__title {
477
+ padding-top: 2px;
478
+ }
479
+
480
+ #ast-sites-modal .ast-sites-modal__header__logo i {
481
+ color: #fff;
482
+ font-size: 10px;
483
+ }
484
+
485
+ #ast-sites-modal .ast-sites-modal__header__items-area {
486
+ display: -webkit-box;
487
+ display: -webkit-flex;
488
+ display: -ms-flexbox;
489
+ display: flex;
490
+ -webkit-box-orient: horizontal;
491
+ -webkit-box-direction: reverse;
492
+ -webkit-flex-direction: row-reverse;
493
+ -ms-flex-direction: row-reverse;
494
+ flex-direction: row-reverse;
495
+ }
496
+
497
+ #ast-sites-modal .ast-sites-modal__header__item {
498
+ position: relative;
499
+ display: -webkit-box;
500
+ display: -webkit-flex;
501
+ display: -ms-flexbox;
502
+ display: flex;
503
+ -webkit-box-align: center;
504
+ -webkit-align-items: center;
505
+ -ms-flex-align: center;
506
+ align-items: center;
507
+ -webkit-box-pack: center;
508
+ -webkit-justify-content: center;
509
+ -ms-flex-pack: center;
510
+ justify-content: center;
511
+ -webkit-box-sizing: content-box;
512
+ box-sizing: content-box;
513
+ cursor: pointer;
514
+ }
515
+
516
+ #ast-sites-modal .ast-sites-modal__header__close--normal .dashicons {
517
+ color: #aaa;
518
+ font-size: 22px;
519
+ }
520
+
521
+ #ast-sites-modal .ast-sites-modal__header__item > i {
522
+ font-size: 20px;
523
+ -webkit-transition: all 0.3s;
524
+ -o-transition: all 0.3s;
525
+ transition: all 0.3s;
526
+ }
527
+
528
+ #ast-sites-modal .ast-sites-modal__header__item > i:not(:hover) {
529
+ color: #a4afb7;
530
+ }
531
+
532
+ #ast-sites-modal .ast-sites-modal__header__close--normal {
533
+ width: 50px;
534
+ height: 50px;
535
+ border-right: 1px solid #e6e9ec;
536
+ }
537
+
538
+ #ast-sites-modal .ast-sites-modal__header__close--normal:hover i {
539
+ color: #6d7882;
540
+ }
541
+
542
+ #ast-sites-modal .ast-sites-modal__header__close--normal i {
543
+ font-size: 18px;
544
+ }
545
+
546
+ #ast-sites-modal .ast-sites-modal__header__close--skip {
547
+ padding: 10px;
548
+ padding-right: 20px;
549
+ margin-left: 10px;
550
+ color: #fff;
551
+ background-color: #a4afb7;
552
+ font-size: 11px;
553
+ font-weight: normal;
554
+ line-height: 1;
555
+ text-transform: uppercase;
556
+ -webkit-border-radius: 2px;
557
+ border-radius: 2px;
558
+ cursor: pointer;
559
+ }
560
+
561
+ #ast-sites-modal .ast-sites-modal__header__close--skip > i {
562
+ font-size: inherit;
563
+ padding-right: 10px;
564
+ margin-right: 15px;
565
+ border-right: 1px solid;
566
+ }
567
+
568
+ #ast-sites-modal .ast-sites-modal__header__close--skip > i:not(:hover) {
569
+ color: #fff;
570
+ }
571
+
572
+ #ast-sites-modal .ast-sites-modal__sidebar {
573
+ width: 25%;
574
+ background-color: rgba(255, 255, 255, 0.3);
575
+ }
576
+
577
+ #ast-sites-modal .ast-sites-modal__content {
578
+ -webkit-box-flex: 1;
579
+ -webkit-flex-grow: 1;
580
+ -ms-flex-positive: 1;
581
+ flex-grow: 1;
582
+ -webkit-box-shadow: 0 0 13px inset rgba(0, 0, 0, 0.05);
583
+ box-shadow: 0 0 13px inset rgba(0, 0, 0, 0.05);
584
+ }
585
+
586
+ .theme-browser .theme {
587
+ cursor: pointer;
588
+ float: right;
589
+ margin: 0 0 4% 4%;
590
+ position: relative;
591
+ width: 30.6%;
592
+ border: 1px solid #ddd;
593
+ box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1);
594
+ box-sizing: border-box;
595
+ }
596
+
597
+ #ast-sites-modal .inner {
598
+ position: relative;
599
+ padding: 8px 8px 0 8px;
600
+ background: #fff;
601
+ overflow: initial;
602
+ -webkit-box-shadow: 0 1px 20px 0 rgba(0, 0, 0, 0.07);
603
+ box-shadow: 0 1px 20px 0 rgba(0, 0, 0, 0.07);
604
+ -webkit-border-radius: 3px;
605
+ border-radius: 3px;
606
+ }
607
+
608
+ #ast-sites-modal .astra-sites-no-sites .description {
609
+ font-size: 13px;
610
+ margin: 0;
611
+ }
612
+
613
+ #ast-sites-modal .astra-sites-no-sites .description a,
614
+ #ast-sites-modal .ast-tooltip-inner-wrap a {
615
+ color: #0073aa;
616
+ }
617
+
618
+ #ast-sites-modal .astra-sites-no-sites .description a:hover,
619
+ #ast-sites-modal .astra-sites-no-sites .description a:active,
620
+ #ast-sites-modal .astra-sites-no-sites .description a:focus,
621
+ #ast-sites-modal .ast-tooltip-inner-wrap a:hover,
622
+ #ast-sites-modal .ast-tooltip-inner-wrap a:active,
623
+ #ast-sites-modal .ast-tooltip-inner-wrap a:focus {
624
+ color: #00a0d2;
625
+ }
626
+
627
+ #ast-sites-modal .astra-sites-no-sites .content {
628
+ justify-content: center;
629
+ }
630
+
631
+ #ast-sites-modal .astra-sites-no-sites .inner {
632
+ background: transparent;
633
+ box-shadow: none;
634
+ }
635
+
636
+ #ast-sites-modal .astra-sites-no-sites .button.astra-sites-back {
637
+ display: inline-block;
638
+ text-decoration: none;
639
+ font-size: 13px;
640
+ line-height: 26px;
641
+ height: 28px;
642
+ margin: 0;
643
+ padding: 0 10px 1px;
644
+ cursor: pointer;
645
+ border-width: 1px;
646
+ border-style: solid;
647
+ -webkit-appearance: none;
648
+ border-radius: 3px;
649
+ white-space: nowrap;
650
+ box-sizing: border-box;
651
+ background: #fafafa;
652
+ border-color: #999;
653
+ color: #23282d;
654
+ }
655
+
656
+ #ast-sites-modal .astra-sites-no-sites h3 {
657
+ margin-bottom: 1.2em;
658
+ }
659
+
660
+ .theme-browser .theme .theme-screenshot:after {
661
+ content: "";
662
+ display: block;
663
+ padding-top: 66.66666%;
664
+ }
665
+
666
+ #ast-sites-modal .theme-name {
667
+ height: auto;
668
+ align-self: center;
669
+ box-shadow: none;
670
+ background: none;
671
+ padding: 7px;
672
+ padding-right: 0;
673
+ font-size: 11px;
674
+ font-weight: normal;
675
+ text-align: right;
676
+ }
677
+
678
+ #ast-sites-modal .theme-browser {
679
+ display: -webkit-box;
680
+ display: -ms-flexbox;
681
+ display: flex;
682
+ -ms-flex-wrap: wrap;
683
+ flex-wrap: wrap;
684
+ }
685
+
686
+ #ast-sites-modal .astra-sites-no-sites {
687
+ width: 100%;
688
+ }
689
+
690
+ #ast-sites-modal .elementor-template-library-menu-item {
691
+ line-height: 1em;
692
+ width: 108px;
693
+ padding: 15px 0;
694
+ display: inline-block;
695
+ }
696
+
697
+ #ast-sites-modal .elementor-template-library-menu-item:hover {
698
+ color: #6d7882;
699
+ }
700
+
701
+ #ast-sites-modal .elementor-template-library-menu-item span {
702
+ margin-left: 10px;
703
+ font-size: 16px;
704
+ }
705
+
706
+ #ast-sites-modal .astra-sites-sync-library-button span {
707
+ font-size: 16px;
708
+ color: #a4afb7;
709
+ }
710
+
711
+ #ast-sites-modal .elementor-template-library-menu-item.elementor-active {
712
+ border-bottom: 3px solid #0073aa;
713
+ background-image: linear-gradient(to bottom, #f1f3f5, #fff);
714
+ color: #6d7882;
715
+ }
716
+
717
+ #ast-sites-modal .theme-preview,
718
+ #ast-sites-modal .theme-preview-block {
719
+ display: none;
720
+ margin: 0 1.3%;
721
+ margin-top: 10px;
722
+ }
723
+
724
+ #ast-sites-modal .ast-validate {
725
+ font-size: 13px;
726
+ line-height: 1.5;
727
+ }
728
+
729
+ #ast-sites-modal .ast-library-template-insert.action-done:before {
730
+ content: "\f147";
731
+ display: inline-block;
732
+ margin-left: 10px;
733
+ font: normal 20px/1 'dashicons';
734
+ -webkit-font-smoothing: antialiased;
735
+ -moz-osx-font-smoothing: grayscale;
736
+ vertical-align: middle;
737
+ }
738
+
739
+ #ast-sites-modal .ast-import-elementor-template.action-done:after {
740
+ content: "\f504";
741
+ display: inline-block;
742
+ margin-right: 10px;
743
+ font: normal 20px/1 'dashicons';
744
+ -webkit-font-smoothing: antialiased;
745
+ -moz-osx-font-smoothing: grayscale;
746
+ vertical-align: middle;
747
+ }
748
+
749
+ #ast-sites-modal .ast-library-template-insert.installing:before,
750
+ #ast-sites-modal .ast-import-elementor-template.installing:before {
751
+ content: "\f463";
752
+ display: inline-block;
753
+ margin-left: 10px;
754
+ font: normal 20px/1 'dashicons';
755
+ -webkit-font-smoothing: antialiased;
756
+ -moz-osx-font-smoothing: grayscale;
757
+ vertical-align: middle;
758
+ -webkit-animation: cssAnimation .72s ease infinite;
759
+ -moz-animation: cssAnimation .72s ease infinite;
760
+ -o-animation: cssAnimation .72s ease infinite;
761
+ -ms-animation: cssAnimation .72s ease infinite;
762
+ animation: cssAnimation .72s ease infinite;
763
+ }
764
+
765
+ @-webkit-keyframes cssAnimation {
766
+ from {
767
+ -webkit-transform: rotate(0);
768
+ -moz-transform: rotate(0);
769
+ -o-transform: rotate(0);
770
+ -ms-transform: rotate(0);
771
+ transform: rotate(0);
772
+ }
773
+ to {
774
+ -webkit-transform: rotate(-360deg);
775
+ -moz-transform: rotate(-360deg);
776
+ -o-transform: rotate(-360deg);
777
+ -ms-transform: rotate(-360deg);
778
+ transform: rotate(-360deg);
779
+ }
780
+ }
781
+ @-moz-keyframes cssAnimation {
782
+ from {
783
+ -webkit-transform: rotate(0);
784
+ -moz-transform: rotate(0);
785
+ -o-transform: rotate(0);
786
+ -ms-transform: rotate(0);
787
+ transform: rotate(0);
788
+ }
789
+ to {
790
+ -webkit-transform: rotate(-360deg);
791
+ -moz-transform: rotate(-360deg);
792
+ -o-transform: rotate(-360deg);
793
+ -ms-transform: rotate(-360deg);
794
+ transform: rotate(-360deg);
795
+ }
796
+ }
797
+ @-o-keyframes cssAnimation {
798
+ from {
799
+ -webkit-transform: rotate(0);
800
+ -moz-transform: rotate(0);
801
+ -o-transform: rotate(0);
802
+ -ms-transform: rotate(0);
803
+ transform: rotate(0);
804
+ }
805
+ to {
806
+ -webkit-transform: rotate(-360deg);
807
+ -moz-transform: rotate(-360deg);
808
+ -o-transform: rotate(-360deg);
809
+ -ms-transform: rotate(-360deg);
810
+ transform: rotate(-360deg);
811
+ }
812
+ }
813
+
814
+ #ast-sites-modal .astra-sites-library-template {
815
+ position: relative;
816
+ width: 33.333%;
817
+ overflow: hidden;
818
+ padding: 15px;
819
+ margin: 0;
820
+ cursor: pointer;
821
+ }
822
+
823
+ #ast-sites-modal .elementor-template-library-template-body {
824
+ display: -webkit-box;
825
+ display: -ms-flexbox;
826
+ display: flex;
827
+ position: relative;
828
+ }
829
+
830
+ #ast-sites-modal .elementor-template-library-template-body img {
831
+ width:100%;
832
+ }
833
+
834
+ #ast-sites-modal .astra-sites-library-template-inner {
835
+ margin: 0;
836
+ -webkit-border-radius: 2px;
837
+ border-radius: 2px;
838
+ -webkit-box-shadow: 0 1px 20px 0 rgba(0,0,0,.07);
839
+ box-shadow: 0 1px 20px 0 rgba(0,0,0,.07);
840
+ padding: 8px 8px 0 8px;
841
+ background: #fff;
842
+ position: relative;
843
+ }
844
+
845
+ #ast-sites-modal .elementor-template-library-template-remote:not(.elementor-template-library-template-page) {
846
+ display: inline-table;
847
+ }
848
+
849
+ #ast-sites-modal .theme-preview img,
850
+ #ast-sites-modal .theme-preview-block img {
851
+ width: 100%;
852
+ }
853
+
854
+ #ast-sites-modal .dialog-lightbox-back {
855
+ background: #fff;
856
+ padding: 10px 10px;
857
+ text-align: right;
858
+ margin-bottom: 20px;
859
+ }
860
+
861
+ #ast-sites-modal .dialog-lightbox-back span {
862
+ cursor: pointer;
863
+ font-weight: bold;
864
+ }
865
+
866
+ #ast-sites-modal .ast-sites-modal__header__menu-area {
867
+ position: relative;
868
+ display: -webkit-box;
869
+ display: -webkit-flex;
870
+ display: -ms-flexbox;
871
+ display: flex;
872
+ -webkit-box-align: center;
873
+ -webkit-align-items: center;
874
+ -ms-flex-align: center;
875
+ align-items: center;
876
+ margin-left: 140px;
877
+ margin-right: 50px;
878
+ flex: 1;
879
+ }
880
+
881
+ #ast-sites-modal .back-to-layout {
882
+ height: 50px;
883
+ padding: 14px;
884
+ }
885
+
886
+ #ast-sites-modal .search-form {
887
+ width: 100%;
888
+ font-weight: normal;
889
+ border: none;
890
+ margin: 0;
891
+ border-radius: 6px;
892
+ position: relative;
893
+ }
894
+ #ast-sites-modal .ast-icon-search {
895
+ position: absolute;
896
+ left: 0;
897
+ top: 0;
898
+ color: #C3C3C3;
899
+ padding: 15px 12px 12px 19px;
900
+ }
901
+ #ast-sites-modal ::-webkit-input-placeholder {
902
+ color: #72777c;
903
+ }
904
+ #ast-sites-modal .astra-sites-sync-library-button.updating-message {
905
+ color: #0073aa;
906
+ }
907
+
908
+ #ast-sites-modal #wp-filter-search-input {
909
+ width: 100%;
910
+ opacity: 1;
911
+ background: transparent;
912
+ border-bottom: 1px solid #ddd;
913
+ border-radius: 0;
914
+ font-size: 11px;
915
+ border: none;
916
+ border-bottom: 1px solid #ddd;
917
+ box-shadow: none;
918
+ height: auto;
919
+ }
920
+
921
+ #ast-sites-modal #wp-filter-search-input.searching {
922
+ border-bottom-right-radius: 0;
923
+ border-bottom-left-radius: 0;
924
+ border-bottom-color: transparent;
925
+ border-color: rgba(223,225,229,0);
926
+ box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28);
927
+ }
928
+
929
+ #ast-sites-modal .single-site-pages-wrap {
930
+ text-align: right;
931
+ }
932
+
933
+ #ast-sites-modal .astra-site-title {
934
+ margin-bottom: 20px;
935
+ text-align: right;
936
+ }
937
+
938
+ #ast-sites-modal .astra-site-contents,
939
+ #ast-sites-modal .astra-sites-import-template,
940
+ #ast-sites-modal .astra-sites-create-page-wrap {
941
+ margin-bottom: 40px;
942
+ }
943
+
944
+ #ast-sites-modal .astra-sites-import-template-notice,
945
+ #ast-sites-modal .astra-sites-create-page-wrap-notice {
946
+ font-size: 15px;
947
+ color: #767676;
948
+ padding: 5px 0 10px;
949
+ }
950
+
951
+ #ast-sites-modal .ast-sites-floating-notice {
952
+ font-size: 13px;
953
+ line-height: 1.5em;
954
+ position: relative;
955
+ }
956
+
957
+ #ast-sites-modal .agency-ribbons {
958
+ top: -5px;
959
+ font-size: 9px;
960
+ left: -5px;
961
+ line-height: 14px;
962
+ }
963
+
964
+ .ast-sites-floating-notice-wrap {
965
+ background: #fff;
966
+ border: 1px solid #ccd0d4;
967
+ border-right-width: 4px;
968
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
969
+ margin: 5px 15px 2px;
970
+ padding: 1px 12px;
971
+ }
972
+
973
+ #ast-sites-modal .notice-dismiss:before {
974
+ background: none;
975
+ color: #72777c;
976
+ content: "\f153";
977
+ display: block;
978
+ font: normal 16px/20px dashicons;
979
+ font-size: 14px;
980
+ speak: none;
981
+ height: 20px;
982
+ text-align: center;
983
+ width: 20px;
984
+ -webkit-font-smoothing: antialiased;
985
+ -moz-osx-font-smoothing: grayscale;
986
+ }
987
+
988
+ #ast-sites-modal .notice-dismiss:hover:before,
989
+ #ast-sites-modal .notice-dismiss:active:before,
990
+ #ast-sites-modal .notice-dismiss:focus:before {
991
+ color: #c00;
992
+ }
993
+
994
+ #ast-sites-modal .ast-sites-floating-notice-wrap.refreshed-notice {
995
+ border-right: 5px solid #46b450;
996
+ }
997
+
998
+ #ast-sites-modal button.notice-dismiss {
999
+ position: absolute;
1000
+ top: 0;
1001
+ left: 1px;
1002
+ border: none;
1003
+ margin: 0;
1004
+ background: none;
1005
+ color: #72777c;
1006
+ cursor: pointer;
1007
+ padding:0;
1008
+ }
1009
+
1010
+ #ast-sites-modal .button-hero {
1011
+ background: #0085ba;
1012
+ border-color: #0073aa #006799 #006799;
1013
+ box-shadow: 0 1px 0 #006799;
1014
+ color: #fff;
1015
+ text-decoration: none;
1016
+ text-shadow: 0 -1px 1px #006799, -1px 0 1px #006799, 0 1px 1px #006799, 1px 0 1px #006799;
1017
+ cursor: pointer;
1018
+ border-width: 1px;
1019
+ border-style: solid;
1020
+ -webkit-appearance: none;
1021
+ border-radius: 3px;
1022
+ white-space: nowrap;
1023
+ box-sizing: border-box;
1024
+ }
1025
+
1026
+ #ast-sites-modal .button-hero.site-preview-button {
1027
+ color: #555;
1028
+ border-color: #cccccc;
1029
+ background: #f7f7f7;
1030
+ box-shadow: 0 1px 0 #cccccc;
1031
+ vertical-align: top;
1032
+ text-shadow: none;
1033
+ }
1034
+
1035
+ #ast-sites-modal form {
1036
+ display: flex;
1037
+ }
1038
+
1039
+ #ast-sites-modal form .ast-importer-create-button {
1040
+ margin-right: 10px;
1041
+ }
1042
+
1043
+ #ast-sites-modal form input {
1044
+ width: 50%;
1045
+ padding: 10px 20px;
1046
+ }
1047
+
1048
+ #ast-sites-modal .astra-sites-import-template-action .button {
1049
+ display: inline-block;
1050
+ cursor: pointer;
1051
+ }
1052
+
1053
+ #ast-sites-modal .theme-id-container {
1054
+ justify-content: space-between;
1055
+ display: flex;
1056
+ line-height: 1.5em;
1057
+ }
1058
+
1059
+ #ast-sites-modal .elementor-templates-modal__header__items-area {
1060
+ height: 50px;
1061
+ }
1062
+
1063
+ #ast-sites-modal .ast-library-template-insert {
1064
+ margin-left: 15px;
1065
+ }
1066
+
1067
+ #ast-sites-modal .elementor-template-library-template-insert {
1068
+ color: #39b54a;
1069
+ padding: 7px;
1070
+ font-size: 12px;
1071
+ line-height: 1.5em;
1072
+ font-weight: 400;
1073
+ display: none;
1074
+ }
1075
+
1076
+ /* Uncomment this when Insert Link logic needs to be enabled. */
1077
+ /* #ast-sites-modal .astra-theme:hover .elementor-template-library-template-insert {
1078
+ display: block;
1079
+ } */
1080
+
1081
+ #ast-sites-modal .astra-sites-content-wrap.processing > div,
1082
+ #ast-sites-modal .astra-sites-content-wrap > div.astra-loading-wrap {
1083
+ opacity: 0;
1084
+ }
1085
+ /* Uncomment this when Insert Link logic needs to be enabled. */
1086
+ /* #ast-sites-modal .astra-sites-content-wrap.processing > div.astra-loading-wrap {
1087
+ opacity: 1;
1088
+ } */
1089
+
1090
+ #ast-sites-modal .elementor-template-library-template-go-pro {
1091
+ color: #D30C5C;
1092
+ padding: 7px;
1093
+ display: none;
1094
+ }
1095
+
1096
+ #ast-sites-modal .astra-theme:hover .elementor-template-library-template-go-pro {
1097
+ display: block;
1098
+ }
1099
+
1100
+ #ast-sites-modal .dialog-lightbox-content-block .elementor-template-library-template-insert {
1101
+ padding: 0;
1102
+ }
1103
+
1104
+ #ast-sites-modal .astra-sites-import-template-action .button-hero.disabled {
1105
+ color: #66c6e4 !important;
1106
+ background: #008ec2 !important;
1107
+ border-color: #007cb2 !important;
1108
+ box-shadow: none !important;
1109
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
1110
+ cursor: default;
1111
+ }
1112
+
1113
+ #ast-sites-modal .single-site-footer {
1114
+ margin-right: 0;
1115
+ padding-left: 15px;
1116
+ padding-right: 30px;
1117
+ }
1118
+
1119
+ #ast-sites-modal .single-site-preview {
1120
+ margin-left: 0;
1121
+ max-height: calc( 100vh - 160px );
1122
+ height: auto;
1123
+ }
1124
+
1125
+ #ast-sites-modal .ast-sites-floating-notice-wrap {
1126
+ margin: 15px 45px -5px 45px;
1127
+ background: #ffffff;
1128
+ padding: 8px 15px;
1129
+ border-right: 4px solid #00a0d2;
1130
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
1131
+ border-radius: 2px;
1132
+ vertical-align: middle;
1133
+ z-index: 99999;
1134
+ text-align: right;
1135
+ display: none;
1136
+ }
1137
+
1138
+ #ast-sites-modal .ast-sites-floating-notice-wrap.slide-out {
1139
+ display: none;
1140
+ }
1141
+
1142
+ #ast-sites-modal .ast-sites-floating-notice-wrap.slide-in {
1143
+ display: block;
1144
+ }
1145
+
1146
+ @keyframes slide-in {
1147
+ 100% { transform: translateX(0%); }
1148
+ }
1149
+
1150
+ @-webkit-keyframes slide-in {
1151
+ 100% { -webkit-transform: translateX(0%); }
1152
+ }
1153
+
1154
+ @keyframes slide-out {
1155
+ 0% { transform: translateX(0%); }
1156
+ 100% { transform: translateX(-120%); }
1157
+ }
1158
+
1159
+ @-webkit-keyframes slide-out {
1160
+ 0% { -webkit-transform: translateX(0%); }
1161
+ 100% { -webkit-transform: translateX(-120%); }
1162
+ }
1163
+
1164
+ #ast-sites-modal .single-site-preview-wrap {
1165
+ width: 100%;
1166
+ }
1167
+
1168
+ #ast-sites-modal .astra-sites-tooltip {
1169
+ margin-right: 15px;
1170
+ margin-left: 15px;
1171
+ padding-right: 15px;
1172
+ padding-left:15px;
1173
+ height: 50px;
1174
+ border-right: 1px solid #e6e9ec;
1175
+ border-left: 1px solid #e6e9ec;
1176
+ opacity: 0;
1177
+ }
1178
+
1179
+ #ast-sites-modal .astra-sites-tooltip-icon {
1180
+ line-height: 50px;
1181
+ }
1182
+
1183
+ #ast-sites-modal .astra-sites-tooltip .dashicons-editor-help {
1184
+ font-size: 20px;
1185
+ color: #555d66;
1186
+ }
1187
+
1188
+ #ast-sites-modal .astra-preview-actions-inner-wrap {
1189
+ position: relative;
1190
+ }
1191
+
1192
+ #ast-sites-modal .astra-preview-actions-wrap {
1193
+ margin-left: 15px;
1194
+ }
1195
+
1196
+ #ast-sites-modal .site-action-buttons-wrap .dashicons {
1197
+ margin-right: 0;
1198
+ }
1199
+
1200
+ #ast-sites-modal .position-left-last {
1201
+ margin-left: auto;
1202
+ }
1203
+
1204
+ #elementor-template-block-color-filter select,
1205
+ #elementor-template-block-color-filter option {
1206
+ text-transform: capitalize;
1207
+ }
1208
+
1209
+ @media (max-width: 768px) {
1210
+ #ast-sites-modal .theme-browser .theme {
1211
+ width: 33.33%;
1212
+ box-shadow: none;
1213
+ }
1214
+ #ast-sites-modal .position-left-last {
1215
+ width: 120px;
1216
+ }
1217
+ #ast-sites-modal .ast-sites-modal__header__menu-area {
1218
+ margin: 0 10px;
1219
+ }
1220
+ }
astra-sites/inc/assets/css/elementor-admin.css ADDED
@@ -0,0 +1,1220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .elementor-add-new-section .elementor-add-ast-site-button:not(.ast-elementor-white-label) {
2
+ margin-left: 5px;
3
+ background-image: url( '../images/logo.svg' );
4
+ background-repeat: no-repeat;
5
+ background-position: center center;
6
+ background-size: contain;
7
+ }
8
+
9
+ .elementor-add-ast-site-button:not(.ast-elementor-white-label) .eicon-folder {
10
+ opacity: 0;
11
+ }
12
+
13
+ .elementor-add-new-section .elementor-add-ast-site-button.ast-elementor-white-label {
14
+ margin-left: 5px;
15
+ background-color: #6d7882;
16
+ }
17
+
18
+ .elementor-add-new-section .elementor-add-ast-site-button i.fa {
19
+ visibility: hidden
20
+ }
21
+
22
+ #ast-sites-modal {
23
+ display: none;
24
+ }
25
+
26
+ #ast-sites-modal .agency-icon {
27
+ width: 20px;
28
+ }
29
+
30
+ #ast-sites-modal.dialog-type-lightbox .dialog-header {
31
+ padding: 0;
32
+ }
33
+
34
+ #ast-sites-modal .ast-sites-modal__header__logo__text-wrapper {
35
+ width: auto;
36
+ padding: 0;
37
+ padding-right: 12px;
38
+ }
39
+
40
+ #ast-sites-modal .ast-sites-modal__header__logo__icon-wrapper {
41
+ background-image: url( '../images/logo.svg' );
42
+ -webkit-border-radius: 2px;
43
+ background-repeat: no-repeat;
44
+ background-position: center center;
45
+ background-size: contain;
46
+ width: 30px;
47
+ height: 30px;
48
+ padding: 4px 7px 6px;
49
+ -webkit-border-radius: 2px;
50
+ border-radius: 2px;
51
+ margin-right: 15px;
52
+ }
53
+
54
+ #ast-sites-modal .astra-blocks-category-wrap {
55
+ text-align: left;
56
+ padding: 0 10px 15px 10px;
57
+ display: flex;
58
+ justify-content: space-between;
59
+ }
60
+
61
+ #ast-sites-modal .elementor-template-library-filter-toolbar > div {
62
+ margin-right: 10px;
63
+ }
64
+
65
+ #ast-sites-modal .astra-blocks-filter {
66
+ border-radius: 3px;
67
+ }
68
+
69
+ #ast-sites-modal .astra-blocks-filter,
70
+ #ast-sites-modal .elementor-template-library-order-input {
71
+ background: #fff;
72
+ padding-left: 5px;
73
+ padding-right: 20px;
74
+ height: 28px;
75
+ color: #6d7882;
76
+ }
77
+
78
+ #ast-sites-modal .astra-blocks-category-inner-wrap .select2-container {
79
+ width: 120px !important;
80
+ }
81
+
82
+ #ast-sites-modal .required-plugins-list li.plugin-card-head {
83
+ list-style-type: none;
84
+ border-bottom: 1px solid #e4e7ea;
85
+ padding-bottom: 12px;
86
+ margin-bottom: 7px;
87
+ margin-left: -16px;
88
+ }
89
+
90
+ #ast-sites-modal .required-plugins-list li.plugin-card-head.no-plugin {
91
+ list-style-type: none;
92
+ border-bottom: none;
93
+ padding-bottom: 0;
94
+ margin-bottom: 0;
95
+ margin-left: -16px;
96
+ }
97
+
98
+ #ast-sites-modal .required-plugins-list {
99
+ margin: 0;
100
+ padding: 0;
101
+ margin-left: 16px;
102
+ margin-top: .5em;
103
+ margin-bottom: .5em;
104
+ list-style-type: disc;
105
+ }
106
+
107
+ #ast-sites-modal .astra-sites-library-template:not(:hover) .elementor-template-library-template-preview,
108
+ #ast-sites-modal .inner:not(:hover) .elementor-template-library-template-preview {
109
+ opacity: 0;
110
+ }
111
+ #ast-sites-modal .astra-sites-library-template .elementor-template-library-template-preview,
112
+ #ast-sites-modal .inner .elementor-template-library-template-preview {
113
+ position: absolute;
114
+ top: 0;
115
+ left: 0;
116
+ width: 100%;
117
+ height: 100%;
118
+ background-color: rgba(0, 0, 0, 0.5);
119
+ -webkit-transition: opacity .2s;
120
+ -o-transition: opacity .2s;
121
+ transition: opacity .2s;
122
+ cursor: pointer;
123
+ }
124
+ #ast-sites-modal .astra-sites-library-template .elementor-template-library-template-preview i,
125
+ #ast-sites-modal .inner .elementor-template-library-template-preview i {
126
+ color: #d5dadf;
127
+ position: absolute;
128
+ top: 50%;
129
+ left: 50%;
130
+ -webkit-transform: translateX(-50%) translateY(-50%);
131
+ -ms-transform: translateX(-50%) translateY(-50%);
132
+ transform: translateX(-50%) translateY(-50%);
133
+ font-size: 34px;
134
+ }
135
+ #ast-sites-modal .astra-sites-library-template:not(.elementor-template-library-template-page) .elementor-template-library-template-footer {
136
+ padding-top: 5px;
137
+ padding-left: 5px;
138
+ background-color: #fff;
139
+ -webkit-transition: -webkit-transform .2s;
140
+ transition: -webkit-transform .2s;
141
+ -o-transition: transform .2s;
142
+ transition: transform .2s;
143
+ transition: transform .2s, -webkit-transform .2s;
144
+ }
145
+ #ast-sites-modal .astra-loading-icon, .astra-loading-icon:after {
146
+ width: 50px;
147
+ height: 50px;
148
+ }
149
+ #ast-sites-modal .astra-sites-library-template .elementor-template-library-template-footer {
150
+ display: -webkit-box;
151
+ display: -webkit-flex;
152
+ display: -ms-flexbox;
153
+ display: flex;
154
+ -webkit-box-pack: justify;
155
+ -webkit-justify-content: space-between;
156
+ -ms-flex-pack: justify;
157
+ justify-content: space-between;
158
+ margin-top: 4px;
159
+ font-size: 11px;
160
+ line-height: 1;
161
+ }
162
+ #ast-sites-modal .theme-browser .theme .theme-screenshot:after {
163
+ padding-top: 200px;
164
+ }
165
+ #ast-sites-modal .required-plugins-list li {
166
+ list-style-type: disc;
167
+ }
168
+ #ast-sites-modal .ast-tooltip-wrap {
169
+ position: absolute;
170
+ left: 0px;
171
+ top: 61px;
172
+ background: #fff;
173
+ box-shadow: 0 3px 10px rgba(25, 30, 35, 0.12);
174
+ padding: 14px;
175
+ border-radius: 2px;
176
+ opacity: 0;
177
+ }
178
+
179
+ #ast-sites-modal .ast-tooltip-wrap::before {
180
+ border: 8px solid #fff;
181
+ content: "";
182
+ position: absolute;
183
+ height: 0;
184
+ width: 0;
185
+ line-height: 0;
186
+ top: -8px;
187
+ left: 28%;
188
+ border-bottom-style: solid;
189
+ border-left-color: transparent;
190
+ border-right-color: transparent;
191
+ border-top: none;
192
+ margin-left: -10px;
193
+ }
194
+
195
+ #ast-sites-modal .ast-tooltip-wrap.ast-show-tooltip {
196
+ display: block;
197
+ }
198
+
199
+ #ast-sites-modal .ast-tooltip-wrap {
200
+ display: none;
201
+ }
202
+
203
+ #ast-sites-modal .required-plugins-list {
204
+ text-align: left;
205
+ font-size: 12px;
206
+ font-weight: 300;
207
+ }
208
+
209
+ #ast-sites-modal .dialog-background-lightbox {
210
+ position: fixed;
211
+ height: 100%;
212
+ width: 100%;
213
+ top: 0;
214
+ left: 0;
215
+ z-index: 1;
216
+ -webkit-user-select: none;
217
+ -moz-user-select: none;
218
+ -ms-user-select: none;
219
+ user-select: none;
220
+ }
221
+
222
+ #ast-sites-modal .dialog-widget-content {
223
+ background-color: #f1f3f5;
224
+ width: 95vw;
225
+ height: 760px;
226
+ max-width: 1200px;
227
+ max-height: 95vh;
228
+ overflow-y: auto;
229
+ overflow-x: hidden;
230
+ top: 50%;
231
+ left: 50%;
232
+ transform: translate(-50%, -50%);
233
+ z-index: 9999;
234
+ font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
235
+ width: 100%;
236
+ }
237
+
238
+ #ast-sites-modal .select2-search__field {
239
+ width: 93% !important
240
+ }
241
+
242
+ #ast-sites-modal .dialog-header {
243
+ padding: 0;
244
+ background-color: #fff;
245
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
246
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
247
+ position: relative;
248
+ z-index: 1;
249
+ }
250
+
251
+ #ast-sites-modal .dialog-buttons-wrapper {
252
+ background-color: #fff;
253
+ border: none;
254
+ display: none;
255
+ -webkit-box-pack: end;
256
+ -webkit-justify-content: flex-end;
257
+ -ms-flex-pack: end;
258
+ justify-content: flex-end;
259
+ padding: 5px;
260
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
261
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
262
+ position: relative;
263
+ }
264
+
265
+ #ast-sites-modal .dialog-buttons-wrapper .elementor-button {
266
+ height: 40px;
267
+ margin-left: 5px;
268
+ }
269
+
270
+ #ast-sites-modal .dialog-buttons-wrapper .elementor-button-success {
271
+ padding: 12px 36px;
272
+ color: #fff;
273
+ width: initial;
274
+ font-size: 15px;
275
+ }
276
+
277
+ #ast-sites-modal .elementor-template-library-order {
278
+ display: -webkit-box;
279
+ display: -webkit-flex;
280
+ display: -ms-flexbox;
281
+ display: flex;
282
+ }
283
+
284
+ #ast-sites-modal .ast-sites-template-library-filter-text-wrapper {
285
+ width: 200px;
286
+ position: relative;
287
+ }
288
+
289
+ #ast-sites-modal .ast-sites-template-library-filter-text-wrapper input {
290
+ border-bottom: 1px solid #d5dadf;
291
+ -webkit-border-radius: 0;
292
+ border-radius: 0;
293
+ font-size: 11px;
294
+ padding: 0 15px 0 0;
295
+ -webkit-transition: border 0.5s;
296
+ -o-transition: border 0.5s;
297
+ transition: border 0.5s;
298
+ background-color: transparent;
299
+ }
300
+
301
+ #ast-sites-modal .ast-sites-template-library-filter-text-wrapper i {
302
+ position: absolute;
303
+ top: 50%;
304
+ right: 0;
305
+ -webkit-transform: translateY(-50%);
306
+ -ms-transform: translateY(-50%);
307
+ transform: translateY(-50%);
308
+ }
309
+
310
+ #ast-sites-modal .ast-template-library-toolbar {
311
+ padding: 10px 45px 0 45px;
312
+ display: -webkit-box;
313
+ display: -webkit-flex;
314
+ display: -ms-flexbox;
315
+ display: flex;
316
+ -webkit-box-pack: justify;
317
+ -webkit-justify-content: space-between;
318
+ -ms-flex-pack: justify;
319
+ justify-content: space-between;
320
+ -webkit-box-align: center;
321
+ -webkit-align-items: center;
322
+ -ms-flex-align: center;
323
+ align-items: center;
324
+ }
325
+
326
+ #ast-sites-modal .dialog-buttons-wrapper .elementor-button-success:hover {
327
+ background-color: #39b54a;
328
+ }
329
+
330
+ #ast-sites-modal .astra-sites-content-wrap {
331
+ height: 706px;
332
+ max-height: 85vh;
333
+ overflow: auto;
334
+ padding-top: 15px;
335
+ }
336
+
337
+ #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar,
338
+ #ast-sites-modal .single-site-pages::-webkit-scrollbar {
339
+ width: 5px;
340
+ background-color: #f1f1f1;
341
+ }
342
+
343
+ #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar-thumb,
344
+ #ast-sites-modal .single-site-pages::-webkit-scrollbar-thumb {
345
+ border-radius: 0;
346
+ background-color: #aaaaaa;
347
+ }
348
+
349
+ #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar-track,
350
+ #ast-sites-modal .single-site-pages::-webkit-scrollbar-track {
351
+ -webkit-box-shadow: inset 0 0 0 rgba(0,0,0,.3);
352
+ width: 20px;
353
+ }
354
+
355
+ #ast-sites-modal .dialog-content {
356
+ height: 100%;
357
+ }
358
+
359
+ #ast-sites-modal .dialog-loading {
360
+ display: none;
361
+ }
362
+
363
+ #ast-sites-modal .astra-sites-search-wrap {
364
+ padding: 0 30px 20px;
365
+ margin-left: 1em;
366
+ }
367
+
368
+ #ast-sites-modal .ast-sites-modal__header {
369
+ display: -webkit-box;
370
+ display: -webkit-flex;
371
+ display: -ms-flexbox;
372
+ display: flex;
373
+ -webkit-box-align: center;
374
+ -webkit-align-items: center;
375
+ -ms-flex-align: center;
376
+ align-items: center;
377
+ -webkit-box-pack: justify;
378
+ -webkit-justify-content: space-between;
379
+ -ms-flex-pack: justify;
380
+ justify-content: space-between;
381
+ height: 50px;
382
+ }
383
+
384
+ #ast-sites-modal .ast-sites-modal__header__logo {
385
+ line-height: 1;
386
+ text-transform: uppercase;
387
+ font-weight: bold;
388
+ cursor: pointer;
389
+ border-right: 1px solid #e6e9ec;
390
+ }
391
+
392
+ #ast-sites-modal .ast-block-insert i {
393
+ padding-right: 5px;
394
+ }
395
+
396
+ #ast-sites-modal .back-to-layout:before {
397
+ line-height: 21px;
398
+ width: 21px;
399
+ height: 21px;
400
+ }
401
+
402
+ #ast-sites-modal .ast-sites-modal__header__logo-area {
403
+ text-align: left;
404
+ padding-left: 12px;
405
+ display: -webkit-box;
406
+ display: -webkit-flex;
407
+ display: -ms-flexbox;
408
+ display: flex;
409
+ }
410
+
411
+ #ast-sites-modal .elementor-template-library-header-menu {
412
+ width: 100%;
413
+ display: flex;
414
+ display: -webkit-box;
415
+ display: -webkit-flex;
416
+ display: -ms-flexbox;
417
+ text-align: center;
418
+ color: #6d7882;
419
+ font-size: 13px;
420
+ }
421
+
422
+ #ast-sites-modal .ast-sites-modal__options .elementor-template-library-header-menu {
423
+ height: 50px;
424
+ }
425
+
426
+ #ast-sites-modal .astra-sites__sync-wrap {
427
+ padding: 17px;
428
+ border-left: 1px solid #e6e9ec;
429
+ cursor: pointer;
430
+ }
431
+
432
+ #ast-sites-modal .astra-sites__sync-wrap:hover span {
433
+ color: #6d7882;
434
+ }
435
+
436
+ #ast-sites-modal .back-to-layout:hover {
437
+ background-color: transparent;
438
+ }
439
+
440
+ #ast-sites-modal .back-to-layout i {
441
+ font-size: 24px;
442
+ width: 24px;
443
+ height: 24px;
444
+ }
445
+
446
+ #ast-sites-modal .theme-browser .theme {
447
+ width: 20%;
448
+ padding: 15px;
449
+ margin: 0;
450
+ }
451
+
452
+ #ast-sites-modal .dialog-message {
453
+ height: calc( 100% - 30px );
454
+ padding: 10px 30px 30px 30px;
455
+ }
456
+
457
+ #ast-sites-modal .dialog-lightbox-content-block .theme {
458
+ width: 33.3%;
459
+ }
460
+
461
+ #ast-sites-modal .dialog-lightbox-content-block.theme-browser .theme .theme-screenshot:after {
462
+ padding-top: 40%;
463
+ }
464
+
465
+ #ast-sites-modal .ast-sites-modal__header__logo-area > * {
466
+ display: -webkit-box;
467
+ display: -webkit-flex;
468
+ display: -ms-flexbox;
469
+ display: flex;
470
+ -webkit-box-align: center;
471
+ -webkit-align-items: center;
472
+ -ms-flex-align: center;
473
+ align-items: center;
474
+ }
475
+
476
+ #ast-sites-modal .ast-sites-modal__header__logo__title {
477
+ padding-top: 2px;
478
+ }
479
+
480
+ #ast-sites-modal .ast-sites-modal__header__logo i {
481
+ color: #fff;
482
+ font-size: 10px;
483
+ }
484
+
485
+ #ast-sites-modal .ast-sites-modal__header__items-area {
486
+ display: -webkit-box;
487
+ display: -webkit-flex;
488
+ display: -ms-flexbox;
489
+ display: flex;
490
+ -webkit-box-orient: horizontal;
491
+ -webkit-box-direction: reverse;
492
+ -webkit-flex-direction: row-reverse;
493
+ -ms-flex-direction: row-reverse;
494
+ flex-direction: row-reverse;
495
+ }
496
+
497
+ #ast-sites-modal .ast-sites-modal__header__item {
498
+ position: relative;
499
+ display: -webkit-box;
500
+ display: -webkit-flex;
501
+ display: -ms-flexbox;
502
+ display: flex;
503
+ -webkit-box-align: center;
504
+ -webkit-align-items: center;
505
+ -ms-flex-align: center;
506
+ align-items: center;
507
+ -webkit-box-pack: center;
508
+ -webkit-justify-content: center;
509
+ -ms-flex-pack: center;
510
+ justify-content: center;
511
+ -webkit-box-sizing: content-box;
512
+ box-sizing: content-box;
513
+ cursor: pointer;
514
+ }
515
+
516
+ #ast-sites-modal .ast-sites-modal__header__close--normal .dashicons {
517
+ color: #aaa;
518
+ font-size: 22px;
519
+ }
520
+
521
+ #ast-sites-modal .ast-sites-modal__header__item > i {
522
+ font-size: 20px;
523
+ -webkit-transition: all 0.3s;
524
+ -o-transition: all 0.3s;
525
+ transition: all 0.3s;
526
+ }
527
+
528
+ #ast-sites-modal .ast-sites-modal__header__item > i:not(:hover) {
529
+ color: #a4afb7;
530
+ }
531
+
532
+ #ast-sites-modal .ast-sites-modal__header__close--normal {
533
+ width: 50px;
534
+ height: 50px;
535
+ border-left: 1px solid #e6e9ec;
536
+ }
537
+
538
+ #ast-sites-modal .ast-sites-modal__header__close--normal:hover i {
539
+ color: #6d7882;
540
+ }
541
+
542
+ #ast-sites-modal .ast-sites-modal__header__close--normal i {
543
+ font-size: 18px;
544
+ }
545
+
546
+ #ast-sites-modal .ast-sites-modal__header__close--skip {
547
+ padding: 10px;
548
+ padding-left: 20px;
549
+ margin-right: 10px;
550
+ color: #fff;
551
+ background-color: #a4afb7;
552
+ font-size: 11px;
553
+ font-weight: normal;
554
+ line-height: 1;
555
+ text-transform: uppercase;
556
+ -webkit-border-radius: 2px;
557
+ border-radius: 2px;
558
+ cursor: pointer;
559
+ }
560
+
561
+ #ast-sites-modal .ast-sites-modal__header__close--skip > i {
562
+ font-size: inherit;
563
+ padding-left: 10px;
564
+ margin-left: 15px;
565
+ border-left: 1px solid;
566
+ }
567
+
568
+ #ast-sites-modal .ast-sites-modal__header__close--skip > i:not(:hover) {
569
+ color: #fff;
570
+ }
571
+
572
+ #ast-sites-modal .ast-sites-modal__sidebar {
573
+ width: 25%;
574
+ background-color: rgba(255, 255, 255, 0.3);
575
+ }
576
+
577
+ #ast-sites-modal .ast-sites-modal__content {
578
+ -webkit-box-flex: 1;
579
+ -webkit-flex-grow: 1;
580
+ -ms-flex-positive: 1;
581
+ flex-grow: 1;
582
+ -webkit-box-shadow: 0 0 13px inset rgba(0, 0, 0, 0.05);
583
+ box-shadow: 0 0 13px inset rgba(0, 0, 0, 0.05);
584
+ }
585
+
586
+ .theme-browser .theme {
587
+ cursor: pointer;
588
+ float: left;
589
+ margin: 0 4% 4% 0;
590
+ position: relative;
591
+ width: 30.6%;
592
+ border: 1px solid #ddd;
593
+ box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1);
594
+ box-sizing: border-box;
595
+ }
596
+
597
+ #ast-sites-modal .inner {
598
+ position: relative;
599
+ padding: 8px 8px 0 8px;
600
+ background: #fff;
601
+ overflow: initial;
602
+ -webkit-box-shadow: 0 1px 20px 0 rgba(0, 0, 0, 0.07);
603
+ box-shadow: 0 1px 20px 0 rgba(0, 0, 0, 0.07);
604
+ -webkit-border-radius: 3px;
605
+ border-radius: 3px;
606
+ }
607
+
608
+ #ast-sites-modal .astra-sites-no-sites .description {
609
+ font-size: 13px;
610
+ margin: 0;
611
+ }
612
+
613
+ #ast-sites-modal .astra-sites-no-sites .description a,
614
+ #ast-sites-modal .ast-tooltip-inner-wrap a {
615
+ color: #0073aa;
616
+ }
617
+
618
+ #ast-sites-modal .astra-sites-no-sites .description a:hover,
619
+ #ast-sites-modal .astra-sites-no-sites .description a:active,
620
+ #ast-sites-modal .astra-sites-no-sites .description a:focus,
621
+ #ast-sites-modal .ast-tooltip-inner-wrap a:hover,
622
+ #ast-sites-modal .ast-tooltip-inner-wrap a:active,
623
+ #ast-sites-modal .ast-tooltip-inner-wrap a:focus {
624
+ color: #00a0d2;
625
+ }
626
+
627
+ #ast-sites-modal .astra-sites-no-sites .content {
628
+ justify-content: center;
629
+ }
630
+
631
+ #ast-sites-modal .astra-sites-no-sites .inner {
632
+ background: transparent;
633
+ box-shadow: none;
634
+ }
635
+
636
+ #ast-sites-modal .astra-sites-no-sites .button.astra-sites-back {
637
+ display: inline-block;
638
+ text-decoration: none;
639
+ font-size: 13px;
640
+ line-height: 26px;
641
+ height: 28px;
642
+ margin: 0;
643
+ padding: 0 10px 1px;
644
+ cursor: pointer;
645
+ border-width: 1px;
646
+ border-style: solid;
647
+ -webkit-appearance: none;
648
+ border-radius: 3px;
649
+ white-space: nowrap;
650
+ box-sizing: border-box;
651
+ background: #fafafa;
652
+ border-color: #999;
653
+ color: #23282d;
654
+ }
655
+
656
+ #ast-sites-modal .astra-sites-no-sites h3 {
657
+ margin-bottom: 1.2em;
658
+ }
659
+
660
+ .theme-browser .theme .theme-screenshot:after {
661
+ content: "";
662
+ display: block;
663
+ padding-top: 66.66666%;
664
+ }
665
+
666
+ #ast-sites-modal .theme-name {
667
+ height: auto;
668
+ align-self: center;
669
+ box-shadow: none;
670
+ background: none;
671
+ padding: 7px;
672
+ padding-left: 0;
673
+ font-size: 11px;
674
+ font-weight: normal;
675
+ text-align: left;
676
+ }
677
+
678
+ #ast-sites-modal .theme-browser {
679
+ display: -webkit-box;
680
+ display: -ms-flexbox;
681
+ display: flex;
682
+ -ms-flex-wrap: wrap;
683
+ flex-wrap: wrap;
684
+ }
685
+
686
+ #ast-sites-modal .astra-sites-no-sites {
687
+ width: 100%;
688
+ }
689
+
690
+ #ast-sites-modal .elementor-template-library-menu-item {
691
+ line-height: 1em;
692
+ width: 108px;
693
+ padding: 15px 0;
694
+ display: inline-block;
695
+ }
696
+
697
+ #ast-sites-modal .elementor-template-library-menu-item:hover {
698
+ color: #6d7882;
699
+ }
700
+
701
+ #ast-sites-modal .elementor-template-library-menu-item span {
702
+ margin-right: 10px;
703
+ font-size: 16px;
704
+ }
705
+
706
+ #ast-sites-modal .astra-sites-sync-library-button span {
707
+ font-size: 16px;
708
+ color: #a4afb7;
709
+ }
710
+
711
+ #ast-sites-modal .elementor-template-library-menu-item.elementor-active {
712
+ border-bottom: 3px solid #0073aa;
713
+ background-image: linear-gradient(to bottom, #f1f3f5, #fff);
714
+ color: #6d7882;
715
+ }
716
+
717
+ #ast-sites-modal .theme-preview,
718
+ #ast-sites-modal .theme-preview-block {
719
+ display: none;
720
+ margin: 0 1.3%;
721
+ margin-top: 10px;
722
+ }
723
+
724
+ #ast-sites-modal .ast-validate {
725
+ font-size: 13px;
726
+ line-height: 1.5;
727
+ }
728
+
729
+ #ast-sites-modal .ast-library-template-insert.action-done:before {
730
+ content: "\f147";
731
+ display: inline-block;
732
+ margin-right: 10px;
733
+ font: normal 20px/1 'dashicons';
734
+ -webkit-font-smoothing: antialiased;
735
+ -moz-osx-font-smoothing: grayscale;
736
+ vertical-align: middle;
737
+ }
738
+
739
+ #ast-sites-modal .ast-import-elementor-template.action-done:after {
740
+ content: "\f504";
741
+ display: inline-block;
742
+ margin-left: 10px;
743
+ font: normal 20px/1 'dashicons';
744
+ -webkit-font-smoothing: antialiased;
745
+ -moz-osx-font-smoothing: grayscale;
746
+ vertical-align: middle;
747
+ }
748
+
749
+ #ast-sites-modal .ast-library-template-insert.installing:before,
750
+ #ast-sites-modal .ast-import-elementor-template.installing:before {
751
+ content: "\f463";
752
+ display: inline-block;
753
+ margin-right: 10px;
754
+ font: normal 20px/1 'dashicons';
755
+ -webkit-font-smoothing: antialiased;
756
+ -moz-osx-font-smoothing: grayscale;
757
+ vertical-align: middle;
758
+ -webkit-animation: cssAnimation .72s ease infinite;
759
+ -moz-animation: cssAnimation .72s ease infinite;
760
+ -o-animation: cssAnimation .72s ease infinite;
761
+ -ms-animation: cssAnimation .72s ease infinite;
762
+ animation: cssAnimation .72s ease infinite;
763
+ }
764
+
765
+ @-webkit-keyframes cssAnimation {
766
+ from {
767
+ -webkit-transform: rotate(0);
768
+ -moz-transform: rotate(0);
769
+ -o-transform: rotate(0);
770
+ -ms-transform: rotate(0);
771
+ transform: rotate(0);
772
+ }
773
+ to {
774
+ -webkit-transform: rotate(360deg);
775
+ -moz-transform: rotate(360deg);
776
+ -o-transform: rotate(360deg);
777
+ -ms-transform: rotate(360deg);
778
+ transform: rotate(360deg);
779
+ }
780
+ }
781
+ @-moz-keyframes cssAnimation {
782
+ from {
783
+ -webkit-transform: rotate(0);
784
+ -moz-transform: rotate(0);
785
+ -o-transform: rotate(0);
786
+ -ms-transform: rotate(0);
787
+ transform: rotate(0);
788
+ }
789
+ to {
790
+ -webkit-transform: rotate(360deg);
791
+ -moz-transform: rotate(360deg);
792
+ -o-transform: rotate(360deg);
793
+ -ms-transform: rotate(360deg);
794
+ transform: rotate(360deg);
795
+ }
796
+ }
797
+ @-o-keyframes cssAnimation {
798
+ from {
799
+ -webkit-transform: rotate(0);
800
+ -moz-transform: rotate(0);
801
+ -o-transform: rotate(0);
802
+ -ms-transform: rotate(0);
803
+ transform: rotate(0);
804
+ }
805
+ to {
806
+ -webkit-transform: rotate(360deg);
807
+ -moz-transform: rotate(360deg);
808
+ -o-transform: rotate(360deg);
809
+ -ms-transform: rotate(360deg);
810
+ transform: rotate(360deg);
811
+ }
812
+ }
813
+
814
+ #ast-sites-modal .astra-sites-library-template {
815
+ position: relative;
816
+ width: 33.333%;
817
+ overflow: hidden;
818
+ padding: 15px;
819
+ margin: 0;
820
+ cursor: pointer;
821
+ }
822
+
823
+ #ast-sites-modal .elementor-template-library-template-body {
824
+ display: -webkit-box;
825
+ display: -ms-flexbox;
826
+ display: flex;
827
+ position: relative;
828
+ }
829
+
830
+ #ast-sites-modal .elementor-template-library-template-body img {
831
+ width:100%;
832
+ }
833
+
834
+ #ast-sites-modal .astra-sites-library-template-inner {
835
+ margin: 0;
836
+ -webkit-border-radius: 2px;
837
+ border-radius: 2px;
838
+ -webkit-box-shadow: 0 1px 20px 0 rgba(0,0,0,.07);
839
+ box-shadow: 0 1px 20px 0 rgba(0,0,0,.07);
840
+ padding: 8px 8px 0 8px;
841
+ background: #fff;
842
+ position: relative;
843
+ }
844
+
845
+ #ast-sites-modal .elementor-template-library-template-remote:not(.elementor-template-library-template-page) {
846
+ display: inline-table;
847
+ }
848
+
849
+ #ast-sites-modal .theme-preview img,
850
+ #ast-sites-modal .theme-preview-block img {
851
+ width: 100%;
852
+ }
853
+
854
+ #ast-sites-modal .dialog-lightbox-back {
855
+ background: #fff;
856
+ padding: 10px 10px;
857
+ text-align: left;
858
+ margin-bottom: 20px;
859
+ }
860
+
861
+ #ast-sites-modal .dialog-lightbox-back span {
862
+ cursor: pointer;
863
+ font-weight: bold;
864
+ }
865
+
866
+ #ast-sites-modal .ast-sites-modal__header__menu-area {
867
+ position: relative;
868
+ display: -webkit-box;
869
+ display: -webkit-flex;
870
+ display: -ms-flexbox;
871
+ display: flex;
872
+ -webkit-box-align: center;
873
+ -webkit-align-items: center;
874
+ -ms-flex-align: center;
875
+ align-items: center;
876
+ margin-right: 140px;
877
+ margin-left: 50px;
878
+ flex: 1;
879
+ }
880
+
881
+ #ast-sites-modal .back-to-layout {
882
+ height: 50px;
883
+ padding: 14px;
884
+ }
885
+
886
+ #ast-sites-modal .search-form {
887
+ width: 100%;
888
+ font-weight: normal;
889
+ border: none;
890
+ margin: 0;
891
+ border-radius: 6px;
892
+ position: relative;
893
+ }
894
+ #ast-sites-modal .ast-icon-search {
895
+ position: absolute;
896
+ right: 0;
897
+ top: 0;
898
+ color: #C3C3C3;
899
+ padding: 15px 19px 12px 12px;
900
+ }
901
+ #ast-sites-modal ::-webkit-input-placeholder {
902
+ color: #72777c;
903
+ }
904
+ #ast-sites-modal .astra-sites-sync-library-button.updating-message {
905
+ color: #0073aa;
906
+ }
907
+
908
+ #ast-sites-modal #wp-filter-search-input {
909
+ width: 100%;
910
+ opacity: 1;
911
+ background: transparent;
912
+ border-bottom: 1px solid #ddd;
913
+ border-radius: 0;
914
+ font-size: 11px;
915
+ border: none;
916
+ border-bottom: 1px solid #ddd;
917
+ box-shadow: none;
918
+ height: auto;
919
+ }
920
+
921
+ #ast-sites-modal #wp-filter-search-input.searching {
922
+ border-bottom-left-radius: 0;
923
+ border-bottom-right-radius: 0;
924
+ border-bottom-color: transparent;
925
+ border-color: rgba(223,225,229,0);
926
+ box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28);
927
+ }
928
+
929
+ #ast-sites-modal .single-site-pages-wrap {
930
+ text-align: left;
931
+ }
932
+
933
+ #ast-sites-modal .astra-site-title {
934
+ margin-bottom: 20px;
935
+ text-align: left;
936
+ }
937
+
938
+ #ast-sites-modal .astra-site-contents,
939
+ #ast-sites-modal .astra-sites-import-template,
940
+ #ast-sites-modal .astra-sites-create-page-wrap {
941
+ margin-bottom: 40px;
942
+ }
943
+
944
+ #ast-sites-modal .astra-sites-import-template-notice,
945
+ #ast-sites-modal .astra-sites-create-page-wrap-notice {
946
+ font-size: 15px;
947
+ color: #767676;
948
+ padding: 5px 0 10px;
949
+ }
950
+
951
+ #ast-sites-modal .ast-sites-floating-notice {
952
+ font-size: 13px;
953
+ line-height: 1.5em;
954
+ position: relative;
955
+ }
956
+
957
+ #ast-sites-modal .agency-ribbons {
958
+ top: -5px;
959
+ font-size: 9px;
960
+ right: -5px;
961
+ line-height: 14px;
962
+ }
963
+
964
+ .ast-sites-floating-notice-wrap {
965
+ background: #fff;
966
+ border: 1px solid #ccd0d4;
967
+ border-left-width: 4px;
968
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
969
+ margin: 5px 15px 2px;
970
+ padding: 1px 12px;
971
+ }
972
+
973
+ #ast-sites-modal .notice-dismiss:before {
974
+ background: none;
975
+ color: #72777c;
976
+ content: "\f153";
977
+ display: block;
978
+ font: normal 16px/20px dashicons;
979
+ font-size: 14px;
980
+ speak: none;
981
+ height: 20px;
982
+ text-align: center;
983
+ width: 20px;
984
+ -webkit-font-smoothing: antialiased;
985
+ -moz-osx-font-smoothing: grayscale;
986
+ }
987
+
988
+ #ast-sites-modal .notice-dismiss:hover:before,
989
+ #ast-sites-modal .notice-dismiss:active:before,
990
+ #ast-sites-modal .notice-dismiss:focus:before {
991
+ color: #c00;
992
+ }
993
+
994
+ #ast-sites-modal .ast-sites-floating-notice-wrap.refreshed-notice {
995
+ border-left: 5px solid #46b450;
996
+ }
997
+
998
+ #ast-sites-modal button.notice-dismiss {
999
+ position: absolute;
1000
+ top: 0;
1001
+ right: 1px;
1002
+ border: none;
1003
+ margin: 0;
1004
+ background: none;
1005
+ color: #72777c;
1006
+ cursor: pointer;
1007
+ padding:0;
1008
+ }
1009
+
1010
+ #ast-sites-modal .button-hero {
1011
+ background: #0085ba;
1012
+ border-color: #0073aa #006799 #006799;
1013
+ box-shadow: 0 1px 0 #006799;
1014
+ color: #fff;
1015
+ text-decoration: none;
1016
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
1017
+ cursor: pointer;
1018
+ border-width: 1px;
1019
+ border-style: solid;
1020
+ -webkit-appearance: none;
1021
+ border-radius: 3px;
1022
+ white-space: nowrap;
1023
+ box-sizing: border-box;
1024
+ }
1025
+
1026
+ #ast-sites-modal .button-hero.site-preview-button {
1027
+ color: #555;
1028
+ border-color: #cccccc;
1029
+ background: #f7f7f7;
1030
+ box-shadow: 0 1px 0 #cccccc;
1031
+ vertical-align: top;
1032
+ text-shadow: none;
1033
+ }
1034
+
1035
+ #ast-sites-modal form {
1036
+ display: flex;
1037
+ }
1038
+
1039
+ #ast-sites-modal form .ast-importer-create-button {
1040
+ margin-left: 10px;
1041
+ }
1042
+
1043
+ #ast-sites-modal form input {
1044
+ width: 50%;
1045
+ padding: 10px 20px;
1046
+ }
1047
+
1048
+ #ast-sites-modal .astra-sites-import-template-action .button {
1049
+ display: inline-block;
1050
+ cursor: pointer;
1051
+ }
1052
+
1053
+ #ast-sites-modal .theme-id-container {
1054
+ justify-content: space-between;
1055
+ display: flex;
1056
+ line-height: 1.5em;
1057
+ }
1058
+
1059
+ #ast-sites-modal .elementor-templates-modal__header__items-area {
1060
+ height: 50px;
1061
+ }
1062
+
1063
+ #ast-sites-modal .ast-library-template-insert {
1064
+ margin-right: 15px;
1065
+ }
1066
+
1067
+ #ast-sites-modal .elementor-template-library-template-insert {
1068
+ color: #39b54a;
1069
+ padding: 7px;
1070
+ font-size: 12px;
1071
+ line-height: 1.5em;
1072
+ font-weight: 400;
1073
+ display: none;
1074
+ }
1075
+
1076
+ /* Uncomment this when Insert Link logic needs to be enabled. */
1077
+ /* #ast-sites-modal .astra-theme:hover .elementor-template-library-template-insert {
1078
+ display: block;
1079
+ } */
1080
+
1081
+ #ast-sites-modal .astra-sites-content-wrap.processing > div,
1082
+ #ast-sites-modal .astra-sites-content-wrap > div.astra-loading-wrap {
1083
+ opacity: 0;
1084
+ }
1085
+ /* Uncomment this when Insert Link logic needs to be enabled. */
1086
+ /* #ast-sites-modal .astra-sites-content-wrap.processing > div.astra-loading-wrap {
1087
+ opacity: 1;
1088
+ } */
1089
+
1090
+ #ast-sites-modal .elementor-template-library-template-go-pro {
1091
+ color: #D30C5C;
1092
+ padding: 7px;
1093
+ display: none;
1094
+ }
1095
+
1096
+ #ast-sites-modal .astra-theme:hover .elementor-template-library-template-go-pro {
1097
+ display: block;
1098
+ }
1099
+
1100
+ #ast-sites-modal .dialog-lightbox-content-block .elementor-template-library-template-insert {
1101
+ padding: 0;
1102
+ }
1103
+
1104
+ #ast-sites-modal .astra-sites-import-template-action .button-hero.disabled {
1105
+ color: #66c6e4 !important;
1106
+ background: #008ec2 !important;
1107
+ border-color: #007cb2 !important;
1108
+ box-shadow: none !important;
1109
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
1110
+ cursor: default;
1111
+ }
1112
+
1113
+ #ast-sites-modal .single-site-footer {
1114
+ margin-left: 0;
1115
+ padding-right: 15px;
1116
+ padding-left: 30px;
1117
+ }
1118
+
1119
+ #ast-sites-modal .single-site-preview {
1120
+ margin-right: 0;
1121
+ max-height: calc( 100vh - 160px );
1122
+ height: auto;
1123
+ }
1124
+
1125
+ #ast-sites-modal .ast-sites-floating-notice-wrap {
1126
+ margin: 15px 45px -5px 45px;
1127
+ background: #ffffff;
1128
+ padding: 8px 15px;
1129
+ border-left: 4px solid #00a0d2;
1130
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
1131
+ border-radius: 2px;
1132
+ vertical-align: middle;
1133
+ z-index: 99999;
1134
+ text-align: left;
1135
+ display: none;
1136
+ }
1137
+
1138
+ #ast-sites-modal .ast-sites-floating-notice-wrap.slide-out {
1139
+ display: none;
1140
+ }
1141
+
1142
+ #ast-sites-modal .ast-sites-floating-notice-wrap.slide-in {
1143
+ display: block;
1144
+ }
1145
+
1146
+ @keyframes slide-in {
1147
+ 100% { transform: translateX(0%); }
1148
+ }
1149
+
1150
+ @-webkit-keyframes slide-in {
1151
+ 100% { -webkit-transform: translateX(0%); }
1152
+ }
1153
+
1154
+ @keyframes slide-out {
1155
+ 0% { transform: translateX(0%); }
1156
+ 100% { transform: translateX(120%); }
1157
+ }
1158
+
1159
+ @-webkit-keyframes slide-out {
1160
+ 0% { -webkit-transform: translateX(0%); }
1161
+ 100% { -webkit-transform: translateX(120%); }
1162
+ }
1163
+
1164
+ #ast-sites-modal .single-site-preview-wrap {
1165
+ width: 100%;
1166
+ }
1167
+
1168
+ #ast-sites-modal .astra-sites-tooltip {
1169
+ margin-left: 15px;
1170
+ margin-right: 15px;
1171
+ padding-left: 15px;
1172
+ padding-right:15px;
1173
+ height: 50px;
1174
+ border-left: 1px solid #e6e9ec;
1175
+ border-right: 1px solid #e6e9ec;
1176
+ opacity: 0;
1177
+ }
1178
+
1179
+ #ast-sites-modal .astra-sites-tooltip-icon {
1180
+ line-height: 50px;
1181
+ }
1182
+
1183
+ #ast-sites-modal .astra-sites-tooltip .dashicons-editor-help {
1184
+ font-size: 20px;
1185
+ color: #555d66;
1186
+ }
1187
+
1188
+ #ast-sites-modal .astra-preview-actions-inner-wrap {
1189
+ position: relative;
1190
+ }
1191
+
1192
+ #ast-sites-modal .astra-preview-actions-wrap {
1193
+ margin-right: 15px;
1194
+ }
1195
+
1196
+ #ast-sites-modal .site-action-buttons-wrap .dashicons {
1197
+ margin-left: 0;
1198
+ }
1199
+
1200
+ #ast-sites-modal .position-left-last {
1201
+ margin-right: auto;
1202
+ }
1203
+
1204
+ #elementor-template-block-color-filter select,
1205
+ #elementor-template-block-color-filter option {
1206
+ text-transform: capitalize;
1207
+ }
1208
+
1209
+ @media (max-width: 768px) {
1210
+ #ast-sites-modal .theme-browser .theme {
1211
+ width: 33.33%;
1212
+ box-shadow: none;
1213
+ }
1214
+ #ast-sites-modal .position-left-last {
1215
+ width: 120px;
1216
+ }
1217
+ #ast-sites-modal .ast-sites-modal__header__menu-area {
1218
+ margin: 0 10px;
1219
+ }
1220
+ }
astra-sites/inc/assets/css/images-rtl.css ADDED
@@ -0,0 +1,632 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'icomoon';
3
+ src: url('../fonts/astra-sites.eot?9i8jex');
4
+ src: url('../fonts/astra-sites.eot?9i8jex#iefix') format('embedded-opentype'),
5
+ url('../fonts/astra-sites.ttf?9i8jex') format('truetype'),
6
+ url('../fonts/astra-sites.woff?9i8jex') format('woff'),
7
+ url('../fonts/astra-sites.svg?9i8jex#icomoon') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ [class^="ast-icon-"], [class*=" ast-icon-"] {
13
+ font-family: 'icomoon' !important;
14
+ speak: none;
15
+ font-style: normal;
16
+ font-weight: normal;
17
+ font-variant: normal;
18
+ text-transform: none;
19
+ line-height: 1;
20
+ -webkit-font-smoothing: antialiased;
21
+ -moz-osx-font-smoothing: grayscale;
22
+ }
23
+
24
+ .ast-icon-chevron-left:before {
25
+ content: "\e904";
26
+ }
27
+
28
+ .ast-icon-search:before {
29
+ content: "\e900";
30
+ }
31
+
32
+ .ast-attachments-browser .ast-image__search.has-input + .search-icon {
33
+ display: none;
34
+ }
35
+
36
+ .ast-attachments-browser .search-icon {
37
+ position: absolute;
38
+ top: 0;
39
+ left: 0;
40
+ color: #2b2b2b;
41
+ opacity: 0.3;
42
+ padding: 12px;
43
+ }
44
+
45
+ .ast-attachments-browser .ast-image__skeleton {
46
+ column-count: 5;
47
+ column-gap: 20px;
48
+ }
49
+
50
+ .ast-attachments-browser .ast-image__search-wrap {
51
+ position: relative;
52
+ display: inline-block;
53
+ margin-left: 1%;
54
+ }
55
+
56
+ .ast-attachments-browser input.ast-image__search {
57
+ line-height: 1.8em;
58
+ width: 620px;
59
+ height: 35px;
60
+ background: #fff;
61
+ border-color: #d5dadf;
62
+ }
63
+
64
+ .ast-attachments-browser .ast-image__list-wrap.loaded .ast-image__list-img-wrap {
65
+ opacity: 1;
66
+ }
67
+
68
+ .ast-attachments-browser .ast-image__list-wrap.loaded .imported.ast-image__list-inner-wrap:before {
69
+ display: block;
70
+ }
71
+
72
+ .fl-builder-edit .media-modal .media-frame-content .ast-image__list-img-overlay span,
73
+ .fl-builder-edit .media-modal .media-frame-content .ast-image__save {
74
+ color: #fff;
75
+ }
76
+ .fl-builder-edit .media-modal .media-frame-content .ast-image__list-img-overlay .ast-image__download-icon {
77
+ color: #767676;
78
+ }
79
+
80
+ .ast-attachments-browser .ast-image__list-img-overlay span {
81
+ position: absolute;
82
+ bottom: 0;
83
+ right: 0;
84
+ color: #fff;
85
+ padding: 10px;
86
+ font-size: 13px;
87
+ width: calc( 100% - 20px );
88
+ text-align: right;
89
+ text-transform: capitalize;
90
+ }
91
+
92
+ .ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon {
93
+ margin: 10px;
94
+ padding: 5px 7px;
95
+ width: auto;
96
+ border-radius: 2px;
97
+ left: 0;
98
+ text-align: left;
99
+ font-size: 16px;
100
+ right: auto;
101
+ background: #fff;
102
+ color: #767676;
103
+ }
104
+
105
+ .ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon:hover {
106
+ color: #111;
107
+ box-shadow: rgb(0 0 0 / 30%) 0px 4px 14px;
108
+ }
109
+
110
+ .ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon.installing:before {
111
+ content: "\f463";
112
+ font: normal 20px/1 'dashicons';
113
+ -webkit-font-smoothing: antialiased;
114
+ -moz-osx-font-smoothing: grayscale;
115
+ vertical-align: middle;
116
+ display: inline-block;
117
+ -webkit-animation: cssAnimation 2s linear infinite;
118
+ -moz-animation: cssAnimation 2s linear infinite;
119
+ -o-animation: cssAnimation 2s linear infinite;
120
+ -ms-animation: cssAnimation 2s linear infinite;
121
+ animation: cssAnimation 2s linear infinite;
122
+ }
123
+
124
+ .ast-attachments-browser .ast-image__list-img-wrap {
125
+ display: flex;
126
+ opacity: 0;
127
+ position: relative;
128
+ }
129
+
130
+ .ast-attachments-browser .ast-image__list-img-wrap:hover {
131
+ box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
132
+ }
133
+
134
+ .ast-attachments-browser .ast-image__list-img-overlay {
135
+ position: absolute;
136
+ top: 0;
137
+ right: 0;
138
+ width: 100%;
139
+ height: 100%;
140
+ background: rgba( 0, 0, 0, 0.4 );
141
+ opacity: 0;
142
+ transition: opacity 0.5s, visibility 0s 0.5s;
143
+ cursor: pointer;
144
+ }
145
+
146
+ .ast-attachments-browser .ast-image__list-inner-wrap:hover .ast-image__list-img-overlay {
147
+ opacity: 1;
148
+ }
149
+
150
+ .ast-attachments-browser .ast-image__filter-wrap {
151
+ display: inline-block;
152
+ vertical-align: top;
153
+ }
154
+
155
+ .ast-powered-by-pixabay-wrap {
156
+ margin-left: 25px;
157
+ display: flex;
158
+ align-items: center;
159
+ float: left;
160
+ margin-top: 10px;
161
+ }
162
+
163
+ .ast-powered-by-pixabay-wrap > span {
164
+ font-size: 12px;
165
+ color: #50575e;
166
+ margin-left: 5px;
167
+ }
168
+
169
+ .ast-powered-by-pixabay-wrap > img {
170
+ height: 1.2em;
171
+ }
172
+
173
+ .ast-attachments-browser .ast-attachments-search-wrap {
174
+ padding: 10px 20px;
175
+ border-bottom: 1px solid #ddd;
176
+ display: block;
177
+ height: 36px;
178
+ align-items: center;
179
+ padding-left: 0px;
180
+ }
181
+
182
+ .ast-attachments-browser .ast-image__filter {
183
+ display: flex;
184
+ padding: 0;
185
+ margin: 0;
186
+ list-style-type: none;
187
+ align-items: center;
188
+ }
189
+
190
+ .ast-attachments-browser .ast-image__filter li {
191
+ padding: 0 8px;
192
+ margin: 0;
193
+ }
194
+
195
+ .ast-attachments-browser .ast-image__filter li:first-child {
196
+ padding-right: 0;
197
+ }
198
+
199
+ .ast-attachments-browser .ast-image__filter li select {
200
+ height: 35px;
201
+ width: auto;
202
+ }
203
+
204
+ .fl-builder .ast-attachments-browser .ast-image__filter li select {
205
+ padding: 0 10px;
206
+ }
207
+
208
+ .ast-attachments-browser .ast-image__skeleton-inner-wrap {
209
+ overflow-y: scroll;
210
+ height: inherit;
211
+ padding: 10px;
212
+ padding-bottom: 0;
213
+ height: inherit;
214
+ }
215
+
216
+ .ast-attachments-browser .button.ast-image__validate-btn {
217
+ height: 38px;
218
+ line-height: 37px;
219
+ padding: 0 15px 2px;
220
+ }
221
+
222
+ .ast-attachments-browser.preview-mode .ast-image__skeleton-inner-wrap {
223
+ overflow-y: auto;
224
+ }
225
+
226
+ .ast-attachments-browser .ast-image__list-wrap {
227
+ padding: 0;
228
+ margin: 0;
229
+ display: grid;
230
+ grid-template-rows: 1fr auto;
231
+ margin-bottom: 20px;
232
+ break-inside: avoid;
233
+ }
234
+ .ast-attachments-browser .ast-image__skeleton-wrap {
235
+ height: 100%;
236
+ }
237
+
238
+ .ast-attachments-browser .ast-image__list-inner-wrap img {
239
+ width: 100%;
240
+ height: auto;
241
+ }
242
+
243
+ .ast-attachments-browser .single-site-wrap {
244
+ display: flex;
245
+ }
246
+
247
+ .ast-attachments-browser .single-site {
248
+ width: 100%;
249
+ display: flex;
250
+ }
251
+
252
+ .ast-attachments-browser .single-site-preview {
253
+ height: auto;
254
+ margin-left: 0;
255
+ max-height: calc(100vh - 280px);
256
+ overflow-y: auto;
257
+ border-radius: 2px;
258
+ box-shadow: none;
259
+ }
260
+
261
+ .ast-attachments-browser .single-site-preview img {
262
+ vertical-align: middle;
263
+ }
264
+
265
+ .ast-attachments-browser .ast-image__preview-skeleton {
266
+ padding: 10px;
267
+ }
268
+
269
+ .ast-attachments-browser .single-site-preview img,
270
+ .ast-attachments-browser .single-site-preview-wrap {
271
+ width: 100%;
272
+ }
273
+ .ast-image__list-inner-wrap.imported{
274
+ position: relative;
275
+ }
276
+
277
+ .ast-attachments-browser .imported.ast-image__list-inner-wrap:before {
278
+ content: 'IMPORTED';
279
+ background: rgba(0,0,0,0.5);
280
+ color: #fff;
281
+ top:10px;
282
+ right:10px;
283
+ width: auto;
284
+ height: auto;
285
+ padding: 5px;
286
+ margin: 0;
287
+ z-index: 9;
288
+ position: absolute;
289
+ display: none;
290
+ }
291
+
292
+ .ast-attachments-browser .ast-image__go-back {
293
+ font-weight: 600;
294
+ font-size: 12px;
295
+ cursor: pointer;
296
+ display: inline-block;
297
+ align-items: center;
298
+ margin-top: 7px;
299
+ }
300
+
301
+ .ast-attachments-browser .ast-image__go-back i {
302
+ font-size: 14px;
303
+ height: 14px;
304
+ width: 14px;
305
+ vertical-align: text-bottom;
306
+ }
307
+
308
+ .ast-attachments-browser .ast-image__save-wrap {
309
+ padding: 0 20px;
310
+ display: inline-block;
311
+ float: left;
312
+ }
313
+
314
+ .ast-attachments-browser .ast-image__loader-wrap {
315
+ display: none;
316
+ margin: 0 auto;
317
+ min-height: 58px;
318
+ line-height: 58px;
319
+ width: 160px;
320
+ text-align: center;
321
+ position: absolute;
322
+ right: 50%;
323
+ bottom: 0;
324
+ transform: translateX(50%);
325
+ }
326
+
327
+ .ast-attachments-browser .ast-image__loader-wrap > div {
328
+ width: 18px;
329
+ height: 18px;
330
+ background-color: #0085ba;
331
+ -webkit-border-radius: 100%;
332
+ border-radius: 100%;
333
+ display: inline-block;
334
+ -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
335
+ animation: sk-bouncedelay 1.4s infinite ease-in-out both;
336
+ }
337
+
338
+ .ast-attachments-browser .ast-image__loader-wrap .ast-image__loader-1 {
339
+ -webkit-animation-delay: -0.32s;
340
+ animation-delay: -0.32s;
341
+ }
342
+
343
+ .ast-attachments-browser .ast-image__loader-wrap .ast-image__loader-2 {
344
+ -webkit-animation-delay: -0.16s;
345
+ animation-delay: -0.16s;
346
+ }
347
+
348
+ .ast-attachments-browser .ast-image__license-heading {
349
+ margin: 0;
350
+ text-align: center;
351
+ font-size: 1.4em;
352
+ font-weight: 600;
353
+ margin-top: 0;
354
+ color: #23282d;
355
+ }
356
+
357
+ .ast-attachments-browser .ast-image__license-description {
358
+ font-size: 13px;
359
+ line-height: 1.5;
360
+ margin: 2em 4em;
361
+ color: #444;
362
+ }
363
+
364
+ .ast-attachments-browser .ast-image__license-get-wrap {
365
+ font-size: 1em;
366
+ margin-top: 40px;
367
+ padding: 18px;
368
+ border-top: 1px solid #eae5e5
369
+ }
370
+
371
+ .ast-attachments-browser .ast-image__license-input-wrap {
372
+ margin-bottom: 20px;
373
+ }
374
+
375
+ .ast-attachments-browser .ast-image__license-get-wrap h4 {
376
+ color: #444;
377
+ margin: 0;
378
+ }
379
+
380
+ .ast-attachments-browser .astra-sites-no-sites {
381
+ width: 100%;
382
+ padding: 7em 0;
383
+ }
384
+
385
+ .ast-attachments-browser .astra-sites-no-sites h3 {
386
+ font-size: 1.3rem;
387
+ font-weight: normal;
388
+ color: #666;
389
+ margin-top: 0;
390
+ text-align: center;
391
+ margin-bottom: 3em;
392
+ }
393
+
394
+ .ast-attachments-browser .ast-image__license-heading-wrap {
395
+ background: #fff;
396
+ margin-bottom: 50px;
397
+ padding: 16px 35px;
398
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
399
+ border-radius: 2px 2px 0 0;
400
+ }
401
+
402
+ .ast-attachments-browser .ast-image__license-wrap {
403
+ position: absolute;
404
+ background: #fcfcfc;
405
+ top: 50%;
406
+ right: 50%;
407
+ transform: translateX(50%)translateY(-40%);
408
+ width: 600px;
409
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
410
+ text-align: center;
411
+ border-radius: 2px;
412
+ }
413
+
414
+ .ast-attachments-browser .ast-image__license-input-inner-wrap {
415
+ display: inline-grid;
416
+ position: relative;
417
+ }
418
+
419
+ .ast-attachments-browser .ast-image__license-input-inner-wrap .ast-image__license-msg {
420
+ padding: 5px 10px;
421
+ border: 1px solid #CC3333;
422
+ border-radius: 2px;
423
+ text-align: right;
424
+ margin-left: 10px;
425
+ margin-top: 5px;
426
+ margin-left: 10px;
427
+ margin-right: 0;
428
+ display: none;
429
+ color: #CC3333;
430
+ background: #FFEEEE;
431
+ }
432
+
433
+ .ast-attachments-browser .ast-image__license-msg i {
434
+ margin-left: 5px;
435
+ }
436
+
437
+ .ast-attachments-browser .ast-image__license-msg span {
438
+ vertical-align: middle;
439
+ }
440
+
441
+ .ast-attachments-browser input.ast-image__license {
442
+ margin-left: 10px;
443
+ width: 300px;
444
+ height: 40px;
445
+ padding-right: 13px;
446
+ border-color: #d6d6d6;
447
+ }
448
+
449
+ .ast-attachments-browser li.ast-image__license-edit-key {
450
+ display: flex;
451
+ justify-content: center;
452
+ margin-right: 5px;
453
+ align-items: center;
454
+ border-right: 1px solid #ededed;
455
+ padding: 0 15px;
456
+ }
457
+
458
+ .ast-attachments-browser .ast-image__license-edit-key + div {
459
+ padding: 0 10px;
460
+ }
461
+
462
+ .ast-attachments-browser li.ast-image__license-edit-key a:focus {
463
+ box-shadow: none;
464
+ }
465
+
466
+ .ast-attachments-browser .ast-image-valid-license {
467
+ height: 40px;
468
+ position: absolute;
469
+ left: 20px;
470
+ top: 0;
471
+ color: green;
472
+ display: flex;
473
+ align-items: center;
474
+ }
475
+
476
+ .ast-attachments-browser .ast-image__browse-images {
477
+ cursor: pointer;
478
+ }
479
+
480
+ .ast-image__save.button-primary {
481
+ display: flex;
482
+ align-items: center;
483
+ }
484
+
485
+ .ast-image__filter-safesearch > label input {
486
+ margin-left: 5px;
487
+ }
488
+
489
+ .ast-attachments-browser .ast-image__save.installing:before {
490
+ display: none;
491
+ }
492
+
493
+ .ast-attachments-browser .ast-image__save.installing:after {
494
+ content: "\f463";
495
+ display: inline-block;
496
+ font: normal 20px/1 'dashicons';
497
+ -webkit-font-smoothing: antialiased;
498
+ -moz-osx-font-smoothing: grayscale;
499
+ vertical-align: middle;
500
+ -webkit-animation: cssAnimation .72s ease infinite;
501
+ -moz-animation: cssAnimation .72s ease infinite;
502
+ -o-animation: cssAnimation .72s ease infinite;
503
+ -ms-animation: cssAnimation .72s ease infinite;
504
+ animation: cssAnimation .72s ease infinite;
505
+ color: #fff;
506
+ margin: 0;
507
+ padding: 0;
508
+ margin-right: 10px;
509
+ vertical-align: middle;
510
+ }
511
+
512
+ @-webkit-keyframes cssAnimation {
513
+ from {
514
+ -webkit-transform: rotate(0);
515
+ -moz-transform: rotate(0);
516
+ -o-transform: rotate(0);
517
+ -ms-transform: rotate(0);
518
+ transform: rotate(0);
519
+ }
520
+ to {
521
+ -webkit-transform: rotate(-360deg);
522
+ -moz-transform: rotate(-360deg);
523
+ -o-transform: rotate(-360deg);
524
+ -ms-transform: rotate(-360deg);
525
+ transform: rotate(-360deg);
526
+ }
527
+ }
528
+ @-moz-keyframes cssAnimation {
529
+ from {
530
+ -webkit-transform: rotate(0);
531
+ -moz-transform: rotate(0);
532
+ -o-transform: rotate(0);
533
+ -ms-transform: rotate(0);
534
+ transform: rotate(0);
535
+ }
536
+ to {
537
+ -webkit-transform: rotate(-360deg);
538
+ -moz-transform: rotate(-360deg);
539
+ -o-transform: rotate(-360deg);
540
+ -ms-transform: rotate(-360deg);
541
+ transform: rotate(-360deg);
542
+ }
543
+ }
544
+ @-o-keyframes cssAnimation {
545
+ from {
546
+ -webkit-transform: rotate(0);
547
+ -moz-transform: rotate(0);
548
+ -o-transform: rotate(0);
549
+ -ms-transform: rotate(0);
550
+ transform: rotate(0);
551
+ }
552
+ to {
553
+ -webkit-transform: rotate(-360deg);
554
+ -moz-transform: rotate(-360deg);
555
+ -o-transform: rotate(-360deg);
556
+ -ms-transform: rotate(-360deg);
557
+ transform: rotate(-360deg);
558
+ }
559
+ }
560
+
561
+ @-webkit-keyframes sk-bouncedelay {
562
+ 0%,
563
+ 80%,
564
+ 100% {
565
+ -webkit-transform: scale(0);
566
+ transform: scale(0);
567
+ }
568
+ 40% {
569
+ -webkit-transform: scale(1);
570
+ transform: scale(1);
571
+ }
572
+ }
573
+
574
+ @keyframes sk-bouncedelay {
575
+ 0%,
576
+ 80%,
577
+ 100% {
578
+ -webkit-transform: scale(0);
579
+ transform: scale(0);
580
+ }
581
+ 40% {
582
+ -webkit-transform: scale(1);
583
+ transform: scale(1);
584
+ }
585
+ }
586
+
587
+ @media (max-width: 767px) {
588
+ .ast-attachments-browser .ast-image__list-wrap {
589
+ width: 33.33%;
590
+ }
591
+ .ast-attachments-browser:not(.preview-mode) .ast-attachments-search-wrap {
592
+ display: inline-block;
593
+ height: 76px;
594
+ width: 100%;
595
+ }
596
+ .ast-attachments-browser .search-icon {
597
+ right: 265px;
598
+ }
599
+ .ast-attachments-browser .imported.ast-image__list-inner-wrap:before {
600
+ top: 15px;
601
+ padding: 4px;
602
+ margin: 0 15px 0 5px;
603
+ font-size: 11px;
604
+ }
605
+ }
606
+
607
+ @media (min-width: 768px) and (max-width: 1024px) {
608
+ .ast-attachments-browser .ast-image__list-wrap {
609
+ width: 33.33%;
610
+ }
611
+ .ast-attachments-browser .ast-image__filter li select {
612
+ width: 100px;
613
+ }
614
+ .ast-attachments-browser input.ast-image__search {
615
+ width: 240px;
616
+ }
617
+ }
618
+ @media (min-width: 1025px) and (max-width: 1200px) {
619
+ .ast-attachments-search-wrap .ast-image__search-wrap input {
620
+ width: 220px;
621
+ }
622
+ }
623
+ @media (min-width: 1201px) and (max-width: 1321px) {
624
+ .ast-attachments-search-wrap .ast-image__search-wrap input {
625
+ width: 360px;
626
+ }
627
+ }
628
+ @media (min-width: 1322px) and (max-width: 1430px) {
629
+ .ast-attachments-search-wrap .ast-image__search-wrap input {
630
+ width: 500px;
631
+ }
632
+ }
astra-sites/inc/assets/css/images.css ADDED
@@ -0,0 +1,632 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'icomoon';
3
+ src: url('../fonts/astra-sites.eot?9i8jex');
4
+ src: url('../fonts/astra-sites.eot?9i8jex#iefix') format('embedded-opentype'),
5
+ url('../fonts/astra-sites.ttf?9i8jex') format('truetype'),
6
+ url('../fonts/astra-sites.woff?9i8jex') format('woff'),
7
+ url('../fonts/astra-sites.svg?9i8jex#icomoon') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ [class^="ast-icon-"], [class*=" ast-icon-"] {
13
+ font-family: 'icomoon' !important;
14
+ speak: none;
15
+ font-style: normal;
16
+ font-weight: normal;
17
+ font-variant: normal;
18
+ text-transform: none;
19
+ line-height: 1;
20
+ -webkit-font-smoothing: antialiased;
21
+ -moz-osx-font-smoothing: grayscale;
22
+ }
23
+
24
+ .ast-icon-chevron-left:before {
25
+ content: "\e904";
26
+ }
27
+
28
+ .ast-icon-search:before {
29
+ content: "\e900";
30
+ }
31
+
32
+ .ast-attachments-browser .ast-image__search.has-input + .search-icon {
33
+ display: none;
34
+ }
35
+
36
+ .ast-attachments-browser .search-icon {
37
+ position: absolute;
38
+ top: 0;
39
+ right: 0;
40
+ color: #2b2b2b;
41
+ opacity: 0.3;
42
+ padding: 12px;
43
+ }
44
+
45
+ .ast-attachments-browser .ast-image__skeleton {
46
+ column-count: 5;
47
+ column-gap: 20px;
48
+ }
49
+
50
+ .ast-attachments-browser .ast-image__search-wrap {
51
+ position: relative;
52
+ display: inline-block;
53
+ margin-right: 1%;
54
+ }
55
+
56
+ .ast-attachments-browser input.ast-image__search {
57
+ line-height: 1.8em;
58
+ width: 620px;
59
+ height: 35px;
60
+ background: #fff;
61
+ border-color: #d5dadf;
62
+ }
63
+
64
+ .ast-attachments-browser .ast-image__list-wrap.loaded .ast-image__list-img-wrap {
65
+ opacity: 1;
66
+ }
67
+
68
+ .ast-attachments-browser .ast-image__list-wrap.loaded .imported.ast-image__list-inner-wrap:before {
69
+ display: block;
70
+ }
71
+
72
+ .fl-builder-edit .media-modal .media-frame-content .ast-image__list-img-overlay span,
73
+ .fl-builder-edit .media-modal .media-frame-content .ast-image__save {
74
+ color: #fff;
75
+ }
76
+ .fl-builder-edit .media-modal .media-frame-content .ast-image__list-img-overlay .ast-image__download-icon {
77
+ color: #767676;
78
+ }
79
+
80
+ .ast-attachments-browser .ast-image__list-img-overlay span {
81
+ position: absolute;
82
+ bottom: 0;
83
+ left: 0;
84
+ color: #fff;
85
+ padding: 10px;
86
+ font-size: 13px;
87
+ width: calc( 100% - 20px );
88
+ text-align: left;
89
+ text-transform: capitalize;
90
+ }
91
+
92
+ .ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon {
93
+ margin: 10px;
94
+ padding: 5px 7px;
95
+ width: auto;
96
+ border-radius: 2px;
97
+ right: 0;
98
+ text-align: right;
99
+ font-size: 16px;
100
+ left: auto;
101
+ background: #fff;
102
+ color: #767676;
103
+ }
104
+
105
+ .ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon:hover {
106
+ color: #111;
107
+ box-shadow: rgb(0 0 0 / 30%) 0px 4px 14px;
108
+ }
109
+
110
+ .ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon.installing:before {
111
+ content: "\f463";
112
+ font: normal 20px/1 'dashicons';
113
+ -webkit-font-smoothing: antialiased;
114
+ -moz-osx-font-smoothing: grayscale;
115
+ vertical-align: middle;
116
+ display: inline-block;
117
+ -webkit-animation: cssAnimation 2s linear infinite;
118
+ -moz-animation: cssAnimation 2s linear infinite;
119
+ -o-animation: cssAnimation 2s linear infinite;
120
+ -ms-animation: cssAnimation 2s linear infinite;
121
+ animation: cssAnimation 2s linear infinite;
122
+ }
123
+
124
+ .ast-attachments-browser .ast-image__list-img-wrap {
125
+ display: flex;
126
+ opacity: 0;
127
+ position: relative;
128
+ }
129
+
130
+ .ast-attachments-browser .ast-image__list-img-wrap:hover {
131
+ box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
132
+ }
133
+
134
+ .ast-attachments-browser .ast-image__list-img-overlay {
135
+ position: absolute;
136
+ top: 0;
137
+ left: 0;
138
+ width: 100%;
139
+ height: 100%;
140
+ background: rgba( 0, 0, 0, 0.4 );
141
+ opacity: 0;
142
+ transition: opacity 0.5s, visibility 0s 0.5s;
143
+ cursor: pointer;
144
+ }
145
+
146
+ .ast-attachments-browser .ast-image__list-inner-wrap:hover .ast-image__list-img-overlay {
147
+ opacity: 1;
148
+ }
149
+
150
+ .ast-attachments-browser .ast-image__filter-wrap {
151
+ display: inline-block;
152
+ vertical-align: top;
153
+ }
154
+
155
+ .ast-powered-by-pixabay-wrap {
156
+ margin-right: 25px;
157
+ display: flex;
158
+ align-items: center;
159
+ float: right;
160
+ margin-top: 10px;
161
+ }
162
+
163
+ .ast-powered-by-pixabay-wrap > span {
164
+ font-size: 12px;
165
+ color: #50575e;
166
+ margin-right: 5px;
167
+ }
168
+
169
+ .ast-powered-by-pixabay-wrap > img {
170
+ height: 1.2em;
171
+ }
172
+
173
+ .ast-attachments-browser .ast-attachments-search-wrap {
174
+ padding: 10px 20px;
175
+ border-bottom: 1px solid #ddd;
176
+ display: block;
177
+ height: 36px;
178
+ align-items: center;
179
+ padding-right: 0px;
180
+ }
181
+
182
+ .ast-attachments-browser .ast-image__filter {
183
+ display: flex;
184
+ padding: 0;
185
+ margin: 0;
186
+ list-style-type: none;
187
+ align-items: center;
188
+ }
189
+
190
+ .ast-attachments-browser .ast-image__filter li {
191
+ padding: 0 8px;
192
+ margin: 0;
193
+ }
194
+
195
+ .ast-attachments-browser .ast-image__filter li:first-child {
196
+ padding-left: 0;
197
+ }
198
+
199
+ .ast-attachments-browser .ast-image__filter li select {
200
+ height: 35px;
201
+ width: auto;
202
+ }
203
+
204
+ .fl-builder .ast-attachments-browser .ast-image__filter li select {
205
+ padding: 0 10px;
206
+ }
207
+
208
+ .ast-attachments-browser .ast-image__skeleton-inner-wrap {
209
+ overflow-y: scroll;
210
+ height: inherit;
211
+ padding: 10px;
212
+ padding-bottom: 0;
213
+ height: inherit;
214
+ }
215
+
216
+ .ast-attachments-browser .button.ast-image__validate-btn {
217
+ height: 38px;
218
+ line-height: 37px;
219
+ padding: 0 15px 2px;
220
+ }
221
+
222
+ .ast-attachments-browser.preview-mode .ast-image__skeleton-inner-wrap {
223
+ overflow-y: auto;
224
+ }
225
+
226
+ .ast-attachments-browser .ast-image__list-wrap {
227
+ padding: 0;
228
+ margin: 0;
229
+ display: grid;
230
+ grid-template-rows: 1fr auto;
231
+ margin-bottom: 20px;
232
+ break-inside: avoid;
233
+ }
234
+ .ast-attachments-browser .ast-image__skeleton-wrap {
235
+ height: 100%;
236
+ }
237
+
238
+ .ast-attachments-browser .ast-image__list-inner-wrap img {
239
+ width: 100%;
240
+ height: auto;
241
+ }
242
+
243
+ .ast-attachments-browser .single-site-wrap {
244
+ display: flex;
245
+ }
246
+
247
+ .ast-attachments-browser .single-site {
248
+ width: 100%;
249
+ display: flex;
250
+ }
251
+
252
+ .ast-attachments-browser .single-site-preview {
253
+ height: auto;
254
+ margin-right: 0;
255
+ max-height: calc(100vh - 280px);
256
+ overflow-y: auto;
257
+ border-radius: 2px;
258
+ box-shadow: none;
259
+ }
260
+
261
+ .ast-attachments-browser .single-site-preview img {
262
+ vertical-align: middle;
263
+ }
264
+
265
+ .ast-attachments-browser .ast-image__preview-skeleton {
266
+ padding: 10px;
267
+ }
268
+
269
+ .ast-attachments-browser .single-site-preview img,
270
+ .ast-attachments-browser .single-site-preview-wrap {
271
+ width: 100%;
272
+ }
273
+ .ast-image__list-inner-wrap.imported{
274
+ position: relative;
275
+ }
276
+
277
+ .ast-attachments-browser .imported.ast-image__list-inner-wrap:before {
278
+ content: 'IMPORTED';
279
+ background: rgba(0,0,0,0.5);
280
+ color: #fff;
281
+ top:10px;
282
+ left:10px;
283
+ width: auto;
284
+ height: auto;
285
+ padding: 5px;
286
+ margin: 0;
287
+ z-index: 9;
288
+ position: absolute;
289
+ display: none;
290
+ }
291
+
292
+ .ast-attachments-browser .ast-image__go-back {
293
+ font-weight: 600;
294
+ font-size: 12px;
295
+ cursor: pointer;
296
+ display: inline-block;
297
+ align-items: center;
298
+ margin-top: 7px;
299
+ }
300
+
301
+ .ast-attachments-browser .ast-image__go-back i {
302
+ font-size: 14px;
303
+ height: 14px;
304
+ width: 14px;
305
+ vertical-align: text-bottom;
306
+ }
307
+
308
+ .ast-attachments-browser .ast-image__save-wrap {
309
+ padding: 0 20px;
310
+ display: inline-block;
311
+ float: right;
312
+ }
313
+
314
+ .ast-attachments-browser .ast-image__loader-wrap {
315
+ display: none;
316
+ margin: 0 auto;
317
+ min-height: 58px;
318
+ line-height: 58px;
319
+ width: 160px;
320
+ text-align: center;
321
+ position: absolute;
322
+ left: 50%;
323
+ bottom: 0;
324
+ transform: translateX(-50%);
325
+ }
326
+
327
+ .ast-attachments-browser .ast-image__loader-wrap > div {
328
+ width: 18px;
329
+ height: 18px;
330
+ background-color: #0085ba;
331
+ -webkit-border-radius: 100%;
332
+ border-radius: 100%;
333
+ display: inline-block;
334
+ -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
335
+ animation: sk-bouncedelay 1.4s infinite ease-in-out both;
336
+ }
337
+
338
+ .ast-attachments-browser .ast-image__loader-wrap .ast-image__loader-1 {
339
+ -webkit-animation-delay: -0.32s;
340
+ animation-delay: -0.32s;
341
+ }
342
+
343
+ .ast-attachments-browser .ast-image__loader-wrap .ast-image__loader-2 {
344
+ -webkit-animation-delay: -0.16s;
345
+ animation-delay: -0.16s;
346
+ }
347
+
348
+ .ast-attachments-browser .ast-image__license-heading {
349
+ margin: 0;
350
+ text-align: center;
351
+ font-size: 1.4em;
352
+ font-weight: 600;
353
+ margin-top: 0;
354
+ color: #23282d;
355
+ }
356
+
357
+ .ast-attachments-browser .ast-image__license-description {
358
+ font-size: 13px;
359
+ line-height: 1.5;
360
+ margin: 2em 4em;
361
+ color: #444;
362
+ }
363
+
364
+ .ast-attachments-browser .ast-image__license-get-wrap {
365
+ font-size: 1em;
366
+ margin-top: 40px;
367
+ padding: 18px;
368
+ border-top: 1px solid #eae5e5
369
+ }
370
+
371
+ .ast-attachments-browser .ast-image__license-input-wrap {
372
+ margin-bottom: 20px;
373
+ }
374
+
375
+ .ast-attachments-browser .ast-image__license-get-wrap h4 {
376
+ color: #444;
377
+ margin: 0;
378
+ }
379
+
380
+ .ast-attachments-browser .astra-sites-no-sites {
381
+ width: 100%;
382
+ padding: 7em 0;
383
+ }
384
+
385
+ .ast-attachments-browser .astra-sites-no-sites h3 {
386
+ font-size: 1.3rem;
387
+ font-weight: normal;
388
+ color: #666;
389
+ margin-top: 0;
390
+ text-align: center;
391
+ margin-bottom: 3em;
392
+ }
393
+
394
+ .ast-attachments-browser .ast-image__license-heading-wrap {
395
+ background: #fff;
396
+ margin-bottom: 50px;
397
+ padding: 16px 35px;
398
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
399
+ border-radius: 2px 2px 0 0;
400
+ }
401
+
402
+ .ast-attachments-browser .ast-image__license-wrap {
403
+ position: absolute;
404
+ background: #fcfcfc;
405
+ top: 50%;
406
+ left: 50%;
407
+ transform: translateX(-50%)translateY(-40%);
408
+ width: 600px;
409
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
410
+ text-align: center;
411
+ border-radius: 2px;
412
+ }
413
+
414
+ .ast-attachments-browser .ast-image__license-input-inner-wrap {
415
+ display: inline-grid;
416
+ position: relative;
417
+ }
418
+
419
+ .ast-attachments-browser .ast-image__license-input-inner-wrap .ast-image__license-msg {
420
+ padding: 5px 10px;
421
+ border: 1px solid #CC3333;
422
+ border-radius: 2px;
423
+ text-align: left;
424
+ margin-right: 10px;
425
+ margin-top: 5px;
426
+ margin-right: 10px;
427
+ margin-left: 0;
428
+ display: none;
429
+ color: #CC3333;
430
+ background: #FFEEEE;
431
+ }
432
+
433
+ .ast-attachments-browser .ast-image__license-msg i {
434
+ margin-right: 5px;
435
+ }
436
+
437
+ .ast-attachments-browser .ast-image__license-msg span {
438
+ vertical-align: middle;
439
+ }
440
+
441
+ .ast-attachments-browser input.ast-image__license {
442
+ margin-right: 10px;
443
+ width: 300px;
444
+ height: 40px;
445
+ padding-left: 13px;
446
+ border-color: #d6d6d6;
447
+ }
448
+
449
+ .ast-attachments-browser li.ast-image__license-edit-key {
450
+ display: flex;
451
+ justify-content: center;
452
+ margin-left: 5px;
453
+ align-items: center;
454
+ border-left: 1px solid #ededed;
455
+ padding: 0 15px;
456
+ }
457
+
458
+ .ast-attachments-browser .ast-image__license-edit-key + div {
459
+ padding: 0 10px;
460
+ }
461
+
462
+ .ast-attachments-browser li.ast-image__license-edit-key a:focus {
463
+ box-shadow: none;
464
+ }
465
+
466
+ .ast-attachments-browser .ast-image-valid-license {
467
+ height: 40px;
468
+ position: absolute;
469
+ right: 20px;
470
+ top: 0;
471
+ color: green;
472
+ display: flex;
473
+ align-items: center;
474
+ }
475
+
476
+ .ast-attachments-browser .ast-image__browse-images {
477
+ cursor: pointer;
478
+ }
479
+
480
+ .ast-image__save.button-primary {
481
+ display: flex;
482
+ align-items: center;
483
+ }
484
+
485
+ .ast-image__filter-safesearch > label input {
486
+ margin-right: 5px;
487
+ }
488
+
489
+ .ast-attachments-browser .ast-image__save.installing:before {
490
+ display: none;
491
+ }
492
+
493
+ .ast-attachments-browser .ast-image__save.installing:after {
494
+ content: "\f463";
495
+ display: inline-block;
496
+ font: normal 20px/1 'dashicons';
497
+ -webkit-font-smoothing: antialiased;
498
+ -moz-osx-font-smoothing: grayscale;
499
+ vertical-align: middle;
500
+ -webkit-animation: cssAnimation .72s ease infinite;
501
+ -moz-animation: cssAnimation .72s ease infinite;
502
+ -o-animation: cssAnimation .72s ease infinite;
503
+ -ms-animation: cssAnimation .72s ease infinite;
504
+ animation: cssAnimation .72s ease infinite;
505
+ color: #fff;
506
+ margin: 0;
507
+ padding: 0;
508
+ margin-left: 10px;
509
+ vertical-align: middle;
510
+ }
511
+
512
+ @-webkit-keyframes cssAnimation {
513
+ from {
514
+ -webkit-transform: rotate(0);
515
+ -moz-transform: rotate(0);
516
+ -o-transform: rotate(0);
517
+ -ms-transform: rotate(0);
518
+ transform: rotate(0);
519
+ }
520
+ to {
521
+ -webkit-transform: rotate(360deg);
522
+ -moz-transform: rotate(360deg);
523
+ -o-transform: rotate(360deg);
524
+ -ms-transform: rotate(360deg);
525
+ transform: rotate(360deg);
526
+ }
527
+ }
528
+ @-moz-keyframes cssAnimation {
529
+ from {
530
+ -webkit-transform: rotate(0);
531
+ -moz-transform: rotate(0);
532
+ -o-transform: rotate(0);
533
+ -ms-transform: rotate(0);
534
+ transform: rotate(0);
535
+ }
536
+ to {
537
+ -webkit-transform: rotate(360deg);
538
+ -moz-transform: rotate(360deg);
539
+ -o-transform: rotate(360deg);
540
+ -ms-transform: rotate(360deg);
541
+ transform: rotate(360deg);
542
+ }
543
+ }
544
+ @-o-keyframes cssAnimation {
545
+ from {
546
+ -webkit-transform: rotate(0);
547
+ -moz-transform: rotate(0);
548
+ -o-transform: rotate(0);
549
+ -ms-transform: rotate(0);
550
+ transform: rotate(0);
551
+ }
552
+ to {
553
+ -webkit-transform: rotate(360deg);
554
+ -moz-transform: rotate(360deg);
555
+ -o-transform: rotate(360deg);
556
+ -ms-transform: rotate(360deg);
557
+ transform: rotate(360deg);
558
+ }
559
+ }
560
+
561
+ @-webkit-keyframes sk-bouncedelay {
562
+ 0%,
563
+ 80%,
564
+ 100% {
565
+ -webkit-transform: scale(0);
566
+ transform: scale(0);
567
+ }
568
+ 40% {
569
+ -webkit-transform: scale(1);
570
+ transform: scale(1);
571
+ }
572
+ }
573
+
574
+ @keyframes sk-bouncedelay {
575
+ 0%,
576
+ 80%,
577
+ 100% {
578
+ -webkit-transform: scale(0);
579
+ transform: scale(0);
580
+ }
581
+ 40% {
582
+ -webkit-transform: scale(1);
583
+ transform: scale(1);
584
+ }
585
+ }
586
+
587
+ @media (max-width: 767px) {
588
+ .ast-attachments-browser .ast-image__list-wrap {
589
+ width: 33.33%;
590
+ }
591
+ .ast-attachments-browser:not(.preview-mode) .ast-attachments-search-wrap {
592
+ display: inline-block;
593
+ height: 76px;
594
+ width: 100%;
595
+ }
596
+ .ast-attachments-browser .search-icon {
597
+ left: 265px;
598
+ }
599
+ .ast-attachments-browser .imported.ast-image__list-inner-wrap:before {
600
+ top: 15px;
601
+ padding: 4px;
602
+ margin: 0 5px 0 15px;
603
+ font-size: 11px;
604
+ }
605
+ }
606
+
607
+ @media (min-width: 768px) and (max-width: 1024px) {
608
+ .ast-attachments-browser .ast-image__list-wrap {
609
+ width: 33.33%;
610
+ }
611
+ .ast-attachments-browser .ast-image__filter li select {
612
+ width: 100px;
613
+ }
614
+ .ast-attachments-browser input.ast-image__search {
615
+ width: 240px;
616
+ }
617
+ }
618
+ @media (min-width: 1025px) and (max-width: 1200px) {
619
+ .ast-attachments-search-wrap .ast-image__search-wrap input {
620
+ width: 220px;
621
+ }
622
+ }
623
+ @media (min-width: 1201px) and (max-width: 1321px) {
624
+ .ast-attachments-search-wrap .ast-image__search-wrap input {
625
+ width: 360px;
626
+ }
627
+ }
628
+ @media (min-width: 1322px) and (max-width: 1430px) {
629
+ .ast-attachments-search-wrap .ast-image__search-wrap input {
630
+ width: 500px;
631
+ }
632
+ }
astra-sites/inc/assets/css/import-status-rtl.css ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wpadminbar #astra-sites-import-status-admin-bar {
2
+ padding-right: 10px;
3
+ border-right: 1px solid #3d4349;
4
+ color: #fff;
5
+ }
6
+
7
+ .astra-sites-import-screen.failed .import-step:before {
8
+ content: "\f335";
9
+ color: #F44336;
10
+ }
11
+
12
+ .astra-sites-import-screen .dashicons-external {
13
+ font-size: inherit;
14
+ vertical-align: middle;
15
+ }
16
+
17
+ #astra-sites-import-status-admin-bar .dashicons {
18
+ font-family: 'dashicons';
19
+ display: inline-block;
20
+ line-height: 1;
21
+ font-weight: 400;
22
+ font-style: normal;
23
+ speak: none;
24
+ text-decoration: inherit;
25
+ text-transform: none;
26
+ text-rendering: auto;
27
+ -webkit-font-smoothing: antialiased;
28
+ -moz-osx-font-smoothing: grayscale;
29
+ font-size: 20px;
30
+ vertical-align: text-top;
31
+ text-align: center;
32
+ transition: color 0.1s ease-in;
33
+ margin-left: 5px;
34
+ }
35
+
36
+ #astra-sites-import-status-admin-bar .loading::before {
37
+ color: #9ea3a8;
38
+ content: "\f463";
39
+ display: inline-block;
40
+ font: normal 20px/1 'dashicons';
41
+ -webkit-font-smoothing: antialiased;
42
+ -moz-osx-font-smoothing: grayscale;
43
+ vertical-align: top;
44
+ animation: rotation 2s infinite linear;
45
+ margin: 5px -2px 0 5px;
46
+ font-weight: revert;
47
+ }
48
+
49
+ .astra-sites-import-screen .import-steps {
50
+ padding: 1.5em 1.5em 1em 1em;
51
+ }
52
+
53
+ .astra-sites-import-screen .import-step.processing:before {
54
+ content: "\f463";
55
+ animation: rotation 2s infinite linear;
56
+ }
57
+
58
+ .astra-sites-import-screen .import-step:before {
59
+ color: #9ea3a8;
60
+ content: "\f139";
61
+ display: inline-block;
62
+ font: normal 20px/1 'dashicons';
63
+ -webkit-font-smoothing: antialiased;
64
+ -moz-osx-font-smoothing: grayscale;
65
+ vertical-align: top;
66
+ font-weight: revert;
67
+ margin-left: 3px;
68
+ }
69
+
70
+ .astra-sites-import-screen .import-step.success::before {
71
+ content: "\f147";
72
+ color: #4CAF50;
73
+ }
74
+
75
+ .astra-sites-import-screen .import-step.fail::before {
76
+ color: #FF5722;
77
+ content: "\f335";
78
+ }
79
+
80
+ .astra-sites-import-screen .footer {
81
+ text-align: right;
82
+ padding: 10px 15px;
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: space-between;
86
+ position: relative;
87
+ }
88
+
89
+ .astra-sites-import-screen .content {
90
+ text-align: right;
91
+ padding: 2em 5em 4em 5em;
92
+ }
93
+
94
+ .astra-sites-import-screen .view-site-button .dashicons {
95
+ font-size: initial;
96
+ vertical-align: middle;
97
+ }
astra-sites/inc/assets/css/import-status.css ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wpadminbar #astra-sites-import-status-admin-bar {
2
+ padding-left: 10px;
3
+ border-left: 1px solid #3d4349;
4
+ color: #fff;
5
+ }
6
+
7
+ .astra-sites-import-screen.failed .import-step:before {
8
+ content: "\f335";
9
+ color: #F44336;
10
+ }
11
+
12
+ .astra-sites-import-screen .dashicons-external {
13
+ font-size: inherit;
14
+ vertical-align: middle;
15
+ }
16
+
17
+ #astra-sites-import-status-admin-bar .dashicons {
18
+ font-family: 'dashicons';
19
+ display: inline-block;
20
+ line-height: 1;
21
+ font-weight: 400;
22
+ font-style: normal;
23
+ speak: none;
24
+ text-decoration: inherit;
25
+ text-transform: none;
26
+ text-rendering: auto;
27
+ -webkit-font-smoothing: antialiased;
28
+ -moz-osx-font-smoothing: grayscale;
29
+ font-size: 20px;
30
+ vertical-align: text-top;
31
+ text-align: center;
32
+ transition: color 0.1s ease-in;
33
+ margin-right: 5px;
34
+ }
35
+
36
+ #astra-sites-import-status-admin-bar .loading::before {
37
+ color: #9ea3a8;
38
+ content: "\f463";
39
+ display: inline-block;
40
+ font: normal 20px/1 'dashicons';
41
+ -webkit-font-smoothing: antialiased;
42
+ -moz-osx-font-smoothing: grayscale;
43
+ vertical-align: top;
44
+ animation: rotation 2s infinite linear;
45
+ margin: 5px 5px 0 -2px;
46
+ font-weight: revert;
47
+ }
48
+
49
+ .astra-sites-import-screen .import-steps {
50
+ padding: 1.5em 1em 1em 1.5em;
51
+ }
52
+
53
+ .astra-sites-import-screen .import-step.processing:before {
54
+ content: "\f463";
55
+ animation: rotation 2s infinite linear;
56
+ }
57
+
58
+ .astra-sites-import-screen .import-step:before {
59
+ color: #9ea3a8;
60
+ content: "\f139";
61
+ display: inline-block;
62
+ font: normal 20px/1 'dashicons';
63
+ -webkit-font-smoothing: antialiased;
64
+ -moz-osx-font-smoothing: grayscale;
65
+ vertical-align: top;
66
+ font-weight: revert;
67
+ margin-right: 3px;
68
+ }
69
+
70
+ .astra-sites-import-screen .import-step.success::before {
71
+ content: "\f147";
72
+ color: #4CAF50;
73
+ }
74
+
75
+ .astra-sites-import-screen .import-step.fail::before {
76
+ color: #FF5722;
77
+ content: "\f335";
78
+ }
79
+
80
+ .astra-sites-import-screen .footer {
81
+ text-align: left;
82
+ padding: 10px 15px;
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: space-between;
86
+ position: relative;
87
+ }
88
+
89
+ .astra-sites-import-screen .content {
90
+ text-align: left;
91
+ padding: 2em 5em 4em 5em;
92
+ }
93
+
94
+ .astra-sites-import-screen .view-site-button .dashicons {
95
+ font-size: initial;
96
+ vertical-align: middle;
97
+ }
astra-sites/inc/assets/css/install-theme-rtl.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .processing:before {
2
+ margin: 0 0px 0px 3px;
3
+ }
4
+ .processing:before {
5
+ animation: rotation 2s infinite linear;
6
+ }
7
+ .processing:before {
8
+ color: #f56e28;
9
+ content: "\f463";
10
+ }
11
+ .processing:before {
12
+ display: inline-block;
13
+ font: normal 20px/1 dashicons;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ vertical-align: top;
17
+ }
18
+ #astra-theme-activation-nag a {
19
+ box-shadow: none;
20
+ outline: none;
21
+ }
astra-sites/inc/assets/css/install-theme.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .processing:before {
2
+ margin: 0 3px 0px 0px;
3
+ }
4
+ .processing:before {
5
+ animation: rotation 2s infinite linear;
6
+ }
7
+ .processing:before {
8
+ color: #f56e28;
9
+ content: "\f463";
10
+ }
11
+ .processing:before {
12
+ display: inline-block;
13
+ font: normal 20px/1 dashicons;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ vertical-align: top;
17
+ }
18
+ #astra-theme-activation-nag a {
19
+ box-shadow: none;
20
+ outline: none;
21
+ }
astra-sites/inc/assets/css/integration-rtl.css ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .notice:not(.ast-img-notice) {
2
+ display: none;
3
+ }
4
+ .ast-img-flex {
5
+ -js-display: flex;
6
+ display: -webkit-box;
7
+ display: -webkit-flex;
8
+ display: -moz-box;
9
+ display: -ms-flexbox;
10
+ display: flex;
11
+ -webkit-box-align: center;
12
+ -webkit-align-items: center;
13
+ -moz-box-align: center;
14
+ -ms-flex-align: center;
15
+ align-items: center;
16
+ -webkit-flex-wrap: wrap;
17
+ -ms-flex-wrap: wrap;
18
+ flex-wrap: wrap;
19
+ -webkit-align-content: center;
20
+ -ms-flex-line-pack: center;
21
+ align-content: center;
22
+ }
23
+
24
+ .form-field p.ast-img-p {
25
+ margin: 1em 0;
26
+ }
27
+
28
+ .ast-img-container{
29
+ max-width: 1200px;
30
+ margin: 0 auto;
31
+ padding: 0 20px;
32
+ box-sizing: border-box;
33
+ }
34
+ .form-wrap .ast-img-response-warning {
35
+ display: block;
36
+ color: #d02222;
37
+ }
38
+ .form-wrap .ast-img-google-error-response {
39
+ margin-top: 5px;
40
+ display: block;
41
+ }
42
+ .form-wrap .ast-img-google-error-response .ast-img-response-warning {
43
+ display: inline-block;
44
+ }
45
+ .form-wrap .ast-img-response-success {
46
+ display: block;
47
+ color: #2dbe15;
48
+ }
49
+ .postbox .inside .form-wrap .ast-img-integration-heading {
50
+ font-size: 15px;
51
+ font-weight: 600;
52
+ }
53
+ #ast-img-menu-page .ast-img-notice {
54
+ max-width: 860px;
55
+ margin: 0 auto;
56
+ }
57
+
58
+ .ast-img-menu-page-wrapper a {
59
+ text-decoration: none;
60
+ }
61
+
62
+ .ast-img-general-form-wrap {
63
+ width: 680px;
64
+ }
65
+
66
+ .ast-img-bulk-actions-wrap {
67
+ flex: auto;
68
+ text-align: left;
69
+ }
70
+
71
+ .ast-img-general-list .inside {
72
+ padding: 0;
73
+ margin: 0;
74
+ }
75
+
76
+ .ast-img-list-section .ast-img-widget-list li {
77
+ -js-display: flex;
78
+ display: -webkit-box;
79
+ display: -webkit-flex;
80
+ display: -moz-box;
81
+ display: -ms-flexbox;
82
+ display: flex;
83
+ -webkit-box-align: center;
84
+ -webkit-align-items: center;
85
+ -moz-box-align: center;
86
+ -ms-flex-align: center;
87
+ align-items: center;
88
+ -webkit-flex-wrap: wrap;
89
+ -ms-flex-wrap: wrap;
90
+ flex-wrap: wrap;
91
+ -webkit-align-content: center;
92
+ -ms-flex-line-pack: center;
93
+ align-content: center;
94
+ padding: 10px 12px;
95
+ -moz-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1) inset;
96
+ -webkit-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1) inset;
97
+ box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1) inset;
98
+ margin-bottom: 0;
99
+ }
100
+
101
+ .ast-img-list-section .ast-img-widget-list li:nth-child(even) {
102
+ background-color: #fbfbfb;
103
+ }
104
+
105
+ .ast-img-list-section .ast-img-widget-list .activate {
106
+ border-right: 3px solid #008ec2;
107
+ padding-right: 12px;
108
+ }
109
+
110
+ .ast-img-widget-list a {
111
+ text-decoration: none;
112
+ }
113
+
114
+ .ast-img-widget-link-wrapper {
115
+ -js-display: flex;
116
+ display: -webkit-box;
117
+ display: -webkit-flex;
118
+ display: -moz-box;
119
+ display: -ms-flexbox;
120
+ display: flex;
121
+ -webkit-box-align: center;
122
+ -webkit-align-items: center;
123
+ -moz-box-align: center;
124
+ -ms-flex-align: center;
125
+ align-items: center;
126
+ -webkit-flex-wrap: wrap;
127
+ -ms-flex-wrap: wrap;
128
+ flex-wrap: wrap;
129
+ -webkit-align-content: center;
130
+ -ms-flex-line-pack: center;
131
+ align-content: center;
132
+ display: -webkit-flex;
133
+ -webkit-flex-direction: row-reverse;
134
+ flex-direction: row-reverse;
135
+ flex: auto;
136
+ }
137
+
138
+ .ast-img-widget-list li a:before {
139
+ display: inline-block;
140
+ margin-left: 2px;
141
+ font: normal 20px/1 'dashicons';
142
+ -webkit-font-smoothing: antialiased;
143
+ -moz-osx-font-smoothing: grayscale;
144
+ vertical-align: top;
145
+ }
146
+
147
+ .ast-img-widget-link-wrapper a:nth-child(even) {
148
+ margin: 0 10px;
149
+ }
150
+
151
+ .ast-img-container .postbox .hndle {
152
+ background: #f7f7f7;
153
+ border-bottom: 2px solid #e6e6e6;
154
+ }
155
+ .ast-img-container .postbox ul {
156
+ margin: 0;
157
+ }
158
+ .ast-img-widget-list a {
159
+ line-height: 1.6;
160
+ }
161
+ .ast-img-widget-list a:focus {
162
+ box-shadow: none;
163
+ }
164
+
165
+ .ast-img-branding-list{
166
+ margin:0;
167
+ }
168
+ .ast-img-menu-page-wrapper .ast-img-container .clear {
169
+ overflow: auto;
170
+ visibility: visible;
171
+ width: auto;
172
+ height: auto;
173
+ }
174
+
175
+ /* Update icon. */
176
+ .ast-img-widget-link-wrapper a.updating-message:before {
177
+ color: #f56e28;
178
+ content: "\f463";
179
+ }
180
+
181
+ /* Spins the update icon. */
182
+ .ast-img-widget-link-wrapper a.updating-message:before {
183
+ -webkit-animation: rotation 2s infinite linear;
184
+ animation: rotation 2s infinite linear;
185
+ }
186
+
187
+ .settings_page_astra-images #wpcontent{
188
+ padding: 0;
189
+ }
190
+
191
+ /* Header */
192
+ .ast-img-menu-page-header.general .ast-img-container,
193
+ .ast-img-menu-page-header.branding .ast-img-container,
194
+ .ast-img-container.ast-img-general,
195
+ .ast-img-container.ast-img-branding-wrapper {
196
+ max-width: 930px;
197
+ }
198
+ .ast-img-title {
199
+ flex: auto;
200
+ align-content: flex-start;
201
+ text-align: right;
202
+ margin: 0;
203
+ }
204
+ .ast-img-title a,
205
+ .ast-img-title span {
206
+ display: block;
207
+ outline: none;
208
+ box-shadow: none;
209
+ font-size: 1.5rem;
210
+ color: #333333;
211
+ font-weight: 500;
212
+ }
213
+
214
+ .ast-img-header-icon {
215
+ width: 50px;
216
+ vertical-align: bottom;
217
+ }
218
+ .ast-img-top-links {
219
+ flex: auto;
220
+ text-align: left;
221
+ font-weight: bold;
222
+ }
223
+ .ast-img-menu-page-header {
224
+ background-color: #fff;
225
+ text-align: center;
226
+ padding: 10px 0;
227
+ margin-bottom: 20px;
228
+ box-shadow: 0 2px 0 #efefef, 0 2px 2px #ececec;
229
+ }
230
+
231
+ /* White Label link*/
232
+ .ast-img-widget-list .ast-img-white-label{
233
+ border-right: 3px solid #008ec2;
234
+ padding-right: 12px;
235
+ }
236
+
237
+ .ast-img-hide-branding #poststuff #post-body.columns-2 {
238
+ margin: 0 auto;
239
+ max-width: 590px;
240
+ }
241
+
242
+ /* Integration */
243
+ .ast-img-integration-wrapper #poststuff {
244
+ width: 640px;
245
+ margin: 0 auto;
246
+ min-width: 640px;
247
+ }
248
+
249
+ .ast-img-integration-form-wrap .form-field select {
250
+ border-style: solid;
251
+ border-width: 1px;
252
+ width: 95%;
253
+ }
254
+
255
+
256
+ /* Spinner */
257
+ .ast-img-button-spinner:before {
258
+ font: normal 20px/.5 dashicons;
259
+ speak: none;
260
+ display: inline-block;
261
+ padding: 0;
262
+ top: 8px;
263
+ right: -4px;
264
+ position: relative;
265
+ vertical-align: top;
266
+ content: "\f463";
267
+ }
268
+
269
+ .ast-img-button-spinner.loading:before {
270
+ -webkit-animation: rotation 1s infinite linear;
271
+ animation: rotation 1s infinite linear;
272
+ }
273
+
274
+ .ast-img-title > a {
275
+ display: flex;
276
+ align-items: center;
277
+ }
278
+ .ast-img-title .ast-img-plugin-version {
279
+ background-color: #e5e5e5;
280
+ border-radius: 3px;
281
+ font-size: 0.5em;
282
+ font-weight: 400;
283
+ margin-right: 10px;
284
+ padding: 2px 7px;
285
+ color: #333;
286
+ }
287
+
288
+ /* New extensions badge */
289
+ #Particles .ast-img-widget-title:after {
290
+ content: "extension";
291
+ color: #fff;
292
+ background: #2ecc71;
293
+ font-size: 0.7em;
294
+ font-weight: 600;
295
+ position: relative;
296
+ padding: 0.3em 0.6em;
297
+ top: -1px;
298
+ right: 12px;
299
+ letter-spacing: 0.5px;
300
+ line-height: 1em;
301
+ text-transform: none;
302
+ text-transform: uppercase !important;
303
+ border-radius: 2px;
304
+ }
astra-sites/inc/assets/css/integration.css ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .notice:not(.ast-img-notice) {
2
+ display: none;
3
+ }
4
+ .ast-img-flex {
5
+ -js-display: flex;
6
+ display: -webkit-box;
7
+ display: -webkit-flex;
8
+ display: -moz-box;
9
+ display: -ms-flexbox;
10
+ display: flex;
11
+ -webkit-box-align: center;
12
+ -webkit-align-items: center;
13
+ -moz-box-align: center;
14
+ -ms-flex-align: center;
15
+ align-items: center;
16
+ -webkit-flex-wrap: wrap;
17
+ -ms-flex-wrap: wrap;
18
+ flex-wrap: wrap;
19
+ -webkit-align-content: center;
20
+ -ms-flex-line-pack: center;
21
+ align-content: center;
22
+ }
23
+
24
+ .form-field p.ast-img-p {
25
+ margin: 1em 0;
26
+ }
27
+
28
+ .ast-img-container{
29
+ max-width: 1200px;
30
+ margin: 0 auto;
31
+ padding: 0 20px;
32
+ box-sizing: border-box;
33
+ }
34
+ .form-wrap .ast-img-response-warning {
35
+ display: block;
36
+ color: #d02222;
37
+ }
38
+ .form-wrap .ast-img-google-error-response {
39
+ margin-top: 5px;
40
+ display: block;
41
+ }
42
+ .form-wrap .ast-img-google-error-response .ast-img-response-warning {
43
+ display: inline-block;
44
+ }
45
+ .form-wrap .ast-img-response-success {
46
+ display: block;
47
+ color: #2dbe15;
48
+ }
49
+ .postbox .inside .form-wrap .ast-img-integration-heading {
50
+ font-size: 15px;
51
+ font-weight: 600;
52
+ }
53
+ #ast-img-menu-page .ast-img-notice {
54
+ max-width: 860px;
55
+ margin: 0 auto;
56
+ }
57
+
58
+ .ast-img-menu-page-wrapper a {
59
+ text-decoration: none;
60
+ }
61
+
62
+ .ast-img-general-form-wrap {
63
+ width: 680px;
64
+ }
65
+
66
+ .ast-img-bulk-actions-wrap {
67
+ flex: auto;
68
+ text-align: right;
69
+ }
70
+
71
+ .ast-img-general-list .inside {
72
+ padding: 0;
73
+ margin: 0;
74
+ }
75
+
76
+ .ast-img-list-section .ast-img-widget-list li {
77
+ -js-display: flex;
78
+ display: -webkit-box;
79
+ display: -webkit-flex;
80
+ display: -moz-box;
81
+ display: -ms-flexbox;
82
+ display: flex;
83
+ -webkit-box-align: center;
84
+ -webkit-align-items: center;
85
+ -moz-box-align: center;
86
+ -ms-flex-align: center;
87
+ align-items: center;
88
+ -webkit-flex-wrap: wrap;
89
+ -ms-flex-wrap: wrap;
90
+ flex-wrap: wrap;
91
+ -webkit-align-content: center;
92
+ -ms-flex-line-pack: center;
93
+ align-content: center;
94
+ padding: 10px 12px;
95
+ -moz-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1) inset;
96
+ -webkit-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1) inset;
97
+ box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1) inset;
98
+ margin-bottom: 0;
99
+ }
100
+
101
+ .ast-img-list-section .ast-img-widget-list li:nth-child(even) {
102
+ background-color: #fbfbfb;
103
+ }
104
+
105
+ .ast-img-list-section .ast-img-widget-list .activate {
106
+ border-left: 3px solid #008ec2;
107
+ padding-left: 12px;
108
+ }
109
+
110
+ .ast-img-widget-list a {
111
+ text-decoration: none;
112
+ }
113
+
114
+ .ast-img-widget-link-wrapper {
115
+ -js-display: flex;
116
+ display: -webkit-box;
117
+ display: -webkit-flex;
118
+ display: -moz-box;
119
+ display: -ms-flexbox;
120
+ display: flex;
121
+ -webkit-box-align: center;
122
+ -webkit-align-items: center;
123
+ -moz-box-align: center;
124
+ -ms-flex-align: center;
125
+ align-items: center;
126
+ -webkit-flex-wrap: wrap;
127
+ -ms-flex-wrap: wrap;
128
+ flex-wrap: wrap;
129
+ -webkit-align-content: center;
130
+ -ms-flex-line-pack: center;
131
+ align-content: center;
132
+ display: -webkit-flex;
133
+ -webkit-flex-direction: row-reverse;
134
+ flex-direction: row-reverse;
135
+ flex: auto;
136
+ }
137
+
138
+ .ast-img-widget-list li a:before {
139
+ display: inline-block;
140
+ margin-right: 2px;
141
+ font: normal 20px/1 'dashicons';
142
+ -webkit-font-smoothing: antialiased;
143
+ -moz-osx-font-smoothing: grayscale;
144
+ vertical-align: top;
145
+ }
146
+
147
+ .ast-img-widget-link-wrapper a:nth-child(even) {
148
+ margin: 0 10px;
149
+ }
150
+
151
+ .ast-img-container .postbox .hndle {
152
+ background: #f7f7f7;
153
+ border-bottom: 2px solid #e6e6e6;
154
+ }
155
+ .ast-img-container .postbox ul {
156
+ margin: 0;
157
+ }
158
+ .ast-img-widget-list a {
159
+ line-height: 1.6;
160
+ }
161
+ .ast-img-widget-list a:focus {
162
+ box-shadow: none;
163
+ }
164
+
165
+ .ast-img-branding-list{
166
+ margin:0;
167
+ }
168
+ .ast-img-menu-page-wrapper .ast-img-container .clear {
169
+ overflow: auto;
170
+ visibility: visible;
171
+ width: auto;
172
+ height: auto;
173
+ }
174
+
175
+ /* Update icon. */
176
+ .ast-img-widget-link-wrapper a.updating-message:before {
177
+ color: #f56e28;
178
+ content: "\f463";
179
+ }
180
+
181
+ /* Spins the update icon. */
182
+ .ast-img-widget-link-wrapper a.updating-message:before {
183
+ -webkit-animation: rotation 2s infinite linear;
184
+ animation: rotation 2s infinite linear;
185
+ }
186
+
187
+ .settings_page_astra-images #wpcontent{
188
+ padding: 0;
189
+ }
190
+
191
+ /* Header */
192
+ .ast-img-menu-page-header.general .ast-img-container,
193
+ .ast-img-menu-page-header.branding .ast-img-container,
194
+ .ast-img-container.ast-img-general,
195
+ .ast-img-container.ast-img-branding-wrapper {
196
+ max-width: 930px;
197
+ }
198
+ .ast-img-title {
199
+ flex: auto;
200
+ align-content: flex-start;
201
+ text-align: left;
202
+ margin: 0;
203
+ }
204
+ .ast-img-title a,
205
+ .ast-img-title span {
206
+ display: block;
207
+ outline: none;
208
+ box-shadow: none;
209
+ font-size: 1.5rem;
210
+ color: #333333;
211
+ font-weight: 500;
212
+ }
213
+
214
+ .ast-img-header-icon {
215
+ width: 50px;
216
+ vertical-align: bottom;
217
+ }
218
+ .ast-img-top-links {
219
+ flex: auto;
220
+ text-align: right;
221
+ font-weight: bold;
222
+ }
223
+ .ast-img-menu-page-header {
224
+ background-color: #fff;
225
+ text-align: center;
226
+ padding: 10px 0;
227
+ margin-bottom: 20px;
228
+ box-shadow: 0 2px 0 #efefef, 0 2px 2px #ececec;
229
+ }
230
+
231
+ /* White Label link*/
232
+ .ast-img-widget-list .ast-img-white-label{
233
+ border-left: 3px solid #008ec2;
234
+ padding-left: 12px;
235
+ }
236
+
237
+ .ast-img-hide-branding #poststuff #post-body.columns-2 {
238
+ margin: 0 auto;
239
+ max-width: 590px;
240
+ }
241
+
242
+ /* Integration */
243
+ .ast-img-integration-wrapper #poststuff {
244
+ width: 640px;
245
+ margin: 0 auto;
246
+ min-width: 640px;
247
+ }
248
+
249
+ .ast-img-integration-form-wrap .form-field select {
250
+ border-style: solid;
251
+ border-width: 1px;
252
+ width: 95%;
253
+ }
254
+
255
+
256
+ /* Spinner */
257
+ .ast-img-button-spinner:before {
258
+ font: normal 20px/.5 dashicons;
259
+ speak: none;
260
+ display: inline-block;
261
+ padding: 0;
262
+ top: 8px;
263
+ left: -4px;
264
+ position: relative;
265
+ vertical-align: top;
266
+ content: "\f463";
267
+ }
268
+
269
+ .ast-img-button-spinner.loading:before {
270
+ -webkit-animation: rotation 1s infinite linear;
271
+ animation: rotation 1s infinite linear;
272
+ }
273
+
274
+ .ast-img-title > a {
275
+ display: flex;
276
+ align-items: center;
277
+ }
278
+ .ast-img-title .ast-img-plugin-version {
279
+ background-color: #e5e5e5;
280
+ border-radius: 3px;
281
+ font-size: 0.5em;
282
+ font-weight: 400;
283
+ margin-left: 10px;
284
+ padding: 2px 7px;
285
+ color: #333;
286
+ }
287
+
288
+ /* New extensions badge */
289
+ #Particles .ast-img-widget-title:after {
290
+ content: "extension";
291
+ color: #fff;
292
+ background: #2ecc71;
293
+ font-size: 0.7em;
294
+ font-weight: 600;
295
+ position: relative;
296
+ padding: 0.3em 0.6em;
297
+ top: -1px;
298
+ left: 12px;
299
+ letter-spacing: 0.5px;
300
+ line-height: 1em;
301
+ text-transform: none;
302
+ text-transform: uppercase !important;
303
+ border-radius: 2px;
304
+ }
astra-sites/inc/assets/fonts/astra-sites.eot ADDED
Binary file
astra-sites/inc/assets/fonts/astra-sites.svg ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="icomoon" horiz-adv-x="1024">
7
+ <font-face units-per-em="1024" ascent="960" descent="-64" />
8
+ <missing-glyph horiz-adv-x="1024" />
9
+ <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
+ <glyph unicode="&#xe900;" glyph-name="search3" d="M660.48 239.616c-68.622-53.712-156.164-86.131-251.277-86.131-226.216 0-409.6 183.384-409.6 409.6s183.384 409.6 409.6 409.6c226.216 0 409.6-183.384 409.6-409.6 0-95.113-32.419-182.654-86.809-252.177l0.678 0.9 273.92-272.896-72.704-72.704-272.896 273.408zM409.6 256c169.662 0 307.2 137.538 307.2 307.2s-137.538 307.2-307.2 307.2v0c-169.662 0-307.2-137.538-307.2-307.2s137.538-307.2 307.2-307.2v0z" />
11
+ <glyph unicode="&#xe901;" glyph-name="heart" d="M859.008 711.808c37.547-37.589 56.277-86.656 56.277-135.851s-18.773-98.261-56.277-135.765l-347.008-347.008-347.008 347.008c-37.504 37.504-56.235 86.571-56.235 135.808s18.731 98.304 56.235 135.808 86.571 56.235 135.808 56.235 98.304-18.731 135.808-56.235l45.227-45.227c16.683-16.683 43.691-16.683 60.331 0l45.312 45.312c37.504 37.504 86.571 56.235 135.765 56.192s98.261-18.773 135.765-56.277zM919.339 772.139c-54.144 54.144-125.184 81.237-196.096 81.28s-141.952-27.051-196.139-81.195l-15.104-15.147-15.061 15.061c-54.144 54.144-125.227 81.237-196.139 81.237s-141.995-27.093-196.139-81.237-81.237-125.227-81.237-196.139 27.093-141.995 81.237-196.139l377.173-377.173c16.683-16.683 43.691-16.683 60.331 0l377.173 377.173c54.144 54.144 81.237 125.184 81.28 196.096s-27.051 141.952-81.28 196.181z" />
12
+ <glyph unicode="&#xe902;" glyph-name="refresh" d="M189.995 540.416c31.445 88.875 95.872 156.544 174.763 194.219s172.032 45.184 260.864 13.739c50.603-17.92 94.123-46.421 127.275-80.213l120.747-113.493h-148.309c-23.552 0-42.667-19.115-42.667-42.667s19.115-42.667 42.667-42.667h255.872c0.213 0 0.384 0 0.597 0 5.845 0.043 11.435 1.323 16.469 3.499 5.077 2.176 9.771 5.376 13.824 9.6 0.512 0.555 1.024 1.109 1.536 1.664 3.2 3.712 5.675 7.808 7.381 12.16s2.731 9.003 2.944 13.909c0.043 0.64 0.043 1.237 0.043 1.835v256c0 23.552-19.115 42.667-42.667 42.667s-42.667-19.115-42.667-42.667v-157.397l-124.843 117.291c-42.325 43.093-96.896 78.635-159.701 100.864-111.061 39.296-227.627 29.824-326.101-17.152s-179.157-131.669-218.453-242.731c-7.893-22.187 3.755-46.549 25.941-54.443s46.592 3.755 54.443 25.984zM85.333 242.688l126.080-118.485c82.304-82.389 191.573-124.075 300.715-124.117s218.411 41.6 301.739 124.885c47.104 47.104 81.109 102.699 100.736 159.787 7.68 22.272-4.181 46.549-26.496 54.229s-46.549-4.181-54.229-26.496c-15.403-44.8-42.368-89.216-80.341-127.189-66.688-66.645-153.984-99.925-241.365-99.925s-174.677 33.365-242.304 100.949l-119.467 112.341h148.267c23.552 0 42.667 19.115 42.667 42.667s-19.115 42.667-42.667 42.667h-255.872c-0.213 0-0.384 0-0.597 0-5.845-0.043-11.435-1.323-16.469-3.499-5.077-2.176-9.771-5.376-13.824-9.6-0.512-0.555-1.024-1.109-1.536-1.664-3.2-3.712-5.675-7.808-7.381-12.16s-2.731-9.003-2.944-13.909c-0.043-0.64-0.043-1.237-0.043-1.835v-256c0-23.552 19.115-42.667 42.667-42.667s42.667 19.115 42.667 42.667z" />
13
+ <glyph unicode="&#xe903;" glyph-name="file" d="M554.667 896h-298.667c-35.328 0-67.413-14.379-90.496-37.504s-37.504-55.168-37.504-90.496v-682.667c0-35.328 14.379-67.413 37.504-90.496s55.168-37.504 90.496-37.504h512c35.328 0 67.413 14.379 90.496 37.504s37.504 55.168 37.504 90.496v469.333c0 11.776-4.779 22.443-12.501 30.165l-298.667 298.667c-4.096 4.096-8.789 7.168-13.824 9.259-5.205 2.176-10.795 3.243-16.341 3.243zM750.336 597.334h-153.003v153.003zM512 810.667v-256c0-23.552 19.115-42.667 42.667-42.667h256v-426.667c0-11.776-4.736-22.4-12.501-30.165s-18.389-12.501-30.165-12.501h-512c-11.776 0-22.4 4.736-30.165 12.501s-12.501 18.389-12.501 30.165v682.667c0 11.776 4.736 22.4 12.501 30.165s18.389 12.501 30.165 12.501z" />
14
+ <glyph unicode="&#xe904;" glyph-name="chevron-left" d="M670.165 200.832l-225.835 225.835 225.835 225.835c16.683 16.683 16.683 43.691 0 60.331s-43.691 16.683-60.331 0l-256-256c-16.683-16.683-16.683-43.691 0-60.331l256-256c16.683-16.683 43.691-16.683 60.331 0s16.683 43.691 0 60.331z" />
15
+ <glyph unicode="&#xe905;" glyph-name="layers" d="M512 805.632l331.264-165.632-331.264-165.632-331.264 165.632zM492.928 891.478l-426.667-213.333c-21.077-10.539-29.611-36.139-19.072-57.216 4.309-8.661 11.136-15.189 19.072-19.072l426.667-213.333c12.459-6.229 26.453-5.803 38.144 0l426.667 213.333c21.077 10.539 29.611 36.181 19.072 57.259-4.309 8.619-11.179 15.147-19.072 19.072l-426.667 213.333c-12.459 6.229-26.453 5.803-38.144 0zM66.261 175.19l426.667-213.333c12.459-6.229 26.453-5.803 38.144 0l426.667 213.333c21.077 10.539 29.611 36.181 19.072 57.259s-36.181 29.611-57.259 19.072l-407.552-203.819-407.595 203.776c-21.077 10.539-46.72 2.005-57.259-19.072s-2.005-46.72 19.072-57.259zM66.261 388.523l426.667-213.333c12.459-6.229 26.453-5.803 38.144 0l426.667 213.333c21.077 10.539 29.611 36.181 19.072 57.259s-36.181 29.611-57.259 19.072l-407.552-203.819-407.595 203.776c-21.077 10.539-46.72 2.005-57.259-19.072s-2.005-46.72 19.072-57.259z" />
16
+ </font></defs></svg>
astra-sites/inc/assets/fonts/astra-sites.ttf ADDED
Binary file
astra-sites/inc/assets/fonts/astra-sites.woff ADDED
Binary file
astra-sites/inc/assets/images/arrow-blue.svg ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Isolation_Mode" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
5
+ y="0px" width="100px" height="56px" viewBox="0 0 100 56" enable-background="new 0 0 100 56" xml:space="preserve">
6
+ <path fill="#0073AA" d="M97.286,0c-1.499,0-2.714,1.2-2.714,2.683c0,11.211-4.895,23.281-13.095,32.286
7
+ C72.279,45.069,59.701,50.634,46.06,50.634c-8.53,0-17.074-2.393-24.709-6.921c-4.842-2.88-9.193-6.499-12.889-10.726l12.753,0.416
8
+ c1.498,0.049,2.752-1.112,2.801-2.594c0.049-1.48-1.125-2.72-2.623-2.769L3.747,27.465c-1.013-0.412-2.179-0.18-2.953,0.585
9
+ c-0.775,0.768-1.007,1.919-0.587,2.92l0.581,17.438c0.034,1.483,1.276,2.657,2.775,2.624c1.497-0.033,2.687-1.261,2.653-2.742
10
+ c0-0.02,0-0.038-0.002-0.058L5.878,38.171c3.733,3.944,8,7.357,12.679,10.146C27.035,53.344,36.545,56,46.06,56
11
+ c15.199,0,29.213-6.192,39.453-17.44C94.584,28.596,100,15.186,100,2.683C100,1.2,98.786,0,97.286,0L97.286,0z M97.286,0"/>
12
+ </svg>
astra-sites/inc/assets/images/beaver-builder.jpg ADDED
Binary file
astra-sites/inc/assets/images/block-editor.png ADDED
Binary file
astra-sites/inc/assets/images/brizy.jpg ADDED
Binary file
astra-sites/inc/assets/images/elementor.jpg ADDED
Binary file
astra-sites/inc/assets/images/empty-collection.svg ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="200px" height="240px" viewBox="0 0 200 240" enable-background="new 0 0 200 240" xml:space="preserve">
6
+ <g>
7
+ <g>
8
+ <path fill="#FFFFFF" d="M196.201,0H3.8C1.7,0,0,1.7,0,3.8v232.5c0,2.1,1.7,3.799,3.8,3.799h192.401c2.1,0,3.799-1.699,3.799-3.799
9
+ V3.8C200,1.7,198.301,0,196.201,0L196.201,0z"/>
10
+ </g>
11
+ </g>
12
+ <g>
13
+ <g>
14
+ <g>
15
+ <path fill="#FF4D4D" d="M170,222.599c-0.199,0-0.5-0.1-0.699-0.299L164,216.999c-0.9-0.799-1.4-1.9-1.4-3.199
16
+ c0-2.301,1.9-4.201,4.201-4.201c1.299,0,2.4,0.5,3.199,1.5c0.801-0.898,2-1.5,3.201-1.5c2.299,0,4.199,1.9,4.199,4.201
17
+ c0,1.199-0.5,2.4-1.5,3.199L170.6,222.3C170.5,222.499,170.301,222.599,170,222.599z M167.1,210.999c-1.699,0-3.1,1.4-3.1,3
18
+ c0,0.9,0.4,1.701,1,2.301l5,4.9l0,0l4.9-4.9c0.699-0.6,1.1-1.4,1.1-2.301c0-1.699-1.4-3-3.1-3c-1.1,0-2,0.5-2.6,1.4l-0.301,0.6
19
+ l-0.299-0.6C169.1,211.499,168.1,210.999,167.1,210.999z"/>
20
+ </g>
21
+ </g>
22
+ </g>
23
+ <g>
24
+ <g>
25
+ <g>
26
+ <path fill="#DDE3E6" d="M106.712,217.599H14.421c-0.818,0-1.5-0.682-1.5-1.501c0-0.817,0.682-1.499,1.5-1.499h92.358
27
+ c0.818,0,1.5,0.682,1.5,1.499C108.211,216.917,107.598,217.599,106.712,217.599z"/>
28
+ </g>
29
+ </g>
30
+ </g>
31
+ <g>
32
+ <g>
33
+ <path fill="#DDE3E6" d="M196.201,0.9c1.6,0,2.799,1.3,2.799,2.8v232.5c0,1.6-1.299,2.799-2.799,2.799H3.8
34
+ c-1.6,0-2.8-1.299-2.8-2.799V3.8C1,2.2,2.3,1,3.8,1L196.201,0.9 M196.201,0H3.8C1.7,0,0,1.7,0,3.8v232.5
35
+ c0,2.1,1.7,3.799,3.8,3.799h192.401c2.1,0,3.799-1.699,3.799-3.799V3.8C200,1.7,198.301,0,196.201,0L196.201,0z"/>
36
+ </g>
37
+ </g>
38
+ <g>
39
+ <rect x="0.899" y="191.399" fill="#DDE3E6" width="198.601" height="1.5"/>
40
+ </g>
41
+ <g>
42
+ <path fill="#DDE3E6" d="M163.801,118.7H36.2c-1.9,0-3.4-1.5-3.4-3.4V38.7c0-1.9,1.5-3.4,3.4-3.4h127.501
43
+ c1.898,0,3.398,1.5,3.398,3.4v76.6C167.1,117.2,165.6,118.7,163.801,118.7z M36.2,37.4c-0.801,0-1.4,0.6-1.4,1.4v76.602
44
+ c0,0.699,0.6,1.398,1.4,1.398h127.501c0.799,0,1.398-0.6,1.398-1.398V38.7c0-0.7-0.6-1.4-1.398-1.4H36.2V37.4z"/>
45
+ </g>
46
+ <g>
47
+ <rect x="33.899" y="172.999" fill="#DDE3E6" width="37.801" height="2.4"/>
48
+ </g>
49
+ <g>
50
+ <path fill="#DDE3E6" d="M69.3,165.8H36.2c-1.9,0-3.4-1.5-3.4-3.4v-28.301c0-1.898,1.5-3.398,3.4-3.398h33.1
51
+ c1.9,0,3.4,1.5,3.4,3.398v28.301C72.7,164.3,71.2,165.8,69.3,165.8z M36.2,132.8c-0.801,0-1.4,0.6-1.4,1.4v28.299
52
+ c0,0.701,0.6,1.4,1.4,1.4h33.1c0.8,0,1.4-0.6,1.4-1.4V134.2c0-0.701-0.601-1.4-1.4-1.4H36.2z"/>
53
+ </g>
54
+ <g>
55
+ <rect x="80.4" y="172.999" fill="#DDE3E6" width="37.801" height="2.4"/>
56
+ </g>
57
+ <g>
58
+ <path fill="#DDE3E6" d="M115.801,165.8H82.7c-1.9,0-3.4-1.5-3.4-3.4v-28.301c0-1.898,1.5-3.398,3.4-3.398h33.101
59
+ c1.9,0,3.4,1.5,3.4,3.398v28.301C119.201,164.3,117.6,165.8,115.801,165.8z M82.7,132.8c-0.8,0-1.4,0.6-1.4,1.4v28.299
60
+ c0,0.701,0.601,1.4,1.4,1.4h33.101c0.799,0,1.4-0.6,1.4-1.4V134.2c0-0.701-0.602-1.4-1.4-1.4H82.7z"/>
61
+ </g>
62
+ <g>
63
+ <rect x="126.701" y="172.999" fill="#DDE3E6" width="37.799" height="2.4"/>
64
+ </g>
65
+ <g>
66
+ <path fill="#DDE3E6" d="M162.1,165.8H129c-1.9,0-3.4-1.5-3.4-3.4v-28.301c0-1.898,1.5-3.398,3.4-3.398h33.1
67
+ c1.9,0,3.4,1.5,3.4,3.398v28.301C165.4,164.3,163.9,165.8,162.1,165.8z M129,132.8c-0.799,0-1.4,0.6-1.4,1.4v28.299
68
+ c0,0.701,0.602,1.4,1.4,1.4h33.1c0.801,0,1.4-0.6,1.4-1.4V134.2c0-0.701-0.6-1.4-1.4-1.4H129z"/>
69
+ </g>
70
+ <g>
71
+ <path fill="#DDE3E6" d="M107.967,65.958c0,2.469-1.98,4.48-4.414,4.48c-2.432,0-4.411-2.009-4.411-4.48s1.979-4.48,4.411-4.48
72
+ C105.986,61.477,107.967,63.489,107.967,65.958L107.967,65.958z M97.314,65.958c0,3.476,2.801,6.308,6.239,6.308
73
+ c3.441,0,6.238-2.831,6.238-6.308c0-3.479-2.797-6.308-6.238-6.308C100.111,59.65,97.314,62.481,97.314,65.958L97.314,65.958z"/>
74
+ <path fill="#DDE3E6" d="M118.678,74.36l-14.094,13.848L87.908,67.983L65.561,96.492l1.697,1.312L87.95,71.406l21.511,26.089
75
+ l1.664-1.357l-5.17-6.271L118.67,77.37c2.984,2.941,13.779,13.59,14.246,14.054l1.523-1.511
76
+ c-0.539-0.535-15.012-14.807-15.012-14.807L118.678,74.36L118.678,74.36z"/>
77
+ </g>
78
+ <g>
79
+ <g>
80
+ <path fill="#DDE3E6" d="M40.214,17.787H11.842c-0.423,0-0.756-0.197-0.756-0.447V9.686c0-0.25,0.333-0.447,0.756-0.447h28.35
81
+ c0.422,0,0.755,0.197,0.755,0.447v7.654C40.946,17.589,40.613,17.787,40.214,17.787z"/>
82
+ </g>
83
+ <g>
84
+ <g>
85
+ <g>
86
+ <rect x="99.244" y="12.763" fill="#DDE3E6" width="89.67" height="1.5"/>
87
+ </g>
88
+ </g>
89
+ </g>
90
+ </g>
91
+ </svg>
astra-sites/inc/assets/images/gutenberg.jpg ADDED
Binary file
astra-sites/inc/assets/images/logo.svg ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 24.2.1, SVG Export Plug-In SVG - Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{opacity:0.83;enable-background:new ;}
7
+ .st1{fill:#95F9EF;}
8
+ .st2{opacity:0.53;enable-background:new ;}
9
+ .st3{fill:url(#SVGID_1_);}
10
+ .st4{opacity:0.7;enable-background:new ;}
11
+ .st5{fill:url(#SVGID_2_);}
12
+ .st6{fill:#FFFFFF;}
13
+ </style>
14
+ <g>
15
+ <g class="st0">
16
+ <path class="st1" d="M26.8,88L9,33.5C8,30.7,9.6,27.8,12.2,27L66.8,9.2c2.7-0.9,5.7,0.6,6.4,3.2l17.9,54.6
17
+ c0.9,2.7-0.6,5.7-3.2,6.4l-54.6,18C30.5,92.2,27.6,90.8,26.8,88z"/>
18
+ </g>
19
+ <g class="st2">
20
+
21
+ <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="4.238" y1="739.9995" x2="95.762" y2="739.9995" gradientTransform="matrix(1 0 0 1 0 -690)">
22
+ <stop offset="0" style="stop-color:#00E97B"/>
23
+ <stop offset="1" style="stop-color:#00F9D7"/>
24
+ </linearGradient>
25
+ <path class="st3" d="M44.7,94.3L5.6,52c-1.9-2.1-1.8-5.3,0.3-7.3L48.1,5.4c2.1-1.9,5.3-1.8,7.2,0.3L94.4,48
26
+ c1.9,2.1,1.8,5.3-0.3,7.3L51.9,94.6C50,96.6,46.6,96.4,44.7,94.3z"/>
27
+ </g>
28
+ <g class="st4">
29
+
30
+ <linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="296.5753" y1="-720.5554" x2="368.5928" y2="-720.5554" gradientTransform="matrix(0.9591 0.2829 0.2829 -0.9591 -65.1611 -734.9626)">
31
+ <stop offset="0" style="stop-color:#00DBDE"/>
32
+ <stop offset="1" style="stop-color:#FC00FF"/>
33
+ </linearGradient>
34
+ <path class="st5" d="M69.2,93.3L10.6,76.1c-2.9-0.8-4.5-3.9-3.7-6.8l17.2-58.6c0.8-2.9,3.9-4.5,6.8-3.7l58.6,17.2
35
+ c2.9,0.8,4.5,3.9,3.7,6.8L75.9,89.6C75.1,92.5,72,94.1,69.2,93.3z"/>
36
+ </g>
37
+ <g>
38
+ <path class="st6" d="M51.9,39.1L51.9,39.1h14.4V28.4H45.9c-1.9,0-3.7,0.3-5.3,1.1c-1.6,0.6-3.1,1.8-4.4,2.9
39
+ c-1.3,1.3-2.2,2.7-2.9,4.4c-0.4,0.7-0.6,1.6-0.8,2.4L51.9,39.1L51.9,39.1z"/>
40
+ <path class="st6" d="M66.9,53.3c-0.6-1.6-1.8-3.2-2.9-4.4c-1.3-1.3-2.7-2.2-4.4-2.9c-1.6-0.6-3.5-1.1-5.3-1.1h-2.4h-6H32.5
41
+ c0.2,0.9,0.5,1.7,0.8,2.6c0.6,1.6,1.8,3.2,2.9,4.4c1.3,1.3,2.7,2.2,4.4,2.9c1.6,0.8,3.5,1.1,5.3,1.1h8.4c0.5,0,0.8,0,1.1,0.2
42
+ c0.3,0.2,0.6,0.3,0.9,0.6c0.3,0.3,0.5,0.6,0.6,0.9c0.2,0.3,0.2,0.8,0.2,1.1c0,0.5,0,0.8-0.2,1.1c-0.2,0.3-0.3,0.6-0.6,0.9
43
+ c-0.3,0.3-0.6,0.5-0.9,0.6c-0.3,0.2-0.8,0.2-1.1,0.2h-20v10.8h19.8c1.9,0,3.7-0.3,5.5-1.1c1.6-0.6,3.2-1.8,4.4-2.9
44
+ c1.3-1.3,2.2-2.7,2.9-4.4c0.6-1.6,1.1-3.5,1.1-5.3C68,56.6,67.7,54.9,66.9,53.3z"/>
45
+ </g>
46
+ </g>
47
+ </svg>
astra-sites/inc/assets/images/pixabay-logo.png ADDED
Binary file
astra-sites/inc/assets/images/placeholder.png ADDED
Binary file
astra-sites/inc/assets/images/premium-crown.svg ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#FFFFFF;}
7
+ </style>
8
+ <path class="st0" d="M93,38.4c0,0.3,0,0.5-0.1,0.8l-5.8,23c-0.3,1.2-1.3,2-2.5,2l-34.5,0.2c0,0,0,0,0,0H15.6c-1.2,0-2.2-0.8-2.5-2
9
+ L7.3,39.2c-0.1-0.3-0.1-0.5-0.1-0.8c-2.2-0.7-3.8-2.8-3.8-5.2c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5c0,1.7-0.8,3.2-2,4.2l7.2,7.3
10
+ c1.8,1.8,4.3,2.9,6.9,2.9c3.1,0,6-1.5,7.8-3.9L46.1,28c-1-1-1.6-2.4-1.6-3.9c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5
11
+ c0,1.5-0.6,2.8-1.5,3.8c0,0,0,0,0,0l11.8,15.7c1.8,2.5,4.8,3.9,7.8,3.9c2.6,0,5.1-1,6.9-2.9l7.2-7.2c-1.2-1-2.1-2.5-2.1-4.3
12
+ c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5C96.6,35.6,95.1,37.6,93,38.4z M86.6,72.5c0-1.4-1.2-2.6-2.6-2.6H16.3c-1.4,0-2.6,1.2-2.6,2.6
13
+ v6.3c0,1.4,1.2,2.6,2.6,2.6H84c1.4,0,2.6-1.2,2.6-2.6V72.5z"/>
14
+ </svg>
astra-sites/inc/assets/images/quick-link-logo.svg ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="bold" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#4224B8;}
7
+ </style>
8
+ <g>
9
+ <path class="st0" d="M21.5,27.8H4.2c-1.5,0-2.8-1.2-2.8-2.8s1.2-2.8,2.8-2.8h41.5c1.5,0,2.8,1.2,2.8,2.8s-1.2,2.8-2.8,2.8H21.5"/>
10
+ <path class="st0" d="M21.5,42.5H4.2c-1.5,0-2.8-1.2-2.8-2.8c0-1.5,1.2-2.8,2.8-2.8h41.5c1.5,0,2.8,1.2,2.8,2.8
11
+ c0,1.5-1.2,2.8-2.8,2.8H21.5"/>
12
+ <path class="st0" d="M45.8,13H4.2c-1.5,0-2.8-1.2-2.8-2.8s1.2-2.8,2.8-2.8h41.5c1.5,0,2.8,1.2,2.8,2.8S47.3,13,45.8,13z"/>
13
+ </g>
14
+ </svg>
astra-sites/inc/assets/js/admin-page.js ADDED
@@ -0,0 +1,3982 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * AJAX Request Queue
3
+ *
4
+ * - add()
5
+ * - remove()
6
+ * - run()
7
+ * - stop()
8
+ *
9
+ * @since 1.0.0
10
+ */
11
+ var AstraSitesAjaxQueue = (function () {
12
+
13
+ var requests = [];
14
+
15
+ return {
16
+
17
+ /**
18
+ * Add AJAX request
19
+ *
20
+ * @since 1.0.0
21
+ */
22
+ add: function (opt) {
23
+ requests.push(opt);
24
+ },
25
+
26
+ /**
27
+ * Remove AJAX request
28
+ *
29
+ * @since 1.0.0
30
+ */
31
+ remove: function (opt) {
32
+ if (jQuery.inArray(opt, requests) > -1) {
33
+ requests.splice($.inArray(opt, requests), 1);
34
+ }
35
+ },
36
+
37
+ /**
38
+ * Run / Process AJAX request
39
+ *
40
+ * @since 1.0.0
41
+ */
42
+ run: function () {
43
+ var self = this,
44
+ oriSuc;
45
+
46
+
47
+ if (requests.length) {
48
+ oriSuc = requests[0].complete;
49
+
50
+ requests[0].complete = function () {
51
+ if (typeof (oriSuc) === 'function') oriSuc();
52
+ requests.shift();
53
+ self.run.apply(self, []);
54
+ };
55
+
56
+ jQuery.ajax(requests[0]);
57
+ } else {
58
+ self.tid = setTimeout(function () {
59
+ self.run.apply(self, []);
60
+ }, 1000);
61
+ }
62
+
63
+ },
64
+
65
+ /**
66
+ * Stop AJAX request
67
+ *
68
+ * @since 1.0.0
69
+ */
70
+ stop: function () {
71
+ requests = [];
72
+ clearTimeout(this.tid);
73
+ },
74
+
75
+ /**
76
+ * Debugging.
77
+ *
78
+ * @param {mixed} data Mixed data.
79
+ */
80
+ _log: function (data, level) {
81
+ var date = new Date();
82
+ var time = date.toLocaleTimeString();
83
+
84
+ var color = '#444';
85
+
86
+ if (typeof data == 'object') {
87
+ console.log(data);
88
+ } else {
89
+ console.log(data + ' ' + time);
90
+ }
91
+ },
92
+ };
93
+
94
+ }());
95
+
96
+ (function ($) {
97
+
98
+ /** Checking the element is in viewport? */
99
+ $.fn.isInViewport = function () {
100
+
101
+ // If not have the element then return false!
102
+ if (!$(this).length) {
103
+ return false;
104
+ }
105
+
106
+ var elementTop = $(this).offset().top;
107
+ var elementBottom = elementTop + $(this).outerHeight();
108
+
109
+ var viewportTop = $(window).scrollTop();
110
+ var viewportBottom = viewportTop + $(window).height();
111
+
112
+ return elementBottom > viewportTop && elementTop < viewportBottom;
113
+ };
114
+
115
+ var AstraSSEImport = {
116
+ complete: {
117
+ posts: 0,
118
+ media: 0,
119
+ users: 0,
120
+ comments: 0,
121
+ terms: 0,
122
+ },
123
+
124
+ updateDelta: function (type, delta) {
125
+ this.complete[type] += delta;
126
+
127
+ var self = this;
128
+ requestAnimationFrame(function () {
129
+ self.render();
130
+ });
131
+ },
132
+ updateProgress: function (type, complete, total) {
133
+ var text = complete + '/' + total;
134
+
135
+ if ('undefined' !== type && 'undefined' !== text) {
136
+ total = parseInt(total, 10);
137
+ if (0 === total || isNaN(total)) {
138
+ total = 1;
139
+ }
140
+
141
+ var percent = parseInt(complete, 10) / total;
142
+ var progress = Math.round(percent * 100) + '%';
143
+ var progress_bar = percent * 100;
144
+
145
+ if (progress_bar <= 100) {
146
+ var process_bars = document.getElementsByClassName('astra-site-import-process');
147
+ for (var i = 0; i < process_bars.length; i++) {
148
+ process_bars[i].value = progress_bar;
149
+ }
150
+ AstraSitesAdmin._log_title('Importing Content.. ' + progress, false, false);
151
+ }
152
+ }
153
+ },
154
+ render: function () {
155
+ var types = Object.keys(this.complete);
156
+ var complete = 0;
157
+ var total = 0;
158
+
159
+ for (var i = types.length - 1; i >= 0; i--) {
160
+ var type = types[i];
161
+ this.updateProgress(type, this.complete[type], this.data.count[type]);
162
+
163
+ complete += this.complete[type];
164
+ total += this.data.count[type];
165
+ }
166
+
167
+ this.updateProgress('total', complete, total);
168
+ }
169
+ };
170
+
171
+ AstraSitesAdmin = {
172
+
173
+ default_cta_link: astraSitesVars.cta_link,
174
+ quick_corner_cta_link: astraSitesVars.cta_quick_corner_link,
175
+ premium_popup_cta_link: astraSitesVars.cta_premium_popup_link,
176
+ import_source: 'legacy',
177
+ wpcontent_left_margin: $('#wpcontent').css('margin-left'),
178
+ header: $('#astra-sites-menu-page .nav-tab-wrapper'),
179
+ header_offset: 0,
180
+ header_gutter: null,
181
+ header_stick_after: null,
182
+
183
+ subscribe_status: false,
184
+ subscribe_skiped: false,
185
+ site_import_status: false,
186
+ page_import_status: false,
187
+ imported_page_data: null,
188
+ first_import_complete: astraSitesVars.first_import_complete,
189
+ remaining_activate_plugins: [],
190
+ required_plugins_original_list: [],
191
+ subscription_form_submitted: astraSitesVars.subscribed,
192
+
193
+ compatibilities: [],
194
+
195
+ skip_and_import_popups: [],
196
+ required_plugins: [],
197
+
198
+ _ref: null,
199
+
200
+ _breakpoint: 768,
201
+ _has_default_page_builder: false,
202
+ _first_time_loaded: true,
203
+
204
+ visited_sites_and_pages: [],
205
+
206
+ reset_remaining_posts: 0,
207
+ reset_remaining_wp_forms: 0,
208
+ reset_remaining_terms: 0,
209
+ reset_processed_posts: 0,
210
+ reset_processed_wp_forms: 0,
211
+ reset_processed_terms: 0,
212
+ site_imported_data: null,
213
+
214
+ backup_taken: false,
215
+ filter_array: [],
216
+ autocompleteTags: astraSitesVars.all_site_categories_and_tags.map( function( item ) {
217
+ return item.name;
218
+ }) || [],
219
+ templateData: {},
220
+ mouseLocation: false,
221
+ log_file: '',
222
+ customizer_data: '',
223
+ wxr_url: '',
224
+ wpforms_url: '',
225
+ cartflows_url: '',
226
+ options_data: '',
227
+ widgets_data: '',
228
+ enabled_extensions: '',
229
+ action_slug: '',
230
+ import_start_time: '',
231
+ import_end_time: '',
232
+ search_terms: [],
233
+ search_terms_with_count: [],
234
+ page_settings_flag: true,
235
+ delay_in_request: false,
236
+ delay_value : 10000, // 10 seconds.
237
+
238
+ init: function () {
239
+ this._show_default_page_builder_sites();
240
+ this._bind();
241
+ this._autocomplete();
242
+ this._load_large_images();
243
+ this._prepare_markup();
244
+ },
245
+
246
+ _prepare_markup: function () {
247
+ var WPAdminbarOuterHeight = parseFloat($('#wpadminbar').outerHeight());
248
+ var HeaderOuterHeight = parseFloat(AstraSitesAdmin.header.outerHeight());
249
+ AstraSitesAdmin.header
250
+ .wrap('<div></div>')
251
+ .parent().css('min-height', HeaderOuterHeight);
252
+
253
+ $('.single-site-footer').css('margin-left', AstraSitesAdmin.wpcontent_left_margin);
254
+ $('.single-site-pages-wrap').css('margin-right', AstraSitesAdmin.wpcontent_left_margin);
255
+
256
+ AstraSitesAdmin.header_gutter = WPAdminbarOuterHeight;
257
+ AstraSitesAdmin.header_offset = WPAdminbarOuterHeight + HeaderOuterHeight;
258
+ AstraSitesAdmin.header_stick_after = WPAdminbarOuterHeight - HeaderOuterHeight;
259
+ AstraSitesAdmin._stick_header();
260
+ },
261
+
262
+ /**
263
+ * load large image
264
+ *
265
+ * @return {[type]} [description]
266
+ */
267
+ _load_large_image: function (el) {
268
+ if (el.hasClass('loaded')) {
269
+ return;
270
+ }
271
+
272
+ if (el.parents('.astra-theme').isInViewport()) {
273
+ var large_img_url = el.data('src') || '';
274
+ var imgLarge = new Image();
275
+ imgLarge.src = large_img_url;
276
+ imgLarge.onload = function () {
277
+ el.removeClass('loading');
278
+ el.addClass('loaded');
279
+ el.css('background-image', 'url(\'' + imgLarge.src + '\'');
280
+ };
281
+ }
282
+ },
283
+
284
+ _load_large_images: function () {
285
+ $('.theme-screenshot').each(function (key, el) {
286
+ AstraSitesAdmin._load_large_image($(el));
287
+ });
288
+ },
289
+
290
+
291
+ _autocomplete: function () {
292
+
293
+ var strings = AstraSitesAdmin.autocompleteTags;
294
+ strings = _.uniq(strings);
295
+ strings = _.sortBy(strings);
296
+
297
+ $("#wp-filter-search-input").autocomplete({
298
+ appendTo: ".astra-sites-autocomplete-result",
299
+ classes: {
300
+ "ui-autocomplete": "astra-sites-auto-suggest"
301
+ },
302
+ source: function (request, response) {
303
+ var results = $.ui.autocomplete.filter(strings, request.term);
304
+
305
+ // Show only 10 results.
306
+ response(results.slice(0, 15));
307
+ },
308
+ open: function (event, ui) {
309
+ $('.search-form').addClass('searching');
310
+ },
311
+ close: function (event, ui) {
312
+ $('.search-form').removeClass('searching');
313
+ }
314
+ });
315
+
316
+ $("#wp-filter-search-input").focus();
317
+ },
318
+
319
+ /**
320
+ * Debugging.
321
+ *
322
+ * @param {mixed} data Mixed data.
323
+ */
324
+ _log: function (data, level) {
325
+ var date = new Date();
326
+ var time = date.toLocaleTimeString();
327
+
328
+ var color = '#444';
329
+
330
+ switch (level) {
331
+ case 'emergency': // color = '#f44336';
332
+ case 'critical': // color = '#f44336';
333
+ case 'alert': // color = '#f44336';
334
+ case 'error': // color = '#f44336';
335
+ if (typeof data == 'object') {
336
+ console.error(data);
337
+ } else {
338
+ console.error(data + ' ' + time);
339
+ }
340
+ break;
341
+ case 'warning': // color = '#ffc107';
342
+ case 'notice': // color = '#ffc107';
343
+ if (typeof data == 'object') {
344
+ console.warn(data);
345
+ } else {
346
+ console.warn(data + ' ' + time);
347
+ }
348
+ break;
349
+ default:
350
+ if (typeof data == 'object') {
351
+ console.log(data);
352
+ } else {
353
+ console.log(data + ' ' + time);
354
+ }
355
+ break;
356
+ // case 'info': color = '#03a9f4';
357
+ // break;
358
+ // case 'debug': color = '#ffc107';
359
+ }
360
+ },
361
+
362
+ _log_title: function (data, append) {
363
+
364
+ var markup = '<p>' + data + '</p>';
365
+ if (typeof data == 'object') {
366
+ var markup = '<p>' + JSON.stringify(data) + '</p>';
367
+ }
368
+
369
+ var selector = $('.ast-importing-wrap');
370
+ if ($('.current-importing-status-title').length) {
371
+ selector = $('.current-importing-status-title');
372
+ }
373
+
374
+ if (append) {
375
+ selector.append(markup);
376
+ } else {
377
+ selector.html(markup);
378
+ }
379
+
380
+ },
381
+
382
+ /**
383
+ * Binds events for the Astra Sites.
384
+ *
385
+ * @since 1.0.0
386
+ * @access private
387
+ * @method _bind
388
+ */
389
+ _bind: function () {
390
+ $(window).on('resize scroll', AstraSitesAdmin._load_large_images);
391
+
392
+ $('.astra-sites__category-filter-anchor, .astra-sites__category-filter-items').hover(function () {
393
+ AstraSitesAdmin.mouseLocation = true;
394
+ }, function () {
395
+ AstraSitesAdmin.mouseLocation = false;
396
+ });
397
+
398
+ $("body").mouseup(function () {
399
+ if (!AstraSitesAdmin.mouseLocation) AstraSitesAdmin._closeFilter();
400
+ });
401
+
402
+ // Change page builder.
403
+ $(document).on('click', '.nav-tab-wrapper .page-builders li', AstraSitesAdmin._ajax_change_page_builder);
404
+ $(document).on('click', '#astra-sites-welcome-form .page-builders li', AstraSitesAdmin._change_page_builder);
405
+
406
+ // Open & Close Popup.
407
+ $(document).on('click', '.site-import-cancel, .astra-sites-result-preview .close, .astra-sites-popup .close', AstraSitesAdmin._close_popup);
408
+ $(document).on('click', '.astra-sites-popup .overlay, .astra-sites-result-preview .overlay', AstraSitesAdmin._close_popup_by_overlay);
409
+
410
+ $(document).on('click', '.ast-sites__filter-wrap-checkbox, .ast-sites__filter-wrap', AstraSitesAdmin._filterClick);
411
+
412
+ // Page.
413
+ $(document).on('click', '.site-import-layout-button', AstraSitesAdmin.show_page_popup_from_sites);
414
+ $(document).on('click', '#astra-sites .astra-sites-previewing-page .theme-screenshot, #astra-sites .astra-sites-previewing-page .theme-name', AstraSitesAdmin.show_page_popup_from_search);
415
+ $(document).on('click', '.astra-sites-page-import-popup .site-install-site-button, .preview-page-from-search-result .site-install-site-button', AstraSitesAdmin.import_page_process);
416
+ $(document).on('astra-sites-after-site-pages-required-plugins', AstraSitesAdmin._page_api_call);
417
+
418
+ // Site reset warning.
419
+ $(document).on('click', '.astra-sites-reset-data .checkbox', AstraSitesAdmin._toggle_reset_notice);
420
+
421
+ // Theme Activation warning.
422
+ $(document).on('click', '.astra-sites-theme-activation .checkbox', AstraSitesAdmin._toggle_theme_notice);
423
+
424
+ $(document).on('wp-theme-install-success', AstraSitesAdmin._activateTheme);
425
+
426
+ // Site.
427
+ $(document).on('click', '.site-import-site-button', AstraSitesAdmin._show_site_popup);
428
+ $(document).on('click', '.astra-sites-get-agency-bundle-button', AstraSitesAdmin._show_get_agency_bundle_notice);
429
+ $(document).on('click', '.astra-sites-activate-license-button', AstraSitesAdmin._show_activate_license_notice);
430
+ $(document).on('click', '.astra-sites-invalid-mini-agency-license-button', AstraSitesAdmin._show_invalid_mini_agency_license);
431
+ $(document).on('click', '.astra-sites-site-import-popup .site-install-site-button', AstraSitesAdmin._resetData);
432
+
433
+ // Skip.
434
+ $(document).on('click', '.astra-sites-skip-and-import-step', AstraSitesAdmin._remove_skip_and_import_popup);
435
+
436
+ // Skip & Import.
437
+ $(document).on('astra-sites-after-astra-sites-required-plugins', AstraSitesAdmin._start_site_import);
438
+
439
+ $(document).on('astra-sites-reset-data', AstraSitesAdmin._backup_before_rest_options);
440
+ $(document).on('astra-sites-backup-settings-before-reset-done', AstraSitesAdmin._reset_customizer_data);
441
+ $(document).on('astra-sites-reset-customizer-data-done', AstraSitesAdmin._reset_site_options);
442
+ $(document).on('astra-sites-reset-site-options-done', AstraSitesAdmin._reset_widgets_data);
443
+ $(document).on('astra-sites-reset-widgets-data-done', AstraSitesAdmin._reset_terms);
444
+ $(document).on('astra-sites-delete-terms-done', AstraSitesAdmin._reset_wp_forms);
445
+ $(document).on('astra-sites-delete-wp-forms-done', AstraSitesAdmin._reset_posts);
446
+
447
+ $(document).on('astra-sites-reset-data-done', AstraSitesAdmin._recheck_backup_options);
448
+ $(document).on('astra-sites-backup-settings-done', AstraSitesAdmin._startImportCartFlows);
449
+ $(document).on('astra-sites-import-cartflows-done', AstraSitesAdmin._startImportWPForms);
450
+ $(document).on('astra-sites-import-wpforms-done', AstraSitesAdmin._importCustomizerSettings);
451
+ $(document).on('astra-sites-import-customizer-settings-done', AstraSitesAdmin._importXML);
452
+ $(document).on('astra-sites-import-xml-done', AstraSitesAdmin.import_siteOptions);
453
+ $(document).on('astra-sites-import-options-done', AstraSitesAdmin._importWidgets);
454
+ $(document).on('astra-sites-import-widgets-done', AstraSitesAdmin._importEnd);
455
+
456
+ // Try again.
457
+ $(document).on('click', '.ast-try-again', AstraSitesAdmin.tryAgain );
458
+
459
+ $(document).on('click', '.astra-sites__category-filter-anchor', AstraSitesAdmin._toggleFilter);
460
+
461
+ // Tooltip.
462
+ $(document).on('click', '.astra-sites-tooltip-icon', AstraSitesAdmin._toggle_tooltip);
463
+
464
+ // Plugin install & activate.
465
+ $(document).on('wp-plugin-installing', AstraSitesAdmin._pluginInstalling);
466
+ $(document).on('wp-plugin-install-error', AstraSitesAdmin._installError);
467
+ $(document).on('wp-plugin-install-success', AstraSitesAdmin._installSuccess);
468
+
469
+ $(document).on('click', '#astra-sites .astra-sites-previewing-site .theme-screenshot, #astra-sites .astra-sites-previewing-site .theme-name', AstraSitesAdmin._show_pages);
470
+ $(document).on('click', '#single-pages .site-single', AstraSitesAdmin._change_site_preview_screenshot);
471
+ $(document).on('click', '.astra-sites-show-favorite-button', AstraSitesAdmin._show_favorite);
472
+
473
+ $(document).on('click', '.favorite-action-wrap', AstraSitesAdmin._toggle_favorite);
474
+ $(document).on('click', '.astra-previewing-single-pages .back-to-layout', AstraSitesAdmin._go_back);
475
+ $(document).on('click', '.astra-sites-showing-favorites .back-to-layout, .astra-sites-no-search-result .back-to-layout, .logo, .astra-sites-back', AstraSitesAdmin._show_sites);
476
+
477
+ $(document).on('keydown', AstraSitesAdmin._next_and_previous_sites);
478
+
479
+ $(document).on('click', '.astra-sites-site-category a', AstraSitesAdmin._filterSites);
480
+
481
+ $(document).on('click', '.astra-sites-sync-library-button', AstraSitesAdmin._sync_library);
482
+ $(document).on('click', '.astra-sites-sync-library-message .notice-dismiss', AstraSitesAdmin._sync_library_complete);
483
+ $(document).on('click', '.page-builder-icon', AstraSitesAdmin._toggle_page_builder_list);
484
+ $(document).on('click', '.showing-page-builders #wpbody-content', AstraSitesAdmin._close_page_builder_list);
485
+ $(document).on('keyup input', '#wp-filter-search-input', AstraSitesAdmin._search);
486
+ $(document).on('keyup', '#wp-filter-search-input', _.debounce(AstraSitesAdmin._searchPost, 1500));
487
+ $(document).on('heartbeat-send', AstraSitesAdmin._sendHeartbeat);
488
+ $(document).on('heartbeat-tick', AstraSitesAdmin._heartbeatDone);
489
+ $(document).on('click', '.ui-autocomplete .ui-menu-item', AstraSitesAdmin._show_search_term);
490
+
491
+ $(document).on('click', '.button-subscription-submit', AstraSitesAdmin._subscribe);
492
+ $(document).on('click', '.button-subscription-skip', AstraSitesAdmin._hide_subscription_popup);
493
+ $(document).on('focusout change', '.subscription-input', AstraSitesAdmin.validate_single_field);
494
+ $(document).on('click input', '.subscription-input', AstraSitesAdmin._animate_fields);
495
+ $(document).on('click', '.astra-sites-advanced-options-heading', AstraSitesAdmin.toggle_advanced);
496
+
497
+ $(window).on('scroll', AstraSitesAdmin._stick_header);
498
+ $(document).on('wp-collapse-menu', AstraSitesAdmin._manage_wp_collapse_menu);
499
+ $(document).on('astra-sites-added-pages', AstraSitesAdmin._stick_header);
500
+ $(document).on('astra-sites-added-pages', AstraSitesAdmin._manage_wp_collapse_menu);
501
+
502
+ },
503
+
504
+ /**
505
+ * Try again for import
506
+ * @param {*} event
507
+ */
508
+ tryAgain: function( event ) {
509
+ event.preventDefault();
510
+ AstraSitesAdmin.delay_in_request = true;
511
+ $( '.site-import-site-button' ).trigger( 'click' );
512
+ },
513
+
514
+ /**
515
+ * Stick Header
516
+ */
517
+ _stick_header: function () {
518
+ if ($(window).outerWidth() > 768 && $(window).scrollTop() > AstraSitesAdmin.header_stick_after) {
519
+ AstraSitesAdmin.header.addClass('stick').stop().css({
520
+ 'top': AstraSitesAdmin.header_gutter,
521
+ 'margin-left': AstraSitesAdmin.wpcontent_left_margin,
522
+ });
523
+ } else {
524
+ AstraSitesAdmin.header.removeClass('stick').stop().css({
525
+ 'top': '',
526
+ });
527
+ }
528
+
529
+ },
530
+
531
+ /**
532
+ * Manage WP COllapse Menu
533
+ */
534
+ _manage_wp_collapse_menu: function (event, state) {
535
+
536
+ AstraSitesAdmin.wpcontent_left_margin = $('#wpcontent').css('margin-left');
537
+
538
+ if (AstraSitesAdmin.header.hasClass('stick')) {
539
+ AstraSitesAdmin.header.css('margin-left', AstraSitesAdmin.wpcontent_left_margin);
540
+ }
541
+
542
+ $('.single-site-footer').css('margin-left', AstraSitesAdmin.wpcontent_left_margin);
543
+ $('.single-site-pages-wrap').css('margin-right', AstraSitesAdmin.wpcontent_left_margin);
544
+
545
+ },
546
+
547
+ toggle_advanced: function (event) {
548
+ const elScope = $('.astra-sites-advanced-options-heading span')
549
+ if (elScope.hasClass('dashicons-arrow-right-alt2')) {
550
+ elScope.removeClass('dashicons-arrow-right-alt2').addClass('dashicons-arrow-down-alt2');
551
+ } else {
552
+ elScope.removeClass('dashicons-arrow-down-alt2').addClass('dashicons-arrow-right-alt2');
553
+ }
554
+ $('.astra-sites-advanced-options').toggle();
555
+ },
556
+
557
+ _animate_fields: function (event) {
558
+ event.preventDefault();
559
+ event.stopPropagation();
560
+ var parentWrapper = $(this).parents('.subscription-field-wrap');
561
+ parentWrapper.addClass('subscription-anim');
562
+ },
563
+
564
+ validate_single_field: function (event) {
565
+ event.preventDefault();
566
+ event.stopPropagation();
567
+ AstraSitesAdmin._validate_field(event.target);
568
+ },
569
+
570
+ _validate_field: function (target) {
571
+
572
+ var field = $(target);
573
+ var fieldValue = field.val() || '';
574
+ var parentWrapper = $(target).parents('.subscription-field-wrap');
575
+ var fieldStatus = fieldValue.length ? true : false;
576
+
577
+ if ((field.hasClass('subscription-input-email') && false === AstraSitesAdmin.isValidEmail(fieldValue))) {
578
+ fieldStatus = false;
579
+ }
580
+
581
+ if (fieldStatus) {
582
+ parentWrapper
583
+ .removeClass('subscription-error')
584
+ .addClass('subscription-success');
585
+
586
+ } else {
587
+ parentWrapper
588
+ .removeClass('subscription-success subscription-anim')
589
+ .addClass('subscription-error');
590
+
591
+ if (field.hasClass('subscription-input-email') && fieldValue.length) {
592
+ parentWrapper
593
+ .addClass('subscription-anim')
594
+ }
595
+ }
596
+
597
+ },
598
+
599
+ _hide_subscription_popup: function (event) {
600
+ $('.subscription-popup').hide();
601
+ $('.astra-sites-result-preview .default').show();
602
+
603
+ AstraSitesAdmin.subscribe_status = true;
604
+ AstraSitesAdmin.subscribe_skiped = true;
605
+
606
+ if ('astra-sites' === AstraSitesAdmin.action_slug) {
607
+ $('.ast-importing-wrap').show();
608
+ $('.astra-sites-result-preview').removeClass('astra-sites-subscription-popup');
609
+ $('.ast-actioms-wrap .button').hide();
610
+ $('.ast-actioms-wrap .site-install-site-button').show();
611
+ $('.ast-actioms-wrap .site-import-cancel').show();
612
+
613
+ $('.astra-sites-result-preview .heading h3').html(astraSitesVars.headings.site_import);
614
+
615
+ if (true === AstraSitesAdmin.site_import_status) {
616
+ AstraSitesAdmin.import_complete();
617
+ }
618
+ } else {
619
+ $('.astra-sites-result-preview .heading h3').html(astraSitesVars.headings.page_import);
620
+
621
+ if (true === AstraSitesAdmin.page_import_status) {
622
+ AstraSitesAdmin.page_import_complete();
623
+ }
624
+ }
625
+ if (event && event.target.classList.value == 'button-subscription-skip') {
626
+ astraSitesVars.subscribed = '';
627
+ AstraSitesAdmin.subscription_form_submitted = '';
628
+ } else {
629
+ astraSitesVars.subscribed = 'yes';
630
+ AstraSitesAdmin.subscription_form_submitted = 'yes';
631
+ }
632
+ },
633
+
634
+ _subscribe: function (event) {
635
+ event.preventDefault();
636
+
637
+ var submit_button = $(this);
638
+
639
+ if (submit_button.hasClass('submitting')) {
640
+ return;
641
+ }
642
+
643
+ var first_name_field = $('.subscription-input-name[name="first_name"]');
644
+ var email_field = $('.subscription-input-email[name="email"]');
645
+ var user_type_field = $('.subscription-input-wp-user-type[name="wp_user_type"]');
646
+ var build_for_field = $('.subscription-input-build-website-for[name="build_website_for"]');
647
+
648
+ var subscription_first_name = first_name_field.val() || '';
649
+ var subscription_email = email_field.val() || '';
650
+ var subscription_user_type = user_type_field.val() || '';
651
+ var subscription_build_for = build_for_field.val() || '';
652
+
653
+ AstraSitesAdmin._validate_field(first_name_field);
654
+ AstraSitesAdmin._validate_field(email_field);
655
+ if ($('#astra-sites-subscription-form-two').length) {
656
+ AstraSitesAdmin._validate_field(user_type_field);
657
+ AstraSitesAdmin._validate_field(build_for_field);
658
+ }
659
+
660
+ if ($('.subscription-field-wrap').hasClass('subscription-error')) {
661
+ return;
662
+ }
663
+
664
+ submit_button.addClass('submitting');
665
+
666
+ var subscription_fields = {
667
+ EMAIL: subscription_email,
668
+ FIRSTNAME: subscription_first_name,
669
+ PAGE_BUILDER: astraSitesVars.default_page_builder_data.name,
670
+ WP_USER_TYPE: subscription_user_type,
671
+ BUILD_WEBSITE_FOR: subscription_build_for,
672
+ };
673
+
674
+ $.ajax({
675
+ url: astraSitesVars.ajaxurl,
676
+ type: 'POST',
677
+ data: {
678
+ action: 'astra-sites-update-subscription',
679
+ _ajax_nonce: astraSitesVars._ajax_nonce,
680
+ data: JSON.stringify(subscription_fields),
681
+ },
682
+ beforeSend: function () {
683
+ console.groupCollapsed('Email Subscription');
684
+ },
685
+ })
686
+ .done(function (response) {
687
+ AstraSitesAdmin._log(response);
688
+
689
+ submit_button
690
+ .text(astraSitesVars.subscriptionSuccessMessage)
691
+ .removeClass('submitting')
692
+ .addClass('submitted')
693
+ .find('.dashicons')
694
+ .removeClass('dashicons-update')
695
+ .addClass('dashicons-yes')
696
+ setTimeout(function () {
697
+ AstraSitesAdmin._hide_subscription_popup();
698
+ }, 5000);
699
+ console.groupEnd();
700
+ });
701
+
702
+ },
703
+
704
+ isValidEmail: function (eMail) {
705
+ if (/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(eMail)) {
706
+ return true;
707
+ }
708
+
709
+ return false;
710
+ },
711
+
712
+ _heartbeatDone: function (e, data) {
713
+ // Check for our data, and use it.
714
+ if (!data['ast-sites-search-terms']) {
715
+ return;
716
+ }
717
+ AstraSitesAdmin.search_terms = [];
718
+ AstraSitesAdmin.search_terms_with_count = [];
719
+ },
720
+
721
+ _sendHeartbeat: function (e, data) {
722
+ // Add additional data to Heartbeat data.
723
+ if (AstraSitesAdmin.search_terms.length > 0) {
724
+ data['ast-sites-search-terms'] = AstraSitesAdmin.search_terms_with_count;
725
+ data['ast-sites-builder'] = astraSitesVars.default_page_builder;
726
+ }
727
+ },
728
+
729
+ _searchPost: function (e) {
730
+ var term = $(this).val().toLowerCase();
731
+ // Skip blank words and words smaller than 3 characters.
732
+ if ('' === term || term.length < 3 ) {
733
+ return;
734
+ }
735
+
736
+ if (!AstraSitesAdmin.search_terms.includes(term)) {
737
+ let count = $( '#astra-sites .ast-sites__search-wrap > div' ).length;
738
+ AstraSitesAdmin.search_terms.push(term);
739
+ AstraSitesAdmin.search_terms_with_count.push({'term': term, 'count': count });
740
+ }
741
+ },
742
+
743
+ _toggleFilter: function (e) {
744
+
745
+ var items = $('.astra-sites__category-filter-items');
746
+
747
+ if (items.hasClass('visible')) {
748
+ items.removeClass('visible');
749
+ items.hide();
750
+ } else {
751
+ items.addClass('visible');
752
+ items.show();
753
+ }
754
+ },
755
+
756
+ _closeFilter: function (e) {
757
+
758
+ var items = $('.astra-sites__category-filter-items');
759
+ items.removeClass('visible');
760
+ items.hide();
761
+ },
762
+
763
+ _filterClick: function (e) {
764
+
765
+ AstraSitesAdmin.filter_array = [];
766
+
767
+ if ($(this).hasClass('ast-sites__filter-wrap')) {
768
+ $('.astra-sites__category-filter-anchor').attr('data-slug', $(this).data('slug'));
769
+ $('.astra-sites__category-filter-items').find('.ast-sites__filter-wrap').removeClass('category-active');
770
+ $(this).addClass('category-active');
771
+ $('.astra-sites__category-filter-anchor').text($(this).text());
772
+ $('.astra-sites__category-filter-anchor').trigger('click');
773
+ $('#wp-filter-search-input').val('');
774
+
775
+ if ($('.astra-sites-show-favorite-button').hasClass('active')) {
776
+ $('.astra-sites-show-favorite-button').removeClass('active');
777
+ $('body').removeClass('astra-sites-showing-favorites');
778
+ AstraSitesAdmin._clean_url_params('favorites');
779
+ }
780
+ }
781
+
782
+ var $filter_name = $('.astra-sites__category-filter-anchor').attr('data-slug');
783
+
784
+ if ('' != $filter_name) {
785
+ AstraSitesAdmin.filter_array.push($filter_name);
786
+ }
787
+
788
+ if ($('.ast-sites__filter-wrap-checkbox input[name=ast-sites-radio]:checked').length) {
789
+ $('.ast-sites__filter-wrap-checkbox input[name=ast-sites-radio]').removeClass('active');
790
+ $('.ast-sites__filter-wrap-checkbox input[name=ast-sites-radio]:checked').addClass('active');
791
+ }
792
+ var $filter_type = $('.ast-sites__filter-wrap-checkbox input[name=ast-sites-radio]:checked').val();
793
+
794
+ if ('' != $filter_type) {
795
+ AstraSitesAdmin.filter_array.push($filter_type);
796
+ }
797
+
798
+ AstraSitesAdmin._closeFilter();
799
+ $('#wp-filter-search-input').trigger('keyup');
800
+ },
801
+
802
+ _show_search_term: function () {
803
+ var search_term = $(this).text() || '';
804
+ $('#wp-filter-search-input').val(search_term);
805
+ $('#wp-filter-search-input').trigger('keyup');
806
+ },
807
+
808
+ _search: function (event) {
809
+
810
+ var search_input = $('#wp-filter-search-input'),
811
+ search_term = $.trim(search_input.val()) || '';
812
+
813
+ if (13 === event.keyCode) {
814
+ $('.astra-sites-autocomplete-result .ui-autocomplete').hide();
815
+ $('.search-form').removeClass('searching');
816
+ $('#astra-sites-admin').removeClass('searching');
817
+ }
818
+
819
+ $('body').removeClass('astra-sites-no-search-result');
820
+
821
+ var searchTemplateFlag = false,
822
+ items = items;
823
+
824
+ AstraSitesAdmin.close_pages_popup();
825
+
826
+ if (search_term.length) {
827
+ search_input.addClass('has-input');
828
+ $('#astra-sites-admin').addClass('searching');
829
+ searchTemplateFlag = true;
830
+ } else {
831
+ search_input.removeClass('has-input');
832
+ $('#astra-sites-admin').removeClass('searching');
833
+ }
834
+
835
+ if( ! items ) {
836
+
837
+ var filter_category = $('.astra-sites__category-filter-anchor').attr('data-slug') || '';
838
+ var filter_type = $('.ast-sites__filter-wrap-checkbox input[name=ast-sites-radio]:checked').val() || '';
839
+
840
+ items = AstraSitesAdmin.get_sites_by_search_term(search_term, filter_type, filter_category);
841
+
842
+ AstraSitesAdmin.autocompleteTags = items.tags;
843
+ AstraSitesAdmin._autocomplete();
844
+ }
845
+
846
+ if ( ( Object.keys( items.pages ).length || Object.keys( items.sites ).length || Object.keys( items.related ).length ) && !AstraSitesAdmin.isEmpty(items)) {
847
+ if ( searchTemplateFlag) {
848
+ AstraSitesAdmin.add_sites_after_search(items);
849
+ } else {
850
+ if( items.sites ) {
851
+ items = Object.assign( items.sites, items.related );
852
+ }
853
+ AstraSitesAdmin.add_sites(items);
854
+ }
855
+ } else {
856
+ if (search_term.length) {
857
+ $('body').addClass('astra-sites-no-search-result');
858
+ }
859
+ $('#astra-sites').html(wp.template('astra-sites-no-sites'));
860
+ }
861
+ },
862
+
863
+ /**
864
+ * Change URL
865
+ */
866
+ _changeAndSetURL: function (url_params) {
867
+ var current_url = window.location.href;
868
+ var current_url_separator = (window.location.href.indexOf("?") === -1) ? "?" : "&";
869
+ var new_url = current_url + current_url_separator + decodeURIComponent($.param(url_params));
870
+ AstraSitesAdmin._changeURL(new_url);
871
+ },
872
+
873
+ /**
874
+ * Clean the URL.
875
+ *
876
+ * @param string url URL string.
877
+ * @return string Change the current URL.
878
+ */
879
+ _changeURL: function (url) {
880
+ History.pushState(null, astraSitesVars.whiteLabelName, url);
881
+ },
882
+
883
+ /**
884
+ * Get URL param.
885
+ */
886
+ _getParamFromURL: function (name, url) {
887
+ if (!url) url = window.location.href;
888
+ name = name.replace(/[\[\]]/g, "\\$&");
889
+ var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
890
+ results = regex.exec(url);
891
+ if (!results) return null;
892
+ if (!results[2]) return '';
893
+ return decodeURIComponent(results[2].replace(/\+/g, " "));
894
+ },
895
+
896
+ _clean_url_params: function (single_param) {
897
+ var url_params = AstraSitesAdmin._getQueryStrings();
898
+ delete url_params[single_param];
899
+ delete url_params['']; // Removed extra empty object.
900
+
901
+ var current_url = window.location.href;
902
+ var root_url = current_url.substr(0, current_url.indexOf('?'));
903
+ if ($.isEmptyObject(url_params)) {
904
+ var new_url = root_url + decodeURIComponent($.param(url_params));
905
+ } else {
906
+ var current_url_separator = (root_url.indexOf("?") === -1) ? "?" : "&";
907
+ var new_url = root_url + current_url_separator + decodeURIComponent($.param(url_params));
908
+ }
909
+
910
+ AstraSitesAdmin._changeURL(new_url);
911
+ },
912
+
913
+ /**
914
+ * Get query strings.
915
+ *
916
+ * @param string string Query string.
917
+ * @return string Check and return query string.
918
+ */
919
+ _getQueryStrings: function (string) {
920
+ return (string || document.location.search).replace(/(^\?)/, '').split("&").map(function (n) { return n = n.split("="), this[n[0]] = n[1], this }.bind({}))[0];
921
+ },
922
+
923
+ isEmpty: function (obj) {
924
+ for (var key in obj) {
925
+ if (obj.hasOwnProperty(key))
926
+ return false;
927
+ }
928
+ return true;
929
+ },
930
+
931
+ _unescape: function (input_string) {
932
+ var title = _.unescape(input_string);
933
+
934
+ // @todo check why below character not escape with function _.unescape();
935
+ title = title.replace('&#8211;', '-');
936
+ title = title.replace('&#8217;', "'");
937
+
938
+ return title;
939
+ },
940
+
941
+ _unescape_lower: function (input_string) {
942
+ var input_string = AstraSitesAdmin._unescape(input_string);
943
+ return input_string.toLowerCase();
944
+ },
945
+
946
+ get_sites_by_search_term: function (search_term, type, category, page_builder) {
947
+
948
+ search_term = search_term.toLowerCase();
949
+
950
+ let result = {
951
+ tags: [],
952
+ sites: {},
953
+ pages: {},
954
+ related: {},
955
+ related_categories: [],
956
+ };
957
+
958
+ /**
959
+ * Get all page builder sites.
960
+ */
961
+ let allSites = Object.assign( {}, astraSitesVars.default_page_builder_sites );
962
+ let sites = {};
963
+ if (page_builder) {
964
+ for (let site_id in allSites) {
965
+ if (allSites[site_id]['astra-site-page-builder'] === page_builder) {
966
+ sites[site_id] = allSites[site_id];
967
+ }
968
+ }
969
+ } else {
970
+ sites = allSites;
971
+ }
972
+
973
+ /**
974
+ * Filter sites by site type
975
+ */
976
+ let newSites = {};
977
+ if( type ) {
978
+ for (let site_id in sites) {
979
+ if (sites[site_id]['astra-sites-type'] === type) {
980
+ newSites[site_id] = sites[site_id];
981
+ }
982
+ }
983
+
984
+ sites = newSites;
985
+ }
986
+
987
+
988
+ /**
989
+ * Filter sites by site category
990
+ */
991
+ newSites = {};
992
+ if( category ) {
993
+ for (let site_id in sites) {
994
+ console.log( sites[site_id]['categories'] );
995
+ if ( Object.values( sites[site_id]['categories'] ).includes( category ) ) {
996
+ newSites[site_id] = sites[site_id];
997
+ }
998
+ }
999
+
1000
+ sites = newSites;
1001
+ }
1002
+
1003
+ /**
1004
+ * Find in sites.
1005
+ *
1006
+ * Add site in tags.
1007
+ * Add site in sites list.
1008
+ */
1009
+ for (let site_id in sites) {
1010
+ let site = sites[site_id];
1011
+
1012
+ /**
1013
+ * Sites
1014
+ */
1015
+ if (site.title.toLowerCase().includes(search_term)) {
1016
+
1017
+ /**
1018
+ * Add site title in tag.
1019
+ */
1020
+ if( ! result.tags.includes( site.title ) ) {
1021
+ result.tags.push(site.title);
1022
+ }
1023
+
1024
+ /**
1025
+ * Add found sites.
1026
+ */
1027
+ result.sites[site_id] = site;
1028
+
1029
+ /**
1030
+ * Add related categories
1031
+ */
1032
+ Object.values(site.categories).map(site_category=>{
1033
+ if (!result.related_categories.includes(site_category)) {
1034
+ result.related_categories.push(site_category);
1035
+ }
1036
+ } );
1037
+
1038
+ }
1039
+
1040
+ /**
1041
+ * Pages
1042
+ */
1043
+ if (Object.keys(site.pages).length) {
1044
+ let pages = site.pages;
1045
+ for (page_id in pages) {
1046
+ if (pages[page_id].title.toLowerCase().includes(search_term)) {
1047
+
1048
+ /**
1049
+ * Add page
1050
+ */
1051
+ result.pages[page_id] = pages[page_id];
1052
+
1053
+ /**
1054
+ * Add tag
1055
+ */
1056
+ if( ! result.tags.includes( pages[page_id].title ) ) {
1057
+ result.tags.push(pages[page_id].title);
1058
+ }
1059
+ }
1060
+ }
1061
+ }
1062
+
1063
+ }
1064
+
1065
+ /**
1066
+ * Add additionals.
1067
+ */
1068
+
1069
+ /**
1070
+ * Filter original tags.
1071
+ */
1072
+ astraSitesVars.all_site_categories_and_tags.map(cat=>{
1073
+ if (cat.name.toLowerCase().includes(search_term)) {
1074
+
1075
+ /**
1076
+ * Add tag in tags list.
1077
+ */
1078
+ result.tags.push(cat.name);
1079
+
1080
+ /**
1081
+ * Add parent tag sites into the related list.
1082
+ */
1083
+ if( astraSitesVars.all_site_categories.length ) {
1084
+ let parent_cat_id = cat.id.toString();
1085
+ if (parent_cat_id.includes('-')) {
1086
+ parent_cat_id = cat.id.split('-')[0];
1087
+ }
1088
+
1089
+ astraSitesVars.all_site_categories.map( site_cat => {
1090
+ if( parent_cat_id == site_cat.id ) {
1091
+ if( ! result.related_categories.includes( site_cat.slug ) ) {
1092
+ result.related_categories.push( site_cat.slug );
1093
+ }
1094
+
1095
+ }
1096
+ });
1097
+ }
1098
+
1099
+
1100
+ }
1101
+ }
1102
+ );
1103
+
1104
+ /**
1105
+ * Related Sites.
1106
+ */
1107
+ for (let site_id in sites) {
1108
+ let site = sites[site_id];
1109
+ Object.values(site.categories).map(site_category=>{
1110
+ if (!result.sites[site_id] && result.related_categories.includes(site_category)) {
1111
+
1112
+ result.related[site_id] = site;
1113
+ }
1114
+ }
1115
+ );
1116
+ }
1117
+
1118
+ /**
1119
+ * Limit tags.
1120
+ */
1121
+ if( result.tags ) {
1122
+ result.tags = result.tags.slice(0, 10);
1123
+ }
1124
+
1125
+ console.log( result );
1126
+
1127
+ return result;
1128
+ },
1129
+
1130
+ _close_page_builder_list: function (event) {
1131
+ event.preventDefault();
1132
+ $('body').removeClass('showing-page-builders');
1133
+ $('.page-builder-icon').removeClass('active');
1134
+ },
1135
+
1136
+ _toggle_page_builder_list: function (event) {
1137
+ event.preventDefault();
1138
+ $(this).toggleClass('active');
1139
+ $('body').toggleClass('showing-page-builders');
1140
+ },
1141
+
1142
+ _sync_library_complete: function () {
1143
+ $.ajax({
1144
+ url: astraSitesVars.ajaxurl,
1145
+ type: 'POST',
1146
+ data: {
1147
+ action: 'astra-sites-update-library-complete',
1148
+ },
1149
+ }).done(function (response) {
1150
+ AstraSitesAdmin._log(response);
1151
+ console.groupEnd('Update Library Request');
1152
+ $('.astra-sites-sync-library-message').remove();
1153
+ });
1154
+ },
1155
+
1156
+ _sync_library_with_ajax: function (is_append) {
1157
+
1158
+ $.ajax({
1159
+ url: astraSitesVars.ajaxurl,
1160
+ type: 'POST',
1161
+ data: {
1162
+ action: 'astra-sites-get-sites-request-count',
1163
+ },
1164
+ beforeSend: function () {
1165
+ console.groupCollapsed('Sync Library');
1166
+ AstraSitesAdmin._log('Sync Library..');
1167
+ },
1168
+ })
1169
+ .fail(function (jqXHR) {
1170
+ AstraSitesAdmin._log(jqXHR, 'error');
1171
+ AstraSitesAdmin._importFailMessage(jqXHR.status + jqXHR.statusText, 'Site Count Request Failed!', jqXHR);
1172
+ console.groupEnd('Sync Library');
1173
+ })
1174
+ .done(function (response) {
1175
+ AstraSitesAdmin._log(response);
1176
+ if (response.success) {
1177
+ var total = response.data;
1178
+
1179
+ AstraSitesAdmin._log(total);
1180
+
1181
+ for (let i = 1; i <= total; i++) {
1182
+
1183
+ AstraSitesAjaxQueue.add({
1184
+ url: astraSitesVars.ajaxurl,
1185
+ type: 'POST',
1186
+ data: {
1187
+ action: 'astra-sites-import-sites',
1188
+ page_no: i,
1189
+ },
1190
+ success: function (result) {
1191
+ AstraSitesAdmin._log(result);
1192
+
1193
+ if (is_append) {
1194
+ if (!AstraSitesAdmin.isEmpty(result.data)) {
1195
+
1196
+ var template = wp.template('astra-sites-page-builder-sites');
1197
+
1198
+ // First fill the placeholders and then append remaining sites.
1199
+ if ($('.placeholder-site').length) {
1200
+ for (site_id in result.data) {
1201
+ if ($('.placeholder-site').length) {
1202
+ $('.placeholder-site').first().remove();
1203
+ }
1204
+ }
1205
+ if ($('#astra-sites .site-single:not(.placeholder-site)').length) {
1206
+ $('#astra-sites .site-single:not(.placeholder-site)').last().after(template(result.data));
1207
+ } else {
1208
+ $('#astra-sites').prepend(template(result.data));
1209
+ }
1210
+ } else {
1211
+ $('#astra-sites').append(template(result.data));
1212
+ }
1213
+
1214
+ astraSitesVars.default_page_builder_sites = $.extend({}, astraSitesVars.default_page_builder_sites, result.data);
1215
+
1216
+ AstraSitesAdmin._load_large_images();
1217
+ $(document).trigger('astra-sites-added-pages');
1218
+ }
1219
+
1220
+ }
1221
+
1222
+ if (i === total && astraSitesVars.strings.syncCompleteMessage) {
1223
+ console.groupEnd('Sync Library');
1224
+ $('#wpbody-content').find('.astra-sites-sync-library-message').remove();
1225
+ var noticeContent = wp.updates.adminNotice({
1226
+ className: 'notice astra-sites-notice notice-success is-dismissible astra-sites-sync-library-message',
1227
+ message: astraSitesVars.strings.syncCompleteMessage + ' <button type="button" class="notice-dismiss"><span class="screen-reader-text">' + astraSitesVars.dismiss + '</span></button>',
1228
+ });
1229
+ $('#astra-sites-admin').before(noticeContent);
1230
+ $(document).trigger('wp-updates-notice-added');
1231
+
1232
+ $('.astra-sites-sync-library-button').removeClass('updating-message');
1233
+ }
1234
+ }
1235
+ });
1236
+ }
1237
+
1238
+ // Run the AJAX queue.
1239
+ AstraSitesAjaxQueue.run();
1240
+ } else {
1241
+ AstraSitesAdmin._importFailMessage(response.data, 'Site Count Request Failed!');
1242
+ }
1243
+ });
1244
+
1245
+ // Import all categories and tags.
1246
+ $.ajax({
1247
+ url: astraSitesVars.ajaxurl,
1248
+ type: 'POST',
1249
+ data: {
1250
+ action: 'astra-sites-import-all-categories-and-tags',
1251
+ },
1252
+ beforeSend: function () {
1253
+ console.groupCollapsed('Importing Site Categories and Tags');
1254
+ AstraSitesAdmin._log('Importing Site Categories and Tags..');
1255
+ },
1256
+ })
1257
+ .fail(function (jqXHR) {
1258
+ AstraSitesAdmin._log(jqXHR);
1259
+ AstraSitesAdmin._importFailMessage(jqXHR.status + jqXHR.statusText, 'Site Category Import Failed!', jqXHR);
1260
+ console.groupEnd('Importing Site Categories and Tags');
1261
+ }).done(function (response) {
1262
+ AstraSitesAdmin._log(response);
1263
+ console.groupEnd('Importing Site Categories and Tags');
1264
+ });
1265
+
1266
+ // Import all categories.
1267
+ $.ajax({
1268
+ url: astraSitesVars.ajaxurl,
1269
+ type: 'POST',
1270
+ data: {
1271
+ action: 'astra-sites-import-all-categories',
1272
+ },
1273
+ beforeSend: function () {
1274
+ console.groupCollapsed('Importing Site Categories');
1275
+ AstraSitesAdmin._log('Importing Site Categories..');
1276
+ },
1277
+ })
1278
+ .fail(function (jqXHR) {
1279
+ AstraSitesAdmin._log(jqXHR);
1280
+ AstraSitesAdmin._importFailMessage(jqXHR.status + jqXHR.statusText, 'Site Category Import Failed!', jqXHR);
1281
+ console.groupEnd('Importing Site Categories');
1282
+ }).done(function (response) {
1283
+ AstraSitesAdmin._log(response);
1284
+ console.groupEnd('Importing Site Categories');
1285
+ });
1286
+
1287
+ // Import page builders.
1288
+ $.ajax({
1289
+ url: astraSitesVars.ajaxurl,
1290
+ type: 'POST',
1291
+ data: {
1292
+ action: 'astra-sites-import-page-builders',
1293
+ },
1294
+ beforeSend: function () {
1295
+ console.groupCollapsed('Importing Page Builders');
1296
+ AstraSitesAdmin._log('Importing Page Builders..');
1297
+ },
1298
+ })
1299
+ .fail(function (jqXHR) {
1300
+ AstraSitesAdmin._log(jqXHR);
1301
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Page Builder Import Failed!', jqXHR);
1302
+ console.groupEnd('Importing Page Builders');
1303
+ }).done(function (response) {
1304
+ AstraSitesAdmin._log(response);
1305
+ console.groupEnd('Importing Page Builders');
1306
+ });
1307
+
1308
+ // Import Blocks.
1309
+ $.ajax({
1310
+ url: astraSitesVars.ajaxurl,
1311
+ type: 'POST',
1312
+ data: {
1313
+ action: 'astra-sites-get-blocks-request-count',
1314
+ },
1315
+ beforeSend: function () {
1316
+ console.groupCollapsed('Updating Blocks');
1317
+ AstraSitesAdmin._log('Updating Blocks');
1318
+ },
1319
+ })
1320
+ .fail(function (jqXHR) {
1321
+ AstraSitesAdmin._log(jqXHR, 'error');
1322
+ AstraSitesAdmin._importFailMessage(jqXHR.status + jqXHR.statusText, 'Blocks Count Request Failed!', jqXHR);
1323
+ console.groupEnd('Updating Blocks');
1324
+ })
1325
+ .done(function (response) {
1326
+ AstraSitesAdmin._log(response);
1327
+ if (response.success) {
1328
+ var total = response.data;
1329
+
1330
+ AstraSitesAdmin._log(total);
1331
+
1332
+ for (let i = 1; i <= total; i++) {
1333
+ AstraSitesAjaxQueue.add({
1334
+ url: astraSitesVars.ajaxurl,
1335
+ type: 'POST',
1336
+ data: {
1337
+ action: 'astra-sites-import-blocks',
1338
+ page_no: i,
1339
+ },
1340
+ beforeSend: function () {
1341
+ console.groupCollapsed('Importing Blocks - Page ' + i);
1342
+ AstraSitesAdmin._log('Importing Blocks - Page ' + i);
1343
+ },
1344
+ success: function (response) {
1345
+ AstraSitesAdmin._log(response);
1346
+ console.groupEnd('Importing Blocks - Page ' + i);
1347
+ }
1348
+ });
1349
+ }
1350
+
1351
+ // Run the AJAX queue.
1352
+ AstraSitesAjaxQueue.run();
1353
+ } else {
1354
+ AstraSitesAdmin._importFailMessage(response.data, 'Blocks Count Request Failed!');
1355
+ }
1356
+ });
1357
+
1358
+ // Import Block Categories.
1359
+ $.ajax({
1360
+ url: astraSitesVars.ajaxurl,
1361
+ type: 'POST',
1362
+ data: {
1363
+ action: 'astra-sites-import-block-categories',
1364
+ },
1365
+ beforeSend: function () {
1366
+ console.groupCollapsed('Importing Block Categories');
1367
+ AstraSitesAdmin._log('Importing Block Categories..');
1368
+ },
1369
+ })
1370
+ .fail(function (jqXHR) {
1371
+ AstraSitesAdmin._log(jqXHR);
1372
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Category Import Failed!', jqXHR);
1373
+ console.groupEnd('Importing Block Categories');
1374
+ }).done(function (response) {
1375
+ AstraSitesAdmin._log(response);
1376
+ console.groupEnd('Importing Block Categories');
1377
+ });
1378
+
1379
+ AstraSitesAdmin._sync_library_complete();
1380
+ },
1381
+
1382
+ _sync_library: function (event) {
1383
+ event.preventDefault();
1384
+ var button = $(this);
1385
+
1386
+ if (button.hasClass('updating-message')) {
1387
+ return;
1388
+ }
1389
+
1390
+ button.addClass('updating-message');
1391
+
1392
+ $('.astra-sites-sync-library-message').remove();
1393
+
1394
+ var noticeContent = wp.updates.adminNotice({
1395
+ className: 'astra-sites-sync-library-message astra-sites-notice notice notice-info',
1396
+ message: astraSitesVars.syncLibraryStart + '<button type="button" class="notice-dismiss"><span class="screen-reader-text">' + astraSitesVars.dismiss + '</span></button>',
1397
+ });
1398
+ $('#astra-sites-admin').before(noticeContent);
1399
+
1400
+ $(document).trigger('wp-updates-notice-added');
1401
+
1402
+ $.ajax({
1403
+ url: astraSitesVars.ajaxurl,
1404
+ type: 'POST',
1405
+ data: {
1406
+ action: 'astra-sites-update-library',
1407
+ },
1408
+ beforeSend: function () {
1409
+ console.groupCollapsed('Update Library Request');
1410
+ AstraSitesAdmin._log('Updating Library..');
1411
+ },
1412
+ })
1413
+ .fail(function (jqXHR) {
1414
+ AstraSitesAdmin._log(jqXHR);
1415
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Sync Library Failed!', jqXHR);
1416
+ console.groupEnd('Update Library Request');
1417
+ })
1418
+ .done(function (response) {
1419
+ console.log(response);
1420
+
1421
+ if (response.success) {
1422
+ if ('updated' === response.data) {
1423
+
1424
+ $('#wpbody-content').find('.astra-sites-sync-library-message').remove();
1425
+ var noticeContent = wp.updates.adminNotice({
1426
+ className: 'notice astra-sites-notice notice-success is-dismissible astra-sites-sync-library-message',
1427
+ message: astraSitesVars.strings.syncCompleteMessage + ' <button type="button" class="notice-dismiss"><span class="screen-reader-text">' + astraSitesVars.dismiss + '</span></button>',
1428
+ });
1429
+ $('#astra-sites-admin').before(noticeContent);
1430
+ $(document).trigger('wp-updates-notice-added');
1431
+ button.removeClass('updating-message');
1432
+ AstraSitesAdmin._log('Already sync all the sites.');
1433
+ console.groupEnd('Update Library Request');
1434
+ } else {
1435
+ AstraSitesAdmin._sync_library_with_ajax();
1436
+ }
1437
+ } else {
1438
+ $('#wpbody-content').find('.astra-sites-sync-library-message').remove();
1439
+ var noticeContent = wp.updates.adminNotice({
1440
+ className: 'notice astra-sites-notice notice-error is-dismissible astra-sites-sync-library-message',
1441
+ message: response.data + ' <button type="button" class="notice-dismiss"><span class="screen-reader-text">' + astraSitesVars.dismiss + '</span></button>',
1442
+ });
1443
+ $('#astra-sites-admin').before(noticeContent);
1444
+ $(document).trigger('wp-updates-notice-added');
1445
+ button.removeClass('updating-message');
1446
+ AstraSitesAdmin._log('Already sync all the sites.');
1447
+ console.groupEnd('Update Library Request');
1448
+ }
1449
+ });
1450
+ },
1451
+
1452
+ _filterSites: function (event) {
1453
+ event.preventDefault();
1454
+ var current_class = $(this).attr('data-group') || '';
1455
+ $(this).parents('.filter-links').find('a').removeClass('current');
1456
+ $(this).addClass('current');
1457
+
1458
+ var search_term = $(this).text() || '';
1459
+
1460
+ if (current_class) {
1461
+ if ($('#astra-sites .astra-theme.' + current_class).length) {
1462
+ $('#wp-filter-search-input').val(search_term);
1463
+
1464
+ // $('#astra-sites .astra-theme').removeClass('astra-show-site astra-hide-site');
1465
+ $('#astra-sites .astra-theme').addClass('astra-hide-site');
1466
+ $('#astra-sites .astra-theme.' + current_class).removeClass('astra-hide-site').addClass('astra-show-site');
1467
+ }
1468
+ } else {
1469
+ $('#astra-sites .astra-theme').removeClass('astra-hide-site').addClass('astra-show-site');
1470
+ }
1471
+
1472
+ $('.filters-wrap-page-categories').removeClass('show');
1473
+ },
1474
+
1475
+ _next_and_previous_sites: function (e) {
1476
+
1477
+ if (!$('body').hasClass('astra-previewing-single-pages')) {
1478
+ return;
1479
+ }
1480
+
1481
+ if (e.key === "Escape") {
1482
+ AstraSitesAdmin.close_pages_popup();
1483
+ return;
1484
+ }
1485
+
1486
+ switch (e.which) {
1487
+
1488
+ // Left Key Pressed
1489
+ case 37:
1490
+ if ($('#astra-sites .astra-theme.current').prev().length) {
1491
+ $('#astra-sites .astra-theme.current').prev().addClass('current').siblings().removeClass('current');
1492
+ var site_id = $('#astra-sites .astra-theme.current').prev().attr('data-site-id') || '';
1493
+ if (site_id) {
1494
+ AstraSitesAdmin.show_pages_by_site_id(site_id);
1495
+ }
1496
+ }
1497
+ break;
1498
+
1499
+ // Right Key Pressed
1500
+ case 39:
1501
+ if ($('#astra-sites .astra-theme.current').next().length) {
1502
+ $('#astra-sites .astra-theme.current').next().addClass('current').siblings().removeClass('current');
1503
+ var site_id = $('#astra-sites .astra-theme.current').next().attr('data-site-id') || '';
1504
+ if (site_id) {
1505
+ AstraSitesAdmin.show_pages_by_site_id(site_id);
1506
+ }
1507
+ }
1508
+ break;
1509
+ }
1510
+
1511
+ },
1512
+
1513
+ show_pages_by_site_id: function (site_id, page_id) {
1514
+
1515
+ var sites = astraSitesVars.default_page_builder_sites || [];
1516
+
1517
+ var data = sites[site_id];
1518
+
1519
+ if ('undefined' !== typeof data) {
1520
+ var site_template = wp.template('astra-sites-single-site-preview');
1521
+
1522
+ if (!AstraSitesAdmin._getParamFromURL('astra-site')) {
1523
+ var url_params = {
1524
+ 'astra-site': site_id,
1525
+ };
1526
+ AstraSitesAdmin._changeAndSetURL(url_params);
1527
+ }
1528
+
1529
+ $('#astra-sites').hide();
1530
+ $('#site-pages').show().html(site_template(data)).removeClass('brizy elementor beaver-builder gutenberg').addClass(astraSitesVars.default_page_builder);
1531
+
1532
+ $('body').addClass('astra-previewing-single-pages');
1533
+ $('#site-pages').attr('data-site-id', site_id);
1534
+
1535
+ if (AstraSitesAdmin._getParamFromURL('astra-page')) {
1536
+ AstraSitesAdmin._set_preview_screenshot_by_page($('#single-pages .site-single[data-page-id="' + AstraSitesAdmin._getParamFromURL('astra-page') + '"]'));
1537
+ // Has first item?
1538
+ // Then set default screnshot in preview.
1539
+ } else if (page_id && $('#single-pages .site-single[data-page-id="' + page_id + '"]').length) {
1540
+ AstraSitesAdmin._set_preview_screenshot_by_page($('#single-pages .site-single[data-page-id="' + page_id + '"]'));
1541
+ } else if ($('#single-pages .site-single').eq(0).length) {
1542
+ AstraSitesAdmin._set_preview_screenshot_by_page($('#single-pages .site-single').eq(0));
1543
+ }
1544
+
1545
+ if (!$('#single-pages .site-single').eq(0).length) {
1546
+ $('.site-import-layout-button').hide();
1547
+ }
1548
+
1549
+ $(document).trigger('astra-sites-added-pages');
1550
+
1551
+ AstraSitesAdmin._load_large_images();
1552
+ }
1553
+
1554
+ },
1555
+
1556
+ _show_sites: function (event) {
1557
+
1558
+ event.preventDefault();
1559
+
1560
+ $('.astra-sites-show-favorite-button').removeClass('active');
1561
+ $('body').removeClass('astra-sites-showing-favorites');
1562
+ $('body').removeClass('astra-sites-no-search-result');
1563
+ $('.astra-sites__category-filter-items').find('.ast-sites__filter-wrap').removeClass('category-active');
1564
+ $('.ast-sites__filter-wrap').first().addClass('category-active');
1565
+ $('.astra-sites__category-filter-anchor').attr('data-slug', '');
1566
+ AstraSitesAdmin.filter_array = [];
1567
+ $('.ast-sites__filter-wrap-checkbox input:radio').attr('checked', false);
1568
+ $('.ast-sites__filter-wrap-checkbox input:radio').removeClass('active');
1569
+ $('#radio-all').trigger('click');
1570
+ $('#radio-all').addClass('active');
1571
+ $('.astra-sites__category-filter-anchor').text('All');
1572
+ AstraSitesAdmin._closeFilter();
1573
+ $('#wp-filter-search-input').val('');
1574
+ $('#astra-sites-admin').removeClass('searching');
1575
+ AstraSitesAdmin.add_sites(astraSitesVars.default_page_builder_sites);
1576
+ AstraSitesAdmin.close_pages_popup();
1577
+
1578
+ AstraSitesAdmin._clean_url_params('favorites');
1579
+
1580
+ AstraSitesAdmin._load_large_images();
1581
+ },
1582
+
1583
+ /**
1584
+ * Go back to all sites view
1585
+ *
1586
+ * @since 2.0.0
1587
+ * @return null
1588
+ */
1589
+ _go_back: function (event) {
1590
+
1591
+ event.preventDefault();
1592
+
1593
+ AstraSitesAdmin._clean_url_params('search');
1594
+ AstraSitesAdmin._clean_url_params('favorites');
1595
+ AstraSitesAdmin._clean_url_params('license');
1596
+ AstraSitesAdmin.close_pages_popup();
1597
+ AstraSitesAdmin._load_large_images();
1598
+ },
1599
+
1600
+ close_pages_popup: function () {
1601
+ astraSitesVars.cpt_slug = 'astra-sites';
1602
+
1603
+ $('#astra-sites').show();
1604
+ $('#site-pages').hide().html('');
1605
+ $('body').removeClass('astra-previewing-single-pages');
1606
+ $('.astra-sites-result-preview').hide();
1607
+
1608
+ $('#astra-sites .astra-theme').removeClass('current');
1609
+
1610
+ AstraSitesAdmin._clean_url_params('astra-site');
1611
+ AstraSitesAdmin._clean_url_params('astra-page');
1612
+ AstraSitesAdmin._clean_url_params('license');
1613
+ },
1614
+
1615
+
1616
+ _toggle_favorite: function (event) {
1617
+
1618
+ let is_favorite = $(this).data('favorite');
1619
+ let parent = $(this).parents('.astra-theme');
1620
+ let site_id = parent.data('site-id').toString();
1621
+ let new_array = Array();
1622
+
1623
+ parent.toggleClass('is-favorite');
1624
+ $(this).data('favorite', !is_favorite);
1625
+
1626
+ if (!is_favorite) {
1627
+ // Add.
1628
+ for (value in astraSitesVars.favorite_data) {
1629
+ new_array.push(astraSitesVars.favorite_data[value]);
1630
+ }
1631
+ new_array.push(site_id);
1632
+ } else {
1633
+ // Remove.
1634
+ for (value in astraSitesVars.favorite_data) {
1635
+ if (site_id != astraSitesVars.favorite_data[value].toString()) {
1636
+ new_array.push(astraSitesVars.favorite_data[value]);
1637
+ }
1638
+ }
1639
+ }
1640
+ astraSitesVars.favorite_data = new_array;
1641
+
1642
+ // If in favorites preview window and unfavorite the item?
1643
+ if ($('body').hasClass('astra-sites-showing-favorites') && !parent.hasClass('is-favorite')) {
1644
+
1645
+ // Then remove the favorite item from markup.
1646
+ parent.remove();
1647
+
1648
+ // Show Empty Favorite message if there is not item in favorite.
1649
+ if (!$('#astra-sites .astra-theme').length) {
1650
+ $('#astra-sites').html(wp.template('astra-sites-no-favorites'));
1651
+ }
1652
+ }
1653
+
1654
+ $.ajax({
1655
+ url: astraSitesVars.ajaxurl,
1656
+ type: 'POST',
1657
+ dataType: 'json',
1658
+ data: {
1659
+ action: 'astra-sites-favorite',
1660
+ is_favorite: !is_favorite,
1661
+ site_id: site_id
1662
+ },
1663
+ beforeSend: function () {
1664
+ console.groupCollapsed('Toggle Favorite');
1665
+ AstraSitesAdmin._log(!is_favorite);
1666
+ },
1667
+ })
1668
+ .fail(function (jqXHR) {
1669
+ AstraSitesAdmin._log(jqXHR);
1670
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Favorite/Unfavorite Failed!', jqXHR);
1671
+ console.groupEnd();
1672
+ })
1673
+ .done(function (response) {
1674
+ AstraSitesAdmin._log(response);
1675
+ console.groupEnd();
1676
+ });
1677
+ },
1678
+
1679
+
1680
+ _show_favorite: function (event) {
1681
+
1682
+ if (event) {
1683
+ event.preventDefault();
1684
+ }
1685
+
1686
+ AstraSitesAdmin.close_pages_popup();
1687
+
1688
+ $('.astra-sites__category-filter-items').find('.ast-sites__filter-wrap').removeClass('category-active');
1689
+ $('.ast-sites__filter-wrap').first().addClass('category-active');
1690
+ $('.astra-sites__category-filter-anchor').attr('data-slug', '');
1691
+ AstraSitesAdmin.filter_array = [];
1692
+ $('.ast-sites__filter-wrap-checkbox input:radio').attr('checked', false);
1693
+ $('.ast-sites__filter-wrap-checkbox input:radio').removeClass('active');
1694
+ $('#radio-all').trigger('click');
1695
+ $('#radio-all').addClass('active');
1696
+ $('.astra-sites__category-filter-anchor').text('All');
1697
+ $('#wp-filter-search-input').val('');
1698
+
1699
+ if ($('.astra-sites-show-favorite-button').hasClass('active')) {
1700
+ $('.astra-sites-show-favorite-button').removeClass('active');
1701
+ $('body').removeClass('astra-sites-showing-favorites');
1702
+ AstraSitesAdmin.add_sites(astraSitesVars.default_page_builder_sites);
1703
+ AstraSitesAdmin._clean_url_params('favorites');
1704
+ } else {
1705
+ AstraSitesAdmin._clean_url_params('search');
1706
+ AstraSitesAdmin._clean_url_params('astra-site');
1707
+ AstraSitesAdmin._clean_url_params('astra-page');
1708
+ AstraSitesAdmin._clean_url_params('license');
1709
+ AstraSitesAdmin.close_pages_popup();
1710
+
1711
+ if (!AstraSitesAdmin._getParamFromURL('favorites')) {
1712
+ var url_params = {
1713
+ 'favorites': 'show'
1714
+ };
1715
+ AstraSitesAdmin._changeAndSetURL(url_params);
1716
+ }
1717
+
1718
+ $('.astra-sites-show-favorite-button').addClass('active');
1719
+ $('body').addClass('astra-sites-showing-favorites');
1720
+ var items = [];
1721
+ for (favorite_id in astraSitesVars.favorite_data) {
1722
+ var exist_data = astraSitesVars.default_page_builder_sites[astraSitesVars.favorite_data[favorite_id].toString()] || {};
1723
+ if (!$.isEmptyObject(exist_data)) {
1724
+ items[astraSitesVars.favorite_data[favorite_id].toString()] = exist_data;
1725
+ }
1726
+ }
1727
+
1728
+ if (!AstraSitesAdmin.isEmpty(items)) {
1729
+ AstraSitesAdmin.add_sites(items);
1730
+ $(document).trigger('astra-sites-added-sites');
1731
+
1732
+ } else {
1733
+ $('#astra-sites').html(wp.template('astra-sites-no-favorites'));
1734
+ }
1735
+ }
1736
+
1737
+ },
1738
+
1739
+ _set_preview_screenshot_by_page: function (element) {
1740
+ var large_img_url = $(element).find('.theme-screenshot').attr('data-featured-src') || '';
1741
+ var url = $(element).find('.theme-screenshot').attr('data-src') || '';
1742
+ var page_name = $(element).find('.theme-name').text() || '';
1743
+
1744
+ $(element).siblings().removeClass('current_page');
1745
+ $(element).addClass('current_page');
1746
+
1747
+ var page_id = $(element).attr('data-page-id') || '';
1748
+ if (page_id) {
1749
+
1750
+ AstraSitesAdmin._clean_url_params('astra-page');
1751
+
1752
+ var url_params = {
1753
+ 'astra-page': page_id,
1754
+ };
1755
+ AstraSitesAdmin._changeAndSetURL(url_params);
1756
+ }
1757
+
1758
+ $('.site-import-layout-button').removeClass('disabled');
1759
+ if (page_name) {
1760
+ var title = astraSitesVars.strings.importSingleTemplate.replace('%s', page_name.trim());
1761
+ $('.site-import-layout-button').text(title);
1762
+ }
1763
+
1764
+ if (url) {
1765
+ $('.single-site-preview').animate({
1766
+ scrollTop: 0
1767
+ }, 0);
1768
+ $('.single-site-preview img').addClass('loading').attr('src', url);
1769
+ var imgLarge = new Image();
1770
+ imgLarge.src = large_img_url;
1771
+ imgLarge.onload = function () {
1772
+ $('.single-site-preview img').removeClass('loading');
1773
+ $('.single-site-preview img').attr('src', imgLarge.src);
1774
+ };
1775
+ }
1776
+ },
1777
+
1778
+ /**
1779
+ * Preview Inner Pages for the Site
1780
+ *
1781
+ * @since 2.0.0
1782
+ * @return null
1783
+ */
1784
+ _change_site_preview_screenshot: function (event) {
1785
+ event.preventDefault();
1786
+
1787
+ var item = $(this);
1788
+
1789
+ AstraSitesAdmin._set_preview_screenshot_by_page(item);
1790
+ },
1791
+
1792
+ _show_pages: function (event) {
1793
+
1794
+ var perent = $(this).parents('.astra-theme');
1795
+ perent.siblings().removeClass('current');
1796
+ perent.addClass('current');
1797
+
1798
+ var site_id = perent.attr('data-site-id') || '';
1799
+ AstraSitesAdmin.show_pages_by_site_id(site_id);
1800
+ },
1801
+
1802
+ _show_default_page_builder_sites: function () {
1803
+
1804
+ if (!$('#astra-sites').length) {
1805
+ return;
1806
+ }
1807
+
1808
+ if (Object.keys(astraSitesVars.default_page_builder_sites).length) {
1809
+ var favorites = AstraSitesAdmin._getParamFromURL('favorites');
1810
+ var search_term = AstraSitesAdmin._getParamFromURL('search');
1811
+ if (search_term) {
1812
+ // var items = AstraSitesAdmin._get_sites_and_pages_by_search_term(search_term);
1813
+ var data = AstraSitesAdmin.get_sites_by_search_term(search_term);
1814
+
1815
+ AstraSitesAdmin.autocompleteTags = data.tags;
1816
+ AstraSitesAdmin._autocomplete();
1817
+
1818
+ if (!AstraSitesAdmin.isEmpty(data.sites) || !AstraSitesAdmin.isEmpty(data.related)) {
1819
+ AstraSitesAdmin.add_sites(data);
1820
+ $('#wp-filter-search-input').val(search_term);
1821
+ } else {
1822
+ $('#astra-sites').html(astraSitesVars.default_page_builder_sites);
1823
+ }
1824
+
1825
+ } else if (favorites) {
1826
+ AstraSitesAdmin._show_favorite();
1827
+ } else {
1828
+ AstraSitesAdmin.add_sites(astraSitesVars.default_page_builder_sites);
1829
+ }
1830
+
1831
+ // Show single site preview.
1832
+ var site_id = AstraSitesAdmin._getParamFromURL('astra-site');
1833
+
1834
+ if (site_id) {
1835
+ AstraSitesAdmin.show_pages_by_site_id(site_id);
1836
+ }
1837
+ } else {
1838
+
1839
+ var temp = [];
1840
+ for (var i = 0; i < 8; i++) {
1841
+ temp['id-' + i] = {
1842
+ 'title': 'Lorem Ipsum',
1843
+ 'class': 'placeholder-site',
1844
+ };
1845
+ }
1846
+
1847
+ AstraSitesAdmin.add_sites(temp);
1848
+ $('#astra-sites').addClass('temp');
1849
+
1850
+ AstraSitesAdmin._sync_library_with_ajax(true);
1851
+ }
1852
+
1853
+ var show_license = AstraSitesAdmin._getParamFromURL('license');
1854
+ if (show_license) {
1855
+ AstraSitesAdmin._show_activate_license_notice();
1856
+ }
1857
+ },
1858
+
1859
+ _change_page_builder: function () {
1860
+ var page_builder = $(this).attr('data-page-builder') || '';
1861
+
1862
+ $(this).parents('.page-builders').find('img').removeClass('active');
1863
+ $(this).find('img').addClass('active');
1864
+
1865
+ $.ajax({
1866
+ url: astraSitesVars.ajaxurl,
1867
+ type: 'POST',
1868
+ data: {
1869
+ action: 'astra-sites-change-page-builder',
1870
+ page_builder: page_builder,
1871
+ },
1872
+ beforeSend: function () {
1873
+ console.groupCollapsed('Change Page Builder');
1874
+ AstraSitesAdmin._log('Change Page Builder..');
1875
+ },
1876
+ })
1877
+ .done(function (response) {
1878
+ AstraSitesAdmin._log(response);
1879
+ AstraSitesAdmin._clean_url_params('astra-site');
1880
+ AstraSitesAdmin._clean_url_params('astra-page');
1881
+ AstraSitesAdmin._clean_url_params('change-page-builder');
1882
+ AstraSitesAdmin._clean_url_params('license');
1883
+ console.groupEnd();
1884
+ location.reload();
1885
+ });
1886
+ },
1887
+
1888
+ _ajax_change_page_builder: function () {
1889
+
1890
+ var page_builder_slug = $(this).attr('data-page-builder') || '';
1891
+ var page_builder_img = $(this).find('img').attr('src') || '';
1892
+ var page_builder_title = $(this).find('.title').text() || '';
1893
+ if (page_builder_img) {
1894
+ $('.selected-page-builder').find('img').attr('src', page_builder_img);
1895
+ }
1896
+ if (page_builder_title) {
1897
+ $('.selected-page-builder').find('.page-builder-title').text(page_builder_title);
1898
+ }
1899
+
1900
+ $('#wp-filter-search-input').val('');
1901
+ $('#astra-sites-admin').removeClass('searching');
1902
+ $('body').removeClass('astra-previewing-single-pages');
1903
+
1904
+ if ($('.page-builders [data-page-builder="' + page_builder_slug + '"]').length) {
1905
+ $('.page-builders [data-page-builder="' + page_builder_slug + '"]').siblings().removeClass('active');
1906
+ $('.page-builders [data-page-builder="' + page_builder_slug + '"]').addClass('active');
1907
+ }
1908
+
1909
+ if (page_builder_slug) {
1910
+
1911
+ AstraSitesAdmin._clean_url_params('astra-site');
1912
+ AstraSitesAdmin._clean_url_params('astra-page');
1913
+ AstraSitesAdmin._clean_url_params('license');
1914
+
1915
+ $('#astra-sites').show();
1916
+ $('#site-pages').hide();
1917
+
1918
+ $.ajax({
1919
+ url: astraSitesVars.ajaxurl,
1920
+ type: 'POST',
1921
+ data: {
1922
+ action: 'astra-sites-change-page-builder',
1923
+ page_builder: page_builder_slug,
1924
+ },
1925
+ beforeSend: function () {
1926
+ console.groupCollapsed('Change Page Builder');
1927
+ AstraSitesAdmin._log('Change Page Builder..');
1928
+ },
1929
+ })
1930
+ .done(function (response) {
1931
+ AstraSitesAdmin._log(response);
1932
+ console.groupEnd();
1933
+ if (response.success) {
1934
+ $('.astra-sites__category-filter-items').find('.ast-sites__filter-wrap').removeClass('category-active');
1935
+ $('.ast-sites__filter-wrap').first().addClass('category-active');
1936
+ $('.astra-sites__category-filter-anchor').attr('data-slug', '');
1937
+ AstraSitesAdmin.filter_array = [];
1938
+ $('.ast-sites__filter-wrap-checkbox input:radio').attr('checked', false);
1939
+ $('.ast-sites__filter-wrap-checkbox input:radio').removeClass('active');
1940
+ $('#radio-all').trigger('click');
1941
+ $('#radio-all').addClass('active');
1942
+ $('.astra-sites__category-filter-anchor').text('All');
1943
+ AstraSitesAdmin._closeFilter();
1944
+
1945
+ astraSitesVars.default_page_builder = page_builder_slug;
1946
+
1947
+ // Set changed page builder data as a default page builder object.
1948
+ astraSitesVars.default_page_builder_sites = response.data;
1949
+ $('.astra-sites-show-favorite-button').removeClass('active');
1950
+ AstraSitesAdmin.add_sites(response.data);
1951
+
1952
+ AstraSitesAdmin._autocomplete();
1953
+ AstraSitesAdmin.quick_corner_cta_link = astraSitesVars.cta_quick_corner_links[ page_builder_slug ];
1954
+ AstraSitesAdmin.premium_popup_cta_link = astraSitesVars.cta_premium_popup_links[ page_builder_slug ];
1955
+ AstraSitesAdmin.default_cta_link = astraSitesVars.cta_links[ page_builder_slug ];
1956
+ $(document).trigger('astra-sites-change-page-builder', page_builder_slug, response.data, response);
1957
+ }
1958
+ });
1959
+
1960
+ }
1961
+ },
1962
+
1963
+ add_sites_after_search: function (data) {
1964
+ var template = wp.template('new-astra-sites-page-builder-sites-search');
1965
+ $('#astra-sites').html(template(data));
1966
+ AstraSitesAdmin._load_large_images();
1967
+ $(document).trigger('astra-sites-added-sites');
1968
+ },
1969
+
1970
+ add_sites: function (data) {
1971
+ var template = wp.template('astra-sites-page-builder-sites');
1972
+
1973
+ $('#astra-sites').html(template(data));
1974
+ AstraSitesAdmin._load_large_images();
1975
+ $(document).trigger('astra-sites-added-sites');
1976
+ },
1977
+
1978
+ _toggle_tooltip: function (event) {
1979
+ event.preventDefault();
1980
+ var tip_id = $(this).data('tip-id') || '';
1981
+ if (tip_id && $('#' + tip_id).length) {
1982
+ $('#' + tip_id).toggle();
1983
+ }
1984
+ },
1985
+
1986
+ _resetData: function () {
1987
+
1988
+ if ($(this).hasClass('updating-message')) {
1989
+ return;
1990
+ }
1991
+ if (AstraSitesAdmin.subscribe_skiped || AstraSitesAdmin.subscription_form_submitted == 'yes') {
1992
+ $('.user-building-for-title').hide();
1993
+ $('.astra-sites-advanced-options').show();
1994
+ $('.astra-sites-advanced-options-heading').hide();
1995
+ $('#astra-sites-subscription-form-one').hide();
1996
+ }
1997
+ if (false === AstraSitesAdmin.subscribe_skiped && $('.subscription-enabled').length && AstraSitesAdmin.subscription_form_submitted !== 'yes') {
1998
+ AstraSitesAdmin._validate_field($('.subscription-input-wp-user-type'));
1999
+ AstraSitesAdmin._validate_field($('.subscription-input-build-website-for'));
2000
+
2001
+ if ($('.subscription-field-wrap').hasClass('subscription-error')) {
2002
+ console.log('error');
2003
+ return;
2004
+ }
2005
+ }
2006
+
2007
+ $('.site-import-cancel').show();
2008
+
2009
+ $('.install-theme-info').hide();
2010
+
2011
+ if (false === AstraSitesAdmin.subscribe_skiped && $('.subscription-enabled').length && AstraSitesAdmin.subscription_form_submitted !== 'yes') {
2012
+ $('.subscription-popup').show();
2013
+ $('.astra-sites-result-preview .default').hide();
2014
+ } else {
2015
+ AstraSitesAdmin.subscribe_status = true;
2016
+ $('.ast-importing-wrap').show();
2017
+ }
2018
+
2019
+ AstraSitesAdmin.import_start_time = new Date();
2020
+
2021
+ $(this).addClass('updating-message installing').text('Importing..');
2022
+ $('body').addClass('importing-site');
2023
+
2024
+ var output = '<div class="current-importing-status-title"></div><div class="current-importing-status-description"></div>';
2025
+ $('.current-importing-status').html(output);
2026
+
2027
+ // Process Theme Activate and Install Process
2028
+ if ($('.astra-sites-theme-activation .checkbox').is(':checked')) {
2029
+ var status = $('.astra-sites-theme-activation .checkbox').data('status')
2030
+ AstraSitesAdmin._installAstra(status);
2031
+ }
2032
+
2033
+ $.ajax({
2034
+ url: astraSitesVars.ajaxurl,
2035
+ type: 'POST',
2036
+ data: {
2037
+ action: 'astra-sites-set-reset-data',
2038
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2039
+ },
2040
+ beforeSend: function () {
2041
+ console.groupCollapsed('Site Reset Data');
2042
+ },
2043
+ })
2044
+ .done(function (response) {
2045
+ console.log('List of Reset Items:');
2046
+ AstraSitesAdmin._log(response);
2047
+ console.groupEnd();
2048
+ if (response.success) {
2049
+ AstraSitesAdmin.site_imported_data = response.data;
2050
+
2051
+ // Process Bulk Plugin Install & Activate.
2052
+ AstraSitesAdmin._bulkPluginInstallActivate();
2053
+ }
2054
+ });
2055
+
2056
+ },
2057
+
2058
+ _remove_skip_and_import_popup: function (event) {
2059
+ event.preventDefault();
2060
+
2061
+ $(this).parents('.skip-and-import').addClass('hide-me visited');
2062
+
2063
+ if ($('.skip-and-import.hide-me').not('.visited').length) {
2064
+ $('.skip-and-import.hide-me').not('.visited').first().removeClass('hide-me');
2065
+ } else {
2066
+ $('.astra-sites-result-preview .default').removeClass('hide-me');
2067
+
2068
+ if ($('.astra-sites-result-preview').hasClass('import-page')) {
2069
+
2070
+ AstraSitesAdmin.skip_and_import_popups = [];
2071
+
2072
+ var notinstalled = AstraSitesAdmin.required_plugins.notinstalled || 0;
2073
+ if (!notinstalled.length) {
2074
+ AstraSitesAdmin.import_page_process();
2075
+ }
2076
+ }
2077
+ }
2078
+ },
2079
+
2080
+ _start_site_import: function () {
2081
+
2082
+ if (AstraSitesAdmin._is_reset_data()) {
2083
+ $(document).trigger('astra-sites-reset-data');
2084
+ } else {
2085
+ $(document).trigger('astra-sites-reset-data-done');
2086
+ }
2087
+ },
2088
+
2089
+ _reset_customizer_data: function () {
2090
+ $.ajax({
2091
+ url: astraSitesVars.ajaxurl,
2092
+ type: 'POST',
2093
+ data: {
2094
+ action: 'astra-sites-reset-customizer-data',
2095
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2096
+ },
2097
+ beforeSend: function () {
2098
+ console.groupCollapsed('Reseting Customizer Data');
2099
+ AstraSitesAdmin._log_title('Reseting Customizer Data..');
2100
+ },
2101
+ })
2102
+ .fail(function (jqXHR) {
2103
+ AstraSitesAdmin._log(jqXHR);
2104
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Reset Customizer Settings Failed!', jqXHR);
2105
+ console.groupEnd();
2106
+ })
2107
+ .done(function (data) {
2108
+ AstraSitesAdmin._log(data);
2109
+ AstraSitesAdmin._log_title('Complete Resetting Customizer Data..');
2110
+ AstraSitesAdmin._log('Complete Resetting Customizer Data..');
2111
+ console.groupEnd();
2112
+ $(document).trigger('astra-sites-reset-customizer-data-done');
2113
+ });
2114
+ },
2115
+
2116
+ _reset_site_options: function () {
2117
+ // Site Options.
2118
+ $.ajax({
2119
+ url: astraSitesVars.ajaxurl,
2120
+ type: 'POST',
2121
+ data: {
2122
+ action: 'astra-sites-reset-site-options',
2123
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2124
+ },
2125
+ beforeSend: function () {
2126
+ console.groupCollapsed('Reseting Site Options');
2127
+ AstraSitesAdmin._log_title('Reseting Site Options..');
2128
+ },
2129
+ })
2130
+ .fail(function (jqXHR) {
2131
+ AstraSitesAdmin._log(jqXHR);
2132
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Reset Site Options Failed!', jqXHR);
2133
+ console.groupEnd();
2134
+ })
2135
+ .done(function (data) {
2136
+ AstraSitesAdmin._log(data);
2137
+ AstraSitesAdmin._log_title('Complete Reseting Site Options..');
2138
+ console.groupEnd();
2139
+ $(document).trigger('astra-sites-reset-site-options-done');
2140
+ });
2141
+ },
2142
+
2143
+ _reset_widgets_data: function () {
2144
+ // Widgets.
2145
+ $.ajax({
2146
+ url: astraSitesVars.ajaxurl,
2147
+ type: 'POST',
2148
+ data: {
2149
+ action: 'astra-sites-reset-widgets-data',
2150
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2151
+ },
2152
+ beforeSend: function () {
2153
+ console.groupCollapsed('Reseting Widgets');
2154
+ AstraSitesAdmin._log_title('Reseting Widgets..');
2155
+ },
2156
+ })
2157
+ .fail(function (jqXHR) {
2158
+ AstraSitesAdmin._log(jqXHR);
2159
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Reset Widgets Data Failed!', jqXHR);
2160
+ console.groupEnd();
2161
+ })
2162
+ .done(function (data) {
2163
+ AstraSitesAdmin._log(data);
2164
+ AstraSitesAdmin._log_title('Complete Reseting Widgets..');
2165
+ console.groupEnd();
2166
+ $(document).trigger('astra-sites-reset-widgets-data-done');
2167
+ });
2168
+ },
2169
+
2170
+ _reset_posts: function () {
2171
+ if (AstraSitesAdmin.site_imported_data['reset_posts'].length) {
2172
+
2173
+ AstraSitesAdmin.reset_remaining_posts = AstraSitesAdmin.site_imported_data['reset_posts'].length;
2174
+
2175
+ console.groupCollapsed('Deleting Posts');
2176
+ AstraSitesAdmin._log_title('Deleting Posts..');
2177
+
2178
+ $.each(AstraSitesAdmin.site_imported_data['reset_posts'], function (index, post_id) {
2179
+
2180
+ AstraSitesAjaxQueue.add({
2181
+ url: astraSitesVars.ajaxurl,
2182
+ type: 'POST',
2183
+ data: {
2184
+ action: 'astra-sites-delete-posts',
2185
+ post_id: post_id,
2186
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2187
+ },
2188
+ success: function (result) {
2189
+
2190
+ if (AstraSitesAdmin.reset_processed_posts < AstraSitesAdmin.site_imported_data['reset_posts'].length) {
2191
+ AstraSitesAdmin.reset_processed_posts += 1;
2192
+ }
2193
+
2194
+ AstraSitesAdmin._log_title('Deleting Post ' + AstraSitesAdmin.reset_processed_posts + ' of ' + AstraSitesAdmin.site_imported_data['reset_posts'].length + '<br/>' + result.data);
2195
+
2196
+ AstraSitesAdmin.reset_remaining_posts -= 1;
2197
+ if (0 == AstraSitesAdmin.reset_remaining_posts) {
2198
+ console.groupEnd();
2199
+ $(document).trigger('astra-sites-delete-posts-done');
2200
+ $(document).trigger('astra-sites-reset-data-done');
2201
+ }
2202
+ }
2203
+ });
2204
+ });
2205
+ AstraSitesAjaxQueue.run();
2206
+
2207
+ } else {
2208
+ $(document).trigger('astra-sites-delete-posts-done');
2209
+ $(document).trigger('astra-sites-reset-data-done');
2210
+ }
2211
+ },
2212
+
2213
+ _reset_wp_forms: function () {
2214
+ if (AstraSitesAdmin.site_imported_data['reset_wp_forms'].length) {
2215
+ AstraSitesAdmin.reset_remaining_wp_forms = AstraSitesAdmin.site_imported_data['reset_wp_forms'].length;
2216
+
2217
+ console.groupCollapsed('Deleting WP Forms');
2218
+ AstraSitesAdmin._log_title('Deleting WP Forms..');
2219
+
2220
+ $.each(AstraSitesAdmin.site_imported_data['reset_wp_forms'], function (index, post_id) {
2221
+ AstraSitesAjaxQueue.add({
2222
+ url: astraSitesVars.ajaxurl,
2223
+ type: 'POST',
2224
+ data: {
2225
+ action: 'astra-sites-delete-wp-forms',
2226
+ post_id: post_id,
2227
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2228
+ },
2229
+ success: function (result) {
2230
+
2231
+ if (AstraSitesAdmin.reset_processed_wp_forms < AstraSitesAdmin.site_imported_data['reset_wp_forms'].length) {
2232
+ AstraSitesAdmin.reset_processed_wp_forms += 1;
2233
+ }
2234
+
2235
+ AstraSitesAdmin._log_title('Deleting Form ' + AstraSitesAdmin.reset_processed_wp_forms + ' of ' + AstraSitesAdmin.site_imported_data['reset_wp_forms'].length + '<br/>' + result.data);
2236
+ AstraSitesAdmin._log('Deleting Form ' + AstraSitesAdmin.reset_processed_wp_forms + ' of ' + AstraSitesAdmin.site_imported_data['reset_wp_forms'].length + '<br/>' + result.data);
2237
+
2238
+ AstraSitesAdmin.reset_remaining_wp_forms -= 1;
2239
+ if (0 == AstraSitesAdmin.reset_remaining_wp_forms) {
2240
+ console.groupEnd();
2241
+ $(document).trigger('astra-sites-delete-wp-forms-done');
2242
+ }
2243
+ }
2244
+ });
2245
+ });
2246
+ AstraSitesAjaxQueue.run();
2247
+
2248
+ } else {
2249
+ $(document).trigger('astra-sites-delete-wp-forms-done');
2250
+ }
2251
+ },
2252
+
2253
+ _reset_terms: function () {
2254
+
2255
+ if (AstraSitesAdmin.site_imported_data['reset_terms'].length) {
2256
+ AstraSitesAdmin.reset_remaining_terms = AstraSitesAdmin.site_imported_data['reset_terms'].length;
2257
+
2258
+ console.groupCollapsed('Deleting Terms');
2259
+ AstraSitesAdmin._log_title('Deleting Terms..');
2260
+
2261
+ $.each(AstraSitesAdmin.site_imported_data['reset_terms'], function (index, term_id) {
2262
+ AstraSitesAjaxQueue.add({
2263
+ url: astraSitesVars.ajaxurl,
2264
+ type: 'POST',
2265
+ data: {
2266
+ action: 'astra-sites-delete-terms',
2267
+ term_id: term_id,
2268
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2269
+ },
2270
+ success: function (result) {
2271
+ if (AstraSitesAdmin.reset_processed_terms < AstraSitesAdmin.site_imported_data['reset_terms'].length) {
2272
+ AstraSitesAdmin.reset_processed_terms += 1;
2273
+ }
2274
+
2275
+ AstraSitesAdmin._log_title('Deleting Term ' + AstraSitesAdmin.reset_processed_terms + ' of ' + AstraSitesAdmin.site_imported_data['reset_terms'].length + '<br/>' + result.data);
2276
+ AstraSitesAdmin._log('Deleting Term ' + AstraSitesAdmin.reset_processed_terms + ' of ' + AstraSitesAdmin.site_imported_data['reset_terms'].length + '<br/>' + result.data);
2277
+
2278
+ AstraSitesAdmin.reset_remaining_terms -= 1;
2279
+ if (0 == AstraSitesAdmin.reset_remaining_terms) {
2280
+ console.groupEnd();
2281
+ $(document).trigger('astra-sites-delete-terms-done');
2282
+ }
2283
+ }
2284
+ });
2285
+ });
2286
+ AstraSitesAjaxQueue.run();
2287
+ } else {
2288
+ $(document).trigger('astra-sites-delete-terms-done');
2289
+ }
2290
+
2291
+ },
2292
+
2293
+ _toggle_reset_notice: function () {
2294
+ if ($(this).is(':checked')) {
2295
+ $('#astra-sites-tooltip-reset-data').show();
2296
+ } else {
2297
+ $('#astra-sites-tooltip-reset-data').hide();
2298
+ }
2299
+ },
2300
+
2301
+ _toggle_theme_notice: function () {
2302
+ var astra_dependent_plugins = ['astra-addon'];
2303
+
2304
+ if (AstraSitesAdmin.isEmpty(AstraSitesAdmin.required_plugins_original_list)) {
2305
+ AstraSitesAdmin.required_plugins_original_list = astraSitesVars.requiredPlugins;
2306
+ }
2307
+
2308
+ var plugins = AstraSitesAdmin.required_plugins_original_list;
2309
+
2310
+ $(this).parents('.astra-site-contents').addClass('required-plugins-count-' + $('.astra-sites-import-plugins .required-plugins-list > li').length);
2311
+
2312
+ if ($(this).is(':checked')) {
2313
+
2314
+ $('#astra-sites-tooltip-theme-activation').hide();
2315
+ $('.astra-site-contents .astra-theme-module').show();
2316
+ $(this).parents('.astra-site-contents').removeClass('dont-use-astra-theme');
2317
+
2318
+ astraSitesVars.requiredPlugins = plugins;
2319
+
2320
+ } else {
2321
+ $(this).parents('.astra-site-contents').addClass('dont-use-astra-theme');
2322
+ $('#astra-sites-tooltip-theme-activation').show();
2323
+ $('.astra-site-contents .astra-theme-module').hide();
2324
+
2325
+ var new_plugins = [];
2326
+ for (plugin_group in plugins) {
2327
+ var temp = [];
2328
+ for (key in plugins[plugin_group]) {
2329
+ if (!astra_dependent_plugins.includes(plugins[plugin_group][key].slug)) {
2330
+ temp.push(plugins[plugin_group][key]);
2331
+ }
2332
+ }
2333
+ new_plugins[plugin_group] = temp;
2334
+ }
2335
+
2336
+ astraSitesVars.requiredPlugins = new_plugins;
2337
+ }
2338
+ },
2339
+
2340
+ _backup_before_rest_options: function () {
2341
+ AstraSitesAdmin._backupOptions('astra-sites-backup-settings-before-reset-done');
2342
+ AstraSitesAdmin.backup_taken = true;
2343
+ },
2344
+
2345
+ _recheck_backup_options: function () {
2346
+ AstraSitesAdmin._backupOptions('astra-sites-backup-settings-done');
2347
+ AstraSitesAdmin.backup_taken = true;
2348
+ },
2349
+
2350
+ _backupOptions: function (trigger_name) {
2351
+
2352
+ // Customizer backup is already taken then return.
2353
+ if (AstraSitesAdmin.backup_taken) {
2354
+ $(document).trigger(trigger_name);
2355
+ } else {
2356
+
2357
+ $.ajax({
2358
+ url: astraSitesVars.ajaxurl,
2359
+ type: 'POST',
2360
+ data: {
2361
+ action: 'astra-sites-backup-settings',
2362
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2363
+ },
2364
+ beforeSend: function () {
2365
+ console.groupCollapsed('Processing Customizer Settings Backup');
2366
+ AstraSitesAdmin._log_title('Processing Customizer Settings Backup..');
2367
+ },
2368
+ })
2369
+ .fail(function (jqXHR) {
2370
+ AstraSitesAdmin._log(jqXHR);
2371
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Backup Customizer Settings Failed!', jqXHR);
2372
+ console.groupEnd();
2373
+ })
2374
+ .done(function (data) {
2375
+ AstraSitesAdmin._log(data);
2376
+
2377
+ // 1. Pass - Import Customizer Options.
2378
+ AstraSitesAdmin._log_title('Customizer Settings Backup Done..');
2379
+
2380
+ console.groupEnd();
2381
+ // Custom trigger.
2382
+ $(document).trigger(trigger_name);
2383
+ });
2384
+ }
2385
+
2386
+ },
2387
+
2388
+ /**
2389
+ * 5. Import Complete.
2390
+ */
2391
+ _importEnd: function (event) {
2392
+
2393
+ $.ajax({
2394
+ url: astraSitesVars.ajaxurl,
2395
+ type: 'POST',
2396
+ dataType: 'json',
2397
+ data: {
2398
+ action: 'astra-sites-import-end',
2399
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2400
+ },
2401
+ beforeSend: function () {
2402
+ console.groupCollapsed('Import Complete!');
2403
+ AstraSitesAdmin._log_title('Import Complete!');
2404
+ }
2405
+ })
2406
+ .fail(function (jqXHR) {
2407
+ AstraSitesAdmin._log(jqXHR);
2408
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Import Complete Failed!', jqXHR);
2409
+ console.groupEnd();
2410
+ })
2411
+ .done(function (response) {
2412
+ AstraSitesAdmin._log(response);
2413
+ console.groupEnd();
2414
+
2415
+ // 5. Fail - Import Complete.
2416
+ if (false === response.success) {
2417
+ AstraSitesAdmin._importFailMessage(response.data, 'Import Complete Failed!');
2418
+ } else {
2419
+ AstraSitesAdmin.site_import_status = true;
2420
+ AstraSitesAdmin.import_complete();
2421
+ }
2422
+ });
2423
+ },
2424
+
2425
+ page_import_complete: function () {
2426
+ if (false === AstraSitesAdmin.subscribe_status) {
2427
+ return;
2428
+ }
2429
+
2430
+ $('body').removeClass('importing-site');
2431
+ $('.rotating, .current-importing-status-wrap,.notice-warning').remove();
2432
+ var template = wp.template('astra-sites-page-import-success');
2433
+ $('.astra-sites-result-preview .inner').html(template(AstraSitesAdmin.imported_page_data));
2434
+
2435
+ AstraSitesAdmin.page_import_status = false;
2436
+ AstraSitesAdmin.subscribe_status = false;
2437
+ },
2438
+
2439
+ import_complete: function () {
2440
+
2441
+ if (false === AstraSitesAdmin.subscribe_status) {
2442
+ return;
2443
+ }
2444
+
2445
+ $('body').removeClass('importing-site');
2446
+
2447
+ var template = wp.template('astra-sites-site-import-success');
2448
+ $('.astra-sites-result-preview .inner').html(template());
2449
+
2450
+ $('.rotating,.current-importing-status-wrap,.notice-warning').remove();
2451
+ $('.astra-sites-result-preview').addClass('astra-sites-result-preview');
2452
+
2453
+ // 5. Pass - Import Complete.
2454
+ AstraSitesAdmin._importSuccessButton();
2455
+
2456
+ AstraSitesAdmin.site_import_status = false;
2457
+ AstraSitesAdmin.subscribe_status = false;
2458
+ if (!AstraSitesAdmin.first_import_complete) {
2459
+ AstraSitesAdmin.first_import_complete = 'yes';
2460
+ }
2461
+ },
2462
+
2463
+ /**
2464
+ * 4. Import Widgets.
2465
+ */
2466
+ _importWidgets: function (event) {
2467
+ if (AstraSitesAdmin._is_process_widgets()) {
2468
+ $.ajax({
2469
+ url: astraSitesVars.ajaxurl,
2470
+ type: 'POST',
2471
+ dataType: 'json',
2472
+ data: {
2473
+ action: 'astra-sites-import-widgets',
2474
+ widgets_data: AstraSitesAdmin.widgets_data,
2475
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2476
+ },
2477
+ beforeSend: function () {
2478
+ console.groupCollapsed('Importing Widgets');
2479
+ AstraSitesAdmin._log_title('Importing Widgets..');
2480
+ },
2481
+ })
2482
+ .fail(function (jqXHR) {
2483
+ AstraSitesAdmin._log(jqXHR);
2484
+ AstraSitesAdmin._failed( jqXHR.status + ' ' + jqXHR.statusText, 'Import Widgets Failed!' );
2485
+ console.groupEnd();
2486
+ })
2487
+ .done(function (response) {
2488
+ AstraSitesAdmin._log(response);
2489
+ console.groupEnd();
2490
+
2491
+ // 4. Fail - Import Widgets.
2492
+ if (false === response.success) {
2493
+ AstraSitesAdmin._failed( response.data, 'Import Widgets Failed!' );
2494
+ } else {
2495
+
2496
+ // 4. Pass - Import Widgets.
2497
+ $(document).trigger('astra-sites-import-widgets-done');
2498
+ }
2499
+ });
2500
+ } else {
2501
+ $(document).trigger('astra-sites-import-widgets-done');
2502
+ }
2503
+ },
2504
+
2505
+ /**
2506
+ * 3. Import Site Options.
2507
+ */
2508
+ import_siteOptions: function (event) {
2509
+
2510
+ if (AstraSitesAdmin._is_process_xml()) {
2511
+ $.ajax({
2512
+ url: astraSitesVars.ajaxurl,
2513
+ type: 'POST',
2514
+ dataType: 'json',
2515
+ data: {
2516
+ action: 'astra-sites-import-options',
2517
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2518
+ },
2519
+ beforeSend: function () {
2520
+ console.groupCollapsed('Importing Options');
2521
+ AstraSitesAdmin._log_title('Importing Options..');
2522
+ $('.astra-demo-import .percent').html('');
2523
+ },
2524
+ })
2525
+ .fail(function (jqXHR) {
2526
+ AstraSitesAdmin._log(jqXHR);
2527
+ AstraSitesAdmin._failed( jqXHR.status + ' ' + jqXHR.statusText, 'Import Site Options Failed!' );
2528
+ console.groupEnd();
2529
+ })
2530
+ .done(function (response) {
2531
+ AstraSitesAdmin._log(response);
2532
+ // 3. Fail - Import Site Options.
2533
+ if (false === response.success) {
2534
+ AstraSitesAdmin._failed( response.data, 'Import Site Options Failed!' );
2535
+ console.groupEnd();
2536
+ } else {
2537
+ console.groupEnd();
2538
+
2539
+ // 3. Pass - Import Site Options.
2540
+ $(document).trigger('astra-sites-import-options-done');
2541
+ }
2542
+ });
2543
+ } else {
2544
+ $(document).trigger('astra-sites-import-options-done');
2545
+ }
2546
+ },
2547
+
2548
+ /**
2549
+ * 2. Prepare XML Data.
2550
+ */
2551
+ _importXML: function () {
2552
+
2553
+ if (AstraSitesAdmin._is_process_xml()) {
2554
+ $.ajax({
2555
+ url: astraSitesVars.ajaxurl,
2556
+ type: 'POST',
2557
+ dataType: 'json',
2558
+ data: {
2559
+ action: 'astra-sites-import-prepare-xml',
2560
+ wxr_url: AstraSitesAdmin.wxr_url,
2561
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2562
+ },
2563
+ beforeSend: function () {
2564
+ console.groupCollapsed('Importing Content');
2565
+ AstraSitesAdmin._log_title('Importing Content..');
2566
+ AstraSitesAdmin._log(AstraSitesAdmin.wxr_url);
2567
+ $('.astra-site-import-process-wrap').show();
2568
+ },
2569
+ })
2570
+ .fail(function (jqXHR) {
2571
+ AstraSitesAdmin._log(jqXHR);
2572
+ AstraSitesAdmin._importFailMessage(jqXHR.status + ' ' + jqXHR.statusText, 'Prepare Import XML Failed!', jqXHR);
2573
+ console.groupEnd();
2574
+ })
2575
+ .done(function (response) {
2576
+
2577
+ AstraSitesAdmin._log(response);
2578
+
2579
+ // 2. Fail - Prepare XML Data.
2580
+ if (false === response.success) {
2581
+ var error_msg = response.data.error || response.data;
2582
+
2583
+ AstraSitesAdmin._importFailMessage(astraSitesVars.xmlRequiredFilesMissing);
2584
+
2585
+ console.groupEnd();
2586
+ } else {
2587
+
2588
+ var xml_processing = $('.astra-demo-import').attr('data-xml-processing');
2589
+
2590
+ if ('yes' === xml_processing) {
2591
+ return;
2592
+ }
2593
+
2594
+ $('.astra-demo-import').attr('data-xml-processing', 'yes');
2595
+
2596
+ // 2. Pass - Prepare XML Data.
2597
+
2598
+ // Import XML though Event Source.
2599
+ AstraSSEImport.data = response.data;
2600
+ AstraSSEImport.render();
2601
+
2602
+ $('.current-importing-status-description').html('').show();
2603
+
2604
+ $('.current-importing-status-wrap').append('<div class="astra-site-import-process-wrap"><progress class="astra-site-import-process" max="100" value="0"></progress></div>');
2605
+
2606
+ var evtSource = new EventSource(AstraSSEImport.data.url);
2607
+ evtSource.onmessage = function (message) {
2608
+ var data = JSON.parse(message.data);
2609
+ switch (data.action) {
2610
+ case 'updateDelta':
2611
+
2612
+ AstraSSEImport.updateDelta(data.type, data.delta);
2613
+ break;
2614
+
2615
+ case 'complete':
2616
+ if ( false == data.error ) {
2617
+ evtSource.close();
2618
+
2619
+ $('.current-importing-status-description').hide();
2620
+ $('.astra-demo-import').removeAttr('data-xml-processing');
2621
+
2622
+ document.getElementsByClassName("astra-site-import-process").value = '100';
2623
+
2624
+ $('.astra-site-import-process-wrap').hide();
2625
+ console.groupEnd();
2626
+
2627
+ $(document).trigger('astra-sites-import-xml-done');
2628
+ } else {
2629
+ evtSource.close();
2630
+ AstraSitesAdmin._importFailMessage(
2631
+ astraSitesVars.xml_import_interrupted_error,
2632
+ 'Import Process Interrupted!',
2633
+ '',
2634
+ '<p>' + astraSitesVars.xml_import_interrupted_primary + '</p>',
2635
+ '<p>' + astraSitesVars.xml_import_interrupted_secondary + '</p>'
2636
+ );
2637
+ }
2638
+
2639
+ break;
2640
+ }
2641
+ };
2642
+ evtSource.onerror = function (error) {
2643
+ evtSource.close();
2644
+ console.log(error);
2645
+ AstraSitesAdmin._importFailMessage('', 'Import Process Interrupted');
2646
+ };
2647
+ evtSource.addEventListener('log', function (message) {
2648
+ var data = JSON.parse(message.data);
2649
+ var message = data.message || '';
2650
+ if (message && 'info' === data.level) {
2651
+ message = message.replace(/"/g, function (letter) {
2652
+ return '';
2653
+ });
2654
+ $('.current-importing-status-description').html(message);
2655
+ }
2656
+ AstraSitesAdmin._log(message, data.level);
2657
+ });
2658
+ }
2659
+ });
2660
+ } else {
2661
+ $(document).trigger('astra-sites-import-xml-done');
2662
+ }
2663
+ },
2664
+
2665
+ _is_reset_data: function () {
2666
+ if ($('.astra-sites-reset-data').find('.checkbox').is(':checked')) {
2667
+ return true;
2668
+ }
2669
+ return false;
2670
+ },
2671
+
2672
+ _is_process_xml: function () {
2673
+ if ($('.astra-sites-import-xml').find('.checkbox').is(':checked')) {
2674
+ return true;
2675
+ }
2676
+ return false;
2677
+ },
2678
+
2679
+ _is_process_customizer: function () {
2680
+ var theme_status = $('.astra-sites-theme-activation .checkbox').length ? $('.astra-sites-theme-activation .checkbox').is(':checked') : true;
2681
+ var customizer_status = $('.astra-sites-import-customizer').find('.checkbox').is(':checked');
2682
+
2683
+ if (theme_status && customizer_status) {
2684
+ return true;
2685
+ }
2686
+ return false;
2687
+ },
2688
+
2689
+ _is_process_widgets: function () {
2690
+ if ($('.astra-sites-import-widgets').find('.checkbox').is(':checked')) {
2691
+ return true;
2692
+ }
2693
+ return false;
2694
+ },
2695
+
2696
+ _startImportCartFlows: function (event) {
2697
+ if (AstraSitesAdmin._is_process_xml() && '' !== AstraSitesAdmin.cartflows_url) {
2698
+
2699
+ $.ajax({
2700
+ url: astraSitesVars.ajaxurl,
2701
+ type: 'POST',
2702
+ dataType: 'json',
2703
+ data: {
2704
+ action: 'astra-sites-import-cartflows',
2705
+ cartflows_url: AstraSitesAdmin.cartflows_url,
2706
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2707
+ },
2708
+ beforeSend: function () {
2709
+ console.groupCollapsed('Importing Flows & Steps');
2710
+ AstraSitesAdmin._log_title('Importing Flows & Steps..');
2711
+ AstraSitesAdmin._log(AstraSitesAdmin.cartflows_url);
2712
+ },
2713
+ })
2714
+ .fail(function (jqXHR) {
2715
+ AstraSitesAdmin._log(jqXHR);
2716
+ AstraSitesAdmin._failed( jqXHR.status + ' ' + jqXHR.statusText, 'Import Cartflows Flow Failed!' );
2717
+ console.groupEnd();
2718
+ })
2719
+ .done(function (response) {
2720
+ AstraSitesAdmin._log(response);
2721
+
2722
+ // 1. Fail - Import WPForms Options.
2723
+ if (false === response.success) {
2724
+ AstraSitesAdmin._failed( response.data, 'Import Cartflows Flow Failed!' );
2725
+ console.groupEnd();
2726
+ } else {
2727
+ console.groupEnd();
2728
+ // 1. Pass - Import Customizer Options.
2729
+ $(document).trigger(AstraSitesAdmin.action_slug + '-import-cartflows-done');
2730
+ }
2731
+ });
2732
+
2733
+ } else {
2734
+ $(document).trigger(AstraSitesAdmin.action_slug + '-import-cartflows-done');
2735
+ }
2736
+
2737
+ },
2738
+
2739
+ _startImportWPForms: function (event) {
2740
+
2741
+ if (AstraSitesAdmin._is_process_xml() && '' !== AstraSitesAdmin.wpforms_url) {
2742
+
2743
+ $.ajax({
2744
+ url: astraSitesVars.ajaxurl,
2745
+ type: 'POST',
2746
+ dataType: 'json',
2747
+ data: {
2748
+ action: 'astra-sites-import-wpforms',
2749
+ wpforms_url: AstraSitesAdmin.wpforms_url,
2750
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2751
+ },
2752
+ beforeSend: function () {
2753
+ console.groupCollapsed('Importing WP Forms');
2754
+ AstraSitesAdmin._log_title('Importing WP Forms..');
2755
+ AstraSitesAdmin._log(AstraSitesAdmin.wpforms_url);
2756
+ },
2757
+ })
2758
+ .fail(function (jqXHR) {
2759
+ AstraSitesAdmin._log(jqXHR);
2760
+ AstraSitesAdmin._failed( jqXHR.status + ' ' + jqXHR.statusText, 'Import WP Forms Failed' );
2761
+ console.groupEnd();
2762
+ })
2763
+ .done(function (response) {
2764
+ AstraSitesAdmin._log(response);
2765
+
2766
+ // 1. Fail - Import WPForms Options.
2767
+ if (false === response.success) {
2768
+ AstraSitesAdmin._failed( response.data, 'Import WP Forms Failed' );
2769
+ console.groupEnd();
2770
+ } else {
2771
+ console.groupEnd();
2772
+ // 1. Pass - Import Customizer Options.
2773
+ $(document).trigger(AstraSitesAdmin.action_slug + '-import-wpforms-done');
2774
+ }
2775
+ });
2776
+
2777
+ } else {
2778
+ $(document).trigger(AstraSitesAdmin.action_slug + '-import-wpforms-done');
2779
+ }
2780
+
2781
+ },
2782
+
2783
+ /**
2784
+ * 1. Import Customizer Options.
2785
+ */
2786
+ _importCustomizerSettings: function (event) {
2787
+ if (AstraSitesAdmin._is_process_customizer()) {
2788
+ $.ajax({
2789
+ url: astraSitesVars.ajaxurl,
2790
+ type: 'POST',
2791
+ dataType: 'json',
2792
+ data: {
2793
+ action: 'astra-sites-import-customizer-settings',
2794
+ _ajax_nonce: astraSitesVars._ajax_nonce,
2795
+ },
2796
+ beforeSend: function () {
2797
+ console.groupCollapsed('Importing Customizer Settings');
2798
+ AstraSitesAdmin._log_title('Importing Customizer Settings..');
2799
+ AstraSitesAdmin._log(JSON.parse(AstraSitesAdmin.customizer_data));
2800
+ },
2801
+ })
2802
+ .fail(function (jqXHR) {
2803
+ AstraSitesAdmin._failed( jqXHR.status + ' ' + jqXHR.statusText, 'Import Customizer Settings Failed!' );
2804
+ AstraSitesAdmin._log(jqXHR);
2805
+ console.groupEnd();
2806
+ })
2807
+ .done(function (response) {
2808
+ AstraSitesAdmin._log(response);
2809
+
2810
+ // 1. Fail - Import Customizer Options.
2811
+ if (false === response.success) {
2812
+ AstraSitesAdmin._failed( response.data, 'Import Customizer Settings Failed!' );
2813
+ console.groupEnd();
2814
+ } else {
2815
+ console.groupEnd();
2816
+ // 1. Pass - Import Customizer Options.
2817
+ $(document).trigger('astra-sites-import-customizer-settings-done');
2818
+ }
2819
+ });
2820
+ } else {
2821
+ $(document).trigger('astra-sites-import-customizer-settings-done');
2822
+ }
2823
+
2824
+ },
2825
+
2826
+ /**
2827
+ * Import Success Button.
2828
+ *
2829
+ * @param {string} data Error message.
2830
+ */
2831
+ _importSuccessButton: function () {
2832
+
2833
+ $('.astra-demo-import').removeClass('updating-message installing')
2834
+ .removeAttr('data-import')
2835
+ .addClass('view-site')
2836
+ .removeClass('astra-demo-import')
2837
+ .text(astraSitesVars.strings.viewSite)
2838
+ .attr('target', '_blank')
2839
+ .append('<i class="dashicons dashicons-external"></i>')
2840
+ .attr('href', astraSitesVars.siteURL);
2841
+ },
2842
+
2843
+ _failed: function( errMessage, titleMessage ) {
2844
+
2845
+ var link = astraSitesVars.process_failed_secondary;
2846
+ link = link.replace( '#DEMO_URL#', AstraSitesAdmin.templateData['astra-site-url'] );
2847
+ link = link.replace( '#SUBJECT#', encodeURI('AJAX failed: ' + errMessage ) );
2848
+
2849
+ AstraSitesAdmin._importFailMessage( errMessage, titleMessage, '', astraSitesVars.process_failed_primary, link);
2850
+
2851
+ },
2852
+
2853
+ /**
2854
+ * Import Error Button.
2855
+ *
2856
+ * @param {string} data Error message.
2857
+ */
2858
+ _importFailMessage: function (message, heading, jqXHR, topContent, bottomContent) {
2859
+
2860
+ heading = heading || 'The import process interrupted';
2861
+
2862
+ var status_code = '';
2863
+ if (jqXHR) {
2864
+ status_code = jqXHR.status ? parseInt(jqXHR.status) : '';
2865
+ }
2866
+
2867
+ if (200 == status_code && astraSitesVars.debug) {
2868
+ var output = astraSitesVars.importFailedMessageDueToDebug;
2869
+
2870
+ } else {
2871
+ var output = topContent || astraSitesVars.importFailedMessage;
2872
+
2873
+ if (message) {
2874
+
2875
+ if( jqXHR.responseText ) {
2876
+ message = message + '<br/>' + jqXHR.responseText;
2877
+ }
2878
+
2879
+ output += '<div class="current-importing-status">Error: ' + message + '</div>';
2880
+ }
2881
+
2882
+ output += bottomContent || '';
2883
+ }
2884
+
2885
+ $('.astra-sites-import-content').html(output);
2886
+ $('.astra-sites-result-preview .heading h3').html(heading);
2887
+
2888
+ $('.astra-demo-import').removeClass('updating-message installing button-primary').addClass('disabled').text('Import Failed!');
2889
+ },
2890
+
2891
+ ucwords: function (str) {
2892
+ if (!str) {
2893
+ return '';
2894
+ }
2895
+
2896
+ str = str.toLowerCase().replace(/\b[a-z]/g, function (letter) {
2897
+ return letter.toUpperCase();
2898
+ });
2899
+
2900
+ str = str.replace(/-/g, function (letter) {
2901
+ return ' ';
2902
+ });
2903
+
2904
+ return str;
2905
+ },
2906
+
2907
+ /**
2908
+ * Install Success
2909
+ */
2910
+ _installSuccess: function (event, response) {
2911
+
2912
+ event.preventDefault();
2913
+
2914
+ console.groupEnd();
2915
+
2916
+ // Reset not installed plugins list.
2917
+ var pluginsList = astraSitesVars.requiredPlugins.notinstalled;
2918
+ astraSitesVars.requiredPlugins.notinstalled = AstraSitesAdmin._removePluginFromQueue(response.slug, pluginsList);
2919
+
2920
+ // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
2921
+ setTimeout(function () {
2922
+
2923
+ console.groupCollapsed('Activating Plugin "' + response.name + '"');
2924
+
2925
+ AstraSitesAdmin._log_title('Activating Plugin - ' + response.name);
2926
+ AstraSitesAdmin._log('Activating Plugin - ' + response.name);
2927
+
2928
+ $.ajax({
2929
+ url: astraSitesVars.ajaxurl,
2930
+ type: 'POST',
2931
+ data: {
2932
+ 'action': 'astra-required-plugin-activate',
2933
+ 'init': response.init,
2934
+ '_ajax_nonce': astraSitesVars._ajax_nonce,
2935
+ },
2936
+ })
2937
+ .done(function (result) {
2938
+ AstraSitesAdmin._log(result);
2939
+
2940
+ if (result.success) {
2941
+ var pluginsList = astraSitesVars.requiredPlugins.inactive;
2942
+
2943
+ AstraSitesAdmin._log_title('Successfully Activated Plugin - ' + response.name);
2944
+ AstraSitesAdmin._log('Successfully Activated Plugin - ' + response.name);
2945
+
2946
+ // Reset not installed plugins list.
2947
+ astraSitesVars.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue(response.slug, pluginsList);
2948
+
2949
+ // Enable Demo Import Button
2950
+ AstraSitesAdmin._enable_demo_import_button();
2951
+ }
2952
+ console.groupEnd();
2953
+ });
2954
+
2955
+ }, 1200);
2956
+
2957
+ },
2958
+
2959
+ /**
2960
+ * Plugin Installation Error.
2961
+ */
2962
+ _installError: function (event, response) {
2963
+
2964
+ event.preventDefault();
2965
+
2966
+ console.log(event);
2967
+ console.log(response);
2968
+
2969
+ $('.astra-sites-result-preview .heading h3').text('Plugin Installation Failed');
2970
+ $('.astra-sites-import-content').html('<p>Plugin "<b>' + response.name + '</b>" installation failed.</p><p>There has been an error on your website. Read an article <a href="https://wpastra.com/docs/starter-templates-plugin-installation-failed/" target="blank">here</a> to solve the issue.</p>');
2971
+
2972
+ $('.astra-demo-import').removeClass('updating-message installing button-primary').addClass('disabled').text('Import Failed!');
2973
+
2974
+ wp.updates.queue = [];
2975
+
2976
+ wp.updates.queueChecker();
2977
+
2978
+ console.groupEnd();
2979
+ },
2980
+
2981
+ /**
2982
+ * Installing Plugin
2983
+ */
2984
+ _pluginInstalling: function (event, args) {
2985
+ event.preventDefault();
2986
+
2987
+ console.groupCollapsed('Installing Plugin "' + args.name + '"');
2988
+
2989
+ AstraSitesAdmin._log_title('Installing Plugin - ' + args.name);
2990
+
2991
+ console.log(args);
2992
+ },
2993
+
2994
+ /**
2995
+ * Bulk Plugin Active & Install
2996
+ */
2997
+ _bulkPluginInstallActivate: function () {
2998
+
2999
+ var not_installed = [];
3000
+ var activate_plugins = [];
3001
+ if( astraSitesVars.requiredPlugins ) {
3002
+ activate_plugins = astraSitesVars.requiredPlugins.inactive || [];
3003
+ not_installed = astraSitesVars.requiredPlugins.notinstalled || [];
3004
+ }
3005
+
3006
+ // If has class the skip-plugins then,
3007
+ // Avoid installing 3rd party plugins.
3008
+ if ($('.astra-sites-result-preview').hasClass('skip-plugins')) {
3009
+ not_installed = [];
3010
+ }
3011
+
3012
+ // First Install Bulk.
3013
+ if (not_installed.length > 0) {
3014
+ AstraSitesAdmin._installAllPlugins(not_installed);
3015
+ }
3016
+
3017
+ // Second Activate Bulk.
3018
+ if (activate_plugins.length > 0) {
3019
+ AstraSitesAdmin._activateAllPlugins(activate_plugins);
3020
+ }
3021
+
3022
+ if (activate_plugins.length <= 0 && not_installed.length <= 0) {
3023
+ AstraSitesAdmin._enable_demo_import_button();
3024
+ }
3025
+
3026
+ },
3027
+
3028
+ /**
3029
+ * Activate All Plugins.
3030
+ */
3031
+ _activateAllPlugins: function (activate_plugins) {
3032
+
3033
+ AstraSitesAdmin.remaining_activate_plugins = activate_plugins.length;
3034
+
3035
+ $.each(activate_plugins, function (index, single_plugin) {
3036
+
3037
+ AstraSitesAjaxQueue.add({
3038
+ url: astraSitesVars.ajaxurl,
3039
+ type: 'POST',
3040
+ data: {
3041
+ 'action': 'astra-required-plugin-activate',
3042
+ 'init': single_plugin.init,
3043
+ 'options': AstraSitesAdmin.options_data,
3044
+ 'enabledExtensions': AstraSitesAdmin.enabled_extensions,
3045
+ '_ajax_nonce': astraSitesVars._ajax_nonce,
3046
+ },
3047
+ beforeSend: function () {
3048
+ console.groupCollapsed('Activating Plugin "' + single_plugin.name + '"');
3049
+ AstraSitesAdmin._log_title('Activating Plugin "' + single_plugin.name + '"');
3050
+ },
3051
+ success: function (result) {
3052
+ console.log(result);
3053
+ console.groupEnd('Activating Plugin "' + single_plugin.name + '"');
3054
+
3055
+ if (result.success) {
3056
+ var pluginsList = astraSitesVars.requiredPlugins.inactive;
3057
+
3058
+ // Reset not installed plugins list.
3059
+ astraSitesVars.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue(single_plugin.slug, pluginsList);
3060
+
3061
+ // Enable Demo Import Button
3062
+ AstraSitesAdmin._enable_demo_import_button();
3063
+ }
3064
+
3065
+ AstraSitesAdmin.remaining_activate_plugins -= 1;
3066
+
3067
+ if (0 === AstraSitesAdmin.remaining_activate_plugins) {
3068
+ console.groupEnd('Activating Required Plugins..');
3069
+ }
3070
+ }
3071
+ });
3072
+ });
3073
+ AstraSitesAjaxQueue.run();
3074
+ },
3075
+
3076
+ /**
3077
+ * Install All Plugins.
3078
+ */
3079
+ _installAllPlugins: function (not_installed) {
3080
+
3081
+ $.each(not_installed, function (index, single_plugin) {
3082
+
3083
+ // Add each plugin activate request in Ajax queue.
3084
+ // @see wp-admin/js/updates.js
3085
+ wp.updates.queue.push({
3086
+ action: 'install-plugin', // Required action.
3087
+ data: {
3088
+ slug: single_plugin.slug,
3089
+ init: single_plugin.init,
3090
+ name: single_plugin.name,
3091
+ success: function () {
3092
+ $(document).trigger('wp-plugin-install-success', [single_plugin]);
3093
+ },
3094
+ error: function () {
3095
+ $(document).trigger('wp-plugin-install-error', [single_plugin]);
3096
+ },
3097
+ }
3098
+ });
3099
+ });
3100
+
3101
+ // Required to set queue.
3102
+ wp.updates.queueChecker();
3103
+ },
3104
+
3105
+ _show_get_agency_bundle_notice: function (event) {
3106
+ event.preventDefault();
3107
+ $('.astra-sites-result-preview')
3108
+ .removeClass('astra-sites-activate-license astra-sites-site-import-popup astra-sites-page-import-popup')
3109
+ .addClass('astra-sites-get-agency-bundle')
3110
+ .show();
3111
+
3112
+ var template = wp.template('astra-sites-pro-site-description');
3113
+ var output = '<div class="overlay"></div>';
3114
+ output += '<div class="inner"><div class="heading"><h3>Liked This demo?</h3></div><span class="dashicons close dashicons-no-alt"></span><div class="astra-sites-import-content">';
3115
+ output += '</div></div>';
3116
+ $('.astra-sites-result-preview').html(output);
3117
+ $('.astra-sites-import-content').html(template);
3118
+ },
3119
+
3120
+ _show_activate_license_notice: function (event) {
3121
+
3122
+ if (event) {
3123
+ event.preventDefault();
3124
+ }
3125
+
3126
+ if (!AstraSitesAdmin._getParamFromURL('license')) {
3127
+ var url_params = {
3128
+ 'license': 'show'
3129
+ };
3130
+ AstraSitesAdmin._changeAndSetURL(url_params);
3131
+ }
3132
+
3133
+ $('.astra-sites-result-preview')
3134
+ .removeClass('astra-sites-site-import-popup astra-sites-skip-templates astra-sites-page-import-popup')
3135
+ .addClass('astra-sites-activate-license')
3136
+ .show();
3137
+
3138
+ var template = wp.template('astra-sites-activate-license');
3139
+ var output = '<div class="overlay"></div>';
3140
+ output += '<div class="inner"><div class="heading"><h3>Activate License for Premium Templates</h3></div><span class="dashicons close dashicons-no-alt"></span><div class="astra-sites-import-content">';
3141
+ output += '</div></div>';
3142
+ $('.astra-sites-result-preview').html(output);
3143
+ $('.astra-sites-import-content').html(template);
3144
+ },
3145
+
3146
+ _show_invalid_mini_agency_license: function (event) {
3147
+ event.preventDefault();
3148
+ $('.astra-sites-result-preview')
3149
+ .removeClass('astra-sites-activate-license astra-sites-site-import-popup astra-sites-skip-templates astra-sites-page-import-popup')
3150
+ .addClass('astra-sites-invalid-mini-agency-license')
3151
+ .show();
3152
+
3153
+ var template = wp.template('astra-sites-invalid-mini-agency-license');
3154
+ var output = '<div class="overlay"></div>';
3155
+ output += '<div class="inner"><div class="heading"><h3>Not Valid License</h3></div><span class="dashicons close dashicons-no-alt"></span><div class="astra-sites-import-content">';
3156
+ output += '</div></div>';
3157
+ $('.astra-sites-result-preview').html(output);
3158
+ $('.astra-sites-import-content').html(template);
3159
+ },
3160
+
3161
+ _get_id: function (site_id) {
3162
+ return site_id.replace('id-', '');
3163
+ },
3164
+
3165
+ /**
3166
+ * Fires when a nav item is clicked.
3167
+ *
3168
+ * @since 1.0
3169
+ * @access private
3170
+ * @method _show_site_popup
3171
+ */
3172
+ _show_site_popup: function (event) {
3173
+ event.preventDefault();
3174
+
3175
+ if ($(this).hasClass('updating-message')) {
3176
+ return;
3177
+ }
3178
+
3179
+ var delay = 1;
3180
+ var retry_str = '';
3181
+ if ( AstraSitesAdmin.delay_in_request ) {
3182
+ delay = AstraSitesAdmin.delay_value;
3183
+ retry_str = '<p class="ast-retry-text">Retrying in <span class="ast-retry-sec">10</span>...</p>';
3184
+
3185
+ var timeleft = AstraSitesAdmin.delay_value / 1000;
3186
+ var countdown = setInterval(function() {
3187
+ timeleft -= 1;
3188
+ $(".ast-retry-sec").html( timeleft );
3189
+ if ( timeleft <= 0 ) {
3190
+ clearInterval(countdown);
3191
+ $(".ast-retry-sec").html( "0" );
3192
+ }
3193
+ }, 1000);
3194
+ }
3195
+
3196
+ $('.astra-sites-result-preview').addClass('import-site').removeClass('import-page');
3197
+
3198
+ $('.astra-sites-result-preview')
3199
+ .removeClass('astra-sites-get-agency-bundle preview-page-from-search-result astra-sites-page-import-popup astra-sites-activate-license')
3200
+ .addClass('astra-sites-site-import-popup')
3201
+ .show();
3202
+
3203
+ var template = wp.template('astra-sites-result-preview');
3204
+ $('.astra-sites-result-preview').html(template('astra-sites')).addClass('preparing');
3205
+ $('.astra-sites-import-content').append('<div class="astra-loading-wrap"><div class="astra-loading-icon"></div></div>'+retry_str);
3206
+
3207
+ // .attr('data-slug', 'astra-sites');
3208
+ AstraSitesAdmin.action_slug = 'astra-sites';
3209
+ astraSitesVars.cpt_slug = 'astra-sites';
3210
+
3211
+ var site_id = $('#site-pages').attr('data-site-id') || '';
3212
+ site_id = AstraSitesAdmin._get_id(site_id);
3213
+
3214
+ setTimeout(function() {
3215
+ $.ajax({
3216
+ url: astraSitesVars.ajaxurl,
3217
+ type: 'POST',
3218
+ data: {
3219
+ action: 'astra-sites-api-request',
3220
+ url: astraSitesVars.cpt_slug + '/' + site_id,
3221
+ _ajax_nonce: astraSitesVars._ajax_nonce,
3222
+ },
3223
+ beforeSend: function () {
3224
+ console.groupCollapsed('Requesting API');
3225
+ }
3226
+ })
3227
+ .fail(function (jqXHR) {
3228
+ AstraSitesAdmin._log(jqXHR);
3229
+ AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.statusText, '', jqXHR, astraSitesVars.ajax_request_failed_primary, astraSitesVars.ajax_request_failed_secondary );
3230
+ console.groupEnd();
3231
+ AstraSitesAdmin.delay_in_request = false;
3232
+ })
3233
+ .done(function (response) {
3234
+ console.log('Template API Response:');
3235
+ AstraSitesAdmin.delay_in_request = false;
3236
+ AstraSitesAdmin._log(response);
3237
+ console.groupEnd();
3238
+ if (response.success) {
3239
+ AstraSitesAdmin.visited_sites_and_pages[response.data.id] = response.data;
3240
+
3241
+ AstraSitesAdmin.templateData = response.data;
3242
+
3243
+ AstraSitesAdmin.process_site_data(AstraSitesAdmin.templateData);
3244
+ } else {
3245
+ AstraSitesAdmin.handle_error( response, site_id );
3246
+ }
3247
+ });
3248
+
3249
+ }, delay);
3250
+
3251
+ },
3252
+
3253
+ handle_error: function( response, id ) {
3254
+ var template = 'astra-sites-request-failed-user';
3255
+ var template_data = {
3256
+ 'primary' : '',
3257
+ 'secondary' : '',
3258
+ 'error' : response.data,
3259
+ 'id' : id
3260
+ };
3261
+ if ( undefined !== response.data.code ) {
3262
+ var code = response.data.code.toString();
3263
+ switch( code ) {
3264
+ case '401':
3265
+ case '404':
3266
+ case '500':
3267
+ template_data.primary = astraSitesVars.server_import_primary_error;
3268
+ break;
3269
+
3270
+ case 'WP_Error':
3271
+ template_data.primary = astraSitesVars.client_import_primary_error;
3272
+ break;
3273
+
3274
+ case 'Cloudflare':
3275
+ template_data.primary = astraSitesVars.cloudflare_import_primary_error;
3276
+ break;
3277
+
3278
+ default:
3279
+ template = 'astra-sites-request-failed';
3280
+ break;
3281
+ }
3282
+ }
3283
+
3284
+ let err_template = wp.template( template );
3285
+ $('.astra-sites-result-preview .heading > h3').text('Import Process Interrupted');
3286
+ $('.astra-sites-import-content').find('.astra-loading-wrap').remove();
3287
+ $('.astra-sites-result-preview').removeClass('preparing');
3288
+ $('.astra-sites-import-content').html( err_template( template_data ) );
3289
+ $('.astra-demo-import').removeClass('updating-message installing button-primary').addClass('disabled').text('Import Failed!');
3290
+ },
3291
+
3292
+ show_popup: function (heading, content, actions, classes) {
3293
+ if (classes) {
3294
+ $('.astra-sites-popup').addClass(classes);
3295
+ }
3296
+ if (heading) {
3297
+ $('.astra-sites-popup .heading h3').html(heading);
3298
+ }
3299
+ if (content) {
3300
+ $('.astra-sites-popup .astra-sites-import-content').html(content);
3301
+ }
3302
+ if (actions) {
3303
+ $('.astra-sites-popup .ast-actioms-wrap').html(actions);
3304
+ }
3305
+
3306
+ $('.astra-sites-popup').show();
3307
+ },
3308
+
3309
+ hide_popup: function () {
3310
+ $('.astra-sites-popup').hide();
3311
+ },
3312
+
3313
+ show_page_popup: function () {
3314
+
3315
+ AstraSitesAdmin.process_import_page();
3316
+ },
3317
+
3318
+ process_import_page: function () {
3319
+ AstraSitesAdmin.hide_popup();
3320
+
3321
+ var page_id = AstraSitesAdmin._get_id($('#single-pages').find('.current_page').attr('data-page-id')) || '';
3322
+ var site_id = AstraSitesAdmin._get_id($('#site-pages').attr('data-site-id')) || '';
3323
+
3324
+ var delay = 1;
3325
+ var retry_str = '';
3326
+ if ( AstraSitesAdmin.delay_in_request ) {
3327
+ delay = AstraSitesAdmin.delay_value;
3328
+ retry_str = '<p class="ast-retry-text">Retrying in <span class="ast-retry-sec">10</span>...</p>';
3329
+
3330
+ var timeleft = AstraSitesAdmin.delay_value / 1000;
3331
+ var countdown = setInterval(function() {
3332
+ timeleft -= 1;
3333
+ $(".ast-retry-sec").html( timeleft );
3334
+ if ( timeleft <= 0 ) {
3335
+ clearInterval(countdown);
3336
+ $(".ast-retry-sec").html( "0" );
3337
+ }
3338
+ }, 1000);
3339
+ }
3340
+
3341
+ $('.astra-sites-result-preview')
3342
+ .removeClass('astra-sites-subscription-popup astra-sites-activate-license astra-sites-get-agency-bundle astra-sites-site-import-popup astra-sites-page-import-popup')
3343
+ .addClass('preview-page-from-search-result')
3344
+ .show();
3345
+
3346
+ $('.astra-sites-result-preview').html(wp.template('astra-sites-result-preview')).addClass('preparing');
3347
+ $('.astra-sites-import-content').append('<div class="astra-loading-wrap"><div class="astra-loading-icon"></div></div>' + retry_str);
3348
+
3349
+ AstraSitesAdmin.action_slug = 'site-pages';
3350
+ astraSitesVars.cpt_slug = 'site-pages';
3351
+
3352
+ setTimeout( function() {
3353
+ // Request.
3354
+ $.ajax({
3355
+ url: astraSitesVars.ajaxurl,
3356
+ type: 'POST',
3357
+ data: {
3358
+ action: 'astra-sites-api-request',
3359
+ url: astraSitesVars.cpt_slug + '/' + page_id,
3360
+ _ajax_nonce: astraSitesVars._ajax_nonce,
3361
+ },
3362
+ beforeSend: function () {
3363
+ console.groupCollapsed('Requesting API URL');
3364
+ AstraSitesAdmin._log('Requesting API URL');
3365
+ }
3366
+ })
3367
+ .fail(function (jqXHR) {
3368
+ AstraSitesAdmin._log(jqXHR);
3369
+ AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.statusText, 'Page Import API Request Failed!', jqXHR, astraSitesVars.ajax_request_failed_primary, astraSitesVars.ajax_request_failed_secondary );
3370
+ console.groupEnd();
3371
+ AstraSitesAdmin.delay_in_request = false;
3372
+ })
3373
+ .done(function (response) {
3374
+ AstraSitesAdmin._log(response);
3375
+ console.groupEnd();
3376
+ AstraSitesAdmin.delay_in_request = false;
3377
+
3378
+ if (response.success) {
3379
+ AstraSitesAdmin.visited_sites_and_pages[response.data.id] = response.data;
3380
+
3381
+ AstraSitesAdmin.templateData = response.data;
3382
+
3383
+ AstraSitesAdmin.required_plugins_list_markup(AstraSitesAdmin.templateData['site-pages-required-plugins']);
3384
+ } else {
3385
+ AstraSitesAdmin.handle_error( response, page_id );
3386
+ }
3387
+ });
3388
+ }, delay );
3389
+
3390
+ },
3391
+
3392
+ show_page_popup_from_search: function (event) {
3393
+ event.preventDefault();
3394
+ var page_id = $(this).parents('.astra-theme').attr('data-page-id') || '';
3395
+ var site_id = $(this).parents('.astra-theme').attr('data-site-id') || '';
3396
+
3397
+ // $('.astra-sites-result-preview').show();
3398
+ $('#astra-sites').hide();
3399
+ $('#site-pages').hide();
3400
+ AstraSitesAdmin.show_pages_by_site_id(site_id, page_id);
3401
+ },
3402
+
3403
+ /**
3404
+ * Fires when a nav item is clicked.
3405
+ *
3406
+ * @since 1.0
3407
+ * @access private
3408
+ * @method show_page_popup
3409
+ */
3410
+ show_page_popup_from_sites: function (event) {
3411
+ event.preventDefault();
3412
+
3413
+ if ($(this).hasClass('updating-message')) {
3414
+ return;
3415
+ }
3416
+
3417
+ $('.astra-sites-result-preview').addClass('import-page').removeClass('import-site');
3418
+
3419
+ AstraSitesAdmin.show_page_popup();
3420
+ },
3421
+
3422
+ // Returns if a value is an array
3423
+ _isArray: function (value) {
3424
+ return value && typeof value === 'object' && value.constructor === Array;
3425
+ },
3426
+
3427
+ add_skip_and_import_popups: function (templates) {
3428
+ if (Object.keys(templates).length) {
3429
+ for (template_id in templates) {
3430
+ var template = wp.template(template_id);
3431
+ var template_data = templates[template_id] || '';
3432
+ $('.astra-sites-result-preview .inner').append(template(template_data));
3433
+ }
3434
+ $('.astra-sites-result-preview .inner > .default').addClass('hide-me');
3435
+ $('.astra-sites-result-preview .inner > .skip-and-import:not(:last-child)').addClass('hide-me');
3436
+ }
3437
+ },
3438
+
3439
+ start_import: function( response ) {
3440
+
3441
+ if (AstraSitesAdmin.subscribe_skiped || AstraSitesAdmin.subscription_form_submitted == 'yes') {
3442
+ $('.user-building-for-title').hide();
3443
+ $('.astra-sites-advanced-options-heading').hide();
3444
+ $('.astra-sites-advanced-options').show();
3445
+ $('#astra-sites-subscription-form-one').hide();
3446
+ }
3447
+
3448
+ if (false === AstraSitesAdmin.subscribe_skiped && $('.subscription-enabled').length && AstraSitesAdmin.subscription_form_submitted !== 'yes') {
3449
+ $('.astra-sites-result-preview .heading h3').html(astraSitesVars.headings.subscription);
3450
+ $('.site-import-cancel').hide();
3451
+
3452
+ if ('site-pages' === AstraSitesAdmin.action_slug) {
3453
+ $('#astra-sites-subscription-form-two').html(wp.template('astra-sites-subscription-form-one'));
3454
+ $('#astra-sites-subscription-form-two').append(wp.template('astra-sites-subscription-form-two'));
3455
+ } else {
3456
+ $('#astra-sites-subscription-form-one').html(wp.template('astra-sites-subscription-form-one'));
3457
+ $('#astra-sites-subscription-form-two').html(wp.template('astra-sites-subscription-form-two'));
3458
+ }
3459
+ }
3460
+
3461
+ // Set compatibilities.
3462
+ AstraSitesAdmin.skip_and_import_popups = [];
3463
+ var compatibilities = astraSitesVars.compatibilities;
3464
+ required_plugins = [];
3465
+ if( response ) {
3466
+ required_plugins = response.data['required_plugins'];
3467
+ AstraSitesAdmin.required_plugins = response.data['required_plugins'];
3468
+
3469
+ if (response.data['third_party_required_plugins'].length) {
3470
+ AstraSitesAdmin.skip_and_import_popups['astra-sites-third-party-required-plugins'] = response.data['third_party_required_plugins'];
3471
+ }
3472
+ }
3473
+
3474
+ var is_dynamic_page = $('#single-pages').find('.current_page').attr('data-dynamic-page') || 'no';
3475
+
3476
+ if (('yes' === is_dynamic_page) && 'site-pages' === AstraSitesAdmin.action_slug) {
3477
+ AstraSitesAdmin.skip_and_import_popups['astra-sites-dynamic-page'] = '';
3478
+ }
3479
+
3480
+ // Release disabled class from import button.
3481
+ $('.astra-demo-import')
3482
+ .removeClass('disabled not-click-able')
3483
+ .attr('data-import', 'disabled');
3484
+
3485
+ // Remove loader.
3486
+ $('.required-plugins').removeClass('loading').html('');
3487
+ $('.required-plugins-list').html('');
3488
+
3489
+ var output = '';
3490
+
3491
+ /**
3492
+ * Count remaining plugins.
3493
+ * @type number
3494
+ */
3495
+ var remaining_plugins = 0;
3496
+ var required_plugins_markup = '';
3497
+
3498
+ /**
3499
+ * Not Installed
3500
+ *
3501
+ * List of not installed required plugins.
3502
+ */
3503
+ if ( required_plugins && typeof required_plugins.notinstalled !== 'undefined') {
3504
+
3505
+ // Add not have installed plugins count.
3506
+ remaining_plugins += parseInt(required_plugins.notinstalled.length);
3507
+
3508
+ $(required_plugins.notinstalled).each(function (index, plugin) {
3509
+ output += '<li class="plugin-card plugin-card-' + plugin.slug + '" data-slug="' + plugin.slug + '" data-init="' + plugin.init + '" data-name="' + plugin.name + '">' + plugin.name + '</li>';
3510
+ });
3511
+ }
3512
+
3513
+ /**
3514
+ * Inactive
3515
+ *
3516
+ * List of not inactive required plugins.
3517
+ */
3518
+ if ( required_plugins && typeof required_plugins.inactive !== 'undefined') {
3519
+
3520
+ // Add inactive plugins count.
3521
+ remaining_plugins += parseInt(required_plugins.inactive.length);
3522
+
3523
+ $(required_plugins.inactive).each(function (index, plugin) {
3524
+ output += '<li class="plugin-card plugin-card-' + plugin.slug + '" data-slug="' + plugin.slug + '" data-init="' + plugin.init + '" data-name="' + plugin.name + '">' + plugin.name + '</li>';
3525
+ });
3526
+ }
3527
+
3528
+ if ('' == output) {
3529
+ $('.astra-sites-result-preview').find('.astra-sites-import-plugins').hide();
3530
+ } else {
3531
+ $('.astra-sites-result-preview').find('.astra-sites-import-plugins').show();
3532
+ $('.astra-sites-result-preview').find('.required-plugins-list').html(output);
3533
+ }
3534
+ if ('yes' === AstraSitesAdmin.first_import_complete && !$('.astra-sites-result-preview').hasClass('import-page')) {
3535
+ $('.astra-sites-advanced-options').find('.astra-site-contents').prepend(wp.template('astra-sites-delete-previous-site'));
3536
+ }
3537
+
3538
+ /**
3539
+ * Enable Demo Import Button
3540
+ * @type number
3541
+ */
3542
+ astraSitesVars.requiredPlugins = required_plugins;
3543
+
3544
+ $('.astra-sites-import-content').find('.astra-loading-wrap').remove();
3545
+ $('.astra-sites-result-preview').removeClass('preparing');
3546
+
3547
+ // Compatibility.
3548
+ if (Object.keys(compatibilities.errors).length || Object.keys(compatibilities.warnings).length || Object.keys(AstraSitesAdmin.skip_and_import_popups).length) {
3549
+
3550
+ if (Object.keys(compatibilities.errors).length || Object.keys(compatibilities.warnings).length) {
3551
+ AstraSitesAdmin.skip_and_import_popups['astra-sites-compatibility-messages'] = compatibilities;
3552
+ }
3553
+
3554
+ if (Object.keys(AstraSitesAdmin.skip_and_import_popups).length) {
3555
+ AstraSitesAdmin.add_skip_and_import_popups(AstraSitesAdmin.skip_and_import_popups);
3556
+ }
3557
+
3558
+ } else {
3559
+
3560
+ // Avoid plugin activation, for pages only.
3561
+ if ('site-pages' === AstraSitesAdmin.action_slug) {
3562
+
3563
+ var notinstalled = [];
3564
+ if( astraSitesVars && astraSitesVars.requiredPlugins && astraSitesVars.requiredPlugins.notinstalled ) {
3565
+ notinstalled = astraSitesVars.requiredPlugins.notinstalled;
3566
+ }
3567
+
3568
+ if (!notinstalled.length) {
3569
+ AstraSitesAdmin.import_page_process();
3570
+ }
3571
+ }
3572
+ }
3573
+ },
3574
+
3575
+ required_plugins_list_markup: function (requiredPlugins) {
3576
+
3577
+ // Add disabled class from import button.
3578
+ $('.astra-demo-import')
3579
+ .addClass('disabled not-click-able')
3580
+ .removeAttr('data-import');
3581
+
3582
+ if( '' === requiredPlugins ) {
3583
+ AstraSitesAdmin.start_import();
3584
+ } else {
3585
+
3586
+ $('.required-plugins').addClass('loading').html('<span class="spinner is-active"></span>');
3587
+
3588
+ // Required Required.
3589
+ $.ajax({
3590
+ url: astraSitesVars.ajaxurl,
3591
+ type: 'POST',
3592
+ data: {
3593
+ action: 'astra-required-plugins',
3594
+ _ajax_nonce: astraSitesVars._ajax_nonce,
3595
+ },
3596
+ beforeSend: function () {
3597
+ console.groupCollapsed('Required Plugins');
3598
+ console.log('Required Plugins of Template:');
3599
+ console.log(requiredPlugins);
3600
+ }
3601
+ })
3602
+ .fail(function (jqXHR) {
3603
+ AstraSitesAdmin._log(jqXHR);
3604
+
3605
+ // Remove loader.
3606
+ $('.required-plugins').removeClass('loading').html('');
3607
+ AstraSitesAdmin._failed( jqXHR.status + ' ' + jqXHR.statusText, 'Required Plugins Failed!' );
3608
+ console.groupEnd();
3609
+ })
3610
+ .done(function (response) {
3611
+ console.log('Required Plugin Status From The Site:');
3612
+ AstraSitesAdmin._log(response);
3613
+ console.groupEnd();
3614
+
3615
+ if (false === response.success) {
3616
+ AstraSitesAdmin._failed( response.data, 'Required Plugins Failed!' );
3617
+ } else {
3618
+ AstraSitesAdmin.start_import( response );
3619
+ }
3620
+ });
3621
+ }
3622
+ },
3623
+
3624
+ import_page_process: function () {
3625
+
3626
+ if ($('.astra-sites-page-import-popup .site-install-site-button, .preview-page-from-search-result .site-install-site-button').hasClass('updating-message')) {
3627
+ return;
3628
+ }
3629
+
3630
+ if (false === AstraSitesAdmin.subscribe_skiped && $('.subscription-enabled').length && AstraSitesAdmin.subscription_form_submitted !== 'yes') {
3631
+ $('.subscription-popup').show();
3632
+ $('.astra-sites-result-preview .default').hide();
3633
+ } else {
3634
+ AstraSitesAdmin.subscribe_status = true;
3635
+ }
3636
+
3637
+ $('.astra-sites-page-import-popup .site-install-site-button, .preview-page-from-search-result .site-install-site-button').addClass('updating-message installing').text('Importing..');
3638
+
3639
+ AstraSitesAdmin.import_start_time = new Date();
3640
+
3641
+ $('.astra-sites-result-preview .inner > h3').text('We\'re importing your website.');
3642
+ $('.install-theme-info').hide();
3643
+ $('.ast-importing-wrap').show();
3644
+ var output = '<div class="current-importing-status-title"></div><div class="current-importing-status-description"></div>';
3645
+ $('.current-importing-status').html(output);
3646
+
3647
+ // Process Bulk Plugin Install & Activate.
3648
+ AstraSitesAdmin._bulkPluginInstallActivate();
3649
+ },
3650
+
3651
+ _installAstra: function (status) {
3652
+
3653
+ var theme_slug = 'astra';
3654
+
3655
+ AstraSitesAdmin._log_title(astraSitesVars.log.themeInstall);
3656
+ AstraSitesAdmin._log(astraSitesVars.log.themeInstall);
3657
+
3658
+ if (status == 'not-installed') {
3659
+ if (wp.updates.shouldRequestFilesystemCredentials && !wp.updates.ajaxLocked) {
3660
+ wp.updates.requestFilesystemCredentials();
3661
+ }
3662
+ wp.updates.installTheme({
3663
+ slug: theme_slug
3664
+ });
3665
+
3666
+ } else if (status == 'installed-but-inactive') {
3667
+ AstraSitesAdmin._activateTheme();
3668
+ }
3669
+
3670
+ },
3671
+
3672
+ _activateTheme: function (event, response) {
3673
+
3674
+ // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
3675
+ setTimeout(function () {
3676
+
3677
+ $.ajax({
3678
+ url: astraSitesVars.ajaxurl,
3679
+ type: 'POST',
3680
+ data: {
3681
+ 'action': 'astra-sites-activate-theme',
3682
+ '_ajax_nonce': astraSitesVars._ajax_nonce,
3683
+ },
3684
+ beforeSend: function () {
3685
+ console.log('Activating Astra Theme..');
3686
+ }
3687
+ })
3688
+ .done(function (result) {
3689
+ AstraSitesAdmin._log(result);
3690
+ if (result.success) {
3691
+ AstraSitesAdmin._log_title(result.data.message);
3692
+ AstraSitesAdmin._log(result.data.message);
3693
+ }
3694
+ });
3695
+
3696
+ }, 3000);
3697
+ },
3698
+
3699
+ _close_popup_by_overlay: function (event) {
3700
+ if (this === event.target) {
3701
+ // Import process is started?
3702
+ // And Closing the window? Then showing the warning confirm message.
3703
+ if ($('body').hasClass('importing-site') && !confirm(astraSitesVars.strings.warningBeforeCloseWindow)) {
3704
+ return;
3705
+ }
3706
+
3707
+ $('body').removeClass('importing-site');
3708
+ $('html').removeClass('astra-site-preview-on');
3709
+
3710
+ AstraSitesAdmin._close_popup();
3711
+ AstraSitesAdmin.hide_popup();
3712
+ }
3713
+ },
3714
+
3715
+ /**
3716
+ * Close Popup
3717
+ *
3718
+ * @since 1.0
3719
+ * @access private
3720
+ * @method _importDemo
3721
+ */
3722
+ _close_popup: function () {
3723
+ AstraSitesAdmin._clean_url_params('astra-site');
3724
+ AstraSitesAdmin._clean_url_params('astra-page');
3725
+ AstraSitesAdmin._clean_url_params('license');
3726
+ $('.astra-sites-result-preview').html('').hide();
3727
+
3728
+ AstraSitesAdmin.hide_popup();
3729
+ },
3730
+
3731
+ _page_api_call: function () {
3732
+
3733
+ // Have any skip and import popup in queue then return.
3734
+ if (Object.keys(AstraSitesAdmin.skip_and_import_popups).length) {
3735
+ return;
3736
+ }
3737
+
3738
+ // Has API data of pages.
3739
+ if (null == AstraSitesAdmin.templateData) {
3740
+ return;
3741
+ }
3742
+
3743
+ AstraSitesAdmin.import_wpform(AstraSitesAdmin.templateData['astra-site-wpforms-path'], function (form_response) {
3744
+
3745
+ $('body').addClass('importing-site');
3746
+
3747
+ // Import Page Content
3748
+ $('.current-importing-status-wrap').remove();
3749
+ $('.astra-sites-result-preview .inner > h3').text('We are importing page!');
3750
+
3751
+ $.ajax({
3752
+ url: astraSitesVars.ajaxurl,
3753
+ type: 'POST',
3754
+ data: {
3755
+ action: 'astra-sites-remote-request',
3756
+ url: AstraSitesAdmin.templateData['astra-page-api-url'],
3757
+ _ajax_nonce: astraSitesVars._ajax_nonce,
3758
+ },
3759
+ beforeSend: function () {
3760
+ console.groupCollapsed('Get Template Details.');
3761
+ },
3762
+ })
3763
+ .fail(function (jqXHR) {
3764
+ console.log(jqXHR);
3765
+ console.groupEnd();
3766
+ })
3767
+ .done(function (response) {
3768
+ console.log( response );
3769
+ console.groupEnd();
3770
+
3771
+ if( response.success ) {
3772
+
3773
+ // Import Brizy images.
3774
+ if (Object.keys(response.data.brizy_media).length) {
3775
+ for (media_key in response.data.brizy_media) {
3776
+ AstraSitesAjaxQueue.add({
3777
+ url: astraSitesVars.ajaxurl,
3778
+ type: 'POST',
3779
+ data: {
3780
+ action: 'astra-sites-import-media',
3781
+ media: response.data.brizy_media[media_key],
3782
+ _ajax_nonce: astraSitesVars._ajax_nonce,
3783
+ },
3784
+ success: function (result) {
3785
+ AstraSitesAdmin._log(result);
3786
+ }
3787
+ });
3788
+ }
3789
+
3790
+ AstraSitesAjaxQueue.run();
3791
+ }
3792
+
3793
+ // Import Single Page.
3794
+ $.ajax({
3795
+ url: astraSitesVars.ajaxurl,
3796
+ type: 'POST',
3797
+ dataType: 'json',
3798
+ data: {
3799
+ 'action': 'astra-sites-create-page',
3800
+ '_ajax_nonce': astraSitesVars._ajax_nonce,
3801
+ 'page_settings_flag': AstraSitesAdmin.page_settings_flag,
3802
+ 'data': response.data,
3803
+ },
3804
+ success: function (response) {
3805
+ if (response.success) {
3806
+ AstraSitesAdmin.page_import_status = true;
3807
+ AstraSitesAdmin.imported_page_data = response.data
3808
+ AstraSitesAdmin.page_import_complete();
3809
+ } else {
3810
+ AstraSitesAdmin._importFailMessage(response.data, 'Page Rest API Request Failed!');
3811
+ }
3812
+ }
3813
+ });
3814
+
3815
+ }
3816
+ }).catch(err => {
3817
+ AstraSitesAdmin._log(err);
3818
+ AstraSitesAdmin._importFailMessage(response.data, 'Page Rest API Request Failed!');
3819
+ });
3820
+ });
3821
+ },
3822
+
3823
+ import_wpform: function (wpforms_url, callback) {
3824
+
3825
+ if ('' == wpforms_url) {
3826
+ if (callback && typeof callback == "function") {
3827
+ callback('');
3828
+ }
3829
+ return;
3830
+ }
3831
+
3832
+ $.ajax({
3833
+ url: astraSitesVars.ajaxurl,
3834
+ type: 'POST',
3835
+ dataType: 'json',
3836
+ data: {
3837
+ action: 'astra-sites-import-wpforms',
3838
+ wpforms_url: wpforms_url,
3839
+ _ajax_nonce: astraSitesVars._ajax_nonce,
3840
+ },
3841
+ beforeSend: function () {
3842
+ console.groupCollapsed('Importing WP Forms');
3843
+ AstraSitesAdmin._log_title('Importing WP Forms..');
3844
+ },
3845
+ })
3846
+ .fail(function (jqXHR) {
3847
+ AstraSitesAdmin._log(jqXHR);
3848
+ AstraSitesAdmin._failed( jqXHR.status + ' ' + jqXHR.statusText, 'Import WP Forms Failed' );
3849
+ console.groupEnd();
3850
+ })
3851
+ .done(function (response) {
3852
+ AstraSitesAdmin._log(response);
3853
+ console.groupEnd();
3854
+
3855
+ // 1. Fail - Import WPForms Options.
3856
+ if (false === response.success) {
3857
+ AstraSitesAdmin._failed( response.data, 'Import WP Forms Failed' );
3858
+ } else {
3859
+ if (callback && typeof callback == "function") {
3860
+ callback(response);
3861
+ }
3862
+ }
3863
+ });
3864
+ },
3865
+
3866
+ process_site_data: function (data) {
3867
+
3868
+ if ('log_file' in data) {
3869
+ AstraSitesAdmin.log_file_url = decodeURIComponent(data.log_file) || '';
3870
+ }
3871
+
3872
+ // 1. Pass - Request Site Import
3873
+ AstraSitesAdmin.customizer_data = JSON.stringify(data['astra-site-customizer-data']) || '';
3874
+ AstraSitesAdmin.wxr_url = encodeURI(data['astra-site-wxr-path']) || '';
3875
+ AstraSitesAdmin.wpforms_url = encodeURI(data['astra-site-wpforms-path']) || '';
3876
+ AstraSitesAdmin.cartflows_url = encodeURI(data['astra-site-cartflows-path']) || '';
3877
+ AstraSitesAdmin.options_data = JSON.stringify(data['astra-site-options-data']) || '';
3878
+ AstraSitesAdmin.enabled_extensions = JSON.stringify(data['astra-enabled-extensions']) || '';
3879
+ AstraSitesAdmin.widgets_data = data['astra-site-widgets-data'] || '';
3880
+
3881
+ // Elementor Template Kit Markup.
3882
+ AstraSitesAdmin.template_kit_markup(data);
3883
+
3884
+ // Required Plugins.
3885
+ AstraSitesAdmin.required_plugins_list_markup(data['required-plugins']);
3886
+ },
3887
+
3888
+ template_kit_markup: function (data) {
3889
+ if ('elementor' != astraSitesVars.default_page_builder) {
3890
+ return;
3891
+ }
3892
+ },
3893
+
3894
+ /**
3895
+ * Enable Demo Import Button.
3896
+ */
3897
+ _enable_demo_import_button: function (type) {
3898
+
3899
+ type = (undefined !== type) ? type : 'free';
3900
+
3901
+ $('.install-theme-info .theme-details .site-description').remove();
3902
+
3903
+ switch (type) {
3904
+
3905
+ case 'free':
3906
+
3907
+ var notinstalled = [];
3908
+ var inactive = [];
3909
+ if( astraSitesVars.requiredPlugins ) {
3910
+ notinstalled = astraSitesVars.requiredPlugins.notinstalled || [];
3911
+ inactive = astraSitesVars.requiredPlugins.inactive || [];
3912
+ }
3913
+ if ($('.astra-sites-result-preview').hasClass('skip-plugins')) {
3914
+ notinstalled = [];
3915
+ }
3916
+
3917
+ if (notinstalled.length === inactive.length) {
3918
+ $(document).trigger('astra-sites-after-' + AstraSitesAdmin.action_slug + '-required-plugins');
3919
+ }
3920
+ break;
3921
+
3922
+ case 'upgrade':
3923
+ var demo_slug = $('.wp-full-overlay-header').attr('data-demo-slug');
3924
+
3925
+ $('.astra-demo-import')
3926
+ .addClass('go-pro button-primary')
3927
+ .removeClass('astra-demo-import')
3928
+ .attr('target', '_blank')
3929
+ .attr('href', astraSitesVars.getUpgradeURL + demo_slug)
3930
+ .text(astraSitesVars.getUpgradeText)
3931
+ .append('<i class="dashicons dashicons-external"></i>');
3932
+ break;
3933
+
3934
+ default:
3935
+ var demo_slug = $('.wp-full-overlay-header').attr('data-demo-slug');
3936
+
3937
+ $('.astra-demo-import')
3938
+ .addClass('go-pro button-primary')
3939
+ .removeClass('astra-demo-import')
3940
+ .attr('target', '_blank')
3941
+ .attr('href', astraSitesVars.getProURL)
3942
+ .text(astraSitesVars.getProText)
3943
+ .append('<i class="dashicons dashicons-external"></i>');
3944
+
3945
+ $('.wp-full-overlay-header').find('.go-pro').remove();
3946
+
3947
+ if (false == astraSitesVars.isWhiteLabeled) {
3948
+ if (astraSitesVars.isPro) {
3949
+ $('.install-theme-info .theme-details').prepend(wp.template('astra-sites-pro-inactive-site-description'));
3950
+ } else {
3951
+ $('.install-theme-info .theme-details').prepend(wp.template('astra-sites-pro-site-description'));
3952
+ }
3953
+ }
3954
+
3955
+ break;
3956
+ }
3957
+
3958
+ },
3959
+
3960
+ /**
3961
+ * Update Page Count.
3962
+ */
3963
+
3964
+ /**
3965
+ * Remove plugin from the queue.
3966
+ */
3967
+ _removePluginFromQueue: function (removeItem, pluginsList) {
3968
+ return jQuery.grep(pluginsList, function (value) {
3969
+ return value.slug != removeItem;
3970
+ });
3971
+ }
3972
+
3973
+ };
3974
+
3975
+ /**
3976
+ * Initialize AstraSitesAdmin
3977
+ */
3978
+ $(function () {
3979
+ AstraSitesAdmin.init();
3980
+ });
3981
+
3982
+ })(jQuery);
astra-sites/inc/assets/js/common.js ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ $scope = {};
4
+
5
+ AstraImageCommon = {
6
+
7
+ images: {},
8
+ image: {},
9
+ action: '',
10
+ offset: 0,
11
+ loadingStatus: true,
12
+ config: {
13
+ q : '',
14
+ lang : 'en',
15
+ image_type : 'all',
16
+ orientation : 'all',
17
+ category : '',
18
+ min_width : 0,
19
+ min_height : 0,
20
+ colors : '',
21
+ editors_choice : false,
22
+ safesearch : true,
23
+ order : 'popular',
24
+ page : $( 'body' ).data( 'page' ),
25
+ per_page : 30,
26
+ callback : '',
27
+ pretty : true
28
+ },
29
+ canSave: false,
30
+ infiniteLoad: false,
31
+ uploader: {},
32
+ file: {},
33
+ frame: {},
34
+ isPreview: false,
35
+ apiStatus: true,
36
+ id : '',
37
+ isValidating: false,
38
+ scopeSet: false,
39
+
40
+ init: function() {
41
+ this._bind();
42
+ },
43
+
44
+ /**
45
+ * Binds events for the Astra Sites.
46
+ *
47
+ * @since 1.0.0
48
+ * @access private
49
+ * @method _bind
50
+ */
51
+ _bind: function() {
52
+
53
+ // Triggers.
54
+ $( document ).on( "ast-image__refresh", AstraImageCommon._initImages );
55
+ $( document ).on( "ast-image__set-scope", AstraImageCommon._setScope );
56
+ $( document ).on( "click", ".ast-image__list-img-overlay", AstraImageCommon._preview );
57
+ $( document ).on( "click", ".ast-image__go-back-text", AstraImageCommon._goBack );
58
+ $( document ).on( "click", ".ast-image__save", AstraImageCommon._save );
59
+ $( document ).on( "click", ".ast-image__filter-safesearch input", AstraImageCommon._filter );
60
+ $( document ).on( "change", ".ast-image__filter select", AstraImageCommon._filter );
61
+ $( document ).on( "click", ".ast-image__edit-api", AstraImageCommon._editAPI );
62
+ $( document ).on( "click", ".ast-image__browse-images", AstraImageCommon._browse );
63
+ $( document ).on( "click", ".ast-image__download-icon", AstraImageCommon._saveFromScreen );
64
+ },
65
+
66
+ _saveFromScreen: function() {
67
+
68
+ let saveIcon = $(this);
69
+ let source = saveIcon.closest('.ast-image__list-img-overlay');
70
+
71
+ saveIcon.addClass( 'installing' );
72
+
73
+ AstraImageCommon.image = {
74
+ 'largeImageURL': source.data( 'img-url' ),
75
+ 'tags' : source.find( 'span:first-child' ).html(),
76
+ 'id' : source.data( 'img-id' ),
77
+ };
78
+
79
+ AstraImageCommon._saveAjax( function ( data ) {
80
+ if ( undefined == data.data ) {
81
+ return;
82
+ }
83
+ astraImages.saved_images = data.data['updated-saved-images'];
84
+ wp.media.view.AstraAttachmentsBrowser.object.photoUploadComplete( data.data );
85
+ saveIcon.text( 'Done' );
86
+ saveIcon.removeClass( 'installing' );
87
+ AstraImageCommon._empty();
88
+ } );
89
+ },
90
+
91
+ _browse: function() {
92
+ $scope.find( '.ast-image__search' ).trigger( 'keyup' );
93
+ },
94
+
95
+ _editAPI: function( event ) {
96
+ event.stopPropagation();
97
+ wp.media.view.AstraAttachmentsBrowser.images = [];
98
+ $scope.find( '.ast-image__loader-wrap' ).show();
99
+ $scope.find( '.ast-image__skeleton' ).html( '' );
100
+ $scope.find( '.ast-image__skeleton' ).attr( 'style', '' );
101
+ $scope.find( '.ast-image__search' ).trigger( 'keyup' );
102
+ $scope.find( '.ast-image__loader-wrap' ).hide();
103
+ },
104
+
105
+ _filter: function() {
106
+ let safesearch = $scope.find( '.ast-image__filter-safesearch input:checked' ).length ? true : false;
107
+ let category = $scope.find( '.ast-image__filter-category select' ).val();
108
+ let orientation = $scope.find( '.ast-image__filter-orientation select' ).val();
109
+ let order = $scope.find( '.ast-image__filter-order select' ).val();
110
+
111
+ AstraImageCommon.config.safesearch = safesearch;
112
+ AstraImageCommon.config.orientation = orientation;
113
+ AstraImageCommon.config.category = category;
114
+ AstraImageCommon.config.order = order;
115
+
116
+ $scope.find( '.ast-image__search' ).trigger( 'keyup' );
117
+ $scope.find( '.ast-image__loader-wrap' ).show();
118
+ },
119
+
120
+ _save: function() {
121
+
122
+ if ( ! AstraImageCommon.canSave ) {
123
+ return;
124
+ }
125
+
126
+ let thisBtn = $( this )
127
+
128
+ if ( thisBtn.data( 'import-status' ) ) {
129
+ return;
130
+ }
131
+ thisBtn.removeClass( 'updating-message' );
132
+
133
+ thisBtn.text( astraImages.downloading );
134
+ thisBtn.addClass( 'installing' );
135
+
136
+ AstraImageCommon.canSave = false;
137
+
138
+ AstraImageCommon._saveAjax( function ( data ) {
139
+ if ( undefined == data.data ) {
140
+ return;
141
+ }
142
+ astraImages.saved_images = data.data['updated-saved-images'];
143
+ wp.media.view.AstraAttachmentsBrowser.object.photoUploadComplete( data.data );
144
+ thisBtn.text( 'Done' );
145
+ thisBtn.removeClass( 'installing' );
146
+ AstraImageCommon._empty();
147
+ } );
148
+
149
+ },
150
+
151
+ _saveAjax: function( callback ) {
152
+
153
+ // Work with JSON page here
154
+ $.ajax({
155
+ url: astraImages.ajaxurl,
156
+ type: 'POST',
157
+ dataType: 'json',
158
+ data: {
159
+ 'action' : 'astra-sites-create-image',
160
+ 'url' : AstraImageCommon.image.largeImageURL,
161
+ 'name' : AstraImageCommon.image.tags,
162
+ 'id' : AstraImageCommon.image.id,
163
+ '_ajax_nonce' : astraImages._ajax_nonce,
164
+ },
165
+ })
166
+ .fail(function( jqXHR ){
167
+ console.log( jqXHR );
168
+ })
169
+ .done( callback );
170
+ },
171
+
172
+ _empty: function() {
173
+
174
+ AstraImageCommon.image = {};
175
+ AstraImageCommon.canSave = false;
176
+ AstraImageCommon.uploader = {};
177
+ AstraImageCommon.file = {};
178
+ AstraImageCommon.isPreview = false;
179
+ },
180
+
181
+ _goBack: function() {
182
+
183
+ AstraImageCommon._empty();
184
+
185
+ $( document ).trigger( 'ast-image__refresh' );
186
+
187
+ $scope.find( '.ast-image__skeleton' ).show();
188
+ $scope.removeClass( 'preview-mode' );
189
+ $scope.find( '.ast-attachments-search-wrap' ).children().show();
190
+ $scope.find( '.ast-image__go-back' ).remove();
191
+ $scope.find( '.ast-image__save-wrap' ).remove();
192
+ $scope.find( '.ast-image__preview-skeleton' ).hide();
193
+ $scope.find( '.ast-image__preview-skeleton' ).html( '' );
194
+
195
+ let wrapHeight = ( AstraImageCommon.offset - 210 );
196
+ $scope.find( '.ast-image__skeleton-inner-wrap' ).css( 'height', wrapHeight );
197
+ },
198
+
199
+ _preview: function(event) {
200
+
201
+ if( event && event.target.classList.contains( 'ast-image__download-icon' ) ) {
202
+ return;
203
+ }
204
+
205
+ AstraImageCommon.isPreview = true;
206
+
207
+ let height = ( AstraImageCommon.offset - 190 );
208
+ $scope.find( '.ast-image__skeleton-inner-wrap' ).css( 'height', height );
209
+
210
+ setTimeout( function() {
211
+ $scope.find( '.ast-image__loader-wrap' ).hide();
212
+ }, 200 );
213
+
214
+ AstraImageCommon.image = {
215
+ 'largeImageURL': $( this ).data( 'img-url' ),
216
+ 'tags' : $( this ).find( 'span:first-child' ).html(),
217
+ 'id' : $( this ).data( 'img-id' ),
218
+ };
219
+
220
+ let preview = wp.template( 'ast-image-single' );
221
+ let single_html = preview( AstraImageCommon.image );
222
+
223
+ let save_btn = wp.template( 'ast-image-save' );
224
+ let single_btn = save_btn( AstraImageCommon.image );
225
+
226
+ let wrapHeight = $scope.find( '.ast-image__skeleton-inner-wrap' ).outerHeight();
227
+ wrapHeight = ( wrapHeight - 60 );
228
+
229
+ $scope.find( '.ast-image__skeleton' ).hide();
230
+ $scope.addClass( 'preview-mode' );
231
+ $scope.find( '.ast-attachments-search-wrap' ).children().hide();
232
+ $scope.find( '.ast-image__search-wrap' ).before( $( '#tmpl-ast-image-go-back' ).text() );
233
+ $scope.find( '.ast-image__search-wrap' ).after( single_btn );
234
+ $scope.find( '.ast-image__preview-skeleton' ).html( single_html );
235
+ $scope.find( '.ast-image__preview-skeleton' ).show();
236
+ $scope.find( '.single-site-preview' ).css( 'max-height', wrapHeight );
237
+
238
+ AstraImageCommon.canSave = true;
239
+ },
240
+
241
+ _setScope: function() {
242
+
243
+ AstraImageCommon.frame = wp.media.view.AstraAttachmentsBrowser.object.$el.closest( '.media-frame' );
244
+ $scope = AstraImageCommon.frame.find( '.ast-attachments-browser' );
245
+
246
+ if ( undefined == $scope ) {
247
+ return;
248
+ }
249
+
250
+ $( 'body' ).data( 'page', 1 );
251
+ let skeleton = $( '#tmpl-ast-image-skeleton' ).text();
252
+ $scope.append( skeleton );
253
+
254
+ let pixabay_filter = wp.template( 'ast-image-filters' );
255
+ if ( ! $scope.find( '.ast-image__filter-wrap' ).length ) {
256
+ $scope.find( '.ast-attachments-search-wrap' ).append( pixabay_filter() );
257
+ }
258
+
259
+ AstraImageCommon.offset = AstraImageCommon.frame.outerHeight();
260
+ let wrapHeight = ( AstraImageCommon.offset - 210 );
261
+ $scope.find( '.ast-image__skeleton-inner-wrap' ).css( 'height', wrapHeight );
262
+ $scope.find( '.ast-image__search' ).trigger( 'keyup' );
263
+ $scope.find( '.ast-image__loader-wrap' ).show();
264
+ $scope.find( '.ast-image__skeleton-inner-wrap' ).scroll( AstraImageCommon._loadMore );
265
+
266
+ AstraImageCommon.scopeSet = true;
267
+ },
268
+
269
+ _initImages: function() {
270
+
271
+ let loop = wp.template( 'ast-image-list' );
272
+ let list_html = loop( wp.media.view.AstraAttachmentsBrowser.images );
273
+ let container = document.querySelector( '.ast-image__skeleton' );
274
+ $scope.find( '.ast-image__loader-wrap' ).show();
275
+
276
+ if ( AstraImageCommon.infiniteLoad ) {
277
+ AstraImageCommon.images.push( wp.media.view.AstraAttachmentsBrowser.images );
278
+ $scope.find( '.ast-image__skeleton' ).append( list_html );
279
+ } else {
280
+ AstraImageCommon.images = wp.media.view.AstraAttachmentsBrowser.images;
281
+ $scope.find( '.ast-image__skeleton' ).html( list_html );
282
+ }
283
+ AstraImageCommon.loadingStatus = true;
284
+ if ( $scope.find( '.ast-image__list-wrap' ).length ) {
285
+ imagesLoaded( container, function() {
286
+ $scope.find( '.ast-image__list-wrap' ).each( function( index ) {
287
+ $( this ).removeClass( 'loading' );
288
+ $( this ).addClass( 'loaded' );
289
+ } );
290
+ $scope.find( '.ast-image__loader-wrap' ).hide();
291
+ });
292
+ } else {
293
+ $scope.find( '.ast-image__loader-wrap' ).hide();
294
+ }
295
+ },
296
+
297
+ _loadMore: function() {
298
+
299
+ if( AstraImageCommon.isPreview ) {
300
+ return;
301
+ }
302
+
303
+ let page = $( 'body' ).data( 'page' );
304
+ page = ( undefined == page ) ? 2 : ( page + 1 );
305
+
306
+ if ( undefined != $scope.find( '.ast-image__list-wrap:last' ).offset() ) {
307
+
308
+ if( ( $( window ).scrollTop() + AstraImageCommon.offset ) >= ( $scope.find( '.ast-image__list-wrap:last' ).offset().top ) ) {
309
+
310
+ if ( AstraImageCommon.loadingStatus ) {
311
+
312
+ $scope.find( '.ast-image__loader-wrap' ).show();
313
+
314
+ AstraImageCommon.loadingStatus = false;
315
+ AstraImageCommon.infiniteLoad = true;
316
+ AstraImageCommon.config.page = page;
317
+
318
+ $( 'body' ).data( 'page', page );
319
+
320
+ $scope.find( '.ast-image__search' ).trigger( 'infinite' );
321
+ }
322
+ }
323
+ }
324
+ },
325
+ };
326
+
327
+ /**
328
+ * Initialize AstraImageCommon
329
+ */
330
+ $( function(){
331
+
332
+ AstraImageCommon.init();
333
+
334
+ });
335
+
336
+ })(jQuery);
337
+
astra-sites/inc/assets/js/dist/main.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('wp-polyfill'), 'version' => '9ada9ad9a5d90598edbb917a8b41d4b7');
astra-sites/inc/assets/js/dist/main.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function a(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(i,n,function(t){return e[t]}.bind(null,n));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){e.exports=a(1)},function(e,t,a){!function(e){var t=function(){if(null!=wp&&wp.media){var e=jQuery,t=wp.media.view.MediaFrame.Post,i=wp.media.view.MediaFrame.Select;wp.media.view.AstraAttachmentsBrowser=a(2);var n={browseRouter:function(e){i.prototype.browseRouter.apply(this,arguments),e.set({astraimages:{text:astraImages.title,priority:70}})},bindHandlers:function(){astraImages.is_elementor_editor?t.prototype.bindHandlers.apply(this,arguments):i.prototype.bindHandlers.apply(this,arguments),this.on("content:create:astraimages",this.astraimages,this)},astraimages:function(t){var a=this.state(),i=new wp.media.view.AstraAttachmentsBrowser({controller:this,model:a,AttachmentView:a.get("AttachmentView")});t.view=i,wp.media.view.AstraAttachmentsBrowser.object=i,setTimeout((function(){e(document).trigger("ast-image__set-scope")}),100)}};astraImages.is_elementor_editor?wp.media.view.MediaFrame.Post=t.extend(n):wp.media.view.MediaFrame.Select=i.extend(n)}};e((function(){t(),astraImages.is_bb_active&&astraImages.is_bb_editor&&void 0!==FLBuilder&&null!==FLBuilder._singlePhotoSelector&&FLBuilder._singlePhotoSelector.on("open",(function(e){t()}))}))}(jQuery)},function(e,t,a){var i,n=wp.media.view.Frame;wp.media.view.AstraContent=a(3),i=n.extend({tagName:"div",className:"attachments-browser ast-attachments-browser",images:[],object:[],initialize:function(){_.defaults(this.options,{filters:!1,search:!0,date:!0,display:!1,sidebar:!0,AttachmentView:wp.media.view.Attachment.Library}),this.createContent()},createContent:function(){this.attachmentsHeading=new wp.media.view.Heading({text:astraImages.title,level:"h3",className:"ast-media-views-heading"}),this.views.add(new wp.media.view.AstraContent),this.$el.find(".ast-image__search").wrapAll('<div class="ast-image__search-wrap">').parent().html(),this.$el.find(".ast-image__search-wrap").append('<span class="ast-icon-search search-icon"></span>')},photoUploadComplete:function(e){e&&e.attachmentData&&(this.model.frame.content.mode("browse"),this.model.get("selection").add(e.attachmentData),this.model.frame.trigger("library:selection:add"),this.model.get("selection"),jQuery(".media-frame .media-button-select").click())}}),e.exports=i},function(e,t,a){wp.media.view.AstraSearch=a(4);var i=wp.media.View.extend({tagName:"div",className:"ast-attachments-search-wrap",initialize:function(){this.value=this.options.value},render:function(){var e=new wp.media.view.AstraSearch({controller:this.controller,model:this.model});return this.views.add(e),this}});e.exports=i},function(e,t){$=jQuery;var a=wp.Backbone.View.extend({tagName:"input",className:"ast-image__search",id:"ast-image-search-input",searching:!1,images:[],attributes:{placeholder:astraImages.search_placeholder,type:"search","aria-describedby":"live-search-desc"},events:{search:"search",keyup:"search",blur:"pushState",infinite:"infinite"},initialize:function(e){this.parent=e.parent},infinite:function(e){this.doSearch(e)},search:function(e){"keyup"===e.type&&27===e.which&&(e.target.value=""),""==e.target.value?this.$el.removeClass("has-input"):this.$el.addClass("has-input"),$scope.find(".ast-image__skeleton").animate({scrollTop:0},0),$("body").data("page",1),AstraImageCommon.infiniteLoad=!1;var t=this;setTimeout((function(){t.doSearch(e)}),1500)},doSearch:function(e){if(!this.searching){var t=this;t.searching=!0,AstraImageCommon.config.q=e.target.value,$.ajax({url:astraImages.ajaxurl,type:"POST",data:{action:"astra-sites-search-images",params:AstraImageCommon.config,_ajax_nonce:astraImages._ajax_nonce},beforeSend:function(){console.groupCollapsed("Requesting Pixabay API")}}).fail((function(e){console.log(e),console.groupEnd()})).done((function(e){console.log("Response:"),console.log(e),console.groupEnd(),e.success&&(t.searching=!1,this.images=e.data.hits,wp.media.view.AstraAttachmentsBrowser.images=this.images),$(document).trigger("ast-image__refresh")}))}},pushState:function(e){$(document).trigger("ast-image__refresh")}});e.exports=a}]);
astra-sites/inc/assets/js/elementor-admin-page.js ADDED
@@ -0,0 +1,1822 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * AJAX Request Queue
3
+ *
4
+ * - add()
5
+ * - remove()
6
+ * - run()
7
+ * - stop()
8
+ *
9
+ * @since 1.0.0
10
+ */
11
+ var AstraSitesAjaxQueue = (function () {
12
+
13
+ var requests = [];
14
+
15
+ return {
16
+
17
+ /**
18
+ * Add AJAX request
19
+ *
20
+ * @since 1.0.0
21
+ */
22
+ add: function (opt) {
23
+ requests.push(opt);
24
+ },
25
+
26
+ /**
27
+ * Remove AJAX request
28
+ *
29
+ * @since 1.0.0
30
+ */
31
+ remove: function (opt) {
32
+ if (jQuery.inArray(opt, requests) > -1)
33
+ requests.splice($.inArray(opt, requests), 1);
34
+ },
35
+
36
+ /**
37
+ * Run / Process AJAX request
38
+ *
39
+ * @since 1.0.0
40
+ */
41
+ run: function () {
42
+ var self = this,
43
+ oriSuc;
44
+
45
+ if (requests.length) {
46
+ oriSuc = requests[0].complete;
47
+
48
+ requests[0].complete = function () {
49
+ if (typeof (oriSuc) === 'function') oriSuc();
50
+ requests.shift();
51
+ self.run.apply(self, []);
52
+ };
53
+
54
+ jQuery.ajax(requests[0]);
55
+
56
+ } else {
57
+
58
+ self.tid = setTimeout(function () {
59
+ self.run.apply(self, []);
60
+ }, 1000);
61
+ }
62
+ },
63
+
64
+ /**
65
+ * Stop AJAX request
66
+ *
67
+ * @since 1.0.0
68
+ */
69
+ stop: function () {
70
+
71
+ requests = [];
72
+ clearTimeout(this.tid);
73
+ }
74
+ };
75
+
76
+ }());
77
+
78
+ (function ($) {
79
+
80
+ $elscope = {};
81
+
82
+ $.fn.isInViewport = function () {
83
+
84
+ // If not have the element then return false!
85
+ if (!$(this).length) {
86
+ return false;
87
+ }
88
+
89
+ var elementTop = $(this).offset().top;
90
+ var elementBottom = elementTop + $(this).outerHeight();
91
+ var viewportTop = $(window).scrollTop();
92
+ var viewportBottom = viewportTop + $(window).height();
93
+
94
+ return elementBottom > viewportTop && elementTop < viewportBottom;
95
+ };
96
+
97
+ AstraElementorSitesAdmin = {
98
+
99
+ visited_pages: [],
100
+ reset_remaining_posts: 0,
101
+ site_imported_data: null,
102
+ backup_taken: false,
103
+ templateData: {},
104
+ insertData: {},
105
+ log_file: '',
106
+ pages_list: '',
107
+ insertActionFlag: false,
108
+ page_id: 0,
109
+ site_id: 0,
110
+ block_id: 0,
111
+ requiredPlugins: [],
112
+ canImport: false,
113
+ canInsert: false,
114
+ type: 'pages',
115
+ action: '',
116
+ masonryObj: [],
117
+ index: 0,
118
+ blockCategory: '',
119
+ blockColor: '',
120
+ processing: false,
121
+ siteType: '',
122
+ page: 1,
123
+ per_page: 20,
124
+
125
+ init: function () {
126
+ this._bind();
127
+ },
128
+
129
+ /**
130
+ * Binds events for the Astra Sites.
131
+ *
132
+ * @since 1.0.0
133
+ * @access private
134
+ * @method _bind
135
+ */
136
+ _bind: function () {
137
+
138
+ if (elementorCommon) {
139
+
140
+ let add_section_tmpl = $("#tmpl-elementor-add-section");
141
+
142
+ if (add_section_tmpl.length > 0) {
143
+
144
+ let action_for_add_section = add_section_tmpl.text();
145
+ let white_label_class = '';
146
+ let stylesheet = '';
147
+ if (astraElementorSites.isWhiteLabeled) {
148
+ white_label_class = " ast-elementor-white-label"
149
+ stylesheet = '<style type="">.elementor-add-ast-site-button.ast-elementor-white-label .eicon-folder:before {content: \'' + astraElementorSites.plugin_name[0] + '\';}</style>'
150
+ }
151
+
152
+ action_for_add_section = action_for_add_section.replace('<div class="elementor-add-section-drag-title', stylesheet + '<div class="elementor-add-section-area-button elementor-add-ast-site-button ' + white_label_class + '" title="' + astraElementorSites.plugin_name + '"> <i class="eicon-folder"></i> </div><div class="elementor-add-section-drag-title');
153
+
154
+ add_section_tmpl.text(action_for_add_section);
155
+
156
+ elementor.on("preview:loaded", function () {
157
+
158
+ let base_skeleton = wp.template('ast-template-base-skeleton');
159
+ let header_template = $('#tmpl-ast-template-modal__header').text();
160
+
161
+ if ($('#ast-sites-modal').length == 0) {
162
+
163
+ $('body').append(base_skeleton());
164
+ $elscope = $('#ast-sites-modal');
165
+ $elscope.find('.astra-sites-content-wrap').before(header_template);
166
+ }
167
+
168
+ AstraElementorSitesAdmin._populate_color_filters();
169
+
170
+ $elscope.find('.astra-blocks-category').select2();
171
+
172
+ $elscope.find('.astra-blocks-category').on('select2:select', AstraElementorSitesAdmin._categoryChange);
173
+ $elscope.find('#elementor-template-block-color-filter select').on('change', AstraElementorSitesAdmin._blockColorChange);
174
+
175
+ $(elementor.$previewContents[0].body).on("click", ".elementor-add-ast-site-button", AstraElementorSitesAdmin._open);
176
+
177
+ // Click events.
178
+ $('body').on("click", ".ast-sites-modal__header__close", AstraElementorSitesAdmin._close);
179
+ $('body').on("click", "#ast-sites-modal .elementor-template-library-menu-item", AstraElementorSitesAdmin._libraryClick);
180
+ $('body').on("click", "#ast-sites-modal .theme-screenshot", AstraElementorSitesAdmin._preview);
181
+ $('body').on("click", "#ast-sites-modal .back-to-layout", AstraElementorSitesAdmin._goBack);
182
+ $('body').on("click", AstraElementorSitesAdmin._closeTooltip);
183
+
184
+ $(document).on("click", "#ast-sites-modal .ast-library-template-insert", AstraElementorSitesAdmin._insert);
185
+ $(document).on("click", ".ast-import-elementor-template", AstraElementorSitesAdmin._importTemplate);
186
+ $('body').on("click", "#ast-sites-modal .astra-sites-tooltip-icon", AstraElementorSitesAdmin._toggleTooltip);
187
+ $(document).on("click", ".elementor-template-library-menu-item", AstraElementorSitesAdmin._toggle);
188
+ $(document).on('click', '#ast-sites-modal .astra-sites__sync-wrap', AstraElementorSitesAdmin._sync);
189
+ $(document).on('click', '#ast-sites-modal .ast-sites-modal__header__logo, #ast-sites-modal .back-to-layout-button', AstraElementorSitesAdmin._home);
190
+ $(document).on('click', '#ast-sites-modal .notice-dismiss', AstraElementorSitesAdmin._dismiss);
191
+ $(document).on('click', '#ast-sites-modal .elementor-template-library-template-insert.ast-block-insert', AstraElementorSitesAdmin._insert_from_link);
192
+
193
+ // Other events.
194
+ $elscope.find('.astra-sites-content-wrap').scroll(AstraElementorSitesAdmin._loadLargeImages);
195
+ $(document).on('keyup input', '#ast-sites-modal #wp-filter-search-input', AstraElementorSitesAdmin._search);
196
+ $(document).on('change', '#ast-sites-modal .elementor-template-library-order-input', AstraElementorSitesAdmin._changeType);
197
+
198
+ // Triggers.
199
+ $(document).on("astra-sites__elementor-open-after", AstraElementorSitesAdmin._initSites);
200
+ $(document).on("astra-sites__elementor-open-before", AstraElementorSitesAdmin._beforeOpen);
201
+ $(document).on("astra-sites__elementor-plugin-check", AstraElementorSitesAdmin._pluginCheck);
202
+ $(document).on('astra-sites__elementor-close-before', AstraElementorSitesAdmin._beforeClose);
203
+
204
+ $(document).on('astra-sites__elementor-do-step-1', AstraElementorSitesAdmin._step1);
205
+ $(document).on('astra-sites__elementor-do-step-2', AstraElementorSitesAdmin._step2);
206
+
207
+ $(document).on('astra-sites__elementor-goback-step-1', AstraElementorSitesAdmin._goStep1);
208
+ $(document).on('astra-sites__elementor-goback-step-2', AstraElementorSitesAdmin._goStep2);
209
+
210
+ // Plugin install & activate.
211
+ $(document).on('wp-plugin-installing', AstraElementorSitesAdmin._pluginInstalling);
212
+ $(document).on('wp-plugin-install-error', AstraElementorSitesAdmin._installError);
213
+ $(document).on('wp-plugin-install-success', AstraElementorSitesAdmin._installSuccess);
214
+
215
+ });
216
+ }
217
+ }
218
+
219
+ },
220
+
221
+ _populate_color_filters: function() {
222
+
223
+ if( ! Object.keys( astraElementorSites.astra_blocks ).length ) {
224
+ return;
225
+ }
226
+
227
+ let template = wp.template('ast-template-block-color-filters');
228
+
229
+ var colorFilters = [];
230
+
231
+ for( block_id in astraElementorSites.astra_blocks ) {
232
+ if( astraElementorSites.astra_blocks[ block_id ]['filter'] && ! colorFilters.includes( astraElementorSites.astra_blocks[ block_id ]['filter'] )) {
233
+ colorFilters.push( astraElementorSites.astra_blocks[ block_id ]['filter'] );
234
+ }
235
+ }
236
+
237
+ if( colorFilters.length <= 1 ) {
238
+ return;
239
+ }
240
+
241
+ $( '#elementor-template-block-color-filter' ).show().html( template( colorFilters ) );
242
+
243
+ },
244
+
245
+ _paginateBlocks: function () {
246
+ if (AstraElementorSitesAdmin.type == 'blocks') {
247
+ if (undefined != $elscope.find('.astra-sites-library-template:last').offset()) {
248
+ if (($('.dialog-widget-content').scrollTop() + 600) >= ($elscope.find('.astra-sites-library-template:last').offset().top)) {
249
+ AstraElementorSitesAdmin.page = (AstraElementorSitesAdmin.page + 1);
250
+ // Set listing HTML.
251
+ AstraElementorSitesAdmin._appendPaginationBlocks(astraElementorSites.astra_blocks);
252
+ }
253
+ }
254
+ }
255
+ },
256
+
257
+ _changeType: function () {
258
+ AstraElementorSitesAdmin.siteType = $(this).val();
259
+ $elscope.find('#wp-filter-search-input').trigger('keyup');
260
+ },
261
+
262
+ _categoryChange: function (event) {
263
+ AstraElementorSitesAdmin.blockCategory = $(this).val();
264
+ $elscope.find('#wp-filter-search-input').trigger('keyup');
265
+ },
266
+
267
+ _blockColorChange: function (event) {
268
+ AstraElementorSitesAdmin.blockColor = $(this).val();
269
+ $elscope.find('#wp-filter-search-input').trigger('keyup');
270
+ },
271
+
272
+ _dismiss: function () {
273
+ $(this).closest('.ast-sites-floating-notice-wrap').removeClass('slide-in');
274
+ $(this).closest('.ast-sites-floating-notice-wrap').addClass('slide-out');
275
+
276
+ setTimeout(function () {
277
+ $(this).closest('.ast-sites-floating-notice-wrap').removeClass('slide-out');
278
+ }, 200);
279
+
280
+ if ($(this).closest('.ast-sites-floating-notice-wrap').hasClass('refreshed-notice')) {
281
+ $.ajax({
282
+ url: astraElementorSites.ajaxurl,
283
+ type: 'POST',
284
+ data: {
285
+ action: 'astra-sites-update-library-complete',
286
+ },
287
+ }).done(function (response) {
288
+ $('#ast-sites-floating-notice-wrap-id').toggle();
289
+ });
290
+
291
+ }
292
+ },
293
+
294
+ _done: function (data) {
295
+
296
+ console.groupEnd('Process Done.');
297
+
298
+ var str = (AstraElementorSitesAdmin.type == 'pages') ? astraElementorSites.template : astraElementorSites.block;
299
+ $elscope.find('.ast-import-elementor-template').removeClass('installing');
300
+ $elscope.find('.ast-import-elementor-template').attr('data-demo-link', data.data.link);
301
+ setTimeout(function () {
302
+ $elscope.find('.ast-import-elementor-template').text('View Saved ' + str);
303
+ $elscope.find('.ast-import-elementor-template').addClass('action-done');
304
+ }, 200);
305
+ },
306
+
307
+ _beforeClose: function () {
308
+ if (AstraElementorSitesAdmin.action == 'insert') {
309
+ $elscope.find('.ast-library-template-insert').removeClass('installing');
310
+ $elscope.find('.ast-library-template-insert').text('Imported');
311
+ $elscope.find('.ast-library-template-insert').addClass('action-done');
312
+
313
+ if ($elscope.find('.ast-sites-floating-notice-wrap').hasClass('slide-in')) {
314
+
315
+ $elscope.find('.ast-sites-floating-notice-wrap').removeClass('slide-in');
316
+ $elscope.find('.ast-sites-floating-notice-wrap').addClass('slide-out');
317
+
318
+ setTimeout(function () {
319
+ $elscope.find('.ast-sites-floating-notice-wrap').removeClass('slide-out');
320
+ }, 200);
321
+ }
322
+ }
323
+ },
324
+
325
+ _closeTooltip: function (event) {
326
+
327
+ if (
328
+ event.target.className !== "ast-tooltip-wrap" &&
329
+ event.target.className !== "dashicons dashicons-editor-help"
330
+ ) {
331
+ var wrap = $elscope.find('.ast-tooltip-wrap');
332
+ if (wrap.hasClass('ast-show-tooltip')) {
333
+ $elscope.find('.ast-tooltip-wrap').removeClass('ast-show-tooltip');
334
+ }
335
+ }
336
+ },
337
+
338
+ _sync: function (event) {
339
+
340
+ event.preventDefault();
341
+ var button = $(this).find('.astra-sites-sync-library-button');
342
+
343
+ if (button.hasClass('updating-message')) {
344
+ return;
345
+ }
346
+
347
+ button.addClass('updating-message');
348
+ $elscope.find('#ast-sites-floating-notice-wrap-id').show().removeClass('error');
349
+ $elscope.find('#ast-sites-floating-notice-wrap-id .ast-sites-floating-notice').html('<span class="message">Syncing template library in the background. The process can take anywhere between 2 to 3 minutes. We will notify you once done.<span><button type="button" class="notice-dismiss"><span class="screen-reader-text">' + astraElementorSites.dismiss_text + '</span></button>');
350
+ $elscope.find('#ast-sites-floating-notice-wrap-id').addClass('slide-in').removeClass('refreshed-notice');
351
+
352
+ $.ajax({
353
+ url: astraElementorSites.ajaxurl,
354
+ type: 'POST',
355
+ data: {
356
+ action: 'astra-sites-update-library',
357
+ },
358
+ })
359
+ .fail(function (jqXHR) {
360
+ console.log(jqXHR);
361
+ })
362
+ .done(function (response) {
363
+
364
+ if (response.success) {
365
+ if ('updated' === response.data) {
366
+ $elscope.find('#ast-sites-floating-notice-wrap-id').addClass('refreshed-notice').find('.ast-sites-floating-notice').html('<span class="message">' + astraElementorSites.syncCompleteMessage + '</span><button type="button" class="notice-dismiss"><span class="screen-reader-text">' + astraElementorSites.dismiss_text + '</span></button>');
367
+ button.removeClass('updating-message');
368
+ console.log('Already sync all the sites.');
369
+ } else {
370
+
371
+ // Import categories.
372
+ $.ajax({
373
+ url: astraElementorSites.ajaxurl,
374
+ type: 'POST',
375
+ data: {
376
+ action: 'astra-sites-import-all-categories-and-tags',
377
+ },
378
+ })
379
+ .fail(function (jqXHR) {
380
+ console.log(jqXHR);
381
+ });
382
+
383
+
384
+ // Import categories.
385
+ $.ajax({
386
+ url: astraElementorSites.ajaxurl,
387
+ type: 'POST',
388
+ data: {
389
+ action: 'astra-sites-import-all-categories',
390
+ },
391
+ })
392
+ .fail(function (jqXHR) {
393
+ console.log(jqXHR);
394
+ });
395
+
396
+ // Import Blocks.
397
+ $.ajax({
398
+ url: astraElementorSites.ajaxurl,
399
+ type: 'POST',
400
+ data: {
401
+ action: 'astra-sites-get-blocks-request-count',
402
+ },
403
+ beforeSend: function () {
404
+ console.groupCollapsed('Updating Blocks');
405
+ console.log('Updating Blocks');
406
+ },
407
+ })
408
+ .fail(function (jqXHR) {
409
+ console.log(jqXHR, 'error');
410
+ console.error(jqXHR.status + jqXHR.statusText, 'Blocks Count Request Failed!', jqXHR);
411
+ console.groupEnd('Updating Blocks');
412
+ })
413
+ .done(function (response) {
414
+ console.log(response);
415
+ if (response.success) {
416
+ var total = response.data;
417
+
418
+ for (let i = 1; i <= total; i++) {
419
+ AstraSitesAjaxQueue.add({
420
+ url: astraElementorSites.ajaxurl,
421
+ type: 'POST',
422
+ data: {
423
+ action: 'astra-sites-import-blocks',
424
+ page_no: i,
425
+ },
426
+ beforeSend: function () {
427
+ console.groupCollapsed('Importing Blocks - Page ' + i);
428
+ console.log('Importing Blocks - Page ' + i);
429
+ },
430
+ success: function (response) {
431
+ console.log(response);
432
+ console.groupEnd('Importing Blocks - Page ' + i);
433
+ }
434
+ });
435
+ }
436
+
437
+ // Run the AJAX queue.
438
+ AstraSitesAjaxQueue.run();
439
+ } else {
440
+ console.error(response.data, 'Blocks Count Request Failed!');
441
+ }
442
+ });
443
+
444
+ // Import Block Categories.
445
+ $.ajax({
446
+ url: astraElementorSites.ajaxurl,
447
+ type: 'POST',
448
+ data: {
449
+ action: 'astra-sites-import-block-categories',
450
+ },
451
+ })
452
+ .fail(function (jqXHR) {
453
+ console.log(jqXHR);
454
+ });
455
+
456
+ $.ajax({
457
+ url: astraElementorSites.ajaxurl,
458
+ type: 'POST',
459
+ data: {
460
+ action: 'astra-sites-get-sites-request-count',
461
+ },
462
+ })
463
+ .fail(function (jqXHR) {
464
+ console.log(jqXHR);
465
+ })
466
+ .done(function (response) {
467
+ if (response.success) {
468
+ var total = response.data;
469
+
470
+ for (let i = 1; i <= total; i++) {
471
+ AstraSitesAjaxQueue.add({
472
+ url: astraElementorSites.ajaxurl,
473
+ type: 'POST',
474
+ data: {
475
+ action: 'astra-sites-import-sites',
476
+ page_no: i,
477
+ },
478
+ success: function (result) {
479
+
480
+ if (i === total && astraElementorSites.syncCompleteMessage) {
481
+ button.removeClass('updating-message');
482
+ $elscope.find('#ast-sites-floating-notice-wrap-id').addClass('refreshed-notice').find('.ast-sites-floating-notice').html('<span class="message">' + astraElementorSites.syncCompleteMessage + '</span><button type="button" class="notice-dismiss"><span class="screen-reader-text">' + astraElementorSites.dismiss_text + '</span></button>');
483
+ }
484
+ }
485
+ });
486
+ }
487
+
488
+ // Run the AJAX queue.
489
+ AstraSitesAjaxQueue.run();
490
+ }
491
+ });
492
+ }
493
+ }
494
+ });
495
+ },
496
+
497
+ _toggleTooltip: function (e) {
498
+
499
+ var wrap = $elscope.find('.ast-tooltip-wrap');
500
+
501
+
502
+ if (wrap.hasClass('ast-show-tooltip')) {
503
+ $elscope.find('.ast-tooltip-wrap').removeClass('ast-show-tooltip');
504
+ } else {
505
+ $elscope.find('.ast-tooltip-wrap').addClass('ast-show-tooltip');
506
+ }
507
+ },
508
+
509
+ _toggle: function (e) {
510
+ $elscope.find('.elementor-template-library-menu-item').removeClass('elementor-active');
511
+
512
+ $elscope.find('.dialog-lightbox-content').hide();
513
+
514
+ $elscope.find('.theme-preview').hide();
515
+ $elscope.find('.theme-preview').html('');
516
+ $elscope.find('.theme-preview-block').hide();
517
+ $elscope.find('.theme-preview-block').html('');
518
+ $elscope.find('.ast-template-library-toolbar').show();
519
+
520
+ $elscope.find('.dialog-lightbox-content').hide();
521
+ $elscope.find('.dialog-lightbox-content-block').hide();
522
+
523
+ $(this).addClass('elementor-active');
524
+ let data_type = $(this).data('template-type');
525
+
526
+ AstraElementorSitesAdmin.type = data_type;
527
+ AstraElementorSitesAdmin._switchTo(data_type);
528
+ },
529
+
530
+ _home: function () {
531
+ if (AstraElementorSitesAdmin.processing) {
532
+ return;
533
+ }
534
+ $elscope.find('#wp-filter-search-input').val('');
535
+ // Hide Back button.
536
+ $elscope.find('.back-to-layout').css('visibility', 'hidden');
537
+ $elscope.find('.back-to-layout').css('opacity', '0');
538
+ $elscope.find('.elementor-template-library-menu-item:first-child').trigger('click');
539
+ },
540
+
541
+ _switchTo: function (type) {
542
+ if ('pages' == type) {
543
+ AstraElementorSitesAdmin._initSites();
544
+ $elscope.find('.dialog-lightbox-content').show();
545
+ $elscope.find('.astra-blocks-category-inner-wrap').hide();
546
+ $elscope.find('.astra-blocks-filter-inner-wrap').hide();
547
+ $elscope.find('.elementor-template-library-order').show();
548
+ } else {
549
+ AstraElementorSitesAdmin._initBlocks();
550
+ $elscope.find('.dialog-lightbox-content-block').show();
551
+ $elscope.find('.astra-blocks-category-inner-wrap').show();
552
+ $elscope.find('.astra-blocks-filter-inner-wrap').show();
553
+ $elscope.find('.elementor-template-library-order').hide();
554
+ }
555
+ $elscope.find('.astra-sites-content-wrap').trigger('scroll');
556
+ },
557
+
558
+ _importWPForm: function (wpforms_url, callback) {
559
+
560
+ if ( ! wpforms_url) {
561
+ if (callback && typeof callback == "function") {
562
+ callback('');
563
+ }
564
+ return;
565
+ }
566
+
567
+ $.ajax({
568
+ url: astraElementorSites.ajaxurl,
569
+ type: 'POST',
570
+ dataType: 'json',
571
+ data: {
572
+ action: 'astra-sites-import-wpforms',
573
+ wpforms_url: wpforms_url,
574
+ _ajax_nonce: astraElementorSites._ajax_nonce,
575
+ },
576
+ beforeSend: function () {
577
+ console.groupCollapsed('Importing WP Forms');
578
+ },
579
+ })
580
+ .fail(function (jqXHR) {
581
+ console.log(jqXHR.status + ' ' + jqXHR.responseText, true);
582
+ console.groupEnd();
583
+ })
584
+ .done(function (data) {
585
+
586
+ // 1. Fail - Import WPForms Options.
587
+ if (false === data.success) {
588
+ console.log(data.data);
589
+ console.groupEnd();
590
+ } else {
591
+ if (callback && typeof callback == "function") {
592
+ callback(data);
593
+ }
594
+ }
595
+ });
596
+ },
597
+
598
+ _createTemplate: function (data) {
599
+
600
+ console.groupEnd();
601
+
602
+ // Work with JSON page here
603
+ $.ajax({
604
+ url: astraElementorSites.ajaxurl,
605
+ type: 'POST',
606
+ dataType: 'json',
607
+ data: {
608
+ 'action': 'astra-sites-create-template',
609
+ 'data': data,
610
+ 'title': (AstraElementorSitesAdmin.type == 'pages') ? astraElementorSites.default_page_builder_sites[AstraElementorSitesAdmin.site_id]['title'] : '',
611
+ 'type': AstraElementorSitesAdmin.type,
612
+ '_ajax_nonce': astraElementorSites._ajax_nonce,
613
+ },
614
+ beforeSend: function () {
615
+ console.groupCollapsed('Creating Template');
616
+ }
617
+ })
618
+ .fail(function (jqXHR) {
619
+ console.log(jqXHR);
620
+ })
621
+ .done(function (data) {
622
+ AstraElementorSitesAdmin._done(data);
623
+ });
624
+ },
625
+
626
+ /**
627
+ * Install All Plugins.
628
+ */
629
+ _installAllPlugins: function (not_installed) {
630
+
631
+ $.each(not_installed, function (index, single_plugin) {
632
+
633
+ console.log('Installing Plugin - ' + single_plugin.name);
634
+
635
+ // Add each plugin activate request in Ajax queue.
636
+ // @see wp-admin/js/updates.js
637
+ wp.updates.queue.push({
638
+ action: 'install-plugin', // Required action.
639
+ data: {
640
+ slug: single_plugin.slug
641
+ }
642
+ });
643
+ });
644
+
645
+ // Required to set queue.
646
+ wp.updates.queueChecker();
647
+ },
648
+
649
+ /**
650
+ * Activate All Plugins.
651
+ */
652
+ _activateAllPlugins: function (activate_plugins) {
653
+
654
+ $.each(activate_plugins, function (index, single_plugin) {
655
+
656
+ console.log('Activating Plugin - ' + single_plugin.name);
657
+
658
+ AstraSitesAjaxQueue.add({
659
+ url: astraElementorSites.ajaxurl,
660
+ type: 'POST',
661
+ data: {
662
+ 'action': 'astra-required-plugin-activate',
663
+ 'init': single_plugin.init,
664
+ '_ajax_nonce': astraElementorSites._ajax_nonce,
665
+ },
666
+ success: function (result) {
667
+
668
+ if (result.success) {
669
+
670
+ var pluginsList = AstraElementorSitesAdmin.requiredPlugins.inactive;
671
+
672
+ // Reset not installed plugins list.
673
+ AstraElementorSitesAdmin.requiredPlugins.inactive = AstraElementorSitesAdmin._removePluginFromQueue(single_plugin.slug, pluginsList);
674
+
675
+ // Enable Demo Import Button
676
+ AstraElementorSitesAdmin._enableImport();
677
+ }
678
+ }
679
+ });
680
+ });
681
+ AstraSitesAjaxQueue.run();
682
+ },
683
+
684
+ /**
685
+ * Remove plugin from the queue.
686
+ */
687
+ _removePluginFromQueue: function (removeItem, pluginsList) {
688
+ return jQuery.grep(pluginsList, function (value) {
689
+ return value.slug != removeItem;
690
+ });
691
+ },
692
+
693
+ /**
694
+ * Get plugin from the queue.
695
+ */
696
+ _getPluginFromQueue: function (item, pluginsList) {
697
+
698
+ var match = '';
699
+ for (ind in pluginsList) {
700
+ if (item == pluginsList[ind].slug) {
701
+ match = pluginsList[ind];
702
+ }
703
+ }
704
+ return match;
705
+ },
706
+
707
+ _bulkPluginInstallActivate: function () {
708
+
709
+ console.groupCollapsed('Bulk Plugin Install Process Started');
710
+
711
+ // If has class the skip-plugins then,
712
+ // Avoid installing 3rd party plugins.
713
+ var not_installed = AstraElementorSitesAdmin.requiredPlugins.notinstalled || '';
714
+ var activate_plugins = AstraElementorSitesAdmin.requiredPlugins.inactive || '';
715
+
716
+ console.log(AstraElementorSitesAdmin.requiredPlugins);
717
+
718
+ // First Install Bulk.
719
+ if (not_installed.length > 0) {
720
+ AstraElementorSitesAdmin._installAllPlugins(not_installed);
721
+ }
722
+
723
+ // Second Activate Bulk.
724
+ if (activate_plugins.length > 0) {
725
+ AstraElementorSitesAdmin._activateAllPlugins(activate_plugins);
726
+ }
727
+
728
+ if (activate_plugins.length <= 0 && not_installed.length <= 0) {
729
+ AstraElementorSitesAdmin._enableImport();
730
+ }
731
+ },
732
+
733
+ _importTemplate: function (e) {
734
+
735
+ if (!AstraElementorSitesAdmin.canImport) {
736
+ if ($(this).attr('data-demo-link') != undefined) {
737
+ window.open($(this).attr('data-demo-link'), '_blank');
738
+ }
739
+ return;
740
+ }
741
+
742
+ AstraElementorSitesAdmin.canImport = false;
743
+
744
+ var str = (AstraElementorSitesAdmin.type == 'pages') ? astraElementorSites.template : astraElementorSites.block;
745
+
746
+ $(this).addClass('installing');
747
+ $(this).text('Saving ' + str + '...');
748
+
749
+ AstraElementorSitesAdmin.action = 'import';
750
+
751
+ AstraElementorSitesAdmin._bulkPluginInstallActivate();
752
+ },
753
+
754
+ _unescape: function (input_string) {
755
+ var title = _.unescape(input_string);
756
+
757
+ // @todo check why below character not escape with function _.unescape();
758
+ title = title.replace('&#8211;', '-');
759
+
760
+ return title;
761
+ },
762
+
763
+ _unescape_lower: function (input_string) {
764
+ input_string = $("<textarea/>").html(input_string).text()
765
+ var input_string = AstraElementorSitesAdmin._unescape(input_string);
766
+ return input_string.toLowerCase();
767
+ },
768
+
769
+ _search: function () {
770
+
771
+ let search_term = $(this).val() || '';
772
+ search_term = search_term.toLowerCase();
773
+
774
+ if ('pages' == AstraElementorSitesAdmin.type) {
775
+
776
+ var items = AstraElementorSitesAdmin._getSearchedPages(search_term);
777
+
778
+ if (search_term.length) {
779
+ $(this).addClass('has-input');
780
+ AstraElementorSitesAdmin._addSites(items);
781
+ } else {
782
+ $(this).removeClass('has-input');
783
+ AstraElementorSitesAdmin._appendSites(astraElementorSites.default_page_builder_sites);
784
+ }
785
+ } else {
786
+
787
+ var items = AstraElementorSitesAdmin._getSearchedBlocks(search_term);
788
+
789
+ if (search_term.length) {
790
+ $(this).addClass('has-input');
791
+ AstraElementorSitesAdmin._appendBlocks(items);
792
+ } else {
793
+ $(this).removeClass('has-input');
794
+ AstraElementorSitesAdmin._appendBlocks(astraElementorSites.astra_blocks);
795
+ }
796
+ }
797
+ },
798
+
799
+ _getSearchedPages: function (search_term) {
800
+ var items = [];
801
+ search_term = search_term.toLowerCase();
802
+
803
+ for (site_id in astraElementorSites.default_page_builder_sites) {
804
+
805
+ var current_site = astraElementorSites.default_page_builder_sites[site_id];
806
+
807
+ // Check in site title.
808
+ if (current_site['title']) {
809
+ var site_title = AstraElementorSitesAdmin._unescape_lower(current_site['title']);
810
+
811
+ if (site_title.toLowerCase().includes(search_term)) {
812
+
813
+ for (page_id in current_site['pages']) {
814
+
815
+ items[page_id] = current_site['pages'][page_id];
816
+ items[page_id]['type'] = 'page';
817
+ items[page_id]['site_id'] = site_id;
818
+ items[page_id]['astra-sites-type'] = current_site['astra-sites-type'] || '';
819
+ items[page_id]['parent-site-name'] = current_site['title'] || '';
820
+ items[page_id]['pages-count'] = 0;
821
+ }
822
+ }
823
+ }
824
+
825
+ // Check in page title.
826
+ if (Object.keys(current_site['pages']).length) {
827
+ var pages = current_site['pages'];
828
+
829
+ for (page_id in pages) {
830
+
831
+ // Check in site title.
832
+ if (pages[page_id]['title']) {
833
+
834
+ var page_title = AstraElementorSitesAdmin._unescape_lower(pages[page_id]['title']);
835
+
836
+ if (page_title.toLowerCase().includes(search_term)) {
837
+ items[page_id] = pages[page_id];
838
+ items[page_id]['type'] = 'page';
839
+ items[page_id]['site_id'] = site_id;
840
+ items[page_id]['astra-sites-type'] = current_site['astra-sites-type'] || '';
841
+ items[page_id]['parent-site-name'] = current_site['title'] || '';
842
+ items[page_id]['pages-count'] = 0;
843
+ }
844
+ }
845
+
846
+ }
847
+ }
848
+ }
849
+
850
+ return items;
851
+ },
852
+
853
+ _getSearchedBlocks: function (search_term) {
854
+
855
+ var items = [];
856
+
857
+ if (search_term.length) {
858
+
859
+ for (block_id in astraElementorSites.astra_blocks) {
860
+
861
+ var current_site = astraElementorSites.astra_blocks[block_id];
862
+
863
+ // Check in site title.
864
+ if (current_site['title']) {
865
+ var site_title = AstraElementorSitesAdmin._unescape_lower(current_site['title']);
866
+
867
+ if (site_title.toLowerCase().includes(search_term)) {
868
+ items[block_id] = current_site;
869
+ items[block_id]['type'] = 'site';
870
+ items[block_id]['site_id'] = block_id;
871
+ }
872
+ }
873
+
874
+ }
875
+ }
876
+
877
+ return items;
878
+ },
879
+
880
+ _addSites: function (data) {
881
+
882
+ if (data) {
883
+ let single_template = wp.template('astra-sites-search');
884
+ pages_list = single_template(data);
885
+ $elscope.find('.dialog-lightbox-content').html(pages_list);
886
+ AstraElementorSitesAdmin._loadLargeImages();
887
+
888
+ } else {
889
+ $elscope.find('.dialog-lightbox-content').html(wp.template('astra-sites-no-sites'));
890
+ }
891
+ },
892
+
893
+ _appendSites: function (data) {
894
+
895
+ let single_template = wp.template('astra-sites-list');
896
+ pages_list = single_template(data);
897
+ $elscope.find('.dialog-lightbox-message-block').hide();
898
+ $elscope.find('.dialog-lightbox-message').show();
899
+ $elscope.find('.dialog-lightbox-content').html(pages_list);
900
+ AstraElementorSitesAdmin._loadLargeImages();
901
+ },
902
+
903
+ _appendBlocks: function (data) {
904
+
905
+ let single_template = wp.template('astra-blocks-list');
906
+ let blocks_list = single_template(data);
907
+ $elscope.find('.dialog-lightbox-message').hide();
908
+ $elscope.find('.dialog-lightbox-message-block').show();
909
+ $elscope.find('.dialog-lightbox-content-block').html(blocks_list);
910
+ AstraElementorSitesAdmin._masonry();
911
+ },
912
+
913
+ _appendPaginationBlocks: function (data) {
914
+
915
+ let single_template = wp.template('astra-blocks-list');
916
+ let blocks_list = single_template(data);
917
+ $elscope.find('.dialog-lightbox-message').hide();
918
+ $elscope.find('.dialog-lightbox-message-block').show();
919
+ $elscope.find('.dialog-lightbox-content-block').append(blocks_list);
920
+ AstraElementorSitesAdmin._masonry();
921
+ },
922
+
923
+ _masonry: function () {
924
+
925
+ //create empty var masonryObj
926
+ var masonryObj;
927
+ var container = document.querySelector('.dialog-lightbox-content-block');
928
+ // initialize Masonry after all images have loaded
929
+ imagesLoaded(container, function () {
930
+ masonryObj = new Masonry(container, {
931
+ itemSelector: '.astra-sites-library-template'
932
+ });
933
+ });
934
+ },
935
+
936
+ _enableImport: function () {
937
+
938
+ console.log('Required Plugins Process Done.');
939
+ console.groupEnd();
940
+
941
+ if ('pages' == AstraElementorSitesAdmin.type) {
942
+
943
+ AstraElementorSitesAdmin._importWPForm(AstraElementorSitesAdmin.templateData['astra-site-wpforms-path'], function (form_response) {
944
+
945
+ $.ajax({
946
+ url: astraElementorSites.ajaxurl,
947
+ type: 'POST',
948
+ data: {
949
+ action: 'astra-sites-remote-request',
950
+ url: AstraElementorSitesAdmin.templateData['astra-page-api-url'],
951
+ _ajax_nonce: astraElementorSites._ajax_nonce,
952
+ },
953
+ beforeSend: function () {
954
+ console.groupCollapsed('Get Template Details.');
955
+ },
956
+ })
957
+ .fail(function (jqXHR) {
958
+ console.log(jqXHR);
959
+ console.groupEnd();
960
+ })
961
+ .done(function (response) {
962
+ console.log( response );
963
+ console.groupEnd();
964
+
965
+ if( response.success ) {
966
+ AstraElementorSitesAdmin.insertData = response.data;
967
+ if ('insert' == AstraElementorSitesAdmin.action) {
968
+ AstraElementorSitesAdmin._insertDemo(response.data);
969
+ } else {
970
+ AstraElementorSitesAdmin._createTemplate(response.data);
971
+ }
972
+ }
973
+ });
974
+ });
975
+
976
+ } else {
977
+
978
+ let url = (undefined != AstraElementorSitesAdmin.templateData['post-meta']) ? AstraElementorSitesAdmin.templateData['post-meta']['astra-site-wpforms-path'] : '';
979
+
980
+ AstraElementorSitesAdmin._importWPForm(url, function (form_response) {
981
+ AstraElementorSitesAdmin.insertData = AstraElementorSitesAdmin.templateData;
982
+ if ('insert' == AstraElementorSitesAdmin.action) {
983
+ AstraElementorSitesAdmin._insertDemo(AstraElementorSitesAdmin.templateData);
984
+ } else {
985
+ AstraElementorSitesAdmin._createTemplate(AstraElementorSitesAdmin.templateData);
986
+ }
987
+ });
988
+
989
+
990
+ }
991
+ },
992
+
993
+ _insert_from_link: function (e) {
994
+
995
+ if (AstraElementorSitesAdmin.processing) {
996
+ return;
997
+ }
998
+
999
+ AstraElementorSitesAdmin.processing = true;
1000
+
1001
+ $elscope.find('.astra-sites-content-wrap').addClass('processing');
1002
+
1003
+ console.groupCollapsed('Inserting Demo.');
1004
+
1005
+ $(this).find('.elementor-button-title').text('Processing..');
1006
+
1007
+ AstraElementorSitesAdmin.page_id = $(this).closest('.astra-theme').data('template-id');
1008
+ AstraElementorSitesAdmin.block_id = $(this).closest('.astra-theme').data('block-id');
1009
+
1010
+ let actual_id = 0;
1011
+ AstraElementorSitesAdmin.canInsert = true;
1012
+
1013
+ if (AstraElementorSitesAdmin.type == 'pages') {
1014
+ actual_id = AstraElementorSitesAdmin.page_id.replace('id-', '');
1015
+ } else {
1016
+ actual_id = AstraElementorSitesAdmin.block_id.replace('id-', '');
1017
+ }
1018
+
1019
+ if (0 != actual_id) {
1020
+
1021
+ console.log('Checking Required Plugin status.');
1022
+
1023
+ var api_post = {
1024
+ slug: 'site-pages' + '/' + actual_id
1025
+ };
1026
+
1027
+ if ('blocks' == AstraElementorSitesAdmin.type) {
1028
+ api_post = {
1029
+ slug: 'astra-blocks' + '/' + actual_id
1030
+ };
1031
+ }
1032
+
1033
+ var params = {
1034
+ method: 'GET',
1035
+ cache: 'default',
1036
+ };
1037
+
1038
+ fetch(astraElementorSites.ApiURL + api_post.slug, params).then(response => {
1039
+ if (response.status === 200) {
1040
+ return response.json().then(items => ({
1041
+ items: items,
1042
+ items_count: response.headers.get('x-wp-total'),
1043
+ item_pages: response.headers.get('x-wp-totalpages'),
1044
+ }))
1045
+ } else {
1046
+ return response.json();
1047
+ }
1048
+ })
1049
+ .then(data => {
1050
+ if ('object' === typeof data) {
1051
+ if (undefined !== data && undefined !== data['items']) {
1052
+ AstraElementorSitesAdmin.templateData = data['items'];
1053
+ let requiredPlugins = [];
1054
+ if (AstraElementorSitesAdmin.type == 'pages') {
1055
+
1056
+ if (undefined !== AstraElementorSitesAdmin.templateData['site-pages-required-plugins']) {
1057
+ requiredPlugins = AstraElementorSitesAdmin.templateData['site-pages-required-plugins'];
1058
+ }
1059
+ } else {
1060
+ if (undefined !== AstraElementorSitesAdmin.templateData['post-meta']['astra-blocks-required-plugins']) {
1061
+ requiredPlugins = AstraElementorSitesAdmin.templateData['post-meta']['astra-blocks-required-plugins'];
1062
+ }
1063
+ }
1064
+ if (undefined != requiredPlugins && null != requiredPlugins && requiredPlugins.length > 0) {
1065
+
1066
+ $.ajax({
1067
+ url: astraElementorSites.ajaxurl,
1068
+ type: 'POST',
1069
+ data: {
1070
+ action: 'astra-required-plugins',
1071
+ _ajax_nonce: astraElementorSites._ajax_nonce,
1072
+ required_plugins: requiredPlugins
1073
+ },
1074
+ })
1075
+ .fail(function (jqXHR) {
1076
+ console.log(jqXHR);
1077
+ console.groupEnd();
1078
+ })
1079
+ .done(function (response) {
1080
+ AstraElementorSitesAdmin.requiredPlugins = response.data['required_plugins'];
1081
+ AstraElementorSitesAdmin.canImport = true;
1082
+ AstraElementorSitesAdmin.canInsert = true;
1083
+ });
1084
+ }
1085
+ }
1086
+ }
1087
+
1088
+ console.log('Insert Process for Demo "' + actual_id + '" has started.');
1089
+
1090
+ AstraElementorSitesAdmin.canInsert = false;
1091
+ AstraElementorSitesAdmin.action = 'insert';
1092
+ AstraElementorSitesAdmin._bulkPluginInstallActivate();
1093
+ });
1094
+
1095
+ } else {
1096
+ AstraElementorSitesAdmin.canInsert = true;
1097
+ AstraElementorSitesAdmin.processing = false;
1098
+ $elscope.find('.astra-sites-content-wrap').removeClass('processing');
1099
+ console.log('Import Failed. Error: Incorrect Import ID');
1100
+ $(this).find('.elementor-button-title').text('Insert');
1101
+ }
1102
+
1103
+ },
1104
+
1105
+ _insert: function (e) {
1106
+
1107
+ if (!AstraElementorSitesAdmin.canInsert) {
1108
+ return;
1109
+ }
1110
+
1111
+ AstraElementorSitesAdmin.canInsert = false;
1112
+ var str = (AstraElementorSitesAdmin.type == 'pages') ? astraElementorSites.template : astraElementorSites.block;
1113
+
1114
+ $(this).addClass('installing');
1115
+ $(this).text('Importing ' + str + '...');
1116
+
1117
+ AstraElementorSitesAdmin.action = 'insert';
1118
+
1119
+ AstraElementorSitesAdmin._bulkPluginInstallActivate();
1120
+ },
1121
+
1122
+ _insertDemo: function (data) {
1123
+
1124
+ if (undefined !== data && undefined !== data['post-meta']['_elementor_data']) {
1125
+
1126
+ let templateModel = new Backbone.Model({
1127
+ getTitle() {
1128
+ return data['title']
1129
+ },
1130
+ });
1131
+ let page_content = JSON.parse(data['post-meta']['_elementor_data']);
1132
+ let page_settings = '';
1133
+ let api_url = '';
1134
+
1135
+ if ('blocks' == AstraElementorSitesAdmin.type) {
1136
+ api_url = astraElementorSites.ApiURL + 'astra-blocks/' + data['id'] + '/';
1137
+ } else {
1138
+ api_url = AstraElementorSitesAdmin.templateData['astra-page-api-url'] + '/';
1139
+ }
1140
+
1141
+ $.ajax({
1142
+ url: astraElementorSites.ajaxurl,
1143
+ type: 'POST',
1144
+ data: {
1145
+ action: 'astra-page-elementor-batch-process',
1146
+ id: elementor.config.document.id,
1147
+ url: api_url,
1148
+ _ajax_nonce: astraElementorSites._ajax_nonce,
1149
+ },
1150
+ beforeSend: function () {
1151
+ console.groupCollapsed('Inserting Demo.');
1152
+ },
1153
+ })
1154
+ .fail(function (jqXHR) {
1155
+ console.log(jqXHR);
1156
+ console.groupEnd();
1157
+ })
1158
+ .done(function (response) {
1159
+
1160
+ AstraElementorSitesAdmin.processing = false;
1161
+ $elscope.find('.astra-sites-content-wrap').removeClass('processing');
1162
+
1163
+ page_content = response.data;
1164
+
1165
+ page_content = page_content.map(function (item) {
1166
+ item.id = Math.random().toString(36).substr(2, 7);
1167
+ return item;
1168
+ });
1169
+
1170
+ console.log(page_content);
1171
+ console.groupEnd();
1172
+ if (undefined !== page_content && '' !== page_content) {
1173
+ if (undefined != $e && 'undefined' != typeof $e.internal) {
1174
+ elementor.channels.data.trigger('document/import', templateModel);
1175
+ elementor.getPreviewView().addChildModel(page_content, { at: AstraElementorSitesAdmin.index } || {});
1176
+ elementor.channels.data.trigger('template:after:insert', {});
1177
+ $e.internal('document/save/set-is-modified', { status: true })
1178
+ } else {
1179
+ elementor.channels.data.trigger('document/import', templateModel);
1180
+ elementor.getPreviewView().addChildModel(page_content, { at: AstraElementorSitesAdmin.index } || {});
1181
+ elementor.channels.data.trigger('template:after:insert', {});
1182
+ elementor.saver.setFlagEditorChange(true);
1183
+ }
1184
+ }
1185
+ AstraElementorSitesAdmin.insertActionFlag = true;
1186
+ AstraElementorSitesAdmin._close();
1187
+ });
1188
+ }
1189
+ },
1190
+
1191
+ _goBack: function (e) {
1192
+
1193
+ if (AstraElementorSitesAdmin.processing) {
1194
+ return;
1195
+ }
1196
+
1197
+ let step = $(this).attr('data-step');
1198
+
1199
+ $elscope.find('#ast-sites-floating-notice-wrap-id.error').hide();
1200
+
1201
+ $elscope.find('.astra-sites-step-1-wrap').show();
1202
+ $elscope.find('.astra-preview-actions-wrap').remove();
1203
+
1204
+ $elscope.find('.ast-template-library-toolbar').show();
1205
+ $elscope.find('.ast-sites-modal__header').removeClass('ast-preview-mode');
1206
+
1207
+ if ('pages' == AstraElementorSitesAdmin.type) {
1208
+
1209
+ if (3 == step) {
1210
+ $(this).attr('data-step', 2);
1211
+ $(document).trigger('astra-sites__elementor-goback-step-2');
1212
+ } else if (2 == step) {
1213
+ $(this).attr('data-step', 1);
1214
+ $(document).trigger('astra-sites__elementor-goback-step-1');
1215
+ }
1216
+ } else {
1217
+ $(this).attr('data-step', 1);
1218
+ $(document).trigger('astra-sites__elementor-goback-step-1');
1219
+ }
1220
+
1221
+ $elscope.find('.astra-sites-content-wrap').trigger('scroll');
1222
+ },
1223
+
1224
+ _goStep1: function (e) {
1225
+
1226
+
1227
+ // Reset site and page ids to null.
1228
+ AstraElementorSitesAdmin.site_id = '';
1229
+ AstraElementorSitesAdmin.page_id = '';
1230
+ AstraElementorSitesAdmin.block_id = '';
1231
+ AstraElementorSitesAdmin.requiredPlugins = [];
1232
+ AstraElementorSitesAdmin.templateData = {};
1233
+ AstraElementorSitesAdmin.canImport = false;
1234
+ AstraElementorSitesAdmin.canInsert = false;
1235
+
1236
+ // Hide Back button.
1237
+ $elscope.find('.back-to-layout').css('visibility', 'hidden');
1238
+ $elscope.find('.back-to-layout').css('opacity', '0');
1239
+
1240
+ // Hide Preview Page.
1241
+ $elscope.find('.theme-preview').hide();
1242
+ $elscope.find('.theme-preview').html('');
1243
+ $elscope.find('.theme-preview-block').hide();
1244
+ $elscope.find('.theme-preview-block').html('');
1245
+ $elscope.find('.ast-template-library-toolbar').show();
1246
+
1247
+ // Show listing page.
1248
+ if (AstraElementorSitesAdmin.type == 'pages') {
1249
+
1250
+ $elscope.find('.dialog-lightbox-content').show();
1251
+ $elscope.find('.dialog-lightbox-content-block').hide();
1252
+
1253
+ // Set listing HTML.
1254
+ AstraElementorSitesAdmin._appendSites(astraElementorSites.default_page_builder_sites);
1255
+ } else {
1256
+
1257
+ // Set listing HTML.
1258
+ AstraElementorSitesAdmin._appendBlocks(astraElementorSites.astra_blocks);
1259
+
1260
+ $elscope.find('.dialog-lightbox-content-block').show();
1261
+ $elscope.find('.dialog-lightbox-content').hide();
1262
+
1263
+ if ('' !== $elscope.find('#wp-filter-search-input').val()) {
1264
+ $elscope.find('#wp-filter-search-input').trigger('keyup');
1265
+ }
1266
+ }
1267
+ },
1268
+
1269
+ _goStep2: function (e) {
1270
+
1271
+ // Set page and site ids.
1272
+ AstraElementorSitesAdmin.site_id = $elscope.find('#astra-blocks').data('site-id');
1273
+ AstraElementorSitesAdmin.page_id = '';
1274
+
1275
+ if (undefined === AstraElementorSitesAdmin.site_id) {
1276
+ return;
1277
+ }
1278
+
1279
+ // Single Preview template.
1280
+ let single_template = wp.template('astra-sites-list-search');
1281
+ let passing_data = astraElementorSites.default_page_builder_sites[AstraElementorSitesAdmin.site_id]['pages'];
1282
+ passing_data['site_id'] = AstraElementorSitesAdmin.site_id;
1283
+ pages_list = single_template(passing_data);
1284
+ $elscope.find('.dialog-lightbox-content').html(pages_list);
1285
+
1286
+ // Hide Preview page.
1287
+ $elscope.find('.theme-preview').hide();
1288
+ $elscope.find('.theme-preview').html('');
1289
+ $elscope.find('.ast-template-library-toolbar').show();
1290
+ $elscope.find('.theme-preview-block').hide();
1291
+ $elscope.find('.theme-preview-block').html('');
1292
+
1293
+ // Show listing page.
1294
+ $elscope.find('.dialog-lightbox-content').show();
1295
+ $elscope.find('.dialog-lightbox-content-block').hide();
1296
+
1297
+ AstraElementorSitesAdmin._loadLargeImages();
1298
+
1299
+ if ('' !== $elscope.find('#wp-filter-search-input').val()) {
1300
+ $elscope.find('#wp-filter-search-input').trigger('keyup');
1301
+ }
1302
+ },
1303
+
1304
+ _step1: function (e) {
1305
+
1306
+ if ('pages' == AstraElementorSitesAdmin.type) {
1307
+
1308
+ let passing_data = astraElementorSites.default_page_builder_sites[AstraElementorSitesAdmin.site_id]['pages'];
1309
+
1310
+ var count = 0;
1311
+ var one_page = [];
1312
+ var one_page_id = '';
1313
+
1314
+ for (key in passing_data) {
1315
+ if (undefined == passing_data[key]['site-pages-type']) {
1316
+ continue;
1317
+ }
1318
+ if ('gutenberg' == passing_data[key]['site-pages-page-builder']) {
1319
+ continue;
1320
+ }
1321
+ count++;
1322
+ one_page = passing_data[key];
1323
+ one_page_id = key;
1324
+ }
1325
+
1326
+ if (count == 1) {
1327
+
1328
+ // Logic for one page sites.
1329
+ AstraElementorSitesAdmin.page_id = one_page_id;
1330
+
1331
+ $elscope.find('.back-to-layout').css('visibility', 'visible');
1332
+ $elscope.find('.back-to-layout').css('opacity', '1');
1333
+
1334
+ $elscope.find('.back-to-layout').attr('data-step', 2);
1335
+ $(document).trigger('astra-sites__elementor-do-step-2');
1336
+
1337
+ return;
1338
+ }
1339
+
1340
+
1341
+ let single_template = wp.template('astra-sites-list-search');
1342
+ passing_data['site_id'] = AstraElementorSitesAdmin.site_id;
1343
+ pages_list = single_template(passing_data);
1344
+ $elscope.find('.dialog-lightbox-content-block').hide();
1345
+ $elscope.find('.astra-sites-step-1-wrap').show();
1346
+ $elscope.find('.astra-preview-actions-wrap').remove();
1347
+ $elscope.find('.theme-preview').hide();
1348
+ $elscope.find('.theme-preview').html('');
1349
+ $elscope.find('.ast-template-library-toolbar').show();
1350
+ $elscope.find('.theme-preview-block').hide();
1351
+ $elscope.find('.theme-preview-block').html('');
1352
+ $elscope.find('.dialog-lightbox-content').show();
1353
+ $elscope.find('.dialog-lightbox-content').html(pages_list);
1354
+
1355
+ AstraElementorSitesAdmin._loadLargeImages();
1356
+
1357
+ } else {
1358
+
1359
+ $elscope.find('.dialog-lightbox-content').hide();
1360
+ $elscope.find('.dialog-lightbox-content-block').hide();
1361
+ $elscope.find('.dialog-lightbox-message').animate({ scrollTop: 0 }, 50);
1362
+ $elscope.find('.theme-preview-block').show();
1363
+ $elscope.find('.ast-template-library-toolbar').hide();
1364
+ $elscope.find('.ast-sites-modal__header').addClass('ast-preview-mode');
1365
+
1366
+ // Hide.
1367
+ $elscope.find('.theme-preview').hide();
1368
+ $elscope.find('.theme-preview').html('');
1369
+
1370
+ let import_template = wp.template('astra-sites-elementor-preview');
1371
+ let import_template_header = wp.template('astra-sites-elementor-preview-actions');
1372
+ let template_object = astraElementorSites.astra_blocks[AstraElementorSitesAdmin.block_id];
1373
+
1374
+ template_object['id'] = AstraElementorSitesAdmin.block_id;
1375
+
1376
+ preview_page_html = import_template(template_object);
1377
+ $elscope.find('.theme-preview-block').html(preview_page_html);
1378
+
1379
+ $elscope.find('.astra-sites-step-1-wrap').hide();
1380
+
1381
+ preview_action_html = import_template_header(template_object);
1382
+ $elscope.find('.elementor-templates-modal__header__items-area').append(preview_action_html);
1383
+ AstraElementorSitesAdmin._masonry();
1384
+
1385
+ let actual_id = AstraElementorSitesAdmin.block_id.replace('id-', '');
1386
+ $(document).trigger('astra-sites__elementor-plugin-check', { 'id': actual_id });
1387
+ }
1388
+ },
1389
+
1390
+ _step2: function (e) {
1391
+
1392
+ $elscope.find('.dialog-lightbox-content').hide();
1393
+ $elscope.find('.dialog-lightbox-message').animate({ scrollTop: 0 }, 50);
1394
+ $elscope.find('.theme-preview').show();
1395
+
1396
+ $elscope.find('.ast-sites-modal__header').addClass('ast-preview-mode');
1397
+
1398
+ if (undefined === AstraElementorSitesAdmin.site_id) {
1399
+ return;
1400
+ }
1401
+
1402
+ let import_template = wp.template('astra-sites-elementor-preview');
1403
+ let import_template_header = wp.template('astra-sites-elementor-preview-actions');
1404
+ let template_object = astraElementorSites.default_page_builder_sites[AstraElementorSitesAdmin.site_id]['pages'][AstraElementorSitesAdmin.page_id];
1405
+
1406
+ if (undefined === template_object) {
1407
+ return;
1408
+ }
1409
+
1410
+ template_object['id'] = AstraElementorSitesAdmin.site_id;
1411
+
1412
+ preview_page_html = import_template(template_object);
1413
+ $elscope.find('.theme-preview').html(preview_page_html);
1414
+
1415
+ $elscope.find('.astra-sites-step-1-wrap').hide();
1416
+
1417
+ preview_action_html = import_template_header(template_object);
1418
+ $elscope.find('.elementor-templates-modal__header__items-area').append(preview_action_html);
1419
+
1420
+ let actual_id = AstraElementorSitesAdmin.page_id.replace('id-', '');
1421
+ $(document).trigger('astra-sites__elementor-plugin-check', { 'id': actual_id });
1422
+ },
1423
+
1424
+ _preview: function (e) {
1425
+
1426
+ if (AstraElementorSitesAdmin.processing) {
1427
+ return;
1428
+ }
1429
+
1430
+ let step = $(this).attr('data-step');
1431
+
1432
+ AstraElementorSitesAdmin.site_id = $(this).closest('.astra-theme').data('site-id');
1433
+ AstraElementorSitesAdmin.page_id = $(this).closest('.astra-theme').data('template-id');
1434
+ AstraElementorSitesAdmin.block_id = $(this).closest('.astra-theme').data('block-id');
1435
+
1436
+ $elscope.find('.back-to-layout').css('visibility', 'visible');
1437
+ $elscope.find('.back-to-layout').css('opacity', '1');
1438
+
1439
+ $elscope.find('.ast-template-library-toolbar').hide();
1440
+ $elscope.find('.ast-sites-modal__header').removeClass('ast-preview-mode');
1441
+
1442
+ if (1 == step) {
1443
+
1444
+ $elscope.find('.back-to-layout').attr('data-step', 2);
1445
+ $(document).trigger('astra-sites__elementor-do-step-1');
1446
+
1447
+ } else {
1448
+
1449
+ $elscope.find('.back-to-layout').attr('data-step', 3);
1450
+ $(document).trigger('astra-sites__elementor-do-step-2');
1451
+
1452
+ }
1453
+ },
1454
+
1455
+ _pluginCheck: function (e, data) {
1456
+
1457
+ var api_post = {
1458
+ slug: 'site-pages' + '/' + data['id']
1459
+ };
1460
+
1461
+ if ('blocks' == AstraElementorSitesAdmin.type) {
1462
+ api_post = {
1463
+ slug: 'astra-blocks' + '/' + data['id']
1464
+ };
1465
+ }
1466
+
1467
+ var params = {
1468
+ method: 'GET',
1469
+ cache: 'default',
1470
+ };
1471
+
1472
+ fetch(astraElementorSites.ApiURL + api_post.slug, params).then(response => {
1473
+ if (response.status === 200) {
1474
+ return response.json().then(items => ({
1475
+ items: items,
1476
+ items_count: response.headers.get('x-wp-total'),
1477
+ item_pages: response.headers.get('x-wp-totalpages'),
1478
+ }))
1479
+ } else {
1480
+ //$(document).trigger( 'astra-sites-api-request-error' );
1481
+ return response.json();
1482
+ }
1483
+ })
1484
+ .then(data => {
1485
+ if ('object' === typeof data) {
1486
+ if (undefined !== data && undefined !== data['items']) {
1487
+ AstraElementorSitesAdmin.templateData = data['items'];
1488
+ if (AstraElementorSitesAdmin.type == 'pages') {
1489
+
1490
+ if (undefined !== AstraElementorSitesAdmin.templateData['site-pages-required-plugins']) {
1491
+ AstraElementorSitesAdmin._requiredPluginsMarkup(AstraElementorSitesAdmin.templateData['site-pages-required-plugins']);
1492
+ }
1493
+ } else {
1494
+ if (undefined !== AstraElementorSitesAdmin.templateData['post-meta']['astra-blocks-required-plugins']) {
1495
+ AstraElementorSitesAdmin._requiredPluginsMarkup(PHP.parse(AstraElementorSitesAdmin.templateData['post-meta']['astra-blocks-required-plugins']));
1496
+ }
1497
+ }
1498
+ }
1499
+ }
1500
+ });
1501
+ },
1502
+
1503
+ _requiredPluginsMarkup: function (requiredPlugins) {
1504
+
1505
+ if ('' === requiredPlugins) {
1506
+ return;
1507
+ }
1508
+
1509
+ if (
1510
+ AstraElementorSitesAdmin.type == 'pages' &&
1511
+ astraElementorSites.default_page_builder_sites[AstraElementorSitesAdmin.site_id]['astra-sites-type'] != undefined &&
1512
+ astraElementorSites.default_page_builder_sites[AstraElementorSitesAdmin.site_id]['astra-sites-type'] != 'free'
1513
+ ) {
1514
+
1515
+ if (!astraElementorSites.license_status) {
1516
+
1517
+ output = '<p class="ast-validate">' + astraElementorSites.license_msg + '</p>';
1518
+
1519
+ $elscope.find('.required-plugins-list').html(output);
1520
+ $elscope.find('.ast-tooltip-wrap').css('opacity', 1);
1521
+ $elscope.find('.astra-sites-tooltip').css('opacity', 1);
1522
+
1523
+ /**
1524
+ * Enable Demo Import Button
1525
+ * @type number
1526
+ */
1527
+ AstraElementorSitesAdmin.requiredPlugins = [];
1528
+ AstraElementorSitesAdmin.canImport = true;
1529
+ AstraElementorSitesAdmin.canInsert = true;
1530
+ $elscope.find('.astra-sites-import-template-action > div').removeClass('disabled');
1531
+ return;
1532
+ }
1533
+
1534
+ }
1535
+
1536
+ // Required Required.
1537
+ $.ajax({
1538
+ url: astraElementorSites.ajaxurl,
1539
+ type: 'POST',
1540
+ data: {
1541
+ action: 'astra-required-plugins',
1542
+ _ajax_nonce: astraElementorSites._ajax_nonce,
1543
+ required_plugins: requiredPlugins
1544
+ },
1545
+ })
1546
+ .fail(function (jqXHR) {
1547
+ console.log(jqXHR);
1548
+ console.groupEnd();
1549
+ })
1550
+ .done(function (response) {
1551
+ if (false === response.success) {
1552
+
1553
+ $elscope = $('#ast-sites-modal');
1554
+ $elscope.find('#ast-sites-floating-notice-wrap-id').show().removeClass('error');
1555
+ $elscope.find('#ast-sites-floating-notice-wrap-id .ast-sites-floating-notice').show().html('<span class="message">Insufficient Permission. Please contact your Super Admin to allow the install required plugin permissions.<span>');
1556
+ $elscope.find('#ast-sites-floating-notice-wrap-id').addClass('error slide-in').removeClass('refreshed-notice');
1557
+
1558
+ } else {
1559
+ var output = '';
1560
+
1561
+ /**
1562
+ * Count remaining plugins.
1563
+ * @type number
1564
+ */
1565
+ var remaining_plugins = 0;
1566
+ var required_plugins_markup = '';
1567
+
1568
+ required_plugins = response.data['required_plugins'];
1569
+
1570
+ if (response.data['third_party_required_plugins'].length) {
1571
+ $( response.data['third_party_required_plugins'] ).each(function (index, plugin) {
1572
+ output += '<li class="plugin-card plugin-card-' + plugin.slug + '" data-slug="' + plugin.slug + '" data-init="' + plugin.init + '" data-name="' + plugin.name + '">' + plugin.name + '</li>';
1573
+ });
1574
+ }
1575
+
1576
+ /**
1577
+ * Not Installed
1578
+ *
1579
+ * List of not installed required plugins.
1580
+ */
1581
+ if (typeof required_plugins.notinstalled !== 'undefined') {
1582
+
1583
+ // Add not have installed plugins count.
1584
+ remaining_plugins += parseInt(required_plugins.notinstalled.length);
1585
+
1586
+ $(required_plugins.notinstalled).each(function (index, plugin) {
1587
+ if ('elementor' == plugin.slug) {
1588
+ return;
1589
+ }
1590
+ output += '<li class="plugin-card plugin-card-' + plugin.slug + '" data-slug="' + plugin.slug + '" data-init="' + plugin.init + '" data-name="' + plugin.name + '">' + plugin.name + '</li>';
1591
+ });
1592
+ }
1593
+
1594
+ /**
1595
+ * Inactive
1596
+ *
1597
+ * List of not inactive required plugins.
1598
+ */
1599
+ if (typeof required_plugins.inactive !== 'undefined') {
1600
+
1601
+ // Add inactive plugins count.
1602
+ remaining_plugins += parseInt(required_plugins.inactive.length);
1603
+
1604
+ $(required_plugins.inactive).each(function (index, plugin) {
1605
+ if ('elementor' == plugin.slug) {
1606
+ return;
1607
+ }
1608
+ output += '<li class="plugin-card plugin-card-' + plugin.slug + '" data-slug="' + plugin.slug + '" data-init="' + plugin.init + '" data-name="' + plugin.name + '">' + plugin.name + '</li>';
1609
+ });
1610
+ }
1611
+
1612
+ /**
1613
+ * Active
1614
+ *
1615
+ * List of not active required plugins.
1616
+ */
1617
+ if (typeof required_plugins.active !== 'undefined') {
1618
+
1619
+ $(required_plugins.active).each(function (index, plugin) {
1620
+ if ('elementor' == plugin.slug) {
1621
+ return;
1622
+ }
1623
+ output += '<li class="plugin-card plugin-card-' + plugin.slug + '" data-slug="' + plugin.slug + '" data-init="' + plugin.init + '" data-name="' + plugin.name + '">' + plugin.name + '</li>';
1624
+ });
1625
+ }
1626
+
1627
+ if ('' != output) {
1628
+ output = '<li class="plugin-card-head"><strong>' + astraElementorSites.install_plugin_text + '</strong></li>' + output;
1629
+ $elscope.find('.required-plugins-list').html(output);
1630
+ $elscope.find('.ast-tooltip-wrap').css('opacity', 1);
1631
+ $elscope.find('.astra-sites-tooltip').css('opacity', 1);
1632
+ }
1633
+
1634
+
1635
+ /**
1636
+ * Enable Demo Import Button
1637
+ * @type number
1638
+ */
1639
+ AstraElementorSitesAdmin.requiredPlugins = response.data['required_plugins'];
1640
+ AstraElementorSitesAdmin.canImport = true;
1641
+ AstraElementorSitesAdmin.canInsert = true;
1642
+ $elscope.find('.astra-sites-import-template-action > div').removeClass('disabled');
1643
+ }
1644
+ });
1645
+ },
1646
+
1647
+ _libraryClick: function (e) {
1648
+ $elscope.find(".elementor-template-library-menu-item").each(function () {
1649
+ $(this).removeClass('elementor-active');
1650
+ });
1651
+ $(this).addClass('elementor-active');
1652
+ },
1653
+
1654
+ _loadLargeImage: function (el) {
1655
+
1656
+ if (el.hasClass('loaded')) {
1657
+ return;
1658
+ }
1659
+
1660
+ if (el.parents('.astra-theme').isInViewport()) {
1661
+ var large_img_url = el.data('src') || '';
1662
+ var imgLarge = new Image();
1663
+ imgLarge.src = large_img_url;
1664
+ imgLarge.onload = function () {
1665
+ el.removeClass('loading');
1666
+ el.addClass('loaded');
1667
+ el.css('background-image', 'url(\'' + imgLarge.src + '\'');
1668
+ };
1669
+ }
1670
+ },
1671
+
1672
+ _loadLargeImages: function () {
1673
+ $elscope.find('.theme-screenshot').each(function (key, el) {
1674
+ AstraElementorSitesAdmin._loadLargeImage($(el));
1675
+ });
1676
+ },
1677
+
1678
+ _close: function (e) {
1679
+ console.groupEnd('Process Done.');
1680
+ $(document).trigger('astra-sites__elementor-close-before');
1681
+ setTimeout(function () {
1682
+ $elscope.fadeOut();
1683
+ $('body').removeClass('astra-sites__elementor-open');
1684
+ }, 300);
1685
+ $(document).trigger('astra-sites__elementor-close-after');
1686
+ },
1687
+
1688
+ _open: function (e) {
1689
+ $(document).trigger('astra-sites__elementor-open-before');
1690
+
1691
+ $('body').addClass('astra-sites__elementor-open');
1692
+
1693
+ let add_section = $(this).closest('.elementor-add-section');
1694
+
1695
+ if (add_section.hasClass('elementor-add-section-inline')) {
1696
+ AstraElementorSitesAdmin.index = add_section.prevAll().length;
1697
+ } else {
1698
+ AstraElementorSitesAdmin.index = add_section.prev().children().length;
1699
+ }
1700
+ AstraElementorSitesAdmin._home();
1701
+ $elscope.fadeIn();
1702
+ if ($('.refreshed-notice').length == 1) {
1703
+ setTimeout(
1704
+ function () {
1705
+ $('.refreshed-notice').find('.notice-dismiss').click();
1706
+ },
1707
+ 2500
1708
+ );
1709
+ }
1710
+ $(document).trigger('astra-sites__elementor-open-after');
1711
+ },
1712
+
1713
+ _beforeOpen: function (e) {
1714
+
1715
+ let userPrefersDark = matchMedia('(prefers-color-scheme: dark)').matches;
1716
+ let uiTheme = elementor.settings.editorPreferences.model.get('ui_theme');
1717
+
1718
+ if ('dark' === uiTheme || ('auto' === uiTheme && userPrefersDark)) {
1719
+ $('body').addClass('ast-sites-dark-mode');
1720
+ } else {
1721
+ $('body').removeClass('ast-sites-dark-mode');
1722
+ }
1723
+
1724
+ // Hide preview page.
1725
+ $elscope.find('.theme-preview').hide();
1726
+ $elscope.find('.theme-preview').html('');
1727
+
1728
+ // Show site listing page.
1729
+ $elscope.find('.dialog-lightbox-content').show();
1730
+
1731
+ // Hide Back button.
1732
+ $elscope.find('.back-to-layout').css('visibility', 'hidden');
1733
+ $elscope.find('.back-to-layout').css('opacity', '0');
1734
+ },
1735
+
1736
+ _initSites: function (e) {
1737
+ AstraElementorSitesAdmin._appendSites(astraElementorSites.default_page_builder_sites);
1738
+ AstraElementorSitesAdmin._goBack();
1739
+ },
1740
+
1741
+ _initBlocks: function (e) {
1742
+ AstraElementorSitesAdmin._appendBlocks(astraElementorSites.astra_blocks);
1743
+ AstraElementorSitesAdmin._goBack();
1744
+ },
1745
+
1746
+ /**
1747
+ * Install Success
1748
+ */
1749
+ _installSuccess: function (event, response) {
1750
+
1751
+ event.preventDefault();
1752
+
1753
+ // Transform the 'Install' button into an 'Activate' button.
1754
+ var $init = $('.plugin-card-' + response.slug).data('init');
1755
+ var $name = $('.plugin-card-' + response.slug).data('name');
1756
+
1757
+ // Reset not installed plugins list.
1758
+ var pluginsList = AstraElementorSitesAdmin.requiredPlugins.notinstalled;
1759
+ var curr_plugin = AstraElementorSitesAdmin._getPluginFromQueue(response.slug, pluginsList);
1760
+
1761
+ AstraElementorSitesAdmin.requiredPlugins.notinstalled = AstraElementorSitesAdmin._removePluginFromQueue(response.slug, pluginsList);
1762
+
1763
+
1764
+ // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
1765
+ setTimeout(function () {
1766
+
1767
+ console.log('Activating Plugin - ' + curr_plugin.name);
1768
+
1769
+ $.ajax({
1770
+ url: astraElementorSites.ajaxurl,
1771
+ type: 'POST',
1772
+ data: {
1773
+ 'action': 'astra-required-plugin-activate',
1774
+ 'init': curr_plugin.init,
1775
+ '_ajax_nonce': astraElementorSites._ajax_nonce,
1776
+ },
1777
+ })
1778
+ .done(function (result) {
1779
+
1780
+ if (result.success) {
1781
+ var pluginsList = AstraElementorSitesAdmin.requiredPlugins.inactive;
1782
+
1783
+ console.log('Activated Plugin - ' + curr_plugin.name);
1784
+
1785
+ // Reset not installed plugins list.
1786
+ AstraElementorSitesAdmin.requiredPlugins.inactive = AstraElementorSitesAdmin._removePluginFromQueue(response.slug, pluginsList);
1787
+
1788
+ // Enable Demo Import Button
1789
+ AstraElementorSitesAdmin._enableImport();
1790
+
1791
+ }
1792
+ });
1793
+
1794
+ }, 1200);
1795
+
1796
+ },
1797
+
1798
+ /**
1799
+ * Plugin Installation Error.
1800
+ */
1801
+ _installError: function (event, response) {
1802
+ console.log(response);
1803
+ console.log('Error Installing Plugin - ' + response.slug);
1804
+ console.log(response.errorMessage);
1805
+ },
1806
+
1807
+ /**
1808
+ * Installing Plugin
1809
+ */
1810
+ _pluginInstalling: function (event, args) {
1811
+ console.log('Installing Plugin - ' + args.slug);
1812
+ },
1813
+ };
1814
+
1815
+ /**
1816
+ * Initialize AstraElementorSitesAdmin
1817
+ */
1818
+ $(function () {
1819
+ AstraElementorSitesAdmin.init();
1820
+ });
1821
+
1822
+ })(jQuery);
astra-sites/inc/assets/js/eventsource.js ADDED
@@ -0,0 +1,675 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * EventSource
3
+ * https://github.com/Yaffle/EventSource
4
+ *
5
+ * Released under the MIT License (MIT)
6
+ * https://github.com/Yaffle/EventSource/blob/master/LICENSE.md
7
+ */
8
+
9
+ /*jslint indent: 2, vars: true, plusplus: true */
10
+ /*global setTimeout, clearTimeout */
11
+
12
+ (function (global) {
13
+ "use strict";
14
+
15
+ var setTimeout = global.setTimeout;
16
+ var clearTimeout = global.clearTimeout;
17
+ var XMLHttpRequest = global.XMLHttpRequest;
18
+ var XDomainRequest = global.XDomainRequest;
19
+ var NativeEventSource = global.EventSource;
20
+ var document = global.document;
21
+
22
+ if (Object.create == null) {
23
+ Object.create = function (C) {
24
+ function F(){}
25
+ F.prototype = C;
26
+ return new F();
27
+ };
28
+ }
29
+
30
+ var k = function () {
31
+ };
32
+
33
+ function XHRWrapper(xhr) {
34
+ this.withCredentials = false;
35
+ this.responseType = "";
36
+ this.readyState = 0;
37
+ this.status = 0;
38
+ this.statusText = "";
39
+ this.responseText = "";
40
+ this.onprogress = k;
41
+ this.onreadystatechange = k;
42
+ this._contentType = "";
43
+ this._xhr = xhr;
44
+ this._sendTimeout = 0;
45
+ this._abort = k;
46
+ }
47
+
48
+ XHRWrapper.prototype.open = function (method, url) {
49
+ this._abort(true);
50
+
51
+ var that = this;
52
+ var xhr = this._xhr;
53
+ var state = 1;
54
+ var timeout = 0;
55
+
56
+ this._abort = function (silent) {
57
+ if (that._sendTimeout !== 0) {
58
+ clearTimeout(that._sendTimeout);
59
+ that._sendTimeout = 0;
60
+ }
61
+ if (state === 1 || state === 2 || state === 3) {
62
+ state = 4;
63
+ xhr.onload = k;
64
+ xhr.onerror = k;
65
+ xhr.onabort = k;
66
+ xhr.onprogress = k;
67
+ xhr.onreadystatechange = k;
68
+ // IE 8 - 9: XDomainRequest#abort() does not fire any event
69
+ // Opera < 10: XMLHttpRequest#abort() does not fire any event
70
+ xhr.abort();
71
+ if (timeout !== 0) {
72
+ clearTimeout(timeout);
73
+ timeout = 0;
74
+ }
75
+ if (!silent) {
76
+ that.readyState = 4;
77
+ that.onreadystatechange();
78
+ }
79
+ }
80
+ state = 0;
81
+ };
82
+
83
+ var onStart = function () {
84
+ if (state === 1) {
85
+ //state = 2;
86
+ var status = 0;
87
+ var statusText = "";
88
+ var contentType = undefined;
89
+ if (!("contentType" in xhr)) {
90
+ try {
91
+ status = xhr.status;
92
+ statusText = xhr.statusText;
93
+ contentType = xhr.getResponseHeader("Content-Type");
94
+ } catch (error) {
95
+ // IE < 10 throws exception for `xhr.status` when xhr.readyState === 2 || xhr.readyState === 3
96
+ // Opera < 11 throws exception for `xhr.status` when xhr.readyState === 2
97
+ // https://bugs.webkit.org/show_bug.cgi?id=29121
98
+ status = 0;
99
+ statusText = "";
100
+ contentType = undefined;
101
+ // Firefox < 14, Chrome ?, Safari ?
102
+ // https://bugs.webkit.org/show_bug.cgi?id=29658
103
+ // https://bugs.webkit.org/show_bug.cgi?id=77854
104
+ }
105
+ } else {
106
+ status = 200;
107
+ statusText = "OK";
108
+ contentType = xhr.contentType;
109
+ }
110
+ if (status !== 0) {
111
+ state = 2;
112
+ that.readyState = 2;
113
+ that.status = status;
114
+ that.statusText = statusText;
115
+ that._contentType = contentType;
116
+ that.onreadystatechange();
117
+ }
118
+ }
119
+ };
120
+ var onProgress = function () {
121
+ onStart();
122
+ if (state === 2 || state === 3) {
123
+ state = 3;
124
+ var responseText = "";
125
+ try {
126
+ responseText = xhr.responseText;
127
+ } catch (error) {
128
+ // IE 8 - 9 with XMLHttpRequest
129
+ }
130
+ that.readyState = 3;
131
+ that.responseText = responseText;
132
+ that.onprogress();
133
+ }
134
+ };
135
+ var onFinish = function () {
136
+ // Firefox 52 fires "readystatechange" (xhr.readyState === 4) without final "readystatechange" (xhr.readyState === 3)
137
+ // IE 8 fires "onload" without "onprogress"
138
+ onProgress();
139
+ if (state === 1 || state === 2 || state === 3) {
140
+ state = 4;
141
+ if (timeout !== 0) {
142
+ clearTimeout(timeout);
143
+ timeout = 0;
144
+ }
145
+ that.readyState = 4;
146
+ that.onreadystatechange();
147
+ }
148
+ };
149
+ var onReadyStateChange = function () {
150
+ if (xhr != undefined) { // Opera 12
151
+ if (xhr.readyState === 4) {
152
+ onFinish();
153
+ } else if (xhr.readyState === 3) {
154
+ onProgress();
155
+ } else if (xhr.readyState === 2) {
156
+ onStart();
157
+ }
158
+ }
159
+ };
160
+ var onTimeout = function () {
161
+ timeout = setTimeout(function () {
162
+ onTimeout();
163
+ }, 500);
164
+ if (xhr.readyState === 3) {
165
+ onProgress();
166
+ }
167
+ };
168
+
169
+ // XDomainRequest#abort removes onprogress, onerror, onload
170
+ xhr.onload = onFinish;
171
+ xhr.onerror = onFinish;
172
+ // improper fix to match Firefox behaviour, but it is better than just ignore abort
173
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=768596
174
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=880200
175
+ // https://code.google.com/p/chromium/issues/detail?id=153570
176
+ // IE 8 fires "onload" without "onprogress
177
+ xhr.onabort = onFinish;
178
+
179
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=736723
180
+ if (!("sendAsBinary" in XMLHttpRequest.prototype) && !("mozAnon" in XMLHttpRequest.prototype)) {
181
+ xhr.onprogress = onProgress;
182
+ }
183
+
184
+ // IE 8 - 9 (XMLHTTPRequest)
185
+ // Opera < 12
186
+ // Firefox < 3.5
187
+ // Firefox 3.5 - 3.6 - ? < 9.0
188
+ // onprogress is not fired sometimes or delayed
189
+ // see also #64
190
+ xhr.onreadystatechange = onReadyStateChange;
191
+
192
+ if ("contentType" in xhr) {
193
+ url += (url.indexOf("?", 0) === -1 ? "?" : "&") + "padding=true";
194
+ }
195
+ xhr.open(method, url, true);
196
+
197
+ if ("readyState" in xhr) {
198
+ // workaround for Opera 12 issue with "progress" events
199
+ // #91
200
+ timeout = setTimeout(function () {
201
+ onTimeout();
202
+ }, 0);
203
+ }
204
+ };
205
+ XHRWrapper.prototype.abort = function () {
206
+ this._abort(false);
207
+ };
208
+ XHRWrapper.prototype.getResponseHeader = function (name) {
209
+ return this._contentType;
210
+ };
211
+ XHRWrapper.prototype.setRequestHeader = function (name, value) {
212
+ var xhr = this._xhr;
213
+ if ("setRequestHeader" in xhr) {
214
+ xhr.setRequestHeader(name, value);
215
+ }
216
+ };
217
+ XHRWrapper.prototype.send = function () {
218
+ // loading indicator in Safari < ? (6), Chrome < 14, Firefox
219
+ if (!("ontimeout" in XMLHttpRequest.prototype) &&
220
+ document != undefined &&
221
+ document.readyState != undefined &&
222
+ document.readyState !== "complete") {
223
+ var that = this;
224
+ that._sendTimeout = setTimeout(function () {
225
+ that._sendTimeout = 0;
226
+ that.send();
227
+ }, 4);
228
+ return;
229
+ }
230
+
231
+ var xhr = this._xhr;
232
+ // withCredentials should be set after "open" for Safari and Chrome (< 19 ?)
233
+ xhr.withCredentials = this.withCredentials;
234
+ xhr.responseType = this.responseType;
235
+ try {
236
+ // xhr.send(); throws "Not enough arguments" in Firefox 3.0
237
+ xhr.send(undefined);
238
+ } catch (error1) {
239
+ // Safari 5.1.7, Opera 12
240
+ throw error1;
241
+ }
242
+ };
243
+
244
+ function XHRTransport(xhr) {
245
+ this._xhr = new XHRWrapper(xhr);
246
+ }
247
+
248
+ XHRTransport.prototype.open = function (onStartCallback, onProgressCallback, onFinishCallback, url, withCredentials, headers) {
249
+ var xhr = this._xhr;
250
+ xhr.open("GET", url);
251
+ var offset = 0;
252
+ xhr.onprogress = function () {
253
+ var responseText = xhr.responseText;
254
+ var chunk = responseText.slice(offset);
255
+ offset += chunk.length;
256
+ onProgressCallback(chunk);
257
+ };
258
+ xhr.onreadystatechange = function () {
259
+ if (xhr.readyState === 2) {
260
+ var status = xhr.status;
261
+ var statusText = xhr.statusText;
262
+ var contentType = xhr.getResponseHeader("Content-Type");
263
+ onStartCallback(status, statusText, contentType);
264
+ } else if (xhr.readyState === 4) {
265
+ onFinishCallback();
266
+ }
267
+ };
268
+ xhr.withCredentials = withCredentials;
269
+ xhr.responseType = "text";
270
+ for (var name in headers) {
271
+ if (Object.prototype.hasOwnProperty.call(headers, name)) {
272
+ xhr.setRequestHeader(name, headers[name]);
273
+ }
274
+ }
275
+ xhr.send();
276
+ };
277
+
278
+ XHRTransport.prototype.cancel = function () {
279
+ var xhr = this._xhr;
280
+ xhr.abort();
281
+ };
282
+
283
+ function EventTarget() {
284
+ this._listeners = Object.create(null);
285
+ }
286
+
287
+ function throwError(e) {
288
+ setTimeout(function () {
289
+ throw e;
290
+ }, 0);
291
+ }
292
+
293
+ EventTarget.prototype.dispatchEvent = function (event) {
294
+ event.target = this;
295
+ var typeListeners = this._listeners[event.type];
296
+ if (typeListeners != undefined) {
297
+ var length = typeListeners.length;
298
+ for (var i = 0; i < length; i += 1) {
299
+ var listener = typeListeners[i];
300
+ try {
301
+ if (typeof listener.handleEvent === "function") {
302
+ listener.handleEvent(event);
303
+ } else {
304
+ listener.call(this, event);
305
+ }
306
+ } catch (e) {
307
+ throwError(e);
308
+ }
309
+ }
310
+ }
311
+ };
312
+ EventTarget.prototype.addEventListener = function (type, listener) {
313
+ type = String(type);
314
+ var listeners = this._listeners;
315
+ var typeListeners = listeners[type];
316
+ if (typeListeners == undefined) {
317
+ typeListeners = [];
318
+ listeners[type] = typeListeners;
319
+ }
320
+ var found = false;
321
+ for (var i = 0; i < typeListeners.length; i += 1) {
322
+ if (typeListeners[i] === listener) {
323
+ found = true;
324
+ }
325
+ }
326
+ if (!found) {
327
+ typeListeners.push(listener);
328
+ }
329
+ };
330
+ EventTarget.prototype.removeEventListener = function (type, listener) {
331
+ type = String(type);
332
+ var listeners = this._listeners;
333
+ var typeListeners = listeners[type];
334
+ if (typeListeners != undefined) {
335
+ var filtered = [];
336
+ for (var i = 0; i < typeListeners.length; i += 1) {
337
+ if (typeListeners[i] !== listener) {
338
+ filtered.push(typeListeners[i]);
339
+ }
340
+ }
341
+ if (filtered.length === 0) {
342
+ delete listeners[type];
343
+ } else {
344
+ listeners[type] = filtered;
345
+ }
346
+ }
347
+ };
348
+
349
+ function Event(type) {
350
+ this.type = type;
351
+ this.target = undefined;
352
+ }
353
+
354
+ function MessageEvent(type, options) {
355
+ Event.call(this, type);
356
+ this.data = options.data;
357
+ this.lastEventId = options.lastEventId;
358
+ }
359
+
360
+ MessageEvent.prototype = Object.create(Event.prototype);
361
+
362
+ var WAITING = -1;
363
+ var CONNECTING = 0;
364
+ var OPEN = 1;
365
+ var CLOSED = 2;
366
+
367
+ var AFTER_CR = -1;
368
+ var FIELD_START = 0;
369
+ var FIELD = 1;
370
+ var VALUE_START = 2;
371
+ var VALUE = 3;
372
+
373
+ var contentTypeRegExp = /^text\/event\-stream;?(\s*charset\=utf\-8)?$/i;
374
+
375
+ var MINIMUM_DURATION = 1000;
376
+ var MAXIMUM_DURATION = 18000000;
377
+
378
+ var parseDuration = function (value, def) {
379
+ var n = parseInt(value, 10);
380
+ if (n !== n) {
381
+ n = def;
382
+ }
383
+ return clampDuration(n);
384
+ };
385
+ var clampDuration = function (n) {
386
+ return Math.min(Math.max(n, MINIMUM_DURATION), MAXIMUM_DURATION);
387
+ };
388
+
389
+ var fire = function (that, f, event) {
390
+ try {
391
+ if (typeof f === "function") {
392
+ f.call(that, event);
393
+ }
394
+ } catch (e) {
395
+ throwError(e);
396
+ }
397
+ };
398
+
399
+ function EventSourcePolyfill(url, options) {
400
+ EventTarget.call(this);
401
+
402
+ this.onopen = undefined;
403
+ this.onmessage = undefined;
404
+ this.onerror = undefined;
405
+
406
+ this.url = undefined;
407
+ this.readyState = undefined;
408
+ this.withCredentials = undefined;
409
+
410
+ this._close = undefined;
411
+
412
+ start(this, url, options);
413
+ }
414
+
415
+ function start(es, url, options) {
416
+ url = String(url);
417
+ var withCredentials = options != undefined && Boolean(options.withCredentials);
418
+
419
+ var initialRetry = clampDuration(1000);
420
+ var heartbeatTimeout = clampDuration(45000);
421
+
422
+ var lastEventId = "";
423
+ var retry = initialRetry;
424
+ var wasActivity = false;
425
+ var headers = options != undefined && options.headers != undefined ? JSON.parse(JSON.stringify(options.headers)) : undefined;
426
+ var CurrentTransport = options != undefined && options.Transport != undefined ? options.Transport : (XDomainRequest != undefined ? XDomainRequest : XMLHttpRequest);
427
+ var transport = new XHRTransport(new CurrentTransport());
428
+ var timeout = 0;
429
+ var currentState = WAITING;
430
+ var dataBuffer = "";
431
+ var lastEventIdBuffer = "";
432
+ var eventTypeBuffer = "";
433
+
434
+ var textBuffer = "";
435
+ var state = FIELD_START;
436
+ var fieldStart = 0;
437
+ var valueStart = 0;
438
+
439
+ var onStart = function (status, statusText, contentType) {
440
+ if (currentState === CONNECTING) {
441
+ if (status === 200 && contentType != undefined && contentTypeRegExp.test(contentType)) {
442
+ currentState = OPEN;
443
+ wasActivity = true;
444
+ retry = initialRetry;
445
+ es.readyState = OPEN;
446
+ var event = new Event("open");
447
+ es.dispatchEvent(event);
448
+ fire(es, es.onopen, event);
449
+ } else {
450
+ var message = "";
451
+ if (status !== 200) {
452
+ if (statusText) {
453
+ statusText = statusText.replace(/\s+/g, " ");
454
+ }
455
+ message = "EventSource's response has a status " + status + " " + statusText + " that is not 200. Aborting the connection.";
456
+ } else {
457
+ message = "EventSource's response has a Content-Type specifying an unsupported type: " + (contentType == undefined ? "-" : contentType.replace(/\s+/g, " ")) + ". Aborting the connection.";
458
+ }
459
+ throwError(new Error(message));
460
+ close();
461
+ var event = new Event("error");
462
+ es.dispatchEvent(event);
463
+ fire(es, es.onerror, event);
464
+ }
465
+ }
466
+ };
467
+
468
+ var onProgress = function (textChunk) {
469
+ if (currentState === OPEN) {
470
+ var n = -1;
471
+ for (var i = 0; i < textChunk.length; i += 1) {
472
+ var c = textChunk.charCodeAt(i);
473
+ if (c === "\n".charCodeAt(0) || c === "\r".charCodeAt(0)) {
474
+ n = i;
475
+ }
476
+ }
477
+ var chunk = (n !== -1 ? textBuffer : "") + textChunk.slice(0, n + 1);
478
+ textBuffer = (n === -1 ? textBuffer : "") + textChunk.slice(n + 1);
479
+ if (chunk !== "") {
480
+ wasActivity = true;
481
+ }
482
+ for (var position = 0; position < chunk.length; position += 1) {
483
+ var c = chunk.charCodeAt(position);
484
+ if (state === AFTER_CR && c === "\n".charCodeAt(0)) {
485
+ state = FIELD_START;
486
+ } else {
487
+ if (state === AFTER_CR) {
488
+ state = FIELD_START;
489
+ }
490
+ if (c === "\r".charCodeAt(0) || c === "\n".charCodeAt(0)) {
491
+ if (state !== FIELD_START) {
492
+ if (state === FIELD) {
493
+ valueStart = position + 1;
494
+ }
495
+ var field = chunk.slice(fieldStart, valueStart - 1);
496
+ var value = chunk.slice(valueStart + (valueStart < position && chunk.charCodeAt(valueStart) === " ".charCodeAt(0) ? 1 : 0), position);
497
+ if (field === "data") {
498
+ dataBuffer += "\n";
499
+ dataBuffer += value;
500
+ } else if (field === "id") {
501
+ lastEventIdBuffer = value;
502
+ } else if (field === "event") {
503
+ eventTypeBuffer = value;
504
+ } else if (field === "retry") {
505
+ initialRetry = parseDuration(value, initialRetry);
506
+ retry = initialRetry;
507
+ } else if (field === "heartbeatTimeout") {
508
+ heartbeatTimeout = parseDuration(value, heartbeatTimeout);
509
+ if (timeout !== 0) {
510
+ clearTimeout(timeout);
511
+ timeout = setTimeout(function () {
512
+ onTimeout();
513
+ }, heartbeatTimeout);
514
+ }
515
+ }
516
+ }
517
+ if (state === FIELD_START) {
518
+ if (dataBuffer !== "") {
519
+ lastEventId = lastEventIdBuffer;
520
+ if (eventTypeBuffer === "") {
521
+ eventTypeBuffer = "message";
522
+ }
523
+ var event = new MessageEvent(eventTypeBuffer, {
524
+ data: dataBuffer.slice(1),
525
+ lastEventId: lastEventIdBuffer
526
+ });
527
+ es.dispatchEvent(event);
528
+ if (eventTypeBuffer === "message") {
529
+ fire(es, es.onmessage, event);
530
+ }
531
+ if (currentState === CLOSED) {
532
+ return;
533
+ }
534
+ }
535
+ dataBuffer = "";
536
+ eventTypeBuffer = "";
537
+ }
538
+ state = c === "\r".charCodeAt(0) ? AFTER_CR : FIELD_START;
539
+ } else {
540
+ if (state === FIELD_START) {
541
+ fieldStart = position;
542
+ state = FIELD;
543
+ }
544
+ if (state === FIELD) {
545
+ if (c === ":".charCodeAt(0)) {
546
+ valueStart = position + 1;
547
+ state = VALUE_START;
548
+ }
549
+ } else if (state === VALUE_START) {
550
+ state = VALUE;
551
+ }
552
+ }
553
+ }
554
+ }
555
+ }
556
+ };
557
+
558
+ var onFinish = function () {
559
+ if (currentState === OPEN || currentState === CONNECTING) {
560
+ currentState = WAITING;
561
+ if (timeout !== 0) {
562
+ clearTimeout(timeout);
563
+ timeout = 0;
564
+ }
565
+ timeout = setTimeout(function () {
566
+ onTimeout();
567
+ }, retry);
568
+ retry = clampDuration(Math.min(initialRetry * 16, retry * 2));
569
+
570
+ es.readyState = CONNECTING;
571
+ var event = new Event("error");
572
+ es.dispatchEvent(event);
573
+ fire(es, es.onerror, event);
574
+ }
575
+ };
576
+
577
+ var close = function () {
578
+ currentState = CLOSED;
579
+ transport.cancel();
580
+ if (timeout !== 0) {
581
+ clearTimeout(timeout);
582
+ timeout = 0;
583
+ }
584
+ es.readyState = CLOSED;
585
+ };
586
+
587
+ var onTimeout = function () {
588
+ timeout = 0;
589
+
590
+ if (currentState !== WAITING) {
591
+ if (!wasActivity) {
592
+ throwError(new Error("No activity within " + heartbeatTimeout + " milliseconds. Reconnecting."));
593
+ transport.cancel();
594
+ } else {
595
+ wasActivity = false;
596
+ timeout = setTimeout(function () {
597
+ onTimeout();
598
+ }, heartbeatTimeout);
599
+ }
600
+ return;
601
+ }
602
+
603
+ wasActivity = false;
604
+ timeout = setTimeout(function () {
605
+ onTimeout();
606
+ }, heartbeatTimeout);
607
+
608
+ currentState = CONNECTING;
609
+ dataBuffer = "";
610
+ eventTypeBuffer = "";
611
+ lastEventIdBuffer = lastEventId;
612
+ textBuffer = "";
613
+ fieldStart = 0;
614
+ valueStart = 0;
615
+ state = FIELD_START;
616
+
617
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=428916
618
+ // Request header field Last-Event-ID is not allowed by Access-Control-Allow-Headers.
619
+ var requestURL = url;
620
+ if (url.slice(0, 5) !== "data:" &&
621
+ url.slice(0, 5) !== "blob:") {
622
+ requestURL = url + (url.indexOf("?", 0) === -1 ? "?" : "&") + "lastEventId=" + encodeURIComponent(lastEventId);
623
+ }
624
+ var requestHeaders = {};
625
+ requestHeaders["Accept"] = "text/event-stream";
626
+ if (headers != undefined) {
627
+ for (var name in headers) {
628
+ if (Object.prototype.hasOwnProperty.call(headers, name)) {
629
+ requestHeaders[name] = headers[name];
630
+ }
631
+ }
632
+ }
633
+ try {
634
+ transport.open(onStart, onProgress, onFinish, requestURL, withCredentials, requestHeaders);
635
+ } catch (error) {
636
+ close();
637
+ throw error;
638
+ }
639
+ };
640
+
641
+ es.url = url;
642
+ es.readyState = CONNECTING;
643
+ es.withCredentials = withCredentials;
644
+ es._close = close;
645
+
646
+ onTimeout();
647
+ }
648
+
649
+ EventSourcePolyfill.prototype = Object.create(EventTarget.prototype);
650
+ EventSourcePolyfill.prototype.CONNECTING = CONNECTING;
651
+ EventSourcePolyfill.prototype.OPEN = OPEN;
652
+ EventSourcePolyfill.prototype.CLOSED = CLOSED;
653
+ EventSourcePolyfill.prototype.close = function () {
654
+ this._close();
655
+ };
656
+
657
+ EventSourcePolyfill.CONNECTING = CONNECTING;
658
+ EventSourcePolyfill.OPEN = OPEN;
659
+ EventSourcePolyfill.CLOSED = CLOSED;
660
+ EventSourcePolyfill.prototype.withCredentials = undefined;
661
+
662
+ global.EventSourcePolyfill = EventSourcePolyfill;
663
+ global.NativeEventSource = NativeEventSource;
664
+
665
+ if (XMLHttpRequest != undefined && (NativeEventSource == undefined || !("withCredentials" in NativeEventSource.prototype))) {
666
+ // Why replace a native EventSource ?
667
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=444328
668
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=831392
669
+ // https://code.google.com/p/chromium/issues/detail?id=260144
670
+ // https://code.google.com/p/chromium/issues/detail?id=225654
671
+ // ...
672
+ global.EventSource = EventSourcePolyfill;
673
+ }
674
+
675
+ }(typeof window !== 'undefined' ? window : this));
astra-sites/inc/assets/js/eventsource.min.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ /**
2
+ * EventSource
3
+ * https://github.com/Yaffle/EventSource
4
+ *
5
+ * Released under the MIT License (MIT)
6
+ * https://github.com/Yaffle/EventSource/blob/master/LICENSE.md
7
+ */
8
+ !function(a){"use strict";function b(a){this.withCredentials=!1,this.responseType="",this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=p,this.onreadystatechange=p,this._contentType="",this._xhr=a,this._sendTimeout=0,this._abort=p}function c(a){this._xhr=new b(a)}function d(){this._listeners=Object.create(null)}function e(a){j(function(){throw a},0)}function f(a){this.type=a,this.target=void 0}function g(a,b){f.call(this,a),this.data=b.data,this.lastEventId=b.lastEventId}function h(a,b){d.call(this),this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this._close=void 0,i(this,a,b)}function i(a,b,d){b=String(b);var h=void 0!=d&&Boolean(d.withCredentials),i=D(1e3),n=D(45e3),o="",p=i,A=!1,B=void 0!=d&&void 0!=d.headers?JSON.parse(JSON.stringify(d.headers)):void 0,F=void 0!=d&&void 0!=d.Transport?d.Transport:void 0!=m?m:l,G=new c(new F),H=0,I=q,J="",K="",L="",M="",N=v,O=0,P=0,Q=function(b,c,d){if(I===r)if(200===b&&void 0!=d&&z.test(d)){I=s,A=!0,p=i,a.readyState=s;var g=new f("open");a.dispatchEvent(g),E(a,a.onopen,g)}else{var h="";200!==b?(c&&(c=c.replace(/\s+/g," ")),h="EventSource's response has a status "+b+" "+c+" that is not 200. Aborting the connection."):h="EventSource's response has a Content-Type specifying an unsupported type: "+(void 0==d?"-":d.replace(/\s+/g," "))+". Aborting the connection.",e(new Error(h)),T();var g=new f("error");a.dispatchEvent(g),E(a,a.onerror,g)}},R=function(b){if(I===s){for(var c=-1,d=0;d<b.length;d+=1){var e=b.charCodeAt(d);(e==="\n".charCodeAt(0)||e==="\r".charCodeAt(0))&&(c=d)}var f=(-1!==c?M:"")+b.slice(0,c+1);M=(-1===c?M:"")+b.slice(c+1),""!==f&&(A=!0);for(var h=0;h<f.length;h+=1){var e=f.charCodeAt(h);if(N===u&&e==="\n".charCodeAt(0))N=v;else if(N===u&&(N=v),e==="\r".charCodeAt(0)||e==="\n".charCodeAt(0)){if(N!==v){N===w&&(P=h+1);var l=f.slice(O,P-1),m=f.slice(P+(h>P&&f.charCodeAt(P)===" ".charCodeAt(0)?1:0),h);"data"===l?(J+="\n",J+=m):"id"===l?K=m:"event"===l?L=m:"retry"===l?(i=C(m,i),p=i):"heartbeatTimeout"===l&&(n=C(m,n),0!==H&&(k(H),H=j(function(){U()},n)))}if(N===v){if(""!==J){o=K,""===L&&(L="message");var q=new g(L,{data:J.slice(1),lastEventId:K});if(a.dispatchEvent(q),"message"===L&&E(a,a.onmessage,q),I===t)return}J="",L=""}N=e==="\r".charCodeAt(0)?u:v}else N===v&&(O=h,N=w),N===w?e===":".charCodeAt(0)&&(P=h+1,N=x):N===x&&(N=y)}}},S=function(){if(I===s||I===r){I=q,0!==H&&(k(H),H=0),H=j(function(){U()},p),p=D(Math.min(16*i,2*p)),a.readyState=r;var b=new f("error");a.dispatchEvent(b),E(a,a.onerror,b)}},T=function(){I=t,G.cancel(),0!==H&&(k(H),H=0),a.readyState=t},U=function(){if(H=0,I!==q)return void(A?(A=!1,H=j(function(){U()},n)):(e(new Error("No activity within "+n+" milliseconds. Reconnecting.")),G.cancel()));A=!1,H=j(function(){U()},n),I=r,J="",L="",K=o,M="",O=0,P=0,N=v;var a=b;"data:"!==b.slice(0,5)&&"blob:"!==b.slice(0,5)&&(a=b+(-1===b.indexOf("?",0)?"?":"&")+"lastEventId="+encodeURIComponent(o));var c={};if(c.Accept="text/event-stream",void 0!=B)for(var d in B)Object.prototype.hasOwnProperty.call(B,d)&&(c[d]=B[d]);try{G.open(Q,R,S,a,h,c)}catch(f){throw T(),f}};a.url=b,a.readyState=r,a.withCredentials=h,a._close=T,U()}var j=a.setTimeout,k=a.clearTimeout,l=a.XMLHttpRequest,m=a.XDomainRequest,n=a.EventSource,o=a.document;null==Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b});var p=function(){};b.prototype.open=function(a,b){this._abort(!0);var c=this,d=this._xhr,e=1,f=0;this._abort=function(a){0!==c._sendTimeout&&(k(c._sendTimeout),c._sendTimeout=0),(1===e||2===e||3===e)&&(e=4,d.onload=p,d.onerror=p,d.onabort=p,d.onprogress=p,d.onreadystatechange=p,d.abort(),0!==f&&(k(f),f=0),a||(c.readyState=4,c.onreadystatechange())),e=0};var g=function(){if(1===e){var a=0,b="",f=void 0;if("contentType"in d)a=200,b="OK",f=d.contentType;else try{a=d.status,b=d.statusText,f=d.getResponseHeader("Content-Type")}catch(g){a=0,b="",f=void 0}0!==a&&(e=2,c.readyState=2,c.status=a,c.statusText=b,c._contentType=f,c.onreadystatechange())}},h=function(){if(g(),2===e||3===e){e=3;var a="";try{a=d.responseText}catch(b){}c.readyState=3,c.responseText=a,c.onprogress()}},i=function(){h(),(1===e||2===e||3===e)&&(e=4,0!==f&&(k(f),f=0),c.readyState=4,c.onreadystatechange())},m=function(){void 0!=d&&(4===d.readyState?i():3===d.readyState?h():2===d.readyState&&g())},n=function(){f=j(function(){n()},500),3===d.readyState&&h()};d.onload=i,d.onerror=i,d.onabort=i,"sendAsBinary"in l.prototype||"mozAnon"in l.prototype||(d.onprogress=h),d.onreadystatechange=m,"contentType"in d&&(b+=(-1===b.indexOf("?",0)?"?":"&")+"padding=true"),d.open(a,b,!0),"readyState"in d&&(f=j(function(){n()},0))},b.prototype.abort=function(){this._abort(!1)},b.prototype.getResponseHeader=function(a){return this._contentType},b.prototype.setRequestHeader=function(a,b){var c=this._xhr;"setRequestHeader"in c&&c.setRequestHeader(a,b)},b.prototype.send=function(){if(!("ontimeout"in l.prototype)&&void 0!=o&&void 0!=o.readyState&&"complete"!==o.readyState){var a=this;return void(a._sendTimeout=j(function(){a._sendTimeout=0,a.send()},4))}var b=this._xhr;b.withCredentials=this.withCredentials,b.responseType=this.responseType;try{b.send(void 0)}catch(c){throw c}},c.prototype.open=function(a,b,c,d,e,f){var g=this._xhr;g.open("GET",d);var h=0;g.onprogress=function(){var a=g.responseText,c=a.slice(h);h+=c.length,b(c)},g.onreadystatechange=function(){if(2===g.readyState){var b=g.status,d=g.statusText,e=g.getResponseHeader("Content-Type");a(b,d,e)}else 4===g.readyState&&c()},g.withCredentials=e,g.responseType="text";for(var i in f)Object.prototype.hasOwnProperty.call(f,i)&&g.setRequestHeader(i,f[i]);g.send()},c.prototype.cancel=function(){var a=this._xhr;a.abort()},d.prototype.dispatchEvent=function(a){a.target=this;var b=this._listeners[a.type];if(void 0!=b)for(var c=b.length,d=0;c>d;d+=1){var f=b[d];try{"function"==typeof f.handleEvent?f.handleEvent(a):f.call(this,a)}catch(g){e(g)}}},d.prototype.addEventListener=function(a,b){a=String(a);var c=this._listeners,d=c[a];void 0==d&&(d=[],c[a]=d);for(var e=!1,f=0;f<d.length;f+=1)d[f]===b&&(e=!0);e||d.push(b)},d.prototype.removeEventListener=function(a,b){a=String(a);var c=this._listeners,d=c[a];if(void 0!=d){for(var e=[],f=0;f<d.length;f+=1)d[f]!==b&&e.push(d[f]);0===e.length?delete c[a]:c[a]=e}},g.prototype=Object.create(f.prototype);var q=-1,r=0,s=1,t=2,u=-1,v=0,w=1,x=2,y=3,z=/^text\/event\-stream;?(\s*charset\=utf\-8)?$/i,A=1e3,B=18e6,C=function(a,b){var c=parseInt(a,10);return c!==c&&(c=b),D(c)},D=function(a){return Math.min(Math.max(a,A),B)},E=function(a,b,c){try{"function"==typeof b&&b.call(a,c)}catch(d){e(d)}};h.prototype=Object.create(d.prototype),h.prototype.CONNECTING=r,h.prototype.OPEN=s,h.prototype.CLOSED=t,h.prototype.close=function(){this._close()},h.CONNECTING=r,h.OPEN=s,h.CLOSED=t,h.prototype.withCredentials=void 0,a.EventSourcePolyfill=h,a.NativeEventSource=n,void 0==l||void 0!=n&&"withCredentials"in n.prototype||(a.EventSource=h)}("undefined"!=typeof window?window:this);
astra-sites/inc/assets/js/fetch.umd.js ADDED
@@ -0,0 +1,538 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Fetch
3
+ * https://github.com/github/fetch
4
+ *
5
+ * Released under the MIT License (MIT)
6
+ * https://github.com/github/fetch/blob/master/LICENSE
7
+ */
8
+ (function (global, factory) {
9
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
10
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
11
+ (factory((global.WHATWGFetch = {})));
12
+ }(this, (function (exports) { 'use strict';
13
+
14
+ var support = {
15
+ searchParams: 'URLSearchParams' in self,
16
+ iterable: 'Symbol' in self && 'iterator' in Symbol,
17
+ blob:
18
+ 'FileReader' in self &&
19
+ 'Blob' in self &&
20
+ (function() {
21
+ try {
22
+ new Blob();
23
+ return true
24
+ } catch (e) {
25
+ return false
26
+ }
27
+ })(),
28
+ formData: 'FormData' in self,
29
+ arrayBuffer: 'ArrayBuffer' in self
30
+ };
31
+
32
+ function isDataView(obj) {
33
+ return obj && DataView.prototype.isPrototypeOf(obj)
34
+ }
35
+
36
+ if (support.arrayBuffer) {
37
+ var viewClasses = [
38
+ '[object Int8Array]',
39
+ '[object Uint8Array]',
40
+ '[object Uint8ClampedArray]',
41
+ '[object Int16Array]',
42
+ '[object Uint16Array]',
43
+ '[object Int32Array]',
44
+ '[object Uint32Array]',
45
+ '[object Float32Array]',
46
+ '[object Float64Array]'
47
+ ];
48
+
49
+ var isArrayBufferView =
50
+ ArrayBuffer.isView ||
51
+ function(obj) {
52
+ return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
53
+ };
54
+ }
55
+
56
+ function normalizeName(name) {
57
+ if (typeof name !== 'string') {
58
+ name = String(name);
59
+ }
60
+ if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
61
+ throw new TypeError('Invalid character in header field name')
62
+ }
63
+ return name.toLowerCase()
64
+ }
65
+
66
+ function normalizeValue(value) {
67
+ if (typeof value !== 'string') {
68
+ value = String(value);
69
+ }
70
+ return value
71
+ }
72
+
73
+ // Build a destructive iterator for the value list
74
+ function iteratorFor(items) {
75
+ var iterator = {
76
+ next: function() {
77
+ var value = items.shift();
78
+ return {done: value === undefined, value: value}
79
+ }
80
+ };
81
+
82
+ if (support.iterable) {
83
+ iterator[Symbol.iterator] = function() {
84
+ return iterator
85
+ };
86
+ }
87
+
88
+ return iterator
89
+ }
90
+
91
+ function Headers(headers) {
92
+ this.map = {};
93
+
94
+ if (headers instanceof Headers) {
95
+ headers.forEach(function(value, name) {
96
+ this.append(name, value);
97
+ }, this);
98
+ } else if (Array.isArray(headers)) {
99
+ headers.forEach(function(header) {
100
+ this.append(header[0], header[1]);
101
+ }, this);
102
+ } else if (headers) {
103
+ Object.getOwnPropertyNames(headers).forEach(function(name) {
104
+ this.append(name, headers[name]);
105
+ }, this);
106
+ }
107
+ }
108
+
109
+ Headers.prototype.append = function(name, value) {
110
+ name = normalizeName(name);
111
+ value = normalizeValue(value);
112
+ var oldValue = this.map[name];
113
+ this.map[name] = oldValue ? oldValue + ', ' + value : value;
114
+ };
115
+
116
+ Headers.prototype['delete'] = function(name) {
117
+ delete this.map[normalizeName(name)];
118
+ };
119
+
120
+ Headers.prototype.get = function(name) {
121
+ name = normalizeName(name);
122
+ return this.has(name) ? this.map[name] : null
123
+ };
124
+
125
+ Headers.prototype.has = function(name) {
126
+ return this.map.hasOwnProperty(normalizeName(name))
127
+ };
128
+
129
+ Headers.prototype.set = function(name, value) {
130
+ this.map[normalizeName(name)] = normalizeValue(value);
131
+ };
132
+
133
+ Headers.prototype.forEach = function(callback, thisArg) {
134
+ for (var name in this.map) {
135
+ if (this.map.hasOwnProperty(name)) {
136
+ callback.call(thisArg, this.map[name], name, this);
137
+ }
138
+ }
139
+ };
140
+
141
+ Headers.prototype.keys = function() {
142
+ var items = [];
143
+ this.forEach(function(value, name) {
144
+ items.push(name);
145
+ });
146
+ return iteratorFor(items)
147
+ };
148
+
149
+ Headers.prototype.values = function() {
150
+ var items = [];
151
+ this.forEach(function(value) {
152
+ items.push(value);
153
+ });
154
+ return iteratorFor(items)
155
+ };
156
+
157
+ Headers.prototype.entries = function() {
158
+ var items = [];
159
+ this.forEach(function(value, name) {
160
+ items.push([name, value]);
161
+ });
162
+ return iteratorFor(items)
163
+ };
164
+
165
+ if (support.iterable) {
166
+ Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
167
+ }
168
+
169
+ function consumed(body) {
170
+ if (body.bodyUsed) {
171
+ return Promise.reject(new TypeError('Already read'))
172
+ }
173
+ body.bodyUsed = true;
174
+ }
175
+
176
+ function fileReaderReady(reader) {
177
+ return new Promise(function(resolve, reject) {
178
+ reader.onload = function() {
179
+ resolve(reader.result);
180
+ };
181
+ reader.onerror = function() {
182
+ reject(reader.error);
183
+ };
184
+ })
185
+ }
186
+
187
+ function readBlobAsArrayBuffer(blob) {
188
+ var reader = new FileReader();
189
+ var promise = fileReaderReady(reader);
190
+ reader.readAsArrayBuffer(blob);
191
+ return promise
192
+ }
193
+
194
+ function readBlobAsText(blob) {
195
+ var reader = new FileReader();
196
+ var promise = fileReaderReady(reader);
197
+ reader.readAsText(blob);
198
+ return promise
199
+ }
200
+
201
+ function readArrayBufferAsText(buf) {
202
+ var view = new Uint8Array(buf);
203
+ var chars = new Array(view.length);
204
+
205
+ for (var i = 0; i < view.length; i++) {
206
+ chars[i] = String.fromCharCode(view[i]);
207
+ }
208
+ return chars.join('')
209
+ }
210
+
211
+ function bufferClone(buf) {
212
+ if (buf.slice) {
213
+ return buf.slice(0)
214
+ } else {
215
+ var view = new Uint8Array(buf.byteLength);
216
+ view.set(new Uint8Array(buf));
217
+ return view.buffer
218
+ }
219
+ }
220
+
221
+ function Body() {
222
+ this.bodyUsed = false;
223
+
224
+ this._initBody = function(body) {
225
+ this._bodyInit = body;
226
+ if (!body) {
227
+ this._bodyText = '';
228
+ } else if (typeof body === 'string') {
229
+ this._bodyText = body;
230
+ } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
231
+ this._bodyBlob = body;
232
+ } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
233
+ this._bodyFormData = body;
234
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
235
+ this._bodyText = body.toString();
236
+ } else if (support.arrayBuffer && support.blob && isDataView(body)) {
237
+ this._bodyArrayBuffer = bufferClone(body.buffer);
238
+ // IE 10-11 can't handle a DataView body.
239
+ this._bodyInit = new Blob([this._bodyArrayBuffer]);
240
+ } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
241
+ this._bodyArrayBuffer = bufferClone(body);
242
+ } else {
243
+ this._bodyText = body = Object.prototype.toString.call(body);
244
+ }
245
+
246
+ if (!this.headers.get('content-type')) {
247
+ if (typeof body === 'string') {
248
+ this.headers.set('content-type', 'text/plain;charset=UTF-8');
249
+ } else if (this._bodyBlob && this._bodyBlob.type) {
250
+ this.headers.set('content-type', this._bodyBlob.type);
251
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
252
+ this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
253
+ }
254
+ }
255
+ };
256
+
257
+ if (support.blob) {
258
+ this.blob = function() {
259
+ var rejected = consumed(this);
260
+ if (rejected) {
261
+ return rejected
262
+ }
263
+
264
+ if (this._bodyBlob) {
265
+ return Promise.resolve(this._bodyBlob)
266
+ } else if (this._bodyArrayBuffer) {
267
+ return Promise.resolve(new Blob([this._bodyArrayBuffer]))
268
+ } else if (this._bodyFormData) {
269
+ throw new Error('could not read FormData body as blob')
270
+ } else {
271
+ return Promise.resolve(new Blob([this._bodyText]))
272
+ }
273
+ };
274
+
275
+ this.arrayBuffer = function() {
276
+ if (this._bodyArrayBuffer) {
277
+ return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
278
+ } else {
279
+ return this.blob().then(readBlobAsArrayBuffer)
280
+ }
281
+ };
282
+ }
283
+
284
+ this.text = function() {
285
+ var rejected = consumed(this);
286
+ if (rejected) {
287
+ return rejected
288
+ }
289
+
290
+ if (this._bodyBlob) {
291
+ return readBlobAsText(this._bodyBlob)
292
+ } else if (this._bodyArrayBuffer) {
293
+ return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
294
+ } else if (this._bodyFormData) {
295
+ throw new Error('could not read FormData body as text')
296
+ } else {
297
+ return Promise.resolve(this._bodyText)
298
+ }
299
+ };
300
+
301
+ if (support.formData) {
302
+ this.formData = function() {
303
+ return this.text().then(decode)
304
+ };
305
+ }
306
+
307
+ this.json = function() {
308
+ return this.text().then(JSON.parse)
309
+ };
310
+
311
+ return this
312
+ }
313
+
314
+ // HTTP methods whose capitalization should be normalized
315
+ var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
316
+
317
+ function normalizeMethod(method) {
318
+ var upcased = method.toUpperCase();
319
+ return methods.indexOf(upcased) > -1 ? upcased : method
320
+ }
321
+
322
+ function Request(input, options) {
323
+ options = options || {};
324
+ var body = options.body;
325
+
326
+ if (input instanceof Request) {
327
+ if (input.bodyUsed) {
328
+ throw new TypeError('Already read')
329
+ }
330
+ this.url = input.url;
331
+ this.credentials = input.credentials;
332
+ if (!options.headers) {
333
+ this.headers = new Headers(input.headers);
334
+ }
335
+ this.method = input.method;
336
+ this.mode = input.mode;
337
+ this.signal = input.signal;
338
+ if (!body && input._bodyInit != null) {
339
+ body = input._bodyInit;
340
+ input.bodyUsed = true;
341
+ }
342
+ } else {
343
+ this.url = String(input);
344
+ }
345
+
346
+ this.credentials = options.credentials || this.credentials || 'same-origin';
347
+ if (options.headers || !this.headers) {
348
+ this.headers = new Headers(options.headers);
349
+ }
350
+ this.method = normalizeMethod(options.method || this.method || 'GET');
351
+ this.mode = options.mode || this.mode || null;
352
+ this.signal = options.signal || this.signal;
353
+ this.referrer = null;
354
+
355
+ if ((this.method === 'GET' || this.method === 'HEAD') && body) {
356
+ throw new TypeError('Body not allowed for GET or HEAD requests')
357
+ }
358
+ this._initBody(body);
359
+ }
360
+
361
+ Request.prototype.clone = function() {
362
+ return new Request(this, {body: this._bodyInit})
363
+ };
364
+
365
+ function decode(body) {
366
+ var form = new FormData();
367
+ body
368
+ .trim()
369
+ .split('&')
370
+ .forEach(function(bytes) {
371
+ if (bytes) {
372
+ var split = bytes.split('=');
373
+ var name = split.shift().replace(/\+/g, ' ');
374
+ var value = split.join('=').replace(/\+/g, ' ');
375
+ form.append(decodeURIComponent(name), decodeURIComponent(value));
376
+ }
377
+ });
378
+ return form
379
+ }
380
+
381
+ function parseHeaders(rawHeaders) {
382
+ var headers = new Headers();
383
+ // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
384
+ // https://tools.ietf.org/html/rfc7230#section-3.2
385
+ var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
386
+ preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
387
+ var parts = line.split(':');
388
+ var key = parts.shift().trim();
389
+ if (key) {
390
+ var value = parts.join(':').trim();
391
+ headers.append(key, value);
392
+ }
393
+ });
394
+ return headers
395
+ }
396
+
397
+ Body.call(Request.prototype);
398
+
399
+ function Response(bodyInit, options) {
400
+ if (!options) {
401
+ options = {};
402
+ }
403
+
404
+ this.type = 'default';
405
+ this.status = options.status === undefined ? 200 : options.status;
406
+ this.ok = this.status >= 200 && this.status < 300;
407
+ this.statusText = 'statusText' in options ? options.statusText : 'OK';
408
+ this.headers = new Headers(options.headers);
409
+ this.url = options.url || '';
410
+ this._initBody(bodyInit);
411
+ }
412
+
413
+ Body.call(Response.prototype);
414
+
415
+ Response.prototype.clone = function() {
416
+ return new Response(this._bodyInit, {
417
+ status: this.status,
418
+ statusText: this.statusText,
419
+ headers: new Headers(this.headers),
420
+ url: this.url
421
+ })
422
+ };
423
+
424
+ Response.error = function() {
425
+ var response = new Response(null, {status: 0, statusText: ''});
426
+ response.type = 'error';
427
+ return response
428
+ };
429
+
430
+ var redirectStatuses = [301, 302, 303, 307, 308];
431
+
432
+ Response.redirect = function(url, status) {
433
+ if (redirectStatuses.indexOf(status) === -1) {
434
+ throw new RangeError('Invalid status code')
435
+ }
436
+
437
+ return new Response(null, {status: status, headers: {location: url}})
438
+ };
439
+
440
+ exports.DOMException = self.DOMException;
441
+ try {
442
+ new exports.DOMException();
443
+ } catch (err) {
444
+ exports.DOMException = function(message, name) {
445
+ this.message = message;
446
+ this.name = name;
447
+ var error = Error(message);
448
+ this.stack = error.stack;
449
+ };
450
+ exports.DOMException.prototype = Object.create(Error.prototype);
451
+ exports.DOMException.prototype.constructor = exports.DOMException;
452
+ }
453
+
454
+ function fetch(input, init) {
455
+ return new Promise(function(resolve, reject) {
456
+ var request = new Request(input, init);
457
+
458
+ if (request.signal && request.signal.aborted) {
459
+ return reject(new exports.DOMException('Aborted', 'AbortError'))
460
+ }
461
+
462
+ var xhr = new XMLHttpRequest();
463
+
464
+ function abortXhr() {
465
+ xhr.abort();
466
+ }
467
+
468
+ xhr.onload = function() {
469
+ var options = {
470
+ status: xhr.status,
471
+ statusText: xhr.statusText,
472
+ headers: parseHeaders(xhr.getAllResponseHeaders() || '')
473
+ };
474
+ options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
475
+ var body = 'response' in xhr ? xhr.response : xhr.responseText;
476
+ resolve(new Response(body, options));
477
+ };
478
+
479
+ xhr.onerror = function() {
480
+ reject(new TypeError('Network request failed'));
481
+ };
482
+
483
+ xhr.ontimeout = function() {
484
+ reject(new TypeError('Network request failed'));
485
+ };
486
+
487
+ xhr.onabort = function() {
488
+ reject(new exports.DOMException('Aborted', 'AbortError'));
489
+ };
490
+
491
+ xhr.open(request.method, request.url, true);
492
+
493
+ if (request.credentials === 'include') {
494
+ xhr.withCredentials = true;
495
+ } else if (request.credentials === 'omit') {
496
+ xhr.withCredentials = false;
497
+ }
498
+
499
+ if ('responseType' in xhr && support.blob) {
500
+ xhr.responseType = 'blob';
501
+ }
502
+
503
+ request.headers.forEach(function(value, name) {
504
+ xhr.setRequestHeader(name, value);
505
+ });
506
+
507
+ if (request.signal) {
508
+ request.signal.addEventListener('abort', abortXhr);
509
+
510
+ xhr.onreadystatechange = function() {
511
+ // DONE (success or failure)
512
+ if (xhr.readyState === 4) {
513
+ request.signal.removeEventListener('abort', abortXhr);
514
+ }
515
+ };
516
+ }
517
+
518
+ xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
519
+ })
520
+ }
521
+
522
+ fetch.polyfill = true;
523
+
524
+ if (!self.fetch) {
525
+ self.fetch = fetch;
526
+ self.Headers = Headers;
527
+ self.Request = Request;
528
+ self.Response = Response;
529
+ }
530
+
531
+ exports.Headers = Headers;
532
+ exports.Request = Request;
533
+ exports.Response = Response;
534
+ exports.fetch = fetch;
535
+
536
+ Object.defineProperty(exports, '__esModule', { value: true });
537
+
538
+ })));
astra-sites/inc/assets/js/helper.js ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
6
+
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ var PHP = {
14
+ stdClass: function stdClass() {},
15
+ stringify: function stringify(val) {
16
+ var hash = new Map([[Infinity, "d:INF;"], [-Infinity, "d:-INF;"], [NaN, "d:NAN;"], [null, "N;"], [undefined, "N;"]]);
17
+
18
+ var utf8length = function utf8length(str) {
19
+ return str ? encodeURI(str).match(/(%.)?./g).length : 0;
20
+ };
21
+
22
+ var serializeString = function serializeString(s) {
23
+ var delim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '"';
24
+ return "".concat(utf8length(s), ":").concat(delim[0]).concat(s).concat(delim[delim.length - 1]);
25
+ };
26
+
27
+ var ref = 0;
28
+
29
+ function serialize(val) {
30
+ var canReference = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
31
+ if (hash.has(val)) return hash.get(val);
32
+ ref += canReference;
33
+ if (typeof val === "string") return "s:".concat(serializeString(val), ";");
34
+ if (typeof val === "number") return "".concat(Math.round(val) === val ? "i" : "d", ":").concat(("" + val).toUpperCase().replace(/(-?\d)E/, "$1.0E"), ";");
35
+ if (typeof val === "boolean") return "b:".concat(+val, ";");
36
+ var a = Array.isArray(val) || val.constructor === Object;
37
+ hash.set(val, "".concat("rR"[+a], ":").concat(ref, ";"));
38
+
39
+ if (typeof val.serialize === "function") {
40
+ return "C:".concat(serializeString(val.constructor.name), ":").concat(serializeString(val.serialize(), "{}"));
41
+ }
42
+
43
+ var vals = Object.entries(val).filter(function (_ref) {
44
+ var _ref2 = _slicedToArray(_ref, 2),
45
+ k = _ref2[0],
46
+ v = _ref2[1];
47
+
48
+ return typeof v !== "function";
49
+ });
50
+ return (a ? "a" : "O:".concat(serializeString(val.constructor.name))) + ":".concat(vals.length, ":{").concat(vals.map(function (_ref3) {
51
+ var _ref4 = _slicedToArray(_ref3, 2),
52
+ k = _ref4[0],
53
+ v = _ref4[1];
54
+
55
+ return serialize(a && /^\d{1,16}$/.test(k) ? +k : k, false) + serialize(v);
56
+ }).join(""), "}");
57
+ }
58
+
59
+ return serialize(val);
60
+ },
61
+ // Provide in second argument the classes that may be instantiated
62
+ // e.g. { MyClass1, MyClass2 }
63
+ parse: function parse(str) {
64
+ var allowedClasses = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
65
+ allowedClasses.stdClass = PHP.stdClass; // Always allowed.
66
+
67
+ var offset = 0;
68
+ var values = [null];
69
+ var specialNums = {
70
+ "INF": Infinity,
71
+ "-INF": -Infinity,
72
+ "NAN": NaN
73
+ };
74
+
75
+ var kick = function kick(msg) {
76
+ var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : offset;
77
+ throw new Error("Error at ".concat(i, ": ").concat(msg, "\n").concat(str, "\n").concat(" ".repeat(i), "^"));
78
+ };
79
+
80
+ var read = function read(expected, ret) {
81
+ return expected === str.slice(offset, offset += expected.length) ? ret : kick("Expected '".concat(expected, "'"), offset - expected.length);
82
+ };
83
+
84
+ function readMatch(regex, msg) {
85
+ var terminator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ";";
86
+ read(":");
87
+ var match = regex.exec(str.slice(offset));
88
+ if (!match) kick("Exected ".concat(msg, ", but got '").concat(str.slice(offset).match(/^[:;{}]|[^:;{}]*/)[0], "'"));
89
+ offset += match[0].length;
90
+ return read(terminator, match[0]);
91
+ }
92
+
93
+ function readUtf8chars(numUtf8Bytes) {
94
+ var terminator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
95
+ var i = offset;
96
+
97
+ while (numUtf8Bytes > 0) {
98
+ var code = str.charCodeAt(offset++);
99
+ numUtf8Bytes -= code < 0x80 ? 1 : code < 0x800 || code >> 11 === 0x1B ? 2 : 3;
100
+ }
101
+
102
+ return numUtf8Bytes ? kick("Invalid string length", i - 2) : read(terminator, str.slice(i, offset));
103
+ }
104
+
105
+ var create = function create(className) {
106
+ return !className ? {} : allowedClasses[className] ? Object.create(allowedClasses[className].prototype) : new (_defineProperty({}, className, function () {})[className])();
107
+ }; // Create a mock class for this name
108
+
109
+
110
+ var readBoolean = function readBoolean() {
111
+ return readMatch(/^[01]/, "a '0' or '1'", ";");
112
+ };
113
+
114
+ var readInt = function readInt() {
115
+ return +readMatch(/^-?\d+/, "an integer", ";");
116
+ };
117
+
118
+ var readUInt = function readUInt(terminator) {
119
+ return +readMatch(/^\d+/, "an unsigned integer", terminator);
120
+ };
121
+
122
+ var readString = function readString() {
123
+ var terminator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
124
+ return readUtf8chars(readUInt(':"'), '"' + terminator);
125
+ };
126
+
127
+ function readDecimal() {
128
+ var num = readMatch(/^-?(\d+(\.\d+)?(E[+-]\d+)?|INF)|NAN/, "a decimal number", ";");
129
+ return num in specialNums ? specialNums[num] : +num;
130
+ }
131
+
132
+ function readKey() {
133
+ var typ = str[offset++];
134
+ return typ === "s" ? readString(";") : typ === "i" ? readUInt(";") : kick("Expected 's' or 'i' as type for a key, but got ${str[offset-1]}", offset - 1);
135
+ }
136
+
137
+ function readObject(obj) {
138
+ for (var i = 0, length = readUInt(":{"); i < length; i++) {
139
+ obj[readKey()] = readValue();
140
+ }
141
+
142
+ return read("}", obj);
143
+ }
144
+
145
+ function readArray() {
146
+ var obj = readObject({});
147
+ return Object.keys(obj).some(function (key, i) {
148
+ return key != i;
149
+ }) ? obj : Object.values(obj);
150
+ }
151
+
152
+ function readCustomObject(obj) {
153
+ if (typeof obj.unserialize !== "function") kick("Instance of ".concat(obj.constructor.name, " does not have an \"unserialize\" method"));
154
+ obj.unserialize(readUtf8chars(readUInt(":{")));
155
+ return read("}", obj);
156
+ }
157
+
158
+ function readValue() {
159
+ var typ = str[offset++].toLowerCase();
160
+ var ref = values.push(null) - 1;
161
+ var val = typ === "n" ? read(";", null) : typ === "s" ? readString(";") : typ === "b" ? readBoolean() : typ === "i" ? readInt() : typ === "d" ? readDecimal() : typ === "a" ? readArray() // Associative array
162
+ : typ === "o" ? readObject(create(readString())) // Object
163
+ : typ === "c" ? readCustomObject(create(readString())) // Custom serialized object
164
+ : typ === "r" ? values[readInt()] // Backreference
165
+ : kick("Unexpected type ".concat(typ), offset - 1);
166
+ if (typ !== "r") values[ref] = val;
167
+ return val;
168
+ }
169
+
170
+ var val = readValue();
171
+ if (offset !== str.length) kick("Unexpected trailing character");
172
+ return val;
173
+ }
174
+ };
astra-sites/inc/assets/js/history.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * History.js
3
+ * https://github.com/browserstate/history.js
4
+ *
5
+ * Copyright © 2014+ Bevry Pty Ltd us@bevry.me (http://bevry.me)
6
+ * Copyright © 2011-2013 Benjamin Lupton b@lupton.cc (http://balupton.com)
7
+ * Released under the BSD License
8
+ * https://github.com/browserstate/history.js/blob/master/LICENSE.md
9
+ */
10
+ (function(e,t){"use strict";var n=e.History=e.History||{},r=e.jQuery;if(typeof n.Adapter!="undefined")throw new Error("History.js Adapter has already been loaded...");n.Adapter={bind:function(e,t,n){r(e).bind(t,n)},trigger:function(e,t,n){r(e).trigger(t,n)},extractEventData:function(e,n,r){var i=n&&n.originalEvent&&n.originalEvent[e]||r&&r[e]||t;return i},onDomLoad:function(e){r(e)}},typeof n.init!="undefined"&&n.init()})(window),function(e,t){"use strict";var n=e.console||t,r=e.document,i=e.navigator,s=!1,o=e.setTimeout,u=e.clearTimeout,a=e.setInterval,f=e.clearInterval,l=e.JSON,c=e.alert,h=e.History=e.History||{},p=e.history;try{s=e.sessionStorage,s.setItem("TEST","1"),s.removeItem("TEST")}catch(d){s=!1}l.stringify=l.stringify||l.encode,l.parse=l.parse||l.decode;if(typeof h.init!="undefined")throw new Error("History.js Core has already been loaded...");h.init=function(e){return typeof h.Adapter=="undefined"?!1:(typeof h.initCore!="undefined"&&h.initCore(),typeof h.initHtml4!="undefined"&&h.initHtml4(),!0)},h.initCore=function(d){if(typeof h.initCore.initialized!="undefined")return!1;h.initCore.initialized=!0,h.options=h.options||{},h.options.hashChangeInterval=h.options.hashChangeInterval||100,h.options.safariPollInterval=h.options.safariPollInterval||500,h.options.doubleCheckInterval=h.options.doubleCheckInterval||500,h.options.disableSuid=h.options.disableSuid||!1,h.options.storeInterval=h.options.storeInterval||1e3,h.options.busyDelay=h.options.busyDelay||250,h.options.debug=h.options.debug||!1,h.options.initialTitle=h.options.initialTitle||r.title,h.options.html4Mode=h.options.html4Mode||!1,h.options.delayInit=h.options.delayInit||!1,h.intervalList=[],h.clearAllIntervals=function(){var e,t=h.intervalList;if(typeof t!="undefined"&&t!==null){for(e=0;e<t.length;e++)f(t[e]);h.intervalList=null}},h.debug=function(){(h.options.debug||!1)&&h.log.apply(h,arguments)},h.log=function(){var e=typeof n!="undefined"&&typeof n.log!="undefined"&&typeof n.log.apply!="undefined",t=r.getElementById("log"),i,s,o,u,a;e?(u=Array.prototype.slice.call(arguments),i=u.shift(),typeof n.debug!="undefined"?n.debug.apply(n,[i,u]):n.log.apply(n,[i,u])):i="\n"+arguments[0]+"\n";for(s=1,o=arguments.length;s<o;++s){a=arguments[s];if(typeof a=="object"&&typeof l!="undefined")try{a=l.stringify(a)}catch(f){}i+="\n"+a+"\n"}return t?(t.value+=i+"\n-----\n",t.scrollTop=t.scrollHeight-t.clientHeight):e||c(i),!0},h.getInternetExplorerMajorVersion=function(){var e=h.getInternetExplorerMajorVersion.cached=typeof h.getInternetExplorerMajorVersion.cached!="undefined"?h.getInternetExplorerMajorVersion.cached:function(){var e=3,t=r.createElement("div"),n=t.getElementsByTagName("i");while((t.innerHTML="<!--[if gt IE "+ ++e+"]><i></i><![endif]-->")&&n[0]);return e>4?e:!1}();return e},h.isInternetExplorer=function(){var e=h.isInternetExplorer.cached=typeof h.isInternetExplorer.cached!="undefined"?h.isInternetExplorer.cached:Boolean(h.getInternetExplorerMajorVersion());return e},h.options.html4Mode?h.emulated={pushState:!0,hashChange:!0}:h.emulated={pushState:!Boolean(e.history&&e.history.pushState&&e.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(i.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(i.userAgent)),hashChange:Boolean(!("onhashchange"in e||"onhashchange"in r)||h.isInternetExplorer()&&h.getInternetExplorerMajorVersion()<8)},h.enabled=!h.emulated.pushState,h.bugs={setHash:Boolean(!h.emulated.pushState&&i.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)),safariPoll:Boolean(!h.emulated.pushState&&i.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)),ieDoubleCheck:Boolean(h.isInternetExplorer()&&h.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(h.isInternetExplorer()&&h.getInternetExplorerMajorVersion()<7)},h.isEmptyObject=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},h.cloneObject=function(e){var t,n;return e?(t=l.stringify(e),n=l.parse(t)):n={},n},h.getRootUrl=function(){var e=r.location.protocol+"//"+(r.location.hostname||r.location.host);if(r.location.port||!1)e+=":"+r.location.port;return e+="/",e},h.getBaseHref=function(){var e=r.getElementsByTagName("base"),t=null,n="";return e.length===1&&(t=e[0],n=t.href.replace(/[^\/]+$/,"")),n=n.replace(/\/+$/,""),n&&(n+="/"),n},h.getBaseUrl=function(){var e=h.getBaseHref()||h.getBasePageUrl()||h.getRootUrl();return e},h.getPageUrl=function(){var e=h.getState(!1,!1),t=(e||{}).url||h.getLocationHref(),n;return n=t.replace(/\/+$/,"").replace(/[^\/]+$/,function(e,t,n){return/\./.test(e)?e:e+"/"}),n},h.getBasePageUrl=function(){var e=h.getLocationHref().replace(/[#\?].*/,"").replace(/[^\/]+$/,function(e,t,n){return/[^\/]$/.test(e)?"":e}).replace(/\/+$/,"")+"/";return e},h.getFullUrl=function(e,t){var n=e,r=e.substring(0,1);return t=typeof t=="undefined"?!0:t,/[a-z]+\:\/\//.test(e)||(r==="/"?n=h.getRootUrl()+e.replace(/^\/+/,""):r==="#"?n=h.getPageUrl().replace(/#.*/,"")+e:r==="?"?n=h.getPageUrl().replace(/[\?#].*/,"")+e:t?n=h.getBaseUrl()+e.replace(/^(\.\/)+/,""):n=h.getBasePageUrl()+e.replace(/^(\.\/)+/,"")),n.replace(/\#$/,"")},h.getShortUrl=function(e){var t=e,n=h.getBaseUrl(),r=h.getRootUrl();return h.emulated.pushState&&(t=t.replace(n,"")),t=t.replace(r,"/"),h.isTraditionalAnchor(t)&&(t="./"+t),t=t.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),t},h.getLocationHref=function(e){return e=e||r,e.URL===e.location.href?e.location.href:e.location.href===decodeURIComponent(e.URL)?e.URL:e.location.hash&&decodeURIComponent(e.location.href.replace(/^[^#]+/,""))===e.location.hash?e.location.href:e.URL.indexOf("#")==-1&&e.location.href.indexOf("#")!=-1?e.location.href:e.URL||e.location.href},h.store={},h.idToState=h.idToState||{},h.stateToId=h.stateToId||{},h.urlToId=h.urlToId||{},h.storedStates=h.storedStates||[],h.savedStates=h.savedStates||[],h.normalizeStore=function(){h.store.idToState=h.store.idToState||{},h.store.urlToId=h.store.urlToId||{},h.store.stateToId=h.store.stateToId||{}},h.getState=function(e,t){typeof e=="undefined"&&(e=!0),typeof t=="undefined"&&(t=!0);var n=h.getLastSavedState();return!n&&t&&(n=h.createStateObject()),e&&(n=h.cloneObject(n),n.url=n.cleanUrl||n.url),n},h.getIdByState=function(e){var t=h.extractId(e.url),n;if(!t){n=h.getStateString(e);if(typeof h.stateToId[n]!="undefined")t=h.stateToId[n];else if(typeof h.store.stateToId[n]!="undefined")t=h.store.stateToId[n];else{for(;;){t=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof h.idToState[t]=="undefined"&&typeof h.store.idToState[t]=="undefined")break}h.stateToId[n]=t,h.idToState[t]=e}}return t},h.normalizeState=function(e){var t,n;if(!e||typeof e!="object")e={};if(typeof e.normalized!="undefined")return e;if(!e.data||typeof e.data!="object")e.data={};return t={},t.normalized=!0,t.title=e.title||"",t.url=h.getFullUrl(e.url?e.url:h.getLocationHref()),t.hash=h.getShortUrl(t.url),t.data=h.cloneObject(e.data),t.id=h.getIdByState(t),t.cleanUrl=t.url.replace(/\??\&_suid.*/,""),t.url=t.cleanUrl,n=!h.isEmptyObject(t.data),(t.title||n)&&h.options.disableSuid!==!0&&(t.hash=h.getShortUrl(t.url).replace(/\??\&_suid.*/,""),/\?/.test(t.hash)||(t.hash+="?"),t.hash+="&_suid="+t.id),t.hashedUrl=h.getFullUrl(t.hash),(h.emulated.pushState||h.bugs.safariPoll)&&h.hasUrlDuplicate(t)&&(t.url=t.hashedUrl),t},h.createStateObject=function(e,t,n){var r={data:e,title:t,url:n};return r=h.normalizeState(r),r},h.getStateById=function(e){e=String(e);var n=h.idToState[e]||h.store.idToState[e]||t;return n},h.getStateString=function(e){var t,n,r;return t=h.normalizeState(e),n={data:t.data,title:e.title,url:e.url},r=l.stringify(n),r},h.getStateId=function(e){var t,n;return t=h.normalizeState(e),n=t.id,n},h.getHashByState=function(e){var t,n;return t=h.normalizeState(e),n=t.hash,n},h.extractId=function(e){var t,n,r,i;return e.indexOf("#")!=-1?i=e.split("#")[0]:i=e,n=/(.*)\&_suid=([0-9]+)$/.exec(i),r=n?n[1]||e:e,t=n?String(n[2]||""):"",t||!1},h.isTraditionalAnchor=function(e){var t=!/[\/\?\.]/.test(e);return t},h.extractState=function(e,t){var n=null,r,i;return t=t||!1,r=h.extractId(e),r&&(n=h.getStateById(r)),n||(i=h.getFullUrl(e),r=h.getIdByUrl(i)||!1,r&&(n=h.getStateById(r)),!n&&t&&!h.isTraditionalAnchor(e)&&(n=h.createStateObject(null,null,i))),n},h.getIdByUrl=function(e){var n=h.urlToId[e]||h.store.urlToId[e]||t;return n},h.getLastSavedState=function(){return h.savedStates[h.savedStates.length-1]||t},h.getLastStoredState=function(){return h.storedStates[h.storedStates.length-1]||t},h.hasUrlDuplicate=function(e){var t=!1,n;return n=h.extractState(e.url),t=n&&n.id!==e.id,t},h.storeState=function(e){return h.urlToId[e.url]=e.id,h.storedStates.push(h.cloneObject(e)),e},h.isLastSavedState=function(e){var t=!1,n,r,i;return h.savedStates.length&&(n=e.id,r=h.getLastSavedState(),i=r.id,t=n===i),t},h.saveState=function(e){return h.isLastSavedState(e)?!1:(h.savedStates.push(h.cloneObject(e)),!0)},h.getStateByIndex=function(e){var t=null;return typeof e=="undefined"?t=h.savedStates[h.savedStates.length-1]:e<0?t=h.savedStates[h.savedStates.length+e]:t=h.savedStates[e],t},h.getCurrentIndex=function(){var e=null;return h.savedStates.length<1?e=0:e=h.savedStates.length-1,e},h.getHash=function(e){var t=h.getLocationHref(e),n;return n=h.getHashByUrl(t),n},h.unescapeHash=function(e){var t=h.normalizeHash(e);return t=decodeURIComponent(t),t},h.normalizeHash=function(e){var t=e.replace(/[^#]*#/,"").replace(/#.*/,"");return t},h.setHash=function(e,t){var n,i;return t!==!1&&h.busy()?(h.pushQueue({scope:h,callback:h.setHash,args:arguments,queue:t}),!1):(h.busy(!0),n=h.extractState(e,!0),n&&!h.emulated.pushState?h.pushState(n.data,n.title,n.url,!1):h.getHash()!==e&&(h.bugs.setHash?(i=h.getPageUrl(),h.pushState(null,null,i+"#"+e,!1)):r.location.hash=e),h)},h.escapeHash=function(t){var n=h.normalizeHash(t);return n=e.encodeURIComponent(n),h.bugs.hashEscape||(n=n.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),n},h.getHashByUrl=function(e){var t=String(e).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return t=h.unescapeHash(t),t},h.setTitle=function(e){var t=e.title,n;t||(n=h.getStateByIndex(0),n&&n.url===e.url&&(t=n.title||h.options.initialTitle));try{r.getElementsByTagName("title")[0].innerHTML=t.replace("<","&lt;").replace(">","&gt;").replace(" & "," &amp; ")}catch(i){}return r.title=t,h},h.queues=[],h.busy=function(e){typeof e!="undefined"?h.busy.flag=e:typeof h.busy.flag=="undefined"&&(h.busy.flag=!1);if(!h.busy.flag){u(h.busy.timeout);var t=function(){var e,n,r;if(h.busy.flag)return;for(e=h.queues.length-1;e>=0;--e){n=h.queues[e];if(n.length===0)continue;r=n.shift(),h.fireQueueItem(r),h.busy.timeout=o(t,h.options.busyDelay)}};h.busy.timeout=o(t,h.options.busyDelay)}return h.busy.flag},h.busy.flag=!1,h.fireQueueItem=function(e){return e.callback.apply(e.scope||h,e.args||[])},h.pushQueue=function(e){return h.queues[e.queue||0]=h.queues[e.queue||0]||[],h.queues[e.queue||0].push(e),h},h.queue=function(e,t){return typeof e=="function"&&(e={callback:e}),typeof t!="undefined"&&(e.queue=t),h.busy()?h.pushQueue(e):h.fireQueueItem(e),h},h.clearQueue=function(){return h.busy.flag=!1,h.queues=[],h},h.stateChanged=!1,h.doubleChecker=!1,h.doubleCheckComplete=function(){return h.stateChanged=!0,h.doubleCheckClear(),h},h.doubleCheckClear=function(){return h.doubleChecker&&(u(h.doubleChecker),h.doubleChecker=!1),h},h.doubleCheck=function(e){return h.stateChanged=!1,h.doubleCheckClear(),h.bugs.ieDoubleCheck&&(h.doubleChecker=o(function(){return h.doubleCheckClear(),h.stateChanged||e(),!0},h.options.doubleCheckInterval)),h},h.safariStatePoll=function(){var t=h.extractState(h.getLocationHref()),n;if(!h.isLastSavedState(t))return n=t,n||(n=h.createStateObject()),h.Adapter.trigger(e,"popstate"),h;return},h.back=function(e){return e!==!1&&h.busy()?(h.pushQueue({scope:h,callback:h.back,args:arguments,queue:e}),!1):(h.busy(!0),h.doubleCheck(function(){h.back(!1)}),p.go(-1),!0)},h.forward=function(e){return e!==!1&&h.busy()?(h.pushQueue({scope:h,callback:h.forward,args:arguments,queue:e}),!1):(h.busy(!0),h.doubleCheck(function(){h.forward(!1)}),p.go(1),!0)},h.go=function(e,t){var n;if(e>0)for(n=1;n<=e;++n)h.forward(t);else{if(!(e<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(n=-1;n>=e;--n)h.back(t)}return h};if(h.emulated.pushState){var v=function(){};h.pushState=h.pushState||v,h.replaceState=h.replaceState||v}else h.onPopState=function(t,n){var r=!1,i=!1,s,o;return h.doubleCheckComplete(),s=h.getHash(),s?(o=h.extractState(s||h.getLocationHref(),!0),o?h.replaceState(o.data,o.title,o.url,!1):(h.Adapter.trigger(e,"anchorchange"),h.busy(!1)),h.expectedStateId=!1,!1):(r=h.Adapter.extractEventData("state",t,n)||!1,r?i=h.getStateById(r):h.expectedStateId?i=h.getStateById(h.expectedStateId):i=h.extractState(h.getLocationHref()),i||(i=h.createStateObject(null,null,h.getLocationHref())),h.expectedStateId=!1,h.isLastSavedState(i)?(h.busy(!1),!1):(h.storeState(i),h.saveState(i),h.setTitle(i),h.Adapter.trigger(e,"statechange"),h.busy(!1),!0))},h.Adapter.bind(e,"popstate",h.onPopState),h.pushState=function(t,n,r,i){if(h.getHashByUrl(r)&&h.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(i!==!1&&h.busy())return h.pushQueue({scope:h,callback:h.pushState,args:arguments,queue:i}),!1;h.busy(!0);var s=h.createStateObject(t,n,r);return h.isLastSavedState(s)?h.busy(!1):(h.storeState(s),h.expectedStateId=s.id,p.pushState(s.id,s.title,s.url),h.Adapter.trigger(e,"popstate")),!0},h.replaceState=function(t,n,r,i){if(h.getHashByUrl(r)&&h.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(i!==!1&&h.busy())return h.pushQueue({scope:h,callback:h.replaceState,args:arguments,queue:i}),!1;h.busy(!0);var s=h.createStateObject(t,n,r);return h.isLastSavedState(s)?h.busy(!1):(h.storeState(s),h.expectedStateId=s.id,p.replaceState(s.id,s.title,s.url),h.Adapter.trigger(e,"popstate")),!0};if(s){try{h.store=l.parse(s.getItem("History.store"))||{}}catch(m){h.store={}}h.normalizeStore()}else h.store={},h.normalizeStore();h.Adapter.bind(e,"unload",h.clearAllIntervals),h.saveState(h.storeState(h.extractState(h.getLocationHref(),!0))),s&&(h.onUnload=function(){var e,t,n;try{e=l.parse(s.getItem("History.store"))||{}}catch(r){e={}}e.idToState=e.idToState||{},e.urlToId=e.urlToId||{},e.stateToId=e.stateToId||{};for(t in h.idToState){if(!h.idToState.hasOwnProperty(t))continue;e.idToState[t]=h.idToState[t]}for(t in h.urlToId){if(!h.urlToId.hasOwnProperty(t))continue;e.urlToId[t]=h.urlToId[t]}for(t in h.stateToId){if(!h.stateToId.hasOwnProperty(t))continue;e.stateToId[t]=h.stateToId[t]}h.store=e,h.normalizeStore(),n=l.stringify(e);try{s.setItem("History.store",n)}catch(i){if(i.code!==DOMException.QUOTA_EXCEEDED_ERR)throw i;s.length&&(s.removeItem("History.store"),s.setItem("History.store",n))}},h.intervalList.push(a(h.onUnload,h.options.storeInterval)),h.Adapter.bind(e,"beforeunload",h.onUnload),h.Adapter.bind(e,"unload",h.onUnload));if(!h.emulated.pushState){h.bugs.safariPoll&&h.intervalList.push(a(h.safariStatePoll,h.options.safariPollInterval));if(i.vendor==="Apple Computer, Inc."||(i.appCodeName||"")==="Mozilla")h.Adapter.bind(e,"hashchange",function(){h.Adapter.trigger(e,"popstate")}),h.getHash()&&h.Adapter.onDomLoad(function(){h.Adapter.trigger(e,"hashchange")})}},(!h.options||!h.options.delayInit)&&h.init()}(window)
astra-sites/inc/assets/js/import-status.js ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ AstraSitesImportStatus = {
4
+ timer: null,
5
+ ajax_in_process: false,
6
+ current_step: null,
7
+ interval: $( '.astra-sites-import-screen' ).length ? 1000 : 10000,
8
+
9
+ /**
10
+ * Init
11
+ */
12
+ init: function()
13
+ {
14
+ this.start();
15
+ },
16
+
17
+ /**
18
+ * Start
19
+ */
20
+ start: function() {
21
+ AstraSitesImportStatus.timer = setInterval( AstraSitesImportStatus.check_status, AstraSitesImportStatus.interval );
22
+ },
23
+
24
+ /**
25
+ * Check Status
26
+ */
27
+ check_status: function() {
28
+ if( false === AstraSitesImportStatus.ajax_in_process ) {
29
+ AstraSitesImportStatus.ajax_in_process = true;
30
+ AstraSitesImportStatus._ajax_request();
31
+ }
32
+ },
33
+
34
+ /**
35
+ * Ajax Request
36
+ */
37
+ _ajax_request: function() {
38
+ $.ajax({
39
+ url: AstraSitesImportStatusVars.ajaxurl,
40
+ type: 'POST',
41
+ data: {
42
+ 'action' : 'astra_sites_check_import_status',
43
+ '_ajax_nonce' : AstraSitesImportStatusVars._ajax_nonce,
44
+ },
45
+ })
46
+ .done(function (result) {
47
+
48
+ AstraSitesImportStatus.ajax_in_process = false;
49
+
50
+ // Admin Bar UI markup.
51
+ if( "complete" === result.data.response.step || "fail" === result.data.response.step ) {
52
+ AstraSitesImportStatus.stop();
53
+
54
+ var response_message = '<span class="dashicons dashicons-no-alt"></span> Site Import Failed';
55
+ if( "complete" === result.data.response.step ) {
56
+ response_message = '<span class="dashicons dashicons-yes"></span>' + response_message;
57
+ }
58
+
59
+ $('#astra-sites-import-status-admin-bar').html( response_message );
60
+
61
+ } else {
62
+ $('#astra-sites-import-status-admin-bar').html( '<span class="loading"></span>' + result.data.response.message );
63
+ }
64
+
65
+ // Admin page UI markup.
66
+ var currentStep = $( '.import-step[data-step="' + result.data.response.step + '"]' );
67
+ if( currentStep.length ) {
68
+ if( "complete" === result.data.response.step || "fail" === result.data.response.step ) {
69
+ $( '.import-step' ).removeClass( 'processing' ).addClass( 'success' );;
70
+ } else if( AstraSitesImportStatus.current_step !== result.data.response.step ) {
71
+ AstraSitesImportStatus.current_step = result.data.response.step;
72
+
73
+ currentStep.prevAll().removeClass('processing').addClass('success');
74
+ currentStep.addClass('processing');
75
+ }
76
+ }
77
+ })
78
+ .fail(function (err) {
79
+ AstraSitesImportStatus.ajax_in_process = false;
80
+
81
+ // Stop.
82
+ AstraSitesImportStatus.stop();
83
+ });
84
+ },
85
+
86
+ /**
87
+ * Step
88
+ */
89
+ stop: function() {
90
+ clearInterval(AstraSitesImportStatus.timer);
91
+ }
92
+
93
+ };
94
+
95
+ /**
96
+ * Initialize AstraSitesImportStatus
97
+ */
98
+ $(function(){
99
+ AstraSitesImportStatus.init();
100
+ });
101
+
102
+ })(jQuery);
astra-sites/inc/assets/js/install-theme.js ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+
3
+ AstraSitesInstallTheme = {
4
+
5
+ /**
6
+ * Init
7
+ */
8
+ init: function() {
9
+ this._auto_close_notice();
10
+ this._bind();
11
+ },
12
+
13
+ /**
14
+ * Binds events for the Astra Sites.
15
+ *
16
+ * @since 1.3.2
17
+ *
18
+ * @access private
19
+ * @method _bind
20
+ */
21
+ _bind: function()
22
+ {
23
+ $( document ).on( 'click', '.astra-sites-theme-not-installed', AstraSitesInstallTheme._install_and_activate );
24
+ $( document ).on( 'click', '.astra-sites-theme-installed-but-inactive', AstraSitesInstallTheme._activateTheme );
25
+ $( document ).on( 'wp-theme-install-success' , AstraSitesInstallTheme._activateTheme);
26
+ },
27
+
28
+ /**
29
+ * Close Getting Started Notice
30
+ *
31
+ * @param {object} event
32
+ * @return void
33
+ */
34
+ _auto_close_notice: function() {
35
+
36
+ if( $( '.astra-sites-getting-started-btn' ).length ) {
37
+ $.ajax({
38
+ url: AstraSitesInstallThemeVars.ajaxurl,
39
+ type: 'POST',
40
+ data: {
41
+ 'action' : 'astra-sites-getting-started-notice',
42
+ '_ajax_nonce' : AstraSitesInstallThemeVars._ajax_nonce,
43
+ },
44
+ })
45
+ .done(function (result) {
46
+ });
47
+ }
48
+
49
+ },
50
+
51
+ /**
52
+ * Activate Theme
53
+ *
54
+ * @since 1.3.2
55
+ */
56
+ _activateTheme: function( event, response ) {
57
+ event.preventDefault();
58
+
59
+ $('#astra-theme-activation-nag a').addClass('processing');
60
+
61
+ if( response ) {
62
+ $('#astra-theme-activation-nag a').text( AstraSitesInstallThemeVars.installed );
63
+ } else {
64
+ $('#astra-theme-activation-nag a').text( AstraSitesInstallThemeVars.activating );
65
+ }
66
+
67
+ // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
68
+ setTimeout( function() {
69
+
70
+ $.ajax({
71
+ url: AstraSitesInstallThemeVars.ajaxurl,
72
+ type: 'POST',
73
+ data: {
74
+ 'action' : 'astra-sites-activate-theme',
75
+ '_ajax_nonce' : AstraSitesInstallThemeVars._ajax_nonce,
76
+ },
77
+ })
78
+ .done(function (result) {
79
+ if( result.success ) {
80
+ $('.astra-sites-theme-action-link').parent().html( AstraSitesInstallThemeVars.activated + ' 🎉' );
81
+ }
82
+
83
+ });
84
+
85
+ }, 3000 );
86
+
87
+ },
88
+
89
+ /**
90
+ * Install and activate
91
+ *
92
+ * @since 1.3.2
93
+ *
94
+ * @param {object} event Current event.
95
+ * @return void
96
+ */
97
+ _install_and_activate: function(event ) {
98
+ event.preventDefault();
99
+ var theme_slug = $(this).data('theme-slug') || '';
100
+ var btn = $( event.target );
101
+
102
+ if ( btn.hasClass( 'processing' ) ) {
103
+ return;
104
+ }
105
+
106
+ btn.text( AstraSitesInstallThemeVars.installing ).addClass('processing');
107
+
108
+ if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
109
+ wp.updates.requestFilesystemCredentials( event );
110
+ }
111
+
112
+ wp.updates.installTheme( {
113
+ slug: theme_slug
114
+ });
115
+ }
116
+
117
+ };
118
+
119
+ /**
120
+ * Initialize
121
+ */
122
+ $(function(){
123
+ AstraSitesInstallTheme.init();
124
+ });
125
+
126
+ })(jQuery);
astra-sites/inc/classes/batch-import/class-astra-sites-batch-import.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Batch Import
4
+ *
5
+ * @package Astra Sites
6
+ * @since 2.5.0
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Import' ) ) :
10
+
11
+ /**
12
+ * Batch Import
13
+ *
14
+ * @since 2.5.0
15
+ */
16
+ class Astra_Sites_Batch_Import {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 2.5.0
22
+ * @var object Class object.
23
+ * @access private
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 2.5.0
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self();
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ *
43
+ * @since 2.5.0
44
+ */
45
+ public function __construct() {
46
+
47
+ // WP Core Files.
48
+ require_once ABSPATH . 'wp-admin/includes/image.php';
49
+
50
+ // Image Downloader.
51
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-astra-sites-image-importer.php';
52
+
53
+ // Batch Processing.
54
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-async-request.php';
55
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-background-process.php';
56
+
57
+ // Site Import Batch.
58
+ require_once ASTRA_SITES_DIR . 'inc/classes/batch-import/class-astra-sites-batch-site-import.php';
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Kicking this off by calling 'get_instance()' method
64
+ */
65
+ Astra_Sites_Batch_Import::get_instance();
66
+
67
+ endif;
astra-sites/inc/classes/batch-import/class-astra-sites-batch-site-import-batch.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Complete Site Import Batch Process
4
+ *
5
+ * @package Astra Sites
6
+ * @since 2.5.0
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Site_Import_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
10
+
11
+ /**
12
+ * Site Import Batch
13
+ *
14
+ * @since 2.5.0
15
+ */
16
+ class Astra_Sites_Batch_Site_Import_Batch extends WP_Background_Process {
17
+
18
+ /**
19
+ * Batch Action
20
+ *
21
+ * @var string
22
+ */
23
+ protected $action = 'astra_sites_site_import_batch';
24
+
25
+ /**
26
+ * Task
27
+ *
28
+ * Override this method to perform any actions required on each
29
+ * queue item. Return the modified item for further processing
30
+ * in the next pass through. Or, return false to remove the
31
+ * item from the queue.
32
+ *
33
+ * @since 2.5.0
34
+ *
35
+ * @param array $data Queue item object.
36
+ * @return mixed
37
+ */
38
+ protected function task( $data ) {
39
+
40
+ $instance = $data['instance'];
41
+
42
+ if ( 'import_queue_1' === $data['method'] ) {
43
+ $instance->import_queue_1( $data['args'] );
44
+ }
45
+
46
+ if ( 'import_queue_2' === $data['method'] ) {
47
+ $instance->import_queue_2( $data['args'] );
48
+ }
49
+
50
+ if ( 'import_queue_3' === $data['method'] ) {
51
+ $instance->import_queue_3( $data['args'] );
52
+ }
53
+
54
+ return false;
55
+ }
56
+
57
+ }
58
+
59
+ endif;
astra-sites/inc/classes/batch-import/class-astra-sites-batch-site-import.php ADDED
@@ -0,0 +1,717 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Single Page Background Process
4
+ *
5
+ * @package Astra Sites
6
+ * @since 2.5.0
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Site_Import' ) ) :
10
+
11
+ /**
12
+ * Background Process
13
+ *
14
+ * @since 2.5.0
15
+ */
16
+ class Astra_Sites_Batch_Site_Import {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 2.5.0
22
+ *
23
+ * @access private
24
+ * @var object Class object.
25
+ */
26
+ private static $instance;
27
+
28
+ /**
29
+ * Current Site Data
30
+ *
31
+ * @since 2.5.0
32
+ *
33
+ * @access private
34
+ * @var object Class object.
35
+ */
36
+ public $current_site_data;
37
+
38
+ /**
39
+ * Process All
40
+ *
41
+ * @since 2.5.0
42
+ * @var object Class object.
43
+ * @access public
44
+ */
45
+ public static $site_import_batch;
46
+
47
+ /**
48
+ * Initiator
49
+ *
50
+ * @since 2.5.0
51
+ *
52
+ * @return object initialized object of class.
53
+ */
54
+ public static function get_instance() {
55
+ if ( ! isset( self::$instance ) ) {
56
+ self::$instance = new self();
57
+ }
58
+ return self::$instance;
59
+ }
60
+
61
+ /**
62
+ * Constructor
63
+ *
64
+ * @since 2.5.0
65
+ */
66
+ public function __construct() {
67
+
68
+ require_once ASTRA_SITES_DIR . 'inc/classes/batch-import/class-astra-sites-batch-site-import-batch.php';
69
+
70
+ /** WordPress Plugin Administration API */
71
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
72
+ require_once ABSPATH . 'wp-admin/includes/update.php';
73
+
74
+ self::$site_import_batch = new Astra_Sites_Batch_Site_Import_Batch();
75
+
76
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
77
+ add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu_item' ), 99 );
78
+ add_action( 'wp_ajax_astra_sites_check_import_status', array( $this, 'check_import_status' ) );
79
+ add_filter( 'wp_astra_sites_site_import_batch_cron_interval', array( $this, 'set_cron_interval' ) );
80
+
81
+ $status = $this->get_status();
82
+
83
+ if (
84
+ ! empty( $status ) &&
85
+ ( isset( $status['step'] ) && ( 'complete' !== $status['step'] && 'fail' !== $status['step'] ) )
86
+ ) {
87
+ add_filter( 'astra_sites_process_sync_batch', '__return_false' );
88
+ add_filter( 'astra_sites_process_auto_sync_library', '__return_false' );
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Set Cron Interval
94
+ *
95
+ * @param int $interval Cron interval time in minutes.
96
+ */
97
+ public function set_cron_interval( $interval = 5 ) {
98
+ return 1;
99
+ }
100
+
101
+ /**
102
+ * Check Import Status
103
+ */
104
+ public function check_import_status() {
105
+
106
+ // Verify Nonce.
107
+ check_ajax_referer( 'astra-sites-import-status', '_ajax_nonce' );
108
+
109
+ $schedule = wp_get_scheduled_event( 'wp_astra_sites_site_import_batch_cron' );
110
+ $time = '';
111
+ if ( $schedule ) {
112
+ $time = human_time_diff( $schedule->timestamp );
113
+ }
114
+
115
+ wp_send_json_success(
116
+ array(
117
+ 'response' => $this->get_status(),
118
+ 'time' => $time,
119
+ )
120
+ );
121
+ }
122
+
123
+ /**
124
+ * Get status
125
+ */
126
+ public function get_status() {
127
+ return get_option( 'astra_sites_site_import_batch_status', array() );
128
+ }
129
+
130
+ /**
131
+ * Update Import Status
132
+ *
133
+ * @param array $args Update status arguments.
134
+ */
135
+ public function update_status( $args = array() ) {
136
+
137
+ $status = $this->get_status();
138
+
139
+ $args = wp_parse_args( $args, $status );
140
+
141
+ update_option( 'astra_sites_site_import_batch_status', $args, 'no' );
142
+ }
143
+
144
+ /**
145
+ * Admin bar menu item
146
+ *
147
+ * @param instance $admin_bar Admin bar.
148
+ */
149
+ public function admin_bar_menu_item( $admin_bar = '' ) {
150
+ if ( ! is_admin() ) {
151
+ return;
152
+ }
153
+
154
+ $status = $this->get_status();
155
+ if ( empty( $status ) || ( isset( $status['step'] ) && 'complete' === $status['step'] ) ) {
156
+ return;
157
+ }
158
+
159
+ $admin_bar->add_menu(
160
+ array(
161
+ 'title' => '<a id="astra-sites-import-status-admin-bar" href="' . admin_url( 'themes.php?page=starter-templates&action=site-import' ) . '">' . esc_html__( 'Import Status', 'astra-sites' ) . '</a>',
162
+ 'id' => 'astra-sites-menu-item',
163
+ 'parent' => false,
164
+ )
165
+ );
166
+ }
167
+
168
+ /**
169
+ * Enqueue Scripts
170
+ *
171
+ * @param string $hook Current hook name.
172
+ */
173
+ public function enqueue_scripts( $hook = '' ) {
174
+
175
+ // We want to show the status on all admin screens.
176
+ // So, Only avoided the customizer screen.
177
+ if ( is_customize_preview() ) {
178
+ return;
179
+ }
180
+
181
+ wp_enqueue_style( 'astra-sites-import-status', ASTRA_SITES_URI . 'inc/assets/css/import-status.css', null, ASTRA_SITES_VER, 'all' );
182
+
183
+ $status = $this->get_status();
184
+ if ( ! empty( $status ) && ( isset( $status['step'] ) && 'complete' !== $status['step'] ) ) {
185
+ wp_enqueue_script( 'astra-sites-import-status', ASTRA_SITES_URI . 'inc/assets/js/import-status.js', array( 'jquery' ), ASTRA_SITES_VER, true );
186
+ wp_localize_script(
187
+ 'astra-sites-import-status',
188
+ 'AstraSitesImportStatusVars',
189
+ array(
190
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
191
+ '_ajax_nonce' => wp_create_nonce( 'astra-sites-import-status' ),
192
+ )
193
+ );
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Import
199
+ *
200
+ * @param int $site_id Site ID.
201
+ * @param boolean $reset Reset and import.
202
+ */
203
+ public function import( $site_id = 0, $reset = false ) {
204
+
205
+ /**
206
+ * Validate site ID.
207
+ */
208
+ if ( ! $site_id ) {
209
+ $this->update_status(
210
+ array(
211
+ 'step' => 'fail',
212
+ 'message' => esc_html__( 'Invalid site ID.', 'astra-sites' ),
213
+ 'end_time' => time(),
214
+ )
215
+ );
216
+ return null;
217
+ }
218
+
219
+ /**
220
+ * Reset
221
+ */
222
+ if ( false === $reset ) {
223
+ $status = $this->get_status();
224
+
225
+ if ( ! empty( $status ) ) {
226
+ if ( isset( $status['step'] ) && 'complete' === $status['step'] ) {
227
+ return array(
228
+ 'status' => 'complete',
229
+ 'message' => esc_html__( 'Site import process is complete.', 'astra-sites' ),
230
+ );
231
+ } else {
232
+ return array(
233
+ 'status' => 'processing',
234
+ 'message' => esc_html__( 'Site import is in process.', 'astra-sites' ),
235
+ );
236
+ }
237
+ }
238
+ }
239
+
240
+ // Set Site Data.
241
+ $demo_data = $this->get_site_data( $site_id );
242
+
243
+ // Invalid Site ID.
244
+ if ( is_wp_error( $demo_data ) ) {
245
+ $this->update_status(
246
+ array(
247
+ 'step' => 'fail',
248
+ 'status' => 'invalid_site_id',
249
+ 'end_time' => time(),
250
+ )
251
+ );
252
+ return;
253
+ } elseif ( isset( $demo_data['site-type'] ) && 'free' !== $demo_data['site-type'] ) {
254
+ $this->update_status(
255
+ array(
256
+ 'step' => 'fail',
257
+ 'status' => 'premium_sites',
258
+ 'end_time' => time(),
259
+ )
260
+ );
261
+ return;
262
+ }
263
+
264
+ // Preparing Import.
265
+ $this->update_status(
266
+ array(
267
+ 'step' => 'preparing',
268
+ 'message' => esc_html__( 'Preparing Site Import', 'astra-sites' ),
269
+ 'start_time' => time(),
270
+ )
271
+ );
272
+
273
+ // Process Site Import.
274
+ $this->process_site_import_batch( $site_id );
275
+
276
+ return array(
277
+ 'status' => 'started',
278
+ 'message' => esc_html__( 'Site import started.', 'astra-sites' ),
279
+ );
280
+ }
281
+
282
+ /**
283
+ * Process Batch
284
+ *
285
+ * @since 2.5.0
286
+ *
287
+ * @param int $site_id Site ID.
288
+ * @return mixed
289
+ */
290
+ public function process_site_import_batch( $site_id = 0 ) {
291
+
292
+ self::$site_import_batch->push_to_queue(
293
+ array(
294
+ 'instance' => self::get_instance(),
295
+ 'method' => 'import_queue_1',
296
+ 'args' => $site_id,
297
+ )
298
+ );
299
+ self::$site_import_batch->push_to_queue(
300
+ array(
301
+ 'instance' => self::get_instance(),
302
+ 'method' => 'import_queue_2',
303
+ 'args' => $site_id,
304
+ )
305
+ );
306
+ self::$site_import_batch->push_to_queue(
307
+ array(
308
+ 'instance' => self::get_instance(),
309
+ 'method' => 'import_queue_3',
310
+ 'args' => $site_id,
311
+ )
312
+ );
313
+
314
+ self::$site_import_batch->save()->dispatch();
315
+ }
316
+
317
+ /**
318
+ * Import Batch One
319
+ *
320
+ * @param int $site_id Site ID.
321
+ */
322
+ public function import_queue_1( $site_id = 0 ) {
323
+
324
+ // Install Required Plugins.
325
+ $this->update_status(
326
+ array(
327
+ 'step' => 'install_plugins',
328
+ 'message' => esc_html__( 'Installing Required Plugins', 'astra-sites' ),
329
+ )
330
+ );
331
+ $this->install_required_plugins( $site_id );
332
+
333
+ }
334
+
335
+ /**
336
+ * Import Batch Two
337
+ *
338
+ * @param int $site_id Site ID.
339
+ */
340
+ public function import_queue_2( $site_id = 0 ) {
341
+
342
+ $this->update_status(
343
+ array(
344
+ 'step' => 'import_contact_forms',
345
+ 'message' => esc_html__( 'Importing Contact Forms', 'astra-sites' ),
346
+ )
347
+ );
348
+
349
+ // Import Flows & Steps.
350
+ $this->import_flows_and_steps( $site_id );
351
+
352
+ // Import WP Forms.
353
+ $this->import_wp_forms( $site_id );
354
+
355
+ $this->update_status(
356
+ array(
357
+ 'step' => 'import_customizer_settings',
358
+ 'message' => esc_html__( 'Setting up the Theme', 'astra-sites' ),
359
+ )
360
+ );
361
+
362
+ // Import Customizer Settings.
363
+ $this->import_customizer_settings( $site_id );
364
+
365
+ $this->update_status(
366
+ array(
367
+ 'step' => 'import_content',
368
+ 'message' => esc_html__( 'Importing Media, Posts, and Pages', 'astra-sites' ),
369
+ )
370
+ );
371
+
372
+ // Import XML.
373
+ $this->import_xml( $site_id );
374
+
375
+ // Import Site Options.
376
+ $this->update_status(
377
+ array(
378
+ 'step' => 'import_options',
379
+ 'message' => esc_html__( 'Importing Site Options', 'astra-sites' ),
380
+ )
381
+ );
382
+ $this->import_site_options( $site_id );
383
+
384
+ // Import Widgets.
385
+ $this->update_status(
386
+ array(
387
+ 'step' => 'import_widgets',
388
+ 'message' => esc_html__( 'Importing Sidebar and Widgets', 'astra-sites' ),
389
+ )
390
+ );
391
+ $this->import_widgets( $site_id );
392
+
393
+ }
394
+
395
+ /**
396
+ * Import Batch Three
397
+ *
398
+ * @param int $site_id Site ID.
399
+ */
400
+ public function import_queue_3( $site_id = 0 ) {
401
+
402
+ // Import End.
403
+ $this->import_end( $site_id );
404
+
405
+ $this->update_status(
406
+ array(
407
+ 'step' => 'complete',
408
+ 'message' => esc_html__( 'Import Complete', 'astra-sites' ),
409
+ 'end_time' => time(),
410
+ )
411
+ );
412
+ }
413
+
414
+ /**
415
+ * Validate ID
416
+ *
417
+ * @param int $site_id Site ID.
418
+ */
419
+ public function validate_id( $site_id ) {
420
+ $site_id = isset( $site_id ) ? absint( $site_id ) : 0;
421
+ if ( ! $site_id ) {
422
+ $this->update_status(
423
+ array(
424
+ 'step' => 'fail',
425
+ 'message' => esc_html__( 'Invalid site ID.', 'astra-sites' ),
426
+ 'end_time' => time(),
427
+ )
428
+ );
429
+ return null;
430
+ }
431
+ }
432
+
433
+ /**
434
+ * Set site data
435
+ *
436
+ * @param int $site_id Site ID.
437
+ */
438
+ public function set_site_data( $site_id ) {
439
+
440
+ }
441
+
442
+ /**
443
+ * Install Required Plugins
444
+ */
445
+ public function install_required_plugins() {
446
+
447
+ /** WordPress Plugin Administration API */
448
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
449
+ require_once ABSPATH . 'wp-admin/includes/update.php';
450
+
451
+ $demo_data = get_option( 'astra_sites_import_data', array() );
452
+
453
+ if ( isset( $demo_data['required-plugins'] ) ) {
454
+
455
+ $plugins = (array) $demo_data['required-plugins'];
456
+
457
+ if ( ! empty( $plugins ) ) {
458
+ $plugin_status = Astra_Sites::get_instance()->required_plugin( $plugins, $demo_data['astra-site-options-data'], $demo_data['astra-enabled-extensions'] );
459
+
460
+ // Install Plugins.
461
+ if ( ! empty( $plugin_status['required_plugins']['notinstalled'] ) ) {
462
+
463
+ foreach ( $plugin_status['required_plugins']['notinstalled'] as $key => $plugin ) {
464
+ if ( isset( $plugin['slug'] ) ) {
465
+
466
+ // Install plugin.
467
+ $this->install_plugin( $plugin );
468
+
469
+ // Activate plugin.
470
+ Astra_Sites::get_instance()->required_plugin_activate( $plugin['init'], $demo_data['astra-site-options-data'], $demo_data['astra-enabled-extensions'] );
471
+ }
472
+ }
473
+ }
474
+
475
+ // Activate Plugins.
476
+ if ( ! empty( $plugin_status['required_plugins']['inactive'] ) ) {
477
+ foreach ( $plugin_status['required_plugins']['inactive'] as $key => $plugin ) {
478
+ if ( isset( $plugin['init'] ) ) {
479
+ Astra_Sites::get_instance()->required_plugin_activate( $plugin['init'], $demo_data['astra-site-options-data'], $demo_data['astra-enabled-extensions'] );
480
+ }
481
+ }
482
+ }
483
+ }
484
+ }
485
+ }
486
+
487
+ /**
488
+ * Install Plugin
489
+ *
490
+ * @param array $plugin Required Plugin.
491
+ */
492
+ public function install_plugin( $plugin = array() ) {
493
+
494
+ if ( ! isset( $plugin['slug'] ) || empty( $plugin['slug'] ) ) {
495
+ return esc_html__( 'Invalid plugin slug', 'astra-sites' );
496
+ }
497
+
498
+ include_once ABSPATH . 'wp-admin/includes/plugin.php';
499
+ include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
500
+ include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
501
+
502
+ $api = plugins_api(
503
+ 'plugin_information',
504
+ array(
505
+ 'slug' => sanitize_key( wp_unslash( $plugin['slug'] ) ),
506
+ 'fields' => array(
507
+ 'sections' => false,
508
+ ),
509
+ )
510
+ );
511
+
512
+ if ( is_wp_error( $api ) ) {
513
+ $status['errorMessage'] = $api->get_error_message();
514
+ return $status;
515
+ }
516
+
517
+ $skin = new WP_Ajax_Upgrader_Skin();
518
+ $upgrader = new Plugin_Upgrader( $skin );
519
+ $result = $upgrader->install( $api->download_link );
520
+
521
+ if ( is_wp_error( $result ) ) {
522
+ return $result->get_error_message();
523
+ } elseif ( is_wp_error( $skin->result ) ) {
524
+ return $skin->result->get_error_message();
525
+ } elseif ( $skin->get_errors()->has_errors() ) {
526
+ return $skin->get_error_messages();
527
+ } elseif ( is_null( $result ) ) {
528
+ global $wp_filesystem;
529
+
530
+ // Pass through the error from WP_Filesystem if one was raised.
531
+ if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) {
532
+ return esc_html( $wp_filesystem->errors->get_error_message() );
533
+ }
534
+
535
+ return esc_html__( 'Unable to connect to the filesystem. Please confirm your credentials.', 'astra-sites' );
536
+ }
537
+
538
+ /* translators: %s plugin name. */
539
+ return sprintf( __( 'Successfully installed "%s" plugin!', 'astra-sites' ), $api->name );
540
+ }
541
+
542
+ /**
543
+ * Backup Customizer Settings
544
+ */
545
+ public function backup_customizer_settings() {
546
+ Astra_Sites::get_instance()->backup_settings();
547
+ }
548
+
549
+ /**
550
+ * Import Flows and Steps
551
+ */
552
+ public function import_flows_and_steps() {
553
+ $demo_data = get_option( 'astra_sites_import_data', array() );
554
+ if ( ! empty( $demo_data ) && isset( $demo_data['astra-site-cartflows-path'] ) && ! empty( $demo_data['astra-site-cartflows-path'] ) ) {
555
+ Astra_Sites_Importer::get_instance()->import_cartflows( $demo_data['astra-site-cartflows-path'] );
556
+ }
557
+ }
558
+
559
+ /**
560
+ * Import WP Forms
561
+ */
562
+ public function import_wp_forms() {
563
+
564
+ /** WordPress Post Administration API */
565
+ require_once ABSPATH . 'wp-admin/includes/post.php';
566
+
567
+ $demo_data = get_option( 'astra_sites_import_data', array() );
568
+ /**
569
+ * Import WP Forms.
570
+ */
571
+ if ( isset( $demo_data['astra-site-wpforms-path'] ) && ! empty( $demo_data['astra-site-wpforms-path'] ) ) {
572
+ Astra_Sites_Importer::get_instance()->import_wpforms( $demo_data['astra-site-wpforms-path'] );
573
+ }
574
+ }
575
+
576
+ /**
577
+ * Import Customizer Settings.
578
+ */
579
+ public function import_customizer_settings() {
580
+ $demo_data = get_option( 'astra_sites_import_data', array() );
581
+ Astra_Sites_Importer::get_instance()->import_customizer_settings( $demo_data['astra-site-customizer-data'] );
582
+ }
583
+
584
+ /**
585
+ * Import Content from XML/WXR.
586
+ */
587
+ public function import_xml() {
588
+ $demo_data = get_option( 'astra_sites_import_data', array() );
589
+
590
+ if ( isset( $demo_data['astra-site-wxr-path'] ) && ! empty( $demo_data['astra-site-wxr-path'] ) ) {
591
+ $xml_path = Astra_Sites_Helper::download_file( $demo_data['astra-site-wxr-path'] );
592
+
593
+ Astra_WXR_Importer::instance()->sse_import( $xml_path['data']['file'] );
594
+ }
595
+ }
596
+
597
+ /**
598
+ * Import Site Options.
599
+ */
600
+ public function import_site_options() {
601
+ $demo_data = get_option( 'astra_sites_import_data', array() );
602
+
603
+ if ( isset( $demo_data['astra-site-options-data'] ) && ! empty( $demo_data['astra-site-options-data'] ) ) {
604
+ Astra_Sites_Importer::get_instance()->import_options( $demo_data['astra-site-options-data'] );
605
+ }
606
+ }
607
+
608
+ /**
609
+ * Import Widgets.
610
+ */
611
+ public function import_widgets() {
612
+ $demo_data = get_option( 'astra_sites_import_data', array() );
613
+
614
+ if ( isset( $demo_data['astra-site-widgets-data'] ) && ! empty( $demo_data['astra-site-widgets-data'] ) ) {
615
+ Astra_Sites_Importer::get_instance()->import_widgets( $demo_data['astra-site-widgets-data'] );
616
+ }
617
+ }
618
+
619
+ /**
620
+ * Import End.
621
+ */
622
+ public function import_end() {
623
+ Astra_Sites_Importer::get_instance()->import_end();
624
+ }
625
+
626
+ /**
627
+ * Direct Import Site without Batch
628
+ *
629
+ * @param int $site_id Site ID.
630
+ */
631
+ public function direct_import( $site_id = 0 ) {
632
+
633
+ $this->validate_id( $site_id );
634
+
635
+ $this->set_site_data( $site_id );
636
+
637
+ $this->install_required_plugins();
638
+
639
+ $this->backup_customizer_settings();
640
+
641
+ $this->reset_previously_import_site();
642
+
643
+ $this->import_flows_and_steps();
644
+
645
+ $this->import_wp_forms();
646
+
647
+ $this->import_customizer_settings();
648
+
649
+ $this->import_xml();
650
+
651
+ $this->import_site_options();
652
+
653
+ $this->import_widgets();
654
+
655
+ $this->import_end();
656
+
657
+ }
658
+
659
+ /**
660
+ * Reset Previously Imported Site
661
+ */
662
+ public function reset_previously_import_site() {
663
+
664
+ // Get tracked data.
665
+ $reset_data = Astra_Sites::get_instance()->get_reset_data();
666
+
667
+ // Delete tracked posts.
668
+ if ( isset( $reset_data['reset_posts'] ) && ! empty( $reset_data['reset_posts'] ) ) {
669
+ foreach ( $reset_data['reset_posts'] as $key => $post_id ) {
670
+ Astra_Sites_Importer::get_instance()->delete_imported_posts( $post_id );
671
+ }
672
+ }
673
+ // Delete tracked terms.
674
+ if ( isset( $reset_data['reset_terms'] ) && ! empty( $reset_data['reset_terms'] ) ) {
675
+ foreach ( $reset_data['reset_terms'] as $key => $post_id ) {
676
+ Astra_Sites_Importer::get_instance()->delete_imported_terms( $post_id );
677
+ }
678
+ }
679
+ // Delete tracked WP forms.
680
+ if ( isset( $reset_data['reset_wp_forms'] ) && ! empty( $reset_data['reset_wp_forms'] ) ) {
681
+ foreach ( $reset_data['reset_wp_forms'] as $key => $post_id ) {
682
+ Astra_Sites_Importer::get_instance()->delete_imported_wp_forms( $post_id );
683
+ }
684
+ }
685
+
686
+ // Delete Customizer Data.
687
+ Astra_Sites_Importer::get_instance()->reset_customizer_data();
688
+
689
+ // Delete Site Options.
690
+ Astra_Sites_Importer::get_instance()->reset_site_options();
691
+
692
+ // Delete Widgets Data.
693
+ Astra_Sites_Importer::get_instance()->reset_widgets_data();
694
+ }
695
+
696
+ /**
697
+ * Get Site Data by Site ID
698
+ *
699
+ * @since 2.5.0
700
+ *
701
+ * @param int $id Site ID.
702
+ * @return array
703
+ */
704
+ public function get_site_data( $id ) {
705
+ if ( empty( $this->current_site_data ) ) {
706
+ // @todo Use Astra_Sites::get_instance()->api_request() instead of below function.
707
+ $this->current_site_data = Astra_Sites_Importer::get_instance()->get_single_demo( $id );
708
+ update_option( 'astra_sites_import_data', $this->current_site_data, 'no' );
709
+ }
710
+
711
+ return $this->current_site_data;
712
+ }
713
+ }
714
+
715
+ Astra_Sites_Batch_Site_Import::get_instance();
716
+
717
+ endif;
astra-sites/inc/classes/class-astra-sites-elementor-images.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra_Sites_Elementor_Images class
4
+ *
5
+ * This class is used to manage Pixabay Images.
6
+ *
7
+ * @package Astra Sites
8
+ * @since 2.0.0
9
+ */
10
+
11
+ use Elementor\Utils;
12
+
13
+ // If plugin - 'Elementor' not exist then return.
14
+ if ( class_exists( 'Astra_Sites_Elementor_Images' ) ) {
15
+ return;
16
+ }
17
+
18
+ /**
19
+ * Astra_Sites_Elementor_Images
20
+ */
21
+ class Astra_Sites_Elementor_Images {
22
+
23
+ /**
24
+ * Instance of Astra_Sites
25
+ *
26
+ * @since 2.0.0
27
+ * @var (Object) Astra_Sites
28
+ */
29
+ private static $instance = null;
30
+
31
+ /**
32
+ * Instance of Astra_Sites_Elementor_Images.
33
+ *
34
+ * @since 2.0.0
35
+ *
36
+ * @return object Class object.
37
+ */
38
+ public static function get_instance() {
39
+ if ( ! isset( self::$instance ) ) {
40
+ self::$instance = new self();
41
+ }
42
+
43
+ return self::$instance;
44
+ }
45
+
46
+ /**
47
+ * Import Image.
48
+ *
49
+ * @since 2.0.0
50
+ * @param array $image Downloaded Image array.
51
+ */
52
+ public function get_attachment_data( $image ) {
53
+
54
+ if ( ! empty( $image ) ) {
55
+ return array(
56
+ 'content' => array(
57
+ array(
58
+ 'id' => \Elementor\Utils::generate_random_string(),
59
+ 'elType' => 'section',
60
+ 'settings' => array(),
61
+ 'isInner' => false,
62
+ 'elements' => array(
63
+ array(
64
+ 'id' => \Elementor\Utils::generate_random_string(),
65
+ 'elType' => 'column',
66
+ 'elements' => array(
67
+ array(
68
+ 'id' => \Elementor\Utils::generate_random_string(),
69
+ 'elType' => 'widget',
70
+ 'settings' => array(
71
+ 'image' => array(
72
+ 'url' => wp_get_attachment_url( $image ),
73
+ 'id' => $image,
74
+ ),
75
+ 'image_size' => 'full',
76
+ ),
77
+ 'widgetType' => 'image',
78
+ ),
79
+ ),
80
+ 'isInner' => false,
81
+ ),
82
+ ),
83
+ ),
84
+ ),
85
+ );
86
+ }
87
+ return array();
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Kicking this off by calling 'get_instance()' method
93
+ */
94
+ Astra_Sites_Elementor_Images::get_instance();
astra-sites/inc/classes/class-astra-sites-elementor-pages.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Elementor Importer
4
+ *
5
+ * @package Astra Sites
6
+ */
7
+
8
+ namespace Elementor\TemplateLibrary;
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit; // Exit if accessed directly.
12
+ }
13
+
14
+ // If plugin - 'Elementor' not exist then return.
15
+ if ( ! class_exists( '\Elementor\Plugin' ) ) {
16
+ return;
17
+ }
18
+
19
+ use Elementor\Core\Base\Document;
20
+ use Elementor\DB;
21
+ use Elementor\Core\Settings\Page\Manager as PageSettingsManager;
22
+ use Elementor\Core\Settings\Manager as SettingsManager;
23
+ use Elementor\Core\Settings\Page\Model;
24
+ use Elementor\Editor;
25
+ use Elementor\Plugin;
26
+ use Elementor\Settings;
27
+ use Elementor\Utils;
28
+
29
+ /**
30
+ * Elementor template library local source.
31
+ *
32
+ * Elementor template library local source handler class is responsible for
33
+ * handling local Elementor templates saved by the user locally on his site.
34
+ *
35
+ * @since 2.0.0 Added compatibility for Elemetnor v2.5.0
36
+ */
37
+ class Astra_Sites_Elementor_Pages extends Source_Local {
38
+
39
+ /**
40
+ * Update post meta.
41
+ *
42
+ * @since 2.0.0
43
+ * @param integer $post_id Post ID.
44
+ * @param array $data Elementor Data.
45
+ * @return array $data Elementor Imported Data.
46
+ */
47
+ public function import( $post_id = 0, $data = array() ) {
48
+
49
+ if ( ! empty( $post_id ) && ! empty( $data ) ) {
50
+
51
+ $data = wp_json_encode( $data, true );
52
+
53
+ // Update WP form IDs.
54
+ $ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
55
+ if ( $ids_mapping ) {
56
+ foreach ( $ids_mapping as $old_id => $new_id ) {
57
+ $data = str_replace( '[wpforms id=\"' . $old_id, '[wpforms id=\"' . $new_id, $data );
58
+ $data = str_replace( '"select_form":"' . $old_id, '"select_form":"' . $new_id, $data );
59
+ }
60
+ }
61
+
62
+ $data = json_decode( $data, true );
63
+
64
+ // Import the data.
65
+ $data = $this->process_export_import_content( $data, 'on_import' );
66
+
67
+ // Replace the site urls.
68
+ $demo_data = get_option( 'astra_sites_import_data', array() );
69
+ if ( isset( $demo_data['astra-site-url'] ) ) {
70
+ $site_url = get_site_url();
71
+ $site_url = str_replace( '/', '\/', $site_url );
72
+ $demo_site_url = 'https:' . $demo_data['astra-site-url'];
73
+ $demo_site_url = str_replace( '/', '\/', $demo_site_url );
74
+ $data = str_replace( $demo_site_url, $site_url, $data );
75
+ }
76
+
77
+ // Replace the site urls.
78
+ $demo_data = get_option( 'astra_sites_import_data', array() );
79
+ if ( isset( $demo_data['astra-site-url'] ) ) {
80
+ $data = wp_json_encode( $data, true );
81
+ if ( ! empty( $data ) ) {
82
+ $site_url = get_site_url();
83
+ $site_url = str_replace( '/', '\/', $site_url );
84
+ $demo_site_url = 'https:' . $demo_data['astra-site-url'];
85
+ $demo_site_url = str_replace( '/', '\/', $demo_site_url );
86
+ $data = str_replace( $demo_site_url, $site_url, $data );
87
+ $data = json_decode( $data, true );
88
+ }
89
+ }
90
+
91
+ // Update processed meta.
92
+ update_metadata( 'post', $post_id, '_elementor_data', $data );
93
+
94
+ // !important, Clear the cache after images import.
95
+ Plugin::$instance->posts_css_manager->clear_cache();
96
+
97
+ return $data;
98
+ }
99
+
100
+ return array();
101
+ }
102
+ }
astra-sites/inc/classes/class-astra-sites-importer-log.php ADDED
@@ -0,0 +1,527 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites Importer Log
4
+ *
5
+ * @since 1.1.0
6
+ * @package Astra Sites
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ if ( ! class_exists( 'Astra_Sites_Importer_Log' ) ) :
14
+
15
+ /**
16
+ * Astra Sites Importer
17
+ */
18
+ class Astra_Sites_Importer_Log {
19
+
20
+ /**
21
+ * Instance
22
+ *
23
+ * @since 1.1.0
24
+ * @var (Object) Class object
25
+ */
26
+ private static $instance = null;
27
+
28
+ /**
29
+ * Log File
30
+ *
31
+ * @since 1.1.0
32
+ * @var (Object) Class object
33
+ */
34
+ private static $log_file = null;
35
+
36
+ /**
37
+ * Set Instance
38
+ *
39
+ * @since 1.1.0
40
+ *
41
+ * @return object Class object.
42
+ */
43
+ public static function get_instance() {
44
+ if ( ! isset( self::$instance ) ) {
45
+ self::$instance = new self();
46
+ }
47
+
48
+ return self::$instance;
49
+ }
50
+
51
+ /**
52
+ * Constructor.
53
+ *
54
+ * @since 1.1.0
55
+ */
56
+ private function __construct() {
57
+
58
+ // Check file read/write permissions.
59
+ add_action( 'admin_init', array( $this, 'has_file_read_write' ) );
60
+
61
+ }
62
+
63
+ /**
64
+ * Check file read/write permissions and process.
65
+ *
66
+ * @since 1.1.0
67
+ * @return null
68
+ */
69
+ public function has_file_read_write() {
70
+
71
+ $upload_dir = self::log_dir();
72
+
73
+ $file_created = Astra_Sites::get_instance()->get_filesystem()->put_contents( $upload_dir['path'] . 'index.html', '' );
74
+ if ( ! $file_created ) {
75
+ add_action( 'admin_notices', array( $this, 'file_permission_notice' ) );
76
+ return;
77
+ }
78
+
79
+ // Set log file.
80
+ self::set_log_file();
81
+
82
+ // Initial AJAX Import Hooks.
83
+ add_action( 'astra_sites_import_start', array( $this, 'start' ), 10, 2 );
84
+ }
85
+
86
+ /**
87
+ * File Permission Notice
88
+ *
89
+ * @since 2.0.0
90
+ * @return void
91
+ */
92
+ public function file_permission_notice() {
93
+ $upload_dir = self::log_dir();
94
+ ?>
95
+ <div class="notice notice-error astra-sites-must-notices astra-sites-file-permission-issue">
96
+ <p><?php esc_html_e( 'Required File Permissions to import the templates are missing.', 'astra-sites' ); ?></p>
97
+ <?php if ( defined( 'FS_METHOD' ) ) { ?>
98
+ <p><?php esc_html_e( 'This is usually due to inconsistent file permissions.', 'astra-sites' ); ?></p>
99
+ <p><code><?php echo esc_html( $upload_dir['path'] ); ?></code></p>
100
+ <?php } else { ?>
101
+ <p><?php esc_html_e( 'You can easily update permissions by adding the following code into the wp-config.php file.', 'astra-sites' ); ?></p>
102
+ <p><code>define( 'FS_METHOD', 'direct' );</code></p>
103
+ <?php } ?>
104
+ </div>
105
+ <?php
106
+ }
107
+
108
+ /**
109
+ * Add log file URL in UI response.
110
+ *
111
+ * @since 1.1.0
112
+ */
113
+ public static function add_log_file_url() {
114
+
115
+ $upload_dir = self::log_dir();
116
+ $upload_path = trailingslashit( $upload_dir['url'] );
117
+ $file_abs_url = get_option( 'astra_sites_recent_import_log_file', self::$log_file );
118
+ $file_url = $upload_path . basename( $file_abs_url );
119
+
120
+ return array(
121
+ 'abs_url' => $file_abs_url,
122
+ 'url' => $file_url,
123
+ );
124
+ }
125
+
126
+ /**
127
+ * Current Time for log.
128
+ *
129
+ * @since 1.1.0
130
+ * @return string Current time with time zone.
131
+ */
132
+ public static function current_time() {
133
+ return gmdate( 'H:i:s' ) . ' ' . date_default_timezone_get();
134
+ }
135
+
136
+ /**
137
+ * Import Start
138
+ *
139
+ * @since 1.1.0
140
+ * @param array $data Import Data.
141
+ * @param string $demo_api_uri Import site API URL.
142
+ * @return void
143
+ */
144
+ public function start( $data = array(), $demo_api_uri = '' ) {
145
+
146
+ self::add( 'Started Import Process' );
147
+
148
+ self::add( '# System Details: ' );
149
+ self::add( "Debug Mode \t\t: " . self::get_debug_mode() );
150
+ self::add( "Operating System \t: " . self::get_os() );
151
+ self::add( "Software \t\t: " . self::get_software() );
152
+ self::add( "MySQL version \t\t: " . self::get_mysql_version() );
153
+ self::add( "XML Reader \t\t: " . self::get_xmlreader_status() );
154
+ self::add( "PHP Version \t\t: " . self::get_php_version() );
155
+ self::add( "PHP Max Input Vars \t: " . self::get_php_max_input_vars() );
156
+ self::add( "PHP Max Post Size \t: " . self::get_php_max_post_size() );
157
+ self::add( "PHP Extension GD \t: " . self::get_php_extension_gd() );
158
+ self::add( "PHP Max Execution Time \t: " . self::get_max_execution_time() );
159
+ self::add( "Max Upload Size \t: " . size_format( wp_max_upload_size() ) );
160
+ self::add( "Memory Limit \t\t: " . self::get_memory_limit() );
161
+ self::add( "Timezone \t\t: " . self::get_timezone() );
162
+ self::add( PHP_EOL . '-----' . PHP_EOL );
163
+ self::add( 'Importing Started! - ' . self::current_time() );
164
+
165
+ self::add( '---' . PHP_EOL );
166
+ self::add( 'WHY IMPORT PROCESS CAN FAIL? READ THIS - ' );
167
+ self::add( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=import-error&utm_medium=wp-dashboard' . PHP_EOL );
168
+ self::add( '---' . PHP_EOL );
169
+
170
+ }
171
+
172
+ /**
173
+ * Get Log File
174
+ *
175
+ * @since 1.1.0
176
+ * @return string log file URL.
177
+ */
178
+ public static function get_log_file() {
179
+ return self::$log_file;
180
+ }
181
+
182
+ /**
183
+ * Log file directory
184
+ *
185
+ * @since 1.1.0
186
+ * @param string $dir_name Directory Name.
187
+ * @return array Uploads directory array.
188
+ */
189
+ public static function log_dir( $dir_name = 'astra-sites' ) {
190
+
191
+ $upload_dir = wp_upload_dir();
192
+
193
+ // Build the paths.
194
+ $dir_info = array(
195
+ 'path' => $upload_dir['basedir'] . '/' . $dir_name . '/',
196
+ 'url' => $upload_dir['baseurl'] . '/' . $dir_name . '/',
197
+ );
198
+
199
+ // Create the upload dir if it doesn't exist.
200
+ if ( ! file_exists( $dir_info['path'] ) ) {
201
+
202
+ // Create the directory.
203
+ wp_mkdir_p( $dir_info['path'] );
204
+
205
+ // Add an index file for security.
206
+ Astra_Sites::get_instance()->get_filesystem()->put_contents( $dir_info['path'] . 'index.html', '' );
207
+ }
208
+
209
+ return $dir_info;
210
+ }
211
+
212
+ /**
213
+ * Set log file
214
+ *
215
+ * @since 1.1.0
216
+ */
217
+ public static function set_log_file() {
218
+
219
+ $upload_dir = self::log_dir();
220
+
221
+ $upload_path = trailingslashit( $upload_dir['path'] );
222
+
223
+ // File format e.g. 'import-31-Oct-2017-06-39-12.txt'.
224
+ self::$log_file = $upload_path . 'import-' . gmdate( 'd-M-Y-h-i-s' ) . '.txt';
225
+
226
+ if ( ! get_option( 'astra_sites_recent_import_log_file', false ) ) {
227
+ update_option( 'astra_sites_recent_import_log_file', self::$log_file, 'no' );
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Write content to a file.
233
+ *
234
+ * @since 1.1.0
235
+ * @param string $content content to be saved to the file.
236
+ */
237
+ public static function add( $content ) {
238
+
239
+ if ( get_option( 'astra_sites_recent_import_log_file', false ) ) {
240
+ $log_file = get_option( 'astra_sites_recent_import_log_file', self::$log_file );
241
+ } else {
242
+ $log_file = self::$log_file;
243
+ }
244
+
245
+ $existing_data = '';
246
+ if ( file_exists( $log_file ) ) {
247
+ $existing_data = Astra_Sites::get_instance()->get_filesystem()->get_contents( $log_file );
248
+ }
249
+
250
+ // Style separator.
251
+ $separator = PHP_EOL;
252
+
253
+ if ( apply_filters( 'astra_sites_debug_logs', false ) ) {
254
+ astra_sites_error_log( $content );
255
+
256
+ Astra_Sites::get_instance()->get_filesystem()->put_contents( $log_file, $existing_data . $separator . $content, FS_CHMOD_FILE );
257
+ }
258
+
259
+ }
260
+
261
+ /**
262
+ * Debug Mode
263
+ *
264
+ * @since 1.1.0
265
+ * @return string Enabled for Debug mode ON and Disabled for Debug mode Off.
266
+ */
267
+ public static function get_debug_mode() {
268
+ if ( WP_DEBUG ) {
269
+ return __( 'Enabled', 'astra-sites' );
270
+ }
271
+
272
+ return __( 'Disabled', 'astra-sites' );
273
+ }
274
+
275
+ /**
276
+ * Memory Limit
277
+ *
278
+ * @since 1.1.0
279
+ * @return string Memory limit.
280
+ */
281
+ public static function get_memory_limit() {
282
+
283
+ $required_memory = '64M';
284
+ $memory_limit_in_bytes_current = wp_convert_hr_to_bytes( WP_MEMORY_LIMIT );
285
+ $memory_limit_in_bytes_required = wp_convert_hr_to_bytes( $required_memory );
286
+
287
+ if ( $memory_limit_in_bytes_current < $memory_limit_in_bytes_required ) {
288
+ return sprintf(
289
+ /* translators: %1$s Memory Limit, %2$s Recommended memory limit. */
290
+ _x( 'Current memory limit %1$s. We recommend setting memory to at least %2$s.', 'Recommended Memory Limit', 'astra-sites' ),
291
+ WP_MEMORY_LIMIT,
292
+ $required_memory
293
+ );
294
+ }
295
+
296
+ return WP_MEMORY_LIMIT;
297
+ }
298
+
299
+ /**
300
+ * Timezone
301
+ *
302
+ * @since 1.1.0
303
+ * @see https://codex.wordpress.org/Option_Reference/
304
+ *
305
+ * @return string Current timezone.
306
+ */
307
+ public static function get_timezone() {
308
+ $timezone = get_option( 'timezone_string' );
309
+
310
+ if ( ! $timezone ) {
311
+ return get_option( 'gmt_offset' );
312
+ }
313
+
314
+ return $timezone;
315
+ }
316
+
317
+ /**
318
+ * Operating System
319
+ *
320
+ * @since 1.1.0
321
+ * @return string Current Operating System.
322
+ */
323
+ public static function get_os() {
324
+ return PHP_OS;
325
+ }
326
+
327
+ /**
328
+ * Server Software
329
+ *
330
+ * @since 1.1.0
331
+ * @return string Current Server Software.
332
+ */
333
+ public static function get_software() {
334
+ return $_SERVER['SERVER_SOFTWARE'];
335
+ }
336
+
337
+ /**
338
+ * MySql Version
339
+ *
340
+ * @since 1.1.0
341
+ * @return string Current MySql Version.
342
+ */
343
+ public static function get_mysql_version() {
344
+ global $wpdb;
345
+ return $wpdb->db_version();
346
+ }
347
+
348
+ /**
349
+ * XML Reader
350
+ *
351
+ * @since 1.2.8
352
+ * @return string Current XML Reader status.
353
+ */
354
+ public static function get_xmlreader_status() {
355
+
356
+ if ( class_exists( 'XMLReader' ) ) {
357
+ return __( 'Yes', 'astra-sites' );
358
+ }
359
+
360
+ return __( 'No', 'astra-sites' );
361
+ }
362
+
363
+ /**
364
+ * PHP Version
365
+ *
366
+ * @since 1.1.0
367
+ * @return string Current PHP Version.
368
+ */
369
+ public static function get_php_version() {
370
+ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
371
+ return _x( 'We recommend to use php 5.4 or higher', 'PHP Version', 'astra-sites' );
372
+ }
373
+ return PHP_VERSION;
374
+ }
375
+
376
+ /**
377
+ * PHP Max Input Vars
378
+ *
379
+ * @since 1.1.0
380
+ * @return string Current PHP Max Input Vars
381
+ */
382
+ public static function get_php_max_input_vars() {
383
+ // @codingStandardsIgnoreStart
384
+ return ini_get( 'max_input_vars' ); // phpcs:disable PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
385
+ // @codingStandardsIgnoreEnd
386
+ }
387
+
388
+ /**
389
+ * PHP Max Post Size
390
+ *
391
+ * @since 1.1.0
392
+ * @return string Current PHP Max Post Size
393
+ */
394
+ public static function get_php_max_post_size() {
395
+ return ini_get( 'post_max_size' );
396
+ }
397
+
398
+ /**
399
+ * PHP Max Execution Time
400
+ *
401
+ * @since 1.1.0
402
+ * @return string Current Max Execution Time
403
+ */
404
+ public static function get_max_execution_time() {
405
+ return ini_get( 'max_execution_time' );
406
+ }
407
+
408
+ /**
409
+ * PHP GD Extension
410
+ *
411
+ * @since 1.1.0
412
+ * @return string Current PHP GD Extension
413
+ */
414
+ public static function get_php_extension_gd() {
415
+ if ( extension_loaded( 'gd' ) ) {
416
+ return __( 'Yes', 'astra-sites' );
417
+ }
418
+
419
+ return __( 'No', 'astra-sites' );
420
+ }
421
+
422
+ /**
423
+ * Display Data
424
+ *
425
+ * @since 2.0.0
426
+ * @return void
427
+ */
428
+ public function display_data() {
429
+
430
+ $crons = _get_cron_array();
431
+ $events = array();
432
+
433
+ if ( empty( $crons ) ) {
434
+ esc_html_e( 'You currently have no scheduled cron events.', 'astra-sites' );
435
+ }
436
+
437
+ foreach ( $crons as $time => $cron ) {
438
+ $keys = array_keys( $cron );
439
+ $key = $keys[0];
440
+ $events[ $key ] = $time;
441
+ }
442
+
443
+ $expired = get_transient( 'astra-sites-import-check' );
444
+ if ( $expired ) {
445
+ global $wpdb;
446
+ $transient = 'astra-sites-import-check';
447
+
448
+ $transient_timeout = $wpdb->get_col(
449
+ $wpdb->prepare(
450
+ "SELECT option_value
451
+ FROM $wpdb->options
452
+ WHERE option_name
453
+ LIKE %s",
454
+ '%_transient_timeout_' . $transient . '%'
455
+ )
456
+ );
457
+
458
+ $older_date = $transient_timeout[0];
459
+ $transient_status = 'Transient: Not Expired! Recheck in ' . human_time_diff( time(), $older_date );
460
+ } else {
461
+ $transient_status = 'Transient: Starting.. Process for each 5 minutes.';
462
+ }
463
+ $temp = get_site_option( 'astra-sites-batch-status-string', '' );
464
+ $temp .= isset( $events['wp_astra_site_importer_cron'] ) ? '<br/>Batch: Recheck batch in ' . human_time_diff( time(), $events['wp_astra_site_importer_cron'] ) : '<br/>Batch: Not Started! Until the Transient expire.';
465
+
466
+ $upload_dir = self::get_instance()->log_dir();
467
+ $list_files = list_files( $upload_dir['path'] );
468
+ $backup_files = array();
469
+ $log_files = array();
470
+ foreach ( $list_files as $key => $file ) {
471
+ if ( strpos( $file, '.json' ) ) {
472
+ $backup_files[] = $file;
473
+ }
474
+ if ( strpos( $file, '.txt' ) ) {
475
+ $log_files[] = $file;
476
+ }
477
+ }
478
+ ?>
479
+ <table>
480
+ <tr>
481
+ <td>
482
+ <h2>Log Files</h2>
483
+ <ul>
484
+ <?php
485
+ foreach ( $log_files as $key => $file ) {
486
+ $file_name = basename( $file );
487
+ $file = str_replace( $upload_dir['path'], $upload_dir['url'], $file );
488
+ ?>
489
+ <li>
490
+ <a target="_blank" href="<?php echo esc_attr( $file ); ?>"><?php echo esc_html( $file_name ); ?></a>
491
+ </li>
492
+ <?php } ?>
493
+ </ul>
494
+ </td>
495
+ <td>
496
+ <h2>Backup Files</h2>
497
+ <ul>
498
+ <?php
499
+ foreach ( $backup_files as $key => $file ) {
500
+ $file_name = basename( $file );
501
+ $file = str_replace( $upload_dir['path'], $upload_dir['url'], $file );
502
+ ?>
503
+ <li>
504
+ <a target="_blank" href="<?php echo esc_attr( $file ); ?>"><?php echo esc_html( $file_name ); ?></a>
505
+ </li>
506
+ <?php } ?>
507
+ </ul>
508
+ </td>
509
+ <td>
510
+ <div class="batch-log">
511
+ <p><?php echo wp_kses_post( $temp ); ?></p>
512
+ <p><?php echo wp_kses_post( $transient_status ); ?></p>
513
+ </div>
514
+ </td>
515
+ </tr>
516
+ </table>
517
+ <?php
518
+ }
519
+
520
+ }
521
+
522
+ /**
523
+ * Kicking this off by calling 'get_instance()' method
524
+ */
525
+ Astra_Sites_Importer_Log::get_instance();
526
+
527
+ endif;
astra-sites/inc/classes/class-astra-sites-importer.php ADDED
@@ -0,0 +1,930 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites Importer
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Sites
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit; // Exit if accessed directly.
11
+ }
12
+
13
+ if ( ! class_exists( 'Astra_Sites_Importer' ) ) {
14
+
15
+ /**
16
+ * Astra Sites Importer
17
+ */
18
+ class Astra_Sites_Importer {
19
+
20
+ /**
21
+ * Instance
22
+ *
23
+ * @since 1.0.0
24
+ * @var (Object) Class object
25
+ */
26
+ public static $instance = null;
27
+
28
+ /**
29
+ * Set Instance
30
+ *
31
+ * @since 1.0.0
32
+ *
33
+ * @return object Class object.
34
+ */
35
+ public static function get_instance() {
36
+ if ( ! isset( self::$instance ) ) {
37
+ self::$instance = new self();
38
+ }
39
+
40
+ return self::$instance;
41
+ }
42
+
43
+ /**
44
+ * Constructor.
45
+ *
46
+ * @since 1.0.0
47
+ */
48
+ public function __construct() {
49
+
50
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-importer-log.php';
51
+ require_once ASTRA_SITES_DIR . 'inc/importers/class-astra-sites-helper.php';
52
+ require_once ASTRA_SITES_DIR . 'inc/importers/class-astra-widget-importer.php';
53
+ require_once ASTRA_SITES_DIR . 'inc/importers/class-astra-customizer-import.php';
54
+ require_once ASTRA_SITES_DIR . 'inc/importers/class-astra-site-options-import.php';
55
+
56
+ // Import AJAX.
57
+ add_action( 'wp_ajax_astra-sites-import-wpforms', array( $this, 'import_wpforms' ) );
58
+ add_action( 'wp_ajax_astra-sites-import-cartflows', array( $this, 'import_cartflows' ) );
59
+ add_action( 'wp_ajax_astra-sites-import-customizer-settings', array( $this, 'import_customizer_settings' ) );
60
+ add_action( 'wp_ajax_astra-sites-import-prepare-xml', array( $this, 'prepare_xml_data' ) );
61
+ add_action( 'wp_ajax_astra-sites-import-options', array( $this, 'import_options' ) );
62
+ add_action( 'wp_ajax_astra-sites-import-widgets', array( $this, 'import_widgets' ) );
63
+ add_action( 'wp_ajax_astra-sites-import-end', array( $this, 'import_end' ) );
64
+
65
+ // Hooks in AJAX.
66
+ add_action( 'astra_sites_import_complete', array( $this, 'after_batch_complete' ) );
67
+ add_action( 'init', array( $this, 'load_importer' ) );
68
+
69
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing.php';
70
+
71
+ add_action( 'astra_sites_image_import_complete', array( $this, 'after_batch_complete' ) );
72
+
73
+ // Reset Customizer Data.
74
+ add_action( 'wp_ajax_astra-sites-reset-customizer-data', array( $this, 'reset_customizer_data' ) );
75
+ add_action( 'wp_ajax_astra-sites-reset-site-options', array( $this, 'reset_site_options' ) );
76
+ add_action( 'wp_ajax_astra-sites-reset-widgets-data', array( $this, 'reset_widgets_data' ) );
77
+
78
+ // Reset Post & Terms.
79
+ add_action( 'wp_ajax_astra-sites-delete-posts', array( $this, 'delete_imported_posts' ) );
80
+ add_action( 'wp_ajax_astra-sites-delete-wp-forms', array( $this, 'delete_imported_wp_forms' ) );
81
+ add_action( 'wp_ajax_astra-sites-delete-terms', array( $this, 'delete_imported_terms' ) );
82
+
83
+ if ( version_compare( get_bloginfo( 'version' ), '5.1.0', '>=' ) ) {
84
+ add_filter( 'http_request_timeout', array( $this, 'set_timeout_for_images' ), 10, 2 );
85
+ }
86
+
87
+ add_action( 'init', array( $this, 'disable_default_woo_pages_creation' ), 2 );
88
+ }
89
+
90
+ /**
91
+ * Restrict WooCommerce Pages Creation process
92
+ *
93
+ * Why? WooCommerce creates set of pages on it's activation
94
+ * These pages are re created via our XML import step.
95
+ * In order to avoid the duplicacy we restrict these page creation process.
96
+ *
97
+ * @since 3.0.0
98
+ */
99
+ public function disable_default_woo_pages_creation() {
100
+ add_filter( 'woocommerce_create_pages', '__return_empty_array' );
101
+ }
102
+
103
+ /**
104
+ * Set the timeout for the HTTP request by request URL.
105
+ *
106
+ * E.g. If URL is images (jpg|png|gif|jpeg) are from the domain `https://websitedemos.net` then we have set the timeout by 30 seconds. Default 5 seconds.
107
+ *
108
+ * @since 1.3.8
109
+ *
110
+ * @param int $timeout_value Time in seconds until a request times out. Default 5.
111
+ * @param string $url The request URL.
112
+ */
113
+ public function set_timeout_for_images( $timeout_value, $url ) {
114
+
115
+ // URL not contain `https://websitedemos.net` then return $timeout_value.
116
+ if ( strpos( $url, 'https://websitedemos.net' ) === false ) {
117
+ return $timeout_value;
118
+ }
119
+
120
+ // Check is image URL of type jpg|png|gif|jpeg.
121
+ if ( astra_sites_is_valid_image( $url ) ) {
122
+ $timeout_value = 300;
123
+ }
124
+
125
+ return $timeout_value;
126
+ }
127
+
128
+ /**
129
+ * Load WordPress WXR importer.
130
+ */
131
+ public function load_importer() {
132
+ require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-astra-wxr-importer.php';
133
+ }
134
+
135
+ /**
136
+ * Change flow status
137
+ *
138
+ * @since 2.0.0
139
+ *
140
+ * @param array $args Flow query args.
141
+ * @return array Flow query args.
142
+ */
143
+ public function change_flow_status( $args ) {
144
+ $args['post_status'] = 'publish';
145
+ return $args;
146
+ }
147
+
148
+ /**
149
+ * Track Flow
150
+ *
151
+ * @since 2.0.0
152
+ *
153
+ * @param integer $flow_id Flow ID.
154
+ * @return void
155
+ */
156
+ public function track_flows( $flow_id ) {
157
+ astra_sites_error_log( 'Flow ID ' . $flow_id );
158
+ Astra_WXR_Importer::instance()->track_post( $flow_id );
159
+ }
160
+
161
+ /**
162
+ * Import WP Forms
163
+ *
164
+ * @since 1.2.14
165
+ * @since 1.4.0 The `$wpforms_url` was added.
166
+ *
167
+ * @param string $wpforms_url WP Forms JSON file URL.
168
+ * @return void
169
+ */
170
+ public function import_wpforms( $wpforms_url = '' ) {
171
+
172
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
173
+ // Verify Nonce.
174
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
175
+
176
+ if ( ! current_user_can( 'customize' ) ) {
177
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
178
+ }
179
+ }
180
+
181
+ $wpforms_url = ( isset( $_REQUEST['wpforms_url'] ) ) ? urldecode( $_REQUEST['wpforms_url'] ) : $wpforms_url;
182
+ $ids_mapping = array();
183
+
184
+ if ( ! astra_sites_is_valid_url( $wpforms_url ) ) {
185
+ wp_send_json_error( __( 'Invalid Request URL.', 'astra-sites' ) );
186
+ }
187
+
188
+ if ( ! empty( $wpforms_url ) && function_exists( 'wpforms_encode' ) ) {
189
+
190
+ // Download JSON file.
191
+ $file_path = Astra_Sites_Helper::download_file( $wpforms_url );
192
+
193
+ if ( $file_path['success'] ) {
194
+ if ( isset( $file_path['data']['file'] ) ) {
195
+
196
+ $ext = strtolower( pathinfo( $file_path['data']['file'], PATHINFO_EXTENSION ) );
197
+
198
+ if ( 'json' === $ext ) {
199
+ $forms = json_decode( Astra_Sites::get_instance()->get_filesystem()->get_contents( $file_path['data']['file'] ), true );
200
+
201
+ if ( ! empty( $forms ) ) {
202
+
203
+ foreach ( $forms as $form ) {
204
+ $title = ! empty( $form['settings']['form_title'] ) ? $form['settings']['form_title'] : '';
205
+ $desc = ! empty( $form['settings']['form_desc'] ) ? $form['settings']['form_desc'] : '';
206
+
207
+ $new_id = post_exists( $title );
208
+
209
+ if ( ! $new_id ) {
210
+ $new_id = wp_insert_post(
211
+ array(
212
+ 'post_title' => $title,
213
+ 'post_status' => 'publish',
214
+ 'post_type' => 'wpforms',
215
+ 'post_excerpt' => $desc,
216
+ )
217
+ );
218
+
219
+ if ( defined( 'WP_CLI' ) ) {
220
+ WP_CLI::line( 'Imported Form ' . $title );
221
+ }
222
+
223
+ // Set meta for tracking the post.
224
+ update_post_meta( $new_id, '_astra_sites_imported_wp_forms', true );
225
+ Astra_Sites_Importer_Log::add( 'Inserted WP Form ' . $new_id );
226
+ }
227
+
228
+ if ( $new_id ) {
229
+
230
+ // ID mapping.
231
+ $ids_mapping[ $form['id'] ] = $new_id;
232
+
233
+ $form['id'] = $new_id;
234
+ wp_update_post(
235
+ array(
236
+ 'ID' => $new_id,
237
+ 'post_content' => wpforms_encode( $form ),
238
+ )
239
+ );
240
+ }
241
+ }
242
+ }
243
+ } else {
244
+ wp_send_json_error( __( 'Invalid JSON file for WP Forms.', 'astra-sites' ) );
245
+ }
246
+ } else {
247
+ wp_send_json_error( __( 'There was an error downloading the WP Forms file.', 'astra-sites' ) );
248
+ }
249
+ } else {
250
+ wp_send_json_error( __( 'There was an error downloading the WP Forms file.', 'astra-sites' ) );
251
+ }
252
+ }
253
+
254
+ update_option( 'astra_sites_wpforms_ids_mapping', $ids_mapping, 'no' );
255
+
256
+ if ( defined( 'WP_CLI' ) ) {
257
+ WP_CLI::line( 'WP Forms Imported.' );
258
+ } elseif ( wp_doing_ajax() ) {
259
+ wp_send_json_success( $ids_mapping );
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Import CartFlows
265
+ *
266
+ * @since 2.0.0
267
+ *
268
+ * @param string $url Cartflows JSON file URL.
269
+ * @return void
270
+ */
271
+ public function import_cartflows( $url = '' ) {
272
+
273
+ // Make the flow publish.
274
+ add_action( 'cartflows_flow_importer_args', array( $this, 'change_flow_status' ) );
275
+ add_action( 'cartflows_flow_imported', array( $this, 'track_flows' ) );
276
+ add_action( 'cartflows_step_imported', array( $this, 'track_flows' ) );
277
+
278
+ $url = ( isset( $_REQUEST['cartflows_url'] ) ) ? urldecode( $_REQUEST['cartflows_url'] ) : urldecode( $url ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
279
+ if ( ! empty( $url ) && is_callable( 'CartFlows_Importer::get_instance' ) ) {
280
+
281
+ // Download JSON file.
282
+ $file_path = Astra_Sites_Helper::download_file( $url );
283
+
284
+ if ( $file_path['success'] ) {
285
+ if ( isset( $file_path['data']['file'] ) ) {
286
+
287
+ $ext = strtolower( pathinfo( $file_path['data']['file'], PATHINFO_EXTENSION ) );
288
+
289
+ if ( 'json' === $ext ) {
290
+ $flows = json_decode( Astra_Sites::get_instance()->get_filesystem()->get_contents( $file_path['data']['file'] ), true );
291
+
292
+ if ( ! empty( $flows ) ) {
293
+ CartFlows_Importer::get_instance()->import_from_json_data( $flows );
294
+ }
295
+ } else {
296
+ wp_send_json_error( __( 'Invalid file for CartFlows flows', 'astra-sites' ) );
297
+ }
298
+ } else {
299
+ wp_send_json_error( __( 'There was an error downloading the CartFlows flows file.', 'astra-sites' ) );
300
+ }
301
+ } else {
302
+ wp_send_json_error( __( 'There was an error downloading the CartFlows flows file.', 'astra-sites' ) );
303
+ }
304
+ }
305
+
306
+ if ( defined( 'WP_CLI' ) ) {
307
+ WP_CLI::line( 'Imported from ' . $url );
308
+ } elseif ( wp_doing_ajax() ) {
309
+ wp_send_json_success( $url );
310
+ }
311
+ }
312
+
313
+ /**
314
+ * Import Customizer Settings.
315
+ *
316
+ * @since 1.0.14
317
+ * @since 1.4.0 The `$customizer_data` was added.
318
+ *
319
+ * @param array $customizer_data Customizer Data.
320
+ * @return void
321
+ */
322
+ public function import_customizer_settings( $customizer_data = array() ) {
323
+
324
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
325
+ // Verify Nonce.
326
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
327
+
328
+ if ( ! current_user_can( 'customize' ) ) {
329
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
330
+ }
331
+ }
332
+
333
+ $customizer_data = astra_get_site_data( 'astra-site-customizer-data' );
334
+
335
+ if ( ! empty( $customizer_data ) ) {
336
+
337
+ Astra_Sites_Importer_Log::add( 'Imported Customizer Settings ' . wp_json_encode( $customizer_data ) );
338
+
339
+ // Set meta for tracking the post.
340
+ astra_sites_error_log( 'Customizer Data ' . wp_json_encode( $customizer_data ) );
341
+
342
+ update_option( '_astra_sites_old_customizer_data', $customizer_data, 'no' );
343
+
344
+ Astra_Customizer_Import::instance()->import( $customizer_data );
345
+
346
+ if ( defined( 'WP_CLI' ) ) {
347
+ WP_CLI::line( 'Imported Customizer Settings!' );
348
+ } elseif ( wp_doing_ajax() ) {
349
+ wp_send_json_success( $customizer_data );
350
+ }
351
+ } else {
352
+ if ( defined( 'WP_CLI' ) ) {
353
+ WP_CLI::line( 'Customizer data is empty!' );
354
+ } elseif ( wp_doing_ajax() ) {
355
+ wp_send_json_error( __( 'Customizer data is empty!', 'astra-sites' ) );
356
+ }
357
+ }
358
+
359
+ }
360
+
361
+ /**
362
+ * Prepare XML Data.
363
+ *
364
+ * @since 1.1.0
365
+ * @return void
366
+ */
367
+ public function prepare_xml_data() {
368
+
369
+ // Verify Nonce.
370
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
371
+
372
+ if ( ! current_user_can( 'customize' ) ) {
373
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
374
+ }
375
+
376
+ if ( ! class_exists( 'XMLReader' ) ) {
377
+ wp_send_json_error( __( 'If XMLReader is not available, it imports all other settings and only skips XML import. This creates an incomplete website. We should bail early and not import anything if this is not present.', 'astra-sites' ) );
378
+ }
379
+
380
+ $wxr_url = ( isset( $_REQUEST['wxr_url'] ) ) ? urldecode( $_REQUEST['wxr_url'] ) : '';
381
+
382
+ if ( ! astra_sites_is_valid_url( $wxr_url ) ) {
383
+ wp_send_json_error( __( 'Invalid Request URL.', 'astra-sites' ) );
384
+ }
385
+
386
+ Astra_Sites_Importer_Log::add( 'Importing from XML ' . $wxr_url );
387
+
388
+ $overrides = array(
389
+ 'wp_handle_sideload' => 'upload',
390
+ );
391
+
392
+ // Download XML file.
393
+ $xml_path = Astra_Sites_Helper::download_file( $wxr_url, $overrides );
394
+
395
+ if ( $xml_path['success'] ) {
396
+
397
+ $post = array(
398
+ 'post_title' => basename( $wxr_url ),
399
+ 'guid' => $xml_path['data']['url'],
400
+ 'post_mime_type' => $xml_path['data']['type'],
401
+ );
402
+
403
+ astra_sites_error_log( wp_json_encode( $post ) );
404
+ astra_sites_error_log( wp_json_encode( $xml_path ) );
405
+
406
+ // as per wp-admin/includes/upload.php.
407
+ $post_id = wp_insert_attachment( $post, $xml_path['data']['file'] );
408
+
409
+ astra_sites_error_log( wp_json_encode( $post_id ) );
410
+
411
+ if ( is_wp_error( $post_id ) ) {
412
+ wp_send_json_error( __( 'There was an error downloading the XML file.', 'astra-sites' ) );
413
+ } else {
414
+
415
+ update_option( 'astra_sites_imported_wxr_id', $post_id, 'no' );
416
+ $attachment_metadata = wp_generate_attachment_metadata( $post_id, $xml_path['data']['file'] );
417
+ wp_update_attachment_metadata( $post_id, $attachment_metadata );
418
+ $data = Astra_WXR_Importer::instance()->get_xml_data( $xml_path['data']['file'], $post_id );
419
+ $data['xml'] = $xml_path['data'];
420
+ wp_send_json_success( $data );
421
+ }
422
+ } else {
423
+ wp_send_json_error( $xml_path['data'] );
424
+ }
425
+ }
426
+
427
+ /**
428
+ * Import Options.
429
+ *
430
+ * @since 1.0.14
431
+ * @since 1.4.0 The `$options_data` was added.
432
+ *
433
+ * @param array $options_data Site Options.
434
+ * @return void
435
+ */
436
+ public function import_options( $options_data = array() ) {
437
+
438
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
439
+ // Verify Nonce.
440
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
441
+
442
+ if ( ! current_user_can( 'customize' ) ) {
443
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
444
+ }
445
+ }
446
+
447
+ $options_data = astra_get_site_data( 'astra-site-options-data' );
448
+
449
+ if ( ! empty( $options_data ) ) {
450
+ // Set meta for tracking the post.
451
+ if ( is_array( $options_data ) ) {
452
+ Astra_Sites_Importer_Log::add( 'Imported - Site Options ' . wp_json_encode( $options_data ) );
453
+ update_option( '_astra_sites_old_site_options', $options_data, 'no' );
454
+ }
455
+
456
+ $options_importer = Astra_Site_Options_Import::instance();
457
+ $options_importer->import_options( $options_data );
458
+ if ( defined( 'WP_CLI' ) ) {
459
+ WP_CLI::line( 'Imported Site Options!' );
460
+ } elseif ( wp_doing_ajax() ) {
461
+ wp_send_json_success( $options_data );
462
+ }
463
+ } else {
464
+ if ( defined( 'WP_CLI' ) ) {
465
+ WP_CLI::line( 'Site options are empty!' );
466
+ } elseif ( wp_doing_ajax() ) {
467
+ wp_send_json_error( __( 'Site options are empty!', 'astra-sites' ) );
468
+ }
469
+ }
470
+
471
+ }
472
+
473
+ /**
474
+ * Import Widgets.
475
+ *
476
+ * @since 1.0.14
477
+ * @since 1.4.0 The `$widgets_data` was added.
478
+ *
479
+ * @param string $widgets_data Widgets Data.
480
+ * @return void
481
+ */
482
+ public function import_widgets( $widgets_data = '' ) {
483
+
484
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
485
+ // Verify Nonce.
486
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
487
+
488
+ if ( ! current_user_can( 'customize' ) ) {
489
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
490
+ }
491
+ }
492
+
493
+ $widgets_data = ( isset( $_POST['widgets_data'] ) ) ? (object) json_decode( stripslashes( $_POST['widgets_data'] ) ) : (object) $widgets_data;
494
+
495
+ if ( ! empty( $widgets_data ) ) {
496
+
497
+ Astra_Widget_Importer::instance()->import_widgets_data( $widgets_data );
498
+
499
+ $sidebars_widgets = get_option( 'sidebars_widgets', array() );
500
+ update_option( '_astra_sites_old_widgets_data', $sidebars_widgets, 'no' );
501
+ Astra_Sites_Importer_Log::add( 'Imported - Widgets ' . wp_json_encode( $sidebars_widgets ) );
502
+
503
+ if ( defined( 'WP_CLI' ) ) {
504
+ WP_CLI::line( 'Widget Imported!' );
505
+ } elseif ( wp_doing_ajax() ) {
506
+ wp_send_json_success( $widgets_data );
507
+ }
508
+ } else {
509
+ if ( defined( 'WP_CLI' ) ) {
510
+ WP_CLI::line( 'Widget data is empty!' );
511
+ } elseif ( wp_doing_ajax() ) {
512
+ wp_send_json_error( __( 'Widget data is empty!', 'astra-sites' ) );
513
+ }
514
+ }
515
+
516
+ }
517
+
518
+ /**
519
+ * Import End.
520
+ *
521
+ * @since 1.0.14
522
+ * @return void
523
+ */
524
+ public function import_end() {
525
+
526
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
527
+ // Verify Nonce.
528
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
529
+
530
+ if ( ! current_user_can( 'customize' ) ) {
531
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
532
+ }
533
+ }
534
+
535
+ $demo_data = get_option( 'astra_sites_import_data', array() );
536
+
537
+ do_action( 'astra_sites_import_complete', $demo_data );
538
+
539
+ update_option( 'astra_sites_import_complete', 'yes', 'no' );
540
+
541
+ if ( wp_doing_ajax() ) {
542
+ wp_send_json_success();
543
+ }
544
+ }
545
+
546
+ /**
547
+ * Get single demo.
548
+ *
549
+ * @since 1.0.0
550
+ *
551
+ * @param (String) $demo_api_uri API URL of a demo.
552
+ *
553
+ * @return (Array) $astra_demo_data demo data for the demo.
554
+ */
555
+ public static function get_single_demo( $demo_api_uri ) {
556
+
557
+ if ( is_int( $demo_api_uri ) ) {
558
+ $demo_api_uri = Astra_Sites::get_instance()->get_api_url() . 'astra-sites/' . $demo_api_uri;
559
+ }
560
+
561
+ // default values.
562
+ $remote_args = array();
563
+ $defaults = array(
564
+ 'id' => '',
565
+ 'astra-site-widgets-data' => '',
566
+ 'astra-site-customizer-data' => '',
567
+ 'astra-site-options-data' => '',
568
+ 'astra-post-data-mapping' => '',
569
+ 'astra-site-wxr-path' => '',
570
+ 'astra-site-wpforms-path' => '',
571
+ 'astra-enabled-extensions' => '',
572
+ 'astra-custom-404' => '',
573
+ 'required-plugins' => '',
574
+ 'astra-site-taxonomy-mapping' => '',
575
+ 'license-status' => '',
576
+ 'site-type' => '',
577
+ 'astra-site-url' => '',
578
+ );
579
+
580
+ $api_args = apply_filters(
581
+ 'astra_sites_api_args',
582
+ array(
583
+ 'timeout' => 15,
584
+ )
585
+ );
586
+
587
+ // Use this for premium demos.
588
+ $request_params = apply_filters(
589
+ 'astra_sites_api_params',
590
+ array(
591
+ 'purchase_key' => '',
592
+ 'site_url' => '',
593
+ )
594
+ );
595
+
596
+ $demo_api_uri = add_query_arg( $request_params, trailingslashit( $demo_api_uri ) );
597
+
598
+ // API Call.
599
+ $response = wp_remote_get( $demo_api_uri, $api_args );
600
+
601
+ if ( is_wp_error( $response ) || ( isset( $response->status ) && 0 === $response->status ) ) {
602
+ if ( isset( $response->status ) ) {
603
+ $data = json_decode( $response, true );
604
+ } else {
605
+ return new WP_Error( 'api_invalid_response_code', $response->get_error_message() );
606
+ }
607
+ }
608
+
609
+ if ( wp_remote_retrieve_response_code( $response ) !== 200 ) {
610
+ return new WP_Error( 'api_invalid_response_code', wp_remote_retrieve_body( $response ) );
611
+ } else {
612
+ $data = json_decode( wp_remote_retrieve_body( $response ), true );
613
+ }
614
+
615
+ $data = json_decode( wp_remote_retrieve_body( $response ), true );
616
+
617
+ if ( ! isset( $data['code'] ) ) {
618
+ $remote_args['id'] = $data['id'];
619
+ $remote_args['astra-site-widgets-data'] = json_decode( $data['astra-site-widgets-data'] );
620
+ $remote_args['astra-site-customizer-data'] = $data['astra-site-customizer-data'];
621
+ $remote_args['astra-site-options-data'] = $data['astra-site-options-data'];
622
+ $remote_args['astra-post-data-mapping'] = $data['astra-post-data-mapping'];
623
+ $remote_args['astra-site-wxr-path'] = $data['astra-site-wxr-path'];
624
+ $remote_args['astra-site-wpforms-path'] = $data['astra-site-wpforms-path'];
625
+ $remote_args['astra-enabled-extensions'] = $data['astra-enabled-extensions'];
626
+ $remote_args['astra-custom-404'] = $data['astra-custom-404'];
627
+ $remote_args['required-plugins'] = $data['required-plugins'];
628
+ $remote_args['astra-site-taxonomy-mapping'] = $data['astra-site-taxonomy-mapping'];
629
+ $remote_args['license-status'] = $data['license-status'];
630
+ $remote_args['site-type'] = $data['astra-site-type'];
631
+ $remote_args['astra-site-url'] = $data['astra-site-url'];
632
+ }
633
+
634
+ // Merge remote demo and defaults.
635
+ return wp_parse_args( $remote_args, $defaults );
636
+ }
637
+
638
+ /**
639
+ * Clear Cache.
640
+ *
641
+ * @since 1.0.9
642
+ */
643
+ public function after_batch_complete() {
644
+
645
+ // Clear 'Builder Builder' cache.
646
+ if ( is_callable( 'FLBuilderModel::delete_asset_cache_for_all_posts' ) ) {
647
+ FLBuilderModel::delete_asset_cache_for_all_posts();
648
+ }
649
+
650
+ // Clear 'Astra Addon' cache.
651
+ if ( is_callable( 'Astra_Minify::refresh_assets' ) ) {
652
+ Astra_Minify::refresh_assets();
653
+ }
654
+
655
+ $this->update_latest_checksums();
656
+
657
+ // Flush permalinks.
658
+ flush_rewrite_rules();
659
+
660
+ delete_option( 'astra_sites_import_data' );
661
+
662
+ Astra_Sites_Importer_Log::add( 'Complete ' );
663
+ }
664
+
665
+ /**
666
+ * Update Latest Checksums
667
+ *
668
+ * Store latest checksum after batch complete.
669
+ *
670
+ * @since 2.0.0
671
+ * @return void
672
+ */
673
+ public function update_latest_checksums() {
674
+ $latest_checksums = get_site_option( 'astra-sites-last-export-checksums-latest', '' );
675
+ update_site_option( 'astra-sites-last-export-checksums', $latest_checksums, 'no' );
676
+ }
677
+
678
+ /**
679
+ * Reset customizer data
680
+ *
681
+ * @since 1.3.0
682
+ * @return void
683
+ */
684
+ public function reset_customizer_data() {
685
+
686
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
687
+ // Verify Nonce.
688
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
689
+
690
+ if ( ! current_user_can( 'customize' ) ) {
691
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
692
+ }
693
+ }
694
+
695
+ Astra_Sites_Importer_Log::add( 'Deleted customizer Settings ' . wp_json_encode( get_option( 'astra-settings', array() ) ) );
696
+
697
+ delete_option( 'astra-settings' );
698
+
699
+ if ( defined( 'WP_CLI' ) ) {
700
+ WP_CLI::line( 'Deleted Customizer Settings!' );
701
+ } elseif ( wp_doing_ajax() ) {
702
+ wp_send_json_success();
703
+ }
704
+ }
705
+
706
+ /**
707
+ * Reset site options
708
+ *
709
+ * @since 1.3.0
710
+ * @return void
711
+ */
712
+ public function reset_site_options() {
713
+
714
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
715
+ // Verify Nonce.
716
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
717
+
718
+ if ( ! current_user_can( 'customize' ) ) {
719
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
720
+ }
721
+ }
722
+
723
+ $options = get_option( '_astra_sites_old_site_options', array() );
724
+
725
+ Astra_Sites_Importer_Log::add( 'Deleted - Site Options ' . wp_json_encode( $options ) );
726
+
727
+ if ( $options ) {
728
+ foreach ( $options as $option_key => $option_value ) {
729
+ delete_option( $option_key );
730
+ }
731
+ }
732
+
733
+ if ( defined( 'WP_CLI' ) ) {
734
+ WP_CLI::line( 'Deleted Site Options!' );
735
+ } elseif ( wp_doing_ajax() ) {
736
+ wp_send_json_success();
737
+ }
738
+ }
739
+
740
+ /**
741
+ * Reset widgets data
742
+ *
743
+ * @since 1.3.0
744
+ * @return void
745
+ */
746
+ public function reset_widgets_data() {
747
+
748
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
749
+ // Verify Nonce.
750
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
751
+
752
+ if ( ! current_user_can( 'customize' ) ) {
753
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
754
+ }
755
+ }
756
+
757
+ // Get all old widget ids.
758
+ $old_widgets_data = (array) get_option( '_astra_sites_old_widgets_data', array() );
759
+ $old_widget_ids = array();
760
+ foreach ( $old_widgets_data as $old_sidebar_key => $old_widgets ) {
761
+ if ( ! empty( $old_widgets ) && is_array( $old_widgets ) ) {
762
+ $old_widget_ids = array_merge( $old_widget_ids, $old_widgets );
763
+ }
764
+ }
765
+
766
+ // Process if not empty.
767
+ $sidebars_widgets = get_option( 'sidebars_widgets', array() );
768
+ if ( ! empty( $old_widget_ids ) && ! empty( $sidebars_widgets ) ) {
769
+
770
+ Astra_Sites_Importer_Log::add( 'DELETED - WIDGETS ' . wp_json_encode( $old_widget_ids ) );
771
+
772
+ foreach ( $sidebars_widgets as $sidebar_id => $widgets ) {
773
+ $widgets = (array) $widgets;
774
+
775
+ if ( ! empty( $widgets ) && is_array( $widgets ) ) {
776
+ foreach ( $widgets as $widget_id ) {
777
+
778
+ if ( in_array( $widget_id, $old_widget_ids, true ) ) {
779
+ Astra_Sites_Importer_Log::add( 'DELETED - WIDGET ' . $widget_id );
780
+
781
+ // Move old widget to inacitve list.
782
+ $sidebars_widgets['wp_inactive_widgets'][] = $widget_id;
783
+
784
+ // Remove old widget from sidebar.
785
+ $sidebars_widgets[ $sidebar_id ] = array_diff( $sidebars_widgets[ $sidebar_id ], array( $widget_id ) );
786
+ }
787
+ }
788
+ }
789
+ }
790
+
791
+ update_option( 'sidebars_widgets', $sidebars_widgets );
792
+ }
793
+
794
+ if ( defined( 'WP_CLI' ) ) {
795
+ WP_CLI::line( 'Deleted Widgets!' );
796
+ } elseif ( wp_doing_ajax() ) {
797
+ wp_send_json_success();
798
+ }
799
+ }
800
+
801
+ /**
802
+ * Delete imported posts
803
+ *
804
+ * @since 1.3.0
805
+ * @since 1.4.0 The `$post_id` was added.
806
+ *
807
+ * @param integer $post_id Post ID.
808
+ * @return void
809
+ */
810
+ public function delete_imported_posts( $post_id = 0 ) {
811
+
812
+ if ( wp_doing_ajax() ) {
813
+ // Verify Nonce.
814
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
815
+
816
+ if ( ! current_user_can( 'customize' ) ) {
817
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
818
+ }
819
+ }
820
+
821
+ $post_id = isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : $post_id;
822
+
823
+ $message = 'Deleted - Post ID ' . $post_id . ' - ' . get_post_type( $post_id ) . ' - ' . get_the_title( $post_id );
824
+
825
+ $message = '';
826
+ if ( $post_id ) {
827
+
828
+ $post_type = get_post_type( $post_id );
829
+ $message = 'Deleted - Post ID ' . $post_id . ' - ' . $post_type . ' - ' . get_the_title( $post_id );
830
+
831
+ do_action( 'astra_sites_before_delete_imported_posts', $post_id, $post_type );
832
+
833
+ Astra_Sites_Importer_Log::add( $message );
834
+ wp_delete_post( $post_id, true );
835
+ }
836
+
837
+ if ( defined( 'WP_CLI' ) ) {
838
+ WP_CLI::line( $message );
839
+ } elseif ( wp_doing_ajax() ) {
840
+ wp_send_json_success( $message );
841
+ }
842
+ }
843
+
844
+ /**
845
+ * Delete imported WP forms
846
+ *
847
+ * @since 1.3.0
848
+ * @since 1.4.0 The `$post_id` was added.
849
+ *
850
+ * @param integer $post_id Post ID.
851
+ * @return void
852
+ */
853
+ public function delete_imported_wp_forms( $post_id = 0 ) {
854
+
855
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
856
+ // Verify Nonce.
857
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
858
+
859
+ if ( ! current_user_can( 'customize' ) ) {
860
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
861
+ }
862
+ }
863
+
864
+ $post_id = isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : $post_id;
865
+
866
+ $message = '';
867
+ if ( $post_id ) {
868
+
869
+ do_action( 'astra_sites_before_delete_imported_wp_forms', $post_id );
870
+
871
+ $message = 'Deleted - Form ID ' . $post_id . ' - ' . get_post_type( $post_id ) . ' - ' . get_the_title( $post_id );
872
+ Astra_Sites_Importer_Log::add( $message );
873
+ wp_delete_post( $post_id, true );
874
+ }
875
+
876
+ if ( defined( 'WP_CLI' ) ) {
877
+ WP_CLI::line( $message );
878
+ } elseif ( wp_doing_ajax() ) {
879
+ wp_send_json_success( $message );
880
+ }
881
+ }
882
+
883
+ /**
884
+ * Delete imported terms
885
+ *
886
+ * @since 1.3.0
887
+ * @since 1.4.0 The `$post_id` was added.
888
+ *
889
+ * @param integer $term_id Term ID.
890
+ * @return void
891
+ */
892
+ public function delete_imported_terms( $term_id = 0 ) {
893
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
894
+ // Verify Nonce.
895
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
896
+
897
+ if ( ! current_user_can( 'customize' ) ) {
898
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
899
+ }
900
+ }
901
+
902
+ $term_id = isset( $_REQUEST['term_id'] ) ? absint( $_REQUEST['term_id'] ) : $term_id;
903
+
904
+ $message = '';
905
+ if ( $term_id ) {
906
+ $term = get_term( $term_id );
907
+ if ( ! is_wp_error( $term ) && ! empty( $term ) && is_object( $term ) ) {
908
+
909
+ do_action( 'astra_sites_before_delete_imported_terms', $term_id, $term );
910
+
911
+ $message = 'Deleted - Term ' . $term_id . ' - ' . $term->name . ' ' . $term->taxonomy;
912
+ Astra_Sites_Importer_Log::add( $message );
913
+ wp_delete_term( $term_id, $term->taxonomy );
914
+ }
915
+ }
916
+
917
+ if ( defined( 'WP_CLI' ) ) {
918
+ WP_CLI::line( $message );
919
+ } elseif ( wp_doing_ajax() ) {
920
+ wp_send_json_success( $message );
921
+ }
922
+ }
923
+
924
+ }
925
+
926
+ /**
927
+ * Kicking this off by calling 'get_instance()' method
928
+ */
929
+ Astra_Sites_Importer::get_instance();
930
+ }
astra-sites/inc/classes/class-astra-sites-page.php ADDED
@@ -0,0 +1,666 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites Page
4
+ *
5
+ * @since 1.0.6
6
+ * @package Astra Sites
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ if ( ! class_exists( 'Astra_Sites_Page' ) ) {
14
+
15
+ /**
16
+ * Astra Admin Settings
17
+ */
18
+ class Astra_Sites_Page {
19
+
20
+ /**
21
+ * View all actions
22
+ *
23
+ * @since 1.0.6
24
+ * @var array $view_actions
25
+ */
26
+ public $view_actions = array();
27
+
28
+ /**
29
+ * Member Variable
30
+ *
31
+ * @var instance
32
+ */
33
+ private static $instance;
34
+
35
+ /**
36
+ * Initiator
37
+ *
38
+ * @since 1.3.0
39
+ */
40
+ public static function get_instance() {
41
+ if ( ! isset( self::$instance ) ) {
42
+ self::$instance = new self();
43
+ }
44
+ return self::$instance;
45
+ }
46
+
47
+ /**
48
+ * Constructor
49
+ *
50
+ * @since 1.3.0
51
+ */
52
+ public function __construct() {
53
+
54
+ if ( ! is_admin() ) {
55
+ return;
56
+ }
57
+
58
+ add_action( 'wp_ajax_astra-sites-change-page-builder', array( $this, 'save_page_builder_on_ajax' ) );
59
+ add_action( 'admin_init', array( $this, 'getting_started' ) );
60
+ }
61
+
62
+ /**
63
+ * Admin notice
64
+ *
65
+ * @since 1.3.5
66
+ *
67
+ * @return void
68
+ */
69
+ public function getting_started() {
70
+
71
+ $current_screen = get_current_screen();
72
+
73
+ // Bail if not on Astra Sites screen.
74
+ if ( ! is_object( $current_screen ) && null === $current_screen ) {
75
+ return;
76
+ }
77
+
78
+ if ( 'plugins' === $current_screen->base ) {
79
+ $processed = get_option( '_astra_sites_gettings_started', 'no' );
80
+ $product_name = Astra_Sites_White_Label::get_instance()->get_white_label_name( 'Astra' );
81
+
82
+ if ( 'yes' === $processed ) {
83
+ return;
84
+ }
85
+
86
+ $arguments = array(
87
+ 'page' => 'starter-templates',
88
+ );
89
+
90
+ $url = add_query_arg( $arguments, admin_url( 'themes.php' ) );
91
+
92
+ ?>
93
+ <div class="notice notice-info is-dismissible astra-sites-notice astra-sites-getting-started-notice">
94
+ <?php /* translators: %1$s is the admin page URL, %2$s is product name. */ ?>
95
+ <p><?php printf( __( 'Thank you for choosing %1$s! Check the library of <a class="astra-sites-getting-started-btn" href="%2$s">ready starter templates here »</a>', 'astra-sites' ), esc_html( $product_name ), esc_url( $url ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
96
+ </div>
97
+ <?php
98
+ }
99
+
100
+ }
101
+
102
+ /**
103
+ * Save Page Builder
104
+ *
105
+ * @return void
106
+ */
107
+ public function save_page_builder_on_ajax() {
108
+
109
+ // Only admins can save settings.
110
+ if ( ! current_user_can( 'manage_options' ) ) {
111
+ wp_send_json_error();
112
+ }
113
+
114
+ // Stored Settings.
115
+ $stored_data = $this->get_settings();
116
+
117
+ // New settings.
118
+ $new_data = array(
119
+ 'page_builder' => ( isset( $_REQUEST['page_builder'] ) ) ? sanitize_key( $_REQUEST['page_builder'] ) : '', // phpcs:ignore WordPress.Security.NonceVerification.Recommended
120
+ );
121
+
122
+ // Merge settings.
123
+ $data = wp_parse_args( $new_data, $stored_data );
124
+
125
+ // Update settings.
126
+ update_option( 'astra_sites_settings', $data, 'no' );
127
+
128
+ $sites = $this->get_sites_by_page_builder( $new_data['page_builder'] );
129
+
130
+ wp_send_json_success( $sites );
131
+ }
132
+
133
+ /**
134
+ * Get Page Builder Sites
135
+ *
136
+ * @since 2.0.0
137
+ *
138
+ * @param string $default_page_builder default page builder slug.
139
+ * @return array page builder sites.
140
+ */
141
+ public function get_sites_by_page_builder( $default_page_builder = '' ) {
142
+ $sites_and_pages = Astra_Sites::get_instance()->get_all_sites();
143
+ $current_page_builder_sites = array();
144
+ if ( ! empty( $sites_and_pages ) ) {
145
+ $page_builder_keys = wp_list_pluck( $sites_and_pages, 'astra-site-page-builder' );
146
+ foreach ( $page_builder_keys as $site_id => $page_builder ) {
147
+ if ( $default_page_builder === $page_builder ) {
148
+ $current_page_builder_sites[ $site_id ] = $sites_and_pages[ $site_id ];
149
+ }
150
+ }
151
+ }
152
+
153
+ return $current_page_builder_sites;
154
+ }
155
+
156
+ /**
157
+ * Get single setting value
158
+ *
159
+ * @param string $key Setting key.
160
+ * @param mixed $defaults Setting value.
161
+ * @return mixed Stored setting value.
162
+ */
163
+ public function get_setting( $key = '', $defaults = '' ) {
164
+
165
+ $settings = $this->get_settings();
166
+
167
+ if ( empty( $settings ) ) {
168
+ return $defaults;
169
+ }
170
+
171
+ if ( array_key_exists( $key, $settings ) ) {
172
+ return $settings[ $key ];
173
+ }
174
+
175
+ return $defaults;
176
+ }
177
+
178
+ /**
179
+ * Get Settings
180
+ *
181
+ * @return array Stored settings.
182
+ */
183
+ public function get_settings() {
184
+
185
+ $defaults = array(
186
+ 'page_builder' => '',
187
+ );
188
+
189
+ $stored_data = get_option( 'astra_sites_settings', $defaults );
190
+
191
+ return wp_parse_args( $stored_data, $defaults );
192
+ }
193
+
194
+ /**
195
+ * Update Settings
196
+ *
197
+ * @param array $args Arguments.
198
+ */
199
+ public function update_settings( $args = array() ) {
200
+
201
+ $stored_data = get_option( 'astra_sites_settings', array() );
202
+
203
+ $new_data = wp_parse_args( $args, $stored_data );
204
+
205
+ update_option( 'astra_sites_settings', $new_data, 'no' );
206
+ }
207
+
208
+ /**
209
+ * Init Nav Menu
210
+ *
211
+ * @param mixed $action Action name.
212
+ * @since 1.0.6
213
+ */
214
+ public function init_nav_menu( $action = '' ) {
215
+
216
+ if ( '' !== $action ) {
217
+ $this->render_tab_menu( $action );
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Render tab menu
223
+ *
224
+ * @param mixed $action Action name.
225
+ * @since 1.0.6
226
+ */
227
+ public function render_tab_menu( $action = '' ) {
228
+ ?>
229
+ <div id="astra-sites-menu-page">
230
+ <?php $this->render( $action ); ?>
231
+ </div>
232
+ <?php
233
+ }
234
+
235
+ /**
236
+ * View actions
237
+ *
238
+ * @since 1.0.11
239
+ */
240
+ public function get_view_actions() {
241
+
242
+ if ( empty( $this->view_actions ) ) {
243
+
244
+ $this->view_actions = apply_filters(
245
+ 'astra_sites_menu_item',
246
+ array()
247
+ );
248
+ }
249
+
250
+ return $this->view_actions;
251
+ }
252
+
253
+ /**
254
+ * Prints HTML content for tabs
255
+ *
256
+ * @param mixed $action Action name.
257
+ * @since 1.0.6
258
+ */
259
+ public function render( $action ) {
260
+
261
+ // Settings update message.
262
+ if ( isset( $_REQUEST['message'] ) && ( 'saved' === $_REQUEST['message'] || 'saved_ext' === $_REQUEST['message'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
263
+ ?>
264
+ <span id="message" class="notice astra-sites-notice notice-success is-dismissive"><p> <?php esc_html_e( 'Settings saved successfully.', 'astra-sites' ); ?> </p></span>
265
+ <?php
266
+ }
267
+
268
+ $current_slug = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : 'starter-templates'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
269
+
270
+ $default_page_builder = $this->get_setting( 'page_builder' );
271
+
272
+ if ( isset( $_GET['action'] ) && 'site-import' === $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
273
+
274
+ $status = Astra_Sites_Batch_Site_Import::get_instance()->get_status();
275
+ $import_status = isset( $status['status'] ) ? $status['status'] : '';
276
+ $status_class = 'invalid_site_id' === $import_status || 'premium_sites' === $import_status ? 'failed' : '';
277
+ $step_class = '';
278
+ if ( ! empty( $status ) ) {
279
+ $step_class = isset( $status['step'] ) && 'complete' === $status['step'] ? 'success' : '';
280
+ }
281
+ ?>
282
+ <div class="astra-sites-welcome astra-sites-import-screen <?php echo esc_attr( $status_class ); ?>">
283
+ <div class="inner-wrap">
284
+ <div class="inner">
285
+ <div class="header">
286
+ <?php
287
+ $white_label = false;
288
+ $white_label_class = '';
289
+ if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
290
+ $white_label_title = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
291
+ if ( $white_label_title ) {
292
+ $white_label = true;
293
+ $white_label_class = 'white-label-enabled';
294
+ }
295
+ }
296
+ ?>
297
+ <span class="logo <?php echo esc_attr( $white_label_class ); ?>">
298
+ <?php if ( ! $white_label ) { ?>
299
+ <img src="<?php echo esc_url( ASTRA_SITES_URI . 'inc/assets/images/logo.svg' ); ?>">
300
+ <?php } else { ?>
301
+ <?php echo esc_html( Astra_Sites_White_Label::get_instance()->get_white_label_name() ); ?>
302
+ <?php } ?>
303
+ <h3 class="title"><?php esc_html_e( 'Importing Starter Template...', 'astra-sites' ); ?></h3>
304
+ </span>
305
+ </div>
306
+ <div class="content">
307
+ <?php if ( 'invalid_site_id' === $import_status ) { ?>
308
+ <p><?php esc_html_e( 'The demo you are importing seems invalid. The site is not found.', 'astra-sites' ); ?></p>
309
+ <?php } elseif ( 'premium_sites' === $import_status ) { ?>
310
+ <p><?php esc_html_e( 'The demo you are importing is a premium demo.', 'astra-sites' ); ?> <a href="https://wpastra.com/starter-templates-plans/?utm_source=batch-site-import&utm_campaign=astra-sites&utm_medium=batch-import" class="" target="_blank"><?php esc_html_e( 'Get Access!', 'astra-sites' ); ?><i class="dashicons dashicons-external"></i></a></p>
311
+ <?php } else { ?>
312
+ <p><?php esc_html_e( 'The import process can take a few minutes depending on the size of the site and speed of the connection.', 'astra-sites' ); ?></p>
313
+ <?php } ?>
314
+ <ul class="import-steps">
315
+ <li class="import-step <?php echo esc_attr( $step_class ); ?>" data-step="preparing">
316
+ <?php esc_html_e( 'Preparing Site Import', 'astra-sites' ); ?>
317
+ </li>
318
+ <li class="import-step <?php echo esc_attr( $step_class ); ?>" data-step="install_plugins">
319
+ <?php esc_html_e( 'Installing Required Plugins', 'astra-sites' ); ?>
320
+ </li>
321
+ <li class="import-step <?php echo esc_attr( $step_class ); ?>" data-step="import_contact_forms">
322
+ <?php esc_html_e( 'Importing Contact Forms', 'astra-sites' ); ?>
323
+ </li>
324
+ <li class="import-step <?php echo esc_attr( $step_class ); ?>" data-step="import_customizer_settings">
325
+ <?php esc_html_e( 'Setting up the Theme', 'astra-sites' ); ?>
326
+ </li>
327
+ <li class="import-step <?php echo esc_attr( $step_class ); ?>" data-step="import_content">
328
+ <?php esc_html_e( 'Importing Media, Posts, and Pages', 'astra-sites' ); ?>
329
+ </li>
330
+ <li class="import-step <?php echo esc_attr( $step_class ); ?>" data-step="import_options">
331
+ <?php esc_html_e( 'Importing Site Options', 'astra-sites' ); ?>
332
+ </li>
333
+ <li class="import-step <?php echo esc_attr( $step_class ); ?>" data-step="import_widgets">
334
+ <?php esc_html_e( 'Importing Sidebar and Widgets', 'astra-sites' ); ?>
335
+ </li>
336
+ <li class="import-step <?php echo esc_attr( $step_class ); ?>" data-step="complete">
337
+ <?php esc_html_e( 'Import Complete', 'astra-sites' ); ?>
338
+ </li>
339
+ </ul>
340
+
341
+ <?php if ( 'success' === $step_class ) { ?>
342
+ <p>
343
+ <?php esc_html_e( 'Site Imported Successfully!', 'astra-sites' ); ?>
344
+ <a class="view-site-button" href="<?php echo esc_url( site_url() ); ?>" target="_blank"><?php esc_html_e( 'Visit Site', 'astra-sites' ); ?> <i class="dashicons dashicons-external"></i></a>
345
+ </p>
346
+ <?php } ?>
347
+ </div>
348
+ </div>
349
+ </div>
350
+ </div>
351
+ <?php
352
+ }
353
+ }
354
+
355
+ /**
356
+ * Site Filters
357
+ *
358
+ * @since 2.0.0
359
+ *
360
+ * @return void
361
+ */
362
+ public function site_filters() {
363
+ ?>
364
+ <div class="wp-filter hide-if-no-js">
365
+ <div class="section-left">
366
+ <div class="search-form">
367
+ <?php
368
+ $categories = Astra_Sites::get_instance()->get_api_option( 'astra-sites-all-site-categories' );
369
+ if ( ! empty( $categories ) ) {
370
+ ?>
371
+ <div id="astra-sites__category-filter" class="dropdown-check-list" tabindex="100">
372
+ <span class="astra-sites__category-filter-anchor" data-slug=""><?php esc_html_e( 'All', 'astra-sites' ); ?></span>
373
+ <ul class="astra-sites__category-filter-items">
374
+ <li class="ast-sites__filter-wrap category-active" data-slug=""><?php esc_html_e( 'All', 'astra-sites' ); ?> </li>
375
+ <?php
376
+ foreach ( $categories as $key => $value ) {
377
+ if ( 'free' !== $value['slug'] ) {
378
+ ?>
379
+ <li class="ast-sites__filter-wrap" data-slug="<?php echo esc_attr( $value['slug'] ); ?>"><?php echo esc_html( $value['name'] ); ?> </li>
380
+ <?php
381
+ }
382
+ }
383
+ ?>
384
+ <li class="ast-sites__filter-wrap-checkbox first-wrap">
385
+ <label>
386
+ <input id="radio-all" type="radio" name="ast-sites-radio" class="checkbox active" value="" checked /><?php esc_html_e( 'All', 'astra-sites' ); ?>
387
+ </label>
388
+ </li>
389
+ <li class="ast-sites__filter-wrap-checkbox">
390
+ <label>
391
+ <input id="radio-free" type="radio" name="ast-sites-radio" class="checkbox" value="free" /><?php esc_html_e( 'Free', 'astra-sites' ); ?>
392
+ </label>
393
+ </li>
394
+ <li class="ast-sites__filter-wrap-checkbox">
395
+ <label>
396
+ <input id="radio-agency" type="radio" name="ast-sites-radio" class="checkbox" value="agency" /><?php esc_html_e( 'Premium', 'astra-sites' ); ?>
397
+ </label>
398
+ </li>
399
+ </ul>
400
+ </div>
401
+ <?php
402
+ }
403
+ ?>
404
+ <input autocomplete="off" placeholder="<?php esc_html_e( 'Search...', 'astra-sites' ); ?>" type="search" aria-describedby="live-search-desc" id="wp-filter-search-input" class="wp-filter-search">
405
+ <span class="ast-icon-search search-icon"></span>
406
+ <div class="astra-sites-autocomplete-result"></div>
407
+ </div>
408
+ </div>
409
+ </div>
410
+ <?php
411
+ }
412
+
413
+ /**
414
+ * Get Default Page Builder
415
+ *
416
+ * @since 2.0.0
417
+ *
418
+ * @return mixed page builders or empty string.
419
+ */
420
+ public function get_default_page_builder() {
421
+ $default_page_builder = $this->get_setting( 'page_builder' );
422
+
423
+ $page_builders = Astra_Sites::get_instance()->get_page_builders();
424
+
425
+ foreach ( $page_builders as $key => $page_builder ) {
426
+ if ( $page_builder['slug'] === $default_page_builder ) {
427
+ return $page_builder;
428
+ }
429
+ }
430
+
431
+ return '';
432
+ }
433
+
434
+ /**
435
+ * Get Page Builders
436
+ *
437
+ * @since 2.0.0
438
+ *
439
+ * @param string $slug Page Builder Slug.
440
+ * @return array page builders.
441
+ */
442
+ public function get_page_builder_image( $slug ) {
443
+
444
+ $image = '';
445
+
446
+ switch ( $slug ) {
447
+
448
+ case 'elementor':
449
+ $image = ASTRA_SITES_URI . 'inc/assets/images/elementor.jpg';
450
+ break;
451
+
452
+ case 'beaver-builder':
453
+ $image = ASTRA_SITES_URI . 'inc/assets/images/beaver-builder.jpg';
454
+ break;
455
+
456
+ case 'gutenberg':
457
+ $image = ASTRA_SITES_URI . 'inc/assets/images/block-editor.png';
458
+ break;
459
+
460
+ case 'brizy':
461
+ $image = ASTRA_SITES_URI . 'inc/assets/images/brizy.jpg';
462
+ break;
463
+ }
464
+
465
+ return $image;
466
+ }
467
+
468
+ /**
469
+ * Page Builder List
470
+ *
471
+ * @since 1.4.0
472
+ * @return array
473
+ */
474
+ public function get_page_builders() {
475
+ return array(
476
+ 'gutenberg' => array(
477
+ 'slug' => 'gutenberg',
478
+ 'name' => esc_html__( 'Gutenberg', 'astra-sites' ),
479
+ 'image_url' => ASTRA_SITES_URI . 'inc/assets/images/block-editor.jpg',
480
+ 'title' => esc_html__( 'The default WordPress editor', 'astra-sites' ),
481
+ ),
482
+ 'elementor' => array(
483
+ 'slug' => 'elementor',
484
+ 'name' => esc_html__( 'Elementor', 'astra-sites' ),
485
+ 'image_url' => ASTRA_SITES_URI . 'inc/assets/images/elementor.jpg',
486
+ ),
487
+ 'beaver-builder' => array(
488
+ 'slug' => 'beaver-builder',
489
+ 'name' => esc_html__( 'Beaver Builder', 'astra-sites' ),
490
+ 'image_url' => ASTRA_SITES_URI . 'inc/assets/images/beaver-builder.jpg',
491
+ ),
492
+ 'brizy' => array(
493
+ 'slug' => 'brizy',
494
+ 'name' => esc_html__( 'Brizy', 'astra-sites' ),
495
+ 'image_url' => ASTRA_SITES_URI . 'inc/assets/images/brizy.jpg',
496
+ ),
497
+ );
498
+ }
499
+
500
+ /**
501
+ * Get and return page URL
502
+ *
503
+ * @param string $menu_slug Menu name.
504
+ * @since 1.0.6
505
+ * @return string page url
506
+ */
507
+ public function get_page_url( $menu_slug ) {
508
+
509
+ $current_slug = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : 'starter-templates'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
510
+ $parent_page = 'themes.php';
511
+
512
+ if ( strpos( $parent_page, '?' ) !== false ) {
513
+ $query_var = '&page=' . $current_slug;
514
+ } else {
515
+ $query_var = '?page=' . $current_slug;
516
+ }
517
+
518
+ $parent_page_url = admin_url( $parent_page . $query_var );
519
+
520
+ $url = $parent_page_url . '&action=' . $menu_slug;
521
+
522
+ return esc_url( $url );
523
+ }
524
+
525
+ /**
526
+ * Converts a period of time in seconds into a human-readable format representing the interval.
527
+ *
528
+ * @since 2.0.0
529
+ *
530
+ * Example:
531
+ *
532
+ * echo self::interval( 90 );
533
+ * // 1 minute 30 seconds
534
+ *
535
+ * @param int $since A period of time in seconds.
536
+ * @return string An interval represented as a string.
537
+ */
538
+ public function interval( $since ) {
539
+ // Array of time period chunks.
540
+ $chunks = array(
541
+ /* translators: 1: The number of years in an interval of time. */
542
+ array( 60 * 60 * 24 * 365, _n_noop( '%s year', '%s years', 'astra-sites' ) ),
543
+ /* translators: 1: The number of months in an interval of time. */
544
+ array( 60 * 60 * 24 * 30, _n_noop( '%s month', '%s months', 'astra-sites' ) ),
545
+ /* translators: 1: The number of weeks in an interval of time. */
546
+ array( 60 * 60 * 24 * 7, _n_noop( '%s week', '%s weeks', 'astra-sites' ) ),
547
+ /* translators: 1: The number of days in an interval of time. */
548
+ array( 60 * 60 * 24, _n_noop( '%s day', '%s days', 'astra-sites' ) ),
549
+ /* translators: 1: The number of hours in an interval of time. */
550
+ array( 60 * 60, _n_noop( '%s hour', '%s hours', 'astra-sites' ) ),
551
+ /* translators: 1: The number of minutes in an interval of time. */
552
+ array( 60, _n_noop( '%s minute', '%s minutes', 'astra-sites' ) ),
553
+ /* translators: 1: The number of seconds in an interval of time. */
554
+ array( 1, _n_noop( '%s second', '%s seconds', 'astra-sites' ) ),
555
+ );
556
+
557
+ if ( $since <= 0 ) {
558
+ return esc_html__( 'now', 'astra-sites' );
559
+ }
560
+
561
+ /**
562
+ * We only want to output two chunks of time here, eg:
563
+ * x years, xx months
564
+ * x days, xx hours
565
+ * so there's only two bits of calculation below:
566
+ */
567
+ $j = count( $chunks );
568
+
569
+ // Step one: the first chunk.
570
+ for ( $i = 0; $i < $j; $i++ ) {
571
+ $seconds = $chunks[ $i ][0];
572
+ $name = $chunks[ $i ][1];
573
+
574
+ // Finding the biggest chunk (if the chunk fits, break).
575
+ $count = floor( $since / $seconds );
576
+ if ( $count ) {
577
+ break;
578
+ }
579
+ }
580
+
581
+ // Set output var.
582
+ $output = sprintf( translate_nooped_plural( $name, $count, 'astra-sites' ), $count );
583
+
584
+ // Step two: the second chunk.
585
+ if ( $i + 1 < $j ) {
586
+ $seconds2 = $chunks[ $i + 1 ][0];
587
+ $name2 = $chunks[ $i + 1 ][1];
588
+ $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 );
589
+ if ( $count2 ) {
590
+ // Add to output var.
591
+ $output .= ' ' . sprintf( translate_nooped_plural( $name2, $count2, 'astra-sites' ), $count2 );
592
+ }
593
+ }
594
+
595
+ return $output;
596
+ }
597
+
598
+ /**
599
+ * Check Cron Status
600
+ *
601
+ * Gets the current cron status by performing a test spawn. Cached for one hour when all is well.
602
+ *
603
+ * @since 2.0.0
604
+ *
605
+ * @param bool $cache Whether to use the cached result from previous calls.
606
+ * @return true|WP_Error Boolean true if the cron spawner is working as expected, or a WP_Error object if not.
607
+ */
608
+ public static function test_cron( $cache = true ) {
609
+ global $wp_version;
610
+
611
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
612
+ return new WP_Error( 'astra_sites_cron_error', esc_html__( 'ERROR! Cron schedules are disabled by setting constant DISABLE_WP_CRON to true.<br/>To start the import process please enable the cron by setting the constant to false. E.g. define( \'DISABLE_WP_CRON\', false );', 'astra-sites' ) );
613
+ }
614
+
615
+ if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
616
+ return new WP_Error( 'astra_sites_cron_error', esc_html__( 'ERROR! Cron schedules are disabled by setting constant ALTERNATE_WP_CRON to true.<br/>To start the import process please enable the cron by setting the constant to false. E.g. define( \'ALTERNATE_WP_CRON\', false );', 'astra-sites' ) );
617
+ }
618
+
619
+ $cached_status = get_transient( 'astra-sites-cron-test-ok' );
620
+
621
+ if ( $cache && $cached_status ) {
622
+ return true;
623
+ }
624
+
625
+ $sslverify = version_compare( $wp_version, 4.0, '<' );
626
+ $doing_wp_cron = sprintf( '%.22F', microtime( true ) );
627
+
628
+ $cron_request = apply_filters(
629
+ 'cron_request',
630
+ array(
631
+ 'url' => site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron ),
632
+ 'key' => $doing_wp_cron,
633
+ 'args' => array(
634
+ 'timeout' => 3,
635
+ 'blocking' => true,
636
+ 'sslverify' => apply_filters( 'https_local_ssl_verify', $sslverify ),
637
+ ),
638
+ )
639
+ );
640
+
641
+ $cron_request['args']['blocking'] = true;
642
+
643
+ $result = wp_remote_post( $cron_request['url'], $cron_request['args'] );
644
+
645
+ if ( is_wp_error( $result ) ) {
646
+ return $result;
647
+ } elseif ( wp_remote_retrieve_response_code( $result ) >= 300 ) {
648
+ return new WP_Error(
649
+ 'unexpected_http_response_code',
650
+ sprintf(
651
+ /* translators: 1: The HTTP response code. */
652
+ __( 'Unexpected HTTP response code: %s', 'astra-sites' ),
653
+ intval( wp_remote_retrieve_response_code( $result ) )
654
+ )
655
+ );
656
+ } else {
657
+ set_transient( 'astra-sites-cron-test-ok', 1, 3600 );
658
+ return true;
659
+ }
660
+
661
+ }
662
+ }
663
+
664
+ Astra_Sites_Page::get_instance();
665
+
666
+ }// End if.
astra-sites/inc/classes/class-astra-sites-white-label.php ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites White Label
4
+ *
5
+ * @package Astra Sites
6
+ * @since 1.0.12
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_White_Label' ) ) :
10
+
11
+ /**
12
+ * Astra_Sites_White_Label
13
+ *
14
+ * @since 1.0.12
15
+ */
16
+ class Astra_Sites_White_Label {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.0.12
22
+ *
23
+ * @var object Class Object.
24
+ * @access private
25
+ */
26
+ private static $instance;
27
+
28
+ /**
29
+ * Member Variable
30
+ *
31
+ * @since 1.0.12
32
+ *
33
+ * @var array branding
34
+ * @access private
35
+ */
36
+ private static $branding;
37
+
38
+ /**
39
+ * Settings
40
+ *
41
+ * @since 1.2.11
42
+ *
43
+ * @var array settings
44
+ *
45
+ * @access private
46
+ */
47
+ private $settings;
48
+
49
+ /**
50
+ * Initiator
51
+ *
52
+ * @since 1.0.12
53
+ *
54
+ * @return object initialized object of class.
55
+ */
56
+ public static function get_instance() {
57
+ if ( ! isset( self::$instance ) ) {
58
+ self::$instance = new self();
59
+ }
60
+ return self::$instance;
61
+ }
62
+
63
+ /**
64
+ * Constructor
65
+ *
66
+ * @since 1.0.12
67
+ */
68
+ public function __construct() {
69
+ add_filter( 'all_plugins', array( $this, 'plugins_page' ) );
70
+ add_filter( 'astra_addon_branding_options', __CLASS__ . '::settings' );
71
+ add_action( 'astra_pro_white_label_add_form', __CLASS__ . '::add_white_label_form' );
72
+ add_filter( 'astra_sites_menu_page_title', array( $this, 'get_white_label_name' ) );
73
+ add_filter( 'astra_sites_page_title', array( $this, 'get_white_label_name' ) );
74
+
75
+ // Display the link with the plugin meta.
76
+ if ( is_admin() ) {
77
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_links' ), 10, 4 );
78
+ }
79
+
80
+ add_filter( 'gutenberg_templates_localize_vars', array( $this, 'add_white_label_name' ) );
81
+ }
82
+ /**
83
+ * Add White Label data
84
+ *
85
+ * @param array $args White label.
86
+ * @since 2.6.0
87
+ */
88
+ public function add_white_label_name( $args = array() ) {
89
+ $args['white_label_name'] = $this->get_white_label();
90
+ return $args;
91
+ }
92
+
93
+ /**
94
+ * White labels the plugins page.
95
+ *
96
+ * @since 1.0.12
97
+ *
98
+ * @param array $plugins Plugins Array.
99
+ * @return array
100
+ */
101
+ public function plugins_page( $plugins ) {
102
+
103
+ if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
104
+ return $plugins;
105
+ }
106
+
107
+ if ( ! isset( $plugins[ ASTRA_SITES_BASE ] ) ) {
108
+ return $plugins;
109
+ }
110
+
111
+ // Set White Labels.
112
+ $name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
113
+ $description = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'description' );
114
+ $author = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'author' );
115
+ $author_uri = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'author_url' );
116
+
117
+ if ( ! empty( $name ) ) {
118
+ $plugins[ ASTRA_SITES_BASE ]['Name'] = $name;
119
+
120
+ // Remove Plugin URI if Agency White Label name is set.
121
+ $plugins[ ASTRA_SITES_BASE ]['PluginURI'] = '';
122
+ }
123
+
124
+ if ( ! empty( $description ) ) {
125
+ $plugins[ ASTRA_SITES_BASE ]['Description'] = $description;
126
+ }
127
+
128
+ if ( ! empty( $author ) ) {
129
+ $plugins[ ASTRA_SITES_BASE ]['Author'] = $author;
130
+ }
131
+
132
+ if ( ! empty( $author_uri ) ) {
133
+ $plugins[ ASTRA_SITES_BASE ]['AuthorURI'] = $author_uri;
134
+ }
135
+
136
+ return $plugins;
137
+ }
138
+
139
+ /**
140
+ * Get value of single key from option array.
141
+ *
142
+ * @since 2.0.0.
143
+ * @param string $type Option type.
144
+ * @param string $key Option key.
145
+ * @param string $default Default value if key not found.
146
+ * @return mixed Return stored option value.
147
+ */
148
+ public static function get_option( $type = '', $key = '', $default = null ) {
149
+
150
+ if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_white_label' ) ) {
151
+ return $default;
152
+ }
153
+
154
+ $value = Astra_Ext_White_Label_Markup::get_white_label( $type, $key );
155
+ if ( ! empty( $value ) ) {
156
+ return $value;
157
+ }
158
+
159
+ return $default;
160
+
161
+ }
162
+
163
+ /**
164
+ * Remove a "view details" link from the plugin list table
165
+ *
166
+ * @since 1.0.12
167
+ *
168
+ * @param array $plugin_meta List of links.
169
+ * @param string $plugin_file Relative path to the main plugin file from the plugins directory.
170
+ * @param array $plugin_data Data from the plugin headers.
171
+ * @return array
172
+ */
173
+ public function plugin_links( $plugin_meta, $plugin_file, $plugin_data ) {
174
+
175
+ if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
176
+ return $plugin_meta;
177
+ }
178
+
179
+ // Set White Labels.
180
+ if ( ASTRA_SITES_BASE === $plugin_file ) {
181
+
182
+ $name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
183
+ $description = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'description' );
184
+
185
+ // Remove Plugin URI if Agency White Label name is set.
186
+ if ( ! empty( $name ) ) {
187
+ unset( $plugin_meta[2] );
188
+ }
189
+ }
190
+
191
+ return $plugin_meta;
192
+ }
193
+
194
+ /**
195
+ * Add White Label setting's
196
+ *
197
+ * @since 1.0.12
198
+ *
199
+ * @param array $settings White label setting.
200
+ * @return array
201
+ */
202
+ public static function settings( $settings = array() ) {
203
+
204
+ $settings['astra-sites'] = array(
205
+ 'name' => '',
206
+ 'description' => '',
207
+ );
208
+
209
+ return $settings;
210
+ }
211
+
212
+ /**
213
+ * Add White Label form
214
+ *
215
+ * @since 1.0.12
216
+ *
217
+ * @param array $settings White label setting.
218
+ * @return void
219
+ */
220
+ public static function add_white_label_form( $settings = array() ) {
221
+
222
+ /* translators: %1$s product name */
223
+ $plugin_name = sprintf( __( '%1$s Branding', 'astra-sites' ), ASTRA_SITES_NAME );
224
+
225
+ require_once ASTRA_SITES_DIR . 'inc/includes/white-label.php';
226
+ }
227
+
228
+ /**
229
+ * Page Title
230
+ *
231
+ * @since 1.0.12
232
+ *
233
+ * @param string $title Page Title.
234
+ * @return string Filtered Page Title.
235
+ */
236
+ public function get_white_label_name( $title = '' ) {
237
+ if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
238
+ $astra_sites_name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
239
+ if ( ! empty( $astra_sites_name ) ) {
240
+ return Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
241
+ }
242
+ }
243
+
244
+ return ASTRA_SITES_NAME;
245
+ }
246
+
247
+ /**
248
+ * White Label Link
249
+ *
250
+ * @since 2.0.0
251
+ *
252
+ * @param string $link Default link.
253
+ * @return string Filtered Page Title.
254
+ */
255
+ public function get_white_label_link( $link = '' ) {
256
+ if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
257
+ $white_label_link = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'licence' );
258
+ if ( ! empty( $white_label_link ) ) {
259
+ return $white_label_link;
260
+ }
261
+ }
262
+
263
+ return $link;
264
+ }
265
+
266
+ /**
267
+ * Is Astra sites White labeled
268
+ *
269
+ * @since 1.2.13
270
+ *
271
+ * @return string
272
+ */
273
+ public function is_white_labeled() {
274
+ $white_label = $this->get_white_label();
275
+
276
+ if ( empty( $white_label ) ) {
277
+ return false;
278
+ }
279
+
280
+ return true;
281
+ }
282
+
283
+ /**
284
+ * Get white label name
285
+ *
286
+ * @since 2.6.0
287
+ *
288
+ * @return string
289
+ */
290
+ public function get_white_label() {
291
+ if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
292
+ return '';
293
+ }
294
+
295
+ $name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
296
+
297
+ if ( ! empty( $name ) ) {
298
+ return $name;
299
+ }
300
+
301
+ return '';
302
+ }
303
+
304
+ }
305
+
306
+ /**
307
+ * Kicking this off by calling 'get_instance()' method
308
+ */
309
+ Astra_Sites_White_Label::get_instance();
310
+
311
+ endif;
astra-sites/inc/classes/class-astra-sites-wp-cli.php ADDED
@@ -0,0 +1,773 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites WP CLI
4
+ *
5
+ * 1. Run `wp astra-sites list` List of all astra sites.
6
+ * 2. Run `wp astra-sites import <id>` Import site.
7
+ *
8
+ * @package Astra Sites
9
+ * @since 1.4.0
10
+ */
11
+
12
+ if ( class_exists( 'WP_CLI_Command' ) && ! class_exists( 'Astra_Sites_WP_CLI' ) ) :
13
+
14
+ /**
15
+ * WP-Cli commands to manage Astra Starter Sites.
16
+ *
17
+ * @since 1.4.0
18
+ */
19
+ class Astra_Sites_WP_CLI extends WP_CLI_Command {
20
+
21
+ /**
22
+ * Site Data
23
+ *
24
+ * @var array
25
+ */
26
+ protected $current_site_data;
27
+
28
+ /**
29
+ * Process Batch
30
+ *
31
+ * ## EXAMPLES
32
+ *
33
+ * $ wp astra-sites batch
34
+ * Processing Site: http://example.com/
35
+ * Batch Process Started..
36
+ * ..
37
+ *
38
+ * @since 2.1.0
39
+ * @param array $args Arguments.
40
+ * @param array $assoc_args Associated Arguments.
41
+ */
42
+ public function batch( $args, $assoc_args ) {
43
+
44
+ WP_CLI::line( 'Processing Site: ' . site_url() );
45
+
46
+ Astra_Sites_Batch_Processing::get_instance()->start_process();
47
+ }
48
+
49
+ /**
50
+ * Generates the list of all Astra Sites.
51
+ *
52
+ * ## OPTIONS
53
+ *
54
+ * [--per-page=<number>]
55
+ * : No of sites to show in the list. Default its showing 10 sites.
56
+ *
57
+ * [--search=<text>]
58
+ * : Show the sites from particular search term.
59
+ *
60
+ * [--category=<text>]
61
+ * : Show the site from the specific category.
62
+ *
63
+ * [--page-builder=<text>]
64
+ * : List the sites from the particular page builder.
65
+ *
66
+ * [--type=<text>]
67
+ * : List the sites from the particular site type.
68
+ *
69
+ * ## EXAMPLES
70
+ *
71
+ * # List all the sites.
72
+ * $ wp astra-sites list
73
+ * +-------+-------------------+-----------------------------------------+---------+----------------+--------------+
74
+ * | id | title | url | type | categories | page-builder |
75
+ * +-------+-------------------+-----------------------------------------+---------+----------------+--------------+
76
+ * | 34184 | Nutritionist | //websitedemos.net/nutritionist-01 | free | Business, Free | Elementor |
77
+ * | 34055 | Law Firm | //websitedemos.net/law-firm-03 | premium | Business | Elementor |
78
+ * +-------+-------------------+-----------------------------------------+---------+----------------+--------------+
79
+ *
80
+ * @since 1.4.0
81
+ * @param array $args Arguments.
82
+ * @param array $assoc_args Associated Arguments.
83
+ *
84
+ * @alias list
85
+ */
86
+ public function list_sites( $args, $assoc_args ) {
87
+
88
+ $per_page = isset( $assoc_args['per-page'] ) ? $assoc_args['per-page'] : 10;
89
+ $search = isset( $assoc_args['search'] ) ? $assoc_args['search'] : '';
90
+
91
+ $rest_args = array(
92
+ '_fields' => 'id,title,slug,astra-sites-site-category,astra-site-page-builder,astra-site-type,astra-site-url',
93
+ 'per_page' => $per_page,
94
+ );
95
+
96
+ if ( ! empty( $search ) ) {
97
+ $rest_args['search'] = $search;
98
+ }
99
+
100
+ $list = (array) $this->get_sites( 'astra-sites', $rest_args, true, $assoc_args );
101
+
102
+ // Modify the output.
103
+ foreach ( $list as $key => $item ) {
104
+ $list[ $key ]['categories'] = implode( ', ', $list[ $key ]['categories'] );
105
+ $list[ $key ]['page-builder'] = implode( ', ', $list[ $key ]['page_builders'] );
106
+ }
107
+
108
+ if ( ! empty( $list ) ) {
109
+ $display_fields = array(
110
+ 'id',
111
+ 'title',
112
+ 'url',
113
+ 'type',
114
+ 'categories',
115
+ 'page-builder',
116
+ );
117
+ $formatter = $this->get_formatter( $assoc_args, $display_fields );
118
+ $formatter->display_items( $list );
119
+ } else {
120
+ WP_CLI::error( __( 'No sites found! Try another query.', 'astra-sites' ) );
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Import the site by site ID.
126
+ *
127
+ * ## OPTIONS
128
+ *
129
+ * <id>
130
+ * : Site id of the import site.
131
+ *
132
+ * [--reset]
133
+ * : Reset the recently imported site data. Including post, pages, customizer settings, widgets etc.
134
+ *
135
+ * [--yes]
136
+ * : Forcefully import the site without asking any prompt message.
137
+ *
138
+ * ## EXAMPLES
139
+ *
140
+ * # Import demo site.
141
+ * $ wp astra-sites import 34184 --reset --yes
142
+ * Activating Plugins..
143
+ * Reseting Posts..
144
+ * ..
145
+ *
146
+ * @since 1.4.0
147
+ * @param array $args Arguments.
148
+ * @param array $assoc_args Associated Arguments.
149
+ */
150
+ public function import( $args, $assoc_args ) {
151
+
152
+ // Force import.
153
+ $yes = isset( $assoc_args['yes'] ) ? true : false;
154
+ if ( ! $yes ) {
155
+ WP_CLI::confirm( __( 'Are you sure you want to import the site?', 'astra-sites' ) );
156
+ }
157
+
158
+ // Valid site ID?
159
+ $id = isset( $args[0] ) ? absint( $args[0] ) : 0;
160
+ if ( ! $id ) {
161
+ WP_CLI::error( __( 'Invalid Site ID,', 'astra-sites' ) );
162
+ }
163
+
164
+ $reset = isset( $assoc_args['reset'] ) ? true : false;
165
+ $site_url = get_site_url();
166
+ $demo_data = $this->get_site_data( $id );
167
+
168
+ // Invalid Site ID.
169
+ if ( is_wp_error( $demo_data ) ) {
170
+ /* Translators: %s is the error message. */
171
+ WP_CLI::error( sprintf( __( 'Site Import failed due to error: %s', 'astra-sites' ), $demo_data->get_error_message() ) );
172
+ }
173
+
174
+ // License Status.
175
+ $license_status = false;
176
+ if ( is_callable( 'BSF_License_Manager::bsf_is_active_license' ) ) {
177
+ $license_status = BSF_License_Manager::bsf_is_active_license( 'astra-pro-sites' );
178
+ }
179
+
180
+ if ( 'free' !== $demo_data['site-type'] && 'upgrade' === $demo_data['license-status'] && ! $license_status ) {
181
+
182
+ if ( ! defined( 'ASTRA_PRO_SITES_NAME' ) ) {
183
+ WP_CLI::line( __( 'This is Premium site. Please activate the "Starter Templates" license!', 'astra-sites' ) );
184
+ WP_CLI::line( __( 'Use `wp plugin deactivate astra-sites` and then `wp plugin activate astra-pro-sites`', 'astra-sites' ) );
185
+ }
186
+
187
+ /* translators: %s is the activate plugin license link. */
188
+ WP_CLI::error( __( 'Use CLI command `wp brainstormforce license activate astra-pro-sites {YOUR_LICENSE_KEY}`', 'astra-sites' ) );
189
+ }
190
+
191
+ /**
192
+ * Install & Activate Required Plugins.
193
+ */
194
+ if ( isset( $demo_data['required-plugins'] ) ) {
195
+ $plugins = (array) $demo_data['required-plugins'];
196
+ if ( ! empty( $plugins ) ) {
197
+ $plugin_status = Astra_Sites::get_instance()->required_plugin( $plugins, $demo_data['astra-site-options-data'], $demo_data['astra-enabled-extensions'] );
198
+
199
+ // Install Plugins.
200
+ if ( ! empty( $plugin_status['required_plugins']['notinstalled'] ) ) {
201
+ WP_CLI::line( __( 'Installing Plugins..', 'astra-sites' ) );
202
+ foreach ( $plugin_status['required_plugins']['notinstalled'] as $key => $plugin ) {
203
+ if ( isset( $plugin['slug'] ) ) {
204
+
205
+ // Install plugin.
206
+ WP_CLI::runcommand( 'plugin install ' . $plugin['slug'] );
207
+
208
+ // Activate plugin.
209
+ Astra_Sites::get_instance()->required_plugin_activate( $plugin['init'], $demo_data['astra-site-options-data'], $demo_data['astra-enabled-extensions'] );
210
+ }
211
+ }
212
+ }
213
+
214
+ // Activate Plugins.
215
+ if ( ! empty( $plugin_status['required_plugins']['inactive'] ) ) {
216
+ WP_CLI::line( __( 'Activating Plugins..', 'astra-sites' ) );
217
+ foreach ( $plugin_status['required_plugins']['inactive'] as $key => $plugin ) {
218
+ if ( isset( $plugin['init'] ) ) {
219
+ Astra_Sites::get_instance()->required_plugin_activate( $plugin['init'], $demo_data['astra-site-options-data'], $demo_data['astra-enabled-extensions'] );
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
225
+
226
+ /**
227
+ * Backup Customizer Settings
228
+ */
229
+ Astra_Sites::get_instance()->backup_settings();
230
+
231
+ /**
232
+ * Reset Site Data
233
+ */
234
+ if ( $reset ) {
235
+ WP_CLI::runcommand( 'astra-sites reset --yes' );
236
+ }
237
+
238
+ /**
239
+ * Import Flows & Steps for CartFlows.
240
+ */
241
+ if ( isset( $demo_data['astra-site-cartflows-path'] ) && ! empty( $demo_data['astra-site-cartflows-path'] ) ) {
242
+ Astra_Sites_Importer::get_instance()->import_cartflows( $demo_data['astra-site-cartflows-path'] );
243
+ }
244
+
245
+ /**
246
+ * Import WP Forms.
247
+ */
248
+ if ( isset( $demo_data['astra-site-wpforms-path'] ) && ! empty( $demo_data['astra-site-wpforms-path'] ) ) {
249
+ Astra_Sites_Importer::get_instance()->import_wpforms( $demo_data['astra-site-wpforms-path'] );
250
+ }
251
+
252
+ /**
253
+ * Import Customizer Settings.
254
+ */
255
+ WP_CLI::runcommand( 'astra-sites import_customizer_settings ' . $id );
256
+
257
+ /**
258
+ * Import Content from XML/WXR.
259
+ */
260
+ if ( isset( $demo_data['astra-site-wxr-path'] ) && ! empty( $demo_data['astra-site-wxr-path'] ) ) {
261
+ WP_CLI::runcommand( 'astra-sites import_wxr ' . $demo_data['astra-site-wxr-path'] );
262
+ }
263
+
264
+ /**
265
+ * Import Site Options.
266
+ */
267
+ if ( isset( $demo_data['astra-site-options-data'] ) && ! empty( $demo_data['astra-site-options-data'] ) ) {
268
+ WP_CLI::line( __( 'Importing Site Options..', 'astra-sites' ) );
269
+ Astra_Sites_Importer::get_instance()->import_options( $demo_data['astra-site-options-data'] );
270
+ }
271
+
272
+ /**
273
+ * Import Widgets.
274
+ */
275
+ if ( isset( $demo_data['astra-site-widgets-data'] ) && ! empty( $demo_data['astra-site-widgets-data'] ) ) {
276
+ WP_CLI::line( __( 'Importing Widgets..', 'astra-sites' ) );
277
+ Astra_Sites_Importer::get_instance()->import_widgets( $demo_data['astra-site-widgets-data'] );
278
+ }
279
+
280
+ /**
281
+ * Import End.
282
+ */
283
+ WP_CLI::runcommand( 'astra-sites import_end' );
284
+
285
+ /* translators: %s is the site URL. */
286
+ WP_CLI::line( sprintf( __( "Site Imported Successfully!\nVisit: %s", 'astra-sites' ), $site_url ) );
287
+ }
288
+
289
+ /**
290
+ * Import End
291
+ *
292
+ * @since 1.4.3
293
+ * @return void
294
+ */
295
+ public function import_end() {
296
+ Astra_Sites_Importer::get_instance()->import_end();
297
+ }
298
+
299
+ /**
300
+ * Import form XML.
301
+ *
302
+ * ## OPTIONS
303
+ *
304
+ * <url>
305
+ * : XML/WXR file URL.
306
+ *
307
+ * ## EXAMPLES
308
+ *
309
+ * $ wp astra-sites import_wxr <url>
310
+ *
311
+ * @since 1.4.3
312
+ * @param array $args Arguments.
313
+ * @param array $assoc_args Associated Arguments.
314
+ * @return void.
315
+ */
316
+ public function import_wxr( $args = array(), $assoc_args = array() ) {
317
+
318
+ // Valid site ID?
319
+ $url = isset( $args[0] ) ? esc_url_raw( $args[0] ) : '';
320
+ if ( empty( $url ) ) {
321
+ WP_CLI::error( esc_html__( 'Invalid XML URL.', 'astra-sites' ) );
322
+ }
323
+
324
+ // Download XML file.
325
+ /* translators: %s is the XML file URL. */
326
+ WP_CLI::line( sprintf( esc_html__( 'Downloading %s', 'astra-sites' ), $url ) );
327
+ $xml_path = Astra_Sites_Helper::download_file( $url );
328
+
329
+ if ( $xml_path['success'] && isset( $xml_path['data']['file'] ) ) {
330
+ WP_CLI::line( esc_html__( 'Importing WXR..', 'astra-sites' ) );
331
+ Astra_WXR_Importer::instance()->sse_import( $xml_path['data']['file'] );
332
+ } else {
333
+ /* translators: %s is error message. */
334
+ WP_CLI::line( printf( esc_html__( 'WXR file Download Failed. Error %s', 'astra-sites' ), esc_html( $xml_path['data'] ) ) );
335
+ }
336
+ }
337
+
338
+ /**
339
+ * Reset
340
+ *
341
+ * Delete all pages, post, custom post type, customizer settings and site options.
342
+ *
343
+ * ## OPTIONS
344
+ *
345
+ * [--yes]
346
+ * : Reset previously imported site data without asking the prompt message.
347
+ *
348
+ * ## EXAMPLES
349
+ *
350
+ * $ wp astra-sites reset
351
+ *
352
+ * @since 1.4.0
353
+ * @param array $args Arguments.
354
+ * @param array $assoc_args Associated Arguments.
355
+ * @return void.
356
+ */
357
+ public function reset( $args = array(), $assoc_args = array() ) {
358
+
359
+ $yes = isset( $assoc_args['yes'] ) ? true : false;
360
+ if ( ! $yes ) {
361
+ WP_CLI::confirm( __( 'Are you sure you want to delete imported site data?', 'astra-sites' ) );
362
+ }
363
+
364
+ // Get tracked data.
365
+ $reset_data = Astra_Sites::get_instance()->get_reset_data();
366
+
367
+ // Delete tracked posts.
368
+ if ( isset( $reset_data['reset_posts'] ) && ! empty( $reset_data['reset_posts'] ) ) {
369
+ WP_CLI::line( __( 'Reseting Posts..', 'astra-sites' ) );
370
+ foreach ( $reset_data['reset_posts'] as $key => $post_id ) {
371
+ Astra_Sites_Importer::get_instance()->delete_imported_posts( $post_id );
372
+ }
373
+ }
374
+ // Delete tracked terms.
375
+ if ( isset( $reset_data['reset_terms'] ) && ! empty( $reset_data['reset_terms'] ) ) {
376
+ WP_CLI::line( __( 'Reseting Terms..', 'astra-sites' ) );
377
+ foreach ( $reset_data['reset_terms'] as $key => $post_id ) {
378
+ Astra_Sites_Importer::get_instance()->delete_imported_terms( $post_id );
379
+ }
380
+ }
381
+ // Delete tracked WP forms.
382
+ if ( isset( $reset_data['reset_wp_forms'] ) && ! empty( $reset_data['reset_wp_forms'] ) ) {
383
+ WP_CLI::line( __( 'Resting WP Forms...', 'astra-sites' ) );
384
+ foreach ( $reset_data['reset_wp_forms'] as $key => $post_id ) {
385
+ Astra_Sites_Importer::get_instance()->delete_imported_wp_forms( $post_id );
386
+ }
387
+ }
388
+
389
+ // Delete Customizer Data.
390
+ Astra_Sites_Importer::get_instance()->reset_customizer_data();
391
+
392
+ // Delete Site Options.
393
+ Astra_Sites_Importer::get_instance()->reset_site_options();
394
+
395
+ // Delete Widgets Data.
396
+ Astra_Sites_Importer::get_instance()->reset_widgets_data();
397
+ }
398
+
399
+ /**
400
+ * Import Customizer Settings
401
+ *
402
+ * ## OPTIONS
403
+ *
404
+ * <id>
405
+ * : Site ID.
406
+ *
407
+ * ## EXAMPLES
408
+ *
409
+ * $ wp astra-sites import_customizer_settings <id>
410
+ *
411
+ * @since 1.4.0
412
+ *
413
+ * @param array $args Arguments.
414
+ * @param array $assoc_args Associated Arguments.
415
+ * @return void
416
+ */
417
+ public function import_customizer_settings( $args, $assoc_args ) {
418
+
419
+ // Valid site ID?
420
+ $id = isset( $args[0] ) ? absint( $args[0] ) : 0;
421
+ if ( ! $id ) {
422
+ WP_CLI::error( __( 'Invalid Site ID,', 'astra-sites' ) );
423
+ }
424
+
425
+ $demo_data = $this->get_site_data( $id );
426
+
427
+ WP_CLI::line( __( 'Importing customizer settings..', 'astra-sites' ) );
428
+ Astra_Sites_Importer::get_instance()->import_customizer_settings( $demo_data['astra-site-customizer-data'] );
429
+ }
430
+
431
+ /**
432
+ * Page Builders
433
+ *
434
+ * ### OPTIONS
435
+ *
436
+ * [<list>]
437
+ * : List all page builders.
438
+ *
439
+ * OR
440
+ *
441
+ * [<set>]
442
+ * : Set the current page builder with given page builder slug.
443
+ *
444
+ * [<slug>]
445
+ * : Page builder slug.
446
+ *
447
+ * ### EXAMPLES
448
+ *
449
+ * # List all the page builders.
450
+ * λ wp astra-sites page_builder list
451
+ * +----------------+----------------+
452
+ * | slug | name |
453
+ * +----------------+----------------+
454
+ * | gutenberg | Gutenberg |
455
+ * | elementor | Elementor |
456
+ * | beaver-builder | Beaver Builder |
457
+ * | brizy | Brizy |
458
+ * +----------------+----------------+
459
+ *
460
+ * # Set `Elementor` as default page builder.
461
+ * λ wp astra-sites page_builder set elementor
462
+ * "Elementor" is set as default page builder.
463
+ *
464
+ * # Set `Beaver Builder` as default page builder.
465
+ * λ wp astra-sites page_builder set beaver-builder
466
+ * "Beaver Builder" is set as default page builder.
467
+ *
468
+ * @since 1.4.0
469
+ * @param array $args Arguments.
470
+ * @param array $assoc_args Associated Arguments.
471
+ */
472
+ public function page_builder( $args, $assoc_args ) {
473
+ $action = isset( $args[0] ) ? $args[0] : '';
474
+
475
+ if ( empty( $action ) ) {
476
+ WP_CLI::error( __( 'Please add valid parameter.', 'astra-sites' ) );
477
+ }
478
+
479
+ $page_builders = Astra_Sites_Page::get_instance()->get_page_builders();
480
+
481
+ if ( 'list' === $action ) {
482
+ $display_fields = array(
483
+ 'slug',
484
+ 'name',
485
+ );
486
+ $formatter = $this->get_formatter( $assoc_args, $display_fields );
487
+ $formatter->display_items( $page_builders );
488
+
489
+ $default_page_builder = isset( $page_builders[ Astra_Sites_Page::get_instance()->get_setting( 'page_builder' ) ] ) ? $page_builders[ Astra_Sites_Page::get_instance()->get_setting( 'page_builder' ) ]['name'] : '';
490
+
491
+ if ( ! empty( $default_page_builder ) ) {
492
+ /* translators: %s is the current page builder name. */
493
+ WP_CLI::line( sprintf( __( 'Default page builder is "%s".', 'astra-sites' ), $default_page_builder ) );
494
+ }
495
+ } elseif ( 'set' === $action ) {
496
+ $page_builder_slugs = array_keys( $page_builders );
497
+ $page_builder_slug = isset( $args[1] ) ? $args[1] : '';
498
+ if ( in_array( $page_builder_slug, $page_builder_slugs, true ) ) {
499
+ Astra_Sites_Page::get_instance()->save_page_builder_on_submit( $page_builder_slug );
500
+ /* translators: %s is the page builder name. */
501
+ WP_CLI::line( sprintf( __( '"%s" is set as default page builder.', 'astra-sites' ), $page_builders[ $page_builder_slug ]['name'] ) );
502
+
503
+ } else {
504
+ WP_CLI::error( __( "Invalid page builder slug. \nCheck all page builder slugs with command `wp astra-sites page_builder list`", 'astra-sites' ) );
505
+ }
506
+ } else {
507
+ WP_CLI::error( __( "Invalid parameter! \nPlease use `list` or `set` parameter.", 'astra-sites' ) );
508
+ }
509
+ }
510
+
511
+ /**
512
+ * Get Formatter
513
+ *
514
+ * @since 1.4.0
515
+ * @param array $assoc_args Associate arguments.
516
+ * @param string $fields Fields.
517
+ * @param string $prefix Prefix.
518
+ * @return object Class object.
519
+ */
520
+ protected function get_formatter( &$assoc_args, $fields = '', $prefix = '' ) {
521
+ return new \WP_CLI\Formatter( $assoc_args, $fields, $prefix );
522
+ }
523
+
524
+ /**
525
+ * Get Site Data by Site ID
526
+ *
527
+ * @since 1.4.0
528
+ *
529
+ * @param int $id Site ID.
530
+ * @return array
531
+ */
532
+ private function get_site_data( $id ) {
533
+ if ( empty( $this->current_site_data ) ) {
534
+ // @todo Use Astra_Sites::get_instance()->api_request() instead of below function.
535
+ $this->current_site_data = Astra_Sites_Importer::get_instance()->get_single_demo( $id );
536
+ update_option( 'astra_sites_import_data', $this->current_site_data, 'no' );
537
+ }
538
+
539
+ return $this->current_site_data;
540
+ }
541
+
542
+ /**
543
+ * Get Sites
544
+ *
545
+ * @since 1.4.0
546
+ *
547
+ * @param string $post_slug Post slug.
548
+ * @param array $args Post query arguments.
549
+ * @param boolean $force Force import.
550
+ * @param array $assoc_args Associate arguments.
551
+ * @return array
552
+ */
553
+ private function get_sites( $post_slug = '', $args = array(), $force = false, $assoc_args = array() ) {
554
+
555
+ // Add page builders.
556
+ $page_builder = isset( $assoc_args['page-builder'] ) ? $assoc_args['page-builder'] : Astra_Sites_Page::get_instance()->get_setting( 'page_builder' );
557
+ $response = $this->get_term_ids( 'astra-site-page-builder', $page_builder, $args );
558
+ $args = $response['args'];
559
+ $page_builders = $response['terms'];
560
+ if ( empty( $page_builders['data'] ) ) {
561
+ WP_CLI::error( __( 'This page builder plugin is not installed. Please try a different page builder.', 'astra-sites' ) );
562
+ }
563
+
564
+ // Add type.
565
+ $type = isset( $assoc_args['type'] ) ? $assoc_args['type'] : '';
566
+ $response = $this->get_term_ids( 'astra-sites-type', $type, $args );
567
+ $args = $response['args'];
568
+ $types = $response['terms'];
569
+ if ( empty( $types['data'] ) ) {
570
+ WP_CLI::error( __( 'This site type does not exist. Please try a different site type.', 'astra-sites' ) );
571
+ }
572
+
573
+ // Add categories.
574
+ $category = isset( $assoc_args['category'] ) ? $assoc_args['category'] : '';
575
+ $response = $this->get_term_ids( 'astra-sites-site-category', $category, $args );
576
+ $args = $response['args'];
577
+ $categories = $response['terms'];
578
+ if ( empty( $categories['data'] ) ) {
579
+ WP_CLI::error( __( 'This site category does not exist. Please try a different site category.', 'astra-sites' ) );
580
+ }
581
+
582
+ // Site list.
583
+ $sites = (array) $this->get_posts( 'astra-sites', $args, $force );
584
+
585
+ $list = array();
586
+ if ( $sites['success'] ) {
587
+ foreach ( $sites['data'] as $key => $site ) {
588
+ $single_site = array(
589
+ 'id' => $site['id'],
590
+ 'slug' => $site['slug'],
591
+ 'title' => $site['title']['rendered'],
592
+ 'url' => $site['astra-site-url'],
593
+ 'type' => ( 'premium' === $site['astra-site-type'] ) ? 'Premium' : ucwords( $site['astra-site-type'] ),
594
+ 'categories' => array(),
595
+ 'page_builders' => array(),
596
+ );
597
+
598
+ if ( isset( $site['astra-sites-site-category'] ) && ! empty( $categories['data'] ) ) {
599
+ foreach ( $site['astra-sites-site-category'] as $category_key => $category_id ) {
600
+ if ( isset( $categories['data'][ $category_id ] ) ) {
601
+ $single_site['categories'][ $category_id ] = $categories['data'][ $category_id ];
602
+ }
603
+ }
604
+ }
605
+
606
+ if ( isset( $site['astra-site-page-builder'] ) && ! empty( $page_builders['data'] ) ) {
607
+ foreach ( $site['astra-site-page-builder'] as $page_builder_key => $page_builder_id ) {
608
+ if ( isset( $page_builders['data'][ $page_builder_id ] ) ) {
609
+ $single_site['page_builders'][ $page_builder_id ] = $page_builders['data'][ $page_builder_id ];
610
+ }
611
+ }
612
+ }
613
+
614
+ $list[] = $single_site;
615
+ }
616
+ }
617
+
618
+ return $list;
619
+ }
620
+
621
+
622
+ /**
623
+ * Get Term IDs
624
+ *
625
+ * @since 1.4.0
626
+ *
627
+ * @param string $term_slug Term slug.
628
+ * @param string $search_term Search term.
629
+ * @param array $args Term query arguments.
630
+ * @return array Term response.
631
+ */
632
+ private function get_term_ids( $term_slug = '', $search_term = '', $args = array() ) {
633
+ $term_args = array();
634
+
635
+ if ( ! empty( $search_term ) ) {
636
+ $term_args = array(
637
+ 'search' => $search_term,
638
+ );
639
+ }
640
+
641
+ $term_response = (array) $this->get_terms( $term_slug, $term_args, true );
642
+
643
+ if ( ! empty( $search_term ) ) {
644
+ if ( ! empty( $term_response ) && is_array( $term_response['data'] ) ) {
645
+ $args[ $term_slug ] = implode( ',', array_keys( $term_response['data'] ) );
646
+ }
647
+ }
648
+
649
+ return array(
650
+ 'args' => $args,
651
+ 'terms' => $term_response,
652
+ );
653
+ }
654
+
655
+ /**
656
+ * Get Terms
657
+ *
658
+ * @since 1.0.0
659
+ *
660
+ * @param array $term_slug Term Slug.
661
+ * @param array $args For selecting the demos (Search terms, pagination etc).
662
+ * @param string $force Force import.
663
+ * @return $array Term response.
664
+ */
665
+ private function get_terms( $term_slug = '', $args = array(), $force = false ) {
666
+
667
+ $defaults = array(
668
+ '_fields' => 'id,name,slug,count',
669
+ );
670
+ $args = wp_parse_args( (array) $args, $defaults );
671
+
672
+ $success = false;
673
+ $terms_data = get_transient( 'astra-sites-term-' . $term_slug );
674
+ if ( empty( $terms_data ) || $force ) {
675
+ $url = add_query_arg( $args, Astra_Sites::get_instance()->get_api_url() . $term_slug );
676
+
677
+ $api_args = array(
678
+ 'timeout' => 60,
679
+ );
680
+
681
+ $response = wp_remote_get( $url, $api_args );
682
+ if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
683
+ $request_term_data = json_decode( wp_remote_retrieve_body( $response ), true );
684
+
685
+ if ( ! isset( $request_term_data['code'] ) ) {
686
+ $success = true;
687
+ $new_terms_data = array();
688
+ foreach ( $request_term_data as $key => $request_term ) {
689
+ $new_terms_data[ $request_term['id'] ] = $request_term['name'];
690
+ }
691
+ if ( set_transient( 'astra-sites-term-' . $term_slug, $new_terms_data, WEEK_IN_SECONDS ) ) {
692
+ return array(
693
+ 'success' => $success,
694
+ 'data' => $new_terms_data,
695
+ );
696
+ }
697
+ }
698
+ }
699
+ }
700
+
701
+ return array(
702
+ 'success' => $success,
703
+ 'data' => $terms_data,
704
+ );
705
+ }
706
+
707
+ /**
708
+ * Get Posts
709
+ *
710
+ * @since 1.4.0
711
+ *
712
+ * @param string $post_slug Post slug.
713
+ * @param array $args Post query arguments.
714
+ * @param boolean $force Force import.
715
+ * @return array
716
+ */
717
+ private function get_posts( $post_slug = '', $args = array(), $force = false ) {
718
+
719
+ $args = wp_parse_args( (array) $args, array() );
720
+
721
+ $all_posts = get_transient( 'astra-sites-post-' . $post_slug );
722
+
723
+ if ( empty( $all_posts ) || $force ) {
724
+ $url = add_query_arg( $args, Astra_Sites::get_instance()->get_api_url() . $post_slug );
725
+
726
+ $api_args = array(
727
+ 'timeout' => 60,
728
+ );
729
+
730
+ $success = false;
731
+ $response = wp_remote_get( $url, $api_args );
732
+ if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
733
+ $all_posts = json_decode( wp_remote_retrieve_body( $response ), true );
734
+
735
+ if ( ! isset( $all_posts['code'] ) ) {
736
+ $success = true;
737
+ set_transient( 'astra-sites-post-' . $post_slug, $all_posts, WEEK_IN_SECONDS );
738
+ }
739
+ }
740
+ } else {
741
+ $success = true;
742
+ }
743
+
744
+ return array(
745
+ 'success' => $success,
746
+ 'data' => $all_posts,
747
+ );
748
+ }
749
+
750
+ /**
751
+ * Sync Library.
752
+ *
753
+ * Sync the library and create the .json files.
754
+ *
755
+ * Use: `wp astra-sites sync`
756
+ *
757
+ * @since 2.0.0
758
+ * @param array $args Arguments.
759
+ * @param array $assoc_args Associated Arguments.
760
+ * @return void.
761
+ */
762
+ public function sync( $args = array(), $assoc_args = array() ) {
763
+ Astra_Sites_Batch_Processing::get_instance()->process_batch();
764
+ }
765
+ }
766
+
767
+ /**
768
+ * Add Command
769
+ */
770
+ WP_CLI::add_command( 'starter-templates', 'Astra_Sites_WP_CLI' );
771
+ WP_CLI::add_command( 'astra-sites', 'Astra_Sites_WP_CLI' );
772
+
773
+ endif;
astra-sites/inc/classes/class-astra-sites.php ADDED
@@ -0,0 +1,2248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Sites
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ use Elementor\Core\Schemes;
14
+
15
+ if ( ! class_exists( 'Astra_Sites' ) ) :
16
+
17
+ /**
18
+ * Astra_Sites
19
+ */
20
+ class Astra_Sites {
21
+
22
+ /**
23
+ * API Domain name
24
+ *
25
+ * @var (String) URL
26
+ */
27
+ public $api_domain;
28
+
29
+ /**
30
+ * API URL which is used to get the response from.
31
+ *
32
+ * @since 1.0.0
33
+ * @var (String) URL
34
+ */
35
+ public $api_url;
36
+
37
+ /**
38
+ * Search API URL which is used to get the response from.
39
+ *
40
+ * @since 2.0.0
41
+ * @var (String) URL
42
+ */
43
+ public $search_url;
44
+
45
+ /**
46
+ * API URL which is used to get the response from Pixabay.
47
+ *
48
+ * @since 2.0.0
49
+ * @var (String) URL
50
+ */
51
+ public $pixabay_url;
52
+
53
+ /**
54
+ * API Key which is used to get the response from Pixabay.
55
+ *
56
+ * @since 2.0.0
57
+ * @var (String) URL
58
+ */
59
+ public $pixabay_api_key;
60
+
61
+ /**
62
+ * Instance of Astra_Sites
63
+ *
64
+ * @since 1.0.0
65
+ * @var (Object) Astra_Sites
66
+ */
67
+ private static $instance = null;
68
+
69
+ /**
70
+ * Localization variable
71
+ *
72
+ * @since 2.0.0
73
+ * @var (Array) $local_vars
74
+ */
75
+ public static $local_vars = array();
76
+
77
+ /**
78
+ * Localization variable
79
+ *
80
+ * @since 2.0.0
81
+ * @var (Array) $wp_upload_url
82
+ */
83
+ public $wp_upload_url = '';
84
+
85
+ /**
86
+ * Ajax
87
+ *
88
+ * @since 2.6.20
89
+ * @var (Array) $ajax
90
+ */
91
+ private $ajax = array();
92
+
93
+ /**
94
+ * Instance of Astra_Sites.
95
+ *
96
+ * @since 1.0.0
97
+ *
98
+ * @return object Class object.
99
+ */
100
+ public static function get_instance() {
101
+ if ( ! isset( self::$instance ) ) {
102
+ self::$instance = new self();
103
+ }
104
+
105
+ return self::$instance;
106
+ }
107
+
108
+ /**
109
+ * Constructor.
110
+ *
111
+ * @since 1.0.0
112
+ */
113
+ private function __construct() {
114
+
115
+ $this->set_api_url();
116
+
117
+ $this->includes();
118
+
119
+ add_action( 'plugin_action_links_' . ASTRA_SITES_BASE, array( $this, 'action_links' ) );
120
+ add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
121
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue' ), 99 );
122
+ add_action( 'wp_enqueue_scripts', array( $this, 'image_search_scripts' ) );
123
+ add_action( 'elementor/editor/footer', array( $this, 'insert_templates' ) );
124
+ add_action( 'admin_footer', array( $this, 'insert_image_templates' ) );
125
+ add_action( 'customize_controls_print_footer_scripts', array( $this, 'insert_image_templates' ) );
126
+ add_action( 'wp_footer', array( $this, 'insert_image_templates_bb_and_brizy' ) );
127
+ add_action( 'elementor/editor/footer', array( $this, 'register_widget_scripts' ), 99 );
128
+ add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'popup_styles' ) );
129
+ add_action( 'elementor/preview/enqueue_styles', array( $this, 'popup_styles' ) );
130
+
131
+ // AJAX.
132
+ $this->ajax = array(
133
+ 'astra-required-plugins' => 'required_plugin',
134
+ 'astra-required-plugin-activate' => 'required_plugin_activate',
135
+ 'astra-sites-backup-settings' => 'backup_settings',
136
+ 'astra-sites-set-reset-data' => 'get_reset_data',
137
+ 'astra-sites-activate-theme' => 'activate_theme',
138
+ 'astra-sites-create-page' => 'create_page',
139
+ 'astra-sites-import-media' => 'import_media',
140
+ 'astra-sites-create-template' => 'create_template',
141
+ 'astra-sites-create-image' => 'create_image',
142
+ 'astra-sites-search-images' => 'search_images',
143
+ 'astra-sites-getting-started-notice' => 'getting_started_notice',
144
+ 'astra-sites-favorite' => 'add_to_favorite',
145
+ 'astra-sites-api-request' => 'api_request',
146
+ 'astra-sites-remote-request' => 'remote_request',
147
+ 'astra-page-elementor-batch-process' => 'elementor_batch_process',
148
+ 'astra-sites-update-subscription' => 'update_subscription',
149
+ );
150
+
151
+ foreach ( $this->ajax as $ajax_hook => $ajax_callback ) {
152
+ add_action( 'wp_ajax_' . $ajax_hook, array( $this, $ajax_callback ) );
153
+ }
154
+
155
+ add_action( 'delete_attachment', array( $this, 'delete_astra_images' ) );
156
+ add_filter( 'heartbeat_received', array( $this, 'search_push' ), 10, 2 );
157
+ add_filter( 'status_header', array( $this, 'status_header' ), 10, 4 );
158
+ add_filter( 'wp_php_error_message', array( $this, 'php_error_message' ), 10, 2 );
159
+ }
160
+
161
+ /**
162
+ * Check is Starter Templates AJAX request.
163
+ *
164
+ * @since 2.7.0
165
+ * @return boolean
166
+ */
167
+ public function is_starter_templates_request() {
168
+
169
+ if ( isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], array_keys( $this->ajax ), true ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
170
+ return true;
171
+ }
172
+
173
+ return false;
174
+ }
175
+
176
+ /**
177
+ * Filters the message that the default PHP error template displays.
178
+ *
179
+ * @since 2.7.0
180
+ *
181
+ * @param string $message HTML error message to display.
182
+ * @param array $error Error information retrieved from `error_get_last()`.
183
+ * @return mixed
184
+ */
185
+ public function php_error_message( $message, $error ) {
186
+
187
+ if ( ! $this->is_starter_templates_request() ) {
188
+ return $message;
189
+ }
190
+
191
+ if ( empty( $error ) ) {
192
+ return $message;
193
+ }
194
+
195
+ $message = isset( $error['message'] ) ? $error['message'] : $message;
196
+
197
+ return $message;
198
+ }
199
+
200
+ /**
201
+ * Filters an HTTP status header.
202
+ *
203
+ * @since 2.6.20
204
+ *
205
+ * @param string $status_header HTTP status header.
206
+ * @param int $code HTTP status code.
207
+ * @param string $description Description for the status code.
208
+ * @param string $protocol Server protocol.
209
+ *
210
+ * @return mixed
211
+ */
212
+ public function status_header( $status_header, $code, $description, $protocol ) {
213
+
214
+ if ( ! $this->is_starter_templates_request() ) {
215
+ return $status_header;
216
+ }
217
+
218
+ $error = error_get_last();
219
+ if ( empty( $error ) ) {
220
+ return $status_header;
221
+ }
222
+
223
+ $message = isset( $error['message'] ) ? $error['message'] : $description;
224
+
225
+ return "$protocol $code $message";
226
+ }
227
+
228
+ /**
229
+ * Update Subscription
230
+ */
231
+ public function update_subscription() {
232
+
233
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
234
+
235
+ if ( ! current_user_can( 'manage_options' ) ) {
236
+ wp_send_json_error( 'You can\'t access this action.' );
237
+ }
238
+
239
+ $arguments = isset( $_POST['data'] ) ? array_map( 'sanitize_text_field', json_decode( stripslashes( $_POST['data'] ), true ) ) : array();
240
+
241
+ // Page Builder mapping.
242
+ $page_builder_mapping = array(
243
+ 'Elementor' => 1,
244
+ 'Beaver Builder' => 2,
245
+ 'Brizy' => 3,
246
+ 'Gutenberg' => 4,
247
+ );
248
+ $arguments['PAGE_BUILDER'] = isset( $page_builder_mapping[ $arguments['PAGE_BUILDER'] ] ) ? $page_builder_mapping[ $arguments['PAGE_BUILDER'] ] : '';
249
+
250
+ $url = apply_filters( 'astra_sites_subscription_url', $this->api_domain . 'wp-json/starter-templates/v1/subscribe/' );
251
+
252
+ $args = array(
253
+ 'timeout' => 30,
254
+ 'body' => $arguments,
255
+ );
256
+
257
+ $response = wp_remote_post( $url, $args );
258
+
259
+ if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
260
+ $response = json_decode( wp_remote_retrieve_body( $response ), true );
261
+
262
+ // Successfully subscribed.
263
+ if ( isset( $response['success'] ) && $response['success'] ) {
264
+ update_user_meta( get_current_user_ID(), 'astra-sites-subscribed', 'yes' );
265
+ }
266
+ }
267
+ wp_send_json_success( $response );
268
+
269
+ }
270
+
271
+ /**
272
+ * Push Data to Search API.
273
+ *
274
+ * @since 2.0.0
275
+ * @param Object $response Response data object.
276
+ * @param Object $data Data object.
277
+ *
278
+ * @return array Search response.
279
+ */
280
+ public function search_push( $response, $data ) {
281
+
282
+ // If we didn't receive our data, don't send any back.
283
+ if ( empty( $data['ast-sites-search-terms'] ) ) {
284
+ return $response;
285
+ }
286
+
287
+ $args = array(
288
+ 'timeout' => 3,
289
+ 'blocking' => true,
290
+ 'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
291
+ 'body' => array(
292
+ 'search' => $data['ast-sites-search-terms'],
293
+ 'builder' => isset( $data['ast-sites-builder'] ) ? $data['ast-sites-builder'] : 'gutenberg',
294
+ 'url' => esc_url( site_url() ),
295
+ 'type' => 'astra-sites',
296
+ ),
297
+ );
298
+ $result = wp_remote_post( $this->search_url, $args );
299
+ $response['ast-sites-search-terms'] = wp_remote_retrieve_body( $result );
300
+
301
+ return $response;
302
+ }
303
+
304
+ /**
305
+ * Before Astra Image delete, remove from options.
306
+ *
307
+ * @since 2.0.0
308
+ * @param int $id ID to deleting image.
309
+ * @return void
310
+ */
311
+ public function delete_astra_images( $id ) {
312
+
313
+ if ( ! $id ) {
314
+ return;
315
+ }
316
+
317
+ // @codingStandardsIgnoreStart
318
+ $saved_images = get_option( 'astra-sites-saved-images', array() );
319
+ $astra_image_flag = get_post_meta( $id, 'astra-images', true );
320
+ $astra_image_flag = (int) $astra_image_flag;
321
+ if (
322
+ '' !== $astra_image_flag &&
323
+ is_array( $saved_images ) &&
324
+ ! empty( $saved_images ) &&
325
+ in_array( $astra_image_flag, $saved_images )
326
+ ) {
327
+ $flag_arr = array( $astra_image_flag );
328
+ $saved_images = array_diff( $saved_images, $flag_arr );
329
+ update_option( 'astra-sites-saved-images', $saved_images, 'no' );
330
+ }
331
+ // @codingStandardsIgnoreEnd
332
+ }
333
+
334
+ /**
335
+ * Enqueue Image Search scripts into Beaver Builder Editor.
336
+ *
337
+ * @since 2.0.0
338
+ * @return void
339
+ */
340
+ public function image_search_scripts() {
341
+
342
+ if (
343
+ class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_active() // BB Builder is on?
344
+ ||
345
+ (
346
+ class_exists( 'Brizy_Editor_Post' ) && // Brizy Builder is on?
347
+ ( isset( $_GET['brizy-edit'] ) || isset( $_GET['brizy-edit-iframe'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
348
+ )
349
+ ||
350
+ is_customize_preview() // Is customizer on?
351
+ ) {
352
+ // Image Search assets.
353
+ $this->image_search_assets();
354
+ }
355
+ }
356
+
357
+ /**
358
+ * Elementor Batch Process via AJAX
359
+ *
360
+ * @since 2.0.0
361
+ */
362
+ public function elementor_batch_process() {
363
+
364
+ // Verify Nonce.
365
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
366
+
367
+ if ( ! current_user_can( 'edit_posts' ) ) {
368
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
369
+ }
370
+
371
+ $api_url = isset( $_POST['url'] ) ? esc_url_raw( $_POST['url'] ) : '';
372
+
373
+ if ( ! astra_sites_is_valid_url( $api_url ) ) {
374
+ wp_send_json_error( __( 'Invalid API URL.', 'astra-sites' ) );
375
+ }
376
+
377
+ $response = wp_remote_get( $api_url );
378
+
379
+ if ( is_wp_error( $response ) ) {
380
+ wp_send_json_error( wp_remote_retrieve_body( $response ) );
381
+ }
382
+
383
+ $body = wp_remote_retrieve_body( $response );
384
+ $data = json_decode( $body, true );
385
+ if ( ! isset( $data['post-meta']['_elementor_data'] ) ) {
386
+ wp_send_json_error( __( 'Invalid Post Meta', 'astra-sites' ) );
387
+ }
388
+
389
+ $meta = json_decode( $data['post-meta']['_elementor_data'], true );
390
+ $post_id = isset( $_POST['id'] ) ? absint( $_POST['id'] ) : '';
391
+
392
+ if ( empty( $post_id ) || empty( $meta ) ) {
393
+ wp_send_json_error( __( 'Invalid Post ID or Elementor Meta', 'astra-sites' ) );
394
+ }
395
+
396
+ if ( isset( $data['astra-page-options-data'] ) && isset( $data['astra-page-options-data']['elementor_load_fa4_shim'] ) ) {
397
+ update_option( 'elementor_load_fa4_shim', $data['astra-page-options-data']['elementor_load_fa4_shim'] );
398
+ }
399
+
400
+ $import = new \Elementor\TemplateLibrary\Astra_Sites_Elementor_Pages();
401
+ $import_data = $import->import( $post_id, $meta );
402
+
403
+ wp_send_json_success( $import_data );
404
+ }
405
+
406
+ /**
407
+ * Elementor Templates Request
408
+ *
409
+ * @since 2.7.3
410
+ */
411
+ public function remote_request() {
412
+
413
+ // Verify Nonce.
414
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
415
+
416
+ if ( ! current_user_can( 'edit_posts' ) ) {
417
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
418
+ }
419
+
420
+ $api_url = isset( $_POST['url'] ) ? sanitize_text_field( $_POST['url'] ) : '';
421
+
422
+ $api_url = add_query_arg( astra_sites_get_api_params(), $api_url );
423
+
424
+ $response = wp_remote_get( $api_url );
425
+
426
+ if ( is_wp_error( $response ) ) {
427
+ wp_send_json_error( wp_remote_retrieve_body( $response ) );
428
+ }
429
+
430
+ $body = wp_remote_retrieve_body( $response );
431
+ $data = json_decode( $body, true );
432
+
433
+ wp_send_json_success( $data );
434
+ }
435
+
436
+ /**
437
+ * API Request
438
+ *
439
+ * @since 2.0.0
440
+ */
441
+ public function api_request() {
442
+
443
+ // Verify Nonce.
444
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
445
+
446
+ $url = isset( $_POST['url'] ) ? sanitize_text_field( $_POST['url'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
447
+
448
+ if ( empty( $url ) ) {
449
+ wp_send_json_error(
450
+ array(
451
+ 'message' => __( 'Provided API URL is empty! Please try again!', 'astra-sites' ),
452
+ 'code' => 'Error',
453
+ )
454
+ );
455
+ }
456
+
457
+ $api_args = apply_filters(
458
+ 'astra_sites_api_params', array(
459
+ 'template_status' => '',
460
+ )
461
+ );
462
+
463
+ $api_url = add_query_arg( $api_args, trailingslashit( self::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/' . $url );
464
+
465
+ if ( ! astra_sites_is_valid_url( $api_url ) ) {
466
+ wp_send_json_error(
467
+ array(
468
+ 'message' => __( 'Invalid Request URL.', 'astra-sites' ),
469
+ 'code' => 'Error',
470
+ )
471
+ );
472
+ }
473
+
474
+ $api_args = apply_filters(
475
+ 'astra_sites_api_args', array(
476
+ 'timeout' => 30,
477
+ )
478
+ );
479
+
480
+ $request = wp_remote_get( $api_url, $api_args );
481
+
482
+ if ( is_wp_error( $request ) ) {
483
+ $wp_error_code = $request->get_error_code();
484
+ switch ( $wp_error_code ) {
485
+ case 'http_request_not_executed':
486
+ /* translators: %s Error Message */
487
+ $message = sprintf( __( 'API Request could not be performed - %s', 'astra-sites' ), $request->get_error_message() );
488
+ break;
489
+ case 'http_request_failed':
490
+ default:
491
+ /* translators: %s Error Message */
492
+ $message = sprintf( __( 'API Request has failed - %s', 'astra-sites' ), $request->get_error_message() );
493
+ break;
494
+ }
495
+
496
+ wp_send_json_error(
497
+ array(
498
+ 'message' => $request->get_error_message(),
499
+ 'code' => 'WP_Error',
500
+ 'response_code' => $wp_error_code,
501
+ )
502
+ );
503
+ }
504
+
505
+ $code = (int) wp_remote_retrieve_response_code( $request );
506
+ $demo_data = json_decode( wp_remote_retrieve_body( $request ), true );
507
+
508
+ if ( 200 === $code ) {
509
+ update_option( 'astra_sites_import_data', $demo_data, 'no' );
510
+ wp_send_json_success( $demo_data );
511
+ }
512
+
513
+ $message = wp_remote_retrieve_body( $request );
514
+ $response_code = $code;
515
+
516
+ if ( 200 !== $code && is_array( $demo_data ) && isset( $demo_data['code'] ) ) {
517
+ $message = $demo_data['message'];
518
+ }
519
+
520
+ if ( 500 === $code ) {
521
+ $message = __( 'Internal Server Error.', 'astra-sites' );
522
+ }
523
+
524
+ if ( 200 !== $code && false !== strpos( $message, 'Cloudflare' ) ) {
525
+ $ip = Astra_Sites_Helper::get_client_ip();
526
+ /* translators: %s IP address. */
527
+ $message = sprintf( __( 'Client IP: %1$s </br> Error code: %2$s', 'astra-sites' ), $ip, $code );
528
+ $code = 'Cloudflare';
529
+ }
530
+
531
+ wp_send_json_error(
532
+ array(
533
+ 'message' => $message,
534
+ 'code' => $code,
535
+ 'response_code' => $response_code,
536
+ )
537
+ );
538
+ }
539
+
540
+ /**
541
+ * Insert Template
542
+ *
543
+ * @return void
544
+ */
545
+ public function insert_image_templates() {
546
+ ob_start();
547
+ require_once ASTRA_SITES_DIR . 'inc/includes/image-templates.php';
548
+ ob_end_flush();
549
+ }
550
+
551
+ /**
552
+ * Insert Template
553
+ *
554
+ * @return void
555
+ */
556
+ public function insert_image_templates_bb_and_brizy() {
557
+
558
+ if (
559
+ class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_active() // BB Builder is on?
560
+ ||
561
+ (
562
+ class_exists( 'Brizy_Editor_Post' ) && // Brizy Builder is on?
563
+ ( isset( $_GET['brizy-edit'] ) || isset( $_GET['brizy-edit-iframe'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
564
+ )
565
+ ) {
566
+ // Image Search Templates.
567
+ ob_start();
568
+ require_once ASTRA_SITES_DIR . 'inc/includes/image-templates.php';
569
+ ob_end_flush();
570
+ }
571
+ }
572
+
573
+ /**
574
+ * Insert Template
575
+ *
576
+ * @return void
577
+ */
578
+ public function insert_templates() {
579
+ ob_start();
580
+ require_once ASTRA_SITES_DIR . 'inc/includes/templates.php';
581
+ require_once ASTRA_SITES_DIR . 'inc/includes/image-templates.php';
582
+ ob_end_flush();
583
+ }
584
+
585
+ /**
586
+ * Add/Remove Favorite.
587
+ *
588
+ * @since 2.0.0
589
+ */
590
+ public function add_to_favorite() {
591
+
592
+ if ( ! current_user_can( 'manage_options' ) ) {
593
+ wp_send_json_error( 'You can\'t access this action.' );
594
+ }
595
+
596
+ $new_favorites = array();
597
+ $site_id = isset( $_POST['site_id'] ) ? sanitize_key( $_POST['site_id'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
598
+
599
+ if ( empty( $site_id ) ) {
600
+ wp_send_json_error();
601
+ }
602
+
603
+ $favorite_settings = get_option( 'astra-sites-favorites', array() );
604
+
605
+ if ( false !== $favorite_settings && is_array( $favorite_settings ) ) {
606
+ $new_favorites = $favorite_settings;
607
+ }
608
+
609
+ if ( 'false' === $_POST['is_favorite'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
610
+ if ( in_array( $site_id, $new_favorites, true ) ) {
611
+ $key = array_search( $site_id, $new_favorites, true );
612
+ unset( $new_favorites[ $key ] );
613
+ }
614
+ } else {
615
+ if ( ! in_array( $site_id, $new_favorites, true ) ) {
616
+ array_push( $new_favorites, $site_id );
617
+ }
618
+ }
619
+
620
+ update_option( 'astra-sites-favorites', $new_favorites, 'no' );
621
+
622
+ wp_send_json_success(
623
+ array(
624
+ 'all_favorites' => $new_favorites,
625
+ )
626
+ );
627
+ }
628
+
629
+ /**
630
+ * Import Template.
631
+ *
632
+ * @since 2.0.0
633
+ */
634
+ public function create_template() {
635
+
636
+ // Verify Nonce.
637
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
638
+
639
+ if ( ! current_user_can( 'customize' ) ) {
640
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
641
+ }
642
+
643
+ $content = isset( $_POST['data']['content']['rendered'] ) ? $_POST['data']['content']['rendered'] : '';
644
+
645
+ $data = isset( $_POST['data'] ) ? $_POST['data'] : array();
646
+
647
+ if ( empty( $data ) ) {
648
+ wp_send_json_error( 'Empty page data.' );
649
+ }
650
+
651
+ $page_id = isset( $_POST['data']['id'] ) ? $_POST['data']['id'] : '';
652
+
653
+ $title = '';
654
+ if ( isset( $_POST['data']['title']['rendered'] ) ) {
655
+ if ( '' !== $_POST['title'] ) {
656
+ $title = $_POST['title'] . ' - ' . $_POST['data']['title']['rendered'];
657
+ } else {
658
+ $title = $_POST['data']['title']['rendered'];
659
+ }
660
+ }
661
+
662
+ $excerpt = isset( $_POST['data']['excerpt']['rendered'] ) ? $_POST['data']['excerpt']['rendered'] : '';
663
+
664
+ $post_args = array(
665
+ 'post_type' => 'elementor_library',
666
+ 'post_status' => 'publish',
667
+ 'post_title' => $title,
668
+ 'post_content' => $content,
669
+ 'post_excerpt' => $excerpt,
670
+ );
671
+
672
+ $new_page_id = wp_insert_post( $post_args );
673
+ update_post_meta( $new_page_id, '_astra_sites_enable_for_batch', true );
674
+ $post_meta = isset( $_POST['data']['post-meta'] ) ? $_POST['data']['post-meta'] : array();
675
+
676
+ if ( ! empty( $post_meta ) ) {
677
+ $this->import_template_meta( $new_page_id, $post_meta );
678
+ }
679
+
680
+ if ( 'pages' === $_POST['type'] ) {
681
+ update_post_meta( $new_page_id, '_elementor_template_type', 'page' );
682
+ wp_set_object_terms( $new_page_id, 'page', 'elementor_library_type' );
683
+ } else {
684
+ update_post_meta( $new_page_id, '_elementor_template_type', 'section' );
685
+ wp_set_object_terms( $new_page_id, 'section', 'elementor_library_type' );
686
+ }
687
+
688
+ update_post_meta( $new_page_id, '_wp_page_template', 'elementor_header_footer' );
689
+
690
+ do_action( 'astra_sites_process_single', $new_page_id );
691
+
692
+ wp_send_json_success(
693
+ array(
694
+ 'remove-page-id' => $page_id,
695
+ 'id' => $new_page_id,
696
+ 'link' => get_permalink( $new_page_id ),
697
+ )
698
+ );
699
+ }
700
+
701
+ /**
702
+ * Import Birzy Media.
703
+ *
704
+ * @since 2.0.0
705
+ */
706
+ public function import_media() {
707
+
708
+ // Verify Nonce.
709
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
710
+
711
+ $image_data = isset( $_POST['media'] ) ? $_POST['media'] : array();
712
+
713
+ if ( empty( $image_data ) ) {
714
+ wp_send_json_error();
715
+ }
716
+
717
+ $image = array(
718
+ 'url' => $image_data['url'],
719
+ 'id' => $image_data['id'],
720
+ );
721
+ $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import( $image );
722
+
723
+ // Set meta data.
724
+ if ( isset( $image_data['meta'] ) && ! empty( $image_data['meta'] ) ) {
725
+ foreach ( $image_data['meta'] as $meta_key => $meta_value ) {
726
+ update_post_meta( $downloaded_image['id'], $meta_key, $meta_value );
727
+ }
728
+ }
729
+
730
+ wp_send_json_success();
731
+ }
732
+
733
+ /**
734
+ * Import Page.
735
+ *
736
+ * @since 2.0.0
737
+ */
738
+ public function create_page() {
739
+
740
+ // Verify Nonce.
741
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
742
+
743
+ if ( ! current_user_can( 'customize' ) ) {
744
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
745
+ }
746
+
747
+ $default_page_builder = Astra_Sites_Page::get_instance()->get_setting( 'page_builder' );
748
+
749
+ $content = isset( $_POST['data']['original_content'] ) ? $_POST['data']['original_content'] : ( isset( $_POST['data']['content']['rendered'] ) ? $_POST['data']['content']['rendered'] : '' );
750
+
751
+ if ( 'elementor' === $default_page_builder ) {
752
+ if ( isset( $_POST['data']['astra-page-options-data'] ) && isset( $_POST['data']['astra-page-options-data']['elementor_load_fa4_shim'] ) ) {
753
+ update_option( 'elementor_load_fa4_shim', $_POST['data']['astra-page-options-data']['elementor_load_fa4_shim'] );
754
+ }
755
+ }
756
+
757
+ $data = isset( $_POST['data'] ) ? $_POST['data'] : array();
758
+
759
+ if ( empty( $data ) ) {
760
+ wp_send_json_error( 'Empty page data.' );
761
+ }
762
+
763
+ $page_id = isset( $_POST['data']['id'] ) ? $_POST['data']['id'] : '';
764
+ $title = isset( $_POST['data']['title']['rendered'] ) ? $_POST['data']['title']['rendered'] : '';
765
+ $excerpt = isset( $_POST['data']['excerpt']['rendered'] ) ? $_POST['data']['excerpt']['rendered'] : '';
766
+
767
+ $post_args = array(
768
+ 'post_type' => 'page',
769
+ 'post_status' => 'draft',
770
+ 'post_title' => $title,
771
+ 'post_content' => $content,
772
+ 'post_excerpt' => $excerpt,
773
+ );
774
+
775
+ $new_page_id = wp_insert_post( $post_args );
776
+ update_post_meta( $new_page_id, '_astra_sites_enable_for_batch', true );
777
+
778
+ $post_meta = isset( $_POST['data']['post-meta'] ) ? $_POST['data']['post-meta'] : array();
779
+
780
+ if ( ! empty( $post_meta ) ) {
781
+ $this->import_post_meta( $new_page_id, $post_meta );
782
+ }
783
+
784
+ if ( isset( $_POST['data']['astra-page-options-data'] ) && ! empty( $_POST['data']['astra-page-options-data'] ) ) {
785
+
786
+ foreach ( $_POST['data']['astra-page-options-data'] as $option => $value ) {
787
+ update_option( $option, $value );
788
+ }
789
+ }
790
+
791
+ if ( 'elementor' === $default_page_builder ) {
792
+ update_post_meta( $new_page_id, '_wp_page_template', 'elementor_header_footer' );
793
+ }
794
+
795
+ do_action( 'astra_sites_process_single', $new_page_id );
796
+
797
+ wp_send_json_success(
798
+ array(
799
+ 'remove-page-id' => $page_id,
800
+ 'id' => $new_page_id,
801
+ 'link' => get_permalink( $new_page_id ),
802
+ )
803
+ );
804
+ }
805
+
806
+ /**
807
+ * Search Images.
808
+ *
809
+ * @since 2.7.3.
810
+ */
811
+ public function search_images() {
812
+ // Verify Nonce.
813
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
814
+
815
+ if ( ! current_user_can( 'upload_files' ) ) {
816
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
817
+ }
818
+
819
+ $params = isset( $_POST['params'] ) ? array_map( 'sanitize_text_field', $_POST['params'] ) : array();
820
+
821
+ $params['key'] = $this->pixabay_api_key;
822
+
823
+ $api_url = add_query_arg( $params, $this->pixabay_url );
824
+
825
+ $response = wp_remote_get( $api_url );
826
+
827
+ if ( is_wp_error( $response ) ) {
828
+ wp_send_json_error( wp_remote_retrieve_body( $response ) );
829
+ }
830
+
831
+ $body = wp_remote_retrieve_body( $response );
832
+ $data = json_decode( $body, true );
833
+
834
+ wp_send_json_success( $data );
835
+ }
836
+
837
+ /**
838
+ * Download and save the image in the media library.
839
+ *
840
+ * @since 2.0.0
841
+ */
842
+ public function create_image() {
843
+ // Verify Nonce.
844
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
845
+
846
+ if ( ! current_user_can( 'upload_files' ) ) {
847
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
848
+ }
849
+
850
+ $url = isset( $_POST['url'] ) ? esc_url_raw( $_POST['url'] ) : false;
851
+ $name = isset( $_POST['name'] ) ? sanitize_text_field( $_POST['name'] ) : false;
852
+ $photo_id = isset( $_POST['id'] ) ? absint( $_POST['id'] ) : 0;
853
+
854
+ if ( false === $url ) {
855
+ wp_send_json_error( __( 'Need to send URL of the image to be downloaded', 'astra-sites' ) );
856
+ }
857
+
858
+ $image = '';
859
+ $result = array();
860
+
861
+ $name = preg_replace( '/\.[^.]+$/', '', $name ) . '-' . $photo_id . '.jpg';
862
+ $image = $this->create_image_from_url( $url, $name, $photo_id );
863
+
864
+ if ( is_wp_error( $image ) ) {
865
+ wp_send_json_error( $image );
866
+ }
867
+
868
+ if ( 0 !== $image ) {
869
+ $result['attachmentData'] = wp_prepare_attachment_for_js( $image );
870
+ if ( did_action( 'elementor/loaded' ) ) {
871
+ $result['data'] = Astra_Sites_Elementor_Images::get_instance()->get_attachment_data( $image );
872
+ }
873
+ if ( 0 === $photo_id ) {
874
+ /**
875
+ * This flag ensures these files are deleted in the Reset Process.
876
+ */
877
+ update_post_meta( $image, '_astra_sites_imported_post', true );
878
+ }
879
+ } else {
880
+ wp_send_json_error( __( 'Could not download the image.', 'astra-sites' ) );
881
+ }
882
+
883
+ // Save downloaded image reference to an option.
884
+ if ( 0 !== $photo_id ) {
885
+ $saved_images = get_option( 'astra-sites-saved-images', array() );
886
+
887
+ if ( empty( $saved_images ) || false === $saved_images ) {
888
+ $saved_images = array();
889
+ }
890
+
891
+ $saved_images[] = $photo_id;
892
+ update_option( 'astra-sites-saved-images', $saved_images, 'no' );
893
+ }
894
+
895
+ $result['updated-saved-images'] = get_option( 'astra-sites-saved-images', array() );
896
+
897
+ wp_send_json_success( $result );
898
+ }
899
+
900
+ /**
901
+ * Set the upload directory
902
+ */
903
+ public function get_wp_upload_url() {
904
+ $wp_upload_dir = wp_upload_dir();
905
+ return isset( $wp_upload_dir['url'] ) ? $wp_upload_dir['url'] : false;
906
+ }
907
+
908
+ /**
909
+ * Create the image and return the new media upload id.
910
+ *
911
+ * @param String $url URL to pixabay image.
912
+ * @param String $name Name to pixabay image.
913
+ * @param String $photo_id Photo ID to pixabay image.
914
+ * @see http://codex.wordpress.org/Function_Reference/wp_insert_attachment#Example
915
+ */
916
+ public function create_image_from_url( $url, $name, $photo_id ) {
917
+ $file_array = array();
918
+ $file_array['name'] = wp_basename( $name );
919
+
920
+ // Download file to temp location.
921
+ $file_array['tmp_name'] = download_url( $url );
922
+
923
+ // If error storing temporarily, return the error.
924
+ if ( is_wp_error( $file_array['tmp_name'] ) ) {
925
+ return $file_array;
926
+ }
927
+
928
+ // Do the validation and storage stuff.
929
+ $id = media_handle_sideload( $file_array, 0, null );
930
+
931
+ // If error storing permanently, unlink.
932
+ if ( is_wp_error( $id ) ) {
933
+ @unlink( $file_array['tmp_name'] ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
934
+ return $id;
935
+ }
936
+
937
+ // Store the original attachment source in meta.
938
+ add_post_meta( $id, '_source_url', $url );
939
+
940
+ update_post_meta( $id, 'astra-images', $photo_id );
941
+ update_post_meta( $id, '_wp_attachment_image_alt', $name );
942
+
943
+ return $id;
944
+ }
945
+
946
+ /**
947
+ * Import Post Meta
948
+ *
949
+ * @since 2.0.0
950
+ *
951
+ * @param integer $post_id Post ID.
952
+ * @param array $metadata Post meta.
953
+ * @return void
954
+ */
955
+ public function import_post_meta( $post_id, $metadata ) {
956
+
957
+ $metadata = (array) $metadata;
958
+
959
+ foreach ( $metadata as $meta_key => $meta_value ) {
960
+
961
+ if ( $meta_value ) {
962
+
963
+ if ( '_elementor_data' === $meta_key ) {
964
+
965
+ $raw_data = json_decode( stripslashes( $meta_value ), true );
966
+
967
+ if ( is_array( $raw_data ) ) {
968
+ $raw_data = wp_slash( wp_json_encode( $raw_data ) );
969
+ } else {
970
+ $raw_data = wp_slash( $raw_data );
971
+ }
972
+ } else {
973
+
974
+ if ( is_serialized( $meta_value, true ) ) {
975
+ $raw_data = maybe_unserialize( stripslashes( $meta_value ) );
976
+ } elseif ( is_array( $meta_value ) ) {
977
+ $raw_data = json_decode( stripslashes( $meta_value ), true );
978
+ } else {
979
+ $raw_data = $meta_value;
980
+ }
981
+ }
982
+
983
+ update_post_meta( $post_id, $meta_key, $raw_data );
984
+ }
985
+ }
986
+ }
987
+
988
+ /**
989
+ * Import Post Meta
990
+ *
991
+ * @since 2.0.0
992
+ *
993
+ * @param integer $post_id Post ID.
994
+ * @param array $metadata Post meta.
995
+ * @return void
996
+ */
997
+ public function import_template_meta( $post_id, $metadata ) {
998
+
999
+ $metadata = (array) $metadata;
1000
+
1001
+ foreach ( $metadata as $meta_key => $meta_value ) {
1002
+
1003
+ if ( $meta_value ) {
1004
+
1005
+ if ( '_elementor_data' === $meta_key ) {
1006
+
1007
+ $raw_data = json_decode( stripslashes( $meta_value ), true );
1008
+
1009
+ if ( is_array( $raw_data ) ) {
1010
+ $raw_data = wp_slash( wp_json_encode( $raw_data ) );
1011
+ } else {
1012
+ $raw_data = wp_slash( $raw_data );
1013
+ }
1014
+ } else {
1015
+
1016
+ if ( is_serialized( $meta_value, true ) ) {
1017
+ $raw_data = maybe_unserialize( stripslashes( $meta_value ) );
1018
+ } elseif ( is_array( $meta_value ) ) {
1019
+ $raw_data = json_decode( stripslashes( $meta_value ), true );
1020
+ } else {
1021
+ $raw_data = $meta_value;
1022
+ }
1023
+ }
1024
+
1025
+ update_post_meta( $post_id, $meta_key, $raw_data );
1026
+ }
1027
+ }
1028
+ }
1029
+
1030
+ /**
1031
+ * Close getting started notice for current user
1032
+ *
1033
+ * @since 1.3.5
1034
+ * @return void
1035
+ */
1036
+ public function getting_started_notice() {
1037
+ // Verify Nonce.
1038
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
1039
+
1040
+ if ( ! current_user_can( 'customize' ) ) {
1041
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
1042
+ }
1043
+
1044
+ update_option( '_astra_sites_gettings_started', 'yes', 'no' );
1045
+ wp_send_json_success();
1046
+ }
1047
+
1048
+ /**
1049
+ * Activate theme
1050
+ *
1051
+ * @since 1.3.2
1052
+ * @return void
1053
+ */
1054
+ public function activate_theme() {
1055
+
1056
+ // Verify Nonce.
1057
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
1058
+
1059
+ if ( ! current_user_can( 'customize' ) ) {
1060
+ wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
1061
+ }
1062
+
1063
+ switch_theme( 'astra' );
1064
+
1065
+ wp_send_json_success(
1066
+ array(
1067
+ 'success' => true,
1068
+ 'message' => __( 'Theme Activated', 'astra-sites' ),
1069
+ )
1070
+ );
1071
+ }
1072
+
1073
+ /**
1074
+ * Set reset data
1075
+ */
1076
+ public function get_reset_data() {
1077
+
1078
+ if ( wp_doing_ajax() ) {
1079
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
1080
+
1081
+ if ( ! current_user_can( 'manage_options' ) ) {
1082
+ return;
1083
+ }
1084
+ }
1085
+
1086
+ global $wpdb;
1087
+
1088
+ $post_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_astra_sites_imported_post'" );
1089
+ $form_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_astra_sites_imported_wp_forms'" );
1090
+ $term_ids = $wpdb->get_col( "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key='_astra_sites_imported_term'" );
1091
+
1092
+ $data = array(
1093
+ 'reset_posts' => $post_ids,
1094
+ 'reset_wp_forms' => $form_ids,
1095
+ 'reset_terms' => $term_ids,
1096
+ );
1097
+
1098
+ if ( wp_doing_ajax() ) {
1099
+ wp_send_json_success( $data );
1100
+ }
1101
+
1102
+ return $data;
1103
+ }
1104
+
1105
+ /**
1106
+ * Backup our existing settings.
1107
+ */
1108
+ public function backup_settings() {
1109
+
1110
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
1111
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
1112
+
1113
+ if ( ! current_user_can( 'manage_options' ) ) {
1114
+ wp_send_json_error( __( 'User does not have permission!', 'astra-sites' ) );
1115
+ }
1116
+ }
1117
+
1118
+ $file_name = 'astra-sites-backup-' . gmdate( 'd-M-Y-h-i-s' ) . '.json';
1119
+ $old_settings = get_option( 'astra-settings', array() );
1120
+ $upload_dir = Astra_Sites_Importer_Log::get_instance()->log_dir();
1121
+ $upload_path = trailingslashit( $upload_dir['path'] );
1122
+ $log_file = $upload_path . $file_name;
1123
+ $file_system = self::get_instance()->get_filesystem();
1124
+
1125
+ // If file system fails? Then take a backup in site option.
1126
+ if ( false === $file_system->put_contents( $log_file, wp_json_encode( $old_settings ), FS_CHMOD_FILE ) ) {
1127
+ update_option( 'astra_sites_' . $file_name, $old_settings, 'no' );
1128
+ }
1129
+
1130
+ if ( defined( 'WP_CLI' ) ) {
1131
+ WP_CLI::line( 'File generated at ' . $log_file );
1132
+ } elseif ( wp_doing_ajax() ) {
1133
+ wp_send_json_success();
1134
+ }
1135
+ }
1136
+
1137
+ /**
1138
+ * Get theme install, active or inactive status.
1139
+ *
1140
+ * @since 1.3.2
1141
+ *
1142
+ * @return string Theme status
1143
+ */
1144
+ public function get_theme_status() {
1145
+
1146
+ $theme = wp_get_theme();
1147
+
1148
+ // Theme installed and activate.
1149
+ if ( 'Astra' === $theme->name || 'Astra' === $theme->parent_theme ) {
1150
+ return 'installed-and-active';
1151
+ }
1152
+
1153
+ // Theme installed but not activate.
1154
+ foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
1155
+ if ( 'Astra' === $theme->name || 'Astra' === $theme->parent_theme ) {
1156
+ return 'installed-but-inactive';
1157
+ }
1158
+ }
1159
+
1160
+ return 'not-installed';
1161
+ }
1162
+
1163
+ /**
1164
+ * Loads textdomain for the plugin.
1165
+ *
1166
+ * @since 1.0.1
1167
+ */
1168
+ public function load_textdomain() {
1169
+ load_plugin_textdomain( 'astra-sites' );
1170
+ }
1171
+
1172
+ /**
1173
+ * Show action links on the plugin screen.
1174
+ *
1175
+ * @param mixed $links Plugin Action links.
1176
+ * @return array
1177
+ */
1178
+ public function action_links( $links ) {
1179
+
1180
+ $arguments = array(
1181
+ 'page' => 'starter-templates',
1182
+ );
1183
+
1184
+ $url = add_query_arg( $arguments, admin_url( 'themes.php' ) );
1185
+
1186
+ $action_links = array(
1187
+ 'settings' => '<a href="' . esc_url( $url ) . '" aria-label="' . esc_attr__( 'See Library', 'astra-sites' ) . '">' . esc_html__( 'See Library', 'astra-sites' ) . '</a>',
1188
+ );
1189
+
1190
+ return array_merge( $action_links, $links );
1191
+ }
1192
+
1193
+ /**
1194
+ * Get the API URL.
1195
+ *
1196
+ * @since 1.0.0
1197
+ */
1198
+ public static function get_api_domain() {
1199
+ return defined( 'STARTER_TEMPLATES_REMOTE_URL' ) ? STARTER_TEMPLATES_REMOTE_URL : apply_filters( 'astra_sites_api_domain', 'https://websitedemos.net/' );
1200
+ }
1201
+
1202
+ /**
1203
+ * Setter for $api_url
1204
+ *
1205
+ * @since 1.0.0
1206
+ */
1207
+ public function set_api_url() {
1208
+ $this->api_domain = trailingslashit( self::get_api_domain() );
1209
+ $this->api_url = apply_filters( 'astra_sites_api_url', $this->api_domain . 'wp-json/wp/v2/' );
1210
+
1211
+ $this->search_url = apply_filters( 'astra_sites_search_api_url', $this->api_domain . 'wp-json/analytics/v2/search/' );
1212
+
1213
+ $this->pixabay_url = 'https://pixabay.com/api/';
1214
+ $this->pixabay_api_key = '2727911-c4d7c1031949c7e0411d7e81e';
1215
+ }
1216
+
1217
+ /**
1218
+ * Enqueue Image Search scripts.
1219
+ *
1220
+ * @since 2.0.0
1221
+ * @return void
1222
+ */
1223
+ public function image_search_assets() {
1224
+
1225
+ wp_enqueue_script( 'masonry' );
1226
+ wp_enqueue_script( 'imagesloaded' );
1227
+
1228
+ wp_enqueue_script(
1229
+ 'astra-sites-images-common',
1230
+ ASTRA_SITES_URI . 'inc/assets/js/common.js',
1231
+ array( 'jquery', 'wp-util' ), // Dependencies, defined above.
1232
+ ASTRA_SITES_VER,
1233
+ true
1234
+ );
1235
+
1236
+ $data = apply_filters(
1237
+ 'astra_sites_images_common',
1238
+ array(
1239
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
1240
+ 'asyncurl' => esc_url( admin_url( 'async-upload.php' ) ),
1241
+ 'is_bb_active' => ( class_exists( 'FLBuilderModel' ) ),
1242
+ 'is_brizy_active' => ( class_exists( 'Brizy_Editor_Post' ) ),
1243
+ 'is_elementor_active' => ( did_action( 'elementor/loaded' ) ),
1244
+ 'is_elementor_editor' => ( did_action( 'elementor/loaded' ) ) ? Elementor\Plugin::instance()->editor->is_edit_mode() : false,
1245
+ 'is_bb_editor' => ( class_exists( 'FLBuilderModel' ) ) ? ( FLBuilderModel::is_builder_active() ) : false,
1246
+ 'is_brizy_editor' => ( class_exists( 'Brizy_Editor_Post' ) ) ? ( isset( $_GET['brizy-edit'] ) || isset( $_GET['brizy-edit-iframe'] ) ) : false, // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1247
+ 'saved_images' => get_option( 'astra-sites-saved-images', array() ),
1248
+ 'pixabay_category' => array(
1249
+ 'all' => __( 'All', 'astra-sites' ),
1250
+ 'animals' => __( 'Animals', 'astra-sites' ),
1251
+ 'buildings' => __( 'Architecture/Buildings', 'astra-sites' ),
1252
+ 'backgrounds' => __( 'Backgrounds/Textures', 'astra-sites' ),
1253
+ 'fashion' => __( 'Beauty/Fashion', 'astra-sites' ),
1254
+ 'business' => __( 'Business/Finance', 'astra-sites' ),
1255
+ 'computer' => __( 'Computer/Communication', 'astra-sites' ),
1256
+ 'education' => __( 'Education', 'astra-sites' ),
1257
+ 'feelings' => __( 'Emotions', 'astra-sites' ),
1258
+ 'food' => __( 'Food/Drink', 'astra-sites' ),
1259
+ 'health' => __( 'Health/Medical', 'astra-sites' ),
1260
+ 'industry' => __( 'Industry/Craft', 'astra-sites' ),
1261
+ 'music' => __( 'Music', 'astra-sites' ),
1262
+ 'nature' => __( 'Nature/Landscapes', 'astra-sites' ),
1263
+ 'people' => __( 'People', 'astra-sites' ),
1264
+ 'places' => __( 'Places/Monuments', 'astra-sites' ),
1265
+ 'religion' => __( 'Religion', 'astra-sites' ),
1266
+ 'science' => __( 'Science/Technology', 'astra-sites' ),
1267
+ 'sports' => __( 'Sports', 'astra-sites' ),
1268
+ 'transportation' => __( 'Transportation/Traffic', 'astra-sites' ),
1269
+ 'travel' => __( 'Travel/Vacation', 'astra-sites' ),
1270
+ ),
1271
+ 'pixabay_order' => array(
1272
+ 'popular' => __( 'Popular', 'astra-sites' ),
1273
+ 'latest' => __( 'Latest', 'astra-sites' ),
1274
+ 'upcoming' => __( 'Upcoming', 'astra-sites' ),
1275
+ 'ec' => __( 'Editor\'s Choice', 'astra-sites' ),
1276
+ ),
1277
+ 'pixabay_orientation' => array(
1278
+ 'any' => __( 'Any Orientation', 'astra-sites' ),
1279
+ 'vertical' => __( 'Vertical', 'astra-sites' ),
1280
+ 'horizontal' => __( 'Horizontal', 'astra-sites' ),
1281
+ ),
1282
+ 'title' => __( 'Free Images', 'astra-sites' ),
1283
+ 'search_placeholder' => __( 'Search - Ex: flowers', 'astra-sites' ),
1284
+ 'downloading' => __( 'Downloading...', 'astra-sites' ),
1285
+ 'validating' => __( 'Validating...', 'astra-sites' ),
1286
+ 'empty_api_key' => __( 'Please enter an API key.', 'astra-sites' ),
1287
+ 'error_api_key' => __( 'An error occured with code ', 'astra-sites' ),
1288
+ '_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
1289
+ )
1290
+ );
1291
+ wp_localize_script( 'astra-sites-images-common', 'astraImages', $data );
1292
+
1293
+ wp_enqueue_script(
1294
+ 'astra-sites-images-script',
1295
+ ASTRA_SITES_URI . 'inc/assets/js/dist/main.js',
1296
+ array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-api-fetch', 'astra-sites-images-common' ), // Dependencies, defined above.
1297
+ ASTRA_SITES_VER,
1298
+ true
1299
+ );
1300
+
1301
+ wp_enqueue_style( 'astra-sites-images', ASTRA_SITES_URI . 'inc/assets/css/images.css', ASTRA_SITES_VER, true );
1302
+ wp_style_add_data( 'astra-sites-images', 'rtl', 'replace' );
1303
+ }
1304
+
1305
+ /**
1306
+ * Getter for $api_url
1307
+ *
1308
+ * @since 1.0.0
1309
+ */
1310
+ public function get_api_url() {
1311
+ return $this->api_url;
1312
+ }
1313
+
1314
+ /**
1315
+ * Enqueue admin scripts.
1316
+ *
1317
+ * @since 1.3.2 Added 'install-theme.js' to install and activate theme.
1318
+ * @since 1.0.5 Added 'getUpgradeText' and 'getUpgradeURL' localize variables.
1319
+ *
1320
+ * @since 1.0.0
1321
+ *
1322
+ * @param string $hook Current hook name.
1323
+ * @return void
1324
+ */
1325
+ public function admin_enqueue( $hook = '' ) {
1326
+
1327
+ // Image Search assets.
1328
+ if ( 'post-new.php' === $hook || 'post.php' === $hook || 'widgets.php' === $hook ) {
1329
+ $this->image_search_assets();
1330
+ }
1331
+
1332
+ // Avoid scripts from customizer.
1333
+ if ( is_customize_preview() ) {
1334
+ return;
1335
+ }
1336
+
1337
+ wp_enqueue_script( 'astra-sites-install-theme', ASTRA_SITES_URI . 'inc/assets/js/install-theme.js', array( 'jquery', 'updates' ), ASTRA_SITES_VER, true );
1338
+ wp_enqueue_style( 'astra-sites-install-theme', ASTRA_SITES_URI . 'inc/assets/css/install-theme.css', null, ASTRA_SITES_VER, 'all' );
1339
+ wp_style_add_data( 'astra-sites-install-theme', 'rtl', 'replace' );
1340
+
1341
+ $data = apply_filters(
1342
+ 'astra_sites_install_theme_localize_vars',
1343
+ array(
1344
+ 'installed' => __( 'Installed! Activating..', 'astra-sites' ),
1345
+ 'activating' => __( 'Activating...', 'astra-sites' ),
1346
+ 'activated' => __( 'Activated!', 'astra-sites' ),
1347
+ 'installing' => __( 'Installing...', 'astra-sites' ),
1348
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
1349
+ '_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
1350
+ )
1351
+ );
1352
+ wp_localize_script( 'astra-sites-install-theme', 'AstraSitesInstallThemeVars', $data );
1353
+
1354
+ if ( 'appearance_page_starter-templates' !== $hook ) {
1355
+ return;
1356
+ }
1357
+
1358
+ global $is_IE, $is_edge;
1359
+
1360
+ if ( $is_IE || $is_edge ) {
1361
+ wp_enqueue_script( 'astra-sites-eventsource', ASTRA_SITES_URI . 'inc/assets/js/eventsource.min.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_SITES_VER, true );
1362
+ }
1363
+
1364
+ // Fetch.
1365
+ wp_register_script( 'astra-sites-fetch', ASTRA_SITES_URI . 'inc/assets/js/fetch.umd.js', array( 'jquery' ), ASTRA_SITES_VER, true );
1366
+
1367
+ // History.
1368
+ wp_register_script( 'astra-sites-history', ASTRA_SITES_URI . 'inc/assets/js/history.js', array( 'jquery' ), ASTRA_SITES_VER, true );
1369
+
1370
+ // Admin Page.
1371
+ wp_enqueue_style( 'astra-sites-admin', ASTRA_SITES_URI . 'inc/assets/css/admin.css', ASTRA_SITES_VER, true );
1372
+ wp_style_add_data( 'astra-sites-admin', 'rtl', 'replace' );
1373
+
1374
+ $data = $this->get_local_vars();
1375
+ }
1376
+
1377
+ /**
1378
+ * Get CTA link
1379
+ *
1380
+ * @param string $source The source of the link.
1381
+ * @param string $medium The medium of the link.
1382
+ * @param string $campaign The campaign of the link.
1383
+ * @return array
1384
+ */
1385
+ public function get_cta_link( $source = '', $medium = '', $campaign = '' ) {
1386
+ $default_page_builder = Astra_Sites_Page::get_instance()->get_setting( 'page_builder' );
1387
+ $cta_links = $this->get_cta_links( $source, $medium, $campaign );
1388
+ return isset( $cta_links[ $default_page_builder ] ) ? $cta_links[ $default_page_builder ] : 'https://wpastra.com/starter-templates-plans/?utm_source=StarterTemplatesPlugin&utm_campaign=WPAdmin';
1389
+ }
1390
+
1391
+ /**
1392
+ * Get CTA Links
1393
+ *
1394
+ * @since 2.6.18
1395
+ *
1396
+ * @param string $source The source of the link.
1397
+ * @param string $medium The medium of the link.
1398
+ * @param string $campaign The campaign of the link.
1399
+ * @return array
1400
+ */
1401
+ public function get_cta_links( $source = '', $medium = '', $campaign = '' ) {
1402
+ return array(
1403
+ 'elementor' => add_query_arg(
1404
+ array(
1405
+ 'utm_source' => ! empty( $source ) ? $source : 'elementor-templates',
1406
+ 'utm_medium' => 'dashboard',
1407
+ 'utm_campaign' => 'Starter-Template-Backend',
1408
+ ), 'https://wpastra.com/elementor-starter-templates/'
1409
+ ),
1410
+ 'beaver-builder' => add_query_arg(
1411
+ array(
1412
+ 'utm_source' => ! empty( $source ) ? $source : 'beaver-templates',
1413
+ 'utm_medium' => 'dashboard',
1414
+ 'utm_campaign' => 'Starter-Template-Backend',
1415
+ ), 'https://wpastra.com/beaver-builder-starter-templates/'
1416
+ ),
1417
+ 'gutenberg' => add_query_arg(
1418
+ array(
1419
+ 'utm_source' => ! empty( $source ) ? $source : 'gutenberg-templates',
1420
+ 'utm_medium' => 'dashboard',
1421
+ 'utm_campaign' => 'Starter-Template-Backend',
1422
+ ), 'https://wpastra.com/starter-templates-plans/'
1423
+ ),
1424
+ 'brizy' => add_query_arg(
1425
+ array(
1426
+ 'utm_source' => ! empty( $source ) ? $source : 'brizy-templates',
1427
+ 'utm_medium' => 'dashboard',
1428
+ 'utm_campaign' => 'Starter-Template-Backend',
1429
+ ), 'https://wpastra.com/starter-templates-plans/'
1430
+ ),
1431
+ );
1432
+ }
1433
+
1434
+ /**
1435
+ * Returns Localization Variables.
1436
+ *
1437
+ * @since 2.0.0
1438
+ */
1439
+ public function get_local_vars() {
1440
+
1441
+ $stored_data = array(
1442
+ 'astra-sites-site-category' => array(),
1443
+ 'astra-site-page-builder' => array(),
1444
+ 'astra-sites' => array(),
1445
+ 'site-pages-category' => array(),
1446
+ 'site-pages-page-builder' => array(),
1447
+ 'site-pages-parent-category' => array(),
1448
+ 'site-pages' => array(),
1449
+ 'favorites' => get_option( 'astra-sites-favorites' ),
1450
+ );
1451
+
1452
+ $favorite_data = get_option( 'astra-sites-favorites' );
1453
+
1454
+ $license_status = false;
1455
+ if ( is_callable( 'BSF_License_Manager::bsf_is_active_license' ) ) {
1456
+ $license_status = BSF_License_Manager::bsf_is_active_license( 'astra-pro-sites' );
1457
+ }
1458
+
1459
+ $default_page_builder = Astra_Sites_Page::get_instance()->get_setting( 'page_builder' );
1460
+
1461
+ $data = apply_filters(
1462
+ 'astra_sites_localize_vars',
1463
+ array(
1464
+ 'subscribed' => get_user_meta( get_current_user_ID(), 'astra-sites-subscribed', true ),
1465
+ 'debug' => defined( 'WP_DEBUG' ) ? true : false,
1466
+ 'isPro' => defined( 'ASTRA_PRO_SITES_NAME' ) ? true : false,
1467
+ 'isWhiteLabeled' => Astra_Sites_White_Label::get_instance()->is_white_labeled(),
1468
+ 'whiteLabelName' => Astra_Sites_White_Label::get_instance()->get_white_label_name(),
1469
+ 'whiteLabelUrl' => Astra_Sites_White_Label::get_instance()->get_white_label_link( 'https://wpastra.com/docs/not-valid-license/' ),
1470
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
1471
+ 'siteURL' => site_url(),
1472
+ 'getProText' => __( 'Get Access!', 'astra-sites' ),
1473
+ 'getProURL' => esc_url( 'https://wpastra.com/starter-templates-plans/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
1474
+ 'getUpgradeText' => __( 'Upgrade', 'astra-sites' ),
1475
+ 'getUpgradeURL' => esc_url( 'https://wpastra.com/starter-templates-plans/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
1476
+ '_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
1477
+ 'requiredPlugins' => array(),
1478
+ 'syncLibraryStart' => '<span class="message">' . esc_html__( 'Syncing template library in the background. The process can take anywhere between 2 to 3 minutes. We will notify you once done.', 'astra-sites' ) . '</span>',
1479
+ 'xmlRequiredFilesMissing' => __( 'Some of the files required during the import process are missing.<br/><br/>Please try again after some time.', 'astra-sites' ),
1480
+ 'importFailedMessageDueToDebug' => __( '<p>WordPress debug mode is currently enabled on your website. This has interrupted the import process..</p><p>Kindly disable debug mode and try importing Starter Template again.</p><p>You can add the following code into the wp-config.php file to disable debug mode.</p><p><code>define(\'WP_DEBUG\', false);</code></p>', 'astra-sites' ),
1481
+ /* translators: %s is a documentation link. */
1482
+ 'importFailedMessage' => sprintf( __( '<p>We are facing a temporary issue in importing this template.</p><p>Read <a href="%s" target="_blank">article</a> to resolve the issue and continue importing template.</p>', 'astra-sites' ), esc_url( 'https://wpastra.com/docs/fix-starter-template-importing-issues/' ) ),
1483
+ /* translators: %s is a documentation link. */
1484
+ 'importFailedRequiredPluginsMessage' => sprintf( __( '<p>We are facing a temporary issue in installing the required plugins for this template.</p><p>Read&nbsp;<a href="%s" target="_blank">article</a>&nbsp;to resolve the issue and continue importing template.</p>', 'astra-sites' ), esc_url( 'https://wpastra.com/docs/plugin-installation-failed-multisite/' ) ),
1485
+
1486
+ 'strings' => array(
1487
+ /* translators: %s are white label strings. */
1488
+ 'warningBeforeCloseWindow' => sprintf( __( 'Warning! %1$s Import process is not complete. Don\'t close the window until import process complete. Do you still want to leave the window?', 'astra-sites' ), Astra_Sites_White_Label::get_instance()->get_white_label_name() ),
1489
+ 'viewSite' => __( 'Done! View Site', 'astra-sites' ),
1490
+ 'syncCompleteMessage' => self::get_instance()->get_sync_complete_message(),
1491
+ /* translators: %s is a template name */
1492
+ 'importSingleTemplate' => __( 'Import "%s" Template', 'astra-sites' ),
1493
+ ),
1494
+ 'log' => array(
1495
+ 'bulkInstall' => __( 'Installing Required Plugins..', 'astra-sites' ),
1496
+ /* translators: %s are white label strings. */
1497
+ 'themeInstall' => sprintf( __( 'Installing %1$s Theme..', 'astra-sites' ), Astra_Sites_White_Label::get_instance()->get_option( 'astra', 'name', 'Astra' ) ),
1498
+ ),
1499
+ 'default_page_builder' => $default_page_builder,
1500
+ 'default_page_builder_data' => Astra_Sites_Page::get_instance()->get_default_page_builder(),
1501
+ 'default_page_builder_sites' => Astra_Sites_Page::get_instance()->get_sites_by_page_builder( $default_page_builder ),
1502
+ 'sites' => astra_sites_get_api_params(),
1503
+ 'allSites' => (array) self::get_instance()->get_all_sites(),
1504
+ 'allCategories' => (array) self::get_instance()->get_api_option( 'astra-sites-all-site-categories' ),
1505
+ 'allCategoriesAndTags' => (array) self::get_instance()->get_api_option( 'astra-sites-all-site-categories-and-tags' ),
1506
+ 'categories' => array(),
1507
+ 'page-builders' => array(),
1508
+ 'all_sites' => $this->get_all_sites(),
1509
+ 'all_site_categories' => get_option( 'astra-sites-all-site-categories', array() ),
1510
+ 'all_site_categories_and_tags' => get_option( 'astra-sites-all-site-categories-and-tags', array() ),
1511
+ 'license_status' => $license_status,
1512
+ 'license_page_builder' => get_option( 'astra-sites-license-page-builder', '' ),
1513
+ 'ApiDomain' => $this->api_domain,
1514
+ 'ApiURL' => $this->api_url,
1515
+ 'stored_data' => $stored_data,
1516
+ 'favorite_data' => $favorite_data,
1517
+ 'category_slug' => 'astra-sites-site-category',
1518
+ 'page_builder' => 'astra-site-page-builder',
1519
+ 'cpt_slug' => 'astra-sites',
1520
+ 'parent_category' => '',
1521
+ 'compatibilities' => $this->get_compatibilities(),
1522
+ 'compatibilities_data' => $this->get_compatibilities_data(),
1523
+ 'dismiss' => __( 'Dismiss this notice.', 'astra-sites' ),
1524
+ 'headings' => array(
1525
+ 'subscription' => esc_html__( 'One Last Step..', 'astra-sites' ),
1526
+ 'site_import' => esc_html__( 'Your Selected Website is Being Imported.', 'astra-sites' ),
1527
+ 'page_import' => esc_html__( 'Your Selected Template is Being Imported.', 'astra-sites' ),
1528
+ ),
1529
+ 'subscriptionSuccessMessage' => esc_html__( 'We have sent you a surprise gift on your email address! Please check your inbox!', 'astra-sites' ),
1530
+ 'first_import_complete' => get_option( 'astra_sites_import_complete' ),
1531
+ 'server_import_primary_error' => __( 'Looks like the template you are importing is temporarily not available.', 'astra-sites' ),
1532
+ 'client_import_primary_error' => __( 'We could not start the import process and this is the message from WordPress:', 'astra-sites' ),
1533
+ 'cloudflare_import_primary_error' => __( 'There was an error connecting to the Starter Templates API.', 'astra-sites' ),
1534
+ 'xml_import_interrupted_primary' => __( 'There was an error while importing the content.', 'astra-sites' ),
1535
+ 'xml_import_interrupted_secondary' => __( 'To import content, WordPress needs to store XML file in /wp-content/ folder. Please get in touch with your hosting provider.', 'astra-sites' ),
1536
+ 'xml_import_interrupted_error' => __( 'Looks like your host probably could not store XML file in /wp-content/ folder.', 'astra-sites' ),
1537
+ /* translators: %s HTML tags */
1538
+ 'ajax_request_failed_primary' => sprintf( __( '%1$sWe could not start the import process due to failed AJAX request and this is the message from WordPress:%2$s', 'astra-sites' ), '<p>', '</p>' ),
1539
+ /* translators: %s URL to document. */
1540
+ 'ajax_request_failed_secondary' => sprintf( __( '%1$sRead&nbsp;<a href="%2$s" target="_blank">article</a>&nbsp;to resolve the issue and continue importing template.%3$s', 'astra-sites' ), '<p>', esc_url( 'https://wpastra.com/docs/internal-server-error-starter-templates/' ), '</p>' ),
1541
+ 'cta_links' => $this->get_cta_links(),
1542
+ 'cta_quick_corner_links' => $this->get_cta_links( 'quick-links-corner' ),
1543
+ 'cta_premium_popup_links' => $this->get_cta_links( 'get-premium-access-popup' ),
1544
+ 'cta_link' => $this->get_cta_link(),
1545
+ 'cta_quick_corner_link' => $this->get_cta_link( 'quick-links-corner' ),
1546
+ 'cta_premium_popup_link' => $this->get_cta_link( 'get-premium-access-popup' ),
1547
+
1548
+ /* translators: %s URL to document. */
1549
+ 'process_failed_primary' => sprintf( __( '%1$sWe could not complete the import process due to failed AJAX request and this is the message:%2$s', 'astra-sites' ), '<p>', '</p>' ),
1550
+ /* translators: %s URL to document. */
1551
+ 'process_failed_secondary' => sprintf( __( '%1$sPlease report this <a href="%2$s" target="_blank">here</a>.%3$s', 'astra-sites' ), '<p>', esc_url( 'https://wpastra.com/starter-templates-support/?url=#DEMO_URL#&subject=#SUBJECT#' ), '</p>' ),
1552
+ 'st_page_url' => admin_url( 'themes.php?page=starter-templates' ),
1553
+ )
1554
+ );
1555
+
1556
+ return $data;
1557
+ }
1558
+
1559
+ /**
1560
+ * Display subscription form
1561
+ *
1562
+ * @since 2.6.1
1563
+ *
1564
+ * @return boolean
1565
+ */
1566
+ public function should_display_subscription_form() {
1567
+
1568
+ $subscription = apply_filters( 'astra_sites_should_display_subscription_form', null );
1569
+ if ( null !== $subscription ) {
1570
+ return $subscription;
1571
+ }
1572
+
1573
+ // Is WhiteLabel enabled?
1574
+ if ( Astra_Sites_White_Label::get_instance()->is_white_labeled() ) {
1575
+ return false;
1576
+ }
1577
+
1578
+ // Is Premium Starter Templates pluign?
1579
+ if ( defined( 'ASTRA_PRO_SITES_NAME' ) ) {
1580
+ return false;
1581
+ }
1582
+
1583
+ // User already subscribed?
1584
+ $subscribed = get_user_meta( get_current_user_ID(), 'astra-sites-subscribed', true );
1585
+ if ( $subscribed ) {
1586
+ return false;
1587
+ }
1588
+
1589
+ return true;
1590
+ }
1591
+
1592
+ /**
1593
+ * Import Compatibility Errors
1594
+ *
1595
+ * @since 2.0.0
1596
+ * @return mixed
1597
+ */
1598
+ public function get_compatibilities_data() {
1599
+ return array(
1600
+ 'xmlreader' => array(
1601
+ 'title' => esc_html__( 'XMLReader Support Missing', 'astra-sites' ),
1602
+ /* translators: %s doc link. */
1603
+ 'tooltip' => '<p>' . esc_html__( 'You\'re close to importing the template. To complete the process, enable XMLReader support on your website..', 'astra-sites' ) . '</p><p>' . sprintf( __( 'Read an article <a href="%s" target="_blank">here</a> to resolve the issue.', 'astra-sites' ), 'https://wpastra.com/docs/xmlreader-missing/' ) . '</p>',
1604
+ ),
1605
+ 'curl' => array(
1606
+ 'title' => esc_html__( 'cURL Support Missing', 'astra-sites' ),
1607
+ /* translators: %s doc link. */
1608
+ 'tooltip' => '<p>' . esc_html__( 'To run a smooth import, kindly enable cURL support on your website.', 'astra-sites' ) . '</p><p>' . sprintf( __( 'Read an article <a href="%s" target="_blank">here</a> to resolve the issue.', 'astra-sites' ), 'https://wpastra.com/docs/curl-support-missing/' ) . '</p>',
1609
+ ),
1610
+ 'wp-debug' => array(
1611
+ 'title' => esc_html__( 'Disable Debug Mode', 'astra-sites' ),
1612
+ /* translators: %s doc link. */
1613
+ 'tooltip' => '<p>' . esc_html__( 'WordPress debug mode is currently enabled on your website. With this, any errors from third-party plugins might affect the import process.', 'astra-sites' ) . '</p><p>' . esc_html__( 'Kindly disable it to continue importing the Starter Template. To do so, you can add the following code into the wp-config.php file.', 'astra-sites' ) . '</p><p><code>define(\'WP_DEBUG\', false);</code></p><p>' . sprintf( __( 'Read an article <a href="%s" target="_blank">here</a> to resolve the issue.', 'astra-sites' ), 'https://wpastra.com/docs/disable-debug-mode/' ) . '</p>',
1614
+ ),
1615
+ 'update-available' => array(
1616
+ 'title' => esc_html__( 'Update Plugin', 'astra-sites' ),
1617
+ /* translators: %s update page link. */
1618
+ 'tooltip' => '<p>' . esc_html__( 'Updates are available for plugins used in this starter template.', 'astra-sites' ) . '</p>##LIST##<p>' . sprintf( __( 'Kindly <a href="%s" target="_blank">update</a> them for a successful import. Skipping this step might break the template design/feature.', 'astra-sites' ), esc_url( network_admin_url( 'update-core.php' ) ) ) . '</p>',
1619
+ ),
1620
+ 'third-party-required' => array(
1621
+ 'title' => esc_html__( 'Required Plugins Missing', 'astra-sites' ),
1622
+ 'tooltip' => '<p>' . esc_html__( 'This starter template requires premium plugins. As these are third party premium plugins, you\'ll need to purchase, install and activate them first.', 'astra-sites' ) . '</p>',
1623
+ ),
1624
+ 'dynamic-page' => array(
1625
+ 'title' => esc_html__( 'Dynamic Page', 'astra-sites' ),
1626
+ 'tooltip' => '<p>' . esc_html__( 'The page template you are about to import contains a dynamic widget/module. Please note this dynamic data will not be available with the imported page.', 'astra-sites' ) . '</p><p>' . esc_html__( 'You will need to add it manually on the page.', 'astra-sites' ) . '</p><p>' . esc_html__( 'This dynamic content will be available when you import the entire site.', 'astra-sites' ) . '</p>',
1627
+ ),
1628
+ );
1629
+ }
1630
+
1631
+ /**
1632
+ * Get all compatibilities
1633
+ *
1634
+ * @since 2.0.0
1635
+ *
1636
+ * @return array
1637
+ */
1638
+ public function get_compatibilities() {
1639
+
1640
+ $data = $this->get_compatibilities_data();
1641
+
1642
+ $compatibilities = array(
1643
+ 'errors' => array(),
1644
+ 'warnings' => array(),
1645
+ );
1646
+
1647
+ if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1648
+ $compatibilities['warnings']['wp-debug'] = $data['wp-debug'];
1649
+ }
1650
+
1651
+ if ( ! class_exists( 'XMLReader' ) ) {
1652
+ $compatibilities['errors']['xmlreader'] = $data['xmlreader'];
1653
+ }
1654
+
1655
+ if ( ! function_exists( 'curl_version' ) ) {
1656
+ $compatibilities['errors']['curl'] = $data['curl'];
1657
+ }
1658
+
1659
+ return $compatibilities;
1660
+ }
1661
+
1662
+ /**
1663
+ * Register module required js on elementor's action.
1664
+ *
1665
+ * @since 2.0.0
1666
+ */
1667
+ public function register_widget_scripts() {
1668
+
1669
+ $page_builders = self::get_instance()->get_page_builders();
1670
+ $has_elementor = false;
1671
+
1672
+ // Use this filter to remove the Starter Templates button from Elementor Editor.
1673
+ $elementor_add_ast_site_button = apply_filters( 'starter_templates_hide_elementor_button', false );
1674
+
1675
+ foreach ( $page_builders as $page_builder ) {
1676
+
1677
+ if ( 'elementor' === $page_builder['slug'] ) {
1678
+ $has_elementor = true;
1679
+ }
1680
+ }
1681
+
1682
+ if ( ! $has_elementor ) {
1683
+ return;
1684
+ }
1685
+
1686
+ if ( $elementor_add_ast_site_button ) {
1687
+ return;
1688
+ }
1689
+
1690
+ wp_enqueue_script( 'astra-sites-helper', ASTRA_SITES_URI . 'inc/assets/js/helper.js', array( 'jquery' ), ASTRA_SITES_VER, true );
1691
+
1692
+ wp_enqueue_script( 'masonry' );
1693
+ wp_enqueue_script( 'imagesloaded' );
1694
+
1695
+ // Image Search assets.
1696
+ $this->image_search_assets();
1697
+
1698
+ wp_enqueue_script( 'astra-sites-elementor-admin-page', ASTRA_SITES_URI . 'inc/assets/js/elementor-admin-page.js', array( 'jquery', 'wp-util', 'updates', 'masonry', 'imagesloaded' ), ASTRA_SITES_VER, true );
1699
+ wp_add_inline_script( 'astra-sites-elementor-admin-page', sprintf( 'var pagenow = "%s";', ASTRA_SITES_NAME ), 'after' );
1700
+ wp_enqueue_style( 'astra-sites-admin', ASTRA_SITES_URI . 'inc/assets/css/admin.css', ASTRA_SITES_VER, true );
1701
+ wp_style_add_data( 'astra-sites-admin', 'rtl', 'replace' );
1702
+
1703
+ $license_status = false;
1704
+ if ( is_callable( 'BSF_License_Manager::bsf_is_active_license' ) ) {
1705
+ $license_status = BSF_License_Manager::bsf_is_active_license( 'astra-pro-sites' );
1706
+ }
1707
+
1708
+ /* translators: %s are link. */
1709
+ $license_msg = sprintf( __( 'This is a premium template available with Essential Bundle and Growth Bundle. you can purchase it from <a href="%s" target="_blank">here</a>.', 'astra-sites' ), 'https://wpastra.com/starter-templates-plans/' );
1710
+
1711
+ if ( defined( 'ASTRA_PRO_SITES_NAME' ) ) {
1712
+ /* translators: %s are link. */
1713
+ $license_msg = sprintf( __( 'This is a premium template available with Essential Bundle and Growth Bundle. <a href="%s" target="_blank">Validate Your License</a> Key to import this template.', 'astra-sites' ), esc_url( admin_url( 'plugins.php?bsf-inline-license-form=astra-pro-sites' ) ) );
1714
+ }
1715
+
1716
+ $data = apply_filters(
1717
+ 'astra_sites_render_localize_vars',
1718
+ array(
1719
+ 'plugin_name' => Astra_Sites_White_Label::get_instance()->get_white_label_name(),
1720
+ 'sites' => astra_sites_get_api_params(),
1721
+ 'settings' => array(),
1722
+ 'page-builders' => array(),
1723
+ 'categories' => array(),
1724
+ 'default_page_builder' => 'elementor',
1725
+ 'astra_blocks' => $this->get_all_blocks(),
1726
+ 'license_status' => $license_status,
1727
+ 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
1728
+ 'default_page_builder_sites' => Astra_Sites_Page::get_instance()->get_sites_by_page_builder( 'elementor' ),
1729
+ 'ApiURL' => $this->api_url,
1730
+ '_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
1731
+ 'isPro' => defined( 'ASTRA_PRO_SITES_NAME' ) ? true : false,
1732
+ 'license_msg' => $license_msg,
1733
+ 'isWhiteLabeled' => Astra_Sites_White_Label::get_instance()->is_white_labeled(),
1734
+ 'getProText' => __( 'Get Access!', 'astra-sites' ),
1735
+ 'getProURL' => esc_url( 'https://wpastra.com/starter-templates-plans/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=wp-dashboard' ),
1736
+ 'astra_block_categories' => $this->get_api_option( 'astra-blocks-categories' ),
1737
+ 'siteURL' => site_url(),
1738
+ 'template' => esc_html__( 'Template', 'astra-sites' ),
1739
+ 'block' => esc_html__( 'Block', 'astra-sites' ),
1740
+ 'dismiss_text' => esc_html__( 'Dismiss', 'astra-sites' ),
1741
+ 'install_plugin_text' => esc_html__( 'Install Required Plugins', 'astra-sites' ),
1742
+ 'syncCompleteMessage' => self::get_instance()->get_sync_complete_message(),
1743
+ /* translators: %s are link. */
1744
+ 'page_settings' => array(
1745
+ 'message' => __( 'You can locate <strong>Starter Templates Settings</strong> under the <strong>Page Settings</strong> of the Style Tab.', 'astra-sites' ),
1746
+ 'url' => '#',
1747
+ 'url_text' => __( 'Read More →', 'astra-sites' ),
1748
+ ),
1749
+ )
1750
+ );
1751
+
1752
+ wp_localize_script( 'astra-sites-elementor-admin-page', 'astraElementorSites', $data );
1753
+ }
1754
+
1755
+ /**
1756
+ * Register module required js on elementor's action.
1757
+ *
1758
+ * @since 2.0.0
1759
+ */
1760
+ public function popup_styles() {
1761
+
1762
+ wp_enqueue_style( 'astra-sites-elementor-admin-page', ASTRA_SITES_URI . 'inc/assets/css/elementor-admin.css', ASTRA_SITES_VER, true );
1763
+ wp_enqueue_style( 'astra-sites-elementor-admin-page-dark', ASTRA_SITES_URI . 'inc/assets/css/elementor-admin-dark.css', ASTRA_SITES_VER, true );
1764
+ wp_style_add_data( 'astra-sites-elementor-admin-page', 'rtl', 'replace' );
1765
+
1766
+ }
1767
+
1768
+ /**
1769
+ * Get all sites
1770
+ *
1771
+ * @since 2.0.0
1772
+ * @return array All sites.
1773
+ */
1774
+ public function get_all_sites() {
1775
+ $sites_and_pages = array();
1776
+ $total_requests = (int) get_site_option( 'astra-sites-requests', 0 );
1777
+
1778
+ for ( $page = 1; $page <= $total_requests; $page++ ) {
1779
+ $current_page_data = get_site_option( 'astra-sites-and-pages-page-' . $page, array() );
1780
+ if ( ! empty( $current_page_data ) ) {
1781
+ foreach ( $current_page_data as $page_id => $page_data ) {
1782
+ $sites_and_pages[ $page_id ] = $page_data;
1783
+ }
1784
+ }
1785
+ }
1786
+
1787
+ return $sites_and_pages;
1788
+ }
1789
+
1790
+ /**
1791
+ * Get all sites
1792
+ *
1793
+ * @since 2.2.4
1794
+ * @param array $option Site options name.
1795
+ * @return array Site Option value.
1796
+ */
1797
+ public function get_api_option( $option ) {
1798
+ return get_site_option( $option, array() );
1799
+ }
1800
+
1801
+ /**
1802
+ * Get all blocks
1803
+ *
1804
+ * @since 2.0.0
1805
+ * @return array All Elementor Blocks.
1806
+ */
1807
+ public function get_all_blocks() {
1808
+
1809
+ $blocks = array();
1810
+ $total_requests = (int) get_site_option( 'astra-blocks-requests', 0 );
1811
+
1812
+ for ( $page = 1; $page <= $total_requests; $page++ ) {
1813
+ $current_page_data = get_site_option( 'astra-blocks-' . $page, array() );
1814
+ if ( ! empty( $current_page_data ) ) {
1815
+ foreach ( $current_page_data as $page_id => $page_data ) {
1816
+ $blocks[ $page_id ] = $page_data;
1817
+ }
1818
+ }
1819
+ }
1820
+
1821
+ return $blocks;
1822
+ }
1823
+
1824
+ /**
1825
+ * Load all the required files in the importer.
1826
+ *
1827
+ * @since 1.0.0
1828
+ */
1829
+ private function includes() {
1830
+
1831
+ require_once ASTRA_SITES_DIR . 'inc/classes/functions.php';
1832
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-white-label.php';
1833
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-page.php';
1834
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-elementor-pages.php';
1835
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-elementor-images.php';
1836
+ require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/class-astra-sites-compatibility.php';
1837
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-importer.php';
1838
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-wp-cli.php';
1839
+ require_once ASTRA_SITES_DIR . 'inc/lib/class-astra-sites-ast-block-templates.php';
1840
+ require_once ASTRA_SITES_DIR . 'inc/lib/onboarding/class-onboarding.php';
1841
+
1842
+ // Batch Import.
1843
+ require_once ASTRA_SITES_DIR . 'inc/classes/batch-import/class-astra-sites-batch-import.php';
1844
+ }
1845
+
1846
+ /**
1847
+ * Required Plugin Activate
1848
+ *
1849
+ * @since 2.0.0 Added parameters $init, $options & $enabled_extensions to add the WP CLI support.
1850
+ * @since 1.0.0
1851
+ * @param string $init Plugin init file.
1852
+ * @param array $options Site options.
1853
+ * @param array $enabled_extensions Enabled extensions.
1854
+ * @return void
1855
+ */
1856
+ public function required_plugin_activate( $init = '', $options = array(), $enabled_extensions = array() ) {
1857
+
1858
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
1859
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
1860
+
1861
+ if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) {
1862
+ wp_send_json_error(
1863
+ array(
1864
+ 'success' => false,
1865
+ 'message' => __( 'Error: You don\'t have the required permissions to install plugins.', 'astra-sites' ),
1866
+ )
1867
+ );
1868
+ }
1869
+ }
1870
+
1871
+ $plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : $init;
1872
+
1873
+ wp_clean_plugins_cache();
1874
+
1875
+ $activate = activate_plugin( $plugin_init, '', false, true );
1876
+
1877
+ if ( is_wp_error( $activate ) ) {
1878
+ if ( defined( 'WP_CLI' ) ) {
1879
+ WP_CLI::error( 'Plugin Activation Error: ' . $activate->get_error_message() );
1880
+ } elseif ( wp_doing_ajax() ) {
1881
+ wp_send_json_error(
1882
+ array(
1883
+ 'success' => false,
1884
+ 'message' => $activate->get_error_message(),
1885
+ )
1886
+ );
1887
+ }
1888
+ }
1889
+
1890
+ $options = astra_get_site_data( 'astra-site-options-data' );
1891
+ $enabled_extensions = astra_get_site_data( 'astra-enabled-extensions' );
1892
+
1893
+ $this->after_plugin_activate( $plugin_init, $options, $enabled_extensions );
1894
+
1895
+ if ( defined( 'WP_CLI' ) ) {
1896
+ WP_CLI::line( 'Plugin Activated!' );
1897
+ } elseif ( wp_doing_ajax() ) {
1898
+ wp_send_json_success(
1899
+ array(
1900
+ 'success' => true,
1901
+ 'message' => __( 'Plugin Activated', 'astra-sites' ),
1902
+ )
1903
+ );
1904
+ }
1905
+ }
1906
+
1907
+ /**
1908
+ * Required Plugins
1909
+ *
1910
+ * @since 2.0.0
1911
+ *
1912
+ * @param array $required_plugins Required Plugins.
1913
+ * @param array $options Site Options.
1914
+ * @param array $enabled_extensions Enabled Extensions.
1915
+ * @return mixed
1916
+ */
1917
+ public function required_plugin( $required_plugins = array(), $options = array(), $enabled_extensions = array() ) {
1918
+
1919
+ // Verify Nonce.
1920
+ if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
1921
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
1922
+ }
1923
+
1924
+ $response = array(
1925
+ 'active' => array(),
1926
+ 'inactive' => array(),
1927
+ 'notinstalled' => array(),
1928
+ );
1929
+
1930
+ $options = astra_get_site_data( 'astra-site-options-data' );
1931
+ $enabled_extensions = astra_get_site_data( 'astra-enabled-extensions' );
1932
+ $required_plugins = astra_get_site_data( 'required-plugins' );
1933
+ $learndash_course_grid = 'https://www.learndash.com/add-on/course-grid/';
1934
+ $learndash_woocommerce = 'https://www.learndash.com/add-on/woocommerce/';
1935
+ if ( is_plugin_active( 'sfwd-lms/sfwd_lms.php' ) ) {
1936
+ $learndash_addons_url = admin_url( 'admin.php?page=learndash_lms_addons' );
1937
+ $learndash_course_grid = $learndash_addons_url;
1938
+ $learndash_woocommerce = $learndash_addons_url;
1939
+ }
1940
+
1941
+ $third_party_required_plugins = array();
1942
+ $third_party_plugins = array(
1943
+ 'sfwd-lms' => array(
1944
+ 'init' => 'sfwd-lms/sfwd_lms.php',
1945
+ 'name' => 'LearnDash LMS',
1946
+ 'link' => 'https://www.learndash.com/',
1947
+ ),
1948
+ 'learndash-course-grid' => array(
1949
+ 'init' => 'learndash-course-grid/learndash_course_grid.php',
1950
+ 'name' => 'LearnDash Course Grid',
1951
+ 'link' => $learndash_course_grid,
1952
+ ),
1953
+ 'learndash-woocommerce' => array(
1954
+ 'init' => 'learndash-woocommerce/learndash_woocommerce.php',
1955
+ 'name' => 'LearnDash WooCommerce Integration',
1956
+ 'link' => $learndash_woocommerce,
1957
+ ),
1958
+ );
1959
+
1960
+ $plugin_updates = get_plugin_updates();
1961
+ $update_avilable_plugins = array();
1962
+
1963
+ if ( ! empty( $required_plugins ) ) {
1964
+ foreach ( $required_plugins as $key => $plugin ) {
1965
+
1966
+ $plugin = (array) $plugin;
1967
+
1968
+ /**
1969
+ * Has Pro Version Support?
1970
+ * And
1971
+ * Is Pro Version Installed?
1972
+ */
1973
+ $plugin_pro = $this->pro_plugin_exist( $plugin['init'] );
1974
+ if ( $plugin_pro ) {
1975
+
1976
+ if ( array_key_exists( $plugin_pro['init'], $plugin_updates ) ) {
1977
+ $update_avilable_plugins[] = $plugin_pro;
1978
+ }
1979
+
1980
+ // Pro - Active.
1981
+ if ( is_plugin_active( $plugin_pro['init'] ) ) {
1982
+ $response['active'][] = $plugin_pro;
1983
+
1984
+ $this->after_plugin_activate( $plugin['init'], $options, $enabled_extensions );
1985
+
1986
+ // Pro - Inactive.
1987
+ } else {
1988
+ $response['inactive'][] = $plugin_pro;
1989
+ }
1990
+ } else {
1991
+ if ( array_key_exists( $plugin['init'], $plugin_updates ) ) {
1992
+ $update_avilable_plugins[] = $plugin;
1993
+ }
1994
+
1995
+ // Lite - Installed but Inactive.
1996
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) && is_plugin_inactive( $plugin['init'] ) ) {
1997
+
1998
+ $response['inactive'][] = $plugin;
1999
+
2000
+ // Lite - Not Installed.
2001
+ } elseif ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin['init'] ) ) {
2002
+
2003
+ // Added premium plugins which need to install first.
2004
+ if ( array_key_exists( $plugin['slug'], $third_party_plugins ) ) {
2005
+ $third_party_required_plugins[] = $third_party_plugins[ $plugin['slug'] ];
2006
+ } else {
2007
+ $response['notinstalled'][] = $plugin;
2008
+ }
2009
+
2010
+ // Lite - Active.
2011
+ } else {
2012
+ $response['active'][] = $plugin;
2013
+
2014
+ $this->after_plugin_activate( $plugin['init'], $options, $enabled_extensions );
2015
+ }
2016
+ }
2017
+ }
2018
+ }
2019
+
2020
+ // Checking the `install_plugins` and `activate_plugins` capability for the current user.
2021
+ // To perform plugin installation process.
2022
+ if (
2023
+ ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) &&
2024
+ ( ( ! current_user_can( 'install_plugins' ) && ! empty( $response['notinstalled'] ) ) || ( ! current_user_can( 'activate_plugins' ) && ! empty( $response['inactive'] ) ) ) ) {
2025
+ $message = __( 'Insufficient Permission. Please contact your Super Admin to allow the install required plugin permissions.', 'astra-sites' );
2026
+ $required_plugins_list = array_merge( $response['notinstalled'], $response['inactive'] );
2027
+ $markup = $message;
2028
+ $markup .= '<ul>';
2029
+ foreach ( $required_plugins_list as $key => $required_plugin ) {
2030
+ $markup .= '<li>' . esc_html( $required_plugin['name'] ) . '</li>';
2031
+ }
2032
+ $markup .= '</ul>';
2033
+
2034
+ wp_send_json_error( $markup );
2035
+ }
2036
+
2037
+ $data = array(
2038
+ 'required_plugins' => $response,
2039
+ 'third_party_required_plugins' => $third_party_required_plugins,
2040
+ 'update_avilable_plugins' => $update_avilable_plugins,
2041
+ );
2042
+
2043
+ if ( wp_doing_ajax() ) {
2044
+ wp_send_json_success( $data );
2045
+ } else {
2046
+ return $data;
2047
+ }
2048
+ }
2049
+
2050
+ /**
2051
+ * After Plugin Activate
2052
+ *
2053
+ * @since 2.0.0
2054
+ *
2055
+ * @param string $plugin_init Plugin Init File.
2056
+ * @param array $options Site Options.
2057
+ * @param array $enabled_extensions Enabled Extensions.
2058
+ * @return void
2059
+ */
2060
+ public function after_plugin_activate( $plugin_init = '', $options = array(), $enabled_extensions = array() ) {
2061
+ $data = array(
2062
+ 'astra_site_options' => $options,
2063
+ 'enabled_extensions' => $enabled_extensions,
2064
+ );
2065
+
2066
+ do_action( 'astra_sites_after_plugin_activation', $plugin_init, $data );
2067
+ }
2068
+
2069
+ /**
2070
+ * Has Pro Version Support?
2071
+ * And
2072
+ * Is Pro Version Installed?
2073
+ *
2074
+ * Check Pro plugin version exist of requested plugin lite version.
2075
+ *
2076
+ * Eg. If plugin 'BB Lite Version' required to import demo. Then we check the 'BB Agency Version' is exist?
2077
+ * If yes then we only 'Activate' Agency Version. [We couldn't install agency version.]
2078
+ * Else we 'Activate' or 'Install' Lite Version.
2079
+ *
2080
+ * @since 1.0.1
2081
+ *
2082
+ * @param string $lite_version Lite version init file.
2083
+ * @return mixed Return false if not installed or not supported by us
2084
+ * else return 'Pro' version details.
2085
+ */
2086
+ public function pro_plugin_exist( $lite_version = '' ) {
2087
+
2088
+ // Lite init => Pro init.
2089
+ $plugins = apply_filters(
2090
+ 'astra_sites_pro_plugin_exist',
2091
+ array(
2092
+ 'beaver-builder-lite-version/fl-builder.php' => array(
2093
+ 'slug' => 'bb-plugin',
2094
+ 'init' => 'bb-plugin/fl-builder.php',
2095
+ 'name' => 'Beaver Builder Plugin',
2096
+ ),
2097
+ 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' => array(
2098
+ 'slug' => 'bb-ultimate-addon',
2099
+ 'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
2100
+ 'name' => 'Ultimate Addon for Beaver Builder',
2101
+ ),
2102
+ 'wpforms-lite/wpforms.php' => array(
2103
+ 'slug' => 'wpforms',
2104
+ 'init' => 'wpforms/wpforms.php',
2105
+ 'name' => 'WPForms',
2106
+ ),
2107
+ ),
2108
+ $lite_version
2109
+ );
2110
+
2111
+ if ( isset( $plugins[ $lite_version ] ) ) {
2112
+
2113
+ // Pro plugin directory exist?
2114
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $plugins[ $lite_version ]['init'] ) ) {
2115
+ return $plugins[ $lite_version ];
2116
+ }
2117
+ }
2118
+
2119
+ return false;
2120
+ }
2121
+
2122
+ /**
2123
+ * Get Default Page Builders
2124
+ *
2125
+ * @since 2.0.0
2126
+ * @return array
2127
+ */
2128
+ public function get_default_page_builders() {
2129
+ return array(
2130
+ array(
2131
+ 'id' => 42,
2132
+ 'slug' => 'gutenberg',
2133
+ 'name' => 'Gutenberg',
2134
+ ),
2135
+ array(
2136
+ 'id' => 33,
2137
+ 'slug' => 'elementor',
2138
+ 'name' => 'Elementor',
2139
+ ),
2140
+ array(
2141
+ 'id' => 34,
2142
+ 'slug' => 'beaver-builder',
2143
+ 'name' => 'Beaver Builder',
2144
+ ),
2145
+ array(
2146
+ 'id' => 41,
2147
+ 'slug' => 'brizy',
2148
+ 'name' => 'Brizy',
2149
+ ),
2150
+ );
2151
+ }
2152
+
2153
+ /**
2154
+ * Get Page Builders
2155
+ *
2156
+ * @since 2.0.0
2157
+ * @return array
2158
+ */
2159
+ public function get_page_builders() {
2160
+ return $this->get_default_page_builders();
2161
+ }
2162
+
2163
+ /**
2164
+ * Get Page Builder Filed
2165
+ *
2166
+ * @since 2.0.0
2167
+ * @param string $page_builder Page Bulider.
2168
+ * @param string $field Field name.
2169
+ * @return mixed
2170
+ */
2171
+ public function get_page_builder_field( $page_builder = '', $field = '' ) {
2172
+ if ( empty( $page_builder ) ) {
2173
+ return '';
2174
+ }
2175
+
2176
+ $page_builders = self::get_instance()->get_page_builders();
2177
+ if ( empty( $page_builders ) ) {
2178
+ return '';
2179
+ }
2180
+
2181
+ foreach ( $page_builders as $key => $current_page_builder ) {
2182
+ if ( $page_builder === $current_page_builder['slug'] ) {
2183
+ if ( isset( $current_page_builder[ $field ] ) ) {
2184
+ return $current_page_builder[ $field ];
2185
+ }
2186
+ }
2187
+ }
2188
+
2189
+ return '';
2190
+ }
2191
+
2192
+ /**
2193
+ * Get License Key
2194
+ *
2195
+ * @since 2.0.0
2196
+ * @return array
2197
+ */
2198
+ public function get_license_key() {
2199
+ if ( class_exists( 'BSF_License_Manager' ) ) {
2200
+ if ( BSF_License_Manager::bsf_is_active_license( 'astra-pro-sites' ) ) {
2201
+ return BSF_License_Manager::instance()->bsf_get_product_info( 'astra-pro-sites', 'purchase_key' );
2202
+ }
2203
+ }
2204
+
2205
+ return '';
2206
+ }
2207
+
2208
+ /**
2209
+ * Get Sync Complete Message
2210
+ *
2211
+ * @since 2.0.0
2212
+ * @param boolean $echo Echo the message.
2213
+ * @return mixed
2214
+ */
2215
+ public function get_sync_complete_message( $echo = false ) {
2216
+
2217
+ $message = __( 'Template library refreshed!', 'astra-sites' );
2218
+
2219
+ if ( $echo ) {
2220
+ echo esc_html( $message );
2221
+ } else {
2222
+ return esc_html( $message );
2223
+ }
2224
+ }
2225
+
2226
+ /**
2227
+ * Get an instance of WP_Filesystem_Direct.
2228
+ *
2229
+ * @since 2.0.0
2230
+ * @return object A WP_Filesystem_Direct instance.
2231
+ */
2232
+ public static function get_filesystem() {
2233
+ global $wp_filesystem;
2234
+
2235
+ require_once ABSPATH . '/wp-admin/includes/file.php';
2236
+
2237
+ WP_Filesystem();
2238
+
2239
+ return $wp_filesystem;
2240
+ }
2241
+ }
2242
+
2243
+ /**
2244
+ * Kicking this off by calling 'get_instance()' method
2245
+ */
2246
+ Astra_Sites::get_instance();
2247
+
2248
+ endif;
astra-sites/inc/classes/compatibility/astra-pro/class-astra-sites-compatibility-astra-pro.php ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites Compatibility for 'Astra Pro'
4
+ *
5
+ * @see https://wordpress.org/plugins/astra-pro/
6
+ *
7
+ * @package Astra Sites
8
+ * @since 1.0.0
9
+ */
10
+
11
+ if ( ! class_exists( 'Astra_Sites_Compatibility_Astra_Pro' ) ) :
12
+
13
+ /**
14
+ * Astra_Sites_Compatibility_Astra_Pro
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class Astra_Sites_Compatibility_Astra_Pro {
19
+
20
+ /**
21
+ * Instance
22
+ *
23
+ * @access private
24
+ * @var object Class object.
25
+ * @since 1.0.0
26
+ */
27
+ private static $instance;
28
+
29
+ /**
30
+ * Initiator
31
+ *
32
+ * @since 1.0.0
33
+ * @return object initialized object of class.
34
+ */
35
+ public static function get_instance() {
36
+ if ( ! isset( self::$instance ) ) {
37
+ self::$instance = new self();
38
+ }
39
+ return self::$instance;
40
+ }
41
+
42
+ /**
43
+ * Constructor
44
+ *
45
+ * @since 1.0.0
46
+ */
47
+ public function __construct() {
48
+ add_action( 'astra_sites_after_plugin_activation', array( $this, 'astra_pro' ), 10, 2 );
49
+ add_action( 'astra_sites_import_start', array( $this, 'import_enabled_extension' ), 10, 2 );
50
+ add_action( 'astra_sites_import_complete', array( $this, 'clear_cache' ) );
51
+ }
52
+
53
+ /**
54
+ * Import
55
+ *
56
+ * @since 1.1.6
57
+ * @return void
58
+ */
59
+ public function import() {
60
+ if ( defined( 'WP_CLI' ) ) {
61
+ WP_CLI::line( 'Processing "Astra Pro" Batch Import' );
62
+ }
63
+ Astra_Sites_Importer_Log::add( '---- Processing Mapping - for Astra Pro ----' );
64
+ self::start_post_mapping();
65
+ }
66
+
67
+ /**
68
+ * Update Site Origin Active Widgets
69
+ *
70
+ * @since 1.0.0
71
+ *
72
+ * @param string $plugin_init Plugin init file.
73
+ * @param array $data Data.
74
+ * @return void
75
+ */
76
+ public function astra_pro( $plugin_init = '', $data = array() ) {
77
+
78
+ if ( 'astra-addon/astra-addon.php' === $plugin_init && ! empty( $data ) ) {
79
+
80
+ if ( is_array( $data ) ) {
81
+ $data = json_decode( wp_json_encode( $data ), true );
82
+ }
83
+
84
+ if ( isset( $data['enabled_extensions'] ) ) {
85
+ $extensions = $data['enabled_extensions'];
86
+
87
+ if ( ! empty( $extensions ) ) {
88
+ if ( is_callable( 'Astra_Admin_Helper::update_admin_settings_option' ) ) {
89
+ Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $extensions );
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Import custom 404 section.
98
+ *
99
+ * @since 1.0.0
100
+ * @param array $demo_data Site all data render from API call.
101
+ * @param array $demo_api_uri Demo URL.
102
+ */
103
+ public function import_custom_404( $demo_data = array(), $demo_api_uri = '' ) {
104
+
105
+ if ( isset( $demo_data['astra-custom-404'] ) ) {
106
+ if ( is_callable( 'Astra_Admin_Helper::update_admin_settings_option' ) ) {
107
+ $options_404 = $demo_data['astra-custom-404'];
108
+ Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_custom_404', $options_404 );
109
+ }
110
+ }
111
+ }
112
+
113
+ /**
114
+ * Import settings enabled Astra extensions from the demo.
115
+ *
116
+ * @since 1.0.0
117
+ * @param array $demo_data Site all data render from API call.
118
+ * @param array $demo_api_uri Demo URL.
119
+ */
120
+ public function import_enabled_extension( $demo_data = array(), $demo_api_uri = '' ) {
121
+
122
+ if ( isset( $demo_data['astra-enabled-extensions'] ) ) {
123
+ if ( is_callable( 'Astra_Admin_Helper::update_admin_settings_option' ) ) {
124
+ Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $demo_data['astra-enabled-extensions'] );
125
+ }
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Start post meta mapping of Astra Addon
131
+ *
132
+ * @since 1.1.6
133
+ *
134
+ * @return null If there is no import option data found.
135
+ */
136
+ public static function start_post_mapping() {
137
+ $demo_data = get_option( 'astra_sites_import_data', array() );
138
+ if ( ! isset( $demo_data['astra-post-data-mapping'] ) ) {
139
+ return;
140
+ }
141
+
142
+ $post_type = 'astra-advanced-hook';
143
+ $posts = ( isset( $demo_data['astra-post-data-mapping'][ $post_type ] ) ) ? $demo_data['astra-post-data-mapping'][ $post_type ] : array();
144
+ if ( ! empty( $posts ) ) {
145
+ foreach ( $posts as $key => $post ) {
146
+ $page = get_page_by_title( $post['post_title'], OBJECT, $post_type );
147
+ if ( is_object( $page ) ) {
148
+ if ( defined( 'WP_CLI' ) ) {
149
+ WP_CLI::line( 'Setting Location Rules for ' . $post['post_title'] );
150
+ }
151
+ self::update_location_rules( $page->ID, 'ast-advanced-hook-location', $post['mapping']['ast-advanced-hook-location'] );
152
+ }
153
+ }
154
+ }
155
+
156
+ $post_type = 'astra_adv_header';
157
+ $posts = ( isset( $demo_data['astra-post-data-mapping'][ $post_type ] ) ) ? $demo_data['astra-post-data-mapping'][ $post_type ] : array();
158
+ if ( ! empty( $posts ) ) {
159
+ foreach ( $posts as $key => $post ) {
160
+ $page = get_page_by_title( $post['post_title'], OBJECT, $post_type );
161
+ if ( is_object( $page ) ) {
162
+ if ( defined( 'WP_CLI' ) ) {
163
+ WP_CLI::line( 'Setting Location Rules for ' . $post['post_title'] );
164
+ }
165
+
166
+ self::update_location_rules( $page->ID, 'ast-advanced-headers-location', $post['mapping']['ast-advanced-headers-location'] );
167
+ self::update_location_rules( $page->ID, 'ast-advanced-headers-exclusion', $post['mapping']['ast-advanced-headers-exclusion'] );
168
+ self::update_header_mapping( $page->ID, 'ast-advanced-headers-design', $post['mapping']['ast-advanced-headers-design'] );
169
+ }
170
+ }
171
+ }
172
+ }
173
+
174
+ /**
175
+ * Update Header Mapping Data
176
+ *
177
+ * @since 1.1.6
178
+ *
179
+ * @param int $post_id Post ID.
180
+ * @param string $meta_key Post meta key.
181
+ * @param array $mapping Mapping array.
182
+ * @return void
183
+ */
184
+ public static function update_header_mapping( $post_id = '', $meta_key = '', $mapping = array() ) {
185
+ Astra_Sites_Importer_Log::add( 'Mapping "' . $meta_key . '" for ' . $post_id );
186
+ $headers_old = get_post_meta( $post_id, $meta_key, true );
187
+ $headers_new = self::get_header_mapping( $headers_old, $mapping );
188
+ update_post_meta( $post_id, $meta_key, $headers_new );
189
+ }
190
+
191
+ /**
192
+ * Update Location Rules
193
+ *
194
+ * @since 1.1.6
195
+ *
196
+ * @param int $post_id Post ID.
197
+ * @param string $meta_key Post meta key.
198
+ * @param array $mapping Mapping array.
199
+ * @return void
200
+ */
201
+ public static function update_location_rules( $post_id = '', $meta_key = '', $mapping = array() ) {
202
+ Astra_Sites_Importer_Log::add( 'Mapping "' . $meta_key . '" for ' . $post_id );
203
+ $location_new = self::get_location_mappings( $mapping );
204
+ update_post_meta( $post_id, $meta_key, $location_new );
205
+ }
206
+
207
+ /**
208
+ * Get mapping locations.
209
+ *
210
+ * @since 1.1.6
211
+ *
212
+ * @param array $location Location data.
213
+ * @return array Location mapping data.
214
+ */
215
+ public static function get_location_mappings( $location = array() ) {
216
+ if ( empty( $location ) ) {
217
+ return $location;
218
+ }
219
+
220
+ if ( ! isset( $location['specific'] ) || empty( $location['specific'] ) ) {
221
+ return $location;
222
+ }
223
+
224
+ $mapping = array();
225
+
226
+ if ( isset( $location['specific']['post'] ) ) {
227
+ foreach ( $location['specific']['post'] as $post_type => $old_post_data ) {
228
+ if ( is_array( $old_post_data ) ) {
229
+ foreach ( $old_post_data as $post_key => $post ) {
230
+ $post_object = get_page_by_path( $post['slug'] );
231
+ if ( $post_object ) {
232
+ $mapping[] = 'post-' . absint( $post_object->ID );
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+
239
+ if ( isset( $location['specific']['tax'] ) ) {
240
+ foreach ( $location['specific']['tax'] as $taxonomy_type => $old_term_data ) {
241
+ if ( is_array( $old_term_data ) ) {
242
+ foreach ( $old_term_data as $term_key => $term_data ) {
243
+ $term = get_term_by( 'slug', $term_data['slug'], $taxonomy_type );
244
+ if ( is_object( $term ) ) {
245
+ $mapping[] = 'tax-' . absint( $term->term_id );
246
+ }
247
+ }
248
+ }
249
+ }
250
+ }
251
+
252
+ $location['specific'] = $mapping;
253
+
254
+ return $location;
255
+ }
256
+
257
+ /**
258
+ * Get advanced header mapping data
259
+ *
260
+ * @since 1.1.6
261
+ *
262
+ * @param array $headers_old Header mapping stored data.
263
+ * @param array $headers_data Header mapping data.
264
+ * @return array Filtered header mapping data.
265
+ */
266
+ public static function get_header_mapping( $headers_old = array(), $headers_data = array() ) {
267
+
268
+ // Set menu location by menu slug.
269
+ if ( isset( $headers_data['menus'] ) && ! empty( $headers_data['menus'] ) ) {
270
+ foreach ( $headers_data['menus'] as $header_option_name => $menu_data ) {
271
+ $term = get_term_by( 'slug', $menu_data['slug'], 'nav_menu' );
272
+ if ( is_object( $term ) ) {
273
+ $headers_old[ $header_option_name ] = $term->term_id;
274
+ }
275
+ }
276
+ }
277
+
278
+ // Set image ID & URL after importing these on website.
279
+ if ( isset( $headers_data['images'] ) && ! empty( $headers_data['images'] ) ) {
280
+ foreach ( $headers_data['images'] as $key => $image_data ) {
281
+ if ( isset( $image_data['image'] ) && ! empty( $image_data['image'] ) ) {
282
+ $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import( $image_data['image'] );
283
+
284
+ $headers_old[ $image_data['key_map']['url'] ] = $downloaded_image['url'];
285
+ $headers_old[ $image_data['key_map']['id'] ] = $downloaded_image['id'];
286
+ }
287
+ }
288
+ }
289
+
290
+ return $headers_old;
291
+ }
292
+
293
+ /**
294
+ * Clear Cache
295
+ *
296
+ * @since 1.2.3
297
+ * @return void
298
+ */
299
+ public function clear_cache() {
300
+ if ( is_callable( 'Astra_Minify::refresh_assets' ) ) {
301
+ Astra_Minify::refresh_assets();
302
+ }
303
+ }
304
+ }
305
+
306
+ /**
307
+ * Kicking this off by calling 'get_instance()' method
308
+ */
309
+ Astra_Sites_Compatibility_Astra_Pro::get_instance();
310
+
311
+ endif;
astra-sites/inc/classes/compatibility/class-astra-sites-compatibility.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites Compatibility for 3rd party plugins.
4
+ *
5
+ * @package Astra Sites
6
+ * @since 1.0.11
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Compatibility' ) ) :
10
+
11
+ /**
12
+ * Astra Sites Compatibility
13
+ *
14
+ * @since 1.0.11
15
+ */
16
+ class Astra_Sites_Compatibility {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @access private
22
+ * @var object Class object.
23
+ * @since 1.0.11
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.0.11
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self();
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ *
43
+ * @since 1.0.11
44
+ */
45
+ public function __construct() {
46
+
47
+ // Plugin - Astra Pro.
48
+ require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/astra-pro/class-astra-sites-compatibility-astra-pro.php';
49
+
50
+ // Plugin - WooCommerce.
51
+ require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/woocommerce/class-astra-sites-compatibility-woocommerce.php';
52
+
53
+ // Plugin - LearnDash LMS.
54
+ require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/sfwd-lms/class-astra-sites-compatibility-sfwd-lms.php';
55
+
56
+ // Plugin - Elementor.
57
+ require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/elementor/class-astra-sites-compatibility-elementor.php';
58
+
59
+ // Plugin - LearnDash.
60
+ require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/learndash/class-astra-sites-compatibility-learndash.php';
61
+ }
62
+
63
+ }
64
+
65
+ /**
66
+ * Kicking this off by calling 'instance()' method
67
+ */
68
+ Astra_Sites_Compatibility::instance();
69
+
70
+ endif;
71
+
72
+
astra-sites/inc/classes/compatibility/elementor/class-astra-sites-compatibility-elementor.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites Compatibility for 'Elementor'
4
+ *
5
+ * @package Astra Sites
6
+ * @since 2.0.0
7
+ */
8
+
9
+ namespace AstraSites\Elementor;
10
+
11
+ defined( 'ABSPATH' ) || exit;
12
+
13
+ if ( ! class_exists( 'Astra_Sites_Compatibility_Elementor' ) ) :
14
+
15
+ /**
16
+ * Elementor Compatibility
17
+ *
18
+ * @since 2.0.0
19
+ */
20
+ class Astra_Sites_Compatibility_Elementor {
21
+
22
+ /**
23
+ * Instance
24
+ *
25
+ * @access private
26
+ * @var object Class object.
27
+ * @since 2.0.0
28
+ */
29
+ private static $instance;
30
+
31
+ /**
32
+ * Initiator
33
+ *
34
+ * @since 2.0.0
35
+ * @return object initialized object of class.
36
+ */
37
+ public static function get_instance() {
38
+ if ( ! isset( self::$instance ) ) {
39
+ self::$instance = new self();
40
+ }
41
+ return self::$instance;
42
+ }
43
+
44
+ /**
45
+ * Constructor
46
+ *
47
+ * @since 2.0.0
48
+ */
49
+ public function __construct() {
50
+
51
+ /**
52
+ * Add Slashes
53
+ *
54
+ * @todo Elementor already have below code which works on defining the constant `WP_LOAD_IMPORTERS`.
55
+ * After defining the constant `WP_LOAD_IMPORTERS` in WP CLI it was not works.
56
+ * Try to remove below duplicate code in future.
57
+ */
58
+ if ( ! wp_doing_ajax() || ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, '3.0.0', '>=' ) ) ) {
59
+ remove_filter( 'wp_import_post_meta', array( 'Elementor\Compatibility', 'on_wp_import_post_meta' ) );
60
+ remove_filter( 'wxr_importer.pre_process.post_meta', array( 'Elementor\Compatibility', 'on_wxr_importer_pre_process_post_meta' ) );
61
+
62
+ add_filter( 'wp_import_post_meta', array( $this, 'on_wp_import_post_meta' ) );
63
+ add_filter( 'wxr_importer.pre_process.post_meta', array( $this, 'on_wxr_importer_pre_process_post_meta' ) );
64
+ }
65
+
66
+ add_action( 'astra_sites_before_delete_imported_posts', array( $this, 'force_delete_kit' ), 10, 2 );
67
+ }
68
+
69
+ /**
70
+ * Force Delete Elementor Kit
71
+ *
72
+ * Delete the previously imported Elementor kit.
73
+ *
74
+ * @param int $post_id Post name.
75
+ * @param string $post_type Post type.
76
+ */
77
+ public function force_delete_kit( $post_id = 0, $post_type = '' ) {
78
+
79
+ if ( ! $post_id ) {
80
+ return;
81
+ }
82
+
83
+ if ( 'elementor_library' === $post_type ) {
84
+ $_GET['force_delete_kit'] = true;
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Process post meta before WP importer.
90
+ *
91
+ * Normalize Elementor post meta on import, We need the `wp_slash` in order
92
+ * to avoid the unslashing during the `add_post_meta`.
93
+ *
94
+ * Fired by `wp_import_post_meta` filter.
95
+ *
96
+ * @since 1.4.3
97
+ * @access public
98
+ *
99
+ * @param array $post_meta Post meta.
100
+ *
101
+ * @return array Updated post meta.
102
+ */
103
+ public function on_wp_import_post_meta( $post_meta ) {
104
+ foreach ( $post_meta as &$meta ) {
105
+ if ( '_elementor_data' === $meta['key'] ) {
106
+ $meta['value'] = wp_slash( $meta['value'] );
107
+ break;
108
+ }
109
+ }
110
+
111
+ return $post_meta;
112
+ }
113
+
114
+ /**
115
+ * Process post meta before WXR importer.
116
+ *
117
+ * Normalize Elementor post meta on import with the new WP_importer, We need
118
+ * the `wp_slash` in order to avoid the unslashing during the `add_post_meta`.
119
+ *
120
+ * Fired by `wxr_importer.pre_process.post_meta` filter.
121
+ *
122
+ * @since 1.4.3
123
+ * @access public
124
+ *
125
+ * @param array $post_meta Post meta.
126
+ *
127
+ * @return array Updated post meta.
128
+ */
129
+ public function on_wxr_importer_pre_process_post_meta( $post_meta ) {
130
+ if ( '_elementor_data' === $post_meta['key'] ) {
131
+ $post_meta['value'] = wp_slash( $post_meta['value'] );
132
+ }
133
+
134
+ return $post_meta;
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Kicking this off by calling 'get_instance()' method
140
+ */
141
+ Astra_Sites_Compatibility_Elementor::get_instance();
142
+
143
+ endif;
astra-sites/inc/classes/compatibility/learndash/class-astra-sites-compatibility-learndash.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Compatibility for 'LearnDash'
4
+ *
5
+ * @see https://wordpress.org/plugins/astra-pro/
6
+ *
7
+ * @package Astra Sites
8
+ * @since 2.3.8
9
+ */
10
+
11
+ // If LearnDash is not defined then return false.
12
+ if ( ! defined( 'LEARNDASH_COURSE_GRID_VERSION' ) ) {
13
+ return;
14
+ }
15
+
16
+ if ( ! class_exists( 'Astra_Sites_Compatibility_LearnDash' ) ) :
17
+
18
+ /**
19
+ * Astra Sites Compatibility LearnDash
20
+ *
21
+ * @since 2.3.8
22
+ */
23
+ class Astra_Sites_Compatibility_LearnDash {
24
+
25
+ /**
26
+ * Instance
27
+ *
28
+ * @access private
29
+ * @var object Class object.
30
+ * @since 2.3.8
31
+ */
32
+ private static $instance;
33
+
34
+ /**
35
+ * Initiator
36
+ *
37
+ * @since 2.3.8
38
+ * @return object initialized object of class.
39
+ */
40
+ public static function get_instance() {
41
+ if ( ! isset( self::$instance ) ) {
42
+ self::$instance = new self();
43
+ }
44
+ return self::$instance;
45
+ }
46
+
47
+ /**
48
+ * Constructor
49
+ *
50
+ * @since 2.3.8
51
+ */
52
+ public function __construct() {
53
+ add_filter( 'astra_sites_pre_process_post_disable_content', '__return_false' );
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Kicking this off by calling 'get_instance()' method
59
+ */
60
+ Astra_Sites_Compatibility_LearnDash::get_instance();
61
+
62
+ endif;
astra-sites/inc/classes/compatibility/sfwd-lms/class-astra-sites-compatibility-sfwd-lms.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites Compatibility for 'LearnDash LMS'
4
+ *
5
+ * @see https://www.learndash.com/
6
+ *
7
+ * @package Astra Sites
8
+ * @since 1.3.13
9
+ */
10
+
11
+ if ( ! class_exists( 'Astra_Sites_Compatibility_SFWD_LMS' ) ) :
12
+
13
+ /**
14
+ * Astra_Sites_Compatibility_SFWD_LMS
15
+ *
16
+ * @since 1.3.13
17
+ */
18
+ class Astra_Sites_Compatibility_SFWD_LMS {
19
+
20
+ /**
21
+ * Instance
22
+ *
23
+ * @access private
24
+ * @var object Class object.
25
+ * @since 1.3.13
26
+ */
27
+ private static $instance;
28
+
29
+ /**
30
+ * Initiator
31
+ *
32
+ * @since 1.3.13
33
+ * @return object initialized object of class.
34
+ */
35
+ public static function get_instance() {
36
+ if ( ! isset( self::$instance ) ) {
37
+ self::$instance = new self();
38
+ }
39
+ return self::$instance;
40
+ }
41
+
42
+ /**
43
+ * Constructor
44
+ *
45
+ * @since 1.3.13
46
+ */
47
+ public function __construct() {
48
+ add_filter( 'astra_sites_gutenberg_batch_process_post_types', array( $this, 'set_post_types' ) );
49
+ add_action( 'astra_sites_import_complete', array( $this, 'process_landing_pages_mapping' ) );
50
+ }
51
+
52
+ /**
53
+ * Set LearnDash Landing pages with respect to Cartflows.
54
+ *
55
+ * @since 2.3.2
56
+ */
57
+ public function process_landing_pages_mapping() {
58
+
59
+ $demo_data = get_option( 'astra_sites_import_data', array() );
60
+ if ( ! isset( $demo_data['astra-post-data-mapping'] ) || ! isset( $demo_data['astra-post-data-mapping']['ld_landing_pages'] ) ) {
61
+ return;
62
+ }
63
+
64
+ $index = 'ld_landing_pages';
65
+ $posts = ( isset( $demo_data['astra-post-data-mapping'][ $index ] ) ) ? $demo_data['astra-post-data-mapping'][ $index ] : array();
66
+
67
+ if ( ! empty( $posts ) ) {
68
+ foreach ( $posts as $key => $post ) {
69
+
70
+ if ( '' !== $post['landing_page'] ) {
71
+ // Get course by Title.
72
+ $course = get_page_by_title( $post['course'], OBJECT, 'sfwd-courses' );
73
+
74
+ // Get landing step by Title.
75
+ $landing_page = get_page_by_title( $post['landing_page'], OBJECT, 'cartflows_step' );
76
+
77
+ if ( is_object( $course ) && is_object( $landing_page ) ) {
78
+
79
+ if ( defined( 'WP_CLI' ) ) {
80
+ WP_CLI::line( 'Setting LearnDash - CartFlows Landing page - ' . $course->post_title . ' - ( ' . $course->ID . ' )' );
81
+ }
82
+
83
+ $ld_meta = get_post_meta( $course->ID, '_sfwd-courses', true );
84
+ $ld_meta['sfwd-courses_wcf_course_template'] = $landing_page->ID;
85
+
86
+ // Update the imported landing step to the course.
87
+ update_post_meta( $course->ID, '_sfwd-courses', $ld_meta );
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Set post types
96
+ *
97
+ * @since 1.3.13
98
+ *
99
+ * @param array $post_types Post types.
100
+ */
101
+ public function set_post_types( $post_types = array() ) {
102
+ return array_merge( $post_types, array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-topic', 'sfwd-quiz', 'sfwd-certificates', 'sfwd-assignment' ) );
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Kicking this off by calling 'get_instance()' method
108
+ */
109
+ Astra_Sites_Compatibility_SFWD_LMS::get_instance();
110
+
111
+ endif;
astra-sites/inc/classes/compatibility/woocommerce/class-astra-sites-compatibility-woocommerce.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Sites Compatibility for 'WooCommerce'
4
+ *
5
+ * @see https://wordpress.org/plugins/woocommerce/
6
+ *
7
+ * @package Astra Sites
8
+ * @since 1.1.4
9
+ */
10
+
11
+ if ( ! class_exists( 'Astra_Sites_Compatibility_WooCommerce' ) ) :
12
+
13
+ /**
14
+ * WooCommerce Compatibility
15
+ *
16
+ * @since 1.1.4
17
+ */
18
+ class Astra_Sites_Compatibility_WooCommerce {
19
+
20
+ /**
21
+ * Instance
22
+ *
23
+ * @access private
24
+ * @var object Class object.
25
+ * @since 1.1.4
26
+ */
27
+ private static $instance;
28
+
29
+ /**
30
+ * Initiator
31
+ *
32
+ * @since 1.1.4
33
+ * @return object initialized object of class.
34
+ */
35
+ public static function instance() {
36
+ if ( ! isset( self::$instance ) ) {
37
+ self::$instance = new self();
38
+ }
39
+ return self::$instance;
40
+ }
41
+
42
+ /**
43
+ * Constructor
44
+ *
45
+ * @since 1.1.4
46
+ */
47
+ public function __construct() {
48
+ add_action( 'astra_sites_import_start', array( $this, 'add_attributes' ), 10, 2 );
49
+
50
+ // WooCommerce product attributes registration.
51
+ if ( class_exists( 'WooCommerce' ) ) {
52
+ add_filter( 'wxr_importer.pre_process.term', array( $this, 'woocommerce_product_attributes_registration' ), 10, 1 );
53
+ add_action( 'astra_sites_import_complete', array( $this, 'update_wc_lookup_table' ) );
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Add product attributes.
59
+ *
60
+ * @since 1.1.4
61
+ *
62
+ * @param string $demo_data Import data.
63
+ * @param array $demo_api_uri Demo site URL.
64
+ * @return void
65
+ */
66
+ public function add_attributes( $demo_data = array(), $demo_api_uri = '' ) {
67
+ $attributes = ( isset( $demo_data['astra-site-options-data']['woocommerce_product_attributes'] ) ) ? $demo_data['astra-site-options-data']['woocommerce_product_attributes'] : array();
68
+
69
+ if ( ! empty( $attributes ) && function_exists( 'wc_create_attribute' ) ) {
70
+ foreach ( $attributes as $key => $attribute ) {
71
+ $args = array(
72
+ 'name' => $attribute['attribute_label'],
73
+ 'slug' => $attribute['attribute_name'],
74
+ 'type' => $attribute['attribute_type'],
75
+ 'order_by' => $attribute['attribute_orderby'],
76
+ 'has_archives' => $attribute['attribute_public'],
77
+ );
78
+
79
+ $id = wc_create_attribute( $args );
80
+ }
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Hook into the pre-process term filter of the content import and register the
86
+ * custom WooCommerce product attributes, so that the terms can then be imported normally.
87
+ *
88
+ * This should probably be removed once the WP importer 2.0 support is added in WooCommerce.
89
+ *
90
+ * Fixes: [WARNING] Failed to import pa_size L warnings in content import.
91
+ * Code from: woocommerce/includes/admin/class-wc-admin-importers.php (ver 2.6.9).
92
+ *
93
+ * Github issue: https://github.com/proteusthemes/one-click-demo-import/issues/71
94
+ *
95
+ * @since 3.0.0
96
+ * @param array $data The term data to import.
97
+ * @return array The unchanged term data.
98
+ */
99
+ public function woocommerce_product_attributes_registration( $data ) {
100
+ global $wpdb;
101
+
102
+ if ( strstr( $data['taxonomy'], 'pa_' ) ) {
103
+ if ( ! taxonomy_exists( $data['taxonomy'] ) ) {
104
+ $attribute_name = wc_sanitize_taxonomy_name( str_replace( 'pa_', '', $data['taxonomy'] ) );
105
+
106
+ // Create the taxonomy.
107
+ if ( ! in_array( $attribute_name, wc_get_attribute_taxonomies(), true ) ) {
108
+ $attribute = array(
109
+ 'attribute_label' => $attribute_name,
110
+ 'attribute_name' => $attribute_name,
111
+ 'attribute_type' => 'select',
112
+ 'attribute_orderby' => 'menu_order',
113
+ 'attribute_public' => 0,
114
+ );
115
+ $wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute );
116
+ delete_transient( 'wc_attribute_taxonomies' );
117
+ }
118
+
119
+ // Register the taxonomy now so that the import works!
120
+ register_taxonomy(
121
+ $data['taxonomy'],
122
+ apply_filters( 'woocommerce_taxonomy_objects_' . $data['taxonomy'], array( 'product' ) ),
123
+ apply_filters( 'woocommerce_taxonomy_args_' . $data['taxonomy'], array(
124
+ 'hierarchical' => true,
125
+ 'show_ui' => false,
126
+ 'query_var' => true,
127
+ 'rewrite' => false,
128
+ ) )
129
+ );
130
+ }
131
+ }
132
+
133
+ return $data;
134
+ }
135
+
136
+ /**
137
+ * Update WooCommerce Lookup Table.
138
+ *
139
+ * @since 3.0.0
140
+ *
141
+ * @return void
142
+ */
143
+ public function update_wc_lookup_table() {
144
+ if ( function_exists( 'wc_update_product_lookup_tables' ) ) {
145
+ if ( ! wc_update_product_lookup_tables_is_running() ) {
146
+ wc_update_product_lookup_tables();
147
+ }
148
+ }
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Kicking this off by calling 'instance()' method
154
+ */
155
+ Astra_Sites_Compatibility_WooCommerce::instance();
156
+
157
+ endif;
astra-sites/inc/classes/functions.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Functions
4
+ *
5
+ * @since 2.0.0
6
+ * @package Astra Sites
7
+ */
8
+
9
+ if ( ! function_exists( 'astra_sites_error_log' ) ) :
10
+
11
+ /**
12
+ * Error Log
13
+ *
14
+ * A wrapper function for the error_log() function.
15
+ *
16
+ * @since 2.0.0
17
+ *
18
+ * @param mixed $message Error message.
19
+ * @return void
20
+ */
21
+ function astra_sites_error_log( $message = '' ) {
22
+ if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
23
+ if ( is_array( $message ) ) {
24
+ $message = wp_json_encode( $message );
25
+ }
26
+
27
+ if ( apply_filters( 'astra_sites_debug_logs', false ) ) {
28
+ error_log( $message ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
29
+ }
30
+ }
31
+ }
32
+
33
+ endif;
34
+
35
+ if ( ! function_exists( 'astra_sites_get_suggestion_link' ) ) :
36
+ /**
37
+ *
38
+ * Get suggestion link.
39
+ *
40
+ * @since 2.6.1
41
+ *
42
+ * @return suggestion link.
43
+ */
44
+ function astra_sites_get_suggestion_link() {
45
+ $white_label_link = Astra_Sites_White_Label::get_option( 'astra-agency', 'licence' );
46
+
47
+ if ( empty( $white_label_link ) ) {
48
+ $white_label_link = 'https://wpastra.com/sites-suggestions/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=suggestions';
49
+ }
50
+ return apply_filters( 'astra_sites_suggestion_link', $white_label_link );
51
+ }
52
+ endif;
53
+
54
+ if ( ! function_exists( 'astra_sites_is_valid_image' ) ) :
55
+ /**
56
+ * Check for the valid image
57
+ *
58
+ * @param string $link The Image link.
59
+ *
60
+ * @since 2.6.2
61
+ * @return boolean
62
+ */
63
+ function astra_sites_is_valid_image( $link = '' ) {
64
+ return preg_match( '/^((https?:\/\/)|(www\.))([a-z0-9-].?)+(:[0-9]+)?\/[\w\-]+\.(jpg|png|gif|jpeg|svg)\/?$/i', $link );
65
+ }
66
+ endif;
67
+
68
+ if ( ! function_exists( 'astra_get_site_data' ) ) :
69
+ /**
70
+ * Returns the value of the index for the Site Data
71
+ *
72
+ * @param string $index The index value of the data.
73
+ *
74
+ * @since 2.6.14
75
+ * @return mixed
76
+ */
77
+ function astra_get_site_data( $index = '' ) {
78
+ $demo_data = get_option( 'astra_sites_import_data', array() );
79
+ if ( ! empty( $demo_data ) && isset( $demo_data[ $index ] ) ) {
80
+ return $demo_data[ $index ];
81
+ }
82
+ return '';
83
+ }
84
+ endif;
85
+
86
+ /**
87
+ * Check is valid URL
88
+ *
89
+ * @param string $url The site URL.
90
+ *
91
+ * @since 2.7.1
92
+ * @return string
93
+ */
94
+ function astra_sites_is_valid_url( $url = '' ) {
95
+ if ( empty( $url ) ) {
96
+ return false;
97
+ }
98
+
99
+ $parse_url = wp_parse_url( $url );
100
+ if ( empty( $parse_url ) || ! is_array( $parse_url ) ) {
101
+ return false;
102
+ }
103
+
104
+ $valid_hosts = array(
105
+ 'lh3.googleusercontent.com',
106
+ 'pixabay.com',
107
+ );
108
+
109
+ $api_domain_parse_url = wp_parse_url( Astra_Sites::get_instance()->get_api_domain() );
110
+ $valid_hosts[] = $api_domain_parse_url['host'];
111
+
112
+ // Validate host.
113
+ if ( in_array( $parse_url['host'], $valid_hosts, true ) ) {
114
+ return true;
115
+ }
116
+
117
+ return false;
118
+ }
119
+
120
+ /**
121
+ * Get API params
122
+ *
123
+ * @since 2.7.3
124
+ * @return array
125
+ */
126
+ function astra_sites_get_api_params() {
127
+ return apply_filters(
128
+ 'astra_sites_api_params', array(
129
+ 'purchase_key' => '',
130
+ 'site_url' => get_site_url(),
131
+ 'per-page' => 15,
132
+ 'template_status' => '',
133
+ )
134
+ );
135
+ }
136
+
astra-sites/inc/config/paths.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Paths
3
+ *
4
+ * Project related paths.
5
+ */
6
+
7
+ const path = require( "path" )
8
+ const fs = require( "fs" )
9
+
10
+ // Make sure any symlinks in the project folder are resolved:
11
+ const pluginDir = fs.realpathSync( process.cwd() )
12
+ const resolvePlugin = relativePath => path.resolve( pluginDir, relativePath )
13
+
14
+ // Config after eject: we're in ./config/
15
+ module.exports = {
16
+ dotenv: resolvePlugin( ".env" ),
17
+ pluginSrc: resolvePlugin( "inc/assets/js/src" ), // Plugin src folder path.
18
+ pluginBlocksJs: resolvePlugin( "inc/assets/js/src/index.js" ),
19
+ yarnLockFile: resolvePlugin( "yarn.lock" ),
20
+ pluginDist: resolvePlugin( "." ), // We are in ./dist folder already so the path '.' resolves to ./dist/.
21
+ }
astra-sites/inc/config/webpack.config.dev.js ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Webpack Configuration
3
+ *
4
+ * Working of a Webpack can be very simple or complex. This is an intenally simple
5
+ * build configuration.
6
+ *
7
+ * Webpack basics — If you are new the Webpack here's all you need to know:
8
+ * 1. Webpack is a module bundler. It bundles different JS modules together.
9
+ * 2. It needs and entry point and an ouput to process file(s) and bundle them.
10
+ * 3. By default it only understands common JavaScript but you can make it
11
+ * understand other formats by way of adding a Webpack loader.
12
+ * 4. In the file below you will find an entry point, an ouput, and a babel-loader
13
+ * that tests all .js files excluding the ones in node_modules to process the
14
+ * ESNext and make it compatible with older browsers i.e. it converts the
15
+ * ESNext (new standards of JavaScript) into old JavaScript through a loader
16
+ * by Babel.
17
+ *
18
+ * TODO: Instructions.
19
+ *
20
+ * @since 1.0.0
21
+ */
22
+
23
+ const paths = require( "./paths" )
24
+ const autoprefixer = require( "autoprefixer" )
25
+ const ExtractTextPlugin = require( "extract-text-webpack-plugin" )
26
+
27
+ const fs = require( "fs" )
28
+ const sass = require('node-sass');
29
+
30
+ // Configuration for the ExtractTextPlugin — DRY rule.
31
+ const extractConfig = {
32
+ use: [
33
+ // "postcss" loader applies autoprefixer to our CSS.
34
+ { loader: "raw-loader" },
35
+ {
36
+ loader: "postcss-loader",
37
+ options: {
38
+ ident: "postcss",
39
+ plugins: [
40
+ autoprefixer( {
41
+ browsers: [
42
+ ">1%",
43
+ "last 4 versions",
44
+ "Firefox ESR",
45
+ "not ie < 9", // React doesn't support IE8 anyway
46
+ ],
47
+ flexbox: "no-2009",
48
+ } ),
49
+ ],
50
+ },
51
+ }
52
+ ],
53
+ }
54
+
55
+ // Export configuration.
56
+ module.exports = {
57
+ entry: {
58
+ "./inc/assets/js/dist/index": paths.pluginBlocksJs, // 'name' : 'path/file.ext'.
59
+ },
60
+ output: {
61
+ // Add * filename * comments to generated require()s in the output.
62
+ pathinfo: true,
63
+ // The dist folder.
64
+ path: paths.pluginDist,
65
+ filename: "[name].js", // [name] = './assets/js/dist/blocks.build' as defined above.
66
+ },
67
+ // You may want 'eval' instead if you prefer to see the compiled output in DevTools.
68
+ devtool: "cheap-eval-source-map",
69
+ module: {
70
+ rules: [
71
+ {
72
+ test: /\.(js|jsx|mjs)$/,
73
+ exclude: /(node_modules|bower_components)/,
74
+ use: {
75
+ loader: "babel-loader",
76
+ options: {
77
+
78
+ // This is a feature of `babel-loader` for webpack (not Babel itself).
79
+ // It enables caching results in ./node_modules/.cache/babel-loader/
80
+ // directory for faster rebuilds.
81
+ cacheDirectory: true,
82
+ },
83
+ },
84
+ }
85
+ ],
86
+ },
87
+ stats: "minimal"
88
+ }
astra-sites/inc/config/webpack.config.prod.js ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Webpack Configuration
3
+ *
4
+ * Working of a Webpack can be very simple or complex. This is an intenally simple
5
+ * build configuration.
6
+ *
7
+ * Webpack basics — If you are new the Webpack here's all you need to know:
8
+ * 1. Webpack is a module bundler. It bundles different JS modules together.
9
+ * 2. It needs and entry point and an ouput to process file(s) and bundle them.
10
+ * 3. By default it only understands common JavaScript but you can make it
11
+ * understand other formats by way of adding a Webpack loader.
12
+ * 4. In the file below you will find an entry point, an ouput, and a babel-loader
13
+ * that tests all .js files excluding the ones in node_modules to process the
14
+ * ESNext and make it compatible with older browsers i.e. it converts the
15
+ * ESNext (new standards of JavaScript) into old JavaScript through a loader
16
+ * by Babel.
17
+ *
18
+ * TODO: Instructions.
19
+ *
20
+ * @since 1.0.0
21
+ */
22
+
23
+ const paths = require( "./paths" )
24
+ const webpack = require( "webpack" )
25
+ const autoprefixer = require( "autoprefixer" )
26
+ const ExtractTextPlugin = require( "extract-text-webpack-plugin" )
27
+
28
+ // Source maps are resource heavy and can cause out of memory issue for large source files.
29
+ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP === "true"
30
+
31
+ const fs = require( "fs" )
32
+ const sass = require('node-sass');
33
+
34
+ // Configuration for the ExtractTextPlugin — DRY rule.
35
+ const extractConfig = {
36
+ use: [
37
+ // "postcss" loader applies autoprefixer to our CSS.
38
+ { loader: "raw-loader" },
39
+ {
40
+ loader: "postcss-loader",
41
+ options: {
42
+ ident: "postcss",
43
+ plugins: [
44
+ autoprefixer( {
45
+ browsers: [
46
+ ">1%",
47
+ "last 4 versions",
48
+ "Firefox ESR",
49
+ "not ie < 9", // React doesn't support IE8 anyway
50
+ ],
51
+ flexbox: "no-2009",
52
+ } ),
53
+ ],
54
+ },
55
+ }
56
+ ],
57
+ }
58
+
59
+ // Export configuration.
60
+ module.exports = {
61
+ entry: {
62
+ "./inc/assets/js/dist/index": paths.pluginBlocksJs, // 'name' : 'path/file.ext'.
63
+ },
64
+ output: {
65
+ // Add /* filename */ comments to generated require()s in the output.
66
+ pathinfo: true,
67
+ // The dist folder.
68
+ path: paths.pluginDist,
69
+ filename: "[name].js", // [name] = './assets/js/dist/blocks.build' as defined above.
70
+ },
71
+ // You may want 'eval' instead if you prefer to see the compiled output in DevTools.
72
+ devtool: shouldUseSourceMap ? "source-map" : false,
73
+ module: {
74
+ rules: [
75
+ {
76
+ test: /\.(js|jsx|mjs)$/,
77
+ exclude: /(node_modules|bower_components)/,
78
+ use: {
79
+ loader: "babel-loader",
80
+ options: {
81
+
82
+ // This is a feature of `babel-loader` for webpack (not Babel itself).
83
+ // It enables caching results in ./node_modules/.cache/babel-loader/
84
+ // directory for faster rebuilds.
85
+ cacheDirectory: true,
86
+ },
87
+ },
88
+ }
89
+ ],
90
+ },
91
+ stats: "minimal"
92
+ }
astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-beaver-builder.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Batch Processing
4
+ *
5
+ * @package Astra Sites
6
+ * @since 1.0.14
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Processing_Beaver_Builder' ) ) :
10
+
11
+ /**
12
+ * Astra_Sites_Batch_Processing_Beaver_Builder
13
+ *
14
+ * @since 1.0.14
15
+ */
16
+ class Astra_Sites_Batch_Processing_Beaver_Builder {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.0.14
22
+ * @access private
23
+ * @var object Class object.
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.0.14
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+
35
+ if ( ! isset( self::$instance ) ) {
36
+ self::$instance = new self();
37
+ }
38
+ return self::$instance;
39
+ }
40
+
41
+ /**
42
+ * Constructor
43
+ *
44
+ * @since 1.0.14
45
+ */
46
+ public function __construct() {
47
+ }
48
+
49
+ /**
50
+ * Import
51
+ *
52
+ * @since 1.0.14
53
+ * @return void
54
+ */
55
+ public function import() {
56
+
57
+ if ( defined( 'WP_CLI' ) ) {
58
+ WP_CLI::line( 'Processing "Beaver Builder" Batch Import' );
59
+ }
60
+
61
+ Astra_Sites_Importer_Log::add( '---- Processing WordPress Posts / Pages - for Beaver Builder ----' );
62
+
63
+ if ( ! is_callable( 'FLBuilderModel::get_post_types' ) ) {
64
+ return;
65
+ }
66
+
67
+ $post_types = FLBuilderModel::get_post_types( 'post-types' );
68
+ if ( defined( 'WP_CLI' ) ) {
69
+ WP_CLI::line( 'For post types: ' . implode( ', ', $post_types ) );
70
+ }
71
+ if ( empty( $post_types ) && ! is_array( $post_types ) ) {
72
+ return;
73
+ }
74
+
75
+ $post_ids = Astra_Sites_Batch_Processing::get_pages( $post_types );
76
+ if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
77
+ return;
78
+ }
79
+
80
+ foreach ( $post_ids as $post_id ) {
81
+ $this->import_single_post( $post_id );
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Update post meta.
87
+ *
88
+ * @param integer $post_id Post ID.
89
+ * @return void
90
+ */
91
+ public function import_single_post( $post_id = 0 ) {
92
+
93
+ $is_bb_post = get_post_meta( $post_id, '_fl_builder_enabled', true );
94
+ if ( ! $is_bb_post ) {
95
+ return;
96
+ }
97
+
98
+ // Is page imported with Starter Sites?
99
+ // If not then skip batch process.
100
+ $imported_from_demo_site = get_post_meta( $post_id, '_astra_sites_enable_for_batch', true );
101
+ if ( ! $imported_from_demo_site ) {
102
+ return;
103
+ }
104
+
105
+ if ( defined( 'WP_CLI' ) ) {
106
+ WP_CLI::line( 'Beaver Builder - Processing page: ' . $post_id );
107
+ }
108
+ Astra_Sites_Importer_Log::add( '---- Processing WordPress Page - for Beaver Builder ---- "' . $post_id . '"' );
109
+
110
+ if ( ! empty( $post_id ) ) {
111
+
112
+ // Get page builder data.
113
+ $data = get_post_meta( $post_id, '_fl_builder_data', true );
114
+
115
+ if ( ! empty( $data ) ) {
116
+ foreach ( $data as $key => $el ) {
117
+
118
+ // Update 'row' images.
119
+ if ( 'row' === $el->type ) {
120
+ $data[ $key ]->settings = self::update_row( $el->settings );
121
+ }
122
+
123
+ // Update 'module' images.
124
+ if ( 'module' === $el->type ) {
125
+ $data[ $key ]->settings = self::update_module( $el->settings );
126
+ }
127
+
128
+ // Update 'column' images.
129
+ if ( 'column' === $el->type ) {
130
+ $data[ $key ]->settings = self::update_column( $el->settings );
131
+ }
132
+ }
133
+
134
+ // Update page builder data.
135
+ update_post_meta( $post_id, '_fl_builder_data', $data );
136
+ update_post_meta( $post_id, '_fl_builder_draft', $data );
137
+
138
+ // Clear all cache.
139
+ FLBuilderModel::delete_asset_cache_for_all_posts();
140
+ }
141
+ }
142
+
143
+ }
144
+
145
+ /**
146
+ * Import Module Images.
147
+ *
148
+ * @param object $settings Module settings object.
149
+ * @return object
150
+ */
151
+ public static function update_module( $settings ) {
152
+
153
+ // 1) Set photos.
154
+ $settings = self::import_photo( $settings );
155
+
156
+ /**
157
+ * 2) Set `$settings->data` for Only type 'image-icon'
158
+ *
159
+ * @todo Remove the condition `'image-icon' === $settings->type` if `$settings->data` is used only for the Image Icon.
160
+ */
161
+ if (
162
+ isset( $settings->data ) &&
163
+ isset( $settings->photo ) && ! empty( $settings->photo ) &&
164
+ 'image-icon' === $settings->type
165
+ ) {
166
+ $settings->data = FLBuilderPhoto::get_attachment_data( $settings->photo );
167
+ }
168
+
169
+ if ( 'uabb-wp-forms-styler' === $settings->type ) {
170
+ astra_sites_error_log( '--------WP Form Styler ID replacement start-------' );
171
+ $ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
172
+ if ( $ids_mapping ) {
173
+ // Update WP form IDs.
174
+ foreach ( $ids_mapping as $old_id => $new_id ) {
175
+ if ( isset( $settings->wp_form_id ) && $old_id === $settings->wp_form_id ) {
176
+ astra_sites_error_log( '--------WP Form Styler ID ' . $old_id . ' replaced to ' . $new_id . '-------' );
177
+ $settings->wp_form_id = $new_id;
178
+ }
179
+ }
180
+ }
181
+ astra_sites_error_log( '--------WP Form Styler ID replacement done-------' );
182
+ }
183
+
184
+ // 3) Set `list item` module images.
185
+ if ( isset( $settings->add_list_item ) ) {
186
+ foreach ( $settings->add_list_item as $key => $value ) {
187
+ $settings->add_list_item[ $key ] = self::import_photo( $value );
188
+ }
189
+ }
190
+
191
+ // 4) Set `list item` module images.
192
+ if ( isset( $settings->text ) ) {
193
+ $settings->text = self::get_wpforms_mapping( $settings->text );
194
+ } elseif ( isset( $settings->html ) ) {
195
+ $settings->html = self::get_wpforms_mapping( $settings->html );
196
+ }
197
+
198
+ return $settings;
199
+ }
200
+
201
+ /**
202
+ * Replace WP Forms shortcode.
203
+ *
204
+ * @since 2.0.0
205
+ * @param string $content Content.
206
+ * @return string Content.
207
+ */
208
+ private static function get_wpforms_mapping( $content = '' ) {
209
+ $ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
210
+ astra_sites_error_log( wp_json_encode( $ids_mapping ) );
211
+ if ( $ids_mapping ) {
212
+ // Update WP form IDs.
213
+ foreach ( $ids_mapping as $old_id => $new_id ) {
214
+ $content = str_replace( '[wpforms id="' . $old_id, '[wpforms id="' . $new_id, $content );
215
+ }
216
+ }
217
+
218
+ return $content;
219
+ }
220
+
221
+ /**
222
+ * Import Column Images.
223
+ *
224
+ * @param object $settings Column settings object.
225
+ * @return object
226
+ */
227
+ public static function update_column( $settings ) {
228
+
229
+ // 1) Set BG Images.
230
+ $settings = self::import_bg_image( $settings );
231
+
232
+ return $settings;
233
+ }
234
+
235
+ /**
236
+ * Import Row Images.
237
+ *
238
+ * @param object $settings Row settings object.
239
+ * @return object
240
+ */
241
+ public static function update_row( $settings ) {
242
+
243
+ // 1) Set BG Images.
244
+ $settings = self::import_bg_image( $settings );
245
+
246
+ return $settings;
247
+ }
248
+
249
+ /**
250
+ * Helper: Import BG Images.
251
+ *
252
+ * @param object $settings Row settings object.
253
+ * @return object
254
+ */
255
+ public static function import_bg_image( $settings ) {
256
+
257
+ if (
258
+ ( ! empty( $settings->bg_image ) && ! empty( $settings->bg_image_src ) )
259
+ ) {
260
+ $image = array(
261
+ 'url' => $settings->bg_image_src,
262
+ 'id' => $settings->bg_image,
263
+ );
264
+
265
+ $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import( $image );
266
+
267
+ $settings->bg_image_src = $downloaded_image['url'];
268
+ $settings->bg_image = $downloaded_image['id'];
269
+ }
270
+
271
+ return $settings;
272
+ }
273
+
274
+ /**
275
+ * Helper: Import Photo.
276
+ *
277
+ * @param object $settings Row settings object.
278
+ * @return object
279
+ */
280
+ public static function import_photo( $settings ) {
281
+
282
+ if ( ! empty( $settings->photo ) && ! empty( $settings->photo_src ) ) {
283
+
284
+ $image = array(
285
+ 'url' => $settings->photo_src,
286
+ 'id' => $settings->photo,
287
+ );
288
+
289
+ $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import( $image );
290
+
291
+ $settings->photo_src = $downloaded_image['url'];
292
+ $settings->photo = $downloaded_image['id'];
293
+ }
294
+
295
+ return $settings;
296
+ }
297
+
298
+
299
+ }
300
+
301
+ /**
302
+ * Kicking this off by calling 'get_instance()' method
303
+ */
304
+ Astra_Sites_Batch_Processing_Beaver_Builder::get_instance();
305
+
306
+ endif;
astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-brizy.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Batch Processing
4
+ *
5
+ * @package Astra Sites
6
+ * @since 1.2.14
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Processing_Brizy' ) ) :
10
+
11
+ /**
12
+ * Astra Sites Batch Processing Brizy
13
+ *
14
+ * @since 1.2.14
15
+ */
16
+ class Astra_Sites_Batch_Processing_Brizy {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.2.14
22
+ * @access private
23
+ * @var object Class object.
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.2.14
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+
35
+ if ( ! isset( self::$instance ) ) {
36
+ self::$instance = new self();
37
+ }
38
+ return self::$instance;
39
+ }
40
+
41
+ /**
42
+ * Constructor
43
+ *
44
+ * @since 1.2.14
45
+ */
46
+ public function __construct() {}
47
+
48
+ /**
49
+ * Import
50
+ *
51
+ * @since 1.2.14
52
+ * @return void
53
+ */
54
+ public function import() {
55
+
56
+ if ( defined( 'WP_CLI' ) ) {
57
+ WP_CLI::line( 'Processing "Brizy" Batch Import' );
58
+ }
59
+
60
+ Astra_Sites_Importer_Log::add( '---- Processing WordPress Posts / Pages - for "Brizy" ----' );
61
+
62
+ if ( ! is_callable( 'Brizy_Editor_Storage_Common::instance' ) ) {
63
+ return;
64
+ }
65
+
66
+ $post_types = Brizy_Editor_Storage_Common::instance()->get( 'post-types' );
67
+
68
+ if ( defined( 'WP_CLI' ) ) {
69
+ WP_CLI::line( 'For post types: ' . implode( ', ', $post_types ) );
70
+ }
71
+
72
+ if ( empty( $post_types ) && ! is_array( $post_types ) ) {
73
+ return;
74
+ }
75
+
76
+ $post_ids = Astra_Sites_Batch_Processing::get_pages( $post_types );
77
+ if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
78
+ return;
79
+ }
80
+
81
+ foreach ( $post_ids as $post_id ) {
82
+ $this->import_single_post( $post_id );
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Update post meta.
88
+ *
89
+ * @param integer $post_id Post ID.
90
+ * @return void
91
+ */
92
+ public function import_single_post( $post_id = 0 ) {
93
+
94
+ $is_brizy_post = get_post_meta( $post_id, 'brizy_post_uid', true );
95
+ if ( ! $is_brizy_post ) {
96
+ return;
97
+ }
98
+
99
+ // Is page imported with Starter Sites?
100
+ // If not then skip batch process.
101
+ $imported_from_demo_site = get_post_meta( $post_id, '_astra_sites_enable_for_batch', true );
102
+ if ( ! $imported_from_demo_site ) {
103
+ return;
104
+ }
105
+
106
+ if ( defined( 'WP_CLI' ) ) {
107
+ WP_CLI::line( 'Brizy - Processing page: ' . $post_id );
108
+ }
109
+
110
+ astra_sites_error_log( '---- Processing WordPress Page - for "Brizy" ---- "' . $post_id . '"' );
111
+
112
+ $ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
113
+
114
+ $json_value = null;
115
+
116
+ $post = Brizy_Editor_Post::get( (int) $post_id );
117
+ $editor_data = $post->get_editor_data();
118
+
119
+ // Empty mapping? Then return.
120
+ if ( ! empty( $ids_mapping ) ) {
121
+
122
+ // Update WPForm IDs.
123
+ astra_sites_error_log( '---- Processing WP Forms Mapping ----' );
124
+ astra_sites_error_log( $ids_mapping );
125
+
126
+ foreach ( $ids_mapping as $old_id => $new_id ) {
127
+ $editor_data = str_replace( '[wpforms id=\"' . $old_id, '[wpforms id=\"' . $new_id, $editor_data );
128
+ }
129
+ }
130
+
131
+ $post->set_editor_data( $editor_data );
132
+ $post->set_needs_compile( $post->get_needs_compile() );
133
+ $post->set_editor_version( BRIZY_EDITOR_VERSION );
134
+ $post->set_compiler_version( BRIZY_EDITOR_VERSION );
135
+ $post->set_plugin_version( BRIZY_VERSION );
136
+ $post->saveStorage();
137
+ $post->savePost();
138
+ }
139
+
140
+ }
141
+
142
+ /**
143
+ * Kicking this off by calling 'get_instance()' method
144
+ */
145
+ Astra_Sites_Batch_Processing_Brizy::get_instance();
146
+
147
+ endif;
astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-elementor.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Elementor Importer
4
+ *
5
+ * @package Astra Sites
6
+ */
7
+
8
+ namespace Elementor\TemplateLibrary;
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit; // Exit if accessed directly.
12
+ }
13
+
14
+ // If plugin - 'Elementor' not exist then return.
15
+ if ( ! class_exists( '\Elementor\Plugin' ) ) {
16
+ return;
17
+ }
18
+
19
+ use Elementor\Core\Base\Document;
20
+ use Elementor\Core\Editor\Editor;
21
+ use Elementor\DB;
22
+ use Elementor\Core\Settings\Manager as SettingsManager;
23
+ use Elementor\Core\Settings\Page\Model;
24
+ use Elementor\Modules\Library\Documents\Library_Document;
25
+ use Elementor\Plugin;
26
+ use Elementor\Utils;
27
+
28
+ /**
29
+ * Elementor template library local source.
30
+ *
31
+ * Elementor template library local source handler class is responsible for
32
+ * handling local Elementor templates saved by the user locally on his site.
33
+ *
34
+ * @since 1.2.13 Added compatibility for Elemetnor v2.5.0
35
+ * @since 1.0.0
36
+ */
37
+ class Astra_Sites_Batch_Processing_Elementor extends Source_Local {
38
+
39
+ /**
40
+ * Import
41
+ *
42
+ * @since 1.0.14
43
+ * @return void
44
+ */
45
+ public function import() {
46
+
47
+ if ( defined( 'WP_CLI' ) ) {
48
+ \WP_CLI::line( 'Processing "Elementor" Batch Import' );
49
+ }
50
+ \Astra_Sites_Importer_Log::add( '---- Processing WordPress Posts / Pages - for Elementor ----' );
51
+ $post_types = \Astra_Sites_Batch_Processing::get_post_types_supporting( 'elementor' );
52
+
53
+ if ( defined( 'WP_CLI' ) ) {
54
+ \WP_CLI::line( 'For post types: ' . implode( ', ', $post_types ) );
55
+ }
56
+ if ( empty( $post_types ) && ! is_array( $post_types ) ) {
57
+ return;
58
+ }
59
+
60
+ $post_ids = \Astra_Sites_Batch_Processing::get_pages( $post_types );
61
+ if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
62
+ return;
63
+ }
64
+
65
+ foreach ( $post_ids as $post_id ) {
66
+ $this->import_single_post( $post_id );
67
+ }
68
+ }
69
+ /**
70
+ * Update post meta.
71
+ *
72
+ * @since 1.0.14
73
+ * @param integer $post_id Post ID.
74
+ * @return void
75
+ */
76
+ public function import_single_post( $post_id = 0 ) {
77
+
78
+ $is_elementor_post = get_post_meta( $post_id, '_elementor_version', true );
79
+ if ( ! $is_elementor_post ) {
80
+ return;
81
+ }
82
+
83
+ // Is page imported with Starter Sites?
84
+ // If not then skip batch process.
85
+ $imported_from_demo_site = get_post_meta( $post_id, '_astra_sites_enable_for_batch', true );
86
+ if ( ! $imported_from_demo_site ) {
87
+ return;
88
+ }
89
+
90
+ if ( defined( 'WP_CLI' ) ) {
91
+ \WP_CLI::line( 'Elementor - Processing page: ' . $post_id );
92
+ }
93
+
94
+ \Astra_Sites_Importer_Log::add( '---- Processing WordPress Page - for Elementor ---- "' . $post_id . '"' );
95
+
96
+ if ( ! empty( $post_id ) ) {
97
+
98
+ $data = get_post_meta( $post_id, '_elementor_data', true );
99
+
100
+ \Astra_Sites_Importer_Log::add( wp_json_encode( $data ) );
101
+
102
+ if ( ! empty( $data ) ) {
103
+
104
+ // Update WP form IDs.
105
+ $ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
106
+ \Astra_Sites_Importer_Log::add( wp_json_encode( $ids_mapping ) );
107
+ if ( $ids_mapping ) {
108
+ foreach ( $ids_mapping as $old_id => $new_id ) {
109
+ $data = str_replace( '[wpforms id=\"' . $old_id, '[wpforms id=\"' . $new_id, $data );
110
+ $data = str_replace( '"select_form":"' . $old_id, '"select_form":"' . $new_id, $data );
111
+ $data = str_replace( '"form_id":"' . $old_id, '"form_id":"' . $new_id, $data );
112
+ }
113
+ }
114
+
115
+ if ( ! is_array( $data ) ) {
116
+ $data = json_decode( $data, true );
117
+ }
118
+ \Astra_Sites_Importer_Log::add( wp_json_encode( $data ) );
119
+
120
+ $document = Plugin::$instance->documents->get( $post_id );
121
+ if ( $document ) {
122
+ $data = $document->get_elements_raw_data( $data, true );
123
+ }
124
+
125
+ // Import the data.
126
+ $data = $this->process_export_import_content( $data, 'on_import' );
127
+
128
+ // Replace the site urls.
129
+ $demo_data = get_option( 'astra_sites_import_data', array() );
130
+ \Astra_Sites_Importer_Log::add( wp_json_encode( $demo_data ) );
131
+ if ( isset( $demo_data['astra-site-url'] ) ) {
132
+ $data = wp_json_encode( $data, true );
133
+ if ( ! empty( $data ) ) {
134
+ $site_url = get_site_url();
135
+ $site_url = str_replace( '/', '\/', $site_url );
136
+ $demo_site_url = 'https:' . $demo_data['astra-site-url'];
137
+ $demo_site_url = str_replace( '/', '\/', $demo_site_url );
138
+ $data = str_replace( $demo_site_url, $site_url, $data );
139
+ $data = json_decode( $data, true );
140
+ }
141
+ }
142
+
143
+ // Update processed meta.
144
+ update_metadata( 'post', $post_id, '_elementor_data', $data );
145
+ update_metadata( 'post', $post_id, '_astra_sites_hotlink_imported', true );
146
+
147
+ // !important, Clear the cache after images import.
148
+ Plugin::$instance->files_manager->clear_cache();
149
+ }
150
+ }
151
+ }
152
+ }
astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-gutenberg.php ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Batch Processing
4
+ *
5
+ * @package Astra Sites
6
+ * @since 1.2.14
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Processing_Gutenberg' ) ) :
10
+
11
+ /**
12
+ * Astra Sites Batch Processing Brizy
13
+ *
14
+ * @since 1.2.14
15
+ */
16
+ class Astra_Sites_Batch_Processing_Gutenberg {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.2.14
22
+ * @access private
23
+ * @var object Class object.
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.2.14
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+
35
+ if ( ! isset( self::$instance ) ) {
36
+ self::$instance = new self();
37
+ }
38
+ return self::$instance;
39
+ }
40
+
41
+ /**
42
+ * Constructor
43
+ *
44
+ * @since 1.2.14
45
+ */
46
+ public function __construct() {}
47
+
48
+ /**
49
+ * Allowed tags for the batch update process.
50
+ *
51
+ * @param array $allowedposttags Array of default allowable HTML tags.
52
+ * @param string|array $context The context for which to retrieve tags. Allowed values are 'post',
53
+ * 'strip', 'data', 'entities', or the name of a field filter such as
54
+ * 'pre_user_description'.
55
+ * @return array Array of allowed HTML tags and their allowed attributes.
56
+ */
57
+ public function allowed_tags_and_attributes( $allowedposttags, $context ) {
58
+
59
+ // Keep only for 'post' contenxt.
60
+ if ( 'post' === $context ) {
61
+
62
+ // <svg> tag and attributes.
63
+ $allowedposttags['svg'] = array(
64
+ 'xmlns' => true,
65
+ 'viewbox' => true,
66
+ );
67
+
68
+ // <path> tag and attributes.
69
+ $allowedposttags['path'] = array(
70
+ 'd' => true,
71
+ );
72
+ }
73
+
74
+ return $allowedposttags;
75
+ }
76
+
77
+ /**
78
+ * Import
79
+ *
80
+ * @since 1.2.14
81
+ * @return void
82
+ */
83
+ public function import() {
84
+
85
+ // Allow the SVG tags in batch update process.
86
+ add_filter( 'wp_kses_allowed_html', array( $this, 'allowed_tags_and_attributes' ), 10, 2 );
87
+
88
+ if ( defined( 'WP_CLI' ) ) {
89
+ WP_CLI::line( 'Processing "Gutenberg" Batch Import' );
90
+ }
91
+
92
+ Astra_Sites_Importer_Log::add( '---- Processing WordPress Posts / Pages - for "Gutenberg" ----' );
93
+
94
+ $post_types = apply_filters( 'astra_sites_gutenberg_batch_process_post_types', array( 'page' ) );
95
+ if ( defined( 'WP_CLI' ) ) {
96
+ WP_CLI::line( 'For post types: ' . implode( ', ', $post_types ) );
97
+ }
98
+
99
+ $post_ids = Astra_Sites_Batch_Processing::get_pages( $post_types );
100
+ if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
101
+ return;
102
+ }
103
+
104
+ foreach ( $post_ids as $post_id ) {
105
+ $this->import_single_post( $post_id );
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Update post meta.
111
+ *
112
+ * @param integer $post_id Post ID.
113
+ * @return void
114
+ */
115
+ public function import_single_post( $post_id = 0 ) {
116
+
117
+ if ( defined( 'WP_CLI' ) ) {
118
+ WP_CLI::line( 'Gutenberg - Processing page: ' . $post_id );
119
+ }
120
+
121
+ // Is page imported with Starter Sites?
122
+ // If not then skip batch process.
123
+ $imported_from_demo_site = get_post_meta( $post_id, '_astra_sites_enable_for_batch', true );
124
+ if ( ! $imported_from_demo_site ) {
125
+ return;
126
+ }
127
+
128
+ $is_elementor_page = get_post_meta( $post_id, '_elementor_version', true );
129
+ $is_beaver_builder_page = get_post_meta( $post_id, '_fl_builder_enabled', true );
130
+ $is_brizy_page = get_post_meta( $post_id, 'brizy_post_uid', true );
131
+
132
+ // If page contain Elementor, Brizy or Beaver Builder meta then skip this page.
133
+ if ( $is_elementor_page || $is_beaver_builder_page || $is_brizy_page ) {
134
+ return;
135
+ }
136
+
137
+ Astra_Sites_Importer_Log::add( '---- Processing WordPress Page - for Gutenberg ---- "' . $post_id . '"' );
138
+
139
+ $ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
140
+
141
+ // Post content.
142
+ $content = get_post_field( 'post_content', $post_id );
143
+
144
+ // Empty mapping? Then return.
145
+ if ( ! empty( $ids_mapping ) ) {
146
+ // Replace ID's.
147
+ foreach ( $ids_mapping as $old_id => $new_id ) {
148
+ $content = str_replace( '[wpforms id="' . $old_id, '[wpforms id="' . $new_id, $content );
149
+ $content = str_replace( '{"formId":"' . $old_id . '"}', '{"formId":"' . $new_id . '"}', $content );
150
+ }
151
+ }
152
+
153
+ // This replaces the category ID in UAG Post blocks.
154
+ $site_options = get_option( 'astra_sites_import_data', array() );
155
+
156
+ if ( isset( $site_options['astra-site-taxonomy-mapping'] ) ) {
157
+
158
+ $tax_mapping = $site_options['astra-site-taxonomy-mapping'];
159
+
160
+ if ( isset( $tax_mapping['post'] ) ) {
161
+
162
+ $catogory_mapping = ( isset( $tax_mapping['post']['category'] ) ) ? $tax_mapping['post']['category'] : array();
163
+
164
+ if ( is_array( $catogory_mapping ) && ! empty( $catogory_mapping ) ) {
165
+
166
+ foreach ( $catogory_mapping as $key => $value ) {
167
+
168
+ $this_site_term = get_term_by( 'slug', $value['slug'], 'category' );
169
+ if ( ! is_wp_error( $this_site_term ) && $this_site_term ) {
170
+ $content = str_replace( '"categories":"' . $value['id'], '"categories":"' . $this_site_term->term_id, $content );
171
+ $content = str_replace( '{"categories":[{"id":' . $value['id'], '{"categories":[{"id":' . $this_site_term->term_id, $content );
172
+ $content = str_replace( 'categories/' . $value['id'], 'categories/' . $this_site_term->term_id, $content );
173
+ $content = str_replace( 'categories=' . $value['id'], 'categories=' . $this_site_term->term_id, $content );
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+
180
+ // # Tweak
181
+ // Gutenberg break block markup from render. Because the '&' is updated in database with '&amp;' and it
182
+ // expects as 'u0026amp;'. So, Converted '&amp;' with 'u0026amp;'.
183
+ //
184
+ // @todo This affect for normal page content too. Detect only Gutenberg pages and process only on it.
185
+ // $content = str_replace( '&amp;', "\u0026amp;", $content );
186
+ $content = $this->get_content( $content );
187
+
188
+ // Update content.
189
+ wp_update_post(
190
+ array(
191
+ 'ID' => $post_id,
192
+ 'post_content' => $content,
193
+ )
194
+ );
195
+ }
196
+
197
+ /**
198
+ * Download and Replace hotlink images
199
+ *
200
+ * @since 2.0.0
201
+ *
202
+ * @param string $content Mixed post content.
203
+ * @return array Hotlink image array.
204
+ */
205
+ public function get_content( $content = '' ) {
206
+
207
+ $content = stripslashes( $content );
208
+
209
+ // Extract all links.
210
+ preg_match_all( '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $content, $match );
211
+
212
+ $all_links = array_unique( $match[0] );
213
+
214
+ // Not have any link.
215
+ if ( empty( $all_links ) ) {
216
+ return $content;
217
+ }
218
+
219
+ $link_mapping = array();
220
+ $image_links = array();
221
+ $other_links = array();
222
+
223
+ // Extract normal and image links.
224
+ foreach ( $all_links as $key => $link ) {
225
+ if ( astra_sites_is_valid_image( $link ) ) {
226
+
227
+ // Get all image links.
228
+ // Avoid *-150x, *-300x and *-1024x images.
229
+ if (
230
+ false === strpos( $link, '-150x' ) &&
231
+ false === strpos( $link, '-300x' ) &&
232
+ false === strpos( $link, '-1024x' )
233
+ ) {
234
+ $image_links[] = $link;
235
+ }
236
+ } else {
237
+
238
+ // Collect other links.
239
+ $other_links[] = $link;
240
+ }
241
+ }
242
+
243
+ // Step 1: Download images.
244
+ if ( ! empty( $image_links ) ) {
245
+ foreach ( $image_links as $key => $image_url ) {
246
+ // Download remote image.
247
+ $image = array(
248
+ 'url' => $image_url,
249
+ 'id' => 0,
250
+ );
251
+ $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import( $image );
252
+
253
+ // Old and New image mapping links.
254
+ $link_mapping[ $image_url ] = $downloaded_image['url'];
255
+ }
256
+ }
257
+
258
+ // Step 2: Replace the demo site URL with live site URL.
259
+ if ( ! empty( $other_links ) ) {
260
+ $demo_data = get_option( 'astra_sites_import_data', array() );
261
+ if ( isset( $demo_data['astra-site-url'] ) ) {
262
+ $site_url = get_site_url();
263
+ foreach ( $other_links as $key => $link ) {
264
+ $link_mapping[ $link ] = str_replace( 'https:' . $demo_data['astra-site-url'], $site_url, $link );
265
+ }
266
+ }
267
+ }
268
+
269
+ // Step 3: Replace mapping links.
270
+ foreach ( $link_mapping as $old_url => $new_url ) {
271
+ $content = str_replace( $old_url, $new_url, $content );
272
+
273
+ // Replace the slashed URLs if any exist.
274
+ $old_url = str_replace( '/', '/\\', $old_url );
275
+ $new_url = str_replace( '/', '/\\', $new_url );
276
+ $content = str_replace( $old_url, $new_url, $content );
277
+ }
278
+
279
+ return $content;
280
+ }
281
+
282
+ }
283
+
284
+ /**
285
+ * Kicking this off by calling 'get_instance()' method
286
+ */
287
+ Astra_Sites_Batch_Processing_Gutenberg::get_instance();
288
+
289
+ endif;
astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-importer.php ADDED
@@ -0,0 +1,405 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Batch Processing
4
+ *
5
+ * @package Astra Sites
6
+ * @since 2.0.0
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Processing_Importer' ) ) :
10
+
11
+ /**
12
+ * Astra_Sites_Batch_Processing_Importer
13
+ *
14
+ * @since 1.0.14
15
+ */
16
+ class Astra_Sites_Batch_Processing_Importer {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.0.14
22
+ * @access private
23
+ * @var object Class object.
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.0.14
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self();
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ *
43
+ * @since 1.0.14
44
+ */
45
+ public function __construct() {
46
+ }
47
+
48
+ /**
49
+ * Import All Categories and Tags
50
+ *
51
+ * @since 2.6.22
52
+ * @return void
53
+ */
54
+ public function import_all_categories_and_tags() {
55
+ astra_sites_error_log( 'Requesting Site Categories' );
56
+ update_site_option( 'astra-sites-batch-status-string', 'Requesting Site Categories', 'no' );
57
+
58
+ $api_args = array(
59
+ 'timeout' => 30,
60
+ );
61
+ $request = wp_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-content/uploads/all-site-categories.json', $api_args );
62
+ if ( ! is_wp_error( $request ) && 200 === (int) wp_remote_retrieve_response_code( $request ) ) {
63
+ $cats = json_decode( wp_remote_retrieve_body( $request ), true );
64
+
65
+ if ( isset( $cats['code'] ) ) {
66
+ $message = isset( $cats['message'] ) ? $cats['message'] : '';
67
+ if ( ! empty( $message ) ) {
68
+ astra_sites_error_log( 'HTTP Request Error: ' . $message );
69
+ } else {
70
+ astra_sites_error_log( 'HTTP Request Error!' );
71
+ }
72
+ } else {
73
+ update_site_option( 'astra-sites-all-site-categories-and-tags', $cats, 'no' );
74
+
75
+ do_action( 'astra_sites_sync_all_site_categories_and_tags', $cats );
76
+ }
77
+ }
78
+
79
+ astra_sites_error_log( 'Site Categories Imported Successfully!' );
80
+ update_site_option( 'astra-sites-batch-status-string', 'Site Categories Imported Successfully!', 'no' );
81
+ }
82
+
83
+ /**
84
+ * Import All Categories and Tags
85
+ *
86
+ * @since 2.6.22
87
+ * @return void
88
+ */
89
+ public function import_all_categories() {
90
+ astra_sites_error_log( 'Requesting Site Categories' );
91
+ update_site_option( 'astra-sites-batch-status-string', 'Requesting Site Categories', 'no' );
92
+
93
+ $api_args = array(
94
+ 'timeout' => 30,
95
+ );
96
+ $request = wp_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/astra-sites-site-category/?hide_empty=true&_fields=id,name,slug&per_page=100', $api_args );
97
+ if ( ! is_wp_error( $request ) && 200 === (int) wp_remote_retrieve_response_code( $request ) ) {
98
+ $cats = json_decode( wp_remote_retrieve_body( $request ), true );
99
+
100
+ if ( isset( $cats['code'] ) ) {
101
+ $message = isset( $cats['message'] ) ? $cats['message'] : '';
102
+ if ( ! empty( $message ) ) {
103
+ astra_sites_error_log( 'HTTP Request Error: ' . $message );
104
+ } else {
105
+ astra_sites_error_log( 'HTTP Request Error!' );
106
+ }
107
+ } else {
108
+ update_site_option( 'astra-sites-all-site-categories', $cats, 'no' );
109
+
110
+ do_action( 'astra_sites_sync_all_site_categories', $cats );
111
+ }
112
+ }
113
+
114
+ astra_sites_error_log( 'Site Categories Imported Successfully!' );
115
+ update_site_option( 'astra-sites-batch-status-string', 'Site Categories Imported Successfully!', 'no' );
116
+ }
117
+
118
+ /**
119
+ * Import Categories
120
+ *
121
+ * @since 2.0.0
122
+ * @return void
123
+ */
124
+ public function import_site_categories() {
125
+ astra_sites_error_log( 'Requesting Site Categories' );
126
+ update_site_option( 'astra-sites-batch-status-string', 'Requesting Site Categories', 'no' );
127
+
128
+ $api_args = array(
129
+ 'timeout' => 30,
130
+ );
131
+ $categories_request = wp_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/astra-sites-site-category/?hide_empty=true&_fields=id,name,slug&per_page=100', $api_args );
132
+ if ( ! is_wp_error( $categories_request ) && 200 === (int) wp_remote_retrieve_response_code( $categories_request ) ) {
133
+ $categories = json_decode( wp_remote_retrieve_body( $categories_request ), true );
134
+
135
+ if ( isset( $categories['code'] ) ) {
136
+ $message = isset( $categories['message'] ) ? $categories['message'] : '';
137
+ if ( ! empty( $message ) ) {
138
+ astra_sites_error_log( 'HTTP Request Error: ' . $message );
139
+ } else {
140
+ astra_sites_error_log( 'HTTP Request Error!' );
141
+ }
142
+ } else {
143
+ update_site_option( 'astra-sites-categories', $categories, 'no' );
144
+
145
+ do_action( 'astra_sites_sync_categories', $categories );
146
+ }
147
+ }
148
+
149
+ astra_sites_error_log( 'Site Categories Imported Successfully!' );
150
+ update_site_option( 'astra-sites-batch-status-string', 'Site Categories Imported Successfully!', 'no' );
151
+ }
152
+
153
+ /**
154
+ * Import Block Categories
155
+ *
156
+ * @since 2.0.0
157
+ * @return void
158
+ */
159
+ public function import_block_categories() {
160
+ astra_sites_error_log( 'Requesting Block Categories' );
161
+ update_site_option( 'astra-sites-batch-status-string', 'Requesting Block Categories', 'no' );
162
+
163
+ $api_args = array(
164
+ 'timeout' => 30,
165
+ );
166
+ $tags_request = wp_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/blocks-category/?_fields=id,name,slug&per_page=100&hide_empty=1', $api_args );
167
+ if ( ! is_wp_error( $tags_request ) && 200 === (int) wp_remote_retrieve_response_code( $tags_request ) ) {
168
+ $tags = json_decode( wp_remote_retrieve_body( $tags_request ), true );
169
+
170
+ if ( isset( $tags['code'] ) ) {
171
+ $message = isset( $tags['message'] ) ? $tags['message'] : '';
172
+ if ( ! empty( $message ) ) {
173
+ astra_sites_error_log( 'HTTP Request Error: ' . $message );
174
+ } else {
175
+ astra_sites_error_log( 'HTTP Request Error!' );
176
+ }
177
+ } else {
178
+ $categories = array();
179
+ foreach ( $tags as $key => $value ) {
180
+ $categories[ $value['id'] ] = $value;
181
+ }
182
+
183
+ update_site_option( 'astra-blocks-categories', $categories, 'no' );
184
+
185
+ do_action( 'astra_sites_sync_blocks_categories', $categories );
186
+ }
187
+ }
188
+
189
+ astra_sites_error_log( 'Block Categories Imported Successfully!' );
190
+ update_site_option( 'astra-sites-batch-status-string', 'Categories Imported Successfully!', 'no' );
191
+ }
192
+
193
+
194
+ /**
195
+ * Import Page Builders
196
+ *
197
+ * @since 2.0.0
198
+ * @return void
199
+ */
200
+ public function set_license_page_builder() {
201
+
202
+ astra_sites_error_log( 'Requesting License Page Builders' );
203
+
204
+ $url = add_query_arg(
205
+ array(
206
+ '_fields' => 'id,name,slug',
207
+ 'site_url' => get_site_url(),
208
+ 'purchase_key' => Astra_Sites::get_instance()->get_license_key(),
209
+ 'only_allow_page_builders' => 'true',
210
+ ),
211
+ trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/astra-site-page-builder/'
212
+ );
213
+
214
+ $api_args = array(
215
+ 'timeout' => 30,
216
+ );
217
+
218
+ $page_builder_request = wp_remote_get( $url, $api_args );
219
+ if ( ! is_wp_error( $page_builder_request ) && 200 === (int) wp_remote_retrieve_response_code( $page_builder_request ) ) {
220
+ $page_builders = json_decode( wp_remote_retrieve_body( $page_builder_request ), true );
221
+ if ( isset( $page_builders['code'] ) ) {
222
+ $message = isset( $page_builders['message'] ) ? $page_builders['message'] : '';
223
+ if ( ! empty( $message ) ) {
224
+ astra_sites_error_log( 'HTTP Request Error: ' . $message );
225
+ } else {
226
+ astra_sites_error_log( 'HTTP Request Error!' );
227
+ }
228
+ } else {
229
+ // @codingStandardsIgnoreStart
230
+ // Set mini agency page builder.
231
+ $page_builder_slugs = wp_list_pluck( $page_builders, 'slug' );
232
+ if ( in_array( 'elementor', $page_builder_slugs ) && ! in_array( 'beaver-builder', $page_builder_slugs ) ) {
233
+ update_option( 'astra-sites-license-page-builder', 'elementor', 'no' );
234
+ astra_sites_error_log( 'Set "Elementor" as License Page Builder' );
235
+ } elseif ( in_array( 'beaver-builder', $page_builder_slugs ) && ! in_array( 'elementor', $page_builder_slugs ) ) {
236
+ update_option( 'astra-sites-license-page-builder', 'beaver-builder', 'no' );
237
+ astra_sites_error_log( 'Set "Beaver Builder" as License Page Builder' );
238
+ } else {
239
+ update_option( 'astra-sites-license-page-builder', '', 'no' );
240
+ astra_sites_error_log( 'Not Set Any License Page Builder' );
241
+ }
242
+ // @codingStandardsIgnoreEnd
243
+ }
244
+ }
245
+ }
246
+
247
+ /**
248
+ * Import Page Builders
249
+ *
250
+ * @since 2.0.0
251
+ * @return void
252
+ */
253
+ public function import_page_builders() {
254
+ astra_sites_error_log( 'Requesting Page Builders' );
255
+ update_site_option( 'astra-sites-batch-status-string', 'Requesting Page Builders', 'no' );
256
+
257
+ $purchase_key = Astra_Sites::get_instance()->get_license_key();
258
+ $site_url = get_site_url();
259
+
260
+ $api_args = array(
261
+ 'timeout' => 30,
262
+ );
263
+
264
+ $page_builder_request = wp_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/astra-site-page-builder/?_fields=id,name,slug&site_url=' . $site_url . '&purchase_key=' . $purchase_key, $api_args );
265
+ if ( ! is_wp_error( $page_builder_request ) && 200 === (int) wp_remote_retrieve_response_code( $page_builder_request ) ) {
266
+ $page_builders = json_decode( wp_remote_retrieve_body( $page_builder_request ), true );
267
+
268
+ if ( isset( $page_builders['code'] ) ) {
269
+ $message = isset( $page_builders['message'] ) ? $page_builders['message'] : '';
270
+ if ( ! empty( $message ) ) {
271
+ astra_sites_error_log( 'HTTP Request Error: ' . $message );
272
+ } else {
273
+ astra_sites_error_log( 'HTTP Request Error!' );
274
+ }
275
+ } else {
276
+ update_site_option( 'astra-sites-page-builders', $page_builders, 'no' );
277
+
278
+ do_action( 'astra_sites_sync_page_builders', $page_builders );
279
+ }
280
+ }
281
+
282
+ astra_sites_error_log( 'Page Builders Imported Successfully!' );
283
+ update_site_option( 'astra-sites-batch-status-string', 'Page Builders Imported Successfully!', 'no' );
284
+ }
285
+
286
+ /**
287
+ * Import Blocks
288
+ *
289
+ * @since 2.0.0
290
+ * @param integer $page Page number.
291
+ * @return void
292
+ */
293
+ public function import_blocks( $page = 1 ) {
294
+
295
+ astra_sites_error_log( 'BLOCK: -------- ACTUAL IMPORT --------' );
296
+ $api_args = array(
297
+ 'timeout' => 30,
298
+ );
299
+ $all_blocks = array();
300
+ astra_sites_error_log( 'BLOCK: Requesting ' . $page );
301
+ update_site_option( 'astra-blocks-batch-status-string', 'Requesting for blocks page - ' . $page, 'no' );
302
+
303
+ $query_args = apply_filters(
304
+ 'astra_sites_blocks_query_args',
305
+ array(
306
+ 'page_builder' => 'elementor',
307
+ 'per_page' => 100,
308
+ 'page' => $page,
309
+ 'wireframe' => 'yes',
310
+ )
311
+ );
312
+
313
+ $api_url = add_query_arg( $query_args, trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/astra-blocks/v1/blocks/' );
314
+
315
+ $response = wp_remote_get( $api_url, $api_args );
316
+
317
+ if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
318
+ $astra_blocks = json_decode( wp_remote_retrieve_body( $response ), true );
319
+
320
+ if ( isset( $astra_blocks['code'] ) ) {
321
+ $message = isset( $astra_blocks['message'] ) ? $astra_blocks['message'] : '';
322
+ if ( ! empty( $message ) ) {
323
+ astra_sites_error_log( 'HTTP Request Error: ' . $message );
324
+ } else {
325
+ astra_sites_error_log( 'HTTP Request Error!' );
326
+ }
327
+ } else {
328
+ astra_sites_error_log( 'BLOCK: Storing data for page ' . $page . ' in option astra-blocks-' . $page );
329
+ update_site_option( 'astra-blocks-batch-status-string', 'Storing data for page ' . $page . ' in option astra-blocks-' . $page, 'no' );
330
+
331
+ update_site_option( 'astra-blocks-' . $page, $astra_blocks, 'no' );
332
+
333
+ do_action( 'astra_sites_sync_blocks', $page, $astra_blocks );
334
+ }
335
+ } else {
336
+ astra_sites_error_log( 'BLOCK: API Error: ' . $response->get_error_message() );
337
+ }
338
+
339
+ astra_sites_error_log( 'BLOCK: Complete storing data for blocks ' . $page );
340
+ update_site_option( 'astra-blocks-batch-status-string', 'Complete storing data for page ' . $page, 'no' );
341
+ }
342
+
343
+ /**
344
+ * Import
345
+ *
346
+ * @since 1.0.14
347
+ * @since 2.0.0 Added page no.
348
+ *
349
+ * @param integer $page Page number.
350
+ * @return array
351
+ */
352
+ public function import_sites( $page = 1 ) {
353
+ $api_args = array(
354
+ 'timeout' => 30,
355
+ );
356
+ $sites_and_pages = array();
357
+ astra_sites_error_log( 'Requesting ' . $page );
358
+ update_site_option( 'astra-sites-batch-status-string', 'Requesting ' . $page, 'no' );
359
+
360
+ $query_args = apply_filters(
361
+ 'astra_sites_import_sites_query_args',
362
+ array(
363
+ 'per_page' => 15,
364
+ 'page' => $page,
365
+ )
366
+ );
367
+
368
+ $api_url = add_query_arg( $query_args, trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/astra-sites/v1/sites-and-pages/' );
369
+
370
+ $response = wp_remote_get( $api_url, $api_args );
371
+ if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
372
+ $sites_and_pages = json_decode( wp_remote_retrieve_body( $response ), true );
373
+
374
+ if ( isset( $sites_and_pages['code'] ) ) {
375
+ $message = isset( $sites_and_pages['message'] ) ? $sites_and_pages['message'] : '';
376
+ if ( ! empty( $message ) ) {
377
+ astra_sites_error_log( 'HTTP Request Error: ' . $message );
378
+ } else {
379
+ astra_sites_error_log( 'HTTP Request Error!' );
380
+ }
381
+ } else {
382
+ astra_sites_error_log( 'Storing data for page ' . $page . ' in option astra-sites-and-pages-page-' . $page );
383
+ update_site_option( 'astra-sites-batch-status-string', 'Storing data for page ' . $page . ' in option astra-sites-and-pages-page-' . $page, 'no' );
384
+
385
+ update_site_option( 'astra-sites-and-pages-page-' . $page, $sites_and_pages, 'no' );
386
+
387
+ do_action( 'astra_sites_sync_sites_and_pages', $page, $sites_and_pages );
388
+ }
389
+ } else {
390
+ astra_sites_error_log( 'API Error: ' . $response->get_error_message() );
391
+ }
392
+
393
+ astra_sites_error_log( 'Complete storing data for page ' . $page );
394
+ update_site_option( 'astra-sites-batch-status-string', 'Complete storing data for page ' . $page, 'no' );
395
+
396
+ return $sites_and_pages;
397
+ }
398
+ }
399
+
400
+ /**
401
+ * Kicking this off by calling 'get_instance()' method
402
+ */
403
+ Astra_Sites_Batch_Processing_Importer::get_instance();
404
+
405
+ endif;
astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-misc.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Misc batch import tasks.
4
+ *
5
+ * @package Astra Sites
6
+ * @since 1.1.6
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Processing_Misc' ) ) :
10
+
11
+ /**
12
+ * Astra_Sites_Batch_Processing_Misc
13
+ *
14
+ * @since 1.1.6
15
+ */
16
+ class Astra_Sites_Batch_Processing_Misc {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.1.6
22
+ * @access private
23
+ * @var object Class object.
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.1.6
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+
35
+ if ( ! isset( self::$instance ) ) {
36
+ self::$instance = new self();
37
+ }
38
+ return self::$instance;
39
+ }
40
+
41
+ /**
42
+ * Constructor
43
+ *
44
+ * @since 1.1.6
45
+ */
46
+ public function __construct() {}
47
+
48
+ /**
49
+ * Import
50
+ *
51
+ * @since 1.1.6
52
+ * @return void
53
+ */
54
+ public function import() {
55
+
56
+ if ( defined( 'WP_CLI' ) ) {
57
+ WP_CLI::line( 'Processing "MISC" Batch Import' );
58
+ }
59
+
60
+ Astra_Sites_Importer_Log::add( '---- Processing MISC ----' );
61
+ self::fix_nav_menus();
62
+ }
63
+
64
+ /**
65
+ * Import Module Images.
66
+ *
67
+ * @return object
68
+ */
69
+ public static function fix_nav_menus() {
70
+
71
+ if ( defined( 'WP_CLI' ) ) {
72
+ WP_CLI::line( 'Setting Nav Menus' );
73
+ }
74
+
75
+ // Not found site data, then return.
76
+ $demo_data = get_option( 'astra_sites_import_data', array() );
77
+ if ( ! isset( $demo_data['astra-post-data-mapping'] ) ) {
78
+ return;
79
+ }
80
+
81
+ // Not found/empty XML URL, then return.
82
+ $xml_url = ( isset( $demo_data['astra-site-wxr-path'] ) ) ? esc_url( $demo_data['astra-site-wxr-path'] ) : '';
83
+ if ( empty( $xml_url ) ) {
84
+ return;
85
+ }
86
+
87
+ // Not empty site URL, then return.
88
+ $site_url = strpos( $xml_url, '/wp-content' );
89
+ if ( false === $site_url ) {
90
+ return;
91
+ }
92
+
93
+ // Get remote site URL.
94
+ $site_url = substr( $xml_url, 0, $site_url );
95
+
96
+ $post_ids = self::get_menu_post_ids();
97
+ if ( is_array( $post_ids ) ) {
98
+ foreach ( $post_ids as $post_id ) {
99
+ if ( defined( 'WP_CLI' ) ) {
100
+ WP_CLI::line( 'Post ID: ' . $post_id );
101
+ }
102
+ Astra_Sites_Importer_Log::add( 'Post ID: ' . $post_id );
103
+ $menu_url = get_post_meta( $post_id, '_menu_item_url', true );
104
+
105
+ if ( $menu_url ) {
106
+ $menu_url = str_replace( $site_url, site_url(), $menu_url );
107
+ update_post_meta( $post_id, '_menu_item_url', $menu_url );
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ /**
114
+ * Get all post id's
115
+ *
116
+ * @since 1.1.6
117
+ *
118
+ * @return array
119
+ */
120
+ public static function get_menu_post_ids() {
121
+
122
+ $args = array(
123
+ 'post_type' => 'nav_menu_item',
124
+
125
+ // Query performance optimization.
126
+ 'fields' => 'ids',
127
+ 'no_found_rows' => true,
128
+ 'post_status' => 'any',
129
+ );
130
+
131
+ $query = new WP_Query( $args );
132
+
133
+ // Have posts?
134
+ if ( $query->have_posts() ) :
135
+
136
+ return $query->posts;
137
+
138
+ endif;
139
+ return null;
140
+ }
141
+
142
+ }
143
+
144
+ /**
145
+ * Kicking this off by calling 'get_instance()' method
146
+ */
147
+ Astra_Sites_Batch_Processing_Misc::get_instance();
148
+
149
+ endif;
astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing-widgets.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Batch Processing
4
+ *
5
+ * @package Astra Sites
6
+ * @since 1.0.14
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Processing_Widgets' ) ) :
10
+
11
+ /**
12
+ * Astra_Sites_Batch_Processing_Widgets
13
+ *
14
+ * @since 1.0.14
15
+ */
16
+ class Astra_Sites_Batch_Processing_Widgets {
17
+
18
+ /**
19
+ * WP Forms.
20
+ *
21
+ * @since 2.6.22
22
+ * @var object Class object.
23
+ */
24
+ public $wpforms_ids_mapping;
25
+
26
+ /**
27
+ * Instance
28
+ *
29
+ * @since 1.0.14
30
+ * @access private
31
+ * @var object Class object.
32
+ */
33
+ private static $instance;
34
+
35
+ /**
36
+ * Initiator
37
+ *
38
+ * @since 1.0.14
39
+ * @return object initialized object of class.
40
+ */
41
+ public static function get_instance() {
42
+ if ( ! isset( self::$instance ) ) {
43
+ self::$instance = new self();
44
+ }
45
+ return self::$instance;
46
+ }
47
+
48
+ /**
49
+ * Constructor
50
+ *
51
+ * @since 1.0.14
52
+ */
53
+ public function __construct() {
54
+ }
55
+
56
+ /**
57
+ * Import
58
+ *
59
+ * @since 1.0.14
60
+ * @return void
61
+ */
62
+ public function import() {
63
+ if ( defined( 'WP_CLI' ) ) {
64
+ WP_CLI::line( 'Importing Widgets Data' );
65
+ }
66
+
67
+ // Catch mapping data.
68
+ $this->wpforms_ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
69
+
70
+ // Process image widget data.
71
+ $this->widget_media_image();
72
+
73
+ // Process text widget data.
74
+ $this->widget_text();
75
+ }
76
+
77
+ /**
78
+ * Widget Text
79
+ *
80
+ * @since 2.6.22
81
+ * @return void
82
+ */
83
+ public function widget_text() {
84
+
85
+ $data = get_option( 'widget_text', null );
86
+
87
+ if ( empty( $data ) ) {
88
+ return;
89
+ }
90
+
91
+ Astra_Sites_Importer_Log::add( '---- Processing Contact Form Mapping from Widgets -----' );
92
+
93
+ foreach ( $data as $key => $value ) {
94
+
95
+ if ( isset( $value['text'] ) && ! empty( $value['text'] ) ) {
96
+
97
+ $content = $value['text'];
98
+
99
+ // Empty mapping? Then return.
100
+ if ( ! empty( $this->wpforms_ids_mapping ) ) {
101
+ // Replace ID's.
102
+ foreach ( $this->wpforms_ids_mapping as $old_id => $new_id ) {
103
+ $content = str_replace( '[wpforms id="' . $old_id, '[wpforms id="' . $new_id, $content );
104
+ $content = str_replace( '{"formId":"' . $old_id . '"}', '{"formId":"' . $new_id . '"}', $content );
105
+ }
106
+ }
107
+
108
+ $data[ $key ]['text'] = $content;
109
+
110
+ if ( defined( 'WP_CLI' ) ) {
111
+ WP_CLI::line( 'Updating Contact Form Mapping' );
112
+ }
113
+ }
114
+ }
115
+
116
+ update_option( 'widget_text', $data );
117
+ }
118
+
119
+ /**
120
+ * Widget Media Image
121
+ *
122
+ * @since 1.0.14
123
+ * @return void
124
+ */
125
+ public function widget_media_image() {
126
+
127
+ $data = get_option( 'widget_media_image', null );
128
+
129
+ if ( empty( $data ) ) {
130
+ return;
131
+ }
132
+
133
+ Astra_Sites_Importer_Log::add( '---- Processing Images from Widgets -----' );
134
+
135
+ foreach ( $data as $key => $value ) {
136
+
137
+ if (
138
+ isset( $value['url'] ) &&
139
+ isset( $value['attachment_id'] )
140
+ ) {
141
+
142
+ $image = array(
143
+ 'url' => $value['url'],
144
+ 'id' => $value['attachment_id'],
145
+ );
146
+
147
+ $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import( $image );
148
+
149
+ $data[ $key ]['url'] = $downloaded_image['url'];
150
+ $data[ $key ]['attachment_id'] = $downloaded_image['id'];
151
+
152
+ if ( defined( 'WP_CLI' ) ) {
153
+ WP_CLI::line( 'Importing Widgets Image: ' . $value['url'] . ' | New Image ' . $downloaded_image['url'] );
154
+ }
155
+ }
156
+ }
157
+
158
+ update_option( 'widget_media_image', $data );
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Kicking this off by calling 'get_instance()' method
164
+ */
165
+ Astra_Sites_Batch_Processing_Widgets::get_instance();
166
+
167
+ endif;
astra-sites/inc/importers/batch-processing/class-astra-sites-batch-processing.php ADDED
@@ -0,0 +1,988 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Batch Processing
4
+ *
5
+ * @package Astra Sites
6
+ * @since 1.0.14
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Batch_Processing' ) ) :
10
+
11
+ /**
12
+ * Astra_Sites_Batch_Processing
13
+ *
14
+ * @since 1.0.14
15
+ */
16
+ class Astra_Sites_Batch_Processing {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.0.14
22
+ * @var object Class object.
23
+ * @access private
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Process All
29
+ *
30
+ * @since 1.0.14
31
+ * @var object Class object.
32
+ * @access public
33
+ */
34
+ public static $process_all;
35
+
36
+ /**
37
+ * Last Export Checksums
38
+ *
39
+ * @since 2.0.0
40
+ * @var object Class object.
41
+ * @access public
42
+ */
43
+ public $last_export_checksums;
44
+
45
+ /**
46
+ * Sites Importer
47
+ *
48
+ * @since 2.0.0
49
+ * @var object Class object.
50
+ * @access public
51
+ */
52
+ public static $process_site_importer;
53
+
54
+ /**
55
+ * Process Single Page
56
+ *
57
+ * @since 2.0.0
58
+ * @var object Class object.
59
+ * @access public
60
+ */
61
+ public static $process_single;
62
+
63
+ /**
64
+ * Initiator
65
+ *
66
+ * @since 1.0.14
67
+ * @return object initialized object of class.
68
+ */
69
+ public static function get_instance() {
70
+ if ( ! isset( self::$instance ) ) {
71
+ self::$instance = new self();
72
+ }
73
+ return self::$instance;
74
+ }
75
+
76
+ /**
77
+ * Constructor
78
+ *
79
+ * @since 1.0.14
80
+ */
81
+ public function __construct() {
82
+
83
+ $this->includes();
84
+
85
+ // Start image importing after site import complete.
86
+ add_filter( 'astra_sites_image_importer_skip_image', array( $this, 'skip_image' ), 10, 2 );
87
+ add_action( 'astra_sites_import_complete', array( $this, 'start_process' ) );
88
+ add_action( 'astra_sites_process_single', array( $this, 'start_process_single' ) );
89
+ add_action( 'admin_head', array( $this, 'start_importer' ) );
90
+ add_action( 'wp_ajax_astra-sites-update-library', array( $this, 'update_library' ) );
91
+ add_action( 'wp_ajax_astra-sites-update-library-complete', array( $this, 'update_library_complete' ) );
92
+ add_action( 'wp_ajax_astra-sites-import-all-categories-and-tags', array( $this, 'import_all_categories_and_tags' ) );
93
+ add_action( 'wp_ajax_astra-sites-import-all-categories', array( $this, 'import_all_categories' ) );
94
+ add_action( 'wp_ajax_astra-sites-import-block-categories', array( $this, 'import_block_categories' ) );
95
+ add_action( 'wp_ajax_astra-sites-import-page-builders', array( $this, 'import_page_builders' ) );
96
+ add_action( 'wp_ajax_astra-sites-import-blocks', array( $this, 'import_blocks' ) );
97
+ add_action( 'wp_ajax_astra-sites-get-sites-request-count', array( $this, 'sites_requests_count' ) );
98
+ add_action( 'wp_ajax_astra-sites-get-blocks-request-count', array( $this, 'blocks_requests_count' ) );
99
+ add_action( 'wp_ajax_astra-sites-import-sites', array( $this, 'import_sites' ) );
100
+ }
101
+
102
+ /**
103
+ * Include Files
104
+ *
105
+ * @since 2.5.0
106
+ */
107
+ public function includes() {
108
+ // Core Helpers - Image.
109
+ // @todo This file is required for Elementor.
110
+ // Once we implement our logic for updating elementor data then we'll delete this file.
111
+ require_once ABSPATH . 'wp-admin/includes/image.php';
112
+
113
+ // Core Helpers - Image Downloader.
114
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-astra-sites-image-importer.php';
115
+
116
+ // Core Helpers - Batch Processing.
117
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-async-request.php';
118
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-background-process.php';
119
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-background-process-astra.php';
120
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-background-process-astra-single.php';
121
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-background-process-astra-site-importer.php';
122
+
123
+ // Prepare Widgets.
124
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-widgets.php';
125
+
126
+ // Prepare Page Builders.
127
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-beaver-builder.php';
128
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-elementor.php';
129
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-gutenberg.php';
130
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-brizy.php';
131
+
132
+ // Prepare Misc.
133
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-misc.php';
134
+
135
+ // Process Importer.
136
+ require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-importer.php';
137
+
138
+ self::$process_all = new WP_Background_Process_Astra();
139
+ self::$process_single = new WP_Background_Process_Astra_Single();
140
+ self::$process_site_importer = new WP_Background_Process_Astra_Site_Importer();
141
+ }
142
+
143
+ /**
144
+ * Import All Categories
145
+ *
146
+ * @since 2.6.22
147
+ * @return void
148
+ */
149
+ public function import_all_categories() {
150
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_all_categories();
151
+ wp_send_json_success();
152
+ }
153
+
154
+ /**
155
+ * Import All Categories and Tags
156
+ *
157
+ * @since 2.6.22
158
+ * @return void
159
+ */
160
+ public function import_all_categories_and_tags() {
161
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_all_categories_and_tags();
162
+ wp_send_json_success();
163
+ }
164
+
165
+ /**
166
+ * Import Block Categories
167
+ *
168
+ * @since 2.0.0
169
+ * @return void
170
+ */
171
+ public function import_block_categories() {
172
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_block_categories();
173
+ wp_send_json_success();
174
+ }
175
+
176
+ /**
177
+ * Import Page Builders
178
+ *
179
+ * @since 2.0.0
180
+ * @return void
181
+ */
182
+ public function import_page_builders() {
183
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_page_builders();
184
+ wp_send_json_success();
185
+ }
186
+
187
+ /**
188
+ * Import Blocks
189
+ *
190
+ * @since 2.0.0
191
+ * @return void
192
+ */
193
+ public function import_blocks() {
194
+ $page_no = isset( $_POST['page_no'] ) ? absint( $_POST['page_no'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
195
+ if ( $page_no ) {
196
+ $sites_and_pages = Astra_Sites_Batch_Processing_Importer::get_instance()->import_blocks( $page_no );
197
+ wp_send_json_success();
198
+ }
199
+
200
+ wp_send_json_error();
201
+ }
202
+
203
+ /**
204
+ * Import Sites
205
+ *
206
+ * @since 2.0.0
207
+ * @return void
208
+ */
209
+ public function import_sites() {
210
+ $page_no = isset( $_POST['page_no'] ) ? absint( $_POST['page_no'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
211
+ if ( $page_no ) {
212
+ $sites_and_pages = Astra_Sites_Batch_Processing_Importer::get_instance()->import_sites( $page_no );
213
+
214
+ $page_builder_keys = wp_list_pluck( $sites_and_pages, 'astra-site-page-builder' );
215
+ $default_page_builder = Astra_Sites_Page::get_instance()->get_setting( 'page_builder' );
216
+
217
+ $current_page_builder_sites = array();
218
+ foreach ( $page_builder_keys as $site_id => $page_builder ) {
219
+ if ( $default_page_builder === $page_builder ) {
220
+ $current_page_builder_sites[ $site_id ] = $sites_and_pages[ $site_id ];
221
+ }
222
+ }
223
+
224
+ wp_send_json_success( $current_page_builder_sites );
225
+ }
226
+
227
+ wp_send_json_error();
228
+ }
229
+
230
+ /**
231
+ * Sites Requests Count
232
+ *
233
+ * @since 2.0.0
234
+ * @return void
235
+ */
236
+ public function sites_requests_count() {
237
+
238
+ // Get count.
239
+ $total_requests = $this->get_total_requests();
240
+ if ( $total_requests ) {
241
+ wp_send_json_success( $total_requests );
242
+ }
243
+
244
+ wp_send_json_error();
245
+ }
246
+
247
+ /**
248
+ * Blocks Requests Count
249
+ *
250
+ * @since 2.1.0
251
+ * @return void
252
+ */
253
+ public function blocks_requests_count() {
254
+
255
+ // Get count.
256
+ $total_requests = $this->get_total_blocks_requests();
257
+ if ( $total_requests ) {
258
+ wp_send_json_success( $total_requests );
259
+ }
260
+
261
+ wp_send_json_error();
262
+ }
263
+
264
+ /**
265
+ * Update Library Complete
266
+ *
267
+ * @since 2.0.0
268
+ * @return void
269
+ */
270
+ public function update_library_complete() {
271
+ Astra_Sites_Importer::get_instance()->update_latest_checksums();
272
+ do_action( 'starter_templates_save_sites_count_as_per_page_builder' );
273
+
274
+ update_site_option( 'astra-sites-batch-is-complete', 'no', 'no' );
275
+ update_site_option( 'astra-sites-manual-sync-complete', 'yes', 'no' );
276
+ wp_send_json_success();
277
+ }
278
+
279
+ /**
280
+ * Get Last Exported Checksum Status
281
+ *
282
+ * @since 2.0.0
283
+ * @return string Checksums Status.
284
+ */
285
+ public function get_last_export_checksums() {
286
+
287
+ $old_last_export_checksums = get_site_option( 'astra-sites-last-export-checksums', '' );
288
+
289
+ $new_last_export_checksums = $this->set_last_export_checksums();
290
+
291
+ $checksums_status = 'no';
292
+
293
+ if ( empty( $old_last_export_checksums ) ) {
294
+ $checksums_status = 'yes';
295
+ }
296
+
297
+ if ( $new_last_export_checksums !== $old_last_export_checksums ) {
298
+ $checksums_status = 'yes';
299
+ }
300
+
301
+ return apply_filters( 'astra_sites_checksums_status', $checksums_status );
302
+ }
303
+
304
+ /**
305
+ * Set Last Exported Checksum
306
+ *
307
+ * @since 2.0.0
308
+ * @return string Checksums Status.
309
+ */
310
+ public function set_last_export_checksums() {
311
+
312
+ if ( ! empty( $this->last_export_checksums ) ) {
313
+ return $this->last_export_checksums;
314
+ }
315
+
316
+ $api_args = array(
317
+ 'timeout' => 60,
318
+ );
319
+
320
+ $response = wp_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/astra-sites/v1/get-last-export-checksums', $api_args );
321
+ if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
322
+ $result = json_decode( wp_remote_retrieve_body( $response ), true );
323
+
324
+ // Set last export checksums.
325
+ if ( ! empty( $result['last_export_checksums'] ) ) {
326
+ update_site_option( 'astra-sites-last-export-checksums-latest', $result['last_export_checksums'], 'no' );
327
+
328
+ $this->last_export_checksums = $result['last_export_checksums'];
329
+ }
330
+ }
331
+
332
+ return $this->last_export_checksums;
333
+ }
334
+
335
+ /**
336
+ * Update Library
337
+ *
338
+ * @since 2.0.0
339
+ * @return void
340
+ */
341
+ public function update_library() {
342
+
343
+ if ( 'no' === $this->get_last_export_checksums() ) {
344
+ wp_send_json_success( 'updated' );
345
+ }
346
+
347
+ $status = Astra_Sites_Page::get_instance()->test_cron();
348
+ if ( is_wp_error( $status ) ) {
349
+ $import_with = 'ajax';
350
+ } else {
351
+ $import_with = 'batch';
352
+ // Process import.
353
+ $this->process_batch();
354
+ }
355
+
356
+ wp_send_json_success( $import_with );
357
+ }
358
+
359
+ /**
360
+ * Start Importer
361
+ *
362
+ * @since 2.0.0
363
+ * @return void
364
+ */
365
+ public function start_importer() {
366
+
367
+ $process_sync = apply_filters( 'astra_sites_initial_sync', true );
368
+
369
+ if ( ! $process_sync ) {
370
+ return;
371
+ }
372
+
373
+ $is_fresh_site = get_site_option( 'astra-sites-fresh-site', '' );
374
+
375
+ // Process initially for the fresh user.
376
+ if ( isset( $_GET['reset'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
377
+
378
+ // Process import.
379
+ $this->process_batch();
380
+
381
+ } elseif ( empty( $is_fresh_site ) ) {
382
+ $dir = ASTRA_SITES_DIR . 'inc/json';
383
+
384
+ // First time user save the data of sites, pages, categories etc from the JSON file.
385
+ $list_files = $this->get_default_assets();
386
+ foreach ( $list_files as $key => $file_name ) {
387
+ if ( file_exists( $dir . '/' . $file_name . '.json' ) ) {
388
+ $data = Astra_Sites::get_instance()->get_filesystem()->get_contents( $dir . '/' . $file_name . '.json' );
389
+ if ( ! empty( $data ) ) {
390
+ update_site_option( $file_name, json_decode( $data, true ) );
391
+ }
392
+ }
393
+ }
394
+
395
+ // Also, Trigger the batch to get latest data.
396
+ // If batch failed then user have at least the data from the JSON file.
397
+ $this->process_batch();
398
+
399
+ update_site_option( 'astra-sites-fresh-site', 'yes', 'no' );
400
+
401
+ // If not fresh user then trigger batch import on the transient and option
402
+ // Only on the Astra Sites page.
403
+ } else {
404
+
405
+ $current_screen = get_current_screen();
406
+
407
+ // Bail if not on Astra Sites screen.
408
+ if ( ! is_object( $current_screen ) && null === $current_screen ) {
409
+ return;
410
+ }
411
+
412
+ if ( 'appearance_page_starter-templates' === $current_screen->id ) {
413
+
414
+ // Process import.
415
+ $this->process_import();
416
+ }
417
+ }
418
+ }
419
+
420
+ /**
421
+ * Json Files Names.
422
+ *
423
+ * @since 2.6.1
424
+ * @return array
425
+ */
426
+ public function get_default_assets() {
427
+
428
+ return array(
429
+ 'astra-blocks-1',
430
+ 'astra-sites-site-category',
431
+ 'astra-sites-all-site-categories',
432
+ 'astra-blocks-4',
433
+ 'astra-sites-page-builders',
434
+ 'astra-blocks-3',
435
+ 'astra-blocks-2',
436
+ 'astra-blocks-categories',
437
+ 'astra-sites-requests',
438
+ 'astra-sites-and-pages-page-1',
439
+ 'astra-sites-and-pages-page-2',
440
+ 'astra-sites-and-pages-page-3',
441
+ 'astra-sites-and-pages-page-4',
442
+ 'astra-sites-and-pages-page-5',
443
+ 'astra-sites-and-pages-page-6',
444
+ 'astra-sites-and-pages-page-7',
445
+ 'astra-sites-and-pages-page-8',
446
+ 'astra-sites-and-pages-page-9',
447
+ 'astra-sites-and-pages-page-10',
448
+ 'astra-sites-and-pages-page-11',
449
+ 'astra-sites-and-pages-page-12',
450
+ 'astra-sites-and-pages-page-13',
451
+ 'astra-sites-and-pages-page-14',
452
+ 'astra-sites-and-pages-page-15',
453
+ 'astra-sites-and-pages-page-16',
454
+ 'astra-sites-and-pages-page-17',
455
+ 'astra-sites-and-pages-page-18',
456
+ 'astra-sites-and-pages-page-19',
457
+ 'astra-sites-and-pages-page-20',
458
+ 'astra-sites-and-pages-page-21',
459
+ 'astra-sites-and-pages-page-22',
460
+ 'astra-sites-and-pages-page-23',
461
+ 'astra-sites-and-pages-page-24',
462
+ );
463
+ }
464
+
465
+ /**
466
+ * Process Batch
467
+ *
468
+ * @since 2.0.0
469
+ * @return mixed
470
+ */
471
+ public function process_batch() {
472
+
473
+ $process_sync = apply_filters( 'astra_sites_process_sync_batch', true );
474
+
475
+ if ( ! $process_sync ) {
476
+ return;
477
+ }
478
+
479
+ if ( 'no' === $this->get_last_export_checksums() ) {
480
+ $this->log( 'Library is up to date!' );
481
+ if ( defined( 'WP_CLI' ) ) {
482
+ WP_CLI::line( 'Library is up to date!' );
483
+ }
484
+ return;
485
+ }
486
+
487
+ $status = Astra_Sites_Page::get_instance()->test_cron();
488
+ if ( is_wp_error( $status ) ) {
489
+ astra_sites_error_log( 'Error! Batch Not Start due to disabled cron events!' );
490
+ update_site_option( 'astra-sites-batch-status-string', 'Error! Batch Not Start due to disabled cron events!', 'no' );
491
+
492
+ if ( defined( 'WP_CLI' ) ) {
493
+ WP_CLI::line( 'Error! Batch Not Start due to disabled cron events!' );
494
+ } else {
495
+ // For non- WP CLI request return to prevent the request.
496
+ return;
497
+ }
498
+ }
499
+
500
+ $this->log( 'Sync Library Started!' );
501
+
502
+ // Added the categories and tags.
503
+ $this->log( 'Added All Categories and tags in queue.' );
504
+
505
+ if ( defined( 'WP_CLI' ) ) {
506
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_all_categories_and_tags();
507
+ } else {
508
+ self::$process_site_importer->push_to_queue(
509
+ array(
510
+ 'instance' => Astra_Sites_Batch_Processing_Importer::get_instance(),
511
+ 'method' => 'import_all_categories_and_tags',
512
+ )
513
+ );
514
+ }
515
+
516
+ // Added the categories.
517
+ $this->log( 'Added All Site Categories in queue.' );
518
+
519
+ if ( defined( 'WP_CLI' ) ) {
520
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_all_categories();
521
+ } else {
522
+ self::$process_site_importer->push_to_queue(
523
+ array(
524
+ 'instance' => Astra_Sites_Batch_Processing_Importer::get_instance(),
525
+ 'method' => 'import_all_categories',
526
+ )
527
+ );
528
+ }
529
+
530
+ // Added the page_builders.
531
+ $this->log( 'Added page builders in queue.' );
532
+
533
+ if ( defined( 'WP_CLI' ) ) {
534
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_page_builders();
535
+ } else {
536
+ self::$process_site_importer->push_to_queue(
537
+ array(
538
+ 'instance' => Astra_Sites_Batch_Processing_Importer::get_instance(),
539
+ 'method' => 'import_page_builders',
540
+ )
541
+ );
542
+ }
543
+
544
+ // Get count.
545
+ $total_requests = $this->get_total_blocks_requests();
546
+ if ( $total_requests ) {
547
+ $this->log( 'BLOCK: Total Blocks Requests ' . $total_requests );
548
+
549
+ for ( $page = 1; $page <= $total_requests; $page++ ) {
550
+
551
+ $this->log( 'BLOCK: Added page ' . $page . ' in queue.' );
552
+
553
+ if ( defined( 'WP_CLI' ) ) {
554
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_blocks( $page );
555
+ } else {
556
+ self::$process_site_importer->push_to_queue(
557
+ array(
558
+ 'page' => $page,
559
+ 'instance' => Astra_Sites_Batch_Processing_Importer::get_instance(),
560
+ 'method' => 'import_blocks',
561
+ )
562
+ );
563
+ }
564
+ }
565
+ }
566
+
567
+ // Added the categories.
568
+ $this->log( 'Added Block Categories in queue.' );
569
+
570
+ if ( defined( 'WP_CLI' ) ) {
571
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_block_categories();
572
+ } else {
573
+ self::$process_site_importer->push_to_queue(
574
+ array(
575
+ 'instance' => Astra_Sites_Batch_Processing_Importer::get_instance(),
576
+ 'method' => 'import_block_categories',
577
+ )
578
+ );
579
+ }
580
+
581
+ // Get count.
582
+ $total_requests = $this->get_total_requests();
583
+ if ( $total_requests ) {
584
+ $this->log( 'Total Requests ' . $total_requests );
585
+
586
+ for ( $page = 1; $page <= $total_requests; $page++ ) {
587
+
588
+ $this->log( 'Added page ' . $page . ' in queue.' );
589
+
590
+ if ( defined( 'WP_CLI' ) ) {
591
+ Astra_Sites_Batch_Processing_Importer::get_instance()->import_sites( $page );
592
+ } else {
593
+ self::$process_site_importer->push_to_queue(
594
+ array(
595
+ 'page' => $page,
596
+ 'instance' => Astra_Sites_Batch_Processing_Importer::get_instance(),
597
+ 'method' => 'import_sites',
598
+ )
599
+ );
600
+ }
601
+ }
602
+ }
603
+
604
+ if ( defined( 'WP_CLI' ) ) {
605
+ $this->log( 'Sync Process Complete.' );
606
+ } else {
607
+ // Dispatch Queue.
608
+ $this->log( 'Dispatch the Queue!' );
609
+
610
+ self::$process_site_importer->save()->dispatch();
611
+ }
612
+
613
+ }
614
+
615
+ /**
616
+ * Log
617
+ *
618
+ * @since 2.0.0
619
+ *
620
+ * @param string $message Log message.
621
+ * @return void.
622
+ */
623
+ public function log( $message = '' ) {
624
+ if ( defined( 'WP_CLI' ) ) {
625
+ WP_CLI::line( $message );
626
+ } else {
627
+ astra_sites_error_log( $message );
628
+ update_site_option( 'astra-sites-batch-status-string', $message, 'no' );
629
+ }
630
+ }
631
+
632
+ /**
633
+ * Process Import
634
+ *
635
+ * @since 2.0.0
636
+ *
637
+ * @return mixed Null if process is already started.
638
+ */
639
+ public function process_import() {
640
+
641
+ $process_sync = apply_filters( 'astra_sites_process_auto_sync_library', true );
642
+
643
+ if ( ! $process_sync ) {
644
+ return;
645
+ }
646
+
647
+ // Batch is already started? Then return.
648
+ $status = get_site_option( 'astra-sites-batch-status' );
649
+ if ( 'in-process' === $status ) {
650
+ return;
651
+ }
652
+
653
+ // Check batch expiry.
654
+ $expired = get_transient( 'astra-sites-import-check' );
655
+ if ( false !== $expired ) {
656
+ return;
657
+ }
658
+
659
+ // For 1 week.
660
+ set_transient( 'astra-sites-import-check', 'true', apply_filters( 'astra_sites_sync_check_time', WEEK_IN_SECONDS ) );
661
+
662
+ update_site_option( 'astra-sites-batch-status', 'in-process', 'no' );
663
+
664
+ // Process batch.
665
+ $this->process_batch();
666
+ }
667
+
668
+ /**
669
+ * Get Total Requests
670
+ *
671
+ * @return integer
672
+ */
673
+ public function get_total_requests() {
674
+
675
+ astra_sites_error_log( 'Getting Total Pages' );
676
+ update_site_option( 'astra-sites-batch-status-string', 'Getting Total Pages', 'no' );
677
+
678
+ $api_args = array(
679
+ 'timeout' => 60,
680
+ );
681
+
682
+ $response = wp_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/astra-sites/v1/get-total-pages/?per_page=15', $api_args );
683
+ if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
684
+ $total_requests = json_decode( wp_remote_retrieve_body( $response ), true );
685
+
686
+ if ( isset( $total_requests['pages'] ) ) {
687
+
688
+ $this->log( 'Updated requests ' . $total_requests['pages'] );
689
+ update_site_option( 'astra-sites-requests', $total_requests['pages'], 'no' );
690
+
691
+ do_action( 'astra_sites_sync_get_total_pages', $total_requests['pages'] );
692
+
693
+ return $total_requests['pages'];
694
+ }
695
+ }
696
+
697
+ astra_sites_error_log( 'Request Failed! Still Calling..' );
698
+ update_site_option( 'astra-sites-batch-status-string', 'Request Failed! Still Calling..', 'no' );
699
+
700
+ }
701
+
702
+ /**
703
+ * Get Blocks Total Requests
704
+ *
705
+ * @return integer
706
+ */
707
+ public function get_total_blocks_requests() {
708
+
709
+ astra_sites_error_log( 'BLOCK: Getting Total Blocks' );
710
+ update_site_option( 'astra-sites-batch-status-string', 'Getting Total Blocks', 'no' );
711
+
712
+ $api_args = array(
713
+ 'timeout' => 60,
714
+ );
715
+
716
+ $query_args = array(
717
+ 'page_builder' => 'elementor',
718
+ 'wireframe' => 'yes',
719
+ );
720
+
721
+ $api_url = add_query_arg( $query_args, trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/astra-blocks/v1/get-blocks-count/' );
722
+
723
+ $response = wp_remote_get( $api_url, $api_args );
724
+ if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
725
+ $total_requests = json_decode( wp_remote_retrieve_body( $response ), true );
726
+
727
+ if ( isset( $total_requests['pages'] ) ) {
728
+ astra_sites_error_log( 'BLOCK: Updated requests ' . $total_requests['pages'] );
729
+ update_site_option( 'astra-blocks-batch-status-string', 'Updated requests ' . $total_requests['pages'], 'no' );
730
+
731
+ update_site_option( 'astra-blocks-requests', $total_requests['pages'], 'no' );
732
+
733
+ do_action( 'astra_sites_sync_blocks_requests', $total_requests['pages'] );
734
+
735
+ return $total_requests['pages'];
736
+ }
737
+ }
738
+
739
+ astra_sites_error_log( 'BLOCK: Request Failed! Still Calling..' );
740
+ update_site_option( 'astra-blocks-batch-status-string', 'Request Failed! Still Calling..', 'no' );
741
+
742
+ }
743
+
744
+ /**
745
+ * Start Single Page Import
746
+ *
747
+ * @param int $page_id Page ID .
748
+ * @since 2.0.0
749
+ * @return void
750
+ */
751
+ public function start_process_single( $page_id ) {
752
+
753
+ astra_sites_error_log( '=================== ' . Astra_Sites_White_Label::get_instance()->get_white_label_name( ASTRA_SITES_NAME ) . ' - Single Page - Importing Images for Blog name \'' . get_the_title( $page_id ) . '\' (' . $page_id . ') ===================' );
754
+
755
+ $default_page_builder = Astra_Sites_Page::get_instance()->get_setting( 'page_builder' );
756
+
757
+ if ( 'gutenberg' === $default_page_builder ) {
758
+ // Add "gutenberg" in import [queue].
759
+ self::$process_single->push_to_queue(
760
+ array(
761
+ 'page_id' => $page_id,
762
+ 'instance' => Astra_Sites_Batch_Processing_Gutenberg::get_instance(),
763
+ )
764
+ );
765
+ }
766
+
767
+ // Add "brizy" in import [queue].
768
+ if ( 'brizy' === $default_page_builder && is_plugin_active( 'brizy/brizy.php' ) ) {
769
+ // Add "gutenberg" in import [queue].
770
+ self::$process_single->push_to_queue(
771
+ array(
772
+ 'page_id' => $page_id,
773
+ 'instance' => Astra_Sites_Batch_Processing_Brizy::get_instance(),
774
+ )
775
+ );
776
+ }
777
+
778
+ // Add "bb-plugin" in import [queue].
779
+ if (
780
+ 'beaver-builder' === $default_page_builder &&
781
+ ( is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) || is_plugin_active( 'bb-plugin/fl-builder.php' ) )
782
+ ) {
783
+ // Add "gutenberg" in import [queue].
784
+ self::$process_single->push_to_queue(
785
+ array(
786
+ 'page_id' => $page_id,
787
+ 'instance' => Astra_Sites_Batch_Processing_Beaver_Builder::get_instance(),
788
+ )
789
+ );
790
+ }
791
+
792
+ // Add "elementor" in import [queue].
793
+ if ( 'elementor' === $default_page_builder ) {
794
+ // @todo Remove required `allow_url_fopen` support.
795
+ if ( ini_get( 'allow_url_fopen' ) ) {
796
+ if ( is_plugin_active( 'elementor/elementor.php' ) ) {
797
+
798
+ // !important, Clear the cache after images import.
799
+ \Elementor\Plugin::$instance->posts_css_manager->clear_cache();
800
+
801
+ $import = new \Elementor\TemplateLibrary\Astra_Sites_Batch_Processing_Elementor();
802
+ self::$process_single->push_to_queue(
803
+ array(
804
+ 'page_id' => $page_id,
805
+ 'instance' => $import,
806
+ )
807
+ );
808
+ }
809
+ } else {
810
+ astra_sites_error_log( 'Couldn\'t not import image due to allow_url_fopen() is disabled!' );
811
+ }
812
+ }
813
+
814
+ // Dispatch Queue.
815
+ self::$process_single->save()->dispatch();
816
+ }
817
+
818
+ /**
819
+ * Skip Image from Batch Processing.
820
+ *
821
+ * @since 1.0.14
822
+ *
823
+ * @param boolean $can_process Batch process image status.
824
+ * @param array $attachment Batch process image input.
825
+ * @return boolean
826
+ */
827
+ public function skip_image( $can_process, $attachment ) {
828
+
829
+ if ( isset( $attachment['url'] ) && ! empty( $attachment['url'] ) ) {
830
+
831
+ // If image URL contain current site URL? then return true to skip that image from import.
832
+ if ( strpos( $attachment['url'], site_url() ) !== false ) {
833
+ return true;
834
+ }
835
+
836
+ if (
837
+ strpos( $attachment['url'], 'brainstormforce.com' ) !== false ||
838
+ strpos( $attachment['url'], 'wpastra.com' ) !== false ||
839
+ strpos( $attachment['url'], 'sharkz.in' ) !== false ||
840
+ strpos( $attachment['url'], 'websitedemos.net' ) !== false
841
+ ) {
842
+ return false;
843
+ }
844
+ }
845
+
846
+ return true;
847
+ }
848
+
849
+ /**
850
+ * Start Image Import
851
+ *
852
+ * @since 1.0.14
853
+ *
854
+ * @return void
855
+ */
856
+ public function start_process() {
857
+
858
+ /** WordPress Plugin Administration API */
859
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
860
+ require_once ABSPATH . 'wp-admin/includes/update.php';
861
+
862
+ $this->includes();
863
+
864
+ $wxr_id = get_site_option( 'astra_sites_imported_wxr_id', 0 );
865
+ if ( $wxr_id ) {
866
+ wp_delete_attachment( $wxr_id, true );
867
+ astra_sites_error_log( 'Deleted Temporary WXR file ' . $wxr_id );
868
+ delete_option( 'astra_sites_imported_wxr_id' );
869
+ astra_sites_error_log( 'Option `astra_sites_imported_wxr_id` Deleted.' );
870
+ }
871
+
872
+ $classes = array();
873
+
874
+ Astra_Sites_Importer_Log::add( 'Batch Process Started..' );
875
+ Astra_Sites_Importer_Log::add( Astra_Sites_White_Label::get_instance()->get_white_label_name( ASTRA_SITES_NAME ) . ' - Importing Images for Blog name \'' . get_bloginfo( 'name' ) . '\' (' . get_current_blog_id() . ')' );
876
+
877
+ // Add "widget" in import [queue].
878
+ $classes[] = Astra_Sites_Batch_Processing_Widgets::get_instance();
879
+
880
+ // Add "gutenberg" in import [queue].
881
+ $classes[] = Astra_Sites_Batch_Processing_Gutenberg::get_instance();
882
+
883
+ // Add "brizy" in import [queue].
884
+ if ( is_plugin_active( 'brizy/brizy.php' ) ) {
885
+ $classes[] = Astra_Sites_Batch_Processing_Brizy::get_instance();
886
+ }
887
+
888
+ // Add "bb-plugin" in import [queue].
889
+ // Add "beaver-builder-lite-version" in import [queue].
890
+ if ( is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) || is_plugin_active( 'bb-plugin/fl-builder.php' ) ) {
891
+ $classes[] = Astra_Sites_Batch_Processing_Beaver_Builder::get_instance();
892
+ }
893
+
894
+ // Add "elementor" in import [queue].
895
+ // @todo Remove required `allow_url_fopen` support.
896
+ if ( ini_get( 'allow_url_fopen' ) && is_plugin_active( 'elementor/elementor.php' ) ) {
897
+ $import = new \Elementor\TemplateLibrary\Astra_Sites_Batch_Processing_Elementor();
898
+ $classes[] = $import;
899
+ }
900
+
901
+ // Add "astra-addon" in import [queue].
902
+ if ( is_plugin_active( 'astra-addon/astra-addon.php' ) ) {
903
+ $classes[] = Astra_Sites_Compatibility_Astra_Pro::get_instance();
904
+ }
905
+
906
+ // Add "misc" in import [queue].
907
+ $classes[] = Astra_Sites_Batch_Processing_Misc::get_instance();
908
+
909
+ if ( defined( 'WP_CLI' ) ) {
910
+ WP_CLI::line( 'Batch Process Started..' );
911
+ // Process all classes.
912
+ foreach ( $classes as $key => $class ) {
913
+ if ( method_exists( $class, 'import' ) ) {
914
+ $class->import();
915
+ }
916
+ }
917
+ WP_CLI::line( 'Batch Process Complete!' );
918
+ } else {
919
+ // Add all classes to batch queue.
920
+ foreach ( $classes as $key => $class ) {
921
+ self::$process_all->push_to_queue( $class );
922
+ }
923
+
924
+ // Dispatch Queue.
925
+ self::$process_all->save()->dispatch();
926
+ }
927
+
928
+ }
929
+
930
+ /**
931
+ * Get all post id's
932
+ *
933
+ * @since 1.0.14
934
+ *
935
+ * @param array $post_types Post types.
936
+ * @return array
937
+ */
938
+ public static function get_pages( $post_types = array() ) {
939
+
940
+ if ( $post_types ) {
941
+ $args = array(
942
+ 'post_type' => $post_types,
943
+
944
+ // Query performance optimization.
945
+ 'fields' => 'ids',
946
+ 'no_found_rows' => true,
947
+ 'post_status' => 'publish',
948
+ 'posts_per_page' => -1,
949
+ );
950
+
951
+ $query = new WP_Query( $args );
952
+
953
+ // Have posts?
954
+ if ( $query->have_posts() ) :
955
+
956
+ return $query->posts;
957
+
958
+ endif;
959
+ }
960
+
961
+ return null;
962
+ }
963
+
964
+ /**
965
+ * Get Supporting Post Types..
966
+ *
967
+ * @since 1.3.7
968
+ * @param integer $feature Feature.
969
+ * @return array
970
+ */
971
+ public static function get_post_types_supporting( $feature ) {
972
+ global $_wp_post_type_features;
973
+
974
+ $post_types = array_keys(
975
+ wp_filter_object_list( $_wp_post_type_features, array( $feature => true ) )
976
+ );
977
+
978
+ return $post_types;
979
+ }
980
+
981
+ }
982
+
983
+ /**
984
+ * Kicking this off by calling 'get_instance()' method
985
+ */
986
+ Astra_Sites_Batch_Processing::get_instance();
987
+
988
+ endif;
astra-sites/inc/importers/batch-processing/helpers/class-astra-sites-image-importer.php ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Image Importer
4
+ *
5
+ * @see https://github.com/elementor/elementor/blob/master/includes/template-library/classes/class-import-images.php
6
+ *
7
+ * => How to use?
8
+ *
9
+ * $image = array(
10
+ * 'url' => '<image-url>',
11
+ * 'id' => '<image-id>',
12
+ * );
13
+ *
14
+ * $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import( $image );
15
+ *
16
+ * @package Astra Sites
17
+ * @since 1.0.14
18
+ */
19
+
20
+ if ( ! class_exists( 'Astra_Sites_Image_Importer' ) ) :
21
+
22
+ /**
23
+ * Astra Sites Image Importer
24
+ *
25
+ * @since 1.0.14
26
+ */
27
+ class Astra_Sites_Image_Importer {
28
+
29
+ /**
30
+ * Instance
31
+ *
32
+ * @since 1.0.14
33
+ * @var object Class object.
34
+ * @access private
35
+ */
36
+ private static $instance;
37
+
38
+ /**
39
+ * Images IDs
40
+ *
41
+ * @var array The Array of already image IDs.
42
+ * @since 1.0.14
43
+ */
44
+ private $already_imported_ids = array();
45
+
46
+ /**
47
+ * Initiator
48
+ *
49
+ * @since 1.0.14
50
+ * @return object initialized object of class.
51
+ */
52
+ public static function get_instance() {
53
+ if ( ! isset( self::$instance ) ) {
54
+ self::$instance = new self();
55
+ }
56
+ return self::$instance;
57
+ }
58
+
59
+ /**
60
+ * Constructor
61
+ *
62
+ * @since 1.0.14
63
+ */
64
+ public function __construct() {
65
+
66
+ if ( ! function_exists( 'WP_Filesystem' ) ) {
67
+ require_once ABSPATH . 'wp-admin/includes/file.php';
68
+ }
69
+
70
+ WP_Filesystem();
71
+ }
72
+
73
+ /**
74
+ * Process Image Download
75
+ *
76
+ * @since 1.0.14
77
+ * @param array $attachments Attachment array.
78
+ * @return array Attachment array.
79
+ */
80
+ public function process( $attachments ) {
81
+
82
+ $downloaded_images = array();
83
+
84
+ foreach ( $attachments as $key => $attachment ) {
85
+ $downloaded_images[] = $this->import( $attachment );
86
+ }
87
+
88
+ return $downloaded_images;
89
+ }
90
+
91
+ /**
92
+ * Get Hash Image.
93
+ *
94
+ * @since 1.0.14
95
+ * @param string $attachment_url Attachment URL.
96
+ * @return string Hash string.
97
+ */
98
+ public function get_hash_image( $attachment_url ) {
99
+ return sha1( $attachment_url );
100
+ }
101
+
102
+ /**
103
+ * Get Saved Image.
104
+ *
105
+ * @since 1.0.14
106
+ * @param string $attachment Attachment Data.
107
+ * @return string Hash string.
108
+ */
109
+ private function get_saved_image( $attachment ) {
110
+
111
+ if ( apply_filters( 'astra_sites_image_importer_skip_image', false, $attachment ) ) {
112
+ Astra_Sites_Importer_Log::add( 'BATCH - SKIP Image - {from filter} - ' . $attachment['url'] . ' - Filter name `astra_sites_image_importer_skip_image`.' );
113
+ return array(
114
+ 'status' => true,
115
+ 'attachment' => $attachment,
116
+ );
117
+ }
118
+
119
+ global $wpdb;
120
+
121
+ // 1. Is already imported in Batch Import Process?
122
+ $post_id = $wpdb->get_var(
123
+ $wpdb->prepare(
124
+ 'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
125
+ WHERE `meta_key` = \'_astra_sites_image_hash\'
126
+ AND `meta_value` = %s
127
+ ;',
128
+ $this->get_hash_image( $attachment['url'] )
129
+ )
130
+ );
131
+
132
+ // 2. Is image already imported though XML?
133
+ if ( empty( $post_id ) ) {
134
+
135
+ // Get file name without extension.
136
+ // To check it exist in attachment.
137
+ $filename = basename( $attachment['url'] );
138
+
139
+ // Find the attachment by meta value.
140
+ // Code reused from Elementor plugin.
141
+ $post_id = $wpdb->get_var(
142
+ $wpdb->prepare(
143
+ "SELECT post_id FROM {$wpdb->postmeta}
144
+ WHERE meta_key = '_wp_attached_file'
145
+ AND meta_value LIKE %s",
146
+ '%/' . $filename . '%'
147
+ )
148
+ );
149
+
150
+ Astra_Sites_Importer_Log::add( 'BATCH - SKIP Image {already imported from xml} - ' . $attachment['url'] );
151
+ }
152
+
153
+ if ( $post_id ) {
154
+ $new_attachment = array(
155
+ 'id' => $post_id,
156
+ 'url' => wp_get_attachment_url( $post_id ),
157
+ );
158
+ $this->already_imported_ids[] = $post_id;
159
+
160
+ return array(
161
+ 'status' => true,
162
+ 'attachment' => $new_attachment,
163
+ );
164
+ }
165
+
166
+ return array(
167
+ 'status' => false,
168
+ 'attachment' => $attachment,
169
+ );
170
+ }
171
+
172
+ /**
173
+ * Import Image
174
+ *
175
+ * @since 1.0.14
176
+ * @param array $attachment Attachment array.
177
+ * @return array Attachment array.
178
+ */
179
+ public function import( $attachment ) {
180
+
181
+ if ( isset( $attachment['url'] ) && ! astra_sites_is_valid_url( $attachment['url'] ) ) {
182
+ return $attachment;
183
+ }
184
+
185
+ Astra_Sites_Importer_Log::add( 'Source - ' . $attachment['url'] );
186
+ $saved_image = $this->get_saved_image( $attachment );
187
+ Astra_Sites_Importer_Log::add( 'Log - ' . wp_json_encode( $saved_image['attachment'] ) );
188
+
189
+ if ( $saved_image['status'] ) {
190
+ return $saved_image['attachment'];
191
+ }
192
+
193
+ $file_content = wp_remote_retrieve_body(
194
+ wp_safe_remote_get(
195
+ $attachment['url'],
196
+ array(
197
+ 'timeout' => '60',
198
+ 'sslverify' => false,
199
+ )
200
+ )
201
+ );
202
+
203
+ // Empty file content?
204
+ if ( empty( $file_content ) ) {
205
+
206
+ Astra_Sites_Importer_Log::add( 'BATCH - FAIL Image {Error: Failed wp_remote_retrieve_body} - ' . $attachment['url'] );
207
+ return $attachment;
208
+ }
209
+
210
+ // Extract the file name and extension from the URL.
211
+ $filename = basename( $attachment['url'] );
212
+
213
+ $upload = wp_upload_bits( $filename, null, $file_content );
214
+
215
+ astra_sites_error_log( $filename );
216
+ astra_sites_error_log( wp_json_encode( $upload ) );
217
+
218
+ $post = array(
219
+ 'post_title' => $filename,
220
+ 'guid' => $upload['url'],
221
+ );
222
+ astra_sites_error_log( wp_json_encode( $post ) );
223
+
224
+ $info = wp_check_filetype( $upload['file'] );
225
+ if ( $info ) {
226
+ $post['post_mime_type'] = $info['type'];
227
+ } else {
228
+ // For now just return the origin attachment.
229
+ return $attachment;
230
+ }
231
+
232
+ $post_id = wp_insert_attachment( $post, $upload['file'] );
233
+ wp_update_attachment_metadata(
234
+ $post_id,
235
+ wp_generate_attachment_metadata( $post_id, $upload['file'] )
236
+ );
237
+ update_post_meta( $post_id, '_astra_sites_image_hash', $this->get_hash_image( $attachment['url'] ) );
238
+
239
+ Astra_WXR_Importer::instance()->track_post( $post_id );
240
+
241
+ $new_attachment = array(
242
+ 'id' => $post_id,
243
+ 'url' => $upload['url'],
244
+ );
245
+
246
+ Astra_Sites_Importer_Log::add( 'BATCH - SUCCESS Image {Imported} - ' . $new_attachment['url'] );
247
+
248
+ $this->already_imported_ids[] = $post_id;
249
+
250
+ return $new_attachment;
251
+ }
252
+
253
+ /**
254
+ * Is Image URL
255
+ *
256
+ * @since 1.3.10
257
+ *
258
+ * @param string $url URL.
259
+ * @return boolean
260
+ */
261
+ public function is_image_url( $url = '' ) {
262
+ if ( empty( $url ) ) {
263
+ return false;
264
+ }
265
+
266
+ if ( astra_sites_is_valid_image( $url ) ) {
267
+ return true;
268
+ }
269
+
270
+ return false;
271
+ }
272
+
273
+ }
274
+
275
+ /**
276
+ * Kicking this off by calling 'get_instance()' method
277
+ */
278
+ Astra_Sites_Image_Importer::get_instance();
279
+
280
+ endif;
astra-sites/inc/importers/batch-processing/helpers/class-wp-async-request.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP Background Process
4
+ * https://github.com/A5hleyRich/wp-background-processing
5
+ *
6
+ * Released under the GNU General Public License v2.0
7
+ * https://github.com/deliciousbrains/wp-background-processing/blob/master/license.txt
8
+ *
9
+ * @see https://github.com/A5hleyRich/wp-background-processing/
10
+ * @package WP-Background-Processing
11
+ */
12
+
13
+ if ( ! class_exists( 'WP_Async_Request' ) ) {
14
+
15
+ /**
16
+ * Abstract WP_Async_Request class.
17
+ *
18
+ * @abstract
19
+ */
20
+ abstract class WP_Async_Request {
21
+
22
+ /**
23
+ * Prefix
24
+ *
25
+ * (default value: 'wp')
26
+ *
27
+ * @var string
28
+ * @access protected
29
+ */
30
+ protected $prefix = 'wp';
31
+
32
+ /**
33
+ * Action
34
+ *
35
+ * (default value: 'async_request')
36
+ *
37
+ * @var string
38
+ * @access protected
39
+ */
40
+ protected $action = 'async_request';
41
+
42
+ /**
43
+ * Identifier
44
+ *
45
+ * @var mixed
46
+ * @access protected
47
+ */
48
+ protected $identifier;
49
+
50
+ /**
51
+ * Data
52
+ *
53
+ * (default value: array())
54
+ *
55
+ * @var array
56
+ * @access protected
57
+ */
58
+ protected $data = array();
59
+
60
+ /**
61
+ * Initiate new async request
62
+ */
63
+ public function __construct() {
64
+ $this->identifier = $this->prefix . '_' . $this->action;
65
+
66
+ add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) );
67
+ add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) );
68
+ }
69
+
70
+ /**
71
+ * Set data used during the request
72
+ *
73
+ * @param array $data Data.
74
+ *
75
+ * @return $this
76
+ */
77
+ public function data( $data ) {
78
+ $this->data = $data;
79
+
80
+ return $this;
81
+ }
82
+
83
+ /**
84
+ * Dispatch the async request
85
+ *
86
+ * @return array|WP_Error
87
+ */
88
+ public function dispatch() {
89
+ $url = add_query_arg( $this->get_query_args(), $this->get_query_url() );
90
+ $args = $this->get_post_args();
91
+
92
+ return wp_remote_post( esc_url_raw( $url ), $args );
93
+ }
94
+
95
+ /**
96
+ * Get query args
97
+ *
98
+ * @return array
99
+ */
100
+ protected function get_query_args() {
101
+ if ( property_exists( $this, 'query_args' ) ) {
102
+ return $this->query_args;
103
+ }
104
+
105
+ return array(
106
+ 'action' => $this->identifier,
107
+ 'nonce' => wp_create_nonce( $this->identifier ),
108
+ );
109
+ }
110
+
111
+ /**
112
+ * Get query URL
113
+ *
114
+ * @return string
115
+ */
116
+ protected function get_query_url() {
117
+ if ( property_exists( $this, 'query_url' ) ) {
118
+ return $this->query_url;
119
+ }
120
+
121
+ return admin_url( 'admin-ajax.php' );
122
+ }
123
+
124
+ /**
125
+ * Get post args
126
+ *
127
+ * @return array
128
+ */
129
+ protected function get_post_args() {
130
+ if ( property_exists( $this, 'post_args' ) ) {
131
+ return $this->post_args;
132
+ }
133
+
134
+ return array(
135
+ 'timeout' => 0.01,
136
+ 'blocking' => false,
137
+ 'body' => $this->data,
138
+ 'cookies' => $_COOKIE,
139
+ 'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
140
+ );
141
+ }
142
+
143
+ /**
144
+ * Maybe handle
145
+ *
146
+ * Check for correct nonce and pass to handler.
147
+ */
148
+ public function maybe_handle() {
149
+ // Don't lock up other requests while processing.
150
+ session_write_close();
151
+
152
+ check_ajax_referer( $this->identifier, 'nonce' );
153
+
154
+ $this->handle();
155
+
156
+ wp_die();
157
+ }
158
+
159
+ /**
160
+ * Handle
161
+ *
162
+ * Override this method to perform any actions required
163
+ * during the async request.
164
+ */
165
+ abstract protected function handle();
166
+
167
+ }
168
+ }
astra-sites/inc/importers/batch-processing/helpers/class-wp-background-process-astra-single.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Single Page Background Process
4
+ *
5
+ * @package Astra Sites
6
+ * @since 2.0.0
7
+ */
8
+
9
+ if ( class_exists( 'WP_Background_Process' ) ) :
10
+
11
+ /**
12
+ * Image Background Process
13
+ *
14
+ * @since 2.0.0
15
+ */
16
+ class WP_Background_Process_Astra_Single extends WP_Background_Process {
17
+
18
+ /**
19
+ * Image Process
20
+ *
21
+ * @var string
22
+ */
23
+ protected $action = 'astra_sites_single_page';
24
+
25
+ /**
26
+ * Task
27
+ *
28
+ * Override this method to perform any actions required on each
29
+ * queue item. Return the modified item for further processing
30
+ * in the next pass through. Or, return false to remove the
31
+ * item from the queue.
32
+ *
33
+ * @since 2.0.0
34
+ *
35
+ * @param object $object Queue item object.
36
+ * @return mixed
37
+ */
38
+ protected function task( $object ) {
39
+
40
+ $page_id = $object['page_id'];
41
+
42
+ $process = $object['instance'];
43
+
44
+ if ( method_exists( $process, 'import_single_post' ) ) {
45
+ $process->import_single_post( $page_id );
46
+ }
47
+
48
+ return false;
49
+ }
50
+
51
+ /**
52
+ * Complete
53
+ *
54
+ * Override if applicable, but ensure that the below actions are
55
+ * performed, or, call parent::complete().
56
+ *
57
+ * @since 2.0.0
58
+ */
59
+ protected function complete() {
60
+
61
+ astra_sites_error_log( 'Complete' );
62
+
63
+ parent::complete();
64
+
65
+ do_action( 'astra_sites_image_import_complete' );
66
+
67
+ }
68
+
69
+ }
70
+
71
+ endif;
astra-sites/inc/importers/batch-processing/helpers/class-wp-background-process-astra-site-importer.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Single Page Background Process
4
+ *
5
+ * @package Astra Sites
6
+ * @since 2.0.0
7
+ */
8
+
9
+ if ( class_exists( 'WP_Background_Process' ) ) :
10
+
11
+ /**
12
+ * Image Background Process
13
+ *
14
+ * @since 2.0.0
15
+ */
16
+ class WP_Background_Process_Astra_Site_Importer extends WP_Background_Process {
17
+
18
+ /**
19
+ * Image Process
20
+ *
21
+ * @var string
22
+ */
23
+ protected $action = 'astra_site_importer';
24
+
25
+ /**
26
+ * Task
27
+ *
28
+ * Override this method to perform any actions required on each
29
+ * queue item. Return the modified item for further processing
30
+ * in the next pass through. Or, return false to remove the
31
+ * item from the queue.
32
+ *
33
+ * @since 2.0.0
34
+ *
35
+ * @param object $object Queue item object.
36
+ * @return mixed
37
+ */
38
+ protected function task( $object ) {
39
+
40
+ $process = $object['instance'];
41
+ $method = $object['method'];
42
+
43
+ if ( 'import_page_builders' === $method ) {
44
+ astra_sites_error_log( '-------- Importing Page Builders --------' );
45
+ update_site_option( 'astra-sites-batch-status-string', 'Importing Page Builders', 'no' );
46
+ $process->import_page_builders();
47
+ } elseif ( 'import_all_categories_and_tags' === $method ) {
48
+ astra_sites_error_log( '-------- Importing All Categories and Tags --------' );
49
+ update_site_option( 'astra-sites-batch-status-string', 'Importing All Categories and Tags', 'no' );
50
+ $process->import_all_categories_and_tags();
51
+ } elseif ( 'import_all_categories' === $method ) {
52
+ astra_sites_error_log( '-------- Importing All Categories --------' );
53
+ update_site_option( 'astra-sites-batch-status-string', 'Importing All Categories', 'no' );
54
+ $process->import_all_categories();
55
+ } elseif ( 'import_sites' === $method ) {
56
+ astra_sites_error_log( '-------- Importing Sites --------' );
57
+ $page = $object['page'];
58
+ astra_sites_error_log( 'Inside Batch ' . $page );
59
+ update_site_option( 'astra-sites-batch-status-string', 'Inside Batch ' . $page, 'no' );
60
+ $process->import_sites( $page );
61
+ } elseif ( 'import_blocks' === $method ) {
62
+ astra_sites_error_log( '-------- Importing Blocks --------' );
63
+ $page = $object['page'];
64
+ astra_sites_error_log( 'Inside Batch ' . $page );
65
+ update_site_option( 'astra-sites-batch-status-string', 'Inside Batch ' . $page, 'no' );
66
+ $process->import_blocks( $page );
67
+ } elseif ( 'import_block_categories' === $method ) {
68
+ astra_sites_error_log( '-------- Importing Blocks Categories --------' );
69
+ update_site_option( 'astra-sites-batch-status-string', 'Importing Blocks Categories', 'no' );
70
+ $process->import_block_categories();
71
+ }
72
+
73
+ return false;
74
+ }
75
+
76
+ /**
77
+ * Complete
78
+ *
79
+ * Override if applicable, but ensure that the below actions are
80
+ * performed, or, call parent::complete().
81
+ *
82
+ * @since 2.0.0
83
+ */
84
+ protected function complete() {
85
+ parent::complete();
86
+
87
+ astra_sites_error_log( esc_html__( 'All processes are complete', 'astra-sites' ) );
88
+ update_site_option( 'astra-sites-batch-status-string', 'All processes are complete', 'no' );
89
+ delete_site_option( 'astra-sites-batch-status' );
90
+ update_site_option( 'astra-sites-batch-is-complete', 'yes', 'no' );
91
+
92
+ do_action( 'astra_sites_site_import_batch_complete' );
93
+ }
94
+
95
+ }
96
+
97
+ endif;
astra-sites/inc/importers/batch-processing/helpers/class-wp-background-process-astra.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Image Background Process
4
+ *
5
+ * @package Astra Sites
6
+ * @since 1.0.11
7
+ */
8
+
9
+ if ( class_exists( 'WP_Background_Process' ) ) :
10
+
11
+ /**
12
+ * Image Background Process
13
+ *
14
+ * @since 1.0.11
15
+ */
16
+ class WP_Background_Process_Astra extends WP_Background_Process {
17
+
18
+ /**
19
+ * Image Process
20
+ *
21
+ * @var string
22
+ */
23
+ protected $action = 'image_process';
24
+
25
+ /**
26
+ * Task
27
+ *
28
+ * Override this method to perform any actions required on each
29
+ * queue item. Return the modified item for further processing
30
+ * in the next pass through. Or, return false to remove the
31
+ * item from the queue.
32
+ *
33
+ * @since 1.0.11
34
+ *
35
+ * @param object $process Queue item object.
36
+ * @return mixed
37
+ */
38
+ protected function task( $process ) {
39
+
40
+ if ( method_exists( $process, 'import' ) ) {
41
+ $process->import();
42
+ }
43
+
44
+ return false;
45
+ }
46
+
47
+ /**
48
+ * Complete
49
+ *
50
+ * Override if applicable, but ensure that the below actions are
51
+ * performed, or, call parent::complete().
52
+ *
53
+ * @since 1.0.11
54
+ */
55
+ protected function complete() {
56
+
57
+ parent::complete();
58
+
59
+ Astra_Sites_Importer_Log::add( 'Batch Process Complete!' );
60
+
61
+ // Delete Log file.
62
+ delete_option( 'astra_sites_recent_import_log_file' );
63
+
64
+ do_action( 'astra_sites_image_import_complete' );
65
+ }
66
+
67
+ }
68
+
69
+ endif;
astra-sites/inc/importers/batch-processing/helpers/class-wp-background-process.php ADDED
@@ -0,0 +1,524 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP Background Process
4
+ * https://github.com/A5hleyRich/wp-background-processing
5
+ *
6
+ * Released under the GNU General Public License v2.0
7
+ * https://github.com/deliciousbrains/wp-background-processing/blob/master/license.txt
8
+ *
9
+ * @see https://github.com/A5hleyRich/wp-background-processing/
10
+ * @package WP-Background-Processing
11
+ */
12
+
13
+ if ( ! class_exists( 'WP_Background_Process' ) ) {
14
+
15
+ /**
16
+ * Abstract WP_Background_Process class.
17
+ *
18
+ * @abstract
19
+ * @extends WP_Async_Request
20
+ */
21
+ abstract class WP_Background_Process extends WP_Async_Request {
22
+
23
+ /**
24
+ * Action
25
+ *
26
+ * (default value: 'background_process')
27
+ *
28
+ * @var string
29
+ * @access protected
30
+ */
31
+ protected $action = 'background_process';
32
+
33
+ /**
34
+ * Start time of current process.
35
+ *
36
+ * (default value: 0)
37
+ *
38
+ * @var int
39
+ * @access protected
40
+ */
41
+ protected $start_time = 0;
42
+
43
+ /**
44
+ * Cron_hook_identifier
45
+ *
46
+ * @var mixed
47
+ * @access protected
48
+ */
49
+ protected $cron_hook_identifier;
50
+
51
+ /**
52
+ * Cron_interval_identifier
53
+ *
54
+ * @var mixed
55
+ * @access protected
56
+ */
57
+ protected $cron_interval_identifier;
58
+
59
+ /**
60
+ * Initiate new background process
61
+ */
62
+ public function __construct() {
63
+ parent::__construct();
64
+
65
+ $this->cron_hook_identifier = $this->identifier . '_cron';
66
+ $this->cron_interval_identifier = $this->identifier . '_cron_interval';
67
+
68
+ add_action( $this->cron_hook_identifier, array( $this, 'handle_cron_healthcheck' ) );
69
+ add_filter( 'cron_schedules', array( $this, 'schedule_cron_healthcheck' ) ); // phpcs:ignore WordPress.WP.CronInterval.ChangeDetected
70
+ }
71
+
72
+ /**
73
+ * Dispatch
74
+ *
75
+ * @return mixed dispatch event.
76
+ */
77
+ public function dispatch() {
78
+ // Schedule the cron healthcheck.
79
+ $this->schedule_event();
80
+
81
+ // Perform remote post.
82
+ return parent::dispatch();
83
+ }
84
+
85
+ /**
86
+ * Push to queue
87
+ *
88
+ * @param mixed $data Data.
89
+ *
90
+ * @return $this
91
+ */
92
+ public function push_to_queue( $data ) {
93
+ $this->data[] = $data;
94
+
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * Save queue
100
+ *
101
+ * @return $this
102
+ */
103
+ public function save() {
104
+ $key = $this->generate_key();
105
+
106
+ if ( ! empty( $this->data ) ) {
107
+ update_site_option( $key, $this->data, 'no' );
108
+ }
109
+
110
+ return $this;
111
+ }
112
+
113
+ /**
114
+ * Update queue
115
+ *
116
+ * @param string $key Key.
117
+ * @param array $data Data.
118
+ *
119
+ * @return $this
120
+ */
121
+ public function update( $key, $data ) {
122
+ if ( ! empty( $data ) ) {
123
+ update_site_option( $key, $data, 'no' );
124
+ }
125
+
126
+ return $this;
127
+ }
128
+
129
+ /**
130
+ * Delete queue
131
+ *
132
+ * @param string $key Key.
133
+ *
134
+ * @return $this
135
+ */
136
+ public function delete( $key ) {
137
+ delete_site_option( $key );
138
+
139
+ return $this;
140
+ }
141
+
142
+ /**
143
+ * Generate key
144
+ *
145
+ * Generates a unique key based on microtime. Queue items are
146
+ * given a unique key so that they can be merged upon save.
147
+ *
148
+ * @param int $length Length.
149
+ *
150
+ * @return string
151
+ */
152
+ protected function generate_key( $length = 64 ) {
153
+ $unique = md5( microtime() . wp_rand() );
154
+ $prepend = $this->identifier . '_batch_';
155
+
156
+ return substr( $prepend . $unique, 0, $length );
157
+ }
158
+
159
+ /**
160
+ * Maybe process queue
161
+ *
162
+ * Checks whether data exists within the queue and that
163
+ * the process is not already running.
164
+ */
165
+ public function maybe_handle() {
166
+ // Don't lock up other requests while processing.
167
+ session_write_close();
168
+
169
+ if ( $this->is_process_running() ) {
170
+ // Background process already running.
171
+ wp_die();
172
+ }
173
+
174
+ if ( $this->is_queue_empty() ) {
175
+ // No data to process.
176
+ wp_die();
177
+ }
178
+
179
+ check_ajax_referer( $this->identifier, 'nonce' );
180
+
181
+ $this->handle();
182
+
183
+ wp_die();
184
+ }
185
+
186
+ /**
187
+ * Is queue empty
188
+ *
189
+ * @return bool
190
+ */
191
+ protected function is_queue_empty() {
192
+ global $wpdb;
193
+
194
+ $table = $wpdb->options;
195
+ $column = 'option_name';
196
+
197
+ if ( is_multisite() ) {
198
+ $table = $wpdb->sitemeta;
199
+ $column = 'meta_key';
200
+ }
201
+
202
+ $key = $this->identifier . '_batch_%';
203
+
204
+ $count = $wpdb->get_var(
205
+ $wpdb->prepare(
206
+ // phpcs:disable
207
+ "
208
+ SELECT COUNT(*)
209
+ FROM {$table}
210
+ WHERE {$column} LIKE %s
211
+ ",
212
+ $key
213
+ // phpcs:enable
214
+ )
215
+ );
216
+
217
+ return ( $count > 0 ) ? false : true;
218
+ }
219
+
220
+ /**
221
+ * Is process running
222
+ *
223
+ * Check whether the current process is already running
224
+ * in a background process.
225
+ */
226
+ protected function is_process_running() {
227
+ if ( get_site_transient( $this->identifier . '_process_lock' ) ) {
228
+ // Process already running.
229
+ return true;
230
+ }
231
+
232
+ return false;
233
+ }
234
+
235
+ /**
236
+ * Lock process
237
+ *
238
+ * Lock the process so that multiple instances can't run simultaneously.
239
+ * Override if applicable, but the duration should be greater than that
240
+ * defined in the time_exceeded() method.
241
+ */
242
+ protected function lock_process() {
243
+ $this->start_time = time(); // Set start time of current process.
244
+
245
+ $lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute
246
+ $lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
247
+
248
+ set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration );
249
+ }
250
+
251
+ /**
252
+ * Unlock process
253
+ *
254
+ * Unlock the process so that other instances can spawn.
255
+ *
256
+ * @return $this
257
+ */
258
+ protected function unlock_process() {
259
+ delete_site_transient( $this->identifier . '_process_lock' );
260
+
261
+ return $this;
262
+ }
263
+
264
+ /**
265
+ * Get batch
266
+ *
267
+ * @return stdClass Return the first batch from the queue
268
+ */
269
+ protected function get_batch() {
270
+ global $wpdb;
271
+
272
+ $table = $wpdb->options;
273
+ $column = 'option_name';
274
+ $key_column = 'option_id';
275
+ $value_column = 'option_value';
276
+
277
+ if ( is_multisite() ) {
278
+ $table = $wpdb->sitemeta;
279
+ $column = 'meta_key';
280
+ $key_column = 'meta_id';
281
+ $value_column = 'meta_value';
282
+ }
283
+
284
+ $key = $this->identifier . '_batch_%';
285
+
286
+ $query = $wpdb->get_row(
287
+ $wpdb->prepare(
288
+ // phpcs:disable
289
+ "
290
+ SELECT *
291
+ FROM {$table}
292
+ WHERE {$column} LIKE %s
293
+ ORDER BY {$key_column} ASC
294
+ LIMIT 1
295
+ ",
296
+ $key
297
+ // phpcs:enable
298
+ )
299
+ );
300
+
301
+ $batch = new stdClass();
302
+ $batch->key = $query->$column;
303
+ $batch->data = maybe_unserialize( $query->$value_column );
304
+
305
+ return $batch;
306
+ }
307
+
308
+ /**
309
+ * Handle
310
+ *
311
+ * Pass each queue item to the task handler, while remaining
312
+ * within server memory and time limit constraints.
313
+ */
314
+ protected function handle() {
315
+ $this->lock_process();
316
+
317
+ do {
318
+ $batch = $this->get_batch();
319
+
320
+ foreach ( $batch->data as $key => $value ) {
321
+ $task = $this->task( $value );
322
+
323
+ if ( false !== $task ) {
324
+ $batch->data[ $key ] = $task;
325
+ } else {
326
+ unset( $batch->data[ $key ] );
327
+ }
328
+
329
+ if ( $this->time_exceeded() || $this->memory_exceeded() ) {
330
+ // Batch limits reached.
331
+ break;
332
+ }
333
+ }
334
+
335
+ // Update or delete current batch.
336
+ if ( ! empty( $batch->data ) ) {
337
+ $this->update( $batch->key, $batch->data );
338
+ } else {
339
+ $this->delete( $batch->key );
340
+ }
341
+ } while ( ! $this->time_exceeded() && ! $this->memory_exceeded() && ! $this->is_queue_empty() );
342
+
343
+ $this->unlock_process();
344
+
345
+ // Start next batch or complete process.
346
+ if ( ! $this->is_queue_empty() ) {
347
+ $this->dispatch();
348
+ } else {
349
+ $this->complete();
350
+ }
351
+
352
+ wp_die();
353
+ }
354
+
355
+ /**
356
+ * Memory exceeded
357
+ *
358
+ * Ensures the batch process never exceeds 90%
359
+ * of the maximum WordPress memory.
360
+ *
361
+ * @return bool
362
+ */
363
+ protected function memory_exceeded() {
364
+ $memory_limit = $this->get_memory_limit() * 0.9; // 90% of max memory
365
+ $current_memory = memory_get_usage( true );
366
+ $return = false;
367
+
368
+ if ( $current_memory >= $memory_limit ) {
369
+ $return = true;
370
+ }
371
+
372
+ return apply_filters( $this->identifier . '_memory_exceeded', $return );
373
+ }
374
+
375
+ /**
376
+ * Get memory limit
377
+ *
378
+ * @return int
379
+ */
380
+ protected function get_memory_limit() {
381
+ if ( function_exists( 'ini_get' ) ) {
382
+ $memory_limit = ini_get( 'memory_limit' );
383
+ } else {
384
+ // Sensible default.
385
+ $memory_limit = '128M';
386
+ }
387
+
388
+ if ( ! $memory_limit || -1 === $memory_limit ) {
389
+ // Unlimited, set to 32GB.
390
+ $memory_limit = '32000M';
391
+ }
392
+
393
+ return intval( $memory_limit ) * 1024 * 1024;
394
+ }
395
+
396
+ /**
397
+ * Time exceeded.
398
+ *
399
+ * Ensures the batch never exceeds a sensible time limit.
400
+ * A timeout limit of 30s is common on shared hosting.
401
+ *
402
+ * @return bool
403
+ */
404
+ protected function time_exceeded() {
405
+ $finish = $this->start_time + apply_filters( $this->identifier . '_default_time_limit', 20 ); // 20 seconds
406
+ $return = false;
407
+
408
+ if ( time() >= $finish ) {
409
+ $return = true;
410
+ }
411
+
412
+ return apply_filters( $this->identifier . '_time_exceeded', $return );
413
+ }
414
+
415
+ /**
416
+ * Complete.
417
+ *
418
+ * Override if applicable, but ensure that the below actions are
419
+ * performed, or, call parent::complete().
420
+ */
421
+ protected function complete() {
422
+ // Unschedule the cron healthcheck.
423
+ $this->clear_scheduled_event();
424
+ }
425
+
426
+ /**
427
+ * Schedule cron healthcheck
428
+ *
429
+ * @access public
430
+ * @param mixed $schedules Schedules.
431
+ * @return mixed
432
+ */
433
+ public function schedule_cron_healthcheck( $schedules ) {
434
+ $interval = apply_filters( $this->identifier . '_cron_interval', 5 );
435
+
436
+ if ( property_exists( $this, 'cron_interval' ) ) {
437
+ $interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval_identifier );
438
+ }
439
+
440
+ // Adds every 5 minutes to the existing schedules.
441
+ $schedules[ $this->identifier . '_cron_interval' ] = array(
442
+ 'interval' => MINUTE_IN_SECONDS * $interval,
443
+ /* translators: %d are the minutes. */
444
+ 'display' => sprintf( __( 'Every %d Minutes', 'astra-sites' ), $interval ),
445
+ );
446
+
447
+ return $schedules;
448
+ }
449
+
450
+ /**
451
+ * Handle cron healthcheck
452
+ *
453
+ * Restart the background process if not already running
454
+ * and data exists in the queue.
455
+ */
456
+ public function handle_cron_healthcheck() {
457
+ if ( $this->is_process_running() ) {
458
+ // Background process already running.
459
+ exit;
460
+ }
461
+
462
+ if ( $this->is_queue_empty() ) {
463
+ // No data to process.
464
+ $this->clear_scheduled_event();
465
+ exit;
466
+ }
467
+
468
+ $this->handle();
469
+
470
+ exit;
471
+ }
472
+
473
+ /**
474
+ * Schedule event
475
+ */
476
+ protected function schedule_event() {
477
+ if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
478
+ wp_schedule_event( time(), $this->cron_interval_identifier, $this->cron_hook_identifier );
479
+ }
480
+ }
481
+
482
+ /**
483
+ * Clear scheduled event
484
+ */
485
+ protected function clear_scheduled_event() {
486
+ $timestamp = wp_next_scheduled( $this->cron_hook_identifier );
487
+
488
+ if ( $timestamp ) {
489
+ wp_unschedule_event( $timestamp, $this->cron_hook_identifier );
490
+ }
491
+ }
492
+
493
+ /**
494
+ * Cancel Process
495
+ *
496
+ * Stop processing queue items, clear cronjob and delete batch.
497
+ */
498
+ public function cancel_process() {
499
+ if ( ! $this->is_queue_empty() ) {
500
+ $batch = $this->get_batch();
501
+
502
+ $this->delete( $batch->key );
503
+
504
+ wp_clear_scheduled_hook( $this->cron_hook_identifier );
505
+ }
506
+
507
+ }
508
+
509
+ /**
510
+ * Task
511
+ *
512
+ * Override this method to perform any actions required on each
513
+ * queue item. Return the modified item for further processing
514
+ * in the next pass through. Or, return false to remove the
515
+ * item from the queue.
516
+ *
517
+ * @param mixed $item Queue item to iterate over.
518
+ *
519
+ * @return mixed
520
+ */
521
+ abstract protected function task( $item );
522
+
523
+ }
524
+ }
astra-sites/inc/importers/class-astra-customizer-import.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Customizer Data importer class.
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Addon
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit; // Exit if accessed directly.
11
+ }
12
+
13
+ /**
14
+ * Customizer Data importer class.
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class Astra_Customizer_Import {
19
+
20
+ /**
21
+ * Instance of Astra_Customizer_Import
22
+ *
23
+ * @since 1.0.0
24
+ * @var Astra_Customizer_Import
25
+ */
26
+ private static $instance = null;
27
+
28
+ /**
29
+ * Instantiate Astra_Customizer_Import
30
+ *
31
+ * @since 1.0.0
32
+ * @return (Object) Astra_Customizer_Import
33
+ */
34
+ public static function instance() {
35
+
36
+ if ( ! isset( self::$instance ) ) {
37
+ self::$instance = new self();
38
+ }
39
+
40
+ return self::$instance;
41
+ }
42
+
43
+ /**
44
+ * Import customizer options.
45
+ *
46
+ * @since 1.0.0
47
+ *
48
+ * @param (Array) $options customizer options from the demo.
49
+ */
50
+ public function import( $options ) {
51
+
52
+ // Update Astra Theme customizer settings.
53
+ if ( isset( $options['astra-settings'] ) ) {
54
+ self::import_settings( $options['astra-settings'] );
55
+ }
56
+
57
+ // Add Custom CSS.
58
+ if ( isset( $options['custom-css'] ) ) {
59
+ wp_update_custom_css_post( $options['custom-css'] );
60
+ }
61
+
62
+ }
63
+
64
+ /**
65
+ * Import Astra Setting's
66
+ *
67
+ * Download & Import images from Astra Customizer Settings.
68
+ *
69
+ * @since 1.0.10
70
+ *
71
+ * @param array $options Astra Customizer setting array.
72
+ * @return void
73
+ */
74
+ public static function import_settings( $options = array() ) {
75
+
76
+ array_walk_recursive(
77
+ $options,
78
+ function ( &$value ) {
79
+ if ( ! is_array( $value ) && astra_sites_is_valid_image( $value ) ) {
80
+ $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import(
81
+ array(
82
+ 'url' => $value,
83
+ 'id' => 0,
84
+ )
85
+ );
86
+ $value = $downloaded_image['url'];
87
+ }
88
+ }
89
+ );
90
+
91
+ // Updated settings.
92
+ update_option( 'astra-settings', $options );
93
+ }
94
+ }
astra-sites/inc/importers/class-astra-site-options-import.php ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Customizer Site options importer class.
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Addon
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Customizer Site options importer class.
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class Astra_Site_Options_Import {
19
+
20
+ /**
21
+ * Instance of Astra_Site_Options_Importer
22
+ *
23
+ * @since 1.0.0
24
+ * @var (Object) Astra_Site_Options_Importer
25
+ */
26
+ private static $instance = null;
27
+
28
+ /**
29
+ * Instanciate Astra_Site_Options_Importer
30
+ *
31
+ * @since 1.0.0
32
+ * @return (Object) Astra_Site_Options_Importer
33
+ */
34
+ public static function instance() {
35
+ if ( ! isset( self::$instance ) ) {
36
+ self::$instance = new self();
37
+ }
38
+
39
+ return self::$instance;
40
+ }
41
+
42
+ /**
43
+ * Site Options
44
+ *
45
+ * @since 1.0.2
46
+ *
47
+ * @return array List of defined array.
48
+ */
49
+ private static function site_options() {
50
+ return array(
51
+ 'custom_logo',
52
+ 'nav_menu_locations',
53
+ 'show_on_front',
54
+ 'page_on_front',
55
+ 'page_for_posts',
56
+
57
+ // Plugin: Elementor.
58
+ 'elementor_container_width',
59
+ 'elementor_cpt_support',
60
+ 'elementor_css_print_method',
61
+ 'elementor_default_generic_fonts',
62
+ 'elementor_disable_color_schemes',
63
+ 'elementor_disable_typography_schemes',
64
+ 'elementor_editor_break_lines',
65
+ 'elementor_exclude_user_roles',
66
+ 'elementor_global_image_lightbox',
67
+ 'elementor_page_title_selector',
68
+ 'elementor_scheme_color',
69
+ 'elementor_scheme_color-picker',
70
+ 'elementor_scheme_typography',
71
+ 'elementor_space_between_widgets',
72
+ 'elementor_stretched_section_container',
73
+ 'elementor_load_fa4_shim',
74
+ 'elementor_active_kit',
75
+
76
+ // Plugin: Beaver Builder.
77
+ '_fl_builder_enabled_icons',
78
+ '_fl_builder_enabled_modules',
79
+ '_fl_builder_post_types',
80
+ '_fl_builder_color_presets',
81
+ '_fl_builder_services',
82
+ '_fl_builder_settings',
83
+ '_fl_builder_user_access',
84
+ '_fl_builder_enabled_templates',
85
+
86
+ // Plugin: WooCommerce.
87
+ // Pages.
88
+ 'woocommerce_shop_page_title',
89
+ 'woocommerce_cart_page_title',
90
+ 'woocommerce_checkout_page_title',
91
+ 'woocommerce_myaccount_page_title',
92
+ 'woocommerce_edit_address_page_title',
93
+ 'woocommerce_view_order_page_title',
94
+ 'woocommerce_change_password_page_title',
95
+ 'woocommerce_logout_page_title',
96
+
97
+ // Account & Privacy.
98
+ 'woocommerce_enable_guest_checkout',
99
+ 'woocommerce_enable_checkout_login_reminder',
100
+ 'woocommerce_enable_signup_and_login_from_checkout',
101
+ 'woocommerce_enable_myaccount_registration',
102
+ 'woocommerce_registration_generate_username',
103
+
104
+ // Plugin: WPForms.
105
+ 'wpforms_settings',
106
+
107
+ // Categories.
108
+ 'woocommerce_product_cat',
109
+
110
+ // Plugin: LearnDash LMS.
111
+ 'learndash_settings_theme_ld30',
112
+ 'learndash_settings_courses_themes',
113
+
114
+ // Astra Theme Global Color Palette and Typography Preset options.
115
+ 'astra-color-palettes',
116
+ 'astra-typography-presets',
117
+ );
118
+ }
119
+
120
+ /**
121
+ * Import site options.
122
+ *
123
+ * @since 1.0.2 Updated option if exist in defined option array 'site_options()'.
124
+ *
125
+ * @since 1.0.0
126
+ *
127
+ * @param (Array) $options Array of site options to be imported from the demo.
128
+ */
129
+ public function import_options( $options = array() ) {
130
+
131
+ if ( ! isset( $options ) ) {
132
+ return;
133
+ }
134
+
135
+ foreach ( $options as $option_name => $option_value ) {
136
+
137
+ // Is option exist in defined array site_options()?
138
+ if ( null !== $option_value ) {
139
+
140
+ // Is option exist in defined array site_options()?
141
+ if ( in_array( $option_name, self::site_options(), true ) ) {
142
+
143
+ switch ( $option_name ) {
144
+
145
+ // Set WooCommerce page ID by page Title.
146
+ case 'woocommerce_shop_page_title':
147
+ case 'woocommerce_cart_page_title':
148
+ case 'woocommerce_checkout_page_title':
149
+ case 'woocommerce_myaccount_page_title':
150
+ case 'woocommerce_edit_address_page_title':
151
+ case 'woocommerce_view_order_page_title':
152
+ case 'woocommerce_change_password_page_title':
153
+ case 'woocommerce_logout_page_title':
154
+ $this->update_woocommerce_page_id_by_option_value( $option_name, $option_value );
155
+ break;
156
+
157
+ case 'page_for_posts':
158
+ case 'page_on_front':
159
+ $this->update_page_id_by_option_value( $option_name, $option_value );
160
+ break;
161
+
162
+ // nav menu locations.
163
+ case 'nav_menu_locations':
164
+ $this->set_nav_menu_locations( $option_value );
165
+ break;
166
+
167
+ // import WooCommerce category images.
168
+ case 'woocommerce_product_cat':
169
+ $this->set_woocommerce_product_cat( $option_value );
170
+ break;
171
+
172
+ // insert logo.
173
+ case 'custom_logo':
174
+ $this->insert_logo( $option_value );
175
+ break;
176
+
177
+ case 'elementor_active_kit':
178
+ if ( '' !== $option_value ) {
179
+ $this->set_elementor_kit();
180
+ }
181
+ break;
182
+
183
+ default:
184
+ update_option( $option_name, $option_value );
185
+ break;
186
+ }
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+ /**
193
+ * Update post option
194
+ *
195
+ * @since 2.2.2
196
+ *
197
+ * @return void
198
+ */
199
+ private function set_elementor_kit() {
200
+
201
+ // Update Elementor Theme Kit Option.
202
+ $args = array(
203
+ 'post_type' => 'elementor_library',
204
+ 'post_status' => 'publish',
205
+ 'numberposts' => 1,
206
+ 'meta_query' => array(
207
+ array(
208
+ 'key' => '_astra_sites_imported_post',
209
+ 'value' => '1',
210
+ ),
211
+ array(
212
+ 'key' => '_elementor_template_type',
213
+ 'value' => 'kit',
214
+ ),
215
+ ),
216
+ );
217
+
218
+ $query = get_posts( $args );
219
+ if ( ! empty( $query ) && isset( $query[0] ) && isset( $query[0]->ID ) ) {
220
+ update_option( 'elementor_active_kit', $query[0]->ID );
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Update post option
226
+ *
227
+ * @since 1.0.2
228
+ *
229
+ * @param string $option_name Option name.
230
+ * @param mixed $option_value Option value.
231
+ * @return void
232
+ */
233
+ private function update_page_id_by_option_value( $option_name, $option_value ) {
234
+ $page = get_page_by_title( $option_value );
235
+ if ( is_object( $page ) ) {
236
+ update_option( $option_name, $page->ID );
237
+ }
238
+ }
239
+
240
+ /**
241
+ * Update WooCommerce page ids.
242
+ *
243
+ * @since 1.1.6
244
+ *
245
+ * @param string $option_name Option name.
246
+ * @param mixed $option_value Option value.
247
+ * @return void
248
+ */
249
+ private function update_woocommerce_page_id_by_option_value( $option_name, $option_value ) {
250
+ $option_name = str_replace( '_title', '_id', $option_name );
251
+ $this->update_page_id_by_option_value( $option_name, $option_value );
252
+ }
253
+
254
+ /**
255
+ * In WP nav menu is stored as ( 'menu_location' => 'menu_id' );
256
+ * In export we send 'menu_slug' like ( 'menu_location' => 'menu_slug' );
257
+ * In import we set 'menu_id' from menu slug like ( 'menu_location' => 'menu_id' );
258
+ *
259
+ * @since 1.0.0
260
+ * @param array $nav_menu_locations Array of nav menu locations.
261
+ */
262
+ private function set_nav_menu_locations( $nav_menu_locations = array() ) {
263
+
264
+ $menu_locations = array();
265
+
266
+ // Update menu locations.
267
+ if ( isset( $nav_menu_locations ) ) {
268
+
269
+ foreach ( $nav_menu_locations as $menu => $value ) {
270
+
271
+ $term = get_term_by( 'slug', $value, 'nav_menu' );
272
+
273
+ if ( is_object( $term ) ) {
274
+ $menu_locations[ $menu ] = $term->term_id;
275
+ }
276
+ }
277
+
278
+ set_theme_mod( 'nav_menu_locations', $menu_locations );
279
+ }
280
+ }
281
+
282
+ /**
283
+ * Set WooCommerce category images.
284
+ *
285
+ * @since 1.1.4
286
+ *
287
+ * @param array $cats Array of categories.
288
+ */
289
+ private function set_woocommerce_product_cat( $cats = array() ) {
290
+
291
+ if ( isset( $cats ) ) {
292
+
293
+ foreach ( $cats as $key => $cat ) {
294
+
295
+ if ( ! empty( $cat['slug'] ) && ! empty( $cat['thumbnail_src'] ) ) {
296
+
297
+ $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import(
298
+ array(
299
+ 'url' => $cat['thumbnail_src'],
300
+ 'id' => 0,
301
+ )
302
+ );
303
+
304
+ if ( $downloaded_image['id'] ) {
305
+
306
+ $term = get_term_by( 'slug', $cat['slug'], 'product_cat' );
307
+
308
+ if ( is_object( $term ) ) {
309
+ update_term_meta( $term->term_id, 'thumbnail_id', $downloaded_image['id'] );
310
+ }
311
+ }
312
+ }
313
+ }
314
+ }
315
+ }
316
+
317
+ /**
318
+ * Insert Logo By URL
319
+ *
320
+ * @since 1.0.0
321
+ * @param string $image_url Logo URL.
322
+ * @return void
323
+ */
324
+ private function insert_logo( $image_url = '' ) {
325
+
326
+ $downloaded_image = Astra_Sites_Image_Importer::get_instance()->import(
327
+ array(
328
+ 'url' => $image_url,
329
+ 'id' => 0,
330
+ )
331
+ );
332
+
333
+ if ( $downloaded_image['id'] ) {
334
+ Astra_WXR_Importer::instance()->track_post( $downloaded_image['id'] );
335
+ set_theme_mod( 'custom_logo', $downloaded_image['id'] );
336
+ }
337
+
338
+ }
339
+
340
+ }
astra-sites/inc/importers/class-astra-sites-helper.php ADDED
@@ -0,0 +1,376 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra Site Helper
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Sites
7
+ */
8
+
9
+ if ( ! class_exists( 'Astra_Sites_Helper' ) ) :
10
+
11
+ /**
12
+ * Astra_Sites_Helper
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class Astra_Sites_Helper {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @access private
22
+ * @var object Instance
23
+ * @since 1.0.0
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.0.0
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self();
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ *
43
+ * @since 1.0.0
44
+ */
45
+ public function __construct() {
46
+ add_filter( 'wie_import_data', array( $this, 'custom_menu_widget' ) );
47
+ add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_svg_image_support' ), 10, 3 );
48
+ }
49
+
50
+ /**
51
+ * Add svg image support
52
+ *
53
+ * @since 1.1.5
54
+ *
55
+ * @param array $response Attachment response.
56
+ * @param object $attachment Attachment object.
57
+ * @param array $meta Attachment meta data.
58
+ */
59
+ public function add_svg_image_support( $response, $attachment, $meta ) {
60
+ if ( ! function_exists( 'simplexml_load_file' ) ) {
61
+ return $response;
62
+ }
63
+
64
+ if ( ! empty( $response['sizes'] ) ) {
65
+ return $response;
66
+ }
67
+
68
+ if ( 'image/svg+xml' !== $response['mime'] ) {
69
+ return $response;
70
+ }
71
+
72
+ $svg_path = get_attached_file( $attachment->ID );
73
+
74
+ $dimensions = self::get_svg_dimensions( $svg_path );
75
+
76
+ $response['sizes'] = array(
77
+ 'full' => array(
78
+ 'url' => $response['url'],
79
+ 'width' => $dimensions->width,
80
+ 'height' => $dimensions->height,
81
+ 'orientation' => $dimensions->width > $dimensions->height ? 'landscape' : 'portrait',
82
+ ),
83
+ );
84
+
85
+ return $response;
86
+ }
87
+
88
+ /**
89
+ * Get SVG Dimensions
90
+ *
91
+ * @since 1.1.5
92
+ *
93
+ * @param string $svg SVG file path.
94
+ * @return array Return SVG file height & width for valid SVG file.
95
+ */
96
+ public static function get_svg_dimensions( $svg ) {
97
+
98
+ $svg = simplexml_load_file( $svg );
99
+
100
+ if ( false === $svg ) {
101
+ $width = '0';
102
+ $height = '0';
103
+ } else {
104
+ $attributes = $svg->attributes();
105
+ $width = (string) $attributes->width;
106
+ $height = (string) $attributes->height;
107
+ }
108
+
109
+ return (object) array(
110
+ 'width' => $width,
111
+ 'height' => $height,
112
+ );
113
+ }
114
+
115
+ /**
116
+ * Custom Menu Widget
117
+ *
118
+ * In widget export we set the nav menu slug instead of ID.
119
+ * So, In import process we check get menu id by slug and set
120
+ * it in import widget process.
121
+ *
122
+ * @since 1.0.7
123
+ *
124
+ * @param object $all_sidebars Widget data.
125
+ * @return object Set custom menu id by slug.
126
+ */
127
+ public function custom_menu_widget( $all_sidebars ) {
128
+
129
+ // Get current menu ID & Slugs.
130
+ $menu_locations = array();
131
+ $nav_menus = (object) wp_get_nav_menus();
132
+ if ( isset( $nav_menus ) ) {
133
+ foreach ( $nav_menus as $menu_key => $menu ) {
134
+ if ( is_object( $menu ) ) {
135
+ $menu_locations[ $menu->term_id ] = $menu->slug;
136
+ }
137
+ }
138
+ }
139
+
140
+ // Import widget data.
141
+ $all_sidebars = (object) $all_sidebars;
142
+ foreach ( $all_sidebars as $widgets_key => $widgets ) {
143
+ foreach ( $widgets as $widget_key => $widget ) {
144
+
145
+ // Found slug in current menu list.
146
+ if ( isset( $widget->nav_menu ) ) {
147
+ $menu_id = array_search( $widget->nav_menu, $menu_locations, true );
148
+ if ( ! empty( $menu_id ) ) {
149
+ $all_sidebars->$widgets_key->$widget_key->nav_menu = $menu_id;
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ return $all_sidebars;
156
+ }
157
+
158
+ /**
159
+ * Download File Into Uploads Directory
160
+ *
161
+ * @since 2.1.0 Added $overrides argument to override the uploaded file actions.
162
+ *
163
+ * @param string $file Download File URL.
164
+ * @param array $overrides Upload file arguments.
165
+ * @param int $timeout_seconds Timeout in downloading the XML file in seconds.
166
+ * @return array Downloaded file data.
167
+ */
168
+ public static function download_file( $file = '', $overrides = array(), $timeout_seconds = 300 ) {
169
+
170
+ // Gives us access to the download_url() and wp_handle_sideload() functions.
171
+ require_once ABSPATH . 'wp-admin/includes/file.php';
172
+
173
+ // Download file to temp dir.
174
+ $temp_file = download_url( $file, $timeout_seconds );
175
+
176
+ // WP Error.
177
+ if ( is_wp_error( $temp_file ) ) {
178
+ return array(
179
+ 'success' => false,
180
+ 'data' => $temp_file->get_error_message(),
181
+ );
182
+ }
183
+
184
+ // Array based on $_FILE as seen in PHP file uploads.
185
+ $file_args = array(
186
+ 'name' => basename( $file ),
187
+ 'tmp_name' => $temp_file,
188
+ 'error' => 0,
189
+ 'size' => filesize( $temp_file ),
190
+ );
191
+
192
+ $defaults = array(
193
+
194
+ // Tells WordPress to not look for the POST form
195
+ // fields that would normally be present as
196
+ // we downloaded the file from a remote server, so there
197
+ // will be no form fields
198
+ // Default is true.
199
+ 'test_form' => false,
200
+
201
+ // Setting this to false lets WordPress allow empty files, not recommended.
202
+ // Default is true.
203
+ 'test_size' => true,
204
+
205
+ // A properly uploaded file will pass this test. There should be no reason to override this one.
206
+ 'test_upload' => true,
207
+
208
+ 'mimes' => array(
209
+ 'xml' => 'text/xml',
210
+ 'json' => 'text/plain',
211
+ ),
212
+ );
213
+
214
+ $overrides = wp_parse_args( $overrides, $defaults );
215
+
216
+ // Move the temporary file into the uploads directory.
217
+ $results = wp_handle_sideload( $file_args, $overrides );
218
+
219
+ astra_sites_error_log( wp_json_encode( $results ) );
220
+
221
+ if ( isset( $results['error'] ) ) {
222
+ return array(
223
+ 'success' => false,
224
+ 'data' => $results,
225
+ );
226
+ }
227
+
228
+ // Success.
229
+ return array(
230
+ 'success' => true,
231
+ 'data' => $results,
232
+ );
233
+ }
234
+
235
+ /**
236
+ * Downloads an image from the specified URL.
237
+ *
238
+ * Taken from the core media_sideload_image() function and
239
+ * modified to return an array of data instead of html.
240
+ *
241
+ * @since 1.0.10
242
+ *
243
+ * @param string $file The image file path.
244
+ * @return array An array of image data.
245
+ */
246
+ public static function sideload_image( $file ) {
247
+ $data = new stdClass();
248
+
249
+ if ( ! function_exists( 'media_handle_sideload' ) ) {
250
+ require_once ABSPATH . 'wp-admin/includes/media.php';
251
+ require_once ABSPATH . 'wp-admin/includes/file.php';
252
+ require_once ABSPATH . 'wp-admin/includes/image.php';
253
+ }
254
+
255
+ if ( ! empty( $file ) ) {
256
+
257
+ // Set variables for storage, fix file filename for query strings.
258
+ preg_match( '/[^\?]+\.(jpe?g|jpe|svg|gif|png)\b/i', $file, $matches );
259
+ $file_array = array();
260
+ $file_array['name'] = basename( $matches[0] );
261
+
262
+ // Download file to temp location.
263
+ $file_array['tmp_name'] = download_url( $file );
264
+
265
+ // If error storing temporarily, return the error.
266
+ if ( is_wp_error( $file_array['tmp_name'] ) ) {
267
+ return $file_array['tmp_name'];
268
+ }
269
+
270
+ // Do the validation and storage stuff.
271
+ $id = media_handle_sideload( $file_array, 0 );
272
+
273
+ // If error storing permanently, unlink.
274
+ if ( is_wp_error( $id ) ) {
275
+ unlink( $file_array['tmp_name'] );
276
+ return $id;
277
+ }
278
+
279
+ // Build the object to return.
280
+ $meta = wp_get_attachment_metadata( $id );
281
+ $data->attachment_id = $id;
282
+ $data->url = wp_get_attachment_url( $id );
283
+ $data->thumbnail_url = wp_get_attachment_thumb_url( $id );
284
+ $data->height = isset( $meta['height'] ) ? $meta['height'] : '';
285
+ $data->width = isset( $meta['width'] ) ? $meta['width'] : '';
286
+ }
287
+
288
+ return $data;
289
+ }
290
+
291
+ /**
292
+ * Extract image URLs and other URLs from a given HTML content.
293
+ *
294
+ * @since 2.6.10
295
+ *
296
+ * @param string $content HTML content string.
297
+ * @return array Array of URLS.
298
+ */
299
+ public static function extract_segregated_urls( $content ) {
300
+ // Extract all links.
301
+ preg_match_all( '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $content, $match );
302
+
303
+ $extracts = array(
304
+ 'image' => array(),
305
+ 'other' => array(),
306
+ );
307
+
308
+ $all_links = array_unique( $match[0] );
309
+
310
+ // Not have any link.
311
+ if ( empty( $all_links ) ) {
312
+ return array();
313
+ }
314
+
315
+ $image_links = array();
316
+ $other_links = array();
317
+
318
+ // Extract normal and image links.
319
+ foreach ( $all_links as $key => $link ) {
320
+ if ( preg_match( '/^((https?:\/\/)|(www\.))([a-z0-9-].?)+(:[0-9]+)?\/[\w\-]+\.(jpg|png|gif|jpeg)\/?$/i', $link ) ) {
321
+
322
+ // Get all image links.
323
+ // Avoid *-150x, *-300x and *-1024x images.
324
+ if (
325
+ false === strpos( $link, '-150x' ) &&
326
+ false === strpos( $link, '-300x' ) &&
327
+ false === strpos( $link, '-1024x' )
328
+ ) {
329
+ $image_links[] = $link;
330
+ }
331
+ } else {
332
+
333
+ // Collect other links.
334
+ $other_links[] = $link;
335
+ }
336
+ }
337
+
338
+ $extracts['image'] = $image_links;
339
+ $extracts['other'] = $other_links;
340
+
341
+ return $extracts;
342
+ }
343
+
344
+ /**
345
+ * Get the client IP address.
346
+ *
347
+ * @since 2.6.4
348
+ */
349
+ public static function get_client_ip() {
350
+ $ipaddress = '';
351
+ if ( getenv( 'HTTP_CLIENT_IP' ) ) {
352
+ $ipaddress = getenv( 'HTTP_CLIENT_IP' );
353
+ } elseif ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
354
+ $ipaddress = getenv( 'HTTP_X_FORWARDED_FOR' );
355
+ } elseif ( getenv( 'HTTP_X_FORWARDED' ) ) {
356
+ $ipaddress = getenv( 'HTTP_X_FORWARDED' );
357
+ } elseif ( getenv( 'HTTP_FORWARDED_FOR' ) ) {
358
+ $ipaddress = getenv( 'HTTP_FORWARDED_FOR' );
359
+ } elseif ( getenv( 'HTTP_FORWARDED' ) ) {
360
+ $ipaddress = getenv( 'HTTP_FORWARDED' );
361
+ } elseif ( getenv( 'REMOTE_ADDR' ) ) {
362
+ $ipaddress = getenv( 'REMOTE_ADDR' );
363
+ } else {
364
+ $ipaddress = 'UNKNOWN';
365
+ }
366
+ return $ipaddress;
367
+ }
368
+
369
+ }
370
+
371
+ /**
372
+ * Kicking this off by calling 'get_instance()' method
373
+ */
374
+ Astra_Sites_Helper::get_instance();
375
+
376
+ endif;
astra-sites/inc/importers/class-astra-widget-importer.php ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Widget Importer Exporter
4
+ * https://github.com/churchthemes/widget-importer-exporter
5
+ *
6
+ * Released under the GNU General Public License v2.0
7
+ * https://github.com/churchthemes/widget-importer-exporter/blob/master/license.txt
8
+ *
9
+ * Widget Data exporter class.
10
+ *
11
+ * @since 2.0.0
12
+ * @package Astra Sites
13
+ */
14
+
15
+ if ( ! defined( 'ABSPATH' ) ) {
16
+ exit; // Exit if accessed directly.
17
+ }
18
+
19
+ /**
20
+ * Widget Data exporter class.
21
+ */
22
+ class Astra_Widget_Importer {
23
+
24
+ /**
25
+ * Instance of Astra_Widget_Importer
26
+ *
27
+ * @var Astra_Widget_Importer
28
+ */
29
+ private static $instance = null;
30
+
31
+ /**
32
+ * Instance
33
+ *
34
+ * @return object
35
+ */
36
+ public static function instance() {
37
+
38
+ if ( ! isset( self::$instance ) ) {
39
+ self::$instance = new self();
40
+ }
41
+
42
+ return self::$instance;
43
+ }
44
+
45
+ /**
46
+ * Available widgets
47
+ *
48
+ * Gather site's widgets into array with ID base, name, etc.
49
+ * Used by export and import functions.
50
+ *
51
+ * @since 0.4
52
+ * @global array $wp_registered_widget_updates
53
+ * @return array Widget information
54
+ */
55
+ public function wie_available_widgets() {
56
+
57
+ global $wp_registered_widget_controls;
58
+
59
+ $widget_controls = $wp_registered_widget_controls;
60
+
61
+ $available_widgets = array();
62
+
63
+ foreach ( $widget_controls as $widget ) {
64
+
65
+ if ( ! empty( $widget['id_base'] ) && ! isset( $available_widgets[ $widget['id_base'] ] ) ) { // no dupes.
66
+
67
+ $available_widgets[ $widget['id_base'] ]['id_base'] = $widget['id_base'];
68
+ $available_widgets[ $widget['id_base'] ]['name'] = $widget['name'];
69
+
70
+ }
71
+ }
72
+
73
+ return apply_filters( 'wie_available_widgets', $available_widgets );
74
+ }
75
+
76
+ /**
77
+ * Import widget JSON data
78
+ *
79
+ * @since 0.4
80
+ * @global array $wp_registered_sidebars
81
+ *
82
+ * @param object $data JSON widget data from .wie file.
83
+ *
84
+ * @return array Results array
85
+ */
86
+ public function import_widgets_data( $data ) {
87
+
88
+ global $wp_registered_sidebars;
89
+
90
+ // Have valid data?
91
+ // If no data or could not decode.
92
+ if ( empty( $data ) || ! is_object( $data ) ) {
93
+ wp_die(
94
+ esc_html__( 'Import data could not be read. Please try a different file.', 'astra-sites' ),
95
+ '',
96
+ array(
97
+ 'back_link' => true,
98
+ )
99
+ );
100
+ }
101
+
102
+ // Hook before import.
103
+ do_action( 'wie_before_import' );
104
+ $data = apply_filters( 'wie_import_data', $data );
105
+
106
+ // Get all available widgets site supports.
107
+ $available_widgets = $this->wie_available_widgets();
108
+
109
+ // Get all existing widget instances.
110
+ $widget_instances = array();
111
+ foreach ( $available_widgets as $widget_data ) {
112
+ $widget_instances[ $widget_data['id_base'] ] = get_option( 'widget_' . $widget_data['id_base'] );
113
+ }
114
+
115
+ // Begin results.
116
+ $results = array();
117
+
118
+ // Loop import data's sidebars.
119
+ foreach ( $data as $sidebar_id => $widgets ) {
120
+
121
+ // Skip inactive widgets.
122
+ // (should not be in export file).
123
+ if ( 'wp_inactive_widgets' === $sidebar_id ) {
124
+ continue;
125
+ }
126
+
127
+ // Check if sidebar is available on this site.
128
+ // Otherwise add widgets to inactive, and say so.
129
+ if ( isset( $wp_registered_sidebars[ $sidebar_id ] ) ) {
130
+ $sidebar_available = true;
131
+ $use_sidebar_id = $sidebar_id;
132
+ $sidebar_message_type = 'success';
133
+ $sidebar_message = '';
134
+ } else {
135
+ $sidebar_available = false;
136
+ $use_sidebar_id = 'wp_inactive_widgets'; // add to inactive if sidebar does not exist in theme.
137
+ $sidebar_message_type = 'error';
138
+ $sidebar_message = esc_html__( 'Widget area does not exist in theme (using Inactive)', 'astra-sites' );
139
+ }
140
+
141
+ // Result for sidebar.
142
+ $results[ $sidebar_id ]['name'] = ! empty( $wp_registered_sidebars[ $sidebar_id ]['name'] ) ? $wp_registered_sidebars[ $sidebar_id ]['name'] : $sidebar_id; // sidebar name if theme supports it; otherwise ID.
143
+ $results[ $sidebar_id ]['message_type'] = $sidebar_message_type;
144
+ $results[ $sidebar_id ]['message'] = $sidebar_message;
145
+ $results[ $sidebar_id ]['widgets'] = array();
146
+
147
+ // Loop widgets.
148
+ foreach ( $widgets as $widget_instance_id => $widget ) {
149
+
150
+ $fail = false;
151
+
152
+ // Get id_base (remove -# from end) and instance ID number.
153
+ $id_base = preg_replace( '/-[0-9]+$/', '', $widget_instance_id );
154
+ $instance_id_number = str_replace( $id_base . '-', '', $widget_instance_id );
155
+
156
+ // Does site support this widget?
157
+ if ( ! $fail && ! isset( $available_widgets[ $id_base ] ) ) {
158
+ $fail = true;
159
+ $widget_message_type = 'error';
160
+ $widget_message = esc_html__( 'Site does not support widget', 'astra-sites' ); // explain why widget not imported.
161
+ }
162
+
163
+ // Filter to modify settings object before conversion to array and import.
164
+ // Leave this filter here for backwards compatibility with manipulating objects (before conversion to array below).
165
+ // Ideally the newer wie_widget_settings_array below will be used instead of this.
166
+ $widget = apply_filters( 'wie_widget_settings', $widget ); // object.
167
+
168
+ // Convert multidimensional objects to multidimensional arrays
169
+ // Some plugins like Jetpack Widget Visibility store settings as multidimensional arrays
170
+ // Without this, they are imported as objects and cause fatal error on Widgets page
171
+ // If this creates problems for plugins that do actually intend settings in objects then may need to consider other approach: https://wordpress.org/support/topic/problem-with-array-of-arrays
172
+ // It is probably much more likely that arrays are used than objects, however.
173
+ $widget = json_decode( wp_json_encode( $widget ), true );
174
+
175
+ // Filter to modify settings array
176
+ // This is preferred over the older wie_widget_settings filter above.
177
+ // Do before identical check because changes may make it identical to end result (such as URL replacements).
178
+ $widget = apply_filters( 'wie_widget_settings_array', $widget );
179
+
180
+ // Does widget with identical settings already exist in same sidebar?
181
+ if ( ! $fail && isset( $widget_instances[ $id_base ] ) ) {
182
+
183
+ // Get existing widgets in this sidebar.
184
+ $sidebars_widgets = get_option( 'sidebars_widgets' );
185
+ $sidebar_widgets = isset( $sidebars_widgets[ $use_sidebar_id ] ) ? $sidebars_widgets[ $use_sidebar_id ] : array(); // check Inactive if that's where will go.
186
+
187
+ // Loop widgets with ID base.
188
+ $single_widget_instances = ! empty( $widget_instances[ $id_base ] ) ? $widget_instances[ $id_base ] : array();
189
+ foreach ( $single_widget_instances as $check_id => $check_widget ) {
190
+
191
+ // Is widget in same sidebar and has identical settings?
192
+ if ( in_array( "$id_base-$check_id", $sidebar_widgets, true ) && (array) $widget === $check_widget ) {
193
+
194
+ $fail = true;
195
+ $widget_message_type = 'warning';
196
+ $widget_message = esc_html__( 'Widget already exists', 'astra-sites' ); // explain why widget not imported.
197
+
198
+ break;
199
+
200
+ }
201
+ }
202
+ }
203
+
204
+ // No failure.
205
+ if ( ! $fail ) {
206
+
207
+ // Add widget instance.
208
+ $single_widget_instances = get_option( 'widget_' . $id_base ); // all instances for that widget ID base, get fresh every time.
209
+ $single_widget_instances = ! empty( $single_widget_instances ) ? $single_widget_instances : array(
210
+ '_multiwidget' => 1,
211
+ ); // start fresh if have to.
212
+ $single_widget_instances[] = $widget; // add it.
213
+
214
+ // Get the key it was given.
215
+ end( $single_widget_instances );
216
+ $new_instance_id_number = key( $single_widget_instances );
217
+
218
+ // If key is 0, make it 1.
219
+ // When 0, an issue can occur where adding a widget causes data from other widget to load, and the widget doesn't stick (reload wipes it).
220
+ if ( '0' === strval( $new_instance_id_number ) ) {
221
+ $new_instance_id_number = 1;
222
+ $single_widget_instances[ $new_instance_id_number ] = $single_widget_instances[0];
223
+ unset( $single_widget_instances[0] );
224
+ }
225
+
226
+ // Move _multiwidget to end of array for uniformity.
227
+ if ( isset( $single_widget_instances['_multiwidget'] ) ) {
228
+ $multiwidget = $single_widget_instances['_multiwidget'];
229
+ unset( $single_widget_instances['_multiwidget'] );
230
+ $single_widget_instances['_multiwidget'] = $multiwidget;
231
+ }
232
+
233
+ // Update option with new widget.
234
+ $result = update_option( 'widget_' . $id_base, $single_widget_instances );
235
+
236
+ // Assign widget instance to sidebar.
237
+ $sidebars_widgets = get_option( 'sidebars_widgets' ); // which sidebars have which widgets, get fresh every time.
238
+
239
+ // Avoid rarely fatal error when the option is an empty string.
240
+ // https://github.com/churchthemes/widget-importer-exporter/pull/11.
241
+ if ( ! $sidebars_widgets ) {
242
+ $sidebars_widgets = array();
243
+ }
244
+
245
+ $new_instance_id = $id_base . '-' . $new_instance_id_number; // use ID number from new widget instance.
246
+ $sidebars_widgets[ $use_sidebar_id ][] = $new_instance_id; // add new instance to sidebar.
247
+ update_option( 'sidebars_widgets', $sidebars_widgets ); // save the amended data.
248
+
249
+ // After widget import action.
250
+ $after_widget_import = array(
251
+ 'sidebar' => $use_sidebar_id,
252
+ 'sidebar_old' => $sidebar_id,
253
+ 'widget' => $widget,
254
+ 'widget_type' => $id_base,
255
+ 'widget_id' => $new_instance_id,
256
+ 'widget_id_old' => $widget_instance_id,
257
+ 'widget_id_num' => $new_instance_id_number,
258
+ 'widget_id_num_old' => $instance_id_number,
259
+ );
260
+ do_action( 'wie_after_widget_import', $after_widget_import );
261
+
262
+ // Success message.
263
+ if ( $sidebar_available ) {
264
+ $widget_message_type = 'success';
265
+ $widget_message = esc_html__( 'Imported', 'astra-sites' );
266
+ } else {
267
+ $widget_message_type = 'warning';
268
+ $widget_message = esc_html__( 'Imported to Inactive', 'astra-sites' );
269
+ }
270
+ }
271
+
272
+ // Result for widget instance.
273
+ $results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['name'] = isset( $available_widgets[ $id_base ]['name'] ) ? $available_widgets[ $id_base ]['name'] : $id_base; // widget name or ID if name not available (not supported by site).
274
+ $results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['title'] = ! empty( $widget['title'] ) ? $widget['title'] : esc_html__( 'No Title', 'astra-sites' ); // show "No Title" if widget instance is untitled.
275
+ $results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message_type'] = $widget_message_type;
276
+ $results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message'] = $widget_message;
277
+
278
+ }
279
+ }
280
+
281
+ // Hook after import.
282
+ do_action( 'wie_after_import' );
283
+
284
+ // Return results.
285
+ return apply_filters( 'wie_import_results', $results );
286
+
287
+ }
288
+
289
+ }
astra-sites/inc/importers/wxr-importer/class-astra-wxr-importer.php ADDED
@@ -0,0 +1,567 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Astra WXR Importer
4
+ *
5
+ * @since 1.0.0
6
+ * @package Astra Addon
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit; // Exit if accessed directly.
11
+ }
12
+
13
+ /**
14
+ * Class Astra WXR Importer
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class Astra_WXR_Importer {
19
+
20
+ /**
21
+ * Instance of Astra_WXR_Importer
22
+ *
23
+ * @since 1.0.0
24
+ * @var Astra_WXR_Importer
25
+ */
26
+ private static $instance = null;
27
+
28
+ /**
29
+ * Instantiate Astra_WXR_Importer
30
+ *
31
+ * @since 1.0.0
32
+ * @return (Object) Astra_WXR_Importer.
33
+ */
34
+ public static function instance() {
35
+ if ( ! isset( self::$instance ) ) {
36
+ self::$instance = new self();
37
+ }
38
+
39
+ return self::$instance;
40
+ }
41
+
42
+ /**
43
+ * Constructor.
44
+ *
45
+ * @since 1.0.0
46
+ */
47
+ private function __construct() {
48
+
49
+ require_once ABSPATH . '/wp-admin/includes/class-wp-importer.php';
50
+ require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wp-importer-logger.php';
51
+ require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wp-importer-logger-serversentevents.php';
52
+ require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wxr-importer.php';
53
+ require_once ASTRA_SITES_DIR . 'inc/importers/wxr-importer/class-wxr-import-info.php';
54
+
55
+ add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
56
+ add_action( 'wp_ajax_astra-wxr-import', array( $this, 'sse_import' ) );
57
+ add_filter( 'wxr_importer.pre_process.user', '__return_null' );
58
+ add_filter( 'wp_import_post_data_processed', array( $this, 'pre_post_data' ), 10, 2 );
59
+ add_filter( 'wxr_importer.pre_process.post', array( $this, 'pre_process_post' ), 10, 4 );
60
+ if ( version_compare( get_bloginfo( 'version' ), '5.1.0', '>=' ) ) {
61
+ add_filter( 'wp_check_filetype_and_ext', array( $this, 'real_mime_types_5_1_0' ), 10, 5 );
62
+ } else {
63
+ add_filter( 'wp_check_filetype_and_ext', array( $this, 'real_mime_types' ), 10, 4 );
64
+ }
65
+
66
+ }
67
+
68
+ /**
69
+ * Track Imported Post
70
+ *
71
+ * @param int $post_id Post ID.
72
+ * @param array $data Raw data imported for the post.
73
+ * @return void
74
+ */
75
+ public function track_post( $post_id = 0, $data = array() ) {
76
+ Astra_Sites_Importer_Log::add( 'Inserted - Post ' . $post_id . ' - ' . get_post_type( $post_id ) . ' - ' . get_the_title( $post_id ) );
77
+
78
+ update_post_meta( $post_id, '_astra_sites_imported_post', true );
79
+ update_post_meta( $post_id, '_astra_sites_enable_for_batch', true );
80
+
81
+ // Set the full width template for the pages.
82
+ if ( isset( $data['post_type'] ) && 'page' === $data['post_type'] ) {
83
+ $is_elementor_page = get_post_meta( $post_id, '_elementor_version', true );
84
+ $theme_status = Astra_Sites::get_instance()->get_theme_status();
85
+ if ( 'installed-and-active' !== $theme_status && $is_elementor_page ) {
86
+ update_post_meta( $post_id, '_wp_page_template', 'elementor_header_footer' );
87
+ }
88
+ } elseif ( isset( $data['post_type'] ) && 'attachment' === $data['post_type'] ) {
89
+ $remote_url = isset( $data['guid'] ) ? $data['guid'] : '';
90
+ $attachment_hash_url = Astra_Sites_Image_Importer::get_instance()->get_hash_image( $remote_url );
91
+ if ( ! empty( $attachment_hash_url ) ) {
92
+ update_post_meta( $post_id, '_astra_sites_image_hash', $attachment_hash_url );
93
+ update_post_meta( $post_id, '_elementor_source_image_hash', $attachment_hash_url );
94
+ }
95
+ }
96
+
97
+ }
98
+
99
+ /**
100
+ * Track Imported Term
101
+ *
102
+ * @param int $term_id Term ID.
103
+ * @return void
104
+ */
105
+ public function track_term( $term_id ) {
106
+ $term = get_term( $term_id );
107
+ if ( $term ) {
108
+ Astra_Sites_Importer_Log::add( 'Inserted - Term ' . $term_id . ' - ' . wp_json_encode( $term ) );
109
+ }
110
+ update_term_meta( $term_id, '_astra_sites_imported_term', true );
111
+ }
112
+
113
+ /**
114
+ * Pre Post Data
115
+ *
116
+ * @since 2.1.0
117
+ *
118
+ * @param array $postdata Post data.
119
+ * @param array $data Post data.
120
+ * @return array Post data.
121
+ */
122
+ public function pre_post_data( $postdata, $data ) {
123
+
124
+ // Skip GUID field which point to the https://websitedemos.net.
125
+ $postdata['guid'] = '';
126
+
127
+ return $postdata;
128
+ }
129
+
130
+ /**
131
+ * Pre Process Post
132
+ *
133
+ * @since 1.2.12
134
+ *
135
+ * @param array $data Post data. (Return empty to skip.).
136
+ * @param array $meta Meta data.
137
+ * @param array $comments Comments on the post.
138
+ * @param array $terms Terms on the post.
139
+ */
140
+ public function pre_process_post( $data, $meta, $comments, $terms ) {
141
+
142
+ if ( isset( $data['post_content'] ) ) {
143
+
144
+ $meta_data = wp_list_pluck( $meta, 'key' );
145
+
146
+ $is_attachment = ( 'attachment' === $data['post_type'] ) ? true : false;
147
+ $is_elementor_page = in_array( '_elementor_version', $meta_data, true );
148
+ $is_beaver_builder_page = in_array( '_fl_builder_enabled', $meta_data, true );
149
+ $is_brizy_page = in_array( 'brizy_post_uid', $meta_data, true );
150
+
151
+ $disable_post_content = apply_filters( 'astra_sites_pre_process_post_disable_content', ( $is_attachment || $is_elementor_page || $is_beaver_builder_page || $is_brizy_page ) );
152
+
153
+ // If post type is `attachment OR
154
+ // If page contain Elementor, Brizy or Beaver Builder meta then skip this page.
155
+ if ( $disable_post_content ) {
156
+ $data['post_content'] = '';
157
+ } else {
158
+ /**
159
+ * Gutenberg Content Data Fix
160
+ *
161
+ * Gutenberg encode the page content. In import process the encoded characterless e.g. <, > are
162
+ * decoded into HTML tag and it break the Gutenberg render markup.
163
+ *
164
+ * Note: We have not check the post is created with Gutenberg or not. We have imported other sites
165
+ * and confirm that this works for every other page builders too.
166
+ */
167
+ $data['post_content'] = wp_slash( $data['post_content'] );
168
+ }
169
+ }
170
+
171
+ return $data;
172
+ }
173
+
174
+ /**
175
+ * Different MIME type of different PHP version
176
+ *
177
+ * Filters the "real" file type of the given file.
178
+ *
179
+ * @since 1.2.9
180
+ *
181
+ * @param array $defaults File data array containing 'ext', 'type', and
182
+ * 'proper_filename' keys.
183
+ * @param string $file Full path to the file.
184
+ * @param string $filename The name of the file (may differ from $file due to
185
+ * $file being in a tmp directory).
186
+ * @param array $mimes Key is the file extension with value as the mime type.
187
+ * @param string $real_mime Real MIME type of the uploaded file.
188
+ */
189
+ public function real_mime_types_5_1_0( $defaults, $file, $filename, $mimes, $real_mime ) {
190
+ return $this->real_mimes( $defaults, $filename );
191
+ }
192
+
193
+ /**
194
+ * Different MIME type of different PHP version
195
+ *
196
+ * Filters the "real" file type of the given file.
197
+ *
198
+ * @since 1.2.9
199
+ *
200
+ * @param array $defaults File data array containing 'ext', 'type', and
201
+ * 'proper_filename' keys.
202
+ * @param string $file Full path to the file.
203
+ * @param string $filename The name of the file (may differ from $file due to
204
+ * $file being in a tmp directory).
205
+ * @param array $mimes Key is the file extension with value as the mime type.
206
+ */
207
+ public function real_mime_types( $defaults, $file, $filename, $mimes ) {
208
+ return $this->real_mimes( $defaults, $filename );
209
+ }
210
+
211
+ /**
212
+ * Real Mime Type
213
+ *
214
+ * @since 1.2.15
215
+ *
216
+ * @param array $defaults File data array containing 'ext', 'type', and
217
+ * 'proper_filename' keys.
218
+ * @param string $filename The name of the file (may differ from $file due to
219
+ * $file being in a tmp directory).
220
+ */
221
+ public function real_mimes( $defaults, $filename ) {
222
+
223
+ // Set EXT and real MIME type only for the file name `wxr.xml`.
224
+ if ( strpos( $filename, 'wxr' ) !== false ) {
225
+ $defaults['ext'] = 'xml';
226
+ $defaults['type'] = 'text/xml';
227
+ }
228
+
229
+ // Set EXT and real MIME type only for the file name `wpforms.json` or `wpforms-{page-id}.json`.
230
+ if ( ( strpos( $filename, 'wpforms' ) !== false ) || ( strpos( $filename, 'cartflows' ) !== false ) ) {
231
+ $defaults['ext'] = 'json';
232
+ $defaults['type'] = 'text/plain';
233
+ }
234
+
235
+ return $defaults;
236
+ }
237
+
238
+ /**
239
+ * Set GUID as per the attachment URL which avoid duplicate images issue due to the different GUID.
240
+ *
241
+ * @param array $data Post data. (Return empty to skip).
242
+ * @param array $meta Meta data.
243
+ * @param array $comments Comments on the post.
244
+ * @param array $terms Terms on the post.
245
+ */
246
+ public function fix_image_duplicate_issue( $data, $meta, $comments, $terms ) {
247
+
248
+ $remote_url = ! empty( $data['attachment_url'] ) ? $data['attachment_url'] : $data['guid'];
249
+ $data['guid'] = $remote_url;
250
+
251
+ return $data;
252
+ }
253
+
254
+ /**
255
+ * Enable the WP_Image_Editor_GD library.
256
+ *
257
+ * @since 2.2.3
258
+ * @param array $editors Image editors library list.
259
+ * @return array
260
+ */
261
+ public function enable_wp_image_editor_gd( $editors ) {
262
+ $gd_editor = 'WP_Image_Editor_GD';
263
+ $editors = array_diff( $editors, array( $gd_editor ) );
264
+ array_unshift( $editors, $gd_editor );
265
+ return $editors;
266
+ }
267
+
268
+ /**
269
+ * Constructor.
270
+ *
271
+ * @since 1.1.0
272
+ * @since 1.4.0 The `$xml_url` was added.
273
+ *
274
+ * @param string $xml_url XML file URL.
275
+ */
276
+ public function sse_import( $xml_url = '' ) {
277
+
278
+ if ( wp_doing_ajax() ) {
279
+
280
+ // Verify Nonce.
281
+ check_ajax_referer( 'astra-sites', '_ajax_nonce' );
282
+
283
+ // @codingStandardsIgnoreStart
284
+ // Start the event stream.
285
+ header( 'Content-Type: text/event-stream, charset=UTF-8' );
286
+ // Turn off PHP output compression.
287
+ $previous = error_reporting( error_reporting() ^ E_WARNING );
288
+ ini_set( 'output_buffering', 'off' );
289
+ ini_set( 'zlib.output_compression', false );
290
+ error_reporting( $previous );
291
+
292
+ if ( $GLOBALS['is_nginx'] ) {
293
+ // Setting this header instructs Nginx to disable fastcgi_buffering
294
+ // and disable gzip for this request.
295
+ header( 'X-Accel-Buffering: no' );
296
+ header( 'Content-Encoding: none' );
297
+ }
298
+ // @codingStandardsIgnoreEnd
299
+
300
+ // 2KB padding for IE.
301
+ echo esc_html( ':' . str_repeat( ' ', 2048 ) . "\n\n" );
302
+ }
303
+
304
+ $xml_id = isset( $_REQUEST['xml_id'] ) ? absint( $_REQUEST['xml_id'] ) : '';
305
+ if ( ! empty( $xml_id ) ) {
306
+ $xml_url = get_attached_file( $xml_id );
307
+ }
308
+
309
+ if ( empty( $xml_url ) ) {
310
+ exit;
311
+ }
312
+
313
+ if ( ! wp_doing_ajax() ) {
314
+ // Time to run the import!
315
+ set_time_limit( 0 );
316
+
317
+ // Ensure we're not buffered.
318
+ wp_ob_end_flush_all();
319
+ flush();
320
+ }
321
+
322
+ // Enable default GD library.
323
+ add_filter( 'wp_image_editors', array( $this, 'enable_wp_image_editor_gd' ) );
324
+
325
+ // Change GUID image URL.
326
+ add_filter( 'wxr_importer.pre_process.post', array( $this, 'fix_image_duplicate_issue' ), 10, 4 );
327
+
328
+ // Are we allowed to create users?
329
+ add_filter( 'wxr_importer.pre_process.user', '__return_null' );
330
+
331
+ // Keep track of our progress.
332
+ add_action( 'wxr_importer.processed.post', array( $this, 'imported_post' ), 10, 2 );
333
+ add_action( 'wxr_importer.process_failed.post', array( $this, 'imported_post' ), 10, 2 );
334
+ add_action( 'wxr_importer.process_already_imported.post', array( $this, 'already_imported_post' ), 10, 2 );
335
+ add_action( 'wxr_importer.process_skipped.post', array( $this, 'already_imported_post' ), 10, 2 );
336
+ add_action( 'wxr_importer.processed.comment', array( $this, 'imported_comment' ) );
337
+ add_action( 'wxr_importer.process_already_imported.comment', array( $this, 'imported_comment' ) );
338
+ add_action( 'wxr_importer.processed.term', array( $this, 'imported_term' ) );
339
+ add_action( 'wxr_importer.process_failed.term', array( $this, 'imported_term' ) );
340
+ add_action( 'wxr_importer.process_already_imported.term', array( $this, 'imported_term' ) );
341
+ add_action( 'wxr_importer.processed.user', array( $this, 'imported_user' ) );
342
+ add_action( 'wxr_importer.process_failed.user', array( $this, 'imported_user' ) );
343
+
344
+ // Keep track of our progress.
345
+ add_action( 'wxr_importer.processed.post', array( $this, 'track_post' ), 10, 2 );
346
+ add_action( 'wxr_importer.processed.term', array( $this, 'track_term' ) );
347
+
348
+ // Flush once more.
349
+ flush();
350
+
351
+ $importer = $this->get_importer();
352
+ $response = $importer->import( $xml_url );
353
+
354
+ // Let the browser know we're done.
355
+ $complete = array(
356
+ 'action' => 'complete',
357
+ 'error' => false,
358
+ );
359
+ if ( is_wp_error( $response ) ) {
360
+ $complete['error'] = $response->get_error_message();
361
+ }
362
+
363
+ $this->emit_sse_message( $complete );
364
+ if ( wp_doing_ajax() ) {
365
+ exit;
366
+ }
367
+ }
368
+
369
+ /**
370
+ * Add .xml files as supported format in the uploader.
371
+ *
372
+ * @since 1.1.5 Added SVG file support.
373
+ *
374
+ * @since 1.0.0
375
+ *
376
+ * @param array $mimes Already supported mime types.
377
+ */
378
+ public function custom_upload_mimes( $mimes ) {
379
+
380
+ // Allow SVG files.
381
+ $mimes['svg'] = 'image/svg+xml';
382
+ $mimes['svgz'] = 'image/svg+xml';
383
+
384
+ // Allow XML files.
385
+ $mimes['xml'] = 'text/xml';
386
+
387
+ // Allow JSON files.
388
+ $mimes['json'] = 'application/json';
389
+
390
+ return $mimes;
391
+ }
392
+
393
+ /**
394
+ * Start the xml import.
395
+ *
396
+ * @since 1.0.0
397
+ * @since 2.1.0 Added $post_id argument which is the downloaded XML file attachment ID.
398
+ *
399
+ * @param string $path Absolute path to the XML file.
400
+ * @param int $post_id Uploaded XML file ID.
401
+ */
402
+ public function get_xml_data( $path, $post_id ) {
403
+
404
+ $args = array(
405
+ 'action' => 'astra-wxr-import',
406
+ 'id' => '1',
407
+ '_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
408
+ 'xml_id' => $post_id,
409
+ );
410
+ $url = add_query_arg( urlencode_deep( $args ), admin_url( 'admin-ajax.php' ) );
411
+
412
+ $data = $this->get_data( $path );
413
+
414
+ return array(
415
+ 'count' => array(
416
+ 'posts' => $data->post_count,
417
+ 'media' => $data->media_count,
418
+ 'users' => count( $data->users ),
419
+ 'comments' => $data->comment_count,
420
+ 'terms' => $data->term_count,
421
+ ),
422
+ 'url' => $url,
423
+ 'strings' => array(
424
+ 'complete' => __( 'Import complete!', 'astra-sites' ),
425
+ ),
426
+ );
427
+ }
428
+
429
+ /**
430
+ * Get XML data.
431
+ *
432
+ * @since 1.1.0
433
+ * @param string $url Downloaded XML file absolute URL.
434
+ * @return array XML file data.
435
+ */
436
+ public function get_data( $url ) {
437
+ $importer = $this->get_importer();
438
+ $data = $importer->get_preliminary_information( $url );
439
+ if ( is_wp_error( $data ) ) {
440
+ return $data;
441
+ }
442
+ return $data;
443
+ }
444
+
445
+ /**
446
+ * Get Importer
447
+ *
448
+ * @since 1.1.0
449
+ * @return object Importer object.
450
+ */
451
+ public function get_importer() {
452
+ $options = apply_filters(
453
+ 'astra_sites_xml_import_options',
454
+ array(
455
+ 'update_attachment_guids' => true,
456
+ 'fetch_attachments' => true,
457
+ 'default_author' => get_current_user_id(),
458
+ )
459
+ );
460
+
461
+ $importer = new WXR_Importer( $options );
462
+ $logger = new WP_Importer_Logger_ServerSentEvents();
463
+
464
+ $importer->set_logger( $logger );
465
+ return $importer;
466
+ }
467
+
468
+ /**
469
+ * Send message when a post has been imported.
470
+ *
471
+ * @since 1.1.0
472
+ * @param int $id Post ID.
473
+ * @param array $data Post data saved to the DB.
474
+ */
475
+ public function imported_post( $id, $data ) {
476
+ $this->emit_sse_message(
477
+ array(
478
+ 'action' => 'updateDelta',
479
+ 'type' => ( 'attachment' === $data['post_type'] ) ? 'media' : 'posts',
480
+ 'delta' => 1,
481
+ )
482
+ );
483
+ }
484
+
485
+ /**
486
+ * Send message when a post is marked as already imported.
487
+ *
488
+ * @since 1.1.0
489
+ * @param array $data Post data saved to the DB.
490
+ */
491
+ public function already_imported_post( $data ) {
492
+ $this->emit_sse_message(
493
+ array(
494
+ 'action' => 'updateDelta',
495
+ 'type' => ( 'attachment' === $data['post_type'] ) ? 'media' : 'posts',
496
+ 'delta' => 1,
497
+ )
498
+ );
499
+ }
500
+
501
+ /**
502
+ * Send message when a comment has been imported.
503
+ *
504
+ * @since 1.1.0
505
+ */
506
+ public function imported_comment() {
507
+ $this->emit_sse_message(
508
+ array(
509
+ 'action' => 'updateDelta',
510
+ 'type' => 'comments',
511
+ 'delta' => 1,
512
+ )
513
+ );
514
+ }
515
+
516
+ /**
517
+ * Send message when a term has been imported.
518
+ *
519
+ * @since 1.1.0
520
+ */
521
+ public function imported_term() {
522
+ $this->emit_sse_message(
523
+ array(
524
+ 'action' => 'updateDelta',
525
+ 'type' => 'terms',
526
+ 'delta' => 1,
527
+ )
528
+ );
529
+ }
530
+
531
+ /**
532
+ * Send message when a user has been imported.
533
+ *
534
+ * @since 1.1.0
535
+ */
536
+ public function imported_user() {
537
+ $this->emit_sse_message(
538
+ array(
539
+ 'action' => 'updateDelta',
540
+ 'type' => 'users',
541
+ 'delta' => 1,
542
+ )
543
+ );
544
+ }
545
+
546
+ /**
547
+ * Emit a Server-Sent Events message.
548
+ *
549
+ * @since 1.1.0
550
+ * @param mixed $data Data to be JSON-encoded and sent in the message.
551
+ */
552
+ public function emit_sse_message( $data ) {
553
+
554
+ if ( wp_doing_ajax() ) {
555
+ echo "event: message\n";
556
+ echo 'data: ' . wp_json_encode( $data ) . "\n\n";
557
+
558
+ // Extra padding.
559
+ echo esc_html( ':' . str_repeat( ' ', 2048 ) . "\n\n" );
560
+ }
561
+
562
+ flush();
563
+ }
564
+
565
+ }
566
+
567
+ Astra_WXR_Importer::instance();
astra-sites/inc/importers/wxr-importer/class-wp-importer-logger-serversentevents.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WordPress Importer
4
+ * https://github.com/humanmade/WordPress-Importer
5
+ *
6
+ * Released under the GNU General Public License v2.0
7
+ * https://github.com/humanmade/WordPress-Importer/blob/master/LICENSE
8
+ *
9
+ * @since 2.0.0
10
+ *
11
+ * @package WordPress Importer
12
+ */
13
+
14
+ if ( ! class_exists( 'WP_Importer_Logger_ServerSentEvents' ) && class_exists( 'WP_Importer_Logger' ) ) {
15
+
16
+ /**
17
+ * Import Log ServerSendEvents
18
+ *
19
+ * @since 2.0.0
20
+ */
21
+ class WP_Importer_Logger_ServerSentEvents extends WP_Importer_Logger {
22
+
23
+ /**
24
+ * Logs with an arbitrary level.
25
+ *
26
+ * @param mixed $level Log level.
27
+ * @param string $message Log message.
28
+ * @param array $context Log context.
29
+ * @return void
30
+ */
31
+ public function log( $level, $message, array $context = array() ) {
32
+
33
+ $data = compact( 'level', 'message' );
34
+
35
+ switch ( $level ) {
36
+ case 'emergency':
37
+ case 'alert':
38
+ case 'critical':
39
+ case 'error':
40
+ case 'warning':
41
+ case 'notice':
42
+ case 'info':
43
+ if ( defined( 'WP_CLI' ) ) {
44
+ if ( isset( $data['message'] ) && ! empty( $data['message'] ) ) {
45
+ WP_CLI::line( $data['message'] );
46
+ } else {
47
+ WP_CLI::line( wp_json_encode( $data ) );
48
+ }
49
+ } else {
50
+ echo "event: log\n";
51
+ echo 'data: ' . wp_json_encode( $data ) . "\n\n";
52
+ }
53
+ flush();
54
+ break;
55
+
56
+ case 'debug':
57
+ if ( defined( 'IMPORT_DEBUG' ) && IMPORT_DEBUG ) {
58
+ if ( defined( 'WP_CLI' ) ) {
59
+ if ( isset( $data['message'] ) && ! empty( $data['message'] ) ) {
60
+ WP_CLI::line( $data['message'] );
61
+ } else {
62
+ WP_CLI::line( wp_json_encode( $data ) );
63
+ }
64
+ } else {
65
+ echo "event: log\n";
66
+ echo 'data: ' . wp_json_encode( $data ) . "\n\n";
67
+ }
68
+ flush();
69
+ break;
70
+ }
71
+ break;
72
+ }
73
+ }
74
+ }
75
+ }
astra-sites/inc/importers/wxr-importer/class-wp-importer-logger.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WordPress Importer
4
+ * https://github.com/humanmade/WordPress-Importer
5
+ *
6
+ * Released under the GNU General Public License v2.0
7
+ * https://github.com/humanmade/WordPress-Importer/blob/master/LICENSE
8
+ *
9
+ * Describes a logger instance
10
+ *
11
+ * Based on PSR-3: http://www.php-fig.org/psr/psr-3/
12
+ *
13
+ * The message MUST be a string or object implementing __toString().
14
+ *
15
+ * The message MAY contain placeholders in the form: {foo} where foo
16
+ * will be replaced by the context data in key "foo".
17
+ *
18
+ * The context array can contain arbitrary data, the only assumption that
19
+ * can be made by implementors is that if an Exception instance is given
20
+ * to produce a stack trace, it MUST be in a key named "exception".
21
+ *
22
+ * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
23
+ * for the full interface specification.
24
+ *
25
+ * @package WordPress Importer
26
+ */
27
+
28
+ if ( ! class_exists( 'WP_Importer_Logger' ) ) :
29
+
30
+ /**
31
+ * WP Importer Log
32
+ */
33
+ class WP_Importer_Logger {
34
+
35
+ /**
36
+ * System is unusable.
37
+ *
38
+ * @param string $message Error message.
39
+ * @param array $context Error context.
40
+ * @return null
41
+ */
42
+ public function emergency( $message, array $context = array() ) {
43
+ return $this->log( 'emergency', $message, $context );
44
+ }
45
+
46
+ /**
47
+ * Action must be taken immediately.
48
+ *
49
+ * Example: Entire website down, database unavailable, etc. This should
50
+ * trigger the SMS alerts and wake you up.
51
+ *
52
+ * @param string $message Error message.
53
+ * @param array $context Error context.
54
+ * @return null
55
+ */
56
+ public function alert( $message, array $context = array() ) {
57
+ return $this->log( 'alert', $message, $context );
58
+ }
59
+
60
+ /**
61
+ * Critical conditions.
62
+ *
63
+ * Example: Application component unavailable, unexpected exception.
64
+ *
65
+ * @param string $message Error message.
66
+ * @param array $context Error context.
67
+ * @return null
68
+ */
69
+ public function critical( $message, array $context = array() ) {
70
+ return $this->log( 'critical', $message, $context );
71
+ }
72
+
73
+ /**
74
+ * Runtime errors that do not require immediate action but should typically
75
+ * be logged and monitored.
76
+ *
77
+ * @param string $message Error message.
78
+ * @param array $context Error context.
79
+ * @return null
80
+ */
81
+ public function error( $message, array $context = array() ) {
82
+ return $this->log( 'error', $message, $context );
83
+ }
84
+
85
+ /**
86
+ * Exceptional occurrences that are not errors.
87
+ *
88
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
89
+ * that are not necessarily wrong.
90
+ *
91
+ * @param string $message Error message.
92
+ * @param array $context Error context.
93
+ * @return null
94
+ */
95
+ public function warning( $message, array $context = array() ) {
96
+ return $this->log( 'warning', $message, $context );
97
+ }
98
+
99
+ /**
100
+ * Normal but significant events.
101
+ *
102
+ * @param string $message Error message.
103
+ * @param array $context Error context.
104
+ * @return null
105
+ */
106
+ public function notice( $message, array $context = array() ) {
107
+ return $this->log( 'notice', $message, $context );
108
+ }
109
+
110
+ /**
111
+ * Interesting events.
112
+ *
113
+ * Example: User logs in, SQL logs.
114
+ *
115
+ * @param string $message Error message.
116
+ * @param array $context Error context.
117
+ * @return null
118
+ */
119
+ public function info( $message, array $context = array() ) {
120
+ return $this->log( 'info', $message, $context );
121
+ }
122
+
123
+ /**
124
+ * Detailed debug information.
125
+ *
126
+ * @param string $message Error message.
127
+ * @param array $context Error context.
128
+ * @return null
129
+ */
130
+ public function debug( $message, array $context = array() ) {
131
+ return $this->log( 'debug', $message, $context );
132
+ }
133
+
134
+ /**
135
+ * Logs with an arbitrary level.
136
+ *
137
+ * @param mixed $level Error level.
138
+ * @param string $message Error message.
139
+ * @param array $context Error context.
140
+ * @return void
141
+ */
142
+ public function log( $level, $message, array $context = array() ) {
143
+
144
+ $this->messages[] = array(
145
+ 'timestamp' => time(),
146
+ 'level' => $level,
147
+ 'message' => $message,
148
+ 'context' => $context,
149
+ );
150
+ }
151
+ }
152
+ endif;
astra-sites/inc/importers/wxr-importer/class-wxr-import-info.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WordPress Importer
4
+ * https://github.com/humanmade/WordPress-Importer
5
+ *
6
+ * Released under the GNU General Public License v2.0
7
+ * https://github.com/humanmade/WordPress-Importer/blob/master/LICENSE
8
+ *
9
+ * @since 2.0.0
10
+ *
11
+ * @package WordPress Importer
12
+ */
13
+
14
+ if ( ! class_exists( 'WXR_Import_Info' ) ) {
15
+
16
+ /**
17
+ * Import Info
18
+ *
19
+ * @since 2.0.0
20
+ */
21
+ class WXR_Import_Info {
22
+
23
+ /**
24
+ * Home
25
+ *
26
+ * @var Home
27
+ */
28
+ public $home;
29
+
30
+ /**
31
+ * Siteurl
32
+ *
33
+ * @var Site URL
34
+ */
35
+ public $siteurl;
36
+
37
+ /**
38
+ * Title
39
+ *
40
+ * @var Title
41
+ */
42
+ public $title;
43
+
44
+ /**
45
+ * Users
46
+ *
47
+ * @var Users
48
+ */
49
+ public $users = array();
50
+
51
+ /**
52
+ * Post_count
53
+ *
54
+ * @var Post Count
55
+ */
56
+ public $post_count = 0;
57
+
58
+ /**
59
+ * Media Count
60
+ *
61
+ * @var Media Count
62
+ */
63
+ public $media_count = 0;
64
+
65
+ /**
66
+ * Comment Count
67
+ *
68
+ * @var Comment Count
69
+ */
70
+ public $comment_count = 0;
71
+
72
+ /**
73
+ * Term Count
74
+ *
75
+ * @var Term Count
76
+ */
77
+ public $term_count = 0;
78
+
79
+ /**
80
+ * Generator
81
+ *
82
+ * @var Generator
83
+ */
84
+ public $generator = '';
85
+
86
+ /**
87
+ * Version
88
+ *
89
+ * @var Version
90
+ */
91
+ public $version;
92
+ }
93
+
94
+ }
astra-sites/inc/importers/wxr-importer/class-wxr-importer.php ADDED
@@ -0,0 +1,2554 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WordPress Importer
4
+ *
5
+ * @package WXR Importer
6
+ *
7
+ * WordPress Importer
8
+ * https://github.com/humanmade/WordPress-Importer
9
+ *
10
+ * Released under the GNU General Public License v2.0
11
+ * https://github.com/humanmade/WordPress-Importer/blob/master/LICENSE
12
+ */
13
+
14
+ /**
15
+ * WXR Importer
16
+ */
17
+ if ( ! class_exists( 'WXR_Importer' ) && class_exists( 'WP_Importer' ) ) :
18
+
19
+ /**
20
+ * WXR Importer
21
+ */
22
+ class WXR_Importer extends WP_Importer {
23
+ /**
24
+ * Maximum supported WXR version
25
+ */
26
+ const MAX_WXR_VERSION = 1.2;
27
+
28
+ /**
29
+ * Regular expression for checking if a post references an attachment
30
+ *
31
+ * Note: This is a quick, weak check just to exclude text-only posts. More
32
+ * vigorous checking is done later to verify.
33
+ */
34
+ const REGEX_HAS_ATTACHMENT_REFS = '!
35
+ (
36
+ # Match anything with an image or attachment class
37
+ class=[\'"].*?\b(wp-image-\d+|attachment-[\w\-]+)\b
38
+ |
39
+ # Match anything that looks like an upload URL
40
+ src=[\'"][^\'"]*(
41
+ [0-9]{4}/[0-9]{2}/[^\'"]+\.(jpg|jpeg|png|gif|svg)
42
+ |
43
+ content/uploads[^\'"]+
44
+ )[\'"]
45
+ )!ix';
46
+
47
+ /**
48
+ * Version of WXR we're importing.
49
+ *
50
+ * Defaults to 1.0 for compatibility. Typically overridden by a
51
+ * `<wp:wxr_version>` tag at the start of the file.
52
+ *
53
+ * @var string
54
+ */
55
+ protected $version = '1.0';
56
+
57
+ // information to import from WXR file.
58
+ /**
59
+ * Categories
60
+ *
61
+ * @var array
62
+ */
63
+ protected $categories = array();
64
+
65
+ /**
66
+ * Tags
67
+ *
68
+ * @var array
69
+ */
70
+ protected $tags = array();
71
+
72
+ /**
73
+ * Base Url
74
+ *
75
+ * @var string
76
+ */
77
+ protected $base_url = '';
78
+
79
+ // TODO: REMOVE THESE.
80
+ /**
81
+ * Processed Terms
82
+ *
83
+ * @var array
84
+ */
85
+ protected $processed_terms = array();
86
+
87
+ /**
88
+ * Processed Posts
89
+ *
90
+ * @var array
91
+ */
92
+ protected $processed_posts = array();
93
+
94
+ /**
95
+ * Processed Menu Items
96
+ *
97
+ * @var array
98
+ */
99
+ protected $processed_menu_items = array();
100
+
101
+ /**
102
+ * Menu Item Orphans
103
+ *
104
+ * @var array
105
+ */
106
+ protected $menu_item_orphans = array();
107
+
108
+ /**
109
+ * Missing Menu Items
110
+ *
111
+ * @var array
112
+ */
113
+ protected $missing_menu_items = array();
114
+
115
+
116
+ // NEW STYLE.
117
+ /**
118
+ * Mapping
119
+ *
120
+ * @var array
121
+ */
122
+ protected $mapping = array();
123
+
124
+ /**
125
+ * Requires Remapping
126
+ *
127
+ * @var array
128
+ */
129
+ protected $requires_remapping = array();
130
+
131
+ /**
132
+ * Exists
133
+ *
134
+ * @var array
135
+ */
136
+ protected $exists = array();
137
+
138
+ /**
139
+ * User Slug Override
140
+ *
141
+ * @var array
142
+ */
143
+ protected $user_slug_override = array();
144
+
145
+
146
+ /**
147
+ * Url Remap
148
+ *
149
+ * @var array
150
+ */
151
+ protected $url_remap = array();
152
+
153
+ /**
154
+ * Featured Images
155
+ *
156
+ * @var array
157
+ */
158
+ protected $featured_images = array();
159
+
160
+
161
+ /**
162
+ * Logger instance.
163
+ *
164
+ * @var WP_Importer_Logger
165
+ */
166
+ protected $logger;
167
+
168
+ /**
169
+ * Constructor
170
+ *
171
+ * @param array $options {.
172
+ * @var bool $prefill_existing_posts Should we prefill `post_exists` calls? (True prefills and uses more memory, false checks once per imported post and takes longer. Default is true.).
173
+ * @var bool $prefill_existing_comments Should we prefill `comment_exists` calls? (True prefills and uses more memory, false checks once per imported comment and takes longer. Default is true.).
174
+ * @var bool $prefill_existing_terms Should we prefill `term_exists` calls? (True prefills and uses more memory, false checks once per imported term and takes longer. Default is true.).
175
+ * @var bool $update_attachment_guids Should attachment GUIDs be updated to the new URL? (True updates the GUID, which keeps compatibility with v1, false doesn't update, and allows deduplication and reimporting. Default is false.).
176
+ * @var bool $fetch_attachments Fetch attachments from the remote server. (True fetches and creates attachment posts, false skips attachments. Default is false.).
177
+ * @var bool $aggressive_url_search Should we search/replace for URLs aggressively? (True searches all posts' content for old URLs and replaces, false checks for `<img class="wp-image-*">` only. Default is false.).
178
+ * @var int $default_author User ID to use if author is missing or invalid. (Default is null, which leaves posts unassigned.).
179
+ * }
180
+ */
181
+ public function __construct( $options = array() ) {
182
+ // Initialize some important variables.
183
+ $empty_types = array(
184
+ 'post' => array(),
185
+ 'comment' => array(),
186
+ 'term' => array(),
187
+ 'user' => array(),
188
+ );
189
+
190
+ $this->mapping = $empty_types;
191
+ $this->mapping['user_slug'] = array();
192
+ $this->mapping['term_id'] = array();
193
+ $this->requires_remapping = $empty_types;
194
+ $this->exists = $empty_types;
195
+
196
+ $this->options = wp_parse_args(
197
+ $options,
198
+ array(
199
+ 'prefill_existing_posts' => true,
200
+ 'prefill_existing_comments' => true,
201
+ 'prefill_existing_terms' => true,
202
+ 'update_attachment_guids' => false,
203
+ 'fetch_attachments' => false,
204
+ 'aggressive_url_search' => false,
205
+ 'default_author' => null,
206
+ )
207
+ );
208
+ }
209
+
210
+ /**
211
+ * Set Logger
212
+ *
213
+ * @param object $logger Logger object.
214
+ */
215
+ public function set_logger( $logger ) {
216
+ $this->logger = $logger;
217
+ }
218
+
219
+ /**
220
+ * Get a stream reader for the file.
221
+ *
222
+ * @param string $file Path to the XML file.
223
+ * @return XMLReader|WP_Error Reader instance on success, error otherwise.
224
+ */
225
+ protected function get_reader( $file ) {
226
+ // Avoid loading external entities for security.
227
+ $old_value = null;
228
+
229
+ $reader = new XMLReader();
230
+ $status = $reader->open( $file );
231
+
232
+ if ( ! $status ) {
233
+ return new WP_Error( 'wxr_importer.cannot_parse', __( 'Could not open the file for parsing', 'wordpress-importer' ) );
234
+ }
235
+
236
+ return $reader;
237
+ }
238
+
239
+ /**
240
+ * The main controller for the actual import stage.
241
+ *
242
+ * @param string $file Path to the WXR file for importing.
243
+ */
244
+ public function get_preliminary_information( $file ) {
245
+ // Let's run the actual importer now, woot.
246
+ $reader = $this->get_reader( $file );
247
+ if ( is_wp_error( $reader ) ) {
248
+ return $reader;
249
+ }
250
+
251
+ // Set the version to compatibility mode first.
252
+ $this->version = '1.0';
253
+
254
+ // Start parsing!
255
+ $data = new WXR_Import_Info();
256
+ while ( $reader->read() ) {
257
+ // Only deal with element opens.
258
+ if ( XMLReader::ELEMENT !== $reader->nodeType ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
259
+ continue;
260
+ }
261
+
262
+ switch ( $reader->name ) {
263
+ case 'wp:wxr_version':
264
+ // Upgrade to the correct version.
265
+ $this->version = $reader->readString();
266
+
267
+ if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
268
+ $this->logger->warning(
269
+ sprintf(
270
+ /* translators: %1$s is WXR version, %2$s is max supported WXR version. */
271
+ __( 'This WXR file (version %1$s) is newer than the importer (version %2$s) and may not be supported. Please consider updating.', 'wordpress-importer' ),
272
+ $this->version,
273
+ self::MAX_WXR_VERSION
274
+ )
275
+ );
276
+ }
277
+
278
+ // Handled everything in this node, move on to the next.
279
+ $reader->next();
280
+ break;
281
+
282
+ case 'generator':
283
+ $data->generator = $reader->readString();
284
+ $reader->next();
285
+ break;
286
+
287
+ case 'title':
288
+ $data->title = $reader->readString();
289
+ $reader->next();
290
+ break;
291
+
292
+ case 'wp:base_site_url':
293
+ $data->siteurl = $reader->readString();
294
+ $reader->next();
295
+ break;
296
+
297
+ case 'wp:base_blog_url':
298
+ $data->home = $reader->readString();
299
+ $reader->next();
300
+ break;
301
+
302
+ case 'wp:author':
303
+ $node = $reader->expand();
304
+
305
+ $parsed = $this->parse_author_node( $node );
306
+ if ( is_wp_error( $parsed ) ) {
307
+ $this->log_error( $parsed );
308
+
309
+ // Skip the rest of this post.
310
+ $reader->next();
311
+ break;
312
+ }
313
+
314
+ $data->users[] = $parsed;
315
+
316
+ // Handled everything in this node, move on to the next.
317
+ $reader->next();
318
+ break;
319
+
320
+ case 'item':
321
+ $node = $reader->expand();
322
+ $parsed = $this->parse_post_node( $node );
323
+ if ( is_wp_error( $parsed ) ) {
324
+ $this->log_error( $parsed );
325
+
326
+ // Skip the rest of this post.
327
+ $reader->next();
328
+ break;
329
+ }
330
+
331
+ if ( 'attachment' === $parsed['data']['post_type'] ) {
332
+ $data->media_count++;
333
+ } else {
334
+ $data->post_count++;
335
+ }
336
+ $data->comment_count += count( $parsed['comments'] );
337
+
338
+ // Handled everything in this node, move on to the next.
339
+ $reader->next();
340
+ break;
341
+
342
+ case 'wp:category':
343
+ case 'wp:tag':
344
+ case 'wp:term':
345
+ $data->term_count++;
346
+
347
+ // Handled everything in this node, move on to the next.
348
+ $reader->next();
349
+ break;
350
+ }
351
+ }
352
+
353
+ $data->version = $this->version;
354
+
355
+ return $data;
356
+ }
357
+
358
+ /**
359
+ * The main controller for the actual import stage.
360
+ *
361
+ * @param string $file Path to the WXR file for importing.
362
+ */
363
+ public function parse_authors( $file ) {
364
+ // Let's run the actual importer now, woot.
365
+ $reader = $this->get_reader( $file );
366
+ if ( is_wp_error( $reader ) ) {
367
+ return $reader;
368
+ }
369
+
370
+ // Set the version to compatibility mode first.
371
+ $this->version = '1.0';
372
+
373
+ // Start parsing!
374
+ $authors = array();
375
+ while ( $reader->read() ) {
376
+ // Only deal with element opens.
377
+ if ( XMLReader::ELEMENT !== $reader->nodeType ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
378
+ continue;
379
+ }
380
+
381
+ switch ( $reader->name ) {
382
+ case 'wp:wxr_version':
383
+ // Upgrade to the correct version.
384
+ $this->version = $reader->readString();
385
+
386
+ if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
387
+ $this->logger->warning(
388
+ sprintf(
389
+ /* translators: %1$s is WXR version, %2$s is max supported WXR version. */
390
+ __( 'This WXR file (version %1$s) is newer than the importer (version %2$s) and may not be supported. Please consider updating.', 'wordpress-importer' ),
391
+ $this->version,
392
+ self::MAX_WXR_VERSION
393
+ )
394
+ );
395
+ }
396
+
397
+ // Handled everything in this node, move on to the next.
398
+ $reader->next();
399
+ break;
400
+
401
+ case 'wp:author':
402
+ $node = $reader->expand();
403
+
404
+ $parsed = $this->parse_author_node( $node );
405
+ if ( is_wp_error( $parsed ) ) {
406
+ $this->log_error( $parsed );
407
+
408
+ // Skip the rest of this post.
409
+ $reader->next();
410
+ break;
411
+ }
412
+
413
+ $authors[] = $parsed;
414
+
415
+ // Handled everything in this node, move on to the next.
416
+ $reader->next();
417
+ break;
418
+ }
419
+ }
420
+
421
+ return $authors;
422
+ }
423
+
424
+ /**
425
+ * The main controller for the actual import stage.
426
+ *
427
+ * @param string $file Path to the WXR file for importing.
428
+ */
429
+ public function import( $file ) {
430
+ add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
431
+ add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
432
+
433
+ $result = $this->import_start( $file );
434
+ if ( is_wp_error( $result ) ) {
435
+ return $result;
436
+ }
437
+
438
+ // Let's run the actual importer now, woot.
439
+ $reader = $this->get_reader( $file );
440
+ if ( is_wp_error( $reader ) ) {
441
+ return $reader;
442
+ }
443
+
444
+ // Set the version to compatibility mode first.
445
+ $this->version = '1.0';
446
+
447
+ // Reset other variables.
448
+ $this->base_url = '';
449
+
450
+ // Start parsing!
451
+ while ( $reader->read() ) {
452
+ // Only deal with element opens.
453
+ if ( XMLReader::ELEMENT !== $reader->nodeType ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
454
+ continue;
455
+ }
456
+
457
+ switch ( $reader->name ) {
458
+ case 'wp:wxr_version':
459
+ // Upgrade to the correct version.
460
+ $this->version = $reader->readString();
461
+
462
+ if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
463
+ $this->logger->warning(
464
+ sprintf(
465
+ /* translators: %1$s is WXR version, %2$s is max supported WXR version. */
466
+ __( 'This WXR file (version %1$s) is newer than the importer (version %2$s) and may not be supported. Please consider updating.', 'wordpress-importer' ),
467
+ $this->version,
468
+ self::MAX_WXR_VERSION
469
+ )
470
+ );
471
+ }
472
+
473
+ // Handled everything in this node, move on to the next.
474
+ $reader->next();
475
+ break;
476
+
477
+ case 'wp:base_site_url':
478
+ $this->base_url = $reader->readString();
479
+
480
+ // Handled everything in this node, move on to the next.
481
+ $reader->next();
482
+ break;
483
+
484
+ case 'item':
485
+ $node = $reader->expand();
486
+ $parsed = $this->parse_post_node( $node );
487
+ if ( is_wp_error( $parsed ) ) {
488
+ $this->log_error( $parsed );
489
+
490
+ // Skip the rest of this post.
491
+ $reader->next();
492
+ break;
493
+ }
494
+
495
+ $this->process_post( $parsed['data'], $parsed['meta'], $parsed['comments'], $parsed['terms'] );
496
+
497
+ // Handled everything in this node, move on to the next.
498
+ $reader->next();
499
+ break;
500
+
501
+ case 'wp:author':
502
+ $node = $reader->expand();
503
+
504
+ $parsed = $this->parse_author_node( $node );
505
+ if ( is_wp_error( $parsed ) ) {
506
+ $this->log_error( $parsed );
507
+
508
+ // Skip the rest of this post.
509
+ $reader->next();
510
+ break;
511
+ }
512
+
513
+ $status = $this->process_author( $parsed['data'], $parsed['meta'] );
514
+ if ( is_wp_error( $status ) ) {
515
+ $this->log_error( $status );
516
+ }
517
+
518
+ // Handled everything in this node, move on to the next.
519
+ $reader->next();
520
+ break;
521
+
522
+ case 'wp:category':
523
+ $node = $reader->expand();
524
+
525
+ $parsed = $this->parse_term_node( $node, 'category' );
526
+ if ( is_wp_error( $parsed ) ) {
527
+ $this->log_error( $parsed );
528
+
529
+ // Skip the rest of this post.
530
+ $reader->next();
531
+ break;
532
+ }
533
+
534
+ $status = $this->process_term( $parsed['data'], $parsed['meta'] );
535
+
536
+ // Handled everything in this node, move on to the next.
537
+ $reader->next();
538
+ break;
539
+
540
+ case 'wp:tag':
541
+ $node = $reader->expand();
542
+
543
+ $parsed = $this->parse_term_node( $node, 'tag' );
544
+ if ( is_wp_error( $parsed ) ) {
545
+ $this->log_error( $parsed );
546
+
547
+ // Skip the rest of this post.
548
+ $reader->next();
549
+ break;
550
+ }
551
+
552
+ $status = $this->process_term( $parsed['data'], $parsed['meta'] );
553
+
554
+ // Handled everything in this node, move on to the next.
555
+ $reader->next();
556
+ break;
557
+
558
+ case 'wp:term':
559
+ $node = $reader->expand();
560
+
561
+ $parsed = $this->parse_term_node( $node );
562
+ if ( is_wp_error( $parsed ) ) {
563
+ $this->log_error( $parsed );
564
+
565
+ // Skip the rest of this post.
566
+ $reader->next();
567
+ break;
568
+ }
569
+
570
+ $status = $this->process_term( $parsed['data'], $parsed['meta'] );
571
+
572
+ // Handled everything in this node, move on to the next.
573
+ $reader->next();
574
+ break;
575
+
576
+ default:
577
+ // Skip this node, probably handled by something already.
578
+ break;
579
+ }
580
+ }
581
+
582
+ // Now that we've done the main processing, do any required
583
+ // post-processing and remapping.
584
+ $this->post_process();
585
+
586
+ if ( $this->options['aggressive_url_search'] ) {
587
+ $this->replace_attachment_urls_in_content();
588
+ }
589
+ // phpcs:disable
590
+ // $this->remap_featured_images();
591
+ // phpcs:enable
592
+ $this->import_end();
593
+ }
594
+
595
+ /**
596
+ * Log an error instance to the logger.
597
+ *
598
+ * @param WP_Error $error Error instance to log.
599
+ */
600
+ protected function log_error( WP_Error $error ) {
601
+ $this->logger->warning( $error->get_error_message() );
602
+
603
+ // Log the data as debug info too.
604
+ $data = $error->get_error_data();
605
+ if ( ! empty( $data ) ) {
606
+ $this->logger->debug( var_export( $data, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
607
+ }
608
+ }
609
+
610
+ /**
611
+ * Parses the WXR file and prepares us for the task of processing parsed data
612
+ *
613
+ * @param string $file Path to the WXR file for importing.
614
+ */
615
+ protected function import_start( $file ) {
616
+ if ( ! is_file( $file ) ) {
617
+ return new WP_Error( 'wxr_importer.file_missing', __( 'The file does not exist, please try again.', 'wordpress-importer' ) );
618
+ }
619
+
620
+ // Suspend bunches of stuff in WP core.
621
+ wp_defer_term_counting( true );
622
+ wp_defer_comment_counting( true );
623
+ wp_suspend_cache_invalidation( true );
624
+
625
+ // Prefill exists calls if told to.
626
+ if ( $this->options['prefill_existing_posts'] ) {
627
+ $this->prefill_existing_posts();
628
+ }
629
+ if ( $this->options['prefill_existing_comments'] ) {
630
+ $this->prefill_existing_comments();
631
+ }
632
+ if ( $this->options['prefill_existing_terms'] ) {
633
+ $this->prefill_existing_terms();
634
+ }
635
+
636
+ /**
637
+ * Begin the import.
638
+ *
639
+ * Fires before the import process has begun. If you need to suspend
640
+ * caching or heavy processing on hooks, do so here.
641
+ */
642
+ do_action( 'import_start' );
643
+ }
644
+
645
+ /**
646
+ * Performs post-import cleanup of files and the cache
647
+ */
648
+ protected function import_end() {
649
+ // Re-enable stuff in core.
650
+ wp_suspend_cache_invalidation( false );
651
+ wp_cache_flush();
652
+ foreach ( get_taxonomies() as $tax ) {
653
+ delete_option( "{$tax}_children" );
654
+ _get_term_hierarchy( $tax );
655
+ }
656
+
657
+ wp_defer_term_counting( false );
658
+ wp_defer_comment_counting( false );
659
+
660
+ /**
661
+ * Complete the import.
662
+ *
663
+ * Fires after the import process has finished. If you need to update
664
+ * your cache or re-enable processing, do so here.
665
+ */
666
+ do_action( 'import_end' );
667
+ }
668
+
669
+ /**
670
+ * Set the user mapping.
671
+ *
672
+ * @param array $mapping List of map arrays (containing `old_slug`, `old_id`, `new_id`).
673
+ */
674
+ public function set_user_mapping( $mapping ) {
675
+ foreach ( $mapping as $map ) {
676
+ if ( empty( $map['old_slug'] ) || empty( $map['old_id'] ) || empty( $map['new_id'] ) ) {
677
+ $this->logger->warning( __( 'Invalid author mapping', 'wordpress-importer' ) );
678
+ $this->logger->debug( var_export( $map, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
679
+ continue;
680
+ }
681
+
682
+ $old_slug = $map['old_slug'];
683
+ $old_id = $map['old_id'];
684
+ $new_id = $map['new_id'];
685
+
686
+ $this->mapping['user'][ $old_id ] = $new_id;
687
+ $this->mapping['user_slug'][ $old_slug ] = $new_id;
688
+ }
689
+ }
690
+
691
+ /**
692
+ * Set the user slug overrides.
693
+ *
694
+ * Allows overriding the slug in the import with a custom/renamed version.
695
+ *
696
+ * @param string[] $overrides Map of old slug to new slug.
697
+ */
698
+ public function set_user_slug_overrides( $overrides ) {
699
+ foreach ( $overrides as $original => $renamed ) {
700
+ $this->user_slug_override[ $original ] = $renamed;
701
+ }
702
+ }
703
+
704
+ /**
705
+ * Parse a post node into post data.
706
+ *
707
+ * @param DOMElement $node Parent node of post data (typically `item`).
708
+ * @return array|WP_Error Post data array on success, error otherwise.
709
+ */
710
+ protected function parse_post_node( $node ) {
711
+ $data = array();
712
+ $meta = array();
713
+ $comments = array();
714
+ $terms = array();
715
+
716
+ foreach ( $node->childNodes as $child ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
717
+ // We only care about child elements.
718
+ if ( XML_ELEMENT_NODE !== $child->nodeType ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
719
+ continue;
720
+ }
721
+
722
+ switch ( $child->tagName ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
723
+ case 'wp:post_type':
724
+ $data['post_type'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
725
+ break;
726
+
727
+ case 'title':
728
+ $data['post_title'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
729
+ break;
730
+
731
+ case 'guid':
732
+ $data['guid'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
733
+ break;
734
+
735
+ case 'dc:creator':
736
+ $data['post_author'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
737
+ break;
738
+
739
+ case 'content:encoded':
740
+ $data['post_content'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
741
+ break;
742
+
743
+ case 'excerpt:encoded':
744
+ $data['post_excerpt'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
745
+ break;
746
+
747
+ case 'wp:post_id':
748
+ $data['post_id'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
749
+ break;
750
+
751
+ case 'wp:post_date':
752
+ $data['post_date'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
753
+ break;
754
+
755
+ case 'wp:post_date_gmt':
756
+ $data['post_date_gmt'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
757
+ break;
758
+
759
+ case 'wp:comment_status':
760
+ $data['comment_status'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
761
+ break;
762
+
763
+ case 'wp:ping_status':
764
+ $data['ping_status'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
765
+ break;
766
+
767
+ case 'wp:post_name':
768
+ $data['post_name'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
769
+ break;
770
+
771
+ case 'wp:status':
772
+ $data['post_status'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
773
+
774
+ if ( 'auto-draft' === $data['post_status'] ) {
775
+ // Bail now.
776
+ return new WP_Error(
777
+ 'wxr_importer.post.cannot_import_draft',
778
+ __( 'Cannot import auto-draft posts' ),
779
+ $data
780
+ );
781
+ }
782
+ break;
783
+
784
+ case 'wp:post_parent':
785
+ $data['post_parent'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
786
+ break;
787
+
788
+ case 'wp:menu_order':
789
+ $data['menu_order'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
790
+ break;
791
+
792
+ case 'wp:post_password':
793
+ $data['post_password'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
794
+ break;
795
+
796
+ case 'wp:is_sticky':
797
+ $data['is_sticky'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
798
+ break;
799
+
800
+ case 'wp:attachment_url':
801
+ $data['attachment_url'] = $child->textContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
802
+ break;
803
+
804
+ case 'wp:postmeta':
805
+ $meta_item = $this->parse_meta_node( $child );
806
+ if ( ! empty( $meta_item ) ) {
807
+ $meta[] = $meta_item;
808
+ }
809
+ break;
810
+
811
+ case 'wp:comment':
812
+ $comment_item = $this->parse_comment_node( $child );
813
+ if ( ! empty( $comment_item ) ) {
814
+ $comments[] = $comment_item;
815
+ }
816
+ break;
817
+
818
+ case 'category':
819
+ $term_item = $this->parse_category_node( $child );
820
+ if ( ! empty( $term_item ) ) {
821
+ $terms[] = $term_item;
822
+ }
823
+ break;
824
+ }
825
+ }
826
+
827
+ return compact( 'data', 'meta', 'comments', 'terms' );
828
+ }
829
+
830
+ /**
831
+ * Create new posts based on import information
832
+ *
833
+ * Posts marked as having a parent which doesn't exist will become top level items.
834
+ * Doesn't create a new post if: the post type doesn't exist, the given post ID
835
+ * is already noted as imported or a post with the same title and date already exists.
836
+ * Note that new/updated terms, comments and meta are imported for the last of the above.
837
+ *
838
+ * @param array $data Post data. (Return empty to skip.).
839
+ * @param array $meta Meta data.
840
+ * @param array $comments Comments on the post.
841
+ * @param array $terms Terms on the post.
842
+ */
843
+ protected function process_post( $data, $meta, $comments, $terms ) {
844
+ /**
845
+ * Pre-process post data.
846
+ *
847
+ * @param array $data Post data. (Return empty to skip.)
848
+ * @param array $meta Meta data.
849
+ * @param array $comments Comments on the post.
850
+ * @param array $terms Terms on the post.
851
+ */
852
+ $data = apply_filters( 'wxr_importer.pre_process.post', $data, $meta, $comments, $terms ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
853
+ if ( empty( $data ) ) {
854
+ return false;
855
+ }
856
+
857
+ $original_id = isset( $data['post_id'] ) ? (int) $data['post_id'] : 0;
858
+ $parent_id = isset( $data['post_parent'] ) ? (int) $data['post_parent'] : 0;
859
+ $author_id = isset( $data['post_author'] ) ? (int) $data['post_author'] : 0;
860
+
861
+ // Have we already processed this?
862
+ if ( isset( $this->mapping['post'][ $original_id ] ) ) {
863
+ return;
864
+ }
865
+
866
+ $post_type_object = get_post_type_object( $data['post_type'] );
867
+
868
+ // Is this type even valid?
869
+ if ( ! $post_type_object ) {
870
+ $this->logger->warning(
871
+ sprintf(
872
+ /* translators: %1$s is the import message, %2$s is post type. */
873
+ __( 'Failed to import "%1$s": Invalid post type %2$s', 'wordpress-importer' ),
874
+ $data['post_title'],
875
+ $data['post_type']
876
+ )
877
+ );
878
+ return false;
879
+ }
880
+
881
+ $post_exists = $this->post_exists( $data );
882
+ if ( $post_exists ) {
883
+ $message = sprintf(
884
+ /* translators: %1$s single post type, %2$s is post title. */
885
+ __( '%1$s "%2$s" already exists.', 'wordpress-importer' ),
886
+ $post_type_object->labels->singular_name,
887
+ $data['post_title']
888
+ );
889
+
890
+ $this->logger->info( $message );
891
+
892
+ /**
893
+ * Post processing already imported.
894
+ *
895
+ * @param array $data Raw data imported for the post.
896
+ */
897
+ do_action( 'wxr_importer.process_already_imported.post', $data ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
898
+
899
+ // Even though this post already exists, new comments might need importing.
900
+ $this->process_comments( $comments, $original_id, $data, $post_exists );
901
+
902
+ return false;
903
+ }
904
+
905
+ // Map the parent post, or mark it as one we need to fix.
906
+ $requires_remapping = false;
907
+ if ( $parent_id ) {
908
+ if ( isset( $this->mapping['post'][ $parent_id ] ) ) {
909
+ $data['post_parent'] = $this->mapping['post'][ $parent_id ];
910
+ } else {
911
+ $meta[] = array(
912
+ 'key' => '_wxr_import_parent',
913
+ 'value' => $parent_id,
914
+ );
915
+ $requires_remapping = true;
916
+
917
+ $data['post_parent'] = 0;
918
+ }
919
+ }
920
+
921
+ // Map the author, or mark it as one we need to fix.
922
+ $author = sanitize_user( $data['post_author'], true );
923
+ if ( empty( $author ) ) {
924
+ // Missing or invalid author, use default if available.
925
+ $data['post_author'] = $this->options['default_author'];
926
+ } elseif ( isset( $this->mapping['user_slug'][ $author ] ) ) {
927
+ $data['post_author'] = $this->mapping['user_slug'][ $author ];
928
+ } else {
929
+ $meta[] = array(
930
+ 'key' => '_wxr_import_user_slug',
931
+ 'value' => $author,
932
+ );
933
+ $requires_remapping = true;
934
+
935
+ $data['post_author'] = (int) get_current_user_id();
936
+ }
937
+
938
+ // Does the post look like it contains attachment images?
939
+ if ( preg_match( self::REGEX_HAS_ATTACHMENT_REFS, $data['post_content'] ) ) {
940
+ $meta[] = array(
941
+ 'key' => '_wxr_import_has_attachment_refs',
942
+ 'value' => true,
943
+ );
944
+ $requires_remapping = true;
945
+ }
946
+
947
+ // Whitelist to just the keys we allow.
948
+ $postdata = array(
949
+ 'import_id' => $data['post_id'],
950
+ );
951
+ $allowed = array(
952
+ 'post_author' => true,
953
+ 'post_date' => true,
954
+ 'post_date_gmt' => true,
955
+ 'post_content' => true,
956
+ 'post_excerpt' => true,
957
+ 'post_title' => true,
958
+ 'post_status' => true,
959
+ 'post_name' => true,
960
+ 'comment_status' => true,
961
+ 'ping_status' => true,
962
+ 'guid' => true,
963
+ 'post_parent' => true,
964
+ 'menu_order' => true,
965
+ 'post_type' => true,
966
+ 'post_password' => true,
967
+ );
968
+ foreach ( $data as $key => $value ) {
969
+ if ( ! isset( $allowed[ $key ] ) ) {
970
+ continue;
971
+ }
972
+
973
+ $postdata[ $key ] = $data[ $key ];
974
+ }
975
+
976
+ $postdata = apply_filters( 'wp_import_post_data_processed', $postdata, $data );
977
+
978
+ if ( 'attachment' === $postdata['post_type'] ) {
979
+ if ( ! $this->options['fetch_attachments'] ) {
980
+ $this->logger->notice(
981
+ sprintf(
982
+ /* translators: %s is post title */
983
+ __( 'Skipping attachment "%s", fetching attachments disabled' ),
984
+ $data['post_title']
985
+ )
986
+ );
987
+ /**
988
+ * Post processing skipped.
989
+ *
990
+ * @param array $data Raw data imported for the post.
991
+ * @param array $meta Raw meta data, already processed by {@see process_post_meta}.
992
+ */
993
+ do_action( 'wxr_importer.process_skipped.post', $data, $meta ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
994
+ return false;
995
+ }
996
+ $remote_url = ! empty( $data['attachment_url'] ) ? $data['attachment_url'] : $data['guid'];
997
+ $post_id = $this->process_attachment( $postdata, $meta, $remote_url );
998
+ } else {
999
+ $post_id = wp_insert_post( $postdata, true );
1000
+ do_action( 'wp_import_insert_post', $post_id, $original_id, $postdata, $data );
1001
+ }
1002
+
1003
+ if ( is_wp_error( $post_id ) ) {
1004
+ $this->logger->error(
1005
+ sprintf(
1006
+ /* translators: %1$s is the post title, %2$s is post type. */
1007
+ __( 'Failed to import "%1$s" (%2$s)', 'wordpress-importer' ),
1008
+ $data['post_title'],
1009
+ $post_type_object->labels->singular_name
1010
+ )
1011
+ );
1012
+ $this->logger->debug( $post_id->get_error_message() );
1013
+
1014
+ /**
1015
+ * Post processing failed.
1016
+ *
1017
+ * @param WP_Error $post_id Error object.
1018
+ * @param array $data Raw data imported for the post.
1019
+ * @param array $meta Raw meta data, already processed by {@see process_post_meta}.
1020
+ * @param array $comments Raw comment data, already processed by {@see process_comments}.
1021
+ * @param array $terms Raw term data, already processed.
1022
+ */
1023
+ do_action( 'wxr_importer.process_failed.post', $post_id, $data, $meta, $comments, $terms ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
1024
+ return false;
1025
+ }
1026
+
1027
+ // Ensure stickiness is handled correctly too.
1028
+ if ( '1' === $data['is_sticky'] ) {
1029
+ stick_post( $post_id );
1030
+ }
1031
+
1032
+ // map pre-import ID to local ID.
1033
+ $this->mapping['post'][ $original_id ] = (int) $post_id;
1034
+ if ( $requires_remapping ) {
1035
+ $this->requires_remapping['post'][ $post_id ] = true;
1036
+ }
1037
+ $this->mark_post_exists( $data, $post_id );
1038
+
1039
+ $this->logger->info(
1040
+ sprintf(
1041
+ /* translators: %1$s is the post title, %2$s is post type. */
1042
+ __( 'Imported "%1$s" (%2$s)', 'wordpress-importer' ),
1043
+ $data['post_title'],
1044
+ $post_type_object->labels->singular_name
1045
+ )
1046
+ );
1047
+ $this->logger->debug(
1048
+ sprintf(
1049
+ /* translators: %1$s is the original post id, %2$s is old post id. */
1050
+ __( 'Post %1$d remapped to %2$d', 'wordpress-importer' ),
1051
+ $original_id,
1052
+ $post_id
1053
+ )
1054
+ );
1055
+
1056
+ // Handle the terms too.
1057
+ $terms = apply_filters( 'wp_import_post_terms', $terms, $post_id, $data );
1058
+
1059
+ if ( ! empty( $terms ) ) {
1060
+ $term_ids = array();
1061
+ foreach ( $terms as $term ) {
1062
+ $taxonomy = $term['taxonomy'];
1063
+ $key = sha1( $taxonomy . ':' . $term['slug'] );
1064
+
1065
+ if ( isset( $this->mapping['term'][ $key ] ) ) {
1066
+ $term_ids[ $taxonomy ][] = (int) $this->mapping['term'][ $key ];
1067
+ } else {
1068
+ $meta[] = array(
1069
+ 'key' => '_wxr_import_term',
1070
+ 'value' => $term,
1071
+ );
1072
+ $requires_remapping = true;
1073
+ }
1074
+ }
1075
+
1076
+ foreach ( $term_ids as $tax => $ids ) {
1077
+ $tt_ids = wp_set_post_terms( $post_id, $ids, $tax );
1078
+ do_action( 'wp_import_set_post_terms', $tt_ids, $ids, $tax, $post_id, $data );
1079
+ }
1080
+ }
1081
+
1082
+ $this->process_comments( $comments, $post_id, $data );
1083
+ $this->process_post_meta( $meta, $post_id, $data );
1084
+
1085
+ if ( 'nav_menu_item' === $data['post_type'] ) {
1086
+ $this->process_menu_item_meta( $post_id, $data, $meta );
1087
+ }
1088
+
1089
+ /**
1090
+ * Post processing completed.
1091
+ *
1092
+ * @param int $post_id New post ID.
1093
+ * @param array $data Raw data imported for the post.
1094
+ * @param array $meta Raw meta data, already processed by {@see process_post_meta}.
1095
+ * @param array $comments Raw comment data, already processed by {@see process_comments}.
1096
+ * @param array $terms Raw term data, already processed.
1097
+ */
1098
+ do_action( 'wxr_importer.processed.post', $post_id, $data, $meta, $comments, $terms ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
1099
+ }
1100
+
1101
+ /**
1102
+ * Attempt to create a new menu item from import data
1103
+ *
1104
+ * Fails for draft, orphaned menu items and those without an associated nav_menu
1105
+ * or an invalid nav_menu term. If