Astra Starter Sites - Version 1.0.4

Version Description

Download this release

Release Info

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

Code changes from version 1.0.3 to 1.0.4

admin/view-astra-sites.php CHANGED
@@ -61,7 +61,7 @@ do_action( 'astra_sites_before_site_grid' );
61
  */
62
  ?>
63
  <script type="text/template" id="tmpl-astra-single-demo">
64
- <div class="theme astra-theme" tabindex="0" aria-describedby="astra-theme-action astra-theme-name"
65
  data-demo-id="{{{data.id}}}"
66
  data-demo-type="{{{data.astra_demo_type}}}"
67
  data-demo-url="{{{data.astra_demo_url}}}"
@@ -73,6 +73,8 @@ do_action( 'astra_sites_before_site_grid' );
73
  data-required-plugins="{{data.required_plugins}}">
74
  <input type="hidden" class="astra-site-options" value="{{data.astra_site_options}}" >
75
 
 
 
76
  <span class="demo-type {{{data.astra_demo_type}}}">{{{data.astra_demo_type}}}</span>
77
 
78
  <div class="theme-screenshot">
61
  */
62
  ?>
63
  <script type="text/template" id="tmpl-astra-single-demo">
64
+ <div class="theme astra-theme {{data.status}}" tabindex="0" aria-describedby="astra-theme-action astra-theme-name"
65
  data-demo-id="{{{data.id}}}"
66
  data-demo-type="{{{data.astra_demo_type}}}"
67
  data-demo-url="{{{data.astra_demo_url}}}"
73
  data-required-plugins="{{data.required_plugins}}">
74
  <input type="hidden" class="astra-site-options" value="{{data.astra_site_options}}" >
75
 
76
+ <span class="status {{data.status}}">{{data.status}}</span>
77
+
78
  <span class="demo-type {{{data.astra_demo_type}}}">{{{data.astra_demo_type}}}</span>
79
 
80
  <div class="theme-screenshot">
assets/css/admin.css CHANGED
@@ -10,18 +10,27 @@
10
  padding-top: 66.66666%
11
  }
12
 
 
13
  .wrap .demo-type {
14
  position: absolute;
15
  z-index: 1;
16
  color: #fff;
17
  padding: 0.5em 1em;
18
  top: -0.5em;
19
- left: -0.5em;
20
  text-transform: uppercase;
21
  }
 
22
  .wrap .demo-type.premium {
23
  background: #0073aa;
24
  }
 
 
 
 
 
 
 
 
25
  .wrap .demo-type.free {
26
  display: none;
27
  }
10
  padding-top: 66.66666%
11
  }
12
 
13
+ .wrap .status,
14
  .wrap .demo-type {
15
  position: absolute;
16
  z-index: 1;
17
  color: #fff;
18
  padding: 0.5em 1em;
19
  top: -0.5em;
 
20
  text-transform: uppercase;
21
  }
22
+ .wrap .status,
23
  .wrap .demo-type.premium {
24
  background: #0073aa;
25
  }
26
+ .wrap .status {
27
+ left: -0.5em;
28
+ }
29
+ .wrap .demo-type.premium {
30
+ right: -0.5em;
31
+ }
32
+
33
+ .wrap .status.publish,
34
  .wrap .demo-type.free {
35
  display: none;
36
  }
assets/js/admin.js CHANGED
@@ -641,11 +641,13 @@ function renderDemoGrid(demos) {
641
  astra_demo_url = demo.astra_demo_url;
642
  astra_demo_type = demo.astra_demo_type;
643
  requiredPlugins = demo.required_plugins;
 
644
  astraSiteOptions = demo.astra_site_options || '';
645
 
646
  templateData = [{
647
  id: id,
648
  astra_demo_type: astra_demo_type,
 
649
  astra_demo_url: astra_demo_url,
650
  demo_api: demo_api,
651
  screenshot: screenshot,
641
  astra_demo_url = demo.astra_demo_url;
642
  astra_demo_type = demo.astra_demo_type;
643
  requiredPlugins = demo.required_plugins;
644
+ status = demo.status;
645
  astraSiteOptions = demo.astra_site_options || '';
646
 
647
  templateData = [{
648
  id: id,
649
  astra_demo_type: astra_demo_type,
650
+ status: status,
651
  astra_demo_url: astra_demo_url,
652
  demo_api: demo_api,
653
  screenshot: screenshot,
astra-sites.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Astra Sites
4
  * Plugin URI: http://www.wpastra.com/pro/
5
  * Description: Import sites build with Astra theme.
6
- * Version: 1.0.3
7
  * Author: Brainstorm Force
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-sites
@@ -14,7 +14,7 @@
14
  /**
15
  * Set constants.
16
  */
17
- define( 'ASTRA_SITES_VER', '1.0.3' );
18
  define( 'ASTRA_SITES_FILE', __FILE__ );
19
  define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) );
20
  define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) );
3
  * Plugin Name: Astra Sites
4
  * Plugin URI: http://www.wpastra.com/pro/
5
  * Description: Import sites build with Astra theme.
6
+ * Version: 1.0.4
7
  * Author: Brainstorm Force
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-sites
14
  /**
15
  * Set constants.
16
  */
17
+ define( 'ASTRA_SITES_VER', '1.0.4' );
18
  define( 'ASTRA_SITES_FILE', __FILE__ );
19
  define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) );
20
  define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) );
classes/class-astra-sites.php CHANGED
@@ -126,7 +126,7 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
126
  */
127
  public static function set_api_url() {
128
 
129
- self::$api_url = apply_filters( 'astra_demo_api_url', 'https://sites.wpastra.com/wp-json/wp/v2/' );
130
 
131
  }
132
 
@@ -144,13 +144,15 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
144
  */
145
  public static function get_api_url( $args, $page = '1' ) {
146
 
147
- $request_params = array(
148
- 'page' => $page,
149
- 'per_page' => '15',
 
150
 
151
- // Use this for premium demos.
152
- 'purchase_key' => '',
153
- 'site_url' => '',
 
154
  );
155
 
156
  $args_search = isset( $args->search ) ? $args->search : '';
@@ -175,7 +177,8 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
175
  * @return (String) URL that can be queried to return the demos.
176
  */
177
  public static function get_taxanomy_api_url() {
178
- return self::$api_url . 'astra-site-category/';
 
179
  }
180
 
181
  /**
@@ -565,8 +568,10 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
565
  'required-plugins' => '',
566
  );
567
 
568
- $api_args = array(
569
- 'timeout' => 15,
 
 
570
  );
571
 
572
  $response = wp_remote_get( $demo_api_uri, $api_args );
@@ -605,8 +610,10 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
605
 
606
  $astra_demos = array();
607
 
608
- $api_args = array(
609
- 'timeout' => 15,
 
 
610
  );
611
 
612
  $response = wp_remote_get( $url, $api_args );
@@ -635,6 +642,9 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
635
  $astra_demos[ $key ]['content'] = isset( $demo['content']['rendered'] ) ? strip_tags( $demo['content']['rendered'] ) : '';
636
  $astra_demos[ $key ]['required_plugins'] = isset( $demo['required-plugins'] ) ? json_encode( $demo['required-plugins'] ) : '';
637
  $astra_demos[ $key ]['astra_site_options'] = isset( $demo['astra-site-options-data'] ) ? json_encode( $demo['astra-site-options-data'] ) : '';
 
 
 
638
  }
639
 
640
  // Free up memory by unsetting variables that are not required.
@@ -656,8 +666,10 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
656
  public static function get_demo_categories() {
657
  $categories = array();
658
 
659
- $api_args = array(
660
- 'timeout' => 15,
 
 
661
  );
662
 
663
  $response = wp_remote_get( self::get_taxanomy_api_url(), $api_args );
@@ -674,8 +686,11 @@ if ( ! class_exists( 'Astra_Sites' ) ) :
674
  if ( is_array( $result ) ) {
675
 
676
  foreach ( $result as $key => $category ) {
677
- if ( 0 == $category['count'] ) {
678
- continue;
 
 
 
679
  }
680
  $categories[ $key ]['id'] = $category['id'];
681
  $categories[ $key ]['name'] = $category['name'];
126
  */
127
  public static function set_api_url() {
128
 
129
+ self::$api_url = apply_filters( 'astra_sites_api_url', 'https://sites.wpastra.com/wp-json/wp/v2/' );
130
 
131
  }
132
 
144
  */
145
  public static function get_api_url( $args, $page = '1' ) {
146
 
147
+ $request_params = apply_filters(
148
+ 'astra_sites_api_params', array(
149
+ 'page' => $page,
150
+ 'per_page' => '15',
151
 
152
+ // Use this for premium demos.
153
+ 'purchase_key' => '',
154
+ 'site_url' => '',
155
+ )
156
  );
157
 
158
  $args_search = isset( $args->search ) ? $args->search : '';
177
  * @return (String) URL that can be queried to return the demos.
178
  */
179
  public static function get_taxanomy_api_url() {
180
+ $request_params = apply_filters( 'astra_sites_api_params', array() );
181
+ return add_query_arg( $request_params, self::$api_url . 'astra-site-category/' );
182
  }
183
 
184
  /**
568
  'required-plugins' => '',
569
  );
570
 
571
+ $api_args = apply_filters(
572
+ 'astra_sites_api_args', array(
573
+ 'timeout' => 15,
574
+ )
575
  );
576
 
577
  $response = wp_remote_get( $demo_api_uri, $api_args );
610
 
611
  $astra_demos = array();
612
 
613
+ $api_args = apply_filters(
614
+ 'astra_sites_api_args', array(
615
+ 'timeout' => 15,
616
+ )
617
  );
618
 
619
  $response = wp_remote_get( $url, $api_args );
642
  $astra_demos[ $key ]['content'] = isset( $demo['content']['rendered'] ) ? strip_tags( $demo['content']['rendered'] ) : '';
643
  $astra_demos[ $key ]['required_plugins'] = isset( $demo['required-plugins'] ) ? json_encode( $demo['required-plugins'] ) : '';
644
  $astra_demos[ $key ]['astra_site_options'] = isset( $demo['astra-site-options-data'] ) ? json_encode( $demo['astra-site-options-data'] ) : '';
645
+
646
+ $demo_status = isset( $demo['status'] ) ? sanitize_key( $demo['status'] ) : '';
647
+ $astra_demos[ $key ]['status'] = ( 'draft' === $demo_status ) ? 'beta' : $demo_status;
648
  }
649
 
650
  // Free up memory by unsetting variables that are not required.
666
  public static function get_demo_categories() {
667
  $categories = array();
668
 
669
+ $api_args = apply_filters(
670
+ 'astra_demo_api_args', array(
671
+ 'timeout' => 15,
672
+ )
673
  );
674
 
675
  $response = wp_remote_get( self::get_taxanomy_api_url(), $api_args );
686
  if ( is_array( $result ) ) {
687
 
688
  foreach ( $result as $key => $category ) {
689
+
690
+ if ( apply_filters( 'astra_sites_category_hide_empty', true ) ) {
691
+ if ( 0 == $category['count'] ) {
692
+ continue;
693
+ }
694
  }
695
  $categories[ $key ]['id'] = $category['id'];
696
  $categories[ $key ]['name'] = $category['name'];
importers/wxr-importer/class-astra-wxr-importer.php CHANGED
@@ -46,7 +46,7 @@ class Astra_WXR_Importer {
46
  $this->includes();
47
 
48
  add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
49
- add_filter( 'wxr_importer.pre_process.user', array( $this, 'avoid_user' ) );
50
  }
51
 
52
  /**
46
  $this->includes();
47
 
48
  add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
49
+ add_filter( 'wxr_importer.pre_process.user', array( $this, 'avoid_user' ), 10, 2 );
50
  }
51
 
52
  /**
languages/astra-sites.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Astra Sites package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Astra Sites 1.0.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
- "POT-Creation-Date: 2017-08-11 06:34:41+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -40,63 +40,63 @@ msgstr ""
40
  msgid "Search Sites..."
41
  msgstr ""
42
 
43
- #: admin/view-astra-sites.php:85
44
  msgid "Details &amp; Preview"
45
  msgstr ""
46
 
47
- #: admin/view-astra-sites.php:91 admin/view-astra-sites.php:159
48
  msgid "Preview"
49
  msgstr ""
50
 
51
- #: admin/view-astra-sites.php:117
52
  msgid "Close"
53
  msgstr ""
54
 
55
- #: admin/view-astra-sites.php:118
56
  msgid "Previous"
57
  msgstr ""
58
 
59
- #: admin/view-astra-sites.php:119
60
  msgid "Next"
61
  msgstr ""
62
 
63
- #: admin/view-astra-sites.php:120 admin/view-astra-sites.php:148
64
  msgid "Install Plugins"
65
  msgstr ""
66
 
67
- #: admin/view-astra-sites.php:136 classes/class-astra-sites.php:214
68
  msgid "Read more"
69
  msgstr ""
70
 
71
- #: admin/view-astra-sites.php:139
72
  msgid "Required Plugins"
73
  msgstr ""
74
 
75
- #: admin/view-astra-sites.php:154
76
  msgid "Collapse"
77
  msgstr ""
78
 
79
- #: admin/view-astra-sites.php:169
80
  #. translators: %1$s & %2$s are a Demo API URL
81
  msgid ""
82
  "<p> It seems the demo data server, <i><a href=\"%1$s\">%2$s</a></i> is "
83
  "unreachable from your site.</p>"
84
  msgstr ""
85
 
86
- #: admin/view-astra-sites.php:171
87
  msgid ""
88
  "<p class=\"left-margin\"> 1. Sometimes, simple page reload fixes any "
89
  "temporary issues. No kidding!</p>"
90
  msgstr ""
91
 
92
- #: admin/view-astra-sites.php:173
93
  msgid ""
94
  "<p class=\"left-margin\"> 2. If that does not work, you will need to talk "
95
  "to your server administrator and check if demo server is being blocked by "
96
  "the firewall!</p>"
97
  msgstr ""
98
 
99
- #: admin/view-astra-sites.php:176
100
  #. translators: %1$s is a support link
101
  msgid ""
102
  "<p>If that does not help, please open up a <a href=\"%1$s\" "
@@ -115,47 +115,47 @@ msgstr ""
115
  msgid "See Library"
116
  msgstr ""
117
 
118
- #: classes/class-astra-sites.php:202
119
  msgid "Purchase"
120
  msgstr ""
121
 
122
- #: classes/class-astra-sites.php:207
123
  msgid "Error!"
124
  msgstr ""
125
 
126
- #: classes/class-astra-sites.php:208
127
  msgid "Error! Read Possibilities."
128
  msgstr ""
129
 
130
- #: classes/class-astra-sites.php:210
131
  msgid "Done! View Site"
132
  msgstr ""
133
 
134
- #: classes/class-astra-sites.php:211
135
  msgid "Activating"
136
  msgstr ""
137
 
138
- #: classes/class-astra-sites.php:212
139
  msgid "Active"
140
  msgstr ""
141
 
142
- #: classes/class-astra-sites.php:213
143
  msgid "Import This Site"
144
  msgstr ""
145
 
146
- #: classes/class-astra-sites.php:215
147
  msgid "Hide"
148
  msgstr ""
149
 
150
- #: classes/class-astra-sites.php:216
151
  msgid "There was a problem receiving a response from server."
152
  msgstr ""
153
 
154
- #: classes/class-astra-sites.php:217
155
  msgid "No Demos found, Try a different search."
156
  msgstr ""
157
 
158
- #: classes/class-astra-sites.php:218
159
  msgid ""
160
  "Executing Demo Import will make your site similar as ours. Please bear in "
161
  "mind -\n"
@@ -169,11 +169,11 @@ msgid ""
169
  "placeholders."
170
  msgstr ""
171
 
172
- #: classes/class-astra-sites.php:254
173
  msgid "No plugin specified"
174
  msgstr ""
175
 
176
- #: classes/class-astra-sites.php:279
177
  msgid "Plugin Successfully Activated"
178
  msgstr ""
179
 
2
  # This file is distributed under the same license as the Astra Sites package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Astra Sites 1.0.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
7
+ "POT-Creation-Date: 2017-08-21 11:22:50+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
40
  msgid "Search Sites..."
41
  msgstr ""
42
 
43
+ #: admin/view-astra-sites.php:89
44
  msgid "Details &amp; Preview"
45
  msgstr ""
46
 
47
+ #: admin/view-astra-sites.php:95 admin/view-astra-sites.php:163
48
  msgid "Preview"
49
  msgstr ""
50
 
51
+ #: admin/view-astra-sites.php:121
52
  msgid "Close"
53
  msgstr ""
54
 
55
+ #: admin/view-astra-sites.php:122
56
  msgid "Previous"
57
  msgstr ""
58
 
59
+ #: admin/view-astra-sites.php:123
60
  msgid "Next"
61
  msgstr ""
62
 
63
+ #: admin/view-astra-sites.php:124 admin/view-astra-sites.php:152
64
  msgid "Install Plugins"
65
  msgstr ""
66
 
67
+ #: admin/view-astra-sites.php:140 classes/class-astra-sites.php:215
68
  msgid "Read more"
69
  msgstr ""
70
 
71
+ #: admin/view-astra-sites.php:143
72
  msgid "Required Plugins"
73
  msgstr ""
74
 
75
+ #: admin/view-astra-sites.php:158
76
  msgid "Collapse"
77
  msgstr ""
78
 
79
+ #: admin/view-astra-sites.php:173
80
  #. translators: %1$s & %2$s are a Demo API URL
81
  msgid ""
82
  "<p> It seems the demo data server, <i><a href=\"%1$s\">%2$s</a></i> is "
83
  "unreachable from your site.</p>"
84
  msgstr ""
85
 
86
+ #: admin/view-astra-sites.php:175
87
  msgid ""
88
  "<p class=\"left-margin\"> 1. Sometimes, simple page reload fixes any "
89
  "temporary issues. No kidding!</p>"
90
  msgstr ""
91
 
92
+ #: admin/view-astra-sites.php:177
93
  msgid ""
94
  "<p class=\"left-margin\"> 2. If that does not work, you will need to talk "
95
  "to your server administrator and check if demo server is being blocked by "
96
  "the firewall!</p>"
97
  msgstr ""
98
 
99
+ #: admin/view-astra-sites.php:180
100
  #. translators: %1$s is a support link
101
  msgid ""
102
  "<p>If that does not help, please open up a <a href=\"%1$s\" "
115
  msgid "See Library"
116
  msgstr ""
117
 
118
+ #: classes/class-astra-sites.php:203
119
  msgid "Purchase"
120
  msgstr ""
121
 
122
+ #: classes/class-astra-sites.php:208
123
  msgid "Error!"
124
  msgstr ""
125
 
126
+ #: classes/class-astra-sites.php:209
127
  msgid "Error! Read Possibilities."
128
  msgstr ""
129
 
130
+ #: classes/class-astra-sites.php:211
131
  msgid "Done! View Site"
132
  msgstr ""
133
 
134
+ #: classes/class-astra-sites.php:212
135
  msgid "Activating"
136
  msgstr ""
137
 
138
+ #: classes/class-astra-sites.php:213
139
  msgid "Active"
140
  msgstr ""
141
 
142
+ #: classes/class-astra-sites.php:214
143
  msgid "Import This Site"
144
  msgstr ""
145
 
146
+ #: classes/class-astra-sites.php:216
147
  msgid "Hide"
148
  msgstr ""
149
 
150
+ #: classes/class-astra-sites.php:217
151
  msgid "There was a problem receiving a response from server."
152
  msgstr ""
153
 
154
+ #: classes/class-astra-sites.php:218
155
  msgid "No Demos found, Try a different search."
156
  msgstr ""
157
 
158
+ #: classes/class-astra-sites.php:219
159
  msgid ""
160
  "Executing Demo Import will make your site similar as ours. Please bear in "
161
  "mind -\n"
169
  "placeholders."
170
  msgstr ""
171
 
172
+ #: classes/class-astra-sites.php:255
173
  msgid "No plugin specified"
174
  msgstr ""
175
 
176
+ #: classes/class-astra-sites.php:280
177
  msgid "Plugin Successfully Activated"
178
  msgstr ""
179
 
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.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -46,6 +46,11 @@ https://sites.wpastra.com/law-free/
46
 
47
  == Changelog ==
48
 
 
 
 
 
 
49
  v1.0.3 - 11-Aug-2017
50
  * Fix: Avoided Astra users from site import process.
51
 
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.4
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.4 - 21-Aug-2017
50
+ * New: Added filter `astra_sites_api_params` for adding extra params in api call.
51
+ * New: Added filter `astra_sites_api_args` for adding extra arguments in api call.
52
+ * New: Added filter `astra_sites_category_hide_empty` for showing categories which are not set for any site.
53
+
54
  v1.0.3 - 11-Aug-2017
55
  * Fix: Avoided Astra users from site import process.
56