Starter Templates by Kadence WP - Version 1.2.9

Version Description

  • Fix: Some import issues, as well as some meta saving issues.
Download this release

Release Info

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

Code changes from version 1.2.8 to 1.2.9

class-kadence-starter-templates.php CHANGED
@@ -172,6 +172,8 @@ class Starter_Templates {
172
  add_action( 'kadence-starter-templates/after_import', array( $this, 'kadence_elementor_after_import' ), 20, 3 );
173
 
174
  add_filter( 'plugin_action_links_kadence-starter-templates/kadence-starter-templates.php', array( $this, 'add_settings_link' ) );
 
 
175
  }
176
  /**
177
  * Set plugin constants.
@@ -187,7 +189,7 @@ class Starter_Templates {
187
  define( 'KADENCE_STARTER_TEMPLATES_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
188
  }
189
  if ( ! defined( 'KADENCE_STARTER_TEMPLATES_VERSION' ) ) {
190
- define( 'KADENCE_STARTER_TEMPLATES_VERSION', '1.2.8' );
191
  }
192
  }
193
 
@@ -2348,5 +2350,38 @@ class Starter_Templates {
2348
  // If we got this far, we need to dismiss the notice.
2349
  update_option( 'kadence_starter_templates_dismiss_upsell', true, false );
2350
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2351
  }
2352
  Starter_Templates::get_instance();
172
  add_action( 'kadence-starter-templates/after_import', array( $this, 'kadence_elementor_after_import' ), 20, 3 );
173
 
174
  add_filter( 'plugin_action_links_kadence-starter-templates/kadence-starter-templates.php', array( $this, 'add_settings_link' ) );
175
+
176
+ add_filter( 'update_post_metadata', array( $this, 'forcibly_fix_issue_with_metadata' ), 15, 5 );
177
  }
178
  /**
179
  * Set plugin constants.
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.9' );
193
  }
194
  }
195
 
2350
  // If we got this far, we need to dismiss the notice.
2351
  update_option( 'kadence_starter_templates_dismiss_upsell', true, false );
2352
  }
2353
+ /**
2354
+ * Add a little css for submenu items.
2355
+ * @param string $forward null, unless we should overide.
2356
+ * @param int $object_id ID of the object metadata is for.
2357
+ * @param string $meta_key Metadata key.
2358
+ * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
2359
+ * @param mixed $prev_value Optional. Previous value to check before updating.
2360
+ */
2361
+ public function forcibly_fix_issue_with_metadata( $forward, $object_id, $meta_key, $meta_value, $prev_value ) {
2362
+ $meta_keys_to_allow = [
2363
+ 'kt_blocks_editor_width' => true,
2364
+ '_kad_post_transparent' => true,
2365
+ '_kad_post_title' => true,
2366
+ '_kad_post_layout' => true,
2367
+ '_kad_post_content_style' => true,
2368
+ '_kad_post_vertical_padding' => true,
2369
+ '_kad_post_sidebar_id' => true,
2370
+ '_kad_post_feature' => true,
2371
+ '_kad_post_feature_position' => true,
2372
+ '_kad_post_header' => true,
2373
+ '_kad_post_footer' => true,
2374
+ ];
2375
+ if ( isset( $meta_keys_to_allow[$meta_key] ) ) {
2376
+ $old_value = get_metadata( 'post', $object_id, $meta_key );
2377
+ if ( is_array( $old_value ) && 1 < count( $old_value ) ) {
2378
+ // Data is an array which shouldn't be the case so we need to clean that up.
2379
+ delete_metadata( 'post', $object_id, $meta_key );
2380
+ add_metadata( 'post', $object_id, $meta_key, $meta_value );
2381
+ return true;
2382
+ }
2383
+ }
2384
+ return $forward;
2385
+ }
2386
  }
2387
  Starter_Templates::get_instance();
inc/class-importer.php CHANGED
@@ -239,11 +239,7 @@ class Importer {
239
  * @param array $terms Raw term data, already processed.
240
  */
241
  public function process_internal_links( $data, $meta, $comments, $terms ) {
242
- $meta_data = wp_list_pluck( $meta, 'key' );
243
- if ( in_array( '_elementor_data', $meta_data, true ) ) {
244
- return $data;
245
- }
246
- if ( ! empty( $data['post_content'] ) ) {
247
  $edit_content = stripslashes( $data['post_content'] );
248
  // Extract all links.
249
  preg_match_all( '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $edit_content, $match );
@@ -360,12 +356,8 @@ class Importer {
360
  * @param array $comments Raw comment data, already processed by {@see process_comments}.
361
  * @param array $terms Raw term data, already processed.
362
  */
363
- public function process_kadence_block_css( $data, $meta, $comments, $terms ) {
364
- $meta_data = wp_list_pluck( $meta, 'key' );
365
- if ( in_array( '_elementor_data', $meta_data, true ) ) {
366
- return $data;
367
- }
368
- if ( ! empty( $data['post_content'] ) ) {
369
  $content = parse_blocks( $data['post_content'] );
370
  foreach ( $content as $indexkey => $block ) {
371
  if ( ! empty( $block['attrs']['kadenceBlockCSS'] ) ) {
239
  * @param array $terms Raw term data, already processed.
240
  */
241
  public function process_internal_links( $data, $meta, $comments, $terms ) {
242
+ if ( ! empty( $data['post_content'] ) && has_blocks( $data['post_content'] ) ) {
 
 
 
 
243
  $edit_content = stripslashes( $data['post_content'] );
244
  // Extract all links.
245
  preg_match_all( '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $edit_content, $match );
356
  * @param array $comments Raw comment data, already processed by {@see process_comments}.
357
  * @param array $terms Raw term data, already processed.
358
  */
359
+ public function process_kadence_block_css( $data, $meta, $comments, $terms ) {
360
+ if ( ! empty( $data['post_content'] ) && has_blocks( $data['post_content'] ) ) {
 
 
 
 
361
  $content = parse_blocks( $data['post_content'] );
362
  foreach ( $content as $indexkey => $block ) {
363
  if ( ! empty( $block['attrs']['kadenceBlockCSS'] ) ) {
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.8
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.9
6
  * Author: Kadence WP
7
  * Author URI: https://kadencewp.com/
8
  * License: GPLv2 or later
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: britner
3
  Tags: templates, gutenberg
4
  Requires at least: 5.0
5
  Tested up to: 5.8
6
- Stable tag: 1.2.7
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,9 @@ Absolutely not.
108
 
109
  == Changelog ==
110
 
 
 
 
111
  = 1.2.8 =
112
  * Fix: Some import issues.
113
 
3
  Tags: templates, gutenberg
4
  Requires at least: 5.0
5
  Tested up to: 5.8
6
+ Stable tag: 1.2.9
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.9 =
112
+ * Fix: Some import issues, as well as some meta saving issues.
113
+
114
  = 1.2.8 =
115
  * Fix: Some import issues.
116