PluginProbe
YayMail – WooCommerce Email Customizer / 4.3.3
YayMail – WooCommerce Email Customizer v4.3.3
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
← All changes | src/Controllers/TemplateController.php +6 -22 4.4.6 → 4.3.3 View file →
@@ -201,9 +201,8 @@
201 201 $text_link_color = sanitize_text_field( $data['text_link_color'] );
202 202 $content_background_color = sanitize_text_field( $data['content_background_color'] );
203 203 $content_text_color = sanitize_text_field( $data['content_text_color'] );
204 204 $title_color = sanitize_text_field( $data['title_color'] );
205 - $preheader = sanitize_text_field( $data['preheader'] );
206 205 $global_header_settings = $data['global_header_settings'] ?? YayMailTemplate::DEFAULT_DATA['global_header_settings'];
207 206 $global_footer_settings = $data['global_footer_settings'] ?? YayMailTemplate::DEFAULT_DATA['global_footer_settings'];
208 207 $update_data = [
209 208 'elements' => $elements,
@@ -213,17 +212,11 @@
213 212 'content_text_color' => $content_text_color,
214 213 'title_color' => $title_color,
215 214 'global_header_settings' => $global_header_settings,
216 215 'global_footer_settings' => $global_footer_settings,
217 - 'preheader' => $preheader,
218 216 ];
219 -
220 - if ( isset( $data['email_subject'] ) ) {
221 - $template_name = get_post_meta( (int) $id, YayMailTemplate::META_KEYS['name'], true );
222 - $this->model::save_email_subject( $template_name, $data['email_subject'] );
223 - }
224 -
225 - return $this->model::update( $id, $update_data, true );
217 + $updated_data = $this->model::update( $id, $update_data, true );
218 + return $updated_data;
226 219 }
227 220
228 221 public function exec_delete_template( \WP_REST_Request $request ) {
229 222 return $this->exec( [ $this, 'delete_template' ], $request );
@@ -240,15 +233,9 @@
240 233 }
241 234
242 235 public function get_template_by_name( \WP_REST_Request $request ) {
243 236 $template_name = sanitize_text_field( $request->get_param( 'template_name' ) );
244 - $variant = yaymail_sanitize_template_variant( $request->get_param( 'variant' ) );
245 - $template_data = $this->model::find_by_name( $template_name, '', $variant );
246 - if ( '' !== $variant && empty( $template_data['id'] ) ) {
247 - // Variant posts are created on first open, seeded from the default design.
248 - new YayMailTemplate( $template_name, '', $variant );
249 - $template_data = $this->model::find_by_name( $template_name, '', $variant );
250 - }
237 + $template_data = $this->model::find_by_name( $template_name );
251 238
252 239 if ( null === $template_data ) {
253 240 $all_emails = yaymail_get_emails();
254 241 if ( in_array(
@@ -399,11 +386,8 @@
399 386 return $this->exec( [ $this, 'change_global_header_footer_status' ], $request );
400 387 }
401 388
402 389 public function change_global_header_footer_status( \WP_REST_Request $request ) {
403 - $status = filter_var( $request->get_param( 'status' ), FILTER_VALIDATE_BOOLEAN );
404 - $platform = sanitize_text_field( $request->get_param( 'platform' ) ?? 'yaymail' );
405 - $platform_obj = \YayMail\Platform\PlatformRegistry::get( $platform ) ?? \YayMail\Platform\PlatformRegistry::get( 'yaymail' );
406 - $key = $platform_obj ? $platform_obj->ghf_option_key( 'enabled' ) : 'global_header_footer_enabled';
407 - return SettingModel::update( [ $key => $status ] );
390 + $status = sanitize_text_field( $request->get_param( 'status' ) );
391 + return SettingModel::update( [ 'global_header_footer_enabled' => $status ] );
408 392 }
409 -}
393 +}