芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/public_html/wp-content/plugins/woocommerce/src/Internal/Email/EmailStyleSync.php
is_syncing = true; try { $this->update_email_colors(); } finally { $this->is_syncing = false; } } } /** * Check if auto-sync is enabled. * * @return bool Whether auto-sync is enabled. */ public function is_auto_sync_enabled() { return 'yes' === get_option( self::AUTO_SYNC_OPTION, 'no' ); } /** * Set auto-sync enabled status. * * @param bool $enabled Whether auto-sync should be enabled. * @return bool Whether the option was updated. */ public function set_auto_sync( bool $enabled ) { return update_option( self::AUTO_SYNC_OPTION, $enabled ? 'yes' : 'no' ); } /** * Sync email styles with theme styles if auto-sync is enabled. * * Uses a flag to prevent recursive calls. */ public function sync_email_styles_with_theme() { if ( $this->is_syncing || ! $this->is_auto_sync_enabled() || ! wp_theme_has_theme_json() ) { return; } $this->is_syncing = true; try { $this->update_email_colors(); } finally { $this->is_syncing = false; } } /** * Update email colors from theme colors. */ protected function update_email_colors() { $colors = EmailColors::get_default_colors(); if ( empty( $colors ) ) { return; } if ( ! empty( $colors['base'] ) ) { update_option( 'woocommerce_email_base_color', $colors['base'] ); } if ( ! empty( $colors['bg'] ) ) { update_option( 'woocommerce_email_background_color', $colors['bg'] ); } if ( ! empty( $colors['body_bg'] ) ) { update_option( 'woocommerce_email_body_background_color', $colors['body_bg'] ); } if ( ! empty( $colors['body_text'] ) ) { update_option( 'woocommerce_email_text_color', $colors['body_text'] ); } if ( ! empty( $colors['footer_text'] ) ) { update_option( 'woocommerce_email_footer_text_color', $colors['footer_text'] ); } } }