コード例 #1
0
ファイル: block.a.php プロジェクト: implico/email-framework
function smarty_block_a($params, $content, Smarty_Internal_Template $template, &$repeat)
{
    $ret = '';
    $smarty = $template->smarty;
    $par = new Params($params);
    $par->setParams([], ['href' => '', 'textDecoration' => $smarty->getConfigVars('aTextDecoration'), 'target' => $smarty->getConfigVars('aTarget'), 'buttonHeight' => false, 'style' => false, 'id' => false, 'class' => false, 'attrs' => false]);
    // only output on the closing tag
    if (!$repeat) {
        if (isset($content)) {
            $ret .= "<a";
            $ret .= SmartyUtils::addAttr('href', $par['href']);
            if ($par['textDecoration'] || $par['style'] || $par['buttonHeight']) {
                $ret .= ' style="';
                if ($par['textDecoration']) {
                    $ret .= "text-decoration:{$par['textDecoration']};text-decoration:{$par['textDecoration']} !important;";
                }
                if ($par['buttonHeight']) {
                    $ret .= "display:inline-block;mso-line-height-rule:exactly;height:{$par['buttonHeight']}px;max-height:{$par['buttonHeight']}px;line-height:{$par['buttonHeight']}px;line-height:{$par['buttonHeight']}px !important;vertical-align:middle;width:100%;white-space:nowrap;overflow:hidden;text-align:center;";
                }
                if ($par['style']) {
                    $ret .= $par['style'];
                }
                $ret .= '"';
            }
            $ret .= SmartyUtils::addAttr('target', $par['target']);
            $ret .= SmartyUtils::getAttrs($par['id'], $par['class'], $par['attrs']);
            $ret .= ">{$content}</a>";
            return $ret;
        }
    }
}
コード例 #2
0
function smarty_block_table($params, $content, Smarty_Internal_Template $template, &$repeat)
{
    $ret = '';
    $smarty = $template->smarty;
    $repeatCss = $smarty->getConfigVars('repeatAttrInCss');
    $par = new Params($params);
    $par->setParams([], ['width' => $smarty->getConfigVars('tableWidth'), 'cellpadding' => '0', 'cellspacing' => '0', 'bgcolor' => false, 'border' => '0', 'bordercolor' => false, 'align' => $smarty->getConfigVars('tableAlign'), 'style' => false, 'id' => false, 'class' => false, 'attrs' => false]);
    // only output on the closing tag
    if (!$repeat) {
        if (isset($content)) {
            if ($par['width'] === "") {
                $par['width'] = $smarty->getConfigVars('lWidth');
            }
            $widthCss = SmartyUtils::unitPx($par['width']);
            $ret .= "<table cellpadding=\"{$par['cellpadding']}\" cellspacing=\"{$par['cellspacing']}\" border=\"{$par['border']}\"";
            $ret .= SmartyUtils::addAttr('align', $par['align']);
            $ret .= SmartyUtils::addAttr('width', $par['width']);
            $ret .= SmartyUtils::addAttr('bgcolor', $par['bgcolor']);
            $ret .= SmartyUtils::addAttr('bordercolor', $par['bordercolor']);
            $style = '';
            if ($repeatCss) {
                $style .= "margin:0";
                if ($par['align'] == 'center') {
                    $style .= " auto";
                }
                $style .= ';';
                $style .= SmartyUtils::addCss('width', $widthCss);
            }
            $style .= SmartyUtils::addCss('background-color', $par['bgcolor']);
            if ($par['border']) {
                $style .= "border:{$par['border']}px solid ";
                if ($par['bordercolor']) {
                    $style .= $par['bordercolor'];
                } else {
                    $style .= '#000';
                }
                $style .= ';';
            }
            $style .= 'border-collapse:collapse;';
            if ($smarty->getConfigVars('outlookCss')) {
                $style .= "mso-table-lspace:0pt;mso-table-rspace:0pt;";
            }
            if ($par['align'] == 'center') {
                $style .= 'margin-left:auto;margin-right:auto;';
            }
            if ($par['style']) {
                $style .= $par['style'];
            }
            if (strlen($style)) {
                $ret .= ' style="' . $style . '"';
            }
            $ret .= SmartyUtils::getAttrs($par['id'], $par['class'], $par['attrs']);
            $ret .= ">";
            $ret .= $content . '</table>';
            return $ret;
        }
    }
}
コード例 #3
0
ファイル: block.tr.php プロジェクト: implico/email-framework
function smarty_block_tr($params, $content, Smarty_Internal_Template $template, &$repeat)
{
    $ret = '';
    $smarty = $template->smarty;
    $par = new Params($params);
    $par->setParams([], ['style' => false, 'id' => false, 'class' => false, 'attrs' => false]);
    // only output on the closing tag
    if (!$repeat) {
        if (isset($content)) {
            $ret .= "<tr";
            $ret .= SmartyUtils::getAttrs($par['id'], $par['class'], $par['attrs'], $par['style']);
            $ret .= ">{$content}</tr>";
            return $ret;
        }
    }
}
コード例 #4
0
function smarty_function_margin($params, Smarty_Internal_Template $template)
{
    $ret = '';
    $smarty = $template->smarty;
    $par = new Params($params);
    $par->setParams([], ['width' => false, 'height' => 30, 'colspan' => 1, 'bgcolor' => false, 'style' => false, 'id' => false, 'class' => false, 'attrs' => false]);
    $tpl = "{tr}{td";
    $tpl .= SmartyUtils::addAttr('height', $par['height'], true);
    $tpl .= SmartyUtils::addAttr('width', $par['width'], true);
    $tpl .= " colspan={$par['colspan']} align=false valign=false noFont=true";
    $tpl .= SmartyUtils::addAttr('overflow', 'hidden');
    $tpl .= SmartyUtils::addAttr('bgcolor', $par['bgcolor']);
    $tpl .= SmartyUtils::addAttr('fontSize', 0);
    $tpl .= SmartyUtils::addAttr('style', $par['style']);
    $tpl .= SmartyUtils::getAttrs($par['id'], $par['class'], $par['attrs']);
    $tpl .= "}";
    if ($par['height'] >= 18) {
        $tpl .= "&nbsp;";
    }
    $tpl .= "{/td}{/tr}";
    $ret .= $smarty->fetch('string:' . $tpl);
    return $ret;
}
コード例 #5
0
ファイル: Compile.php プロジェクト: implico/email-framework
 /**
  * Execute compile command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     //get project name & set source/output dirs
     $project = $input->getArgument('project');
     $this->config = new \Implico\Email\Config($project, $input->getOption('dir'));
     if ($error = $this->config->getErrors()) {
         switch ($error) {
             case 'projectNotFound':
                 $output->writeln('<fg=red>ERROR: project directory not found</fg=red>');
                 exit(1);
                 break;
         }
     }
     SmartyUtils::init($this->config);
     //get script name(s)
     $scripts = $input->getOption('script');
     //if script name(s) not passed, set all scripts (exclude dirs)
     if (!$scripts) {
         $scripts = array_filter(array_diff(scandir($this->config['scriptsDir']), array('.', '..')), function ($script) {
             return !is_dir($this->config['scriptsDir'] . $script);
         });
     }
     //add ".tpl" extension when applicable
     foreach ($scripts as $i => $script) {
         if (strpos($script, '.') === false) {
             $scripts[$i] = $script . '.tpl';
         }
     }
     //get watch option
     $watch = $input->getOption('watch');
     //get output option
     $outputMode = $input->getOption('output');
     //create & configure Smarty object
     $smarty = new \Smarty();
     $smarty->setCompileDir(IE_SMARTY_COMPILE_DIR);
     $smarty->addPluginsDir(IE_SMARTY_PLUGINS_DIR);
     $smarty->addPluginsDir(IE_SMARTY_CUSTOM_PLUGINS_DIR);
     $smarty->compile_check = false;
     $smarty->force_compile = true;
     $smarty->error_reporting = E_ALL;
     $smarty->registerClass('SmartyUtils', 'Implico\\Email\\Utils\\Smarty');
     //set directories
     $smarty->setTemplateDir(array(0 => $this->config['dir'], 'core' => IE_CORE_DIR, 'layouts' => $this->config['layoutsDir'], 'scripts' => $this->config['scriptsDir'], 'styles' => $this->config['stylesDir']));
     //master config file
     $smarty->configLoad(IE_CORE_DIR . 'config.conf');
     //optional master custom config file
     $customConf = IE_CUSTOM_DIR . 'config.conf';
     if (file_exists($customConf)) {
         $smarty->configLoad($customConf);
     }
     //console message for watching
     if ($watch) {
         $output->writeln('Watching for changes...');
     }
     //main loop - watch for changes (or execute once if not watching)
     $compileNo = 1;
     $compileDirStamp = '';
     //dirs to inspect file change
     $checkDirs = array($this->config['configsDir'], $this->config['configsScriptsDir'], $this->config['layoutsDir'], $this->config['scriptsDir'], $this->config['stylesDir']);
     //set output mode variables
     $outputMinified = in_array('m', $outputMode);
     $outputFormatted = in_array('f', $outputMode);
     //formatter object
     $formatter = null;
     //css inliner object
     $cssToInlineStyles = new CssToInlineStyles();
     while (true) {
         //compile only if not watching or the dirs filestamp changes
         if (!$watch || $compileDirStamp != $this->getDirStamp($checkDirs)) {
             //clear compiled templates
             $smarty->clearCompiledTemplate();
             //Smarty assign project-specific config file path
             $configFile = $this->config['configsDir'] . 'config.conf';
             $loadConfigFile = file_exists($configFile);
             //set random complile_id (forces Smarty to compile)
             $smarty->compile_id = uniqid();
             //list of compiled scripts
             $compiledScripts = $scripts;
             //fetch & save templates
             foreach ($scripts as $i => $script) {
                 //script name without extension
                 $scriptName = substr($script, 0, strrpos($script, '.'));
                 $smarty->clearConfig();
                 if ($loadConfigFile) {
                     $smarty->configLoad($configFile);
                 }
                 //set script-specific config file path if exists
                 $configFileScript = $this->config['configsScriptsDir'] . $scriptName . '.conf';
                 if (file_exists($configFileScript)) {
                     $smarty->configLoad($configFileScript);
                 }
                 //lazy create indenter
                 if ($outputFormatted && !$formatter) {
                     $formatter = new \Gajus\Dindent\Indenter(array('indentation_character' => $smarty->getConfigVars('indentChar')));
                 }
                 //set encoding
                 $outputEncoding = $smarty->getConfigVars('encoding');
                 if (!$outputEncoding) {
                     $outputEncoding = 'utf-8';
                 }
                 $outputEncodingUtf8 = strtoupper($outputEncoding) == 'UTF-8';
                 try {
                     //get the html
                     $html = $smarty->fetch($this->config['scriptsDir'] . $script);
                     //get inline styles
                     $inlineCss = $smarty->fetch($this->config['stylesDir'] . 'inline.tpl');
                     if (trim($inlineCss)) {
                         $cssToInlineStyles->setHTML($html);
                         $cssToInlineStyles->setCSS($inlineCss);
                         $html = $cssToInlineStyles->convert();
                     }
                     //save minified
                     if ($outputMinified) {
                         $htmlSave = $html;
                         if (!$outputEncodingUtf8) {
                             $htmlSave = mb_convert_encoding($htmlSave, $outputEncoding, 'utf-8');
                         }
                         //max line width = 900 chars
                         $maxPerLine = 750;
                         $endLine = false;
                         $newHtml = '';
                         for ($i = 0; $i < mb_strlen($htmlSave, $outputEncoding); $i++) {
                             if ($i % $maxPerLine == 0 && $i > 0) {
                                 $endLine = true;
                             }
                             $curChar = mb_substr($htmlSave, $i, 1, $outputEncoding);
                             $newHtml .= $curChar;
                             if ($endLine) {
                                 if ($curChar == '>') {
                                     $newHtml .= PHP_EOL;
                                     $endLine = false;
                                 }
                             }
                         }
                         $htmlSave = $newHtml;
                         $this->saveOutput($this->config['outputsDir'] . $scriptName . '.min.html', $htmlSave);
                     }
                     //save formatted
                     if ($outputFormatted) {
                         $htmlSave = $formatter->indent($html);
                         if (!$outputEncodingUtf8) {
                             $htmlSave = mb_convert_encoding($htmlSave, $outputEncoding, 'utf-8');
                         }
                         $this->saveOutput($this->config['outputsDir'] . $scriptName . '.html', $htmlSave, true);
                     }
                 } catch (\Exception $e) {
                     $output->writeln('<fg=red>' . $e->getMessage() . '</fg=red>');
                     $compiledScripts[$i] .= ' <fg=red>(ERROR)</fg=red>';
                 }
             }
             //console info message
             $output->writeln(($watch ? '#' . $compileNo++ . ' ' : '') . 'Compiled ' . date('d-m-Y H:i:s') . ' ' . implode(', ', $compiledScripts));
         }
         //break if not watching
         if (!$watch) {
             break;
         }
         //calculate dirs filestamp to compare
         $compileDirStamp = $this->getDirStamp($checkDirs);
         //pause
         usleep(500000);
     }
 }
コード例 #6
0
function smarty_function_img($params, Smarty_Internal_Template $template)
{
    $ret = '';
    $smarty = $template->smarty;
    $repeatCss = $smarty->getConfigVars('repeatAttrInCss');
    $par = new Params($params);
    $par->setParams([], ['src' => '', 'srcPrepend' => $smarty->getConfigVars('imgSrcPrepend'), 'width' => false, 'height' => false, 'autoSize' => $smarty->getConfigVars('imgAutoSize'), 'alt' => $smarty->getConfigVars('imgAlt'), 'padding' => false, 'margin' => '0', 'marginV' => '0', 'marginH' => '0', 'align' => false, 'display' => $smarty->getConfigVars('imgDisplay'), 'border' => '0', 'bordercolor' => false, 'style' => false, 'id' => false, 'class' => '', 'attrs' => false]);
    $ret .= "<img";
    $src = $par['src'];
    if ($par['srcPrepend'] !== false) {
        $src = $par['srcPrepend'] . $src;
    }
    $ret .= SmartyUtils::addAttr('src', $src);
    //auto size
    if ($par['autoSize'] && $par['src'] && !$par['width'] && !$par['height']) {
        $file = SmartyUtils::$config['outputsDir'] . $par['src'];
        if (file_exists($file)) {
            $s = getimagesize($file);
            if ($s) {
                $par['width'] = $s[0];
                $par['height'] = $s[1];
            }
        }
    }
    $ret .= SmartyUtils::addAttr('width', $par['width']);
    $widthCss = SmartyUtils::unitPx($par['width']);
    $ret .= SmartyUtils::addAttr('height', $par['height']);
    $ret .= SmartyUtils::addAttr('alt', $par['alt']);
    $ret .= SmartyUtils::addAttr('vspace', $par['marginV']);
    $ret .= SmartyUtils::addAttr('hspace', $par['marginH']);
    if ($par->isDefault('margin') && ($par['marginV'] || $par['marginH'])) {
        $par['margin'] = ($par['marginV'] ? $par['marginV'] : '0') + 'px ' + ($par['marginH'] ? $par['marginH'] : '0') + 'px';
    }
    $ret .= SmartyUtils::addAttr('align', $par['align']);
    $ret .= SmartyUtils::addAttr('border', $par['border']);
    $ret .= SmartyUtils::addAttr('bordercolor', $par['bordercolor']);
    $ret .= " style=\"";
    $ret .= SmartyUtils::addCss('display', $par['display']);
    if ($repeatCss) {
        $ret .= SmartyUtils::addCss('width', $par['width']);
        $ret .= SmartyUtils::addCss('height', $par['height']);
    }
    $ret .= SmartyUtils::addCss('padding', $par['padding']);
    $ret .= SmartyUtils::addCss('margin', $par['margin']);
    if ($par['border'] && $par['border'] != '0') {
        if ($par['bordercolor']) {
            $ret .= "border:{$par['border']}px solid {$par['bordercolor']};";
        } else {
            $ret .= "border-width:{$par['border']}px;";
        }
    } else {
        //if ($repeatCss) {
        $ret .= 'border:none;';
        //}
    }
    $ret .= 'outline:none;text-decoration:none;';
    if ($smarty->getConfigVars('outlookCss')) {
        $ret .= '-ms-interpolation-mode:bicubic;';
    }
    if ($par['style']) {
        $ret .= $par['style'];
    }
    $ret .= '"';
    $ret .= SmartyUtils::getAttrs($par['id'], $par['class'], $par['attrs']);
    $ret .= ' />';
    return $ret;
}
コード例 #7
0
function smarty_block_font($params, $content, Smarty_Internal_Template $template, &$repeat)
{
    $ret = '';
    $smarty = $template->smarty;
    $repeatCss = $smarty->getConfigVars('repeatAttrInCss');
    $par = new Params($params);
    $par->setParams([], ['color' => $smarty->getConfigVars('fontColor'), 'size' => $smarty->getConfigVars('fontSize'), 'sizeForce' => false, 'family' => $smarty->getConfigVars('fontFamily'), 'bold' => false, 'b' => false, 'italic' => false, 'i' => false, 'underlined' => false, 'u' => false, 'centered' => false, 'c' => false, 'style' => false, 'lineHeight' => false, 'forceCss' => false]);
    // only output on the closing tag
    if (!$repeat) {
        if (isset($content)) {
            $setCss = false;
            //check if any argument was set - if true, the css are applied
            foreach ($par as $key => $value) {
                if (!$par->isDefault($key)) {
                    $setCss = true;
                    break;
                }
            }
            $setCss = $setCss || !$smarty->getConfigVars('fontStyleTdTag');
            $isBold = $par['bold'] !== false || $par['b'] !== false;
            $isItalic = $par['italic'] !== false || $par['i'] !== false;
            $isUnderlined = $par['underlined'] !== false || $par['u'] !== false;
            $isCentered = $par['centered'] !== false || $par['c'] !== false;
            $css = "";
            $css .= SmartyUtils::addCss('font-size', $par['size'] . 'px');
            if ($par['sizeForce']) {
                $css .= SmartyUtils::addCss('font-size', $par['size'] . 'px !important');
            }
            $cssFont = $css;
            $css .= SmartyUtils::addCss('color', $par['color']);
            $css .= SmartyUtils::addCss('font-family', $par['family']);
            if ($isBold) {
                $css .= SmartyUtils::addCss('font-weight', 'bold');
            }
            if ($isItalic) {
                $css .= SmartyUtils::addCss('font-style', 'italic');
            }
            if ($isUnderlined) {
                $css .= SmartyUtils::addCss('text-decoration', 'underline');
            }
            if ($repeatCss || $par['forceCss']) {
                $cssFont = $css;
            }
            $prop = SmartyUtils::addCss('line-height', $par['lineHeight']);
            $css .= $prop;
            $cssFont .= $prop;
            if ($par['style']) {
                $prop = $par['style'];
                $css .= $prop;
                $cssFont .= $prop;
            }
            if ($isCentered) {
                $ret .= '<center>';
            }
            if ($isBold) {
                $ret .= '<b>';
            }
            if ($isItalic) {
                $ret .= '<i>';
            }
            if ($isUnderlined) {
                $ret .= '<u>';
            }
            $useSpan = $smarty->getConfigVars('fontStyleSpanTag') && ($setCss || $par['forceCss']);
            if ($useSpan) {
                $ret .= "<span style=\"{$css}\">";
            }
            $useFont = $smarty->getConfigVars('fontStyleFontTag');
            if ($useFont) {
                $sizeFont = SmartyUtils::convertFontSize($par['size']);
                $ret .= "<font color=\"{$par['color']}\" size=\"{$sizeFont}\" face=\"{$par['family']}\" style=\"{$cssFont}\">";
            }
            $ret .= $content;
            if ($useFont) {
                $ret .= '</font>';
            }
            if ($useSpan) {
                $ret .= '</span>';
            }
            if ($isUnderlined) {
                $ret .= '</u>';
            }
            if ($isItalic) {
                $ret .= '</i>';
            }
            if ($isBold) {
                $ret .= '</b>';
            }
            if ($isCentered) {
                $ret .= '</center>';
            }
            return $ret;
        }
    }
}
コード例 #8
0
function smarty_block_button($params, $content, Smarty_Internal_Template $template, &$repeat)
{
    $ret = '';
    $smarty = $template->smarty;
    $par = new Params($params);
    $par->setParams([], ['href' => '', 'width' => false, 'height' => false, 'bgcolor' => false, 'bordercolor' => false, 'borderRadius' => false, 'centered' => true]);
    // only output on the closing tag
    if (!$repeat) {
        if (isset($content)) {
            $isCentered = $par['centered'];
            $hasBorder = $par['bordercolor'] !== false;
            $arcSize = false;
            if ($par['height'] && $par['borderRadius']) {
                $arcSize = round($par['borderRadius'] / $par['height'] * 100) . '%';
            }
            $tagName = $par['borderRadius'] ? 'roundrect' : 'rect';
            $ret .= '
      <!--[if mso]>
        <v:' . $tagName . ' xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="' . $par['href'] . '" style="height:' . $par['height'] . 'px;v-text-anchor:middle;width:' . $par['width'] . 'px;"';
            $ret .= SmartyUtils::addAttr('arcsize', $arcSize);
            $ret .= SmartyUtils::addAttr('strokecolor', $par['bordercolor']);
            if (!$par['bordercolor']) {
                $ret .= ' stroke="f"';
            }
            $ret .= ' fillcolor="' . $par['bgcolor'] . '">';
            $ret .= '<w:anchorlock/>';
            if (!$hasBorder) {
                $ret .= '<![endif]-->';
            }
            if ($isCentered) {
                $ret .= '<center>';
            }
            $inner = "{a href='{$par['href']}' textDecoration='none' buttonHeight='{$par['height']}' style='width:{$par['width']}px;-webkit-text-size-adjust:none;background-color:{$par['bgcolor']};";
            $innerWithBorder = false;
            if ($par['borderRadius'] !== false) {
                $par['borderRadius'] .= 'px';
            }
            $inner .= SmartyUtils::addCss('border-radius', $par['borderRadius']);
            if (!$par['centered']) {
                $inner .= SmartyUtils::addCss('text-align', 'left');
            }
            if ($hasBorder) {
                $par['bordercolor'] = '1px solid ' . $par['bordercolor'];
                $innerWithBorder = $inner;
                $innerWithBorder .= SmartyUtils::addCss('border', $par['bordercolor']);
            }
            $innerFinish = "'}" . $content . '{/a}';
            if ($hasBorder) {
                $innerWithBorder .= SmartyUtils::addCss('mso-hide', 'all');
                $innerWithBorder .= $innerFinish;
            }
            $inner .= $innerFinish;
            $ret .= $inner;
            if ($par['centered']) {
                $ret .= '</center>';
            }
            if (!$hasBorder) {
                $ret .= '<!--[if mso]>';
            }
            $ret .= '</v:' . $tagName . '>
        <![endif]-->';
            //add a button with border hidden for MSO
            if ($hasBorder) {
                $ret .= $innerWithBorder;
            }
            return $smarty->fetch('string:' . $ret);
        }
    }
}
コード例 #9
0
ファイル: block.td.php プロジェクト: implico/email-framework
function smarty_block_td($params, $content, Smarty_Internal_Template $template, &$repeat)
{
    $ret = '';
    $smarty = $template->smarty;
    $repeatCss = $smarty->getConfigVars('repeatAttrInCss');
    $noFont = isset($params['noFont']) ? $params['noFont'] : !$smarty->getConfigVars('fontStyleTdTag');
    $par = new Params($params);
    $par->setParams([], ['width' => $smarty->getConfigVars('tdWidth'), 'height' => false, 'colspan' => 1, 'align' => $smarty->getConfigVars('tdAlign'), 'valign' => $smarty->getConfigVars('tdValign'), 'padding' => 0, 'overflow' => $smarty->getConfigVars('tdOverflow'), 'bgcolor' => false, 'lineHeight' => $smarty->getConfigVars('tdLineHeight'), 'borderRadius' => false, 'noFont' => $noFont, 'fontFamily' => $noFont ? false : $smarty->getConfigVars('fontFamily'), 'fontSize' => $noFont ? false : $smarty->getConfigVars('fontSize'), 'fontColor' => $noFont ? false : $smarty->getConfigVars('fontColor'), 'style' => false, 'id' => false, 'class' => false, 'attrs' => false]);
    // only output on the closing tag
    if (!$repeat) {
        if (isset($content)) {
            if ($par['width'] === "") {
                $par['width'] = $smarty->getConfigVars('lWidth');
            }
            //shorthand
            if ($par['overflow'] === true) {
                $par['overflow'] = 'hidden';
            }
            $ret .= "<td";
            $ret .= SmartyUtils::addAttr('width', $par['width']);
            $widthCss = SmartyUtils::unitPx($par['width']);
            $ret .= SmartyUtils::addAttr('height', $par['height']);
            if ($par['colspan'] > 1) {
                $ret .= SmartyUtils::addAttr('colspan', $par['colspan']);
            }
            $ret .= SmartyUtils::addAttr('valign', $par['valign']);
            $ret .= SmartyUtils::addAttr('align', $par['align']);
            $ret .= SmartyUtils::addAttr('bgcolor', $par['bgcolor']);
            $style = '';
            if ($repeatCss) {
                $style .= SmartyUtils::addCss('width', $widthCss);
                if ($par['height'] !== false) {
                    $style .= SmartyUtils::addCss('height', $par['height'] . 'px');
                }
                $style .= SmartyUtils::addCss('vertical-align', $par['valign']);
                $style .= SmartyUtils::addCss('text-align', $par['align']);
            }
            if ($smarty->getConfigVars('outlookCss') && $par['lineHeight'] !== false) {
                $style .= "mso-line-height-rule:exactly;";
            }
            if ($repeatCss || !$par->isDefault('padding')) {
                $style .= SmartyUtils::addCss('padding', $par['padding']);
            }
            $style .= SmartyUtils::addCss('overflow', $par['overflow']);
            $style .= SmartyUtils::addCss('background', $par['bgcolor']);
            $style .= SmartyUtils::addCss('line-height', $par['lineHeight']);
            $style .= SmartyUtils::addCss('border-radius', $par['borderRadius']);
            $style .= SmartyUtils::addCss('font-family', $par['fontFamily']);
            if ($par['fontSize'] !== false) {
                $par['fontSize'] = $par['fontSize'] . 'px';
            }
            $style .= SmartyUtils::addCss('font-size', $par['fontSize']);
            $style .= SmartyUtils::addCss('color', $par['fontColor']);
            if ($par['style']) {
                $style .= $par['style'];
            }
            if (strlen($style)) {
                $ret .= ' style="' . $style . '"';
            }
            $ret .= SmartyUtils::getAttrs($par['id'], $par['class'], $par['attrs']);
            $ret .= ">{$content}</td>";
            return $ret;
        }
    }
}