Ejemplo n.º 1
0
 /**
  * Injects noparse extractions.
  *
  * This is so that multiple parses can store noparse
  * extractions and all noparse can then be injected right
  * before data is displayed.
  *
  * @param   string    $text    Text to inject into
  * @return  string
  */
 public static function inject_noparse($text)
 {
     return parent::injectNoparse($text);
 }
Ejemplo n.º 2
0
Archivo: view.php Proyecto: nob/joi
 /**
  * _render_layout
  * Renders the page
  *
  * @param string  $_html  HTML of the template to use
  * @param string  $template_type  Content type of the template
  * @return string
  */
 public function _render_layout($_html, $template_type = 'html')
 {
     if (self::$_layout != '') {
         $this->data['layout_content'] = $_html;
         $layout_path = $this->getTemplatesDirectory() . '/' . ltrim(self::$_layout, '/');
         if ($template_type == 'html') {
             if (!file_exists($layout_path . ".html")) {
                 Log::fatal("Can't find the specified theme", 'template');
                 return '<p style="text-align:center; font-size:28px; font-style:italic; padding-top:50px;">We can\'t find your theme files. Please check your settings.';
             }
             Statamic_View::$_dataStore = array_merge(Statamic_View::$_dataStore, $this->data);
             $html = $this->parser->parse(file_get_contents($layout_path . ".html"), Statamic_View::$_dataStore, array($this, 'callback'), true);
             $html = Lex\Parser::injectNoparse($html);
         } else {
             extract($this->data);
             ob_start();
             require $layout_path . ".php";
             $html = ob_get_clean();
         }
         return $html;
     }
     return $_html;
 }
Ejemplo n.º 3
0
 /**
  * _render_layout
  * Renders the page
  *
  * @param string $_html HTML of the template to use
  * @param string $template_type Content type of the template
  * @return string
  */
 public function _render_layout($_html, $template_type = 'html')
 {
     if (self::$_layout) {
         $this->data['layout_content'] = $_html;
         if ($template_type != 'html' or self::$_control_panel) {
             extract($this->data);
             ob_start();
             require self::$_layout . ".php";
             $html = ob_get_clean();
         } else {
             if (!File::exists(self::$_layout . ".html")) {
                 Log::fatal("Can't find the specified theme.", 'core', 'template');
                 return '<p style="text-align:center; font-size:28px; font-style:italic; padding-top:50px;">We can\'t find your theme files. Please check your settings.';
             }
             $this->appendNewData($this->data);
             // Fetch layout and parse any front matter
             $layout = Parse::frontMatter(File::get(self::$_layout . '.html'), false);
             $html = Parse::template($layout['content'], Statamic_View::$_dataStore, array($this, 'callback'));
             $html = Lex\Parser::injectNoparse($html);
         }
     } else {
         $html = $_html;
     }
     // post-render hook
     $html = \Hook::run('_render', 'after', 'replace', $html, $html);
     return $html;
 }
Ejemplo n.º 4
0
 /**
  * _render_layout
  * Renders the page
  *
  * @param string $_html HTML of the template to use
  * @param string $template_type Content type of the template
  * @return string
  */
 public function _render_layout($_html, $template_type = 'html')
 {
     if (self::$_layout != '') {
         $this->data['layout_content'] = $_html;
         $layout_path = Path::assemble(BASE_PATH, Config::getTemplatesPath(), self::$_layout);
         if ($template_type != 'html' or self::$_control_panel) {
             extract($this->data);
             ob_start();
             require $layout_path . ".php";
             $html = ob_get_clean();
         } else {
             if (!File::exists($layout_path . ".html")) {
                 Log::fatal("Can't find the specified theme.", 'core', 'template');
                 return '<p style="text-align:center; font-size:28px; font-style:italic; padding-top:50px;">We can\'t find your theme files. Please check your settings.';
             }
             $this->mergeNewData($this->data);
             $html = Parse::template(File::get($layout_path . ".html"), Statamic_View::$_dataStore, array($this, 'callback'));
             $html = Lex\Parser::injectNoparse($html);
         }
     } else {
         $html = $_html;
     }
     // post-render hook
     $html = \Hook::run('_render', 'after', 'replace', $html, $html);
     return $html;
 }