ThemeGrill Demo Importer - Version 1.7.7

Version Description

  • 12-01-2022 =
  • Support - BlockArt Blocks plugin.
  • Support - Online Education theme.
  • Fix - PHP warning while importing widget.
Download this release

Release Info

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

Code changes from version 1.7.6.1 to 1.7.7

includes/class-demo-importer.php CHANGED
@@ -955,15 +955,16 @@ class TG_Demo_Importer {
955
  * @return array
956
  */
957
  public function update_widget_data( $widget, $widget_type, $instance_id, $demo_data ) {
958
- if ( 'nav_menu' == $widget_type ) {
959
- $nav_menu = wp_get_nav_menu_object( $widget['title'] );
 
960
 
961
  if ( is_object( $nav_menu ) && $nav_menu->term_id ) {
962
  $widget['nav_menu'] = $nav_menu->term_id;
963
  }
964
  } elseif ( ! empty( $demo_data['widgets_data_update'] ) ) {
965
  foreach ( $demo_data['widgets_data_update'] as $dropdown_type => $dropdown_data ) {
966
- if ( ! in_array( $dropdown_type, array( 'dropdown_pages', 'dropdown_categories' ) ) ) {
967
  continue;
968
  }
969
 
@@ -971,7 +972,7 @@ class TG_Demo_Importer {
971
  switch ( $dropdown_type ) {
972
  case 'dropdown_pages':
973
  foreach ( $dropdown_data as $widget_id => $widget_data ) {
974
- if ( ! empty( $widget_data[ $instance_id ] ) && $widget_id == $widget_type ) {
975
  foreach ( $widget_data[ $instance_id ] as $widget_key => $widget_value ) {
976
  $page = get_page_by_title( $widget_value );
977
 
@@ -982,6 +983,7 @@ class TG_Demo_Importer {
982
  }
983
  }
984
  break;
 
985
  case 'dropdown_categories':
986
  foreach ( $dropdown_data as $taxonomy => $taxonomy_data ) {
987
  if ( ! taxonomy_exists( $taxonomy ) ) {
@@ -989,7 +991,7 @@ class TG_Demo_Importer {
989
  }
990
 
991
  foreach ( $taxonomy_data as $widget_id => $widget_data ) {
992
- if ( ! empty( $widget_data[ $instance_id ] ) && $widget_id == $widget_type ) {
993
  foreach ( $widget_data[ $instance_id ] as $widget_key => $widget_value ) {
994
  $term = get_term_by( 'name', $widget_value, $taxonomy );
995
 
955
  * @return array
956
  */
957
  public function update_widget_data( $widget, $widget_type, $instance_id, $demo_data ) {
958
+ if ( 'nav_menu' === $widget_type ) {
959
+ $menu = isset( $widget['title'] ) ? $widget['title'] : $widget['nav_menu'];
960
+ $nav_menu = wp_get_nav_menu_object( $menu );
961
 
962
  if ( is_object( $nav_menu ) && $nav_menu->term_id ) {
963
  $widget['nav_menu'] = $nav_menu->term_id;
964
  }
965
  } elseif ( ! empty( $demo_data['widgets_data_update'] ) ) {
966
  foreach ( $demo_data['widgets_data_update'] as $dropdown_type => $dropdown_data ) {
967
+ if ( ! in_array( $dropdown_type, array( 'dropdown_pages', 'dropdown_categories' ), true ) ) {
968
  continue;
969
  }
970
 
972
  switch ( $dropdown_type ) {
973
  case 'dropdown_pages':
974
  foreach ( $dropdown_data as $widget_id => $widget_data ) {
975
+ if ( ! empty( $widget_data[ $instance_id ] ) && $widget_id === $widget_type ) {
976
  foreach ( $widget_data[ $instance_id ] as $widget_key => $widget_value ) {
977
  $page = get_page_by_title( $widget_value );
978
 
983
  }
984
  }
985
  break;
986
+ default:
987
  case 'dropdown_categories':
988
  foreach ( $dropdown_data as $taxonomy => $taxonomy_data ) {
989
  if ( ! taxonomy_exists( $taxonomy ) ) {
991
  }
992
 
993
  foreach ( $taxonomy_data as $widget_id => $widget_data ) {
994
+ if ( ! empty( $widget_data[ $instance_id ] ) && $widget_id === $widget_type ) {
995
  foreach ( $widget_data[ $instance_id ] as $widget_key => $widget_value ) {
996
  $term = get_term_by( 'name', $widget_value, $taxonomy );
997
 
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.6.1';
24
 
25
  /**
26
  * Theme single instance of this class.
@@ -123,7 +123,30 @@ final class ThemeGrill_Demo_Importer {
123
  * @return array
124
  */
125
  private function get_core_supported_themes() {
126
- $core_themes = array( 'spacious', 'colormag', 'flash', 'estore', 'ample', 'accelerate', 'colornews', 'foodhunt', 'fitclub', 'radiate', 'freedom', 'himalayas', 'esteem', 'envince', 'suffice', 'explore', 'masonic', 'cenote', 'zakra', 'webshop', 'elearning' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  // Check for official core themes pro version.
128
  $pro_themes = array_diff( $core_themes, array( 'explore', 'masonic' ) );
129
  if ( ! empty( $pro_themes ) ) {
20
  *
21
  * @var string
22
  */
23
+ public $version = '1.7.7';
24
 
25
  /**
26
  * Theme single instance of this class.
123
  * @return array
124
  */
125
  private function get_core_supported_themes() {
126
+ $core_themes = array(
127
+ 'spacious',
128
+ 'colormag',
129
+ 'flash',
130
+ 'estore',
131
+ 'ample',
132
+ 'accelerate',
133
+ 'colornews',
134
+ 'foodhunt',
135
+ 'fitclub',
136
+ 'radiate',
137
+ 'freedom',
138
+ 'himalayas',
139
+ 'esteem',
140
+ 'envince',
141
+ 'suffice',
142
+ 'explore',
143
+ 'masonic',
144
+ 'cenote',
145
+ 'zakra',
146
+ 'webshop',
147
+ 'elearning',
148
+ 'online-education'
149
+ );
150
  // Check for official core themes pro version.
151
  $pro_themes = array_diff( $core_themes, array( 'explore', 'masonic' ) );
152
  if ( ! empty( $pro_themes ) ) {
includes/functions-demo-importer.php CHANGED
@@ -14,6 +14,9 @@ require_once TGDM_ABSPATH . 'includes/functions-demo-update.php';
14
  // Disable Masteriyo setup wizard.
15
  add_filter( 'masteriyo_enable_setup_wizard', '__return_false' );
16
 
 
 
 
17
  /**
18
  * Ajax handler for installing a required plugin.
19
  *
@@ -243,7 +246,7 @@ add_action( 'themegrill_ajax_demo_imported', 'tg_set_elementor_load_fa4_shim' );
243
  function tg_set_elementor_load_fa4_shim() {
244
  $elementor_load_fa4_shim = get_option( 'elementor_load_fa4_shim' );
245
 
246
- if ( ! $elementor_load_fa4_shim || '' === $elementor_load_fa4_shim ) {
247
  update_option( 'elementor_load_fa4_shim', 'yes' );
248
  }
249
  }
@@ -423,26 +426,31 @@ function tg_set_masteriyo_pages( $demo_id ) {
423
  $masteriyo_pages = apply_filters(
424
  'themegrill_masteriyo_' . $demo_id . '_pages',
425
  array(
426
- 'courses' => array(
427
  'name' => 'courses',
428
  'title' => 'Courses',
429
  'setting_name' => 'courses_page_id',
430
  ),
431
- 'account' => array(
432
  'name' => 'account',
433
  'title' => 'Account',
434
  'setting_name' => 'account_page_id',
435
  ),
436
- 'checkout' => array(
437
  'name' => 'checkout',
438
  'title' => 'Checkout',
439
  'setting_name' => 'checkout_page_id',
440
  ),
441
- 'learn' => array(
442
  'name' => 'learn',
443
  'title' => 'Learn',
444
  'setting_name' => 'learn_page_id',
445
  ),
 
 
 
 
 
446
  )
447
  );
448
 
@@ -576,12 +584,12 @@ function tg_print_admin_notice_templates() {
576
  *
577
  * @see tg_set_siteorigin_setting()
578
  */
579
- add_action( 'themegrill_ajax_demo_imported', 'tg_set_siteorigin_setting' );
580
 
581
  /**
582
  * Set SiteOrigin PageBuilder Default Setting.
583
  */
584
- function tg_set_siteorigin_setting() {
585
  $siteorigin_version = defined( 'SITEORIGIN_PANELS_VERSION' ) ? SITEORIGIN_PANELS_VERSION : false;
586
 
587
  if ( version_compare( $siteorigin_version, '2.12.0', '>=' ) ) {
@@ -593,3 +601,28 @@ function tg_set_siteorigin_setting() {
593
  update_option( 'siteorigin_panels_settings', $settings );
594
  }
595
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  // Disable Masteriyo setup wizard.
15
  add_filter( 'masteriyo_enable_setup_wizard', '__return_false' );
16
 
17
+ // Disable BlockArt redirection.
18
+ add_filter( 'blockart_activation_redirect', '__return_false' );
19
+
20
  /**
21
  * Ajax handler for installing a required plugin.
22
  *
246
  function tg_set_elementor_load_fa4_shim() {
247
  $elementor_load_fa4_shim = get_option( 'elementor_load_fa4_shim' );
248
 
249
+ if ( ! $elementor_load_fa4_shim ) {
250
  update_option( 'elementor_load_fa4_shim', 'yes' );
251
  }
252
  }
426
  $masteriyo_pages = apply_filters(
427
  'themegrill_masteriyo_' . $demo_id . '_pages',
428
  array(
429
+ 'courses' => array(
430
  'name' => 'courses',
431
  'title' => 'Courses',
432
  'setting_name' => 'courses_page_id',
433
  ),
434
+ 'account' => array(
435
  'name' => 'account',
436
  'title' => 'Account',
437
  'setting_name' => 'account_page_id',
438
  ),
439
+ 'checkout' => array(
440
  'name' => 'checkout',
441
  'title' => 'Checkout',
442
  'setting_name' => 'checkout_page_id',
443
  ),
444
+ 'learn' => array(
445
  'name' => 'learn',
446
  'title' => 'Learn',
447
  'setting_name' => 'learn_page_id',
448
  ),
449
+ 'instructor-registration' => array(
450
+ 'name' => 'instructor-registration',
451
+ 'title' => 'Instructor Registration',
452
+ 'setting_name' => 'instructor_registration_page_id',
453
+ ),
454
  )
455
  );
456
 
584
  *
585
  * @see tg_set_siteorigin_setting()
586
  */
587
+ add_action( 'themegrill_ajax_demo_imported', 'tg_set_siteorigin_settings' );
588
 
589
  /**
590
  * Set SiteOrigin PageBuilder Default Setting.
591
  */
592
+ function tg_set_siteorigin_settings() {
593
  $siteorigin_version = defined( 'SITEORIGIN_PANELS_VERSION' ) ? SITEORIGIN_PANELS_VERSION : false;
594
 
595
  if ( version_compare( $siteorigin_version, '2.12.0', '>=' ) ) {
601
  update_option( 'siteorigin_panels_settings', $settings );
602
  }
603
  }
604
+
605
+ /**
606
+ * After demo imported AJAX action.
607
+ *
608
+ * @see tg_update_masteriyo_settings()
609
+ */
610
+ add_action( 'themegrill_ajax_demo_imported', 'tg_update_masteriyo_settings', 10, 2 );
611
+
612
+ /**
613
+ * Update Masteriyo settings.
614
+ *
615
+ * @param string $id Demo Id.
616
+ * @param array $data Demo data.
617
+ * @return void
618
+ */
619
+ function tg_update_masteriyo_settings( $id, $data ) {
620
+
621
+ if ( ! function_exists( 'masteriyo_set_setting' ) || empty( $data['masteriyo_settings'] ) ) {
622
+ return;
623
+ }
624
+
625
+ foreach ( $data['masteriyo_settings'] as $key => $value ) {
626
+ masteriyo_set_setting( $key, $value );
627
+ }
628
+ }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ThemeGrill
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.6.1
7
  License: GPLv3 or later
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -76,30 +76,12 @@ Yes you can! Join in on our [GitHub repository](https://github.com/themegrill/th
76
  3. Finally, Import the Demo with just one click.
77
 
78
  == Changelog ==
 
 
 
 
 
79
  = 1.7.6.1 - 31-12-2021 =
80
  * Tweak - Update stable tag.
81
 
82
- = 1.7.6 - 30-12-2021 =
83
- * Tweak - Update resources URL.
84
-
85
- = 1.7.5 - 25-10-2021 =
86
- * Tweak - Use of escaping and sanitization functions.
87
-
88
- = 1.7.4 - 19-10-2021 =
89
- * Enhancement - Compatibility with latest Masteriyo LMS plugin.
90
-
91
- = 1.7.3 - 08-10-2021 =
92
- * Tweak - Support eLearning theme.
93
- * Tweak - Disable Masteriyo setup wizard.
94
- * Tweak - Setup Masteriyo pages properly after demo import.
95
-
96
- = 1.7.2 - 25-06-2021 =
97
- * Fix - Value (Legacy) of Parallax Type option from SiteOrigin plugin changing after demo import.
98
-
99
- = 1.7.1 - 18-01-2021 =
100
- * Remove - Admin notice for `Plugin Review`.
101
-
102
- = 1.7.0 - 11-01-2021 =
103
- * Tweak - Set FontAwesome 4 Shim feature to be enabled automatically on successful theme demo import.
104
-
105
  [See changelog for all versions](https://raw.githubusercontent.com/themegrill/themegrill-demo-importer/master/CHANGELOG.txt).
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.7
7
  License: GPLv3 or later
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
76
  3. Finally, Import the Demo with just one click.
77
 
78
  == Changelog ==
79
+ = 1.7.7 - 12-01-2022 =
80
+ * Support - BlockArt Blocks plugin.
81
+ * Support - Online Education theme.
82
+ * Fix - PHP warning while importing widget.
83
+
84
  = 1.7.6.1 - 31-12-2021 =
85
  * Tweak - Update stable tag.
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  [See changelog for all versions](https://raw.githubusercontent.com/themegrill/themegrill-demo-importer/master/CHANGELOG.txt).
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.6.1
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.7
7
  * Author: ThemeGrill
8
  * Author URI: https://themegrill.com
9
  * License: GPLv3 or later