示例#1
0
 public static function Anchor($uri, $title = NULL, $attributes = NULL, $protocol = NULL, $escape_title = FALSE)
 {
     /**
      * Create HTML link anchors.
      *
      * @param   string  URL or URI string
      * @param   string  link text
      * @param   array   HTML anchor attributes
      * @param   string  non-default protocol, eg: https
      * @param   boolean option to escape the title that is output
      * @return  string
      */
     if ($protocol === NULL) {
         $protocol = getenv('HTTPS') == 'on' ? 'https' : 'http';
     }
     if (strpos($uri, '#') === 0) {
         // This is an id target link, not a URL
         $site_url = $uri;
     } elseif (strpos($uri, '://') === FALSE) {
         $site_url = Uri::baseUrl() . $uri;
     } else {
         //$attributes['target'] = '_blank';
         $site_url = $uri;
     }
     return '<a href="' . $site_url . '"' . (is_array($attributes) ? htmlAttributes($attributes) : '') . '>' . ($escape_title ? htmlspecialchars($title === NULL ? $site_url : $title, ENT_QUOTES, 'UTF-8', FALSE) : ($title === NULL ? $site_url : $title)) . '</a>';
 }
示例#2
0
 function __construct()
 {
     // generates the user class and determines what we are doing
     //session_name($this->config['site']['cookie']);
     //session_start();
     $this->baseUri = Uri::baseUrl();
     $this->set_actions();
     if (isset($_GET['logout'])) {
         $this->logout();
     } elseif (isset($_POST['nonce'])) {
         if ($this->nonce('login') == $_POST['nonce']) {
             $this->login();
         } elseif ($this->nonce('signup') == $_POST['nonce']) {
             $this->signup();
         } elseif ($this->nonce('change') == $_POST['nonce']) {
             $this->change();
         } elseif ($this->nonce('edit') == $_POST['nonce']) {
             $this->edit();
         } else {
             $this->fail("Please try again");
         }
     } elseif (isset($_GET['activate'])) {
         $this->activate();
     }
 }