ThemeGrill Demo Importer - Version 1.7.5

Version Description

  • 25-10-2021 =
  • Tweak - Use of escaping and sanitization functions.
Download this release

Release Info

Developer themegrilldev
Plugin Icon 128x128 ThemeGrill Demo Importer
Version 1.7.5
Comparing to
See all releases

Code changes from version 1.7.4 to 1.7.5

includes/class-demo-importer.php CHANGED
@@ -183,25 +183,18 @@ class TG_Demo_Importer {
183
  'settings' => array(
184
  'isNew' => false,
185
  'ajaxUrl' => admin_url( 'admin-ajax.php' ),
186
- 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
187
  'suggestURI' => apply_filters( 'themegrill_demo_importer_suggest_new', 'https://themegrill.com/contact/' ),
188
  'confirmImport' => sprintf(
189
-
190
  __( 'Importing demo data will ensure that your site will look similar as theme demo. It makes you easy to modify the content instead of creating them from scratch. Also, consider before importing the demo: %1$s %2$s %3$s %4$s %5$s %6$s', 'themegrill-demo-importer' ),
191
-
192
  '<ol><li class="warning">' . __( 'Importing the demo on the site if you have already added the content is highly discouraged.', 'themegrill-demo-importer' ) . '</li>',
193
-
194
  '<li>' . __( 'You need to import demo on fresh WordPress install to exactly replicate the theme demo.', 'themegrill-demo-importer' ) . '</li>',
195
-
196
  '<li>' . __( 'It will install the required plugins as well as activate them for installing the required theme demo within your site.', 'themegrill-demo-importer' ) . '</li>',
197
-
198
  '<li>' . __( 'Copyright images will get replaced with other placeholder images.', 'themegrill-demo-importer' ) . '</li>',
199
-
200
  '<li>' . __( 'None of the posts, pages, attachments or any other data already existing in your site will be deleted or modified.', 'themegrill-demo-importer' ) . '</li>',
201
-
202
  '<li>' . __( 'It will take some time to import the theme demo.', 'themegrill-demo-importer' ) . '</li></ol>'
203
-
204
- )
205
  ),
206
  'l10n' => array(
207
  'search' => __( 'Search Demos', 'themegrill-demo-importer' ),
@@ -210,6 +203,7 @@ class TG_Demo_Importer {
210
  'error' => sprintf( __( 'An unexpected error occurred. Something may be wrong with ThemeGrill demo server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.', 'themegrill-demo-importer' ), 'https://wordpress.org/support/plugin/themegrill-demo-importer' ),
211
  'tryAgain' => __( 'Try Again', 'themegrill-demo-importer' ),
212
  'suggestNew' => __( 'Please suggest us!', 'themegrill-demo-importer' ),
 
213
  'demosFound' => __( 'Number of Demos found: %d', 'themegrill-demo-importer' ),
214
  'noDemosFound' => __( 'No demos found. Try a different search.', 'themegrill-demo-importer' ),
215
  'collapseSidebar' => __( 'Collapse Sidebar', 'themegrill-demo-importer' ),
@@ -274,15 +268,17 @@ class TG_Demo_Importer {
274
  'content' =>
275
  '<h2>' . __( 'Help &amp; Support', 'themegrill-demo-importer' ) . '</h2>' .
276
  '<p>' . sprintf(
 
277
  __( 'Should you need help understanding, using, or extending ThemeGrill Demo Importer, <a href="%s">please read our documentation</a>. You will find all kinds of resources including snippets, tutorials and much more.', 'themegrill-demo-importer' ),
278
  'https://themegrill.com/docs/themegrill-demo-importer/'
279
  ) . '</p>' .
280
  '<p>' . sprintf(
 
281
  __( 'For further assistance with ThemeGrill Demo Importer core you can use the <a href="%1$s">community forum</a>. If you need help with premium themes sold by ThemeGrill, please <a href="%2$s">use our free support forum</a>.', 'themegrill-demo-importer' ),
282
  'https://wordpress.org/support/plugin/themegrill-demo-importer',
283
  'https://themegrill.com/support-forum/'
284
  ) . '</p>' .
285
- '<p><a href="' . 'https://wordpress.org/support/plugin/themegrill-demo-importer' . '" class="button button-primary">' . __( 'Community forum', 'themegrill-demo-importer' ) . '</a> <a href="' . 'https://themegrill.com/support-forum/' . '" class="button">' . __( 'ThemeGrill Support', 'themegrill-demo-importer' ) . '</a></p>',
286
  )
287
  );
288
 
@@ -292,19 +288,24 @@ class TG_Demo_Importer {
292
  'title' => __( 'Found a bug?', 'themegrill-demo-importer' ),
293
  'content' =>
294
  '<h2>' . __( 'Found a bug?', 'themegrill-demo-importer' ) . '</h2>' .
295
- '<p>' . sprintf( __( 'If you find a bug within ThemeGrill Demo Importer you can create a ticket via <a href="%1$s">Github issues</a>. Ensure you read the <a href="%2$s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible.', 'themegrill-demo-importer' ), 'https://github.com/themegrill/themegrill-demo-importer/issues?state=open', 'https://github.com/themegrill/themegrill-demo-importer/blob/master/.github/CONTRIBUTING.md' ) . '</p>' .
296
- '<p><a href="' . 'https://github.com/themegrill/themegrill-demo-importer/issues?state=open' . '" class="button button-primary">' . __( 'Report a bug', 'themegrill-demo-importer' ) . '</a></p>',
 
 
 
 
 
297
 
298
  )
299
  );
300
 
301
  $screen->set_help_sidebar(
302
  '<p><strong>' . __( 'For more information:', 'themegrill-demo-importer' ) . '</strong></p>' .
303
- '<p><a href="' . 'https://themegrill.com/demo-importer/' . '" target="_blank">' . __( 'About Demo Importer', 'themegrill-demo-importer' ) . '</a></p>' .
304
- '<p><a href="' . 'https://wordpress.org/plugins/themegrill-demo-importer/' . '" target="_blank">' . __( 'WordPress.org project', 'themegrill-demo-importer' ) . '</a></p>' .
305
- '<p><a href="' . 'https://github.com/themegrill/themegrill-demo-importer' . '" target="_blank">' . __( 'Github project', 'themegrill-demo-importer' ) . '</a></p>' .
306
- '<p><a href="' . 'https://themegrill.com/wordpress-themes/' . '" target="_blank">' . __( 'Official themes', 'themegrill-demo-importer' ) . '</a></p>' .
307
- '<p><a href="' . 'https://themegrill.com/plugins/' . '" target="_blank">' . __( 'Official plugins', 'themegrill-demo-importer' ) . '</a></p>'
308
  );
309
  }
310
 
@@ -342,7 +343,7 @@ class TG_Demo_Importer {
342
  */
343
  public function zakra_is_premium_theme_plan() {
344
 
345
- if ( is_plugin_active( 'zakra-pro/zakra-pro.php' ) && is_plugin_active( 'companion-elementor/companion-elementor.php') ) {
346
  return true;
347
  }
348
 
@@ -357,7 +358,7 @@ class TG_Demo_Importer {
357
  */
358
  public function themegrill_is_all_themes_plan() {
359
 
360
- if ( is_plugin_active( 'companion-elementor/companion-elementor.php') ) {
361
  return true;
362
  }
363
 
183
  'settings' => array(
184
  'isNew' => false,
185
  'ajaxUrl' => admin_url( 'admin-ajax.php' ),
186
+ 'adminUrl' => wp_parse_url( self_admin_url(), PHP_URL_PATH ),
187
  'suggestURI' => apply_filters( 'themegrill_demo_importer_suggest_new', 'https://themegrill.com/contact/' ),
188
  'confirmImport' => sprintf(
189
+ /* translators: Before import warning texts */
190
  __( 'Importing demo data will ensure that your site will look similar as theme demo. It makes you easy to modify the content instead of creating them from scratch. Also, consider before importing the demo: %1$s %2$s %3$s %4$s %5$s %6$s', 'themegrill-demo-importer' ),
 
191
  '<ol><li class="warning">' . __( 'Importing the demo on the site if you have already added the content is highly discouraged.', 'themegrill-demo-importer' ) . '</li>',
 
192
  '<li>' . __( 'You need to import demo on fresh WordPress install to exactly replicate the theme demo.', 'themegrill-demo-importer' ) . '</li>',
 
193
  '<li>' . __( 'It will install the required plugins as well as activate them for installing the required theme demo within your site.', 'themegrill-demo-importer' ) . '</li>',
 
194
  '<li>' . __( 'Copyright images will get replaced with other placeholder images.', 'themegrill-demo-importer' ) . '</li>',
 
195
  '<li>' . __( 'None of the posts, pages, attachments or any other data already existing in your site will be deleted or modified.', 'themegrill-demo-importer' ) . '</li>',
 
196
  '<li>' . __( 'It will take some time to import the theme demo.', 'themegrill-demo-importer' ) . '</li></ol>'
197
+ ),
 
198
  ),
199
  'l10n' => array(
200
  'search' => __( 'Search Demos', 'themegrill-demo-importer' ),
203
  'error' => sprintf( __( 'An unexpected error occurred. Something may be wrong with ThemeGrill demo server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.', 'themegrill-demo-importer' ), 'https://wordpress.org/support/plugin/themegrill-demo-importer' ),
204
  'tryAgain' => __( 'Try Again', 'themegrill-demo-importer' ),
205
  'suggestNew' => __( 'Please suggest us!', 'themegrill-demo-importer' ),
206
+ /* translators: %d: Number of demos. */
207
  'demosFound' => __( 'Number of Demos found: %d', 'themegrill-demo-importer' ),
208
  'noDemosFound' => __( 'No demos found. Try a different search.', 'themegrill-demo-importer' ),
209
  'collapseSidebar' => __( 'Collapse Sidebar', 'themegrill-demo-importer' ),
268
  'content' =>
269
  '<h2>' . __( 'Help &amp; Support', 'themegrill-demo-importer' ) . '</h2>' .
270
  '<p>' . sprintf(
271
+ /* translators: %s: Documentation URL */
272
  __( 'Should you need help understanding, using, or extending ThemeGrill Demo Importer, <a href="%s">please read our documentation</a>. You will find all kinds of resources including snippets, tutorials and much more.', 'themegrill-demo-importer' ),
273
  'https://themegrill.com/docs/themegrill-demo-importer/'
274
  ) . '</p>' .
275
  '<p>' . sprintf(
276
+ /* translators: 1: WP support URL. 2: TG support URL */
277
  __( 'For further assistance with ThemeGrill Demo Importer core you can use the <a href="%1$s">community forum</a>. If you need help with premium themes sold by ThemeGrill, please <a href="%2$s">use our free support forum</a>.', 'themegrill-demo-importer' ),
278
  'https://wordpress.org/support/plugin/themegrill-demo-importer',
279
  'https://themegrill.com/support-forum/'
280
  ) . '</p>' .
281
+ '<p><a href="https://wordpress.org/support/plugin/themegrill-demo-importer" class="button button-primary">' . __( 'Community forum', 'themegrill-demo-importer' ) . '</a> <a href="https://themegrill.com/support-forum/" class="button">' . __( 'ThemeGrill Support', 'themegrill-demo-importer' ) . '</a></p>',
282
  )
283
  );
284
 
288
  'title' => __( 'Found a bug?', 'themegrill-demo-importer' ),
289
  'content' =>
290
  '<h2>' . __( 'Found a bug?', 'themegrill-demo-importer' ) . '</h2>' .
291
+ '<p>' . sprintf(
292
+ /* translators: %s: GitHub links */
293
+ __( 'If you find a bug within ThemeGrill Demo Importer you can create a ticket via <a href="%1$s">Github issues</a>. Ensure you read the <a href="%2$s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible.', 'themegrill-demo-importer' ),
294
+ 'https://github.com/themegrill/themegrill-demo-importer/issues?state=open',
295
+ 'https://github.com/themegrill/themegrill-demo-importer/blob/master/.github/CONTRIBUTING.md'
296
+ ) . '</p>' .
297
+ '<p><a href="https://github.com/themegrill/themegrill-demo-importer/issues?state=open" class="button button-primary">' . __( 'Report a bug', 'themegrill-demo-importer' ) . '</a></p>',
298
 
299
  )
300
  );
301
 
302
  $screen->set_help_sidebar(
303
  '<p><strong>' . __( 'For more information:', 'themegrill-demo-importer' ) . '</strong></p>' .
304
+ '<p><a href="https://themegrill.com/demo-importer/" target="_blank">' . __( 'About Demo Importer', 'themegrill-demo-importer' ) . '</a></p>' .
305
+ '<p><a href="https://wordpress.org/plugins/themegrill-demo-importer/" target="_blank">' . __( 'WordPress.org project', 'themegrill-demo-importer' ) . '</a></p>' .
306
+ '<p><a href="https://github.com/themegrill/themegrill-demo-importer" target="_blank">' . __( 'Github project', 'themegrill-demo-importer' ) . '</a></p>' .
307
+ '<p><a href="https://themegrill.com/wordpress-themes/" target="_blank">' . __( 'Official themes', 'themegrill-demo-importer' ) . '</a></p>' .
308
+ '<p><a href="https://themegrill.com/plugins/" target="_blank">' . __( 'Official plugins', 'themegrill-demo-importer' ) . '</a></p>'
309
  );
310
  }
311
 
343
  */
344
  public function zakra_is_premium_theme_plan() {
345
 
346
+ if ( is_plugin_active( 'zakra-pro/zakra-pro.php' ) && is_plugin_active( 'companion-elementor/companion-elementor.php' ) ) {
347
  return true;
348
  }
349
 
358
  */
359
  public function themegrill_is_all_themes_plan() {
360
 
361
+ if ( is_plugin_active( 'companion-elementor/companion-elementor.php' ) ) {
362
  return true;
363
  }
364
 
includes/class-themegrill-demo-importer.php CHANGED
@@ -20,7 +20,7 @@ final class ThemeGrill_Demo_Importer {
20
  *
21
  * @var string
22
  */
23
- public $version = '1.7.4';
24
 
25
  /**
26
  * Theme single instance of this class.
20
  *
21
  * @var string
22
  */
23
+ public $version = '1.7.5';
24
 
25
  /**
26
  * Theme single instance of this class.
includes/functions-demo-importer.php CHANGED
@@ -90,7 +90,7 @@ function tg_ajax_install_required_plugin() {
90
 
91
  $skin = new WP_Ajax_Upgrader_Skin();
92
  $upgrader = new Plugin_Upgrader( $skin );
93
- $result = 'everest-forms' === wp_unslash( $_POST['slug'] ) ? true : $upgrader->install( $api->download_link );
94
 
95
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
96
  $status['debug'] = $skin->get_upgrade_messages();
@@ -124,7 +124,7 @@ function tg_ajax_install_required_plugin() {
124
  $install_status = install_plugin_install_status( $api );
125
 
126
  if ( current_user_can( 'activate_plugin', $install_status['file'] ) && is_plugin_inactive( $install_status['file'] ) ) {
127
- $result = 'everest-forms' === wp_unslash( $_POST['slug'] ) ? true : activate_plugin( $install_status['file'] );
128
 
129
  if ( is_wp_error( $result ) ) {
130
  $status['errorCode'] = $result->get_error_code();
@@ -458,7 +458,7 @@ function tg_set_masteriyo_pages( $demo_id ) {
458
  $delete_ids = array();
459
 
460
  // Retrieve page with greater id and delete others.
461
- if ( sizeof( $page_ids ) > 1 ) {
462
 
463
  foreach ( $page_ids as $page ) {
464
  if ( $page->ID > $page_id ) {
@@ -554,7 +554,7 @@ function tg_print_admin_notice_templates() {
554
  printf( __( '%s installs failed.', 'themegrill-demo-importer' ), '{{ data.errors }}' );
555
  ?>
556
  <# } #>
557
- <span class="screen-reader-text"><?php _e( 'Show more details', 'themegrill-demo-importer' ); ?></span>
558
  <span class="toggle-indicator" aria-hidden="true"></span>
559
  </button>
560
  <# } #>
90
 
91
  $skin = new WP_Ajax_Upgrader_Skin();
92
  $upgrader = new Plugin_Upgrader( $skin );
93
+ $result = $upgrader->install( $api->download_link );
94
 
95
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
96
  $status['debug'] = $skin->get_upgrade_messages();
124
  $install_status = install_plugin_install_status( $api );
125
 
126
  if ( current_user_can( 'activate_plugin', $install_status['file'] ) && is_plugin_inactive( $install_status['file'] ) ) {
127
+ $result = activate_plugin( $install_status['file'] );
128
 
129
  if ( is_wp_error( $result ) ) {
130
  $status['errorCode'] = $result->get_error_code();
458
  $delete_ids = array();
459
 
460
  // Retrieve page with greater id and delete others.
461
+ if ( count( $page_ids ) > 1 ) {
462
 
463
  foreach ( $page_ids as $page ) {
464
  if ( $page->ID > $page_id ) {
554
  printf( __( '%s installs failed.', 'themegrill-demo-importer' ), '{{ data.errors }}' );
555
  ?>
556
  <# } #>
557
+ <span class="screen-reader-text"><?php esc_html_e( 'Show more details', 'themegrill-demo-importer' ); ?></span>
558
  <span class="toggle-indicator" aria-hidden="true"></span>
559
  </button>
560
  <# } #>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ThemeGrill, shivapoudel
3
  Tags: themegrill, theme demos, demo, importer, one click import
4
  Requires at least: 4.7
5
  Tested up to: 5.8
6
- Stable tag: 1.7.4
7
  License: GPLv3 or later
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -72,6 +72,9 @@ Yes you can! Join in on our [GitHub repository](https://github.com/themegrill/th
72
  3. Finally, Import the Demo with just one click.
73
 
74
  == Changelog ==
 
 
 
75
  = 1.7.4 - 19-10-2021 =
76
  * Enhancement - Compatibility with latest Masteriyo LMS plugin.
77
 
3
  Tags: themegrill, theme demos, demo, importer, one click import
4
  Requires at least: 4.7
5
  Tested up to: 5.8
6
+ Stable tag: 1.7.5
7
  License: GPLv3 or later
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
72
  3. Finally, Import the Demo with just one click.
73
 
74
  == Changelog ==
75
+ = 1.7.5 - 25-10-2021 =
76
+ * Tweak - Use of escaping and sanitization functions.
77
+
78
  = 1.7.4 - 19-10-2021 =
79
  * Enhancement - Compatibility with latest Masteriyo LMS plugin.
80
 
themegrill-demo-importer.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: ThemeGrill Demo Importer
4
  * Plugin URI: https://themegrill.com/demo-importer/
5
  * Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click.
6
- * Version: 1.7.4
7
  * Author: ThemeGrill
8
  * Author URI: https://themegrill.com
9
  * License: GPLv3 or later
3
  * Plugin Name: ThemeGrill Demo Importer
4
  * Plugin URI: https://themegrill.com/demo-importer/
5
  * Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click.
6
+ * Version: 1.7.5
7
  * Author: ThemeGrill
8
  * Author URI: https://themegrill.com
9
  * License: GPLv3 or later