/"; /** * Checks for any content wrapper HTML tags applied through * the Visual Editor during the composing of an email message. * * @param string $content the full email content. * * @return string */ public static function checkWrapperSymbols($content) { $chunks = preg_split(static::$wrapper_pattern, (string)$content); if (count($chunks) < 2) { // no content wrapper used in email message return $content; } $layout_opening = self::getWrapperLayout(true); $layout_closing = self::getWrapperLayout(false); $final_content = ''; foreach ($chunks as $piece => $part) { $is_even = ($piece === 0 || (($piece % 2) === 0)); if (strlen(trim($part)) && !$is_even) { $final_content .= $layout_opening . $part . $layout_closing; } else { $final_content .= $part; } } return $final_content; } /** * Returns the current mail wrapper layout HTML code. * * @param bool $opening whether to get the opening or closing HTML. * * @return string */ public static function getWrapperLayout($opening = true) { // configuration field name $opt_name = 'mail_wrapper_layout_' . ($opening ? 'opening' : 'closing'); // access the configuration object $config = VBOFactory::getConfig(); // get the current configuration value $layout = $config->get($opt_name); if (!$layout) { // set and get default layout $layout = self::getWrapperDefaultLayout($opening); $config->set($opt_name, $layout); } return $layout; } /** * Returns the default mail wrapper layout HTML code. * * @param bool $opening whether to get the opening or closing HTML. * * @return string */ private static function getWrapperDefaultLayout($opening = true) { $layout_opening = "\n"; $layout_opening .= "
"; $layout_opening .= "\n\t"; $layout_opening .= "
"; $layout_opening .= "\n"; $layout_closing = "\n"; $layout_closing .= "\t
\n"; $layout_closing .= "
\n"; return $opening ? $layout_opening : $layout_closing; } }