ThemeGrill Demo Importer - Version 1.4.1

Version Description

  • 08-12-2017 =
  • Feature - Compatiable with Elementor page builder.
  • Fix - Styling issue caused by missing theme-id-container container.

See changelog for all versions.

=

Download this release

Release Info

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

Code changes from version 1.4.0 to 1.4.1

assets/js/admin/demo-importer.js CHANGED
@@ -1335,6 +1335,22 @@ $( document ).ready( function() {
1335
  demos.Run.init();
1336
  }
1337
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1338
  // Rating footer.
1339
  $( '.themegrill-demo-importer-rating-link' ).on( 'click', function() {
1340
  var $this_el = $( this );
@@ -1351,13 +1367,6 @@ $( document ).ready( function() {
1351
  return window.confirm( demos.data.settings.confirmReset );
1352
  });
1353
 
1354
- // Load videos when help button is clicked.
1355
- $( '#contextual-help-link' ).on( 'click', function() {
1356
- var frame = $( '#tab-panel-themegrill_demo_importer_guided_tour_tab iframe' );
1357
-
1358
- frame.attr( 'src', frame.data( 'src' ) );
1359
- });
1360
-
1361
  // Make disabled checkbox always checked through data-checked.
1362
  $( document.body ).on( 'click', 'thead .check-column :checkbox', function( event ) {
1363
  var $this = $( this ),
1335
  demos.Run.init();
1336
  }
1337
 
1338
+ // Load videos when help button is clicked or welcome page is viewed.
1339
+ $( document.body ).on( 'themegrill_demo_importer_guided_tour_embed', function() {
1340
+ $( '.themegrill-demo-importer-guided-tour-embed' ).each( function() {
1341
+ var video_id = $( this ).data( 'video_id' );
1342
+ $( this ).replaceWith( '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/' + video_id + '" frameborder="0" allowfullscreen></iframe>' );
1343
+ } );
1344
+ } );
1345
+
1346
+ if ( demos.isInstall ) {
1347
+ $( document.body ).trigger( 'themegrill_demo_importer_guided_tour_embed' );
1348
+ } else {
1349
+ $( '#contextual-help-link' ).on( 'click', function() {
1350
+ $( document.body ).trigger( 'themegrill_demo_importer_guided_tour_embed' );
1351
+ } );
1352
+ }
1353
+
1354
  // Rating footer.
1355
  $( '.themegrill-demo-importer-rating-link' ).on( 'click', function() {
1356
  var $this_el = $( this );
1367
  return window.confirm( demos.data.settings.confirmReset );
1368
  });
1369
 
 
 
 
 
 
 
 
1370
  // Make disabled checkbox always checked through data-checked.
1371
  $( document.body ).on( 'click', 'thead .check-column :checkbox', function( event ) {
1372
  var $this = $( this ),
includes/admin/views/html-admin-page-importer.php CHANGED
@@ -43,34 +43,36 @@ if ( ! defined( 'ABSPATH' ) ) {
43
  printf( __( 'By %s', 'themegrill-demo-importer' ), $demo['author'] );
44
  ?></div>
45
 
46
- <?php if ( $demo['active'] ) { ?>
47
- <h2 class="theme-name" id="demo-name"><?php
48
- /* translators: %s: Demo name */
49
- printf( __( '<span>Imported:</span> %s', 'themegrill-demo-importer' ), esc_html( $demo['name'] ) );
50
- ?></h2>
51
- <?php } else { ?>
52
- <h2 class="theme-name" id="<?php echo esc_attr( $demo['id'] . '-name' ); ?>"><?php echo esc_html( $demo['name'] ); ?></h2>
53
- <?php } ?>
 
54
 
55
- <div class="theme-actions">
56
- <?php if ( $demo['active'] ) : ?>
57
- <a class="button button-primary live-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['preview'] ); ?>"><?php _e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
58
- <?php else : ?>
59
- <?php if ( ! empty( $demo['hasNotice'] ) ) : ?>
60
- <?php if ( isset( $demo['hasNotice']['required_theme'] ) ) : ?>
61
- <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" data-tip="<?php echo esc_attr( sprintf( __( 'Required %s theme must be activated to import this demo.', 'themegrill-demo-importer' ), $demo['theme'] ) ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
62
- <?php elseif ( isset( $demo['hasNotice']['required_plugins'] ) ) : ?>
63
- <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" data-tip="<?php echo esc_attr( 'Required Plugin must be activated to import this demo.', 'themegrill-demo-importer' ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
64
- <?php endif; ?>
65
  <?php else : ?>
66
- <?php
67
- /* translators: %s: Demo name */
68
- $aria_label = sprintf( _x( 'Import %s', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
69
- ?>
70
- <a class="button button-primary hide-if-no-js import" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
 
 
 
 
 
 
 
 
 
71
  <?php endif; ?>
72
- <a class="button button-secondary demo-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['demo_url'] ); ?>"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
73
- <?php endif; ?>
74
  </div>
75
  </div>
76
  <?php endforeach; ?>
@@ -95,34 +97,36 @@ if ( ! defined( 'ABSPATH' ) ) {
95
  printf( __( 'By %s', 'themegrill-demo-importer' ), '{{{ data.author }}}' );
96
  ?></div>
97
 
98
- <# if ( data.active ) { #>
99
- <h2 class="theme-name" id="{{ data.id }}-name"><?php
100
- /* translators: %s: Demo name */
101
- printf( __( '<span>Imported:</span> %s', 'themegrill-demo-importer' ), '{{{ data.name }}}' );
102
- ?></h2>
103
- <# } else { #>
104
- <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
105
- <# } #>
106
-
107
- <div class="theme-actions">
108
  <# if ( data.active ) { #>
109
- <a class="button button-primary live-preview" target="_blank" href="{{{ data.actions.preview }}}"><?php _e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
 
 
 
110
  <# } else { #>
111
- <# if ( ! _.isEmpty( data.hasNotice ) ) { #>
112
- <# if ( data.hasNotice['required_theme'] ) { #>
113
- <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" data-tip="<?php echo esc_attr( sprintf( __( 'Required %s theme must be activated to import this demo.', 'themegrill-demo-importer' ), '{{{ data.theme }}}' ) ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
114
- <# } else if ( data.hasNotice['required_plugins'] ) { #>
115
- <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" data-tip="<?php echo esc_attr( 'Required Plugin must be activated to import this demo.', 'themegrill-demo-importer' ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
116
- <# } #>
117
  <# } else { #>
118
- <?php
119
- /* translators: %s: Demo name */
120
- $aria_label = sprintf( _x( 'Import %s', 'demo', 'themegrill-demo-importer' ), '{{ data.name }}' );
121
- ?>
122
- <a class="button button-primary hide-if-no-js demo-import" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
 
 
 
 
 
 
 
 
 
123
  <# } #>
124
- <a class="button button-secondary demo-preview" target="_blank" href="{{{ data.actions.demo_url }}}"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
125
- <# } #>
126
  </div>
127
 
128
  <# if ( data.imported ) { #>
43
  printf( __( 'By %s', 'themegrill-demo-importer' ), $demo['author'] );
44
  ?></div>
45
 
46
+ <div class="theme-id-container">
47
+ <?php if ( $demo['active'] ) { ?>
48
+ <h2 class="theme-name" id="demo-name"><?php
49
+ /* translators: %s: Demo name */
50
+ printf( __( '<span>Imported:</span> %s', 'themegrill-demo-importer' ), esc_html( $demo['name'] ) );
51
+ ?></h2>
52
+ <?php } else { ?>
53
+ <h2 class="theme-name" id="<?php echo esc_attr( $demo['id'] . '-name' ); ?>"><?php echo esc_html( $demo['name'] ); ?></h2>
54
+ <?php } ?>
55
 
56
+ <div class="theme-actions">
57
+ <?php if ( $demo['active'] ) : ?>
58
+ <a class="button button-primary live-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['preview'] ); ?>"><?php _e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
 
 
 
 
 
 
 
59
  <?php else : ?>
60
+ <?php if ( ! empty( $demo['hasNotice'] ) ) : ?>
61
+ <?php if ( isset( $demo['hasNotice']['required_theme'] ) ) : ?>
62
+ <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" data-tip="<?php echo esc_attr( sprintf( __( 'Required %s theme must be activated to import this demo.', 'themegrill-demo-importer' ), $demo['theme'] ) ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
63
+ <?php elseif ( isset( $demo['hasNotice']['required_plugins'] ) ) : ?>
64
+ <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" data-tip="<?php echo esc_attr( 'Required Plugin must be activated to import this demo.', 'themegrill-demo-importer' ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
65
+ <?php endif; ?>
66
+ <?php else : ?>
67
+ <?php
68
+ /* translators: %s: Demo name */
69
+ $aria_label = sprintf( _x( 'Import %s', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
70
+ ?>
71
+ <a class="button button-primary hide-if-no-js import" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
72
+ <?php endif; ?>
73
+ <a class="button button-secondary demo-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['demo_url'] ); ?>"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
74
  <?php endif; ?>
75
+ </div>
 
76
  </div>
77
  </div>
78
  <?php endforeach; ?>
97
  printf( __( 'By %s', 'themegrill-demo-importer' ), '{{{ data.author }}}' );
98
  ?></div>
99
 
100
+ <div class="theme-id-container">
 
 
 
 
 
 
 
 
 
101
  <# if ( data.active ) { #>
102
+ <h2 class="theme-name" id="{{ data.id }}-name"><?php
103
+ /* translators: %s: Demo name */
104
+ printf( __( '<span>Imported:</span> %s', 'themegrill-demo-importer' ), '{{{ data.name }}}' );
105
+ ?></h2>
106
  <# } else { #>
107
+ <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
108
+ <# } #>
109
+
110
+ <div class="theme-actions">
111
+ <# if ( data.active ) { #>
112
+ <a class="button button-primary live-preview" target="_blank" href="{{{ data.actions.preview }}}"><?php _e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
113
  <# } else { #>
114
+ <# if ( ! _.isEmpty( data.hasNotice ) ) { #>
115
+ <# if ( data.hasNotice['required_theme'] ) { #>
116
+ <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" data-tip="<?php echo esc_attr( sprintf( __( 'Required %s theme must be activated to import this demo.', 'themegrill-demo-importer' ), '{{{ data.theme }}}' ) ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
117
+ <# } else if ( data.hasNotice['required_plugins'] ) { #>
118
+ <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" data-tip="<?php echo esc_attr( 'Required Plugin must be activated to import this demo.', 'themegrill-demo-importer' ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
119
+ <# } #>
120
+ <# } else { #>
121
+ <?php
122
+ /* translators: %s: Demo name */
123
+ $aria_label = sprintf( _x( 'Import %s', 'demo', 'themegrill-demo-importer' ), '{{ data.name }}' );
124
+ ?>
125
+ <a class="button button-primary hide-if-no-js demo-import" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
126
+ <# } #>
127
+ <a class="button button-secondary demo-preview" target="_blank" href="{{{ data.actions.demo_url }}}"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
128
  <# } #>
129
+ </div>
 
130
  </div>
131
 
132
  <# if ( data.imported ) { #>
includes/admin/views/html-admin-page-installer-preview.php CHANGED
@@ -29,23 +29,26 @@ if ( ! defined( 'ABSPATH' ) ) {
29
  /* translators: %s: Demo author name */
30
  printf( __( 'By %s', 'themegrill-demo-importer' ), $demo['author'] );
31
  ?></div>
32
- <h3 class="theme-name"><?php echo esc_html( $demo['name'] ); ?></h3>
33
 
34
- <div class="theme-actions">
35
- <?php if ( ! $demo['installed'] && ! $demo['actions']['pro_link'] ) : ?>
36
- <?php
37
- /* translators: %s: Demo name */
38
- $aria_label = sprintf( _x( 'Download %s', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
39
- ?>
40
- <a class="button button-primary demo-download" data-name="<?php echo esc_attr( $demo['name'] ); ?>" href="<?php echo esc_url( $demo['actions']['download_url'] ); ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Download', 'themegrill-demo-importer' ); ?></a>
41
- <?php elseif ( $demo['actions']['pro_link'] ) : ?>
42
- <?php
43
- /* translators: %s: Demo name */
44
- $aria_label = sprintf( _x( 'View %s Pro', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
45
- ?>
46
- <a class="button button-primary demo-premium" target="_blank" data-name="<?php echo esc_attr( $demo['name'] ); ?>" href="<?php echo esc_url( $demo['actions']['pro_link'] ); ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'View Pro', 'themegrill-demo-importer' ); ?></a>
47
- <?php endif; ?>
48
- <a class="button button-secondary demo-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['preview_url'] ); ?>"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
 
 
 
 
49
  </div>
50
 
51
  <?php if ( $demo['installed'] ) : ?>
29
  /* translators: %s: Demo author name */
30
  printf( __( 'By %s', 'themegrill-demo-importer' ), $demo['author'] );
31
  ?></div>
 
32
 
33
+ <div class="theme-id-container">
34
+ <h3 class="theme-name"><?php echo esc_html( $demo['name'] ); ?></h3>
35
+
36
+ <div class="theme-actions">
37
+ <?php if ( ! $demo['installed'] && ! $demo['actions']['pro_link'] ) : ?>
38
+ <?php
39
+ /* translators: %s: Demo name */
40
+ $aria_label = sprintf( _x( 'Download %s', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
41
+ ?>
42
+ <a class="button button-primary demo-download" data-name="<?php echo esc_attr( $demo['name'] ); ?>" href="<?php echo esc_url( $demo['actions']['download_url'] ); ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Download', 'themegrill-demo-importer' ); ?></a>
43
+ <?php elseif ( $demo['actions']['pro_link'] ) : ?>
44
+ <?php
45
+ /* translators: %s: Demo name */
46
+ $aria_label = sprintf( _x( 'View %s Pro', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
47
+ ?>
48
+ <a class="button button-primary demo-premium" target="_blank" data-name="<?php echo esc_attr( $demo['name'] ); ?>" href="<?php echo esc_url( $demo['actions']['pro_link'] ); ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'View Pro', 'themegrill-demo-importer' ); ?></a>
49
+ <?php endif; ?>
50
+ <a class="button button-secondary demo-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['preview_url'] ); ?>"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
51
+ </div>
52
  </div>
53
 
54
  <?php if ( $demo['installed'] ) : ?>
includes/admin/views/html-admin-page-installer-uploads.php CHANGED
@@ -26,34 +26,36 @@ if ( ! defined( 'ABSPATH' ) ) {
26
  printf( __( 'By %s', 'themegrill-demo-importer' ), $demo['author'] );
27
  ?></div>
28
 
29
- <?php if ( $demo['active'] ) { ?>
30
- <h2 class="theme-name" id="demo-name"><?php
31
- /* translators: %s: Demo name */
32
- printf( __( '<span>Imported:</span> %s', 'themegrill-demo-importer' ), esc_html( $demo['name'] ) );
33
- ?></h2>
34
- <?php } else { ?>
35
- <h2 class="theme-name" id="<?php echo esc_attr( $demo['id'] . '-name' ); ?>"><?php echo esc_html( $demo['name'] ); ?></h2>
36
- <?php } ?>
 
37
 
38
- <div class="theme-actions">
39
- <?php if ( $demo['active'] ) : ?>
40
- <a class="button button-primary live-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['preview'] ); ?>"><?php _e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
41
- <?php else : ?>
42
- <?php if ( ! empty( $demo['hasNotice'] ) ) : ?>
43
- <?php if ( isset( $demo['hasNotice']['required_theme'] ) ) : ?>
44
- <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" data-tip="<?php echo esc_attr( sprintf( __( 'Required %s theme must be activated to import this demo.', 'themegrill-demo-importer' ), $demo['theme'] ) ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
45
- <?php elseif ( isset( $demo['hasNotice']['required_plugins'] ) ) : ?>
46
- <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" data-tip="<?php echo esc_attr( 'Required Plugin must be activated to import this demo.', 'themegrill-demo-importer' ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
47
- <?php endif; ?>
48
  <?php else : ?>
49
- <?php
50
- /* translators: %s: Demo name */
51
- $aria_label = sprintf( _x( 'Import %s', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
52
- ?>
53
- <a class="button button-primary hide-if-no-js import" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
 
 
 
 
 
 
 
 
 
54
  <?php endif; ?>
55
- <a class="button button-secondary demo-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['demo_url'] ); ?>"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
56
- <?php endif; ?>
57
  </div>
58
  </div>
59
  <?php endforeach; ?>
26
  printf( __( 'By %s', 'themegrill-demo-importer' ), $demo['author'] );
27
  ?></div>
28
 
29
+ <div class="theme-id-container">
30
+ <?php if ( $demo['active'] ) { ?>
31
+ <h2 class="theme-name" id="demo-name"><?php
32
+ /* translators: %s: Demo name */
33
+ printf( __( '<span>Imported:</span> %s', 'themegrill-demo-importer' ), esc_html( $demo['name'] ) );
34
+ ?></h2>
35
+ <?php } else { ?>
36
+ <h2 class="theme-name" id="<?php echo esc_attr( $demo['id'] . '-name' ); ?>"><?php echo esc_html( $demo['name'] ); ?></h2>
37
+ <?php } ?>
38
 
39
+ <div class="theme-actions">
40
+ <?php if ( $demo['active'] ) : ?>
41
+ <a class="button button-primary live-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['preview'] ); ?>"><?php _e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
 
 
 
 
 
 
 
42
  <?php else : ?>
43
+ <?php if ( ! empty( $demo['hasNotice'] ) ) : ?>
44
+ <?php if ( isset( $demo['hasNotice']['required_theme'] ) ) : ?>
45
+ <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" data-tip="<?php echo esc_attr( sprintf( __( 'Required %s theme must be activated to import this demo.', 'themegrill-demo-importer' ), $demo['theme'] ) ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
46
+ <?php elseif ( isset( $demo['hasNotice']['required_plugins'] ) ) : ?>
47
+ <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" data-tip="<?php echo esc_attr( 'Required Plugin must be activated to import this demo.', 'themegrill-demo-importer' ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
48
+ <?php endif; ?>
49
+ <?php else : ?>
50
+ <?php
51
+ /* translators: %s: Demo name */
52
+ $aria_label = sprintf( _x( 'Import %s', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
53
+ ?>
54
+ <a class="button button-primary hide-if-no-js import" href="#" data-name=<?php echo esc_attr( $demo['name'] );?>" data-slug="<?php echo esc_attr( $demo['id'] ); ?>" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
55
+ <?php endif; ?>
56
+ <a class="button button-secondary demo-preview" target="_blank" href="<?php echo esc_url( $demo['actions']['demo_url'] ); ?>"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
57
  <?php endif; ?>
58
+ </div>
 
59
  </div>
60
  </div>
61
  <?php endforeach; ?>
includes/admin/views/html-admin-page-installer.php CHANGED
@@ -80,7 +80,9 @@ $demo_filter_links = apply_filters( 'themegrill_demo_importer_filter_links_array
80
  </div>
81
  <div class="welcome-panel-iframe-video">
82
  <div class="welcome-panel-iframe-video-inner">
83
- <iframe width="560" height="315" src="<?php echo esc_url( 'https://www.youtube.com/embed/rhiybsv3vUU?rel=0&amp;showinfo=0' ); ?>" allowtransparency="true" frameborder="0" scrolling="no" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen></iframe>
 
 
84
  </div>
85
  </div>
86
  </div>
@@ -111,34 +113,36 @@ $demo_filter_links = apply_filters( 'themegrill_demo_importer_filter_links_array
111
  printf( __( 'By %s', 'themegrill-demo-importer' ), '{{{ data.author }}}' );
112
  ?></div>
113
 
114
- <# if ( data.active ) { #>
115
- <h2 class="theme-name" id="{{ data.id }}-name"><?php
116
- /* translators: %s: Demo name */
117
- printf( __( '<span>Imported:</span> %s', 'themegrill-demo-importer' ), '{{{ data.name }}}' );
118
- ?></h2>
119
- <# } else { #>
120
- <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
121
- <# } #>
122
-
123
- <div class="theme-actions">
124
  <# if ( data.active ) { #>
125
- <a class="button button-primary live-preview" target="_blank" href="{{{ data.actions.preview }}}"><?php _e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
 
 
 
126
  <# } else { #>
127
- <# if ( ! _.isEmpty( data.hasNotice ) ) { #>
128
- <# if ( data.hasNotice['required_theme'] ) { #>
129
- <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" data-tip="<?php echo esc_attr( sprintf( __( 'Required %s theme must be activated to import this demo.', 'themegrill-demo-importer' ), '{{{ data.theme }}}' ) ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
130
- <# } else if ( data.hasNotice['required_plugins'] ) { #>
131
- <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" data-tip="<?php echo esc_attr( 'Required Plugin must be activated to import this demo.', 'themegrill-demo-importer' ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
132
- <# } #>
133
  <# } else { #>
134
- <?php
135
- /* translators: %s: Demo name */
136
- $aria_label = sprintf( _x( 'Import %s', 'demo', 'themegrill-demo-importer' ), '{{ data.name }}' );
137
- ?>
138
- <a class="button button-primary hide-if-no-js demo-import" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
 
 
 
 
 
 
 
 
 
139
  <# } #>
140
- <a class="button button-secondary demo-preview" target="_blank" href="{{{ data.actions.demo_url }}}"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
141
- <# } #>
142
  </div>
143
 
144
  <# if ( data.imported ) { #>
80
  </div>
81
  <div class="welcome-panel-iframe-video">
82
  <div class="welcome-panel-iframe-video-inner">
83
+ <a href="https://www.youtube.com/watch?v=rhiybsv3vUU" target="_blank" class="themegrill-demo-importer-guided-tour-embed" data-video_id="rhiybsv3vUU">
84
+ <img src="https://img.youtube.com/vi/rhiybsv3vUU/maxresdefault.jpg" width="560" height="315" />
85
+ </a>
86
  </div>
87
  </div>
88
  </div>
113
  printf( __( 'By %s', 'themegrill-demo-importer' ), '{{{ data.author }}}' );
114
  ?></div>
115
 
116
+ <div class="theme-id-container">
 
 
 
 
 
 
 
 
 
117
  <# if ( data.active ) { #>
118
+ <h2 class="theme-name" id="{{ data.id }}-name"><?php
119
+ /* translators: %s: Demo name */
120
+ printf( __( '<span>Imported:</span> %s', 'themegrill-demo-importer' ), '{{{ data.name }}}' );
121
+ ?></h2>
122
  <# } else { #>
123
+ <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
124
+ <# } #>
125
+
126
+ <div class="theme-actions">
127
+ <# if ( data.active ) { #>
128
+ <a class="button button-primary live-preview" target="_blank" href="{{{ data.actions.preview }}}"><?php _e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
129
  <# } else { #>
130
+ <# if ( ! _.isEmpty( data.hasNotice ) ) { #>
131
+ <# if ( data.hasNotice['required_theme'] ) { #>
132
+ <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" data-tip="<?php echo esc_attr( sprintf( __( 'Required %s theme must be activated to import this demo.', 'themegrill-demo-importer' ), '{{{ data.theme }}}' ) ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
133
+ <# } else if ( data.hasNotice['required_plugins'] ) { #>
134
+ <a class="button button-primary hide-if-no-js tips demo-import disabled" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" data-tip="<?php echo esc_attr( 'Required Plugin must be activated to import this demo.', 'themegrill-demo-importer' ); ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
135
+ <# } #>
136
+ <# } else { #>
137
+ <?php
138
+ /* translators: %s: Demo name */
139
+ $aria_label = sprintf( _x( 'Import %s', 'demo', 'themegrill-demo-importer' ), '{{ data.name }}' );
140
+ ?>
141
+ <a class="button button-primary hide-if-no-js demo-import" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Import', 'themegrill-demo-importer' ); ?></a>
142
+ <# } #>
143
+ <a class="button button-secondary demo-preview" target="_blank" href="{{{ data.actions.demo_url }}}"><?php _e( 'Preview', 'themegrill-demo-importer' ); ?></a>
144
  <# } #>
145
+ </div>
 
146
  </div>
147
 
148
  <# if ( data.imported ) { #>
includes/class-demo-importer.php CHANGED
@@ -61,8 +61,9 @@ class TG_Demo_Importer {
61
  add_action( 'wp_ajax_import-demo', array( $this, 'ajax_import_demo' ) );
62
  add_action( 'wp_ajax_footer-text-rated', array( $this, 'ajax_footer_text_rated' ) );
63
 
64
- // Update custom nav menu items and siteorigin panel data.
65
  add_action( 'themegrill_ajax_demo_imported', array( $this, 'update_nav_menu_items' ) );
 
66
  add_action( 'themegrill_ajax_demo_imported', array( $this, 'update_siteorigin_data' ), 10, 2 );
67
 
68
  // Update widget and customizer demo import settings data.
@@ -267,21 +268,22 @@ class TG_Demo_Importer {
267
  $video_map = array(
268
  'demo-importer' => array(
269
  'title' => __( 'Importing Demo', 'themegrill-demo-importer' ),
270
- 'id' => 'ctdquor9uh',
271
  ),
272
  );
273
 
274
  $video_key = empty( $_GET['page'] ) ? $screen->id : sanitize_title( $_GET['page'] );
275
 
276
  if ( ! tg_demo_installer_enabled() && isset( $video_map[ $video_key ] ) ) {
 
 
 
 
 
277
  $screen->add_help_tab( array(
278
- 'id' => 'themegrill_demo_importer_guided_tour_tab',
279
- 'title' => __( 'Guided Tour', 'themegrill-demo-importer' ),
280
- 'content' =>
281
- '<h2>' . __( 'Guided Tour', 'themegrill-demo-importer' ) . ' &ndash; ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' .
282
- '<script src="//fast.wistia.net/assets/external/E-v1.js" aync></script>
283
- <div class="wistia_embed wistia_async_' . esc_attr( $video_map[ $video_key ]['id'] ) . ' videoFoam=true seo=false" style="width:640px;height:360px;">&nbsp;</div>
284
- ',
285
  ) );
286
  }
287
 
@@ -958,11 +960,106 @@ class TG_Demo_Importer {
958
  return $data;
959
  }
960
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
961
  /**
962
  * Recursive function to address n level deep layoutbuilder data update.
963
- * @param array $panels_data
 
964
  * @param string $data_type
965
- * @param array $data_value
966
  * @return array
967
  */
968
  public function siteorigin_recursive_update( $panels_data, $data_type, $data_value ) {
@@ -1043,7 +1140,7 @@ class TG_Demo_Importer {
1043
  $page = get_page_by_title( $widget_value );
1044
 
1045
  if ( is_object( $page ) && $page->ID ) {
1046
- $widget_instance[ $widget_key ] = $page->ID;
1047
  }
1048
  }
1049
  }
@@ -1088,8 +1185,9 @@ class TG_Demo_Importer {
1088
 
1089
  /**
1090
  * Update siteorigin panel settings data.
1091
- * @param string $demo_id
1092
- * @param array $demo_data
 
1093
  */
1094
  public function update_siteorigin_data( $demo_id, $demo_data ) {
1095
  if ( ! empty( $demo_data['siteorigin_panels_data_update'] ) ) {
61
  add_action( 'wp_ajax_import-demo', array( $this, 'ajax_import_demo' ) );
62
  add_action( 'wp_ajax_footer-text-rated', array( $this, 'ajax_footer_text_rated' ) );
63
 
64
+ // Update custom nav menu items, elementor and siteorigin panel data.
65
  add_action( 'themegrill_ajax_demo_imported', array( $this, 'update_nav_menu_items' ) );
66
+ add_action( 'themegrill_ajax_demo_imported', array( $this, 'update_elementor_data' ), 10, 2 );
67
  add_action( 'themegrill_ajax_demo_imported', array( $this, 'update_siteorigin_data' ), 10, 2 );
68
 
69
  // Update widget and customizer demo import settings data.
268
  $video_map = array(
269
  'demo-importer' => array(
270
  'title' => __( 'Importing Demo', 'themegrill-demo-importer' ),
271
+ 'id' => 'Ou6_rgjw6is',
272
  ),
273
  );
274
 
275
  $video_key = empty( $_GET['page'] ) ? $screen->id : sanitize_title( $_GET['page'] );
276
 
277
  if ( ! tg_demo_installer_enabled() && isset( $video_map[ $video_key ] ) ) {
278
+ $embed_code = '
279
+ <a href="https://www.youtube.com/watch?v=' . esc_attr( $video_map[ $video_key ]['id'] ) . '" target="_blank" class="themegrill-demo-importer-guided-tour-embed" data-video_id="' . esc_attr( $video_map[ $video_key ]['id'] ) . '">
280
+ <img src="https://img.youtube.com/vi/' . esc_attr( $video_map[ $video_key ]['id'] ) . '/maxresdefault.jpg" width="560" height="315" />
281
+ </a>';
282
+
283
  $screen->add_help_tab( array(
284
+ 'id' => 'themegrill_demo_importer_guided_tour_tab',
285
+ 'title' => __( 'Guided Tour', 'themegrill-demo-importer' ),
286
+ 'content' => '<h2>' . __( 'Guided Tour', 'themegrill-demo-importer' ) . ' &ndash; ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' . $embed_code,
 
 
 
 
287
  ) );
288
  }
289
 
960
  return $data;
961
  }
962
 
963
+ /**
964
+ * Recursive function to address n level deep elementor data update.
965
+ *
966
+ * @param array $elementor_data
967
+ * @param string $data_type
968
+ * @param array $data_value
969
+ * @return array
970
+ */
971
+ public function elementor_recursive_update( $elementor_data, $data_type, $data_value ) {
972
+ $elementor_data = json_decode( stripslashes( $elementor_data ), true );
973
+
974
+ // Recursively update elementor data.
975
+ foreach ( $elementor_data as $element_id => $element_data ) {
976
+ if ( ! empty( $element_data['elements' ] ) ) {
977
+ foreach ( $element_data['elements'] as $el_key => $el_data ) {
978
+ if ( ! empty( $el_data['elements'] ) ) {
979
+ foreach ( $el_data['elements'] as $el_child_key => $child_el_data ) {
980
+ if ( 'widget' === $child_el_data['elType'] ) {
981
+ $settings = isset( $child_el_data['settings'] ) ? $child_el_data['settings'] : array();
982
+ $widgetType = isset( $child_el_data['widgetType'] ) ? $child_el_data['widgetType'] : '';
983
+
984
+ if ( isset( $settings['display_type'] ) && 'categories' === $settings['display_type'] ) {
985
+ $categories_selected = isset( $settings['categories_selected'] ) ? $settings['categories_selected'] : '';
986
+
987
+ if ( ! empty( $data_value['data_update'] ) ) {
988
+ foreach ( $data_value['data_update'] as $taxonomy => $taxonomy_data ) {
989
+ if ( ! taxonomy_exists( $taxonomy ) ) {
990
+ continue;
991
+ }
992
+
993
+ foreach ( $taxonomy_data as $widget_id => $widget_data ) {
994
+ if ( ! empty( $widget_data ) && $widget_id == $widgetType ) {
995
+ if ( is_array( $categories_selected ) ) {
996
+ foreach ( $categories_selected as $cat_key => $cat_id ) {
997
+ if ( isset( $widget_data[ $cat_id ] ) ) {
998
+ $term = get_term_by( 'name', $widget_data[ $cat_id ], $taxonomy );
999
+
1000
+ if ( is_object( $term ) && $term->term_id ) {
1001
+ $categories_selected[ $cat_key ] = $term->term_id;
1002
+ }
1003
+ }
1004
+ }
1005
+ } elseif ( isset( $widget_data[ $categories_selected ] ) ) {
1006
+ $term = get_term_by( 'name', $widget_data[ $categories_selected ], $taxonomy );
1007
+
1008
+ if ( is_object( $term ) && $term->term_id ) {
1009
+ $categories_selected = $term->term_id;
1010
+ }
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+ }
1016
+
1017
+ // Update the elementor data.
1018
+ $elementor_data[ $element_id ][ 'elements' ][ $el_key ]['elements'][ $el_child_key ]['settings']['categories_selected'] = $categories_selected;
1019
+ }
1020
+ }
1021
+ }
1022
+ }
1023
+ }
1024
+ }
1025
+ }
1026
+
1027
+ return wp_json_encode( $elementor_data );
1028
+ }
1029
+
1030
+ /**
1031
+ * Update elementor settings data.
1032
+ *
1033
+ * @param string $demo_id Demo ID.
1034
+ * @param array $demo_data Demo Data.
1035
+ */
1036
+ public function update_elementor_data( $demo_id, $demo_data ) {
1037
+ if ( ! empty( $demo_data['elementor_data_update'] ) ) {
1038
+ foreach ( $demo_data['elementor_data_update'] as $data_type => $data_value ) {
1039
+ if ( ! empty( $data_value['post_title'] ) ) {
1040
+ $page = get_page_by_title( $data_value['post_title'] );
1041
+
1042
+ if ( is_object( $page ) && $page->ID ) {
1043
+ $elementor_data = get_post_meta( $page->ID, '_elementor_data', true );
1044
+
1045
+ if ( ! empty( $elementor_data ) ) {
1046
+ $elementor_data = $this->elementor_recursive_update( $elementor_data, $data_type, $data_value );
1047
+ }
1048
+
1049
+ // Update elementor data.
1050
+ update_post_meta( $page->ID, '_elementor_data', $elementor_data );
1051
+ }
1052
+ }
1053
+ }
1054
+ }
1055
+ }
1056
+
1057
  /**
1058
  * Recursive function to address n level deep layoutbuilder data update.
1059
+ *
1060
+ * @param array $panels_data
1061
  * @param string $data_type
1062
+ * @param array $data_value
1063
  * @return array
1064
  */
1065
  public function siteorigin_recursive_update( $panels_data, $data_type, $data_value ) {
1140
  $page = get_page_by_title( $widget_value );
1141
 
1142
  if ( is_object( $page ) && $page->ID ) {
1143
+ $widget_instance[ $widget_key ] = $page->ID;
1144
  }
1145
  }
1146
  }
1185
 
1186
  /**
1187
  * Update siteorigin panel settings data.
1188
+ *
1189
+ * @param string $demo_id Demo ID.
1190
+ * @param array $demo_data Demo Data.
1191
  */
1192
  public function update_siteorigin_data( $demo_id, $demo_data ) {
1193
  if ( ! empty( $demo_data['siteorigin_panels_data_update'] ) ) {
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === ThemeGrill Demo Importer ===
2
  Contributors: ThemeGrill, shivapoudel
3
  Tags: themegrill, themes, demo, importer, download
4
- Requires at least: 4.0
5
- Tested up to: 4.8
6
- Stable tag: 1.4.0
7
  License: GPLv3 or later
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -21,7 +21,7 @@ Get free support at https://themegrill.com/support-forum/
21
 
22
  = Requirements =
23
 
24
- * WordPress 4.5 or later.
25
  * [ThemeGrill Official Themes](https://themegrill.com/wordpress-themes/).
26
 
27
  = Contribute =
@@ -67,13 +67,9 @@ Yes you can! Join in on our [GitHub repository](https://github.com/themegrill/th
67
 
68
  == Changelog ==
69
 
70
- = 1.4.0 - 20/07/2017 =
71
- * Feature - Plugin installer and activator mechinism.
72
- * Fix - Call to undefined function `preg_filter()`.
73
- * Dev - Improved file structure.
74
- * Dev - Introduced `tg_demo_installer_enabled()`.
75
- * Dev - Introduced `tg_demo_installer_preview()`.
76
- * Dev - Introduced `tg_demo_preview_screenshot_url()`.
77
 
78
  [See changelog for all versions](https://raw.githubusercontent.com/themegrill/themegrill-demo-importer/master/CHANGELOG.txt).
79
 
1
  === ThemeGrill Demo Importer ===
2
  Contributors: ThemeGrill, shivapoudel
3
  Tags: themegrill, themes, demo, importer, download
4
+ Requires at least: 4.7
5
+ Tested up to: 4.9
6
+ Stable tag: 1.4.1
7
  License: GPLv3 or later
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
21
 
22
  = Requirements =
23
 
24
+ * WordPress 4.7 or later.
25
  * [ThemeGrill Official Themes](https://themegrill.com/wordpress-themes/).
26
 
27
  = Contribute =
67
 
68
  == Changelog ==
69
 
70
+ = 1.4.1 - 08-12-2017 =
71
+ * Feature - Compatiable with Elementor page builder.
72
+ * Fix - Styling issue caused by missing `theme-id-container` container.
 
 
 
 
73
 
74
  [See changelog for all versions](https://raw.githubusercontent.com/themegrill/themegrill-demo-importer/master/CHANGELOG.txt).
75
 
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 your demo content, widgets and theme settings with one click for ThemeGrill official themes.
6
- * Version: 1.4.0
7
  * Author: ThemeGrill
8
  * Author URI: https://themegrill.com
9
  * License: GPLv3 or later
@@ -26,7 +26,7 @@ final class ThemeGrill_Demo_Importer {
26
  * Plugin version.
27
  * @var string
28
  */
29
- public $version = '1.4.0';
30
 
31
  /**
32
  * Instance of this class.
@@ -76,7 +76,7 @@ final class ThemeGrill_Demo_Importer {
76
  * Define TGDM Constants.
77
  */
78
  private function define_constants() {
79
- $upload_dir = wp_upload_dir();
80
 
81
  $this->define( 'TGDM_PLUGIN_FILE', __FILE__ );
82
  $this->define( 'TGDM_ABSPATH', dirname( TGDM_PLUGIN_FILE ) . '/' );
3
  * Plugin Name: ThemeGrill Demo Importer
4
  * Plugin URI: https://themegrill.com/demo-importer/
5
  * Description: Import your demo content, widgets and theme settings with one click for ThemeGrill official themes.
6
+ * Version: 1.4.1
7
  * Author: ThemeGrill
8
  * Author URI: https://themegrill.com
9
  * License: GPLv3 or later
26
  * Plugin version.
27
  * @var string
28
  */
29
+ public $version = '1.4.1';
30
 
31
  /**
32
  * Instance of this class.
76
  * Define TGDM Constants.
77
  */
78
  private function define_constants() {
79
+ $upload_dir = wp_upload_dir( null, false );
80
 
81
  $this->define( 'TGDM_PLUGIN_FILE', __FILE__ );
82
  $this->define( 'TGDM_ABSPATH', dirname( TGDM_PLUGIN_FILE ) . '/' );