| @@ -63,21 +63,8 @@ | ||
| 63 | 63 | ]; |
| 64 | 64 | wp_send_json( $return ); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - // Nonce verified above. | |
| 68 | - $can_save = apply_filters( 'rtsb/builder/create_template/can_save', true, $page_type, $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 69 | - | |
| 70 | - if ( true !== $can_save ) { | |
| 71 | - wp_send_json( | |
| 72 | - [ | |
| 73 | - 'success' => false, | |
| 74 | - 'post_id' => $page_id, | |
| 75 | - 'message' => is_string( $can_save ) ? $can_save : esc_html__( 'Template cannot be saved.', 'shopbuilder' ), | |
| 76 | - ] | |
| 77 | - ); | |
| 78 | - } | |
| 79 | - | |
| 80 | 67 | add_filter( |
| 81 | 68 | 'pre_option_elementor_unfiltered_files_upload', |
| 82 | 69 | function () { |
| 83 | 70 | return '1'; |
| @@ -127,14 +114,9 @@ | ||
| 127 | 114 | update_post_meta( $page_id, BuilderFns::$product_template_meta, $product_id ); |
| 128 | 115 | update_post_meta( $page_id, '_is_product_page_template_for', $template_for ); |
| 129 | 116 | } |
| 130 | 117 | |
| 131 | - $has_default = TemplateSettings::instance()->get_option( $option_name ); | |
| 132 | - $singleton_types = apply_filters( | |
| 133 | - 'rtsb/builder/singleton_types', | |
| 134 | - array_keys( BuilderFns::builder_page_types() ) | |
| 135 | - ); | |
| 136 | - $is_pool_type = ! in_array( $page_type, $singleton_types, true ); | |
| 118 | + $has_default = TemplateSettings::instance()->get_option( $option_name ); | |
| 137 | 119 | if ( ( 'product' === $page_type && 'all_products' !== $template_for ) || ( 'archive' === $page_type && count( $selected_category ) ) ) { |
| 138 | 120 | if ( ! $has_default ) { |
| 139 | 121 | TemplateSettings::instance()->set_option( $option_name, '' ); |
| 140 | 122 | } |
| @@ -139,20 +121,12 @@ | ||
| 139 | 121 | TemplateSettings::instance()->set_option( $option_name, '' ); |
| 140 | 122 | } |
| 141 | 123 | } else { |
| 142 | 124 | if ( 'default_template' === $default_template ) { |
| 143 | - if ( $is_pool_type ) { | |
| 144 | - update_post_meta( $page_id, '_rtsb_tb_enabled_in_pool', 'on' ); | |
| 145 | - } else { | |
| 146 | - TemplateSettings::instance()->set_option( $option_name, $page_id ); | |
| 147 | - } | |
| 125 | + TemplateSettings::instance()->set_option( $option_name, $page_id ); | |
| 148 | 126 | } else { |
| 149 | - if ( $is_pool_type ) { | |
| 150 | - delete_post_meta( $page_id, '_rtsb_tb_enabled_in_pool' ); | |
| 151 | - } else { | |
| 152 | - if ( ! $has_default ) { | |
| 153 | - TemplateSettings::instance()->set_option( $option_name, '' ); | |
| 154 | - } | |
| 127 | + if ( ! $has_default ) { | |
| 128 | + TemplateSettings::instance()->set_option( $option_name, '' ); | |
| 155 | 129 | } |
| 156 | 130 | } |
| 157 | 131 | } |
| 158 | 132 | |