function smarty_block_contentPlaceholder($params, $content, Smarty_Internal_Template $template, $open)
{
    if ($open) {
        return '';
    } else {
        return CM_Frontend_TemplateHelper_ContentPlaceholder::create($content, $params['width'], $params['height'], isset($params['stretch']) ? ' stretch' : false);
    }
}
Example #2
0
 /**
  * @param string $tagText
  * @return string
  * @throws CM_Exception_Invalid
  */
 private function _transformToLazyImages($tagText)
 {
     $tagText = preg_replace_callback('/^<img src="([^"]+)" alt="([^"]+)"(?: title="(?:[^"]+)?")?(?: class="([^"]+)")?(?: width="(\\d+)")?(?: height="(\\d+)")? \\/>$/i', function ($matches) {
         $src = $matches[1];
         $alt = $matches[2];
         if (count($matches) > 5) {
             $width = (int) $matches[4];
             $height = (int) $matches[5];
             if ($width > 0 && $height > 0) {
                 $class = $matches[3] ? 'lazy ' . $matches[3] : 'lazy';
                 $imgHtml = '<img data-original="' . $src . '" alt="' . $alt . '" class="' . $class . '"/>';
                 return '<div class="usertext-image">' . CM_Frontend_TemplateHelper_ContentPlaceholder::create($imgHtml, $width, $height) . '</div>';
             }
             return $matches[0];
         } else {
             return '<div class="usertext-image"><img src="' . $src . '" alt="' . $alt . '"/></div>';
         }
     }, $tagText);
     return $tagText;
 }