예제 #1
0
파일: Response.php 프로젝트: jewelhuq/fraym
 /**
  * @param bool $exit
  * @param bool $parseOutput
  * @return $this
  */
 public function finish($exit = true, $parseOutput = false)
 {
     // get the output and eval for precaching
     $content = ob_get_clean();
     if ($parseOutput === true) {
         // Output the source to the client, for dynamic cache we need to eval the output source
         $content = $this->core->evalString($content);
         // Filter the output to assign css or js files, sets title or meta tags
         $content = $this->template->outputFilter($content);
     }
     $this->addHTTPHeader("Content-Length: " . strlen($content));
     foreach ($this->_httpHeaders as $header) {
         $this->sendHTTPHeader($header);
     }
     echo $content;
     if ($exit) {
         exit;
     }
     return $this;
 }
예제 #2
0
 /**
  * @param $xml
  * @return array|string
  */
 private function contentChildViews($xml)
 {
     $childsHtml = array();
     foreach ($xml->children() as $child) {
         $contentId = $this->getContentId($child);
         $blocks = $this->getDataFromBlocksByContentId($contentId);
         // In Editmode we want to render all views to insert content
         if (empty($blocks) && $this->getXMLAttr($child, 'hideEmpty') !== false && $this->block->inEditMode() === false) {
             continue;
         }
         // result returns an array
         $result = $this->contentChildViews($child);
         $addContent = $this->getXMLAttr($child, 'add') ?: 'afterContent';
         if (!isset($childsHtml[$addContent])) {
             $childsHtml[$addContent] = '';
         }
         if (count($result) > 0) {
             $blockhtml = (isset($result['beforeContent']) ? $result['beforeContent'] : '') . $this->core->evalString($blocks) . (isset($result['afterContent']) ? $result['afterContent'] : '');
             if (($this->getXMLAttr($child, 'hideEmpty') === null || $this->getXMLAttr($child, 'hideEmpty') === true) && $this->block->inEditMode() === false && trim($blockhtml) == '') {
                 $childsHtml[$addContent] .= isset($childsHtml[$addContent]) ? $childsHtml[$addContent] : '';
             } else {
                 $childsHtml[$addContent] .= (isset($childsHtml[$addContent]) ? $childsHtml[$addContent] : '') . $this->blockController->createEditViewContentDIV($child, $blockhtml);
             }
         } else {
             $blockhtml = $this->core->evalString($blocks);
             if (($this->getXMLAttr($child, 'hideEmpty') === null || $this->getXMLAttr($child, 'hideEmpty') === true) && $this->block->inEditMode() === false && trim($blockhtml) == '') {
                 $childsHtml[$addContent] .= '';
             } else {
                 $childsHtml[$addContent] .= $this->blockController->createEditViewContentDIV($child, $blockhtml);
             }
         }
     }
     return $childsHtml;
 }
예제 #3
0
파일: Template.php 프로젝트: jewelhuq/fraym
 /**
  * @param null $content
  * @return string
  */
 public function prepareTemplate($content = null)
 {
     if ($content === null) {
         // get the template content
         $content = $this->getTemplateContent();
     }
     $this->currentTemplateContent = $content;
     $this->addParserLog('Start template parsing: ' . $content);
     $content = $this->replaceCustomTemplateFunctions($content);
     $content = $this->replaceTemplateTags($content);
     $this->template = null;
     $vars = $this->getTemplateVarString();
     return $this->core->evalString($vars . $content, true, array(&$this, 'evalErrorHandler'));
 }