Astra Starter Sites - Version 1.0.9

Version Description

Download this release

Release Info

Developer Nikschavan
Plugin Icon Astra Starter Sites
Version 1.0.9
Comparing to
See all releases

Code changes from version 1.0.8 to 1.0.9

astra-sites.php CHANGED
@@ -1,9 +1,9 @@
1
<?php
2
/**
3
- * Plugin Name: Astra Free Sites
4
* Plugin URI: http://www.wpastra.com/pro/
5
* Description: Import free sites build with Astra theme.
6
- * Version: 1.0.8
7
* Author: Brainstorm Force
8
* Author URI: http://www.brainstormforce.com
9
* Text Domain: astra-sites
@@ -15,7 +15,7 @@
15
* Set constants.
16
*/
17
if ( ! defined( 'ASTRA_SITES_VER' ) ) {
18
- define( 'ASTRA_SITES_VER', '1.0.8' );
19
}
20
21
if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
1
<?php
2
/**
3
+ * Plugin Name: Astra Sites - Lite
4
* Plugin URI: http://www.wpastra.com/pro/
5
* Description: Import free sites build with Astra theme.
6
+ * Version: 1.0.9
7
* Author: Brainstorm Force
8
* Author URI: http://www.brainstormforce.com
9
* Text Domain: astra-sites
15
* Set constants.
16
*/
17
if ( ! defined( 'ASTRA_SITES_VER' ) ) {
18
+ define( 'ASTRA_SITES_VER', '1.0.9' );
19
}
20
21
if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
inc/admin/class-astra-sites-page.php CHANGED
@@ -31,7 +31,7 @@ if ( ! class_exists( 'Astra_Sites_Page' ) ) {
31
* @since 1.0.6
32
* @var array $menu_page_title
33
*/
34
- static public $menu_page_title = 'Astra Sites';
35
36
/**
37
* Plugin slug
@@ -82,7 +82,7 @@ if ( ! class_exists( 'Astra_Sites_Page' ) ) {
82
*/
83
static public function init_admin_settings() {
84
85
- self::$menu_page_title = apply_filters( 'astra_sites_menu_page_title', __( 'Astra Sites' , 'astra-sites' ) );
86
87
if ( isset( $_REQUEST['page'] ) && strpos( $_REQUEST['page'], self::$plugin_slug ) !== false ) {
88
31
* @since 1.0.6
32
* @var array $menu_page_title
33
*/
34
+ static public $menu_page_title = 'Astra Sites - Lite';
35
36
/**
37
* Plugin slug
82
*/
83
static public function init_admin_settings() {
84
85
+ self::$menu_page_title = apply_filters( 'astra_sites_menu_page_title', __( 'Astra Sites - Lite' , 'astra-sites' ) );
86
87
if ( isset( $_REQUEST['page'] ) && strpos( $_REQUEST['page'], self::$plugin_slug ) !== false ) {
88
inc/admin/view-astra-sites.php CHANGED
@@ -22,26 +22,47 @@ wp_enqueue_style( 'astra-sites-admin' );
22
23
<div class="wp-filter hide-if-no-js">
24
25
- <ul class="filter-links">
26
-
27
- <li><a href="#" data-sort="all" class="current" data-id="all"><?php esc_html_e( 'All', 'astra-sites' ); ?></a></li>
28
-
29
- <?php foreach ( Astra_Sites::get_demo_categories() as $key => $category ) { ?>
30
- <li>
31
- <a href="#"
32
- data-sort="<?php echo esc_attr( $category['slug'] ); ?>"
33
- data-id="<?php echo esc_attr( $category['id'] ); ?>">
34
- <?php echo esc_attr( $category['name'] ); ?>
35
- </a>
36
- </li>
37
- <?php } ?>
38
- </ul>
39
40
- <div class="search-form">
41
- <label class="screen-reader-text" for="wp-filter-search-input"><?php esc_html_e( 'Search Sites', 'astra-sites' ); ?></label>
42
- <input placeholder="<?php esc_attr_e( 'Search Sites...', 'astra-sites' ); ?>" type="search" aria-describedby="live-search-desc" id="wp-filter-search-input" class="wp-filter-search">
43
</div>
44
45
</div>
46
47
<?php do_action( 'astra_sites_before_site_grid' ); ?>
22
23
<div class="wp-filter hide-if-no-js">
24
25
+ <div class="left-section">
26
+
27
+ <div class="filter-count">
28
+ <span class="count"></span>
29
+ </div>
30
31
+ <ul class="filter-links astra-page-builder">
32
+ <?php foreach ( Astra_Sites::get_page_builders() as $key => $category ) { ?>
33
+ <li>
34
+ <a href="#"
35
+ data-sort="<?php echo esc_attr( $category['slug'] ); ?>"
36
+ data-id="<?php echo esc_attr( $category['id'] ); ?>">
37
+ <?php echo esc_attr( $category['name'] ); ?>
38
+ </a>
39
+ </li>
40
+ <?php } ?>
41
+ </ul>
42
</div>
43
44
+ <div class="right-section">
45
+ <ul class="filter-links astra-category">
46
+
47
+ <li><a href="#" data-sort="all" class="current" data-id="all"><?php esc_html_e( 'All', 'astra-sites' ); ?></a></li>
48
+
49
+ <?php foreach ( Astra_Sites::get_demo_categories() as $key => $category ) { ?>
50
+ <li>
51
+ <a href="#"
52
+ data-sort="<?php echo esc_attr( $category['slug'] ); ?>"
53
+ data-id="<?php echo esc_attr( $category['id'] ); ?>">
54
+ <?php echo esc_attr( $category['name'] ); ?>
55
+ </a>
56
+ </li>
57
+ <?php } ?>
58
+ </ul>
59
+
60
+ <div class="search-form">
61
+ <label class="screen-reader-text" for="wp-filter-search-input"><?php esc_html_e( 'Search Sites', 'astra-sites' ); ?></label>
62
+ <input placeholder="<?php esc_attr_e( 'Search Sites...', 'astra-sites' ); ?>" type="search" aria-describedby="live-search-desc" id="wp-filter-search-input" class="wp-filter-search">
63
+ </div>
64
+ </div>
65
+
66
</div>
67
68
<?php do_action( 'astra_sites_before_site_grid' ); ?>
inc/assets/css/admin.css CHANGED
@@ -201,4 +201,25 @@
201
*/
202
.astra-api-error {
203
margin: 0 0 0.5em 0;
204
}
201
*/
202
.astra-api-error {
203
margin: 0 0 0.5em 0;
204
+ }
205
+
206
+ /**
207
+ * Grid
208
+ */
209
+ .wp-filter .search-form {
210
+ margin-left: 1em;
211
+ }
212
+ .wp-filter .search-form input[type="search"] {
213
+ width: 200px;
214
+ font-size: 13px;
215
+ padding: 5px 10px;
216
+ }
217
+ .left-section {
218
+ display: inline-block;
219
+ }
220
+ .right-section {
221
+ float: right;
222
+ }
223
+ .filter-count {
224
+ min-width: 3em;
225
}
inc/assets/js/admin.js CHANGED
@@ -14,24 +14,24 @@ function initial_load_demos() {
14
dataType: 'json',
15
data: {
16
action : 'astra-list-sites',
17
- category : 'all',
18
- id : 'all',
19
paged : '1',
20
},
21
})
22
.done(function (demos) {
23
jQuery('body').removeClass('loading-content');
24
25
// Has sites?
26
- if( demos.length ) {
27
- renderDemoGrid( demos );
28
29
// Something is wrong in API request.
30
} else {
31
var template = wp.template('astra-no-demos');
32
-
33
jQuery('.themes').append( template );
34
}
35
})
36
.fail(function () {
37
jQuery('body').removeClass('loading-content');
@@ -89,7 +89,7 @@ function enable_demo_import_button( type = 'free' ) {
89
}
90
91
function resetPagedCount() {
92
- categoryId = jQuery('.filter-links li .current').data('id');
93
jQuery('body').attr('data-astra-demo-paged', '1');
94
jQuery('body').attr('data-astra-site-category', categoryId);
95
jQuery('body').attr('data-astra-demo-search', '');
@@ -129,20 +129,27 @@ jQuery(document).scroll(function (event) {
129
130
jQuery('.no-themes').remove();
131
132
jQuery.ajax({
133
url: astraDemo.ajaxurl,
134
type: 'POST',
135
dataType: 'json',
136
data: {
137
action: 'astra-list-sites',
138
- id: id,
139
paged: paged,
140
- search: search
141
},
142
})
143
.done(function (demos) {
144
jQuery('body').removeClass('loading-content');
145
- renderDemoGrid(demos);
146
})
147
.fail(function () {
148
jQuery('body').removeClass('loading-content');
@@ -568,18 +575,16 @@ jQuery(document).on('click', '.filter-links li a', function (event) {
568
$this = jQuery(this);
569
$this.parent('li').siblings().find('.current').removeClass('current');
570
$this.addClass('current');
571
- slug = $this.data('sort');
572
- id = $this.data('id');
573
574
resetPagedCount();
575
paged = parseInt(jQuery('body').attr('data-astra-demo-paged'));
576
577
- if (slug == 'all') {
578
- category = 'all';
579
- } else {
580
- category = slug;
581
- }
582
-
583
jQuery('body').addClass('loading-content');
584
jQuery('.theme-browser .theme').remove();
585
jQuery('.no-themes').remove();
@@ -591,19 +596,25 @@ jQuery(document).on('click', '.filter-links li a', function (event) {
591
dataType: 'json',
592
data: {
593
action: 'astra-list-sites',
594
- category: category,
595
- id: id,
596
paged: paged,
597
},
598
})
599
- .done(function (demos) {
600
- jQuery('body').removeClass('loading-content');
601
- renderDemoGrid(demos);
602
- })
603
- .fail(function () {
604
- jQuery('body').removeClass('loading-content');
605
- jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.responseError+'</p>');
606
- });
607
608
});
609
@@ -616,6 +627,12 @@ jQuery(document).on('keyup input', '#wp-filter-search-input', function () {
616
id = 'all';
617
}
618
619
window.clearTimeout(ref);
620
ref = window.setTimeout(function () {
621
ref = null;
@@ -633,31 +650,36 @@ jQuery(document).on('keyup input', '#wp-filter-search-input', function () {
633
data: {
634
action: 'astra-list-sites',
635
search: $this,
636
- id: id,
637
},
638
})
639
- .done(function (demos) {
640
- jQuery('.filter-links li a[data-id="all"]').addClass('current');
641
- jQuery('.filter-links li a[data-id="all"]').parent('li').siblings().find('.current').removeClass('current');
642
- jQuery('body').removeClass('loading-content');
643
644
- if (demos.length > 0) {
645
- renderDemoGrid(demos);
646
- } else {
647
- jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.searchNoFound+'</p>');
648
- }
649
650
- })
651
- .fail(function () {
652
- jQuery('body').removeClass('loading-content');
653
- jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.responseError+'.</p>');
654
- });
655
656
}, 500);
657
658
});
659
660
- function renderDemoGrid(demos) {
661
jQuery.each(demos, function (index, demo) {
662
663
id = demo.id;
@@ -691,6 +713,8 @@ function renderDemoGrid(demos) {
691
var template = wp.template('astra-single-demo');
692
jQuery('.themes').append(template(templateData[0]));
693
});
694
}
695
696
jQuery(document).on('click', '.collapse-sidebar', function (event) {
14
dataType: 'json',
15
data: {
16
action : 'astra-list-sites',
17
paged : '1',
18
},
19
})
20
.done(function (demos) {
21
+
22
jQuery('body').removeClass('loading-content');
23
+ jQuery('.filter-count .count').text( demos.sites_count );
24
25
// Has sites?
26
+ if ( demos.sites_count > 0 ) {
27
+ renderDemoGrid( demos.sites );
28
29
// Something is wrong in API request.
30
} else {
31
var template = wp.template('astra-no-demos');
32
jQuery('.themes').append( template );
33
}
34
+
35
})
36
.fail(function () {
37
jQuery('body').removeClass('loading-content');
89
}
90
91
function resetPagedCount() {
92
+ categoryId = jQuery('.astra-category.filter-links li .current').data('id');
93
jQuery('body').attr('data-astra-demo-paged', '1');
94
jQuery('body').attr('data-astra-site-category', categoryId);
95
jQuery('body').attr('data-astra-demo-search', '');
129
130
jQuery('.no-themes').remove();
131
132
+ var astra_page_builder = jQuery('.filter-links.astra-page-builder'),
133
+ astra_category = jQuery('.filter-links.astra-category'),
134
+ page_builder_id = astra_page_builder.find('.current').data('id'),
135
+ category_id = astra_category.find('.current').data('id');
136
+
137
jQuery.ajax({
138
url: astraDemo.ajaxurl,
139
type: 'POST',
140
dataType: 'json',
141
data: {
142
action: 'astra-list-sites',
143
paged: paged,
144
+ search: search,
145
+ page_builder_id : page_builder_id,
146
+ category_id : category_id,
147
},
148
})
149
.done(function (demos) {
150
+
151
jQuery('body').removeClass('loading-content');
152
+ renderDemoGrid(demos.sites);
153
})
154
.fail(function () {
155
jQuery('body').removeClass('loading-content');
575
$this = jQuery(this);
576
$this.parent('li').siblings().find('.current').removeClass('current');
577
$this.addClass('current');
578
+
579
+ var astra_page_builder = jQuery('.filter-links.astra-page-builder'),
580
+ astra_category = jQuery('.filter-links.astra-category'),
581
+ page_builder_id = astra_page_builder.find('.current').data('id'),
582
+ category_id = astra_category.find('.current').data('id');
583
584
resetPagedCount();
585
+
586
paged = parseInt(jQuery('body').attr('data-astra-demo-paged'));
587
588
jQuery('body').addClass('loading-content');
589
jQuery('.theme-browser .theme').remove();
590
jQuery('.no-themes').remove();
596
dataType: 'json',
597
data: {
598
action: 'astra-list-sites',
599
paged: paged,
600
+ page_builder_id : page_builder_id,
601
+ category_id : category_id,
602
},
603
})
604
+ .done(function (demos) {
605
+ jQuery('.filter-count .count').text( demos.sites_count );
606
+ jQuery('body').removeClass('loading-content');
607
+
608
+ if ( demos.sites_count > 0 ) {
609
+ renderDemoGrid(demos.sites);
610
+ } else {
611
+ jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.searchNoFound+'</p>');
612
+ }
613
+ })
614
+ .fail(function () {
615
+ jQuery('body').removeClass('loading-content');
616
+ jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.responseError+'</p>');
617
+ });
618
619
});
620
627
id = 'all';
628
}
629
630
+ var astra_page_builder = jQuery('.filter-links.astra-page-builder'),
631
+ astra_category = jQuery('.filter-links.astra-category'),
632
+ page_builder_id = astra_page_builder.find('.current').data('id'),
633
+ category_id = astra_category.find('.current').data('id');
634
+
635
+
636
window.clearTimeout(ref);
637
ref = window.setTimeout(function () {
638
ref = null;
650
data: {
651
action: 'astra-list-sites',
652
search: $this,
653
+ page_builder_id : page_builder_id,
654
+ category_id : category_id,
655
},
656
})
657
+ .done(function (demos) {
658
+ jQuery('body').removeClass('loading-content');
659
660
+ console.log('demos.sites_count: ' + demos.sites_count);
661
+
662
+ jQuery('.filter-count .count').text( demos.sites_count );
663
+
664
+ if ( demos.sites_count > 0 ) {
665
+ renderDemoGrid(demos.sites);
666
+ } else {
667
+ jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.searchNoFound+'</p>');
668
+ }
669
+
670
+ })
671
+ .fail(function () {
672
+ jQuery('body').removeClass('loading-content');
673
+ jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.responseError+'.</p>');
674
+ });
675
676
677
}, 500);
678
679
});
680
681
+ function renderDemoGrid(demos, current_event = '') {
682
+
683
jQuery.each(demos, function (index, demo) {
684
685
id = demo.id;
713
var template = wp.template('astra-single-demo');
714
jQuery('.themes').append(template(templateData[0]));
715
});
716
+
717
+
718
}
719
720
jQuery(document).on('click', '.collapse-sidebar', function (event) {
inc/classes/class-astra-sites.php CHANGED
@@ -161,15 +161,23 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
161
);
162
163
$args_search = isset( $args->search ) ? $args->search : '';
164
- $args_id = isset( $args->id ) ? $args->id : '';
165
166
- // Not Search?
167
- if ( '' !== $args_search ) {
168
- $request_params['search'] = $args_search;
169
170
- // Not All?
171
- } elseif ( 'all' != $args_id ) {
172
- $request_params['astra-site-category'] = $args_id;
173
}
174
175
return add_query_arg( $request_params, self::$api_url . 'astra-sites' );
@@ -186,6 +194,17 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
186
return add_query_arg( $request_params, self::$api_url . 'astra-site-category/' );
187
}
188
189
/**
190
* Enqueue admin scripts.
191
*
@@ -458,11 +477,11 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
458
return;
459
}
460
461
$args = new stdClass();
462
- $args->category = isset( $_POST['category'] ) ? esc_attr( $_POST['category'] ) : '';
463
- $args->id = isset( $_POST['id'] ) ? esc_attr( $_POST['id'] ) : '';
464
$args->search = isset( $_POST['search'] ) ? esc_attr( $_POST['search'] ) : '';
465
- $paged = isset( $_POST['paged'] ) ? esc_attr( $_POST['paged'] ) : '1';
466
467
return wp_send_json( self::get_astra_demos( $args, $paged ) );
468
}
@@ -496,6 +515,28 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
496
// Import Widgets data.
497
$this->import_widgets( $demo_data['astra-site-widgets-data'] );
498
499
}
500
501
/**
@@ -654,7 +695,10 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
654
655
$url = self::get_api_url( $args, $paged );
656
657
- $astra_demos = array();
658
659
$api_args = apply_filters(
660
'astra_sites_api_args', array(
@@ -665,6 +709,9 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
665
$response = wp_remote_get( $url, $api_args );
666
667
if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
668
$result = json_decode( wp_remote_retrieve_body( $response ), true );
669
670
// If is array then proceed
@@ -677,29 +724,29 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
677
continue;
678
}
679
680
- $astra_demos[ $key ]['id'] = isset( $demo['id'] ) ? esc_attr( $demo['id'] ) : '';
681
- $astra_demos[ $key ]['slug'] = isset( $demo['slug'] ) ? esc_attr( $demo['slug'] ) : '';
682
- $astra_demos[ $key ]['date'] = isset( $demo['date'] ) ? esc_attr( $demo['date'] ) : '';
683
- $astra_demos[ $key ]['astra_demo_type'] = isset( $demo['astra-site-type'] ) ? sanitize_key( $demo['astra-site-type'] ) : '';
684
- $astra_demos[ $key ]['astra_demo_url'] = isset( $demo['astra-site-url'] ) ? esc_url( $demo['astra-site-url'] ) : '';
685
- $astra_demos[ $key ]['title'] = isset( $demo['title']['rendered'] ) ? esc_attr( $demo['title']['rendered'] ) : '';
686
- $astra_demos[ $key ]['featured_image_url'] = isset( $demo['featured-image-url'] ) ? esc_url( $demo['featured-image-url'] ) : '';
687
- $astra_demos[ $key ]['demo_api'] = isset( $demo['_links']['self'][0]['href'] ) ? esc_url( $demo['_links']['self'][0]['href'] ) : self::get_api_url( new stdClass() ) . $demo['id'];
688
- $astra_demos[ $key ]['content'] = isset( $demo['content']['rendered'] ) ? strip_tags( $demo['content']['rendered'] ) : '';
689
690
if ( isset( $demo['required-plugins'] ) ) {
691
$required_plugins = $demo['required-plugins'];
692
if ( is_array( $required_plugins ) ) {
693
- $astra_demos[ $key ]['required_plugins'] = json_encode( $required_plugins );
694
} else {
695
- $astra_demos[ $key ]['required_plugins'] = $required_plugins;
696
}
697
}
698
- $astra_demos[ $key ]['astra_site_options'] = isset( $demo['astra-site-options-data'] ) ? json_encode( $demo['astra-site-options-data'] ) : '';
699
- $astra_demos[ $key ]['astra_enabled_extensions'] = isset( $demo['astra-enabled-extensions'] ) ? json_encode( $demo['astra-enabled-extensions'] ) : '';
700
701
$demo_status = isset( $demo['status'] ) ? sanitize_key( $demo['status'] ) : '';
702
- $astra_demos[ $key ]['status'] = ( 'draft' === $demo_status ) ? 'beta' : $demo_status;
703
}
704
705
// Free up memory by unsetting variables that are not required.
@@ -764,6 +811,58 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
764
return $categories;
765
}
766
767
}
768
769
/**
161
);
162
163
$args_search = isset( $args->search ) ? $args->search : '';
164
+ $args_search = isset( $args->search ) ? $args->search : '';
165
+ $category_id = isset( $args->category_id ) ? $args->category_id : '';
166
+ $page_builder_id = isset( $args->page_builder_id ) ? $args->page_builder_id : '';
167
168
+ // Have Search?
169
+ if ( ! empty( $args_search ) ) {
170
+ $request_params['search'] = $args_search;
171
+ }
172
+
173
+ // Have Site Page Builder Category?
174
+ if ( ! empty( $page_builder_id ) && 'all' != $page_builder_id ) {
175
+ $request_params['astra-site-page-builder'] = $page_builder_id;
176
+ }
177
178
+ // Have Site Category?
179
+ if ( ! empty( $category_id ) && 'all' != $category_id ) {
180
+ $request_params['astra-site-category'] = $category_id;
181
}
182
183
return add_query_arg( $request_params, self::$api_url . 'astra-sites' );
194
return add_query_arg( $request_params, self::$api_url . 'astra-site-category/' );
195
}
196
197
+ /**
198
+ * Returns the API URL for searching site page builders
199
+ *
200
+ * @since 1.0.9
201
+ * @return (String) URL that can be queried to return the demos.
202
+ */
203
+ public static function get_page_builders_api_url() {
204
+ $request_params = apply_filters( 'astra_sites_api_params', array() );
205
+ return add_query_arg( $request_params, self::$api_url . 'astra-site-page-builder/' );
206
+ }
207
+
208
/**
209
* Enqueue admin scripts.
210
*
477
return;
478
}
479
480
+ $paged = isset( $_POST['paged'] ) ? esc_attr( $_POST['paged'] ) : '1';
481
$args = new stdClass();
482
$args->search = isset( $_POST['search'] ) ? esc_attr( $_POST['search'] ) : '';
483
+ $args->page_builder_id = isset( $_POST['page_builder_id'] ) ? esc_attr( $_POST['page_builder_id'] ) : '';
484
+ $args->category_id = isset( $_POST['category_id'] ) ? esc_attr( $_POST['category_id'] ) : '';
485
486
return wp_send_json( self::get_astra_demos( $args, $paged ) );
487
}
515
// Import Widgets data.
516
$this->import_widgets( $demo_data['astra-site-widgets-data'] );
517
518
+ // Clear Cache.
519
+ $this->clear_cache();
520
+
521
+ }
522
+
523
+ /**
524
+ * Clear Cache.
525
+ *
526
+ * @since 1.0.9
527
+ */
528
+ private function clear_cache() {
529
+
530
+ // Clear 'Elementor' file cache.
531
+ if ( class_exists( '\Elementor\Plugin' ) ) {
532
+ Elementor\Plugin::$instance->posts_css_manager->clear_cache();
533
+ }
534
+
535
+ // Clear 'Builder Builder' cache.
536
+ if ( is_callable( 'FLBuilderModel::delete_asset_cache_for_all_posts' ) ) {
537
+ FLBuilderModel::delete_asset_cache_for_all_posts();
538
+ }
539
+
540
}
541
542
/**
695
696
$url = self::get_api_url( $args, $paged );
697
698
+ $astra_demos = array(
699
+ 'sites' => array(),
700
+ 'sites_count' => 0,
701
+ );
702
703
$api_args = apply_filters(
704
'astra_sites_api_args', array(
709
$response = wp_remote_get( $url, $api_args );
710
711
if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
712
+
713
+ $astra_demos['sites_count'] = wp_remote_retrieve_header( $response, 'x-wp-total' );
714
+
715
$result = json_decode( wp_remote_retrieve_body( $response ), true );
716
717
// If is array then proceed
724
continue;
725
}
726
727
+ $astra_demos['sites'][ $key ]['id'] = isset( $demo['id'] ) ? esc_attr( $demo['id'] ) : '';
728
+ $astra_demos['sites'][ $key ]['slug'] = isset( $demo['slug'] ) ? esc_attr( $demo['slug'] ) : '';
729
+ $astra_demos['sites'][ $key ]['date'] = isset( $demo['date'] ) ? esc_attr( $demo['date'] ) : '';
730
+ $astra_demos['sites'][ $key ]['astra_demo_type'] = isset( $demo['astra-site-type'] ) ? sanitize_key( $demo['astra-site-type'] ) : '';
731
+ $astra_demos['sites'][ $key ]['astra_demo_url'] = isset( $demo['astra-site-url'] ) ? esc_url( $demo['astra-site-url'] ) : '';
732
+ $astra_demos['sites'][ $key ]['title'] = isset( $demo['title']['rendered'] ) ? esc_attr( $demo['title']['rendered'] ) : '';
733
+ $astra_demos['sites'][ $key ]['featured_image_url'] = isset( $demo['featured-image-url'] ) ? esc_url( $demo['featured-image-url'] ) : '';
734
+ $astra_demos['sites'][ $key ]['demo_api'] = isset( $demo['_links']['self'][0]['href'] ) ? esc_url( $demo['_links']['self'][0]['href'] ) : self::get_api_url( new stdClass() ) . $demo['id'];
735
+ $astra_demos['sites'][ $key ]['content'] = isset( $demo['content']['rendered'] ) ? strip_tags( $demo['content']['rendered'] ) : '';
736
737
if ( isset( $demo['required-plugins'] ) ) {
738
$required_plugins = $demo['required-plugins'];
739
if ( is_array( $required_plugins ) ) {
740
+ $astra_demos['sites'][ $key ]['required_plugins'] = json_encode( $required_plugins );
741
} else {
742
+ $astra_demos['sites'][ $key ]['required_plugins'] = $required_plugins;
743
}
744
}
745
+ $astra_demos['sites'][ $key ]['astra_site_options'] = isset( $demo['astra-site-options-data'] ) ? json_encode( $demo['astra-site-options-data'] ) : '';
746
+ $astra_demos['sites'][ $key ]['astra_enabled_extensions'] = isset( $demo['astra-enabled-extensions'] ) ? json_encode( $demo['astra-enabled-extensions'] ) : '';
747
748
$demo_status = isset( $demo['status'] ) ? sanitize_key( $demo['status'] ) : '';
749
+ $astra_demos['sites'][ $key ]['status'] = ( 'draft' === $demo_status ) ? 'beta' : $demo_status;
750
}
751
752
// Free up memory by unsetting variables that are not required.
811
return $categories;
812
}
813
814
+ /**
815
+ * Get Site Page Builder Categories.
816
+ *
817
+ * @since 1.0.9
818
+ * @return (Array) Array of Site Page Builder Categories.
819
+ */
820
+ public static function get_page_builders() {
821
+ $categories = array();
822
+
823
+ $api_args = apply_filters(
824
+ 'astra_demo_api_args', array(
825
+ 'timeout' => 15,
826
+ )
827
+ );
828
+
829
+ $response = wp_remote_get( self::get_page_builders_api_url(), $api_args );
830
+
831
+ if ( ! is_wp_error( $response ) || 200 === wp_remote_retrieve_response_code( $response ) ) {
832
+ $result = json_decode( wp_remote_retrieve_body( $response ), true );
833
+
834
+ if ( array_key_exists( 'code', $result ) && 'rest_no_route' === $result['code'] ) {
835
+ return $categories;
836
+ }
837
+
838
+ // If is array then proceed
839
+ // Else skip it.
840
+ if ( is_array( $result ) ) {
841
+
842
+ foreach ( $result as $key => $category ) {
843
+
844
+ if ( apply_filters( 'astra_sites_category_hide_empty', true ) ) {
845
+ if ( 0 == $category['count'] ) {
846
+ continue;
847
+ }
848
+ }
849
+ $categories[ $key ]['id'] = $category['id'];
850
+ $categories[ $key ]['name'] = $category['name'];
851
+ $categories[ $key ]['slug'] = $category['slug'];
852
+ $categories[ $key ]['count'] = $category['count'];
853
+ $categories[ $key ]['link-category'] = $category['_links']['self'][0]['href'];
854
+ }
855
+
856
+ // Free up memory by unsetting variables that are not required.
857
+ unset( $result );
858
+ unset( $response );
859
+
860
+ }
861
+ }
862
+
863
+ return $categories;
864
+ }
865
+
866
}
867
868
/**
languages/astra-sites.pot CHANGED
@@ -1,10 +1,10 @@
1
# Copyright (C) 2017 Brainstorm Force
2
- # This file is distributed under the same license as the Astra Free Sites package.
3
msgid ""
4
msgstr ""
5
- "Project-Id-Version: Astra Free Sites 1.0.8\n"
6
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
- "POT-Creation-Date: 2017-09-05 14:54:17+00:00\n"
8
"MIME-Version: 1.0\n"
9
"Content-Type: text/plain; charset=utf-8\n"
10
"Content-Transfer-Encoding: 8bit\n"
@@ -24,83 +24,83 @@ msgstr ""
24
"X-Textdomain-Support: yes\n"
25
"X-Generator: grunt-wp-i18n1.0.0\n"
26
27
- #: inc/admin/class-astra-sites-page.php:85
28
- msgid "Astra Sites"
29
msgstr ""
30
31
#: inc/admin/class-astra-sites-page.php:158
32
msgid "Settings saved successfully."
33
msgstr ""
34
35
- #: inc/admin/view-astra-sites.php:27
36
msgid "All"
37
msgstr ""
38
39
- #: inc/admin/view-astra-sites.php:41
40
msgid "Search Sites"
41
msgstr ""
42
43
- #: inc/admin/view-astra-sites.php:42
44
msgid "Search Sites..."
45
msgstr ""
46
47
- #: inc/admin/view-astra-sites.php:91
48
msgid "Details &amp; Preview"
49
msgstr ""
50
51
- #: inc/admin/view-astra-sites.php:97 inc/admin/view-astra-sites.php:166
52
msgid "Preview"
53
msgstr ""
54
55
- #: inc/admin/view-astra-sites.php:124
56
msgid "Close"
57
msgstr ""
58
59
- #: inc/admin/view-astra-sites.php:125
60
msgid "Previous"
61
msgstr ""
62
63
- #: inc/admin/view-astra-sites.php:126
64
msgid "Next"
65
msgstr ""
66
67
- #: inc/admin/view-astra-sites.php:127 inc/admin/view-astra-sites.php:155
68
msgid "Install Plugins"
69
msgstr ""
70
71
- #: inc/admin/view-astra-sites.php:143 inc/classes/class-astra-sites.php:238
72
msgid "Read more"
73
msgstr ""
74
75
- #: inc/admin/view-astra-sites.php:146
76
msgid "Required Plugins"
77
msgstr ""
78
79
- #: inc/admin/view-astra-sites.php:161
80
msgid "Collapse"
81
msgstr ""
82
83
- #: inc/admin/view-astra-sites.php:176
84
#. translators: %1$s & %2$s are a Demo API URL
85
msgid ""
86
"<p> It seems the demo data server, <i><a href=\"%1$s\">%2$s</a></i> is "
87
"unreachable from your site.</p>"
88
msgstr ""
89
90
- #: inc/admin/view-astra-sites.php:178
91
msgid ""
92
"<p class=\"left-margin\"> 1. Sometimes, simple page reload fixes any "
93
"temporary issues. No kidding!</p>"
94
msgstr ""
95
96
- #: inc/admin/view-astra-sites.php:180
97
msgid ""
98
"<p class=\"left-margin\"> 2. If that does not work, you will need to talk "
99
"to your server administrator and check if demo server is being blocked by "
100
"the firewall!</p>"
101
msgstr ""
102
103
- #: inc/admin/view-astra-sites.php:183
104
#. translators: %1$s is a support link
105
msgid ""
106
"<p>If that does not help, please open up a <a href=\"%1$s\" "
@@ -115,55 +115,55 @@ msgid ""
115
"Sites\" plugin. <a href=\"%1$s\">Install & Activate Now</a>"
116
msgstr ""
117
118
- #: inc/classes/class-astra-sites.php:125
119
msgid "See Library"
120
msgstr ""
121
122
- #: inc/classes/class-astra-sites.php:224
123
msgid "Purchase"
124
msgstr ""
125
126
- #: inc/classes/class-astra-sites.php:226
127
msgid "Upgrade"
128
msgstr ""
129
130
- #: inc/classes/class-astra-sites.php:231
131
msgid "Error!"
132
msgstr ""
133
134
- #: inc/classes/class-astra-sites.php:232
135
msgid "Error! Read Possibilities."
136
msgstr ""
137
138
- #: inc/classes/class-astra-sites.php:234
139
msgid "Done! View Site"
140
msgstr ""
141
142
- #: inc/classes/class-astra-sites.php:235
143
msgid "Activating"
144
msgstr ""
145
146
- #: inc/classes/class-astra-sites.php:236
147
msgid "Active"
148
msgstr ""
149
150
- #: inc/classes/class-astra-sites.php:237
151
msgid "Import This Site"
152
msgstr ""
153
154
- #: inc/classes/class-astra-sites.php:239
155
msgid "Hide"
156
msgstr ""
157
158
- #: inc/classes/class-astra-sites.php:240
159
msgid "There was a problem receiving a response from server."
160
msgstr ""
161
162
- #: inc/classes/class-astra-sites.php:241
163
msgid "No Demos found, Try a different search."
164
msgstr ""
165
166
- #: inc/classes/class-astra-sites.php:242
167
msgid ""
168
"Executing Demo Import will make your site similar as ours. Please bear in "
169
"mind -\n"
@@ -177,19 +177,19 @@ msgid ""
177
"placeholders."
178
msgstr ""
179
180
- #: inc/classes/class-astra-sites.php:282
181
msgid "No plugin specified"
182
msgstr ""
183
184
- #: inc/classes/class-astra-sites.php:311
185
msgid "Plugin Successfully Activated"
186
msgstr ""
187
188
- #: inc/classes/class-astra-sites.php:440
189
msgid "You have not \"customize\" access to import the astra site."
190
msgstr ""
191
192
- #: inc/classes/class-astra-sites.php:448
193
msgid "Demo Imported Successfully."
194
msgstr ""
195
@@ -368,10 +368,6 @@ msgstr ""
368
msgid "Could not update comment #%d with mapped data"
369
msgstr ""
370
371
- #. Plugin Name of the plugin/theme
372
- msgid "Astra Free Sites"
373
- msgstr ""
374
-
375
#. Plugin URI of the plugin/theme
376
msgid "http://www.wpastra.com/pro/"
377
msgstr ""
1
# Copyright (C) 2017 Brainstorm Force
2
+ # This file is distributed under the same license as the Astra Sites - Lite package.
3
msgid ""
4
msgstr ""
5
+ "Project-Id-Version: Astra Sites - Lite 1.0.9\n"
6
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
+ "POT-Creation-Date: 2017-09-08 10:19:28+00:00\n"
8
"MIME-Version: 1.0\n"
9
"Content-Type: text/plain; charset=utf-8\n"
10
"Content-Transfer-Encoding: 8bit\n"
24
"X-Textdomain-Support: yes\n"
25
"X-Generator: grunt-wp-i18n1.0.0\n"
26
27
+ #. Plugin Name of the plugin/theme
28
+ msgid "Astra Sites - Lite"
29
msgstr ""
30
31
#: inc/admin/class-astra-sites-page.php:158
32
msgid "Settings saved successfully."
33
msgstr ""
34
35
+ #: inc/admin/view-astra-sites.php:47
36
msgid "All"
37
msgstr ""
38
39
+ #: inc/admin/view-astra-sites.php:61
40
msgid "Search Sites"
41
msgstr ""
42
43
+ #: inc/admin/view-astra-sites.php:62
44
msgid "Search Sites..."
45
msgstr ""
46
47
+ #: inc/admin/view-astra-sites.php:112
48
msgid "Details &amp; Preview"
49
msgstr ""
50
51
+ #: inc/admin/view-astra-sites.php:118 inc/admin/view-astra-sites.php:187
52
msgid "Preview"
53
msgstr ""
54
55
+ #: inc/admin/view-astra-sites.php:145
56
msgid "Close"
57
msgstr ""
58
59
+ #: inc/admin/view-astra-sites.php:146
60
msgid "Previous"
61
msgstr ""
62
63
+ #: inc/admin/view-astra-sites.php:147
64
msgid "Next"
65
msgstr ""
66
67
+ #: inc/admin/view-astra-sites.php:148 inc/admin/view-astra-sites.php:176
68
msgid "Install Plugins"
69
msgstr ""
70
71
+ #: inc/admin/view-astra-sites.php:164 inc/classes/class-astra-sites.php:253
72
msgid "Read more"
73
msgstr ""
74
75
+ #: inc/admin/view-astra-sites.php:167
76
msgid "Required Plugins"
77
msgstr ""
78
79
+ #: inc/admin/view-astra-sites.php:182
80
msgid "Collapse"
81
msgstr ""
82
83
+ #: inc/admin/view-astra-sites.php:197
84
#. translators: %1$s & %2$s are a Demo API URL
85
msgid ""
86
"<p> It seems the demo data server, <i><a href=\"%1$s\">%2$s</a></i> is "
87
"unreachable from your site.</p>"
88
msgstr ""
89
90
+ #: inc/admin/view-astra-sites.php:199
91
msgid ""
92
"<p class=\"left-margin\"> 1. Sometimes, simple page reload fixes any "
93
"temporary issues. No kidding!</p>"
94
msgstr ""
95
96
+ #: inc/admin/view-astra-sites.php:201
97
msgid ""
98
"<p class=\"left-margin\"> 2. If that does not work, you will need to talk "
99
"to your server administrator and check if demo server is being blocked by "
100
"the firewall!</p>"
101
msgstr ""
102
103
+ #: inc/admin/view-astra-sites.php:204
104
#. translators: %1$s is a support link
105
msgid ""
106
"<p>If that does not help, please open up a <a href=\"%1$s\" "
115
"Sites\" plugin. <a href=\"%1$s\">Install & Activate Now</a>"
116
msgstr ""
117
118
+ #: inc/classes/class-astra-sites.php:121
119
msgid "See Library"
120
msgstr ""
121
122
+ #: inc/classes/class-astra-sites.php:239
123
msgid "Purchase"
124
msgstr ""
125
126
+ #: inc/classes/class-astra-sites.php:241
127
msgid "Upgrade"
128
msgstr ""
129
130
+ #: inc/classes/class-astra-sites.php:246
131
msgid "Error!"
132
msgstr ""
133
134
+ #: inc/classes/class-astra-sites.php:247
135
msgid "Error! Read Possibilities."
136
msgstr ""
137
138
+ #: inc/classes/class-astra-sites.php:249
139
msgid "Done! View Site"
140
msgstr ""
141
142
+ #: inc/classes/class-astra-sites.php:250
143
msgid "Activating"
144
msgstr ""
145
146
+ #: inc/classes/class-astra-sites.php:251
147
msgid "Active"
148
msgstr ""
149
150
+ #: inc/classes/class-astra-sites.php:252
151
msgid "Import This Site"
152
msgstr ""
153
154
+ #: inc/classes/class-astra-sites.php:254
155
msgid "Hide"
156
msgstr ""
157
158
+ #: inc/classes/class-astra-sites.php:255
159
msgid "There was a problem receiving a response from server."
160
msgstr ""
161
162
+ #: inc/classes/class-astra-sites.php:256
163
msgid "No Demos found, Try a different search."
164
msgstr ""
165
166
+ #: inc/classes/class-astra-sites.php:257
167
msgid ""
168
"Executing Demo Import will make your site similar as ours. Please bear in "
169
"mind -\n"
177
"placeholders."
178
msgstr ""
179
180
+ #: inc/classes/class-astra-sites.php:297
181
msgid "No plugin specified"
182
msgstr ""
183
184
+ #: inc/classes/class-astra-sites.php:326
185
msgid "Plugin Successfully Activated"
186
msgstr ""
187
188
+ #: inc/classes/class-astra-sites.php:455
189
msgid "You have not \"customize\" access to import the astra site."
190
msgstr ""
191
192
+ #: inc/classes/class-astra-sites.php:463
193
msgid "Demo Imported Successfully."
194
msgstr ""
195
368
msgid "Could not update comment #%d with mapped data"
369
msgstr ""
370
371
#. Plugin URI of the plugin/theme
372
msgid "http://www.wpastra.com/pro/"
373
msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wpastra.com/pro/
4
Tags: demo, theme demos, one click import
5
Requires at least: 4.4
6
Tested up to: 4.8.1
7
- Stable tag: 1.0.8
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -46,6 +46,9 @@ https://sites.wpastra.com/law-free/
46
47
== Changelog ==
48
49
v1.0.8 - 6-Sept-2017
50
* Fix: Beaver Builder option import.
51
* Enhancement: Disabled dismiss-able notice visible once for each user.
4
Tags: demo, theme demos, one click import
5
Requires at least: 4.4
6
Tested up to: 4.8.1
7
+ Stable tag: 1.0.9
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
46
47
== Changelog ==
48
49
+ v1.0.9 - 8-Sept-2017
50
+ * New: Added page builder categories for listing sites as per page builder.
51
+
52
v1.0.8 - 6-Sept-2017
53
* Fix: Beaver Builder option import.
54
* Enhancement: Disabled dismiss-able notice visible once for each user.