Пример #1
0
 public function output()
 {
     if ($this->output) {
         $output = $this->output;
         //Lets Replace all Instances of <!--{{MODULE POST}}-->
         preg_match_all('/<!--{{(.*)}}-->/Uis', $output, $matches, PREG_SET_ORDER);
         if ($matches) {
             foreach ($matches as $match) {
                 $res = $this->getChild('common/custom_position', $match[1]);
                 if ($res) {
                     $output = str_replace($match[0], $res, $output);
                 }
             }
         }
         $output = \Core\Shortcode::doShortcode($output);
         $doc = \Core\Registry::getInstance()->get('document');
         $scripts = $doc->getScripts();
         if ($scripts) {
             $html = '';
             foreach ($scripts as $script) {
                 $html .= '<script type="text/javascript" src="' . $script . '"></script>';
             }
             $output = str_replace('<!-- Custom JS -->', $html, $output);
         }
         $styles = $doc->getStyles();
         if ($styles) {
             $html = '';
             foreach ($styles as $style) {
                 $html .= '<link rel="' . $style['rel'] . '" type="text/css" href="' . $style['href'] . '" media="' . $style['media'] . '" />';
             }
             $output = str_replace('<!-- Custom CSS -->', $html, $output);
         }
         $metas = $doc->getMeta();
         if ($metas) {
             $html = '';
             foreach ($metas as $meta) {
                 $html .= '<meta ' . $meta['meta'] . '="' . $meta['key'] . '" content="' . $meta['value'] . '" />' . "\n";
             }
             $output = str_replace('<!-- Custom META -->', $html, $output);
         }
         \Core\Registry::getInstance()->get('event')->trigger('before.render', $output);
         if ($this->level) {
             $output = $this->compress($output, $this->level);
             $this->addHeader('Content-Length: ' . strlen($output));
         }
         if (!headers_sent()) {
             foreach ($this->headers as $header) {
                 header($header, true);
             }
         }
         echo $output;
     }
 }
Пример #2
0
function add_shortcode($tag, $func)
{
    \Core\Shortcode::addShortcode($tag, $func);
}
Пример #3
0
 public function div_color($attribs, $innercontent = '')
 {
     $attribs = \Core\Shortcode::shortcodeAtts(array('textcolor' => "#cc0000"), $attribs);
     $html = '<div style="color:' . $attribs['textcolor'] . '">' . $innercontent . '</div>';
     return $html;
 }