PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.7.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.7.0
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
← All changes | includes/admin/class-steps.php +57 -6 1.7.92.7.0 View file →
@@ -60,8 +60,10 @@
60 60 add_action( 'wp_ajax_sellkit_steps_get_coupons', [ $this, 'get_coupons' ] );
61 61 add_action( 'wp_loaded', [ $this, 'sellkit_steps_flush_rules' ] );
62 62 add_action( 'sellkit_after_toggle_status_sellkit-funnels', [ $this, 'update_steps_post_status' ], 10, 2 );
63 63 add_action( 'sellkit_funnels_after_delete_posts_sellkit-funnels', [ $this, 'remove_steps_pages' ], 10, 1 );
64 +
65 + add_action( 'wp_loaded', [ $this, 'sellkit_set_sellkit_translation_mode' ] );
64 66 }
65 67
66 68 /**
67 69 * Removes steps pages.
@@ -77,9 +79,11 @@
77 79 return;
78 80 }
79 81
80 82 foreach ( $nodes[0] as $node ) {
81 - wp_delete_post( $node['page_id'] );
83 + if ( isset( $node['page_id'] ) ) {
84 + wp_delete_post( $node['page_id'] );
85 + }
82 86 }
83 87 }
84 88
85 89 /**
@@ -91,12 +95,12 @@
91 95 return [
92 96 'sales-page' => esc_html__( 'Sales Page', 'sellkit' ),
93 97 'checkout' => esc_html__( 'Checkout', 'sellkit' ),
94 98 'thankyou' => esc_html__( 'Thank You', 'sellkit' ),
95 - 'decision' => esc_html__( 'Decision', 'sellkit' ),
99 + 'decision' => esc_html__( 'Condition', 'sellkit' ),
96 100 'upsell' => esc_html__( 'Upsell', 'sellkit' ),
97 101 'downsell' => esc_html__( 'Downsell', 'sellkit' ),
98 - 'optin-confirmation' => esc_html__( 'Opt-in Confirmation' ),
102 + 'optin-confirmation' => esc_html__( 'Opt-in Confirmation', 'sellkit' ),
99 103 'optin' => esc_html__( 'Opt-in', 'sellkit' ),
100 104 ];
101 105 }
102 106
@@ -112,8 +116,14 @@
112 116 $step['funnel_id'] = $funnel_id;
113 117 $step['number'] = $step_number;
114 118
115 119 if ( array_key_exists( 'page_id', $step ) ) {
120 + $translated_step = apply_filters( 'wpml_object_id', $step['page_id'], 'sellkit_step', true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML API.
121 +
122 + if ( $step['page_id'] !== $translated_step ) {
123 + update_post_meta( $translated_step, 'step_data', $step );
124 + }
125 +
116 126 update_post_meta( $step['page_id'], 'step_data', $step );
117 127 }
118 128 }
119 129 }
@@ -215,9 +225,9 @@
215 225 wp_send_json_error( __( 'Please install and activate WooCommerce.', 'sellkit' ) );
216 226 }
217 227
218 228 if ( empty( $products_id ) ) {
219 - wp_send_json_error( __( 'Please send some product ids' ) );
229 + wp_send_json_error( __( 'Please send some product ids', 'sellkit' ) );
220 230 }
221 231
222 232 $products_id = is_array( $products_id ) ? $products_id : [ $products_id ];
223 233
@@ -317,9 +327,9 @@
317 327 $nodes[ end( $old_node_keys ) + 1 ] = $last_node;
318 328 $keys = array_keys( $nodes );
319 329
320 330 if (
321 - 'last-node' !== $origin_node &&
331 + 'last-node' !== $origin_node && ! empty( $nodes[ $origin_node ] ) &&
322 332 'decision' !== $nodes[ $origin_node ]['type']['key'] &&
323 333 'upsell' !== $nodes[ $origin_node ]['type']['key'] &&
324 334 'downsell' !== $nodes[ $origin_node ]['type']['key']
325 335 ) {
@@ -326,9 +336,9 @@
326 336 $nodes[ $origin_node ]['targets'] = [ [ 'nodeId' => strval( end( $keys ) ) ] ];
327 337 }
328 338
329 339 if (
330 - 'last-node' !== $origin_node &&
340 + 'last-node' !== $origin_node && isset( $nodes[ $origin_node ]['type'] ) &&
331 341 (
332 342 'decision' === $nodes[ $origin_node ]['type']['key'] ||
333 343 'upsell' === $nodes[ $origin_node ]['type']['key'] ||
334 344 'downsell' === $nodes[ $origin_node ]['type']['key']
@@ -382,8 +392,12 @@
382 392 if ( 'string' !== gettype( $template ) || ! is_object( $post ) || self::SELLKIT_STEP_POST_TYPE !== $post->post_type ) {
383 393 return $template;
384 394 }
385 395
396 + if ( has_blocks( $post ) ) {
397 + return $template;
398 + }
399 +
386 400 remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
387 401 add_filter( 'next_post_rel_link', '__return_empty_string' );
388 402 add_filter( 'previous_post_rel_link', '__return_empty_string' );
389 403
@@ -507,8 +521,12 @@
507 521 */
508 522 public function update_steps_post_status( $funnel_id, $new_status ) {
509 523 $steps = get_post_meta( $funnel_id, 'sellkit_steps', true );
510 524
525 + if ( ! is_array( $steps ) ) {
526 + return;
527 + }
528 +
511 529 foreach ( $steps as $step ) {
512 530 if ( $step['page_id'] === $funnel_id ) {
513 531 continue;
514 532 }
@@ -516,8 +534,41 @@
516 534 wp_update_post(array(
517 535 'ID' => $step['page_id'],
518 536 'post_status' => $new_status,
519 537 ) );
538 + }
539 + }
540 +
541 + /**
542 + * Make SellKit custom post types translatable by default and set step_data custom field to "Copy".
543 + *
544 + * @since 2.3.2
545 + */
546 + public function sellkit_set_sellkit_translation_mode() {
547 + if ( function_exists( 'wpml_load_settings_helper' ) ) {
548 + global $sitepress;
549 +
550 + if ( $sitepress instanceof SitePress ) {
551 + $settings_helper = wpml_load_settings_helper();
552 +
553 + $post_types = [
554 + 'sellkit_step',
555 + 'sellkit-discount',
556 + 'sellkit-coupon',
557 + 'sellkit-alert',
558 + ];
559 +
560 + foreach ( $post_types as $post_type ) {
561 + $settings_helper->set_post_type_translatable( $post_type );
562 + $settings_helper->set_post_type_translation_unlocked_option( $post_type, true );
563 +
564 + if ( class_exists( '\WPML\Settings\PostType\Automatic' ) ) {
565 + \WPML\Settings\PostType\Automatic::set( $post_type, true );
566 + }
567 + }
568 +
569 + do_action( 'wpml_save_custom_field_translation_option', 'step_data', WPML_COPY_CUSTOM_FIELD ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML API.
570 + }
520 571 }
521 572 }
522 573 }
523 574