style_inline() public méthode

Apply inline styles to dynamic content.
public style_inline ( string | null $content ) : string
$content string | null
Résultat string
 public static function email_template($subject, $message)
 {
     global $woocommerce, $woocommerce_settings;
     // load the mailer class
     $mailer = WC()->mailer();
     $email_heading = $subject;
     $message;
     $abstractClass = new ReflectionClass('WC_Email');
     if (!$abstractClass->isAbstract()) {
         $email = new WC_Email();
         // wrap the content with the email template and then add styles
         $fetch_data = $email->style_inline($mailer->wrap_message($email_heading, $message));
     } else {
         $fetch_data = $mailer->wrap_message($email_heading, $message);
     }
     return $fetch_data;
 }
 /**
  * Preview email template.
  *
  * @return string
  */
 public function preview_emails()
 {
     if (isset($_GET['preview_woocommerce_mail'])) {
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'preview-mail')) {
             die('Security check');
         }
         // load the mailer class
         $mailer = WC()->mailer();
         // get the preview email subject
         $email_heading = __('HTML Email Template', 'woocommerce');
         // get the preview email content
         ob_start();
         include 'views/html-email-template-preview.php';
         $message = ob_get_clean();
         // create a new email
         $email = new WC_Email();
         // wrap the content with the email template and then add styles
         $message = apply_filters('woocommerce_mail_content', $email->style_inline($mailer->wrap_message($email_heading, $message)));
         // print the preview email
         echo $message;
         exit;
     }
 }