Starter Templates by Kadence WP - Version 1.2.13

Version Description

  • Update: Support for some third party plugins.
  • Update: Show 5.9 support.
  • Update: Cleanup some code.
Download this release

Release Info

Developer britner
Plugin Icon 128x128 Starter Templates by Kadence WP
Version 1.2.13
Comparing to
See all releases

Code changes from version 1.2.12 to 1.2.13

class-kadence-starter-templates.php CHANGED
@@ -189,7 +189,7 @@ class Starter_Templates {
189
  define( 'KADENCE_STARTER_TEMPLATES_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
190
  }
191
  if ( ! defined( 'KADENCE_STARTER_TEMPLATES_VERSION' ) ) {
192
- define( 'KADENCE_STARTER_TEMPLATES_VERSION', '1.2.12' );
193
  }
194
  }
195
 
@@ -222,6 +222,9 @@ class Starter_Templates {
222
  if ( class_exists( 'woocommerce' ) && isset( $selected_import['ecommerce'] ) && $selected_import['ecommerce'] ) {
223
  $this->import_demo_woocommerce();
224
  }
 
 
 
225
  if ( function_exists( 'tribe_update_option' ) ) {
226
  tribe_update_option( 'toggle_blocks_editor', true );
227
  }
@@ -501,6 +504,27 @@ class Starter_Templates {
501
  }
502
  }
503
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
  /**
505
  * Kadence Import function.
506
  */
@@ -684,6 +708,16 @@ class Starter_Templates {
684
  'state' => Plugin_Check::active_check( 'event-tickets/event-tickets.php' ),
685
  'src' => 'repo',
686
  ),
 
 
 
 
 
 
 
 
 
 
687
  );
688
  $palettes = array(
689
  array(
@@ -1092,6 +1126,20 @@ class Starter_Templates {
1092
  'path' => 'event-tickets/event-tickets.php',
1093
  'src' => 'repo',
1094
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1095
  );
1096
  $plugin_information = array();
1097
  foreach( $info['plugins'] as $plugin ) {
@@ -1168,8 +1216,8 @@ class Starter_Templates {
1168
  public function install_plugins_ajax_callback() {
1169
  Helpers::verify_ajax_call();
1170
 
1171
- if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['selected'] ) || ! isset( $_POST['builder'] ) ) {
1172
- wp_send_json_error( 'Permissions Issue' );
1173
  }
1174
  // Get selected file index or set it to 0.
1175
  $selected_index = empty( $_POST['selected'] ) ? '' : sanitize_text_field( $_POST['selected'] );
@@ -1307,6 +1355,20 @@ class Starter_Templates {
1307
  'path' => 'event-tickets/event-tickets.php',
1308
  'src' => 'repo',
1309
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1310
  );
1311
  foreach( $info['plugins'] as $plugin ) {
1312
  $path = false;
@@ -1355,6 +1417,9 @@ class Starter_Templates {
1355
  }
1356
  }
1357
  if ( 'notactive' === $state && 'repo' === $src ) {
 
 
 
1358
  $api = plugins_api(
1359
  'plugin_information',
1360
  array(
@@ -1387,6 +1452,9 @@ class Starter_Templates {
1387
  if ( 'give' === $base ) {
1388
  add_option( 'give_install_pages_created', 1, '', false );
1389
  }
 
 
 
1390
  $activate = activate_plugin( $path, '', false, $silent );
1391
  if ( is_wp_error( $activate ) ) {
1392
  $install = false;
@@ -1398,12 +1466,18 @@ class Starter_Templates {
1398
  $install = false;
1399
  }
1400
  } elseif ( 'installed' === $state ) {
 
 
 
1401
  //$silent = false;
1402
  $silent = ( 'give' === $base || 'elementor' === $base ? false : true );
1403
  if ( 'give' === $base ) {
1404
  // Make sure give doesn't add it's pages, prevents having two sets.
1405
  update_option( 'give_install_pages_created', 1, '', false );
1406
  }
 
 
 
1407
  $activate = activate_plugin( $path, '', false, $silent );
1408
  if ( is_wp_error( $activate ) ) {
1409
  $install = false;
189
  define( 'KADENCE_STARTER_TEMPLATES_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
190
  }
191
  if ( ! defined( 'KADENCE_STARTER_TEMPLATES_VERSION' ) ) {
192
+ define( 'KADENCE_STARTER_TEMPLATES_VERSION', '1.2.13' );
193
  }
194
  }
195
 
222
  if ( class_exists( 'woocommerce' ) && isset( $selected_import['ecommerce'] ) && $selected_import['ecommerce'] ) {
223
  $this->import_demo_woocommerce();
224
  }
225
+ if ( class_exists( 'Restrict_Content_Pro' ) && isset( $selected_import['plugins'] ) && is_array( $selected_import['plugins'] ) && in_array( 'restrict-content', $selected_import['plugins'] ) ) {
226
+ $this->import_demo_restrict_content();
227
+ }
228
  if ( function_exists( 'tribe_update_option' ) ) {
229
  tribe_update_option( 'toggle_blocks_editor', true );
230
  }
504
  }
505
  }
506
  }
507
+ /**
508
+ * Kadence Import function.
509
+ */
510
+ public function import_demo_restrict_content() {
511
+ $rcp_options = get_option( 'rcp_settings' );
512
+ $rcppages = array(
513
+ 'registration_page' => 'Register',
514
+ 'redirect' => 'Welcome',
515
+ 'account_page' => 'Your Membership',
516
+ 'edit_profile' => 'Edit Your Profile',
517
+ 'update_card' => 'Update Billing Card',
518
+ );
519
+ foreach ( $rcppages as $rcp_page_name => $rcp_page_title ) {
520
+ $rcppage = get_page_by_title( $rcp_page_title );
521
+ if ( isset( $rcppage ) && $rcppage->ID ) {
522
+ $rcp_options[ $rcp_page_name ] = $rcppage->ID;
523
+ }
524
+ }
525
+
526
+ update_option( 'rcp_settings', $rcp_options );
527
+ }
528
  /**
529
  * Kadence Import function.
530
  */
708
  'state' => Plugin_Check::active_check( 'event-tickets/event-tickets.php' ),
709
  'src' => 'repo',
710
  ),
711
+ 'orderable' => array(
712
+ 'title' => 'Orderable',
713
+ 'state' => Plugin_Check::active_check( 'orderable/orderable.php' ),
714
+ 'src' => 'repo',
715
+ ),
716
+ 'restrict-content' => array(
717
+ 'title' => 'Restrict Content',
718
+ 'state' => Plugin_Check::active_check( 'restrict-content/restrictcontent.php' ),
719
+ 'src' => 'repo',
720
+ ),
721
  );
722
  $palettes = array(
723
  array(
1126
  'path' => 'event-tickets/event-tickets.php',
1127
  'src' => 'repo',
1128
  ),
1129
+ 'orderable' => array(
1130
+ 'title' => 'Orderable',
1131
+ 'base' => 'orderable',
1132
+ 'slug' => 'orderable',
1133
+ 'path' => 'orderable/orderable.php',
1134
+ 'src' => 'repo',
1135
+ ),
1136
+ 'restrict-content' => array(
1137
+ 'title' => 'Restrict Content',
1138
+ 'base' => 'restrict-content',
1139
+ 'slug' => 'restrictcontent',
1140
+ 'path' => 'restrict-content/restrictcontent.php',
1141
+ 'src' => 'repo',
1142
+ ),
1143
  );
1144
  $plugin_information = array();
1145
  foreach( $info['plugins'] as $plugin ) {
1216
  public function install_plugins_ajax_callback() {
1217
  Helpers::verify_ajax_call();
1218
 
1219
+ if ( ! isset( $_POST['selected'] ) || ! isset( $_POST['builder'] ) ) {
1220
+ wp_send_json_error( 'Missing Information' );
1221
  }
1222
  // Get selected file index or set it to 0.
1223
  $selected_index = empty( $_POST['selected'] ) ? '' : sanitize_text_field( $_POST['selected'] );
1355
  'path' => 'event-tickets/event-tickets.php',
1356
  'src' => 'repo',
1357
  ),
1358
+ 'orderable' => array(
1359
+ 'title' => 'Orderable',
1360
+ 'base' => 'orderable',
1361
+ 'slug' => 'orderable',
1362
+ 'path' => 'orderable/orderable.php',
1363
+ 'src' => 'repo',
1364
+ ),
1365
+ 'restrict-content' => array(
1366
+ 'title' => 'Restrict Content',
1367
+ 'base' => 'restrict-content',
1368
+ 'slug' => 'restrictcontent',
1369
+ 'path' => 'restrict-content/restrictcontent.php',
1370
+ 'src' => 'repo',
1371
+ ),
1372
  );
1373
  foreach( $info['plugins'] as $plugin ) {
1374
  $path = false;
1417
  }
1418
  }
1419
  if ( 'notactive' === $state && 'repo' === $src ) {
1420
+ if ( ! current_user_can( 'install_plugins' ) ) {
1421
+ wp_send_json_error( 'Permissions Issue' );
1422
+ }
1423
  $api = plugins_api(
1424
  'plugin_information',
1425
  array(
1452
  if ( 'give' === $base ) {
1453
  add_option( 'give_install_pages_created', 1, '', false );
1454
  }
1455
+ if ( 'restrict-content' === $base ) {
1456
+ update_option( 'rcp_install_pages_created', current_time( 'mysql' ) );
1457
+ }
1458
  $activate = activate_plugin( $path, '', false, $silent );
1459
  if ( is_wp_error( $activate ) ) {
1460
  $install = false;
1466
  $install = false;
1467
  }
1468
  } elseif ( 'installed' === $state ) {
1469
+ if ( ! current_user_can( 'install_plugins' ) ) {
1470
+ wp_send_json_error( 'Permissions Issue' );
1471
+ }
1472
  //$silent = false;
1473
  $silent = ( 'give' === $base || 'elementor' === $base ? false : true );
1474
  if ( 'give' === $base ) {
1475
  // Make sure give doesn't add it's pages, prevents having two sets.
1476
  update_option( 'give_install_pages_created', 1, '', false );
1477
  }
1478
+ if ( 'restrict-content' === $base ) {
1479
+ update_option( 'rcp_install_pages_created', current_time( 'mysql' ) );
1480
+ }
1481
  $activate = activate_plugin( $path, '', false, $silent );
1482
  if ( is_wp_error( $activate ) ) {
1483
  $install = false;
inc/class-importer.php CHANGED
@@ -294,9 +294,6 @@ class Importer {
294
  $slash = str_replace( 'n ', '\n ', $block['attrs']['kadenceBlockCSS'] );
295
  $slash = str_replace( ';n', ';\n', $slash );
296
  $slash = str_replace( 'nselector', '\nselector', $slash );
297
- // $update = str_replace( 'n ', '\\\n ', $block['attrs']['kadenceBlockCSS'] );
298
- // $update = str_replace( ';n', ';\\\n', $update );
299
- // $update = str_replace( 'nselector', '\\\nselector', $update );
300
  $update = str_replace( 'n ', '', $block['attrs']['kadenceBlockCSS'] );
301
  $update = str_replace( ';n', ';', $update );
302
  $update = str_replace( 'nselector', 'selector', $update );
@@ -322,8 +319,6 @@ class Importer {
322
  $post_content = parse_blocks( $data['post_content'] );
323
  foreach ( $post_content as $block ) {
324
  if ( ! empty( $block['attrs']['kadenceBlockCSS'] ) ) {
325
- //error_log( print_r( $data['post_content'], true ) );
326
- //error_log( print_r( $block['attrs']['kadenceBlockCSS'], true ) );
327
  $slash = str_replace( 'n ', '\n ', $block['attrs']['kadenceBlockCSS'] );
328
  $slash = str_replace( ';n', ';\n', $slash );
329
  $slash = str_replace( '; n', '; \n', $slash );
@@ -332,9 +327,6 @@ class Importer {
332
  $update = str_replace( ';n', ';\\\n', $update );
333
  $update = str_replace( '; n', '; \\\n', $update );
334
  $update = str_replace( 'nselector', '\\\nselector', $update );
335
- // $update = str_replace( 'n ', '', $block['attrs']['kadenceBlockCSS'] );
336
- // $update = str_replace( ';n', ';', $update );
337
- // $update = str_replace( 'nselector', 'selector', $update );
338
  $data['post_content'] = str_replace( $slash, $update, $data['post_content'] );
339
  $data['post_content'] = str_replace( $block['attrs']['kadenceBlockCSS'], $update, $data['post_content'] );
340
  }
@@ -361,12 +353,6 @@ class Importer {
361
  $content = parse_blocks( $data['post_content'] );
362
  foreach ( $content as $indexkey => $block ) {
363
  if ( ! empty( $block['attrs']['kadenceBlockCSS'] ) ) {
364
- //stripslashes( $data['post_content'] )
365
- // $slash = str_replace( '{n ', '{\n ', $block['attrs']['kadenceBlockCSS'] );
366
- // $slash = str_replace( ';n', ';\n', $slash );
367
- // $slash = str_replace( '; n', '; \n', $slash );
368
- // $slash = str_replace( '}n', '}\n', $slash );
369
- // $slash = str_replace( 'nselector', '\nselector', $slash );
370
  $slash = wp_json_encode( $block['attrs']['kadenceBlockCSS'] );
371
  $update = str_replace( '\n', '\\\n', $slash );
372
  $slash = str_replace( '--global-palette', '\u002d\u002dglobal-palette', $slash );
@@ -374,20 +360,6 @@ class Importer {
374
  $data['post_content'] = str_replace( $slash, $update, $data['post_content'] );
375
  }
376
  }
377
- // if ( 'kadence/testimonials' === $block['blockName'] ) {
378
- // if ( isset( $block['attrs'] ) && is_array( $block['attrs'] ) ) {
379
- // if ( ! empty( $block['attrs']['testimonials'] ) && is_array( $block['attrs']['testimonials'] ) ) {
380
- // foreach ( $block['attrs']['testimonials'] as $test_key => $test_content ) {
381
- // if ( ! empty( $test_content['title'] ) ) {
382
- // $test_slash = wp_json_encode( $test_content['title'] );
383
- // $test_update = str_replace( '\"', '\\"', $test_slash );
384
- // $test_update = str_replace( '<\/', '<\\/', $test_update );
385
- // $data['post_content'] = str_replace( $test_slash, $test_update, $data['post_content'] );
386
- // }
387
- // }
388
- // }
389
- // }
390
- // }
391
  if ( isset( $block['innerBlocks'] ) && ! empty( $block['innerBlocks'] ) && is_array( $block['innerBlocks'] ) ) {
392
  $data['post_content'] = $this->blocks_cycle_through( $data['post_content'], $block['innerBlocks'] );
393
  }
@@ -403,21 +375,6 @@ class Importer {
403
  public function blocks_cycle_through( $post_content, $inner_blocks ) {
404
  foreach ( $inner_blocks as $in_indexkey => $inner_block ) {
405
  if ( ! empty( $inner_block['attrs']['kadenceBlockCSS'] ) ) {
406
- // $slash = str_replace( '{n ', '{\n ', $inner_block['attrs']['kadenceBlockCSS'] );
407
- // $slash = str_replace( ';n', ';\n', $slash );
408
- // $slash = str_replace( '; n', '; \n', $slash );
409
- // $slash = str_replace( 'nselector', '\nselector', $slash );
410
- // $update = str_replace( '{\n ', '{\\\n ', $inner_block['attrs']['kadenceBlockCSS'] );
411
- // $update = str_replace( ';\n', ';\\\n', $update );
412
- // $update = str_replace( '; \n', '; \\\n', $update );
413
- // $update = str_replace( '\nselector', '\\\nselector', $update );
414
- // $update = str_replace( '{n ', '{\\\n ', $update );
415
- // $update = str_replace( ';n', ';\\\n', $update );
416
- // $update = str_replace( '; n', '; \\\n', $update );
417
- // $update = str_replace( 'nselector', '\\\nselector', $update );
418
- // $update = str_replace( 'n ', '', $block['attrs']['kadenceBlockCSS'] );
419
- // $update = str_replace( ';n', ';', $update );
420
- // $update = str_replace( 'nselector', 'selector', $update );
421
  $slash = wp_json_encode( $inner_block['attrs']['kadenceBlockCSS'] );
422
  $update = str_replace( '\n', ' \\\n', $slash );
423
  $slash = str_replace( '--global-palette', '\u002d\u002dglobal-palette', $slash );
@@ -425,20 +382,6 @@ class Importer {
425
  $post_content = str_replace( $slash, $update, $post_content );
426
  }
427
  }
428
- // if ( 'kadence/testimonials' === $inner_block['blockName'] ) {
429
- // if ( isset( $inner_block['attrs'] ) && is_array( $inner_block['attrs'] ) ) {
430
- // if ( ! empty( $inner_block['attrs']['testimonials'] ) && is_array( $inner_block['attrs']['testimonials'] ) ) {
431
- // foreach ( $inner_block['attrs']['testimonials'] as $test_key => $test_content ) {
432
- // if ( ! empty( $test_content['title'] ) ) {
433
- // $test_slash = wp_json_encode( $test_content['title'] );
434
- // $test_update = str_replace( '\"', '\\"', $test_slash );
435
- // $test_update = str_replace( '<\/', '<\\/', $test_update );
436
- // $post_content = str_replace( $test_slash, $test_update, $post_content );
437
- // }
438
- // }
439
- // }
440
- // }
441
- // }
442
  if ( isset( $inner_block['innerBlocks'] ) && ! empty( $inner_block['innerBlocks'] ) && is_array( $inner_block['innerBlocks'] ) ) {
443
  $post_content = $this->blocks_cycle_through( $post_content, $inner_block['innerBlocks'] );
444
  }
@@ -469,7 +412,6 @@ class Importer {
469
  foreach ( $images as $image ) {
470
  if ( ! empty( $image['url'] ) ) {
471
  $this->replace_image_urls( $meta_item['value'] );
472
- //error_log( print_r( $images, true ) );
473
  }
474
  }
475
  }
294
  $slash = str_replace( 'n ', '\n ', $block['attrs']['kadenceBlockCSS'] );
295
  $slash = str_replace( ';n', ';\n', $slash );
296
  $slash = str_replace( 'nselector', '\nselector', $slash );
 
 
 
297
  $update = str_replace( 'n ', '', $block['attrs']['kadenceBlockCSS'] );
298
  $update = str_replace( ';n', ';', $update );
299
  $update = str_replace( 'nselector', 'selector', $update );
319
  $post_content = parse_blocks( $data['post_content'] );
320
  foreach ( $post_content as $block ) {
321
  if ( ! empty( $block['attrs']['kadenceBlockCSS'] ) ) {
 
 
322
  $slash = str_replace( 'n ', '\n ', $block['attrs']['kadenceBlockCSS'] );
323
  $slash = str_replace( ';n', ';\n', $slash );
324
  $slash = str_replace( '; n', '; \n', $slash );
327
  $update = str_replace( ';n', ';\\\n', $update );
328
  $update = str_replace( '; n', '; \\\n', $update );
329
  $update = str_replace( 'nselector', '\\\nselector', $update );
 
 
 
330
  $data['post_content'] = str_replace( $slash, $update, $data['post_content'] );
331
  $data['post_content'] = str_replace( $block['attrs']['kadenceBlockCSS'], $update, $data['post_content'] );
332
  }
353
  $content = parse_blocks( $data['post_content'] );
354
  foreach ( $content as $indexkey => $block ) {
355
  if ( ! empty( $block['attrs']['kadenceBlockCSS'] ) ) {
 
 
 
 
 
 
356
  $slash = wp_json_encode( $block['attrs']['kadenceBlockCSS'] );
357
  $update = str_replace( '\n', '\\\n', $slash );
358
  $slash = str_replace( '--global-palette', '\u002d\u002dglobal-palette', $slash );
360
  $data['post_content'] = str_replace( $slash, $update, $data['post_content'] );
361
  }
362
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  if ( isset( $block['innerBlocks'] ) && ! empty( $block['innerBlocks'] ) && is_array( $block['innerBlocks'] ) ) {
364
  $data['post_content'] = $this->blocks_cycle_through( $data['post_content'], $block['innerBlocks'] );
365
  }
375
  public function blocks_cycle_through( $post_content, $inner_blocks ) {
376
  foreach ( $inner_blocks as $in_indexkey => $inner_block ) {
377
  if ( ! empty( $inner_block['attrs']['kadenceBlockCSS'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  $slash = wp_json_encode( $inner_block['attrs']['kadenceBlockCSS'] );
379
  $update = str_replace( '\n', ' \\\n', $slash );
380
  $slash = str_replace( '--global-palette', '\u002d\u002dglobal-palette', $slash );
382
  $post_content = str_replace( $slash, $update, $post_content );
383
  }
384
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  if ( isset( $inner_block['innerBlocks'] ) && ! empty( $inner_block['innerBlocks'] ) && is_array( $inner_block['innerBlocks'] ) ) {
386
  $post_content = $this->blocks_cycle_through( $post_content, $inner_block['innerBlocks'] );
387
  }
412
  foreach ( $images as $image ) {
413
  if ( ! empty( $image['url'] ) ) {
414
  $this->replace_image_urls( $meta_item['value'] );
 
415
  }
416
  }
417
  }
kadence-starter-templates.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Kadence Starter Templates
4
  * Description: Choose the prebuilt website and click to import.
5
- * Version: 1.2.12
6
  * Author: Kadence WP
7
  * Author URI: https://kadencewp.com/
8
  * License: GPLv2 or later
2
  /**
3
  * Plugin Name: Kadence Starter Templates
4
  * Description: Choose the prebuilt website and click to import.
5
+ * Version: 1.2.13
6
  * Author: Kadence WP
7
  * Author URI: https://kadencewp.com/
8
  * License: GPLv2 or later
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: britner
3
  Tags: templates, gutenberg
4
  Requires at least: 5.0
5
- Tested up to: 5.8
6
- Stable tag: 1.2.12
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -108,6 +108,11 @@ Absolutely not.
108
 
109
  == Changelog ==
110
 
 
 
 
 
 
111
  = 1.2.12 =
112
  * Fix: Issue with initial load.
113
 
2
  Contributors: britner
3
  Tags: templates, gutenberg
4
  Requires at least: 5.0
5
+ Tested up to: 5.9
6
+ Stable tag: 1.2.13
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
108
 
109
  == Changelog ==
110
 
111
+ = 1.2.13 =
112
+ * Update: Support for some third party plugins.
113
+ * Update: Show 5.9 support.
114
+ * Update: Cleanup some code.
115
+
116
  = 1.2.12 =
117
  * Fix: Issue with initial load.
118