Example #1
0
 /**
  * show.
  *
  * @return string anchor element
  */
 public function show()
 {
     if ($this->src == '#') {
         $src = '#';
     } else {
         $src = !preg_match('#^\\w+\\:\\/\\/#', $this->src) ? Configure::siteurl($this->src) : $this->src;
     }
     $text = empty($this->text) ? $src : $this->text;
     $title = empty($this->title) ? $text : $this->title;
     if ($this->autoActive === true) {
         if ($href == Request::currenturl()) {
             $this->addAttr('class', 'active');
         }
     }
     $this->addAttr('title', $title)->addAttr('href', $src);
     return "<a{$this->htmlAttribute}>{$text}</a>";
 }
Example #2
0
 /**
  * redirect.
  *
  * @param   string dynamic/static url
  *
  * @return string fixed url
  */
 public static function redirect($target)
 {
     $url = !preg_match('#^\\w+\\:\\/\\/#', $target) ? Configure::siteurl($target) : $target;
     if (!headers_sent()) {
         header("Location: {$url}");
         exit;
     }
     printf('<script type="text/javascript">window.location.href = "%s";</script>', $url);
 }
Example #3
0
 /**
  * currenturl.
  *
  * @return bool
  */
 public static function currenturl()
 {
     $uriString = self::parseRequestUri();
     $query = Configure::server('query_string');
     return empty($query) ? Configure::siteurl($uriString) : Configure::siteurl("/{$uriString}?{$query}");
 }