/**
  * Write the Template Object strings ready for template display
  *
  * @param string $mask A mask to write each line via "sprintf()"
  * @return string The string to display fot this template object
  */
 public function write($mask = '%s')
 {
     $content = '';
     foreach ($this->get() as $entry) {
         $content .= $entry . "\n";
     }
     $str = sprintf($mask, Html::writeHtmlTag('script', $content));
     return $str;
 }
Esempio n. 2
0
 /**
  * Write minified versions of the files stack in the cache directory
  *
  * @param string $mask A mask to write each line via "sprintf()"
  * @return string The string to display fot this template object
  */
 public function writeMinified($mask = '%s')
 {
     $str = '';
     foreach ($this->cleanStack($this->getMinified(), 'file') as $entry) {
         $tag_attrs = array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $entry['file']);
         if (isset($entry['media']) && !empty($entry['media']) && $entry['media'] != 'screen') {
             $tag_attrs['media'] = $entry['media'];
         }
         $str .= sprintf($mask, Html::writeHtmlTag('link', null, $tag_attrs, true));
     }
     return $str;
 }
 /**
  * Returns the full HTML `script`
  *
  * @return string
  */
 public function __toHtml()
 {
     try {
         $this->parse();
         $str = \Library\Helper\Html::writeHtmlTag('script', null, array('src' => $this->transformed_data['src'], 'type' => $this->transformed_data['type']), true);
     } catch (\Exception $e) {
         $str = $e->getMessage();
     }
     return $str;
 }
Esempio n. 4
0
 /**
  * Write the Template Object strings ready for template display
  *
  * @param string $mask A mask to write each line via "sprintf()"
  * @return string The string to display fot this template object
  */
 public function write($mask = '%s')
 {
     $str = '';
     foreach ($this->cleanStack($this->get()) as $entry) {
         $str .= (strlen($str) > 0 ? $this->separator : '') . $entry;
     }
     $title_str = Html::writeHtmlTag('title', strip_tags($str));
     return sprintf($mask, $title_str);
 }
Esempio n. 5
0
 /**
  * Write the Template Object strings ready for template display
  *
  * @param string $mask A mask to write each line via "sprintf()"
  * @return string The string to display fot this template object
  */
 public function write($mask = '%s')
 {
     $str = '';
     foreach ($this->cleanStack($this->get(), 'name') as $entry) {
         $tag_attrs = array();
         if (true === $entry['http-equiv']) {
             $tag_attrs['http-equiv'] = $entry['name'];
         } else {
             $tag_attrs['name'] = $entry['name'];
         }
         $tag_attrs['content'] = $entry['content'];
         $tag = Html::writeHtmlTag('meta', null, $tag_attrs, true);
         if (isset($entry['condition']) && !empty($entry['condition'])) {
             $tag = ConditionalComment::buildCondition($tag, $entry['condition']);
         }
         $str .= sprintf($mask, $tag);
     }
     return $str;
 }
 /**
  * Write minified versions of the files stack in the cache directory
  */
 public function writeMinified($mask = '%s')
 {
     $str = '';
     foreach ($this->cleanStack($this->getMinified(), 'path') as $entry) {
         $tag_attrs = array('type' => 'text/javascript', 'src' => $entry['path']);
         $str .= sprintf($mask, Html::writeHtmlTag('script', null, $tag_attrs));
     }
     return $str;
 }
Esempio n. 7
0
 /**
  * Write the Template Object strings ready for template display
  *
  * @param string $mask A mask to write each line via "sprintf()"
  * @return string The string to display fot this template object
  */
 public function write($mask = '%s')
 {
     $str = '';
     // allow multi same links
     //        foreach($this->cleanStack( $this->get(), 'rel' ) as $entry) {
     foreach ($this->get() as $entry) {
         $str .= sprintf($mask, Html::writeHtmlTag('link', null, $entry, true));
     }
     return $str;
 }