Esempio n. 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>";
 }
Esempio n. 2
0
 /**
  * catchValue.
  *
  * @param	string field name
  * @param	array|string value(s)
  * @param	Any default value
  *
  * @return Any
  */
 public function catchValue($field, $default = null)
 {
     if ('post' == Request::method('strtolower') || !isset($_POST[$field])) {
         return $default;
     }
     return $_POST[$field];
 }
Esempio n. 3
0
 /**
  * run
  * execute or running the application.
  */
 public function run()
 {
     $this->dispatcher->dispatch(Http\Request::createFromGlobals(), Configure::read('url_suffix'));
     $handler = $this->dispatcher->fetchHandler();
     if (empty($handler)) {
         throw new Exception('handler does not found');
     }
     try {
         $reflection = new ReflectionFunction($handler);
         $output = $reflection->invoke($this->dispatcher->fetchParams());
         $this->response->send($output);
     } catch (ReflectionException $e) {
         Debugger::handleException($e);
     }
 }