Пример #1
0
 /**
  * Returns the content from a given template
  *
  * @param string $template The template to use.
  * @param array[optional] $variables The variabled to assign.
  * @return string
  */
 private static function getTemplateContent($template, $variables = null)
 {
     // new template instance
     $tpl = new BackendTemplate(false);
     // set some options
     $tpl->setForceCompile(true);
     // variables were set
     if (!empty($variables)) {
         $tpl->assign($variables);
     }
     // grab the content
     $content = $tpl->getContent($template);
     // replace internal links/images
     $search = array('href="/', 'src="/');
     $replace = array('href="' . SITE_URL . '/', 'src="' . SITE_URL . '/');
     $content = str_replace($search, $replace, $content);
     // require CSSToInlineStyles
     require_once 'external/css_to_inline_styles.php';
     // create instance
     $cssToInlineStyles = new CSSToInlineStyles();
     // set some properties
     $cssToInlineStyles->setHTML($content);
     $cssToInlineStyles->setUseInlineStylesBlock(true);
     $cssToInlineStyles->setEncoding(SPOON_CHARSET);
     // return the content
     return (string) $cssToInlineStyles->convert();
 }