| @@ -60,10 +60,8 @@ | ||
| 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' ] ); | |
| 66 | 64 | } |
| 67 | 65 | |
| 68 | 66 | /** |
| 69 | 67 | * Removes steps pages. |
| @@ -79,11 +77,9 @@ | ||
| 79 | 77 | return; |
| 80 | 78 | } |
| 81 | 79 | |
| 82 | 80 | foreach ( $nodes[0] as $node ) { |
| 83 | - if ( isset( $node['page_id'] ) ) { | |
| 84 | - wp_delete_post( $node['page_id'] ); | |
| 85 | - } | |
| 81 | + wp_delete_post( $node['page_id'] ); | |
| 86 | 82 | } |
| 87 | 83 | } |
| 88 | 84 | |
| 89 | 85 | /** |
| @@ -98,9 +94,9 @@ | ||
| 98 | 94 | 'thankyou' => esc_html__( 'Thank You', 'sellkit' ), |
| 99 | 95 | 'decision' => esc_html__( 'Condition', 'sellkit' ), |
| 100 | 96 | 'upsell' => esc_html__( 'Upsell', 'sellkit' ), |
| 101 | 97 | 'downsell' => esc_html__( 'Downsell', 'sellkit' ), |
| 102 | - 'optin-confirmation' => esc_html__( 'Opt-in Confirmation', 'sellkit' ), | |
| 98 | + 'optin-confirmation' => esc_html__( 'Opt-in Confirmation' ), | |
| 103 | 99 | 'optin' => esc_html__( 'Opt-in', 'sellkit' ), |
| 104 | 100 | ]; |
| 105 | 101 | } |
| 106 | 102 | |
| @@ -116,14 +112,8 @@ | ||
| 116 | 112 | $step['funnel_id'] = $funnel_id; |
| 117 | 113 | $step['number'] = $step_number; |
| 118 | 114 | |
| 119 | 115 | 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 | - | |
| 126 | 116 | update_post_meta( $step['page_id'], 'step_data', $step ); |
| 127 | 117 | } |
| 128 | 118 | } |
| 129 | 119 | } |
| @@ -225,9 +215,9 @@ | ||
| 225 | 215 | wp_send_json_error( __( 'Please install and activate WooCommerce.', 'sellkit' ) ); |
| 226 | 216 | } |
| 227 | 217 | |
| 228 | 218 | if ( empty( $products_id ) ) { |
| 229 | - wp_send_json_error( __( 'Please send some product ids', 'sellkit' ) ); | |
| 219 | + wp_send_json_error( __( 'Please send some product ids' ) ); | |
| 230 | 220 | } |
| 231 | 221 | |
| 232 | 222 | $products_id = is_array( $products_id ) ? $products_id : [ $products_id ]; |
| 233 | 223 | |
| @@ -327,9 +317,9 @@ | ||
| 327 | 317 | $nodes[ end( $old_node_keys ) + 1 ] = $last_node; |
| 328 | 318 | $keys = array_keys( $nodes ); |
| 329 | 319 | |
| 330 | 320 | if ( |
| 331 | - 'last-node' !== $origin_node && ! empty( $nodes[ $origin_node ] ) && | |
| 321 | + 'last-node' !== $origin_node && | |
| 332 | 322 | 'decision' !== $nodes[ $origin_node ]['type']['key'] && |
| 333 | 323 | 'upsell' !== $nodes[ $origin_node ]['type']['key'] && |
| 334 | 324 | 'downsell' !== $nodes[ $origin_node ]['type']['key'] |
| 335 | 325 | ) { |
| @@ -336,9 +326,9 @@ | ||
| 336 | 326 | $nodes[ $origin_node ]['targets'] = [ [ 'nodeId' => strval( end( $keys ) ) ] ]; |
| 337 | 327 | } |
| 338 | 328 | |
| 339 | 329 | if ( |
| 340 | - 'last-node' !== $origin_node && isset( $nodes[ $origin_node ]['type'] ) && | |
| 330 | + 'last-node' !== $origin_node && | |
| 341 | 331 | ( |
| 342 | 332 | 'decision' === $nodes[ $origin_node ]['type']['key'] || |
| 343 | 333 | 'upsell' === $nodes[ $origin_node ]['type']['key'] || |
| 344 | 334 | 'downsell' === $nodes[ $origin_node ]['type']['key'] |
| @@ -534,41 +524,8 @@ | ||
| 534 | 524 | wp_update_post(array( |
| 535 | 525 | 'ID' => $step['page_id'], |
| 536 | 526 | 'post_status' => $new_status, |
| 537 | 527 | ) ); |
| 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 | - } | |
| 571 | 528 | } |
| 572 | 529 | } |
| 573 | 530 | } |
| 574 | 531 | |