Example #1
0
 /**
  * Form Html attributes from array.
  *
  * @false  array   $attributes
  * @param array $attributes
  * @param array $html
  * @return string
  */
 public function addAttributes($attributes, $html = array())
 {
     if (!empty($attributes)) {
         foreach ($attributes as $key => $value) {
             if (!is_null($value)) {
                 $html[] = $key . '="' . Html::entities($value) . '"';
             }
         }
     }
     return count($html) > 0 ? ' ' . implode(' ', $html) : '';
 }
Example #2
0
 /**
  * Generate anchor link
  *
  * @false  string     $url
  * @false  string     $name
  * @false  array   $attributes
  * @param       $url
  * @param null  $name
  * @param array $attributes
  * @return string
  */
 protected function link($url, $name = null, $attributes = array())
 {
     $name = is_null($name) ? $url : $name;
     $this->setLocation($url, strtolower(__FUNCTION__));
     list(, $caller) = debug_backtrace(false);
     $lingTag = '';
     $lingTag = '<a href="' . $this->getBaseUrl() . Html::entities($url) . '"
      ' . $this->addAttributes($attributes) . '>' . Html::entities($name) . '</a>' . PHP_EOL;
     /*
     | If method called statically we will simply return
     | as string
     */
     if ($this->isFacade($caller)) {
         return $this->stripCarriage($lingTag);
     }
     $this->assets[$this->tag[$this->where]][strtolower(__FUNCTION__)][] = $lingTag;
     return $this->assets[$this->tag[$this->where]][strtolower(__FUNCTION__)];
 }
Example #3
0
 /**
  * Generate anchor link.
  *
  * @false  string     $url
  * @false  string     $name
  * @false  array   $attributes
  *
  * @param       $url
  * @param null  $name
  * @param array $attributes
  *
  * @return string
  */
 protected function link($url, $name = null, $attributes = [])
 {
     $name = is_null($name) ? $url : $name;
     $this->setLocation($url, strtolower(__FUNCTION__));
     $lingTag = '';
     $lingTag = '<a href="' . $this->getBaseUrl() . Html::entities($url) . '"
      ' . $this->addAttributes($attributes) . '>' . Html::entities($name) . '</a>' . PHP_EOL;
     /*
     | If method called statically we will simply return
     | as string
     */
     if (isset($attributes['type']) && $attributes['type'] == 'static') {
         return trim($this->stripCarriage($lingTag));
     }
     $this->assets[$this->tag[$this->where]][strtolower(__FUNCTION__)][] = trim($lingTag);
     return $this->assets[$this->tag[$this->where]][strtolower(__FUNCTION__)];
 }
Example #4
0
 /**
  * Escape HTML entities in a string.
  *
  * @param  string  $value
  * @return string
  */
 function e($value)
 {
     return Html::entities($value);
 }