Example #1
0
 public function render($tabulations)
 {
     Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
     echo $tabulations . '<!--' . "\n";
     echo $tabulations . '	' . $this->m_content . "\n";
     echo $tabulations . '-->' . "\n";
 }
Example #2
0
 public function addBlock($p_block)
 {
     Assert::type(__METHOD__, '$p_block instanceof Block', $p_block instanceof Block);
     Assert::precondition(__METHOD__, 'in_array($p_block, $this->m_blocks, true) == false', in_array($p_block, $this->m_blocks, true) == false);
     $this->m_blocks[] = $p_block;
     foreach ($p_block->getSettings() as $setting) {
         $this->m_settings[] = $setting;
     }
     return $this;
 }
Example #3
0
 public function render($tabulations)
 {
     Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
     Debug::startTimer('render');
     //	m_attributes serialization
     $attributes = '';
     foreach ($this->m_attributes as $attribute => $value) {
         $attributes = $attributes . ' ' . $attribute . '="' . $value . '"';
     }
     echo $tabulations . '<link' . $attributes . '>' . "\n";
     Debug::stopTimer('render');
 }
Example #4
0
 public static function unsecure($variable)
 {
     Assert::type(__METHOD__, 'is_string($variable) || is_array($variable) || is_null($variable) || is_numeric($variable)', is_string($variable) || is_array($variable) || is_null($variable) || is_numeric($variable));
     if (is_string($variable)) {
         return htmlspecialchars_decode($variable, ENT_QUOTES);
     } else {
         if (is_array($variable) && !empty($variable)) {
             foreach ($variable as $key => $value) {
                 $variable[$key] = self::unsecure($value);
             }
         }
     }
     return $variable;
 }
Example #5
0
 public function setView($p_view)
 {
     Assert::type(__METHOD__, '$p_view instanceof View', $p_view instanceof View);
     unset($this->m_view);
     //	Destruction of the previous reference to avoid any conflict with the new one
     $this->m_view = $p_view;
     return $this;
 }
Example #6
0
 public function run($options = array())
 {
     Assert::type(__METHOD__, 'is_array($options)', is_array($options));
     foreach ($this->m_blocks as $block) {
         $this->state = $block->process($this->state, $options);
     }
     echo "<!DOCTYPE html>\n";
     echo "\t<html>\n";
     echo "\t\t<head>\n";
     foreach ($this->m_metas as $meta) {
         $meta->render('			');
     }
     foreach ($this->m_links as $link) {
         $link->render('			');
     }
     foreach ($this->m_scripts as $script) {
         $script->render('			');
     }
     echo "\t\t\t<title>" . $this->m_title . "</title>\n";
     echo "\t\t</head>\n";
     echo "\t\t<body>\n";
     foreach ($this->m_blocks as $block) {
         $block->render('			');
     }
     echo "\t\t</body>\n";
     echo "\t</html>\n";
 }
Example #7
0
 public function __construct($p_settings)
 {
     Assert::type(__METHOD__, 'is_array($p_settings)', is_array($p_settings));
     $this->m_settings = $p_settings;
 }
Example #8
0
 public function render($tabulations)
 {
     Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
     Debug::startTimer('render');
     $singleTags = array('input', 'br', 'hr', 'img', 'meta', 'link');
     //	m_attributes serialization
     $attributes = '';
     foreach ($this->m_attributes as $attribute => $value) {
         $attributes = $attributes . ' ' . $attribute . '="' . $value . '"';
     }
     //	<tag> type HTML tags
     if (in_array($this->m_tag, $singleTags)) {
         echo $tabulations . '<' . $this->m_tag . ' ' . $attributes . '>' . "\n";
     } else {
         echo $tabulations . '<' . $this->m_tag . $attributes . ">\n";
         if ($this->m_content != '') {
             echo $tabulations . '	' . $this->m_content . "\n";
         }
         foreach ($this->m_components as $component) {
             $component->render($tabulations . '	');
         }
         echo $tabulations . '</' . $this->m_tag . ">\n";
     }
     Debug::stopTimer('render');
 }
Example #9
0
 public function render($tabulations, $outputs)
 {
     Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
     Assert::type(__METHOD__, 'is_array($outputs)', is_array($outputs));
     $this->build($outputs);
     if (!empty($this->m_components)) {
         foreach ($this->m_components as $component) {
             $component->render($tabulations);
         }
     }
 }