here() публичный статический Метод

public static here ( )
 public function check()
 {
     if (!$this->authorized()) {
         $this->auth->setAction(Mapper::here());
         $this->auth->error($this->auth->authError);
         $this->controller->redirect($this->auth->loginAction);
         return false;
     }
     return true;
 }
Пример #2
0
 public function isPublic()
 {
     $here = Mapper::here();
     $authorized = $this->authorized;
     foreach ($this->permissions as $url => $permission) {
         if (Mapper::match($url, $here)) {
             $authorized = $permission;
         }
     }
     return $authorized;
 }
Пример #3
0
 public function menu($array = array())
 {
     $html = '<ul>' . PHP_EOL;
     foreach ($array as $label => $link) {
         $class = trim(Mapper::here(), '/') == trim($link, '/') ? ' class="selected" ' : '';
         $class = Mapper::match($link) ? ' class="selected" ' : '';
         $listclass = $this->applyClassOn == 'list' ? $class : '';
         $html .= '<li' . $listclass . '>';
         if (is_array($link)) {
             $html .= $label;
             $html .= $this->menu($link);
         } else {
             $linkclass = $this->applyClassOn == 'link' ? $class : '';
             $html .= '<a href="' . Mapper::url($link) . $linkclass . '" >' . $label . '</a>';
         }
         $html .= '</li>' . PHP_EOL;
     }
     $html .= '</ul>' . PHP_EOL;
     return $html;
 }
Пример #4
0
 /**
  *  Faz a interpretação da URL, identificando as partes da URL.
  * 
  *  @param string $url URL a ser interpretada
  *  @return array URL interpretada
  */
 public function parseUrl($url = null)
 {
     $here = Mapper::normalize(is_null($url) ? Mapper::here() : $url);
     $url = Mapper::getRoute($here);
     $prefixes = join("|", Mapper::getPrefixes());
     $parts = array("here", "prefix", "controller", "action", "id", "extension", "params");
     preg_match("/^\\/(?:({$prefixes})(?:\\/|(?!\\w)))?(?:([a-z_-]*)\\/?)?(?:([a-z_-]*)\\/?)?(?:(\\d*))?(?:\\.([\\w]+))?(?:\\/?(.*))?/i", $url, $reg);
     foreach ($parts as $k => $key) {
         $this->path[$key] = $reg[$k];
     }
     $this->path["namedParams"] = $this->path["params"] = array();
     foreach (split("/", $reg[6]) as $param) {
         if (preg_match("/([^:]*):([^:]*)/", $param, $reg)) {
             $this->path["namedParams"][$reg[1]] = urldecode($reg[2]);
         } elseif ($param != "") {
             $this->path["params"][] = urldecode($param);
         }
     }
     $this->path["here"] = $here;
     if (empty($this->path["controller"])) {
         $this->path["controller"] = Mapper::getRoot();
     }
     if (empty($this->path["action"])) {
         $this->path["action"] = "index";
     }
     if (!empty($this->path["prefix"])) {
         $this->path["action"] = "{$this->path['prefix']}_{$this->path['action']}";
     }
     if (empty($this->path["id"])) {
         $this->path["id"] = null;
     }
     if (empty($this->path["extension"])) {
         $this->path["extension"] = Config::read("defaultExtension");
     }
     return $this->path;
 }
Пример #5
0
 /**
  * Inicia uma tag form
  *    
  * @param string $name O nome do formulário
  * @return $this
  */
 public function form($name = 'form')
 {
     $this->nowfield = $name;
     $this->fields[] = $name;
     $this->configs[$name] = array('field' => 'form', 'opening' => true, 'uses_label' => false, 'has_more' => 'after');
     // 'after': Sim, depois eu fecho/ 'none': não,
     // pode fechar/ 'value': tenho um valor, e só.
     $this->attr('method', 'POST')->attr('action', Mapper::url(Mapper::here()))->attr('name', $name)->attr('id', $name);
     return $this;
 }
Пример #6
0
 * For ease of development EasyFW uses PHP's include_path.  If you
 * cannot modify your include_path set this value.
 *
 * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
 */
//defined('EASY_CORE_INCLUDE_PATH') || define('EASY_CORE_INCLUDE_PATH', FRAMEWORK_PATH . 'Lib' . DS . 'Easy' . DS);
/**
 * Editing below this line should NOT be necessary.
 * Change at your own risk.
 *
 */
if (!defined('EASY_CORE_INCLUDE_PATH')) {
    if (function_exists('ini_set')) {
        ini_set('include_path', FRAMEWORK_PATH . 'Lib' . PATH_SEPARATOR . ini_get('include_path'));
    }
    if (!(include 'Easy' . DS . 'bootstrap.php')) {
        $failed = true;
    }
} else {
    if (!(include EASY_CORE_INCLUDE_PATH . 'bootstrap.php')) {
        $failed = true;
    }
}
if (!empty($failed)) {
    trigger_error(__("EasyFW core could not be found.  Check the value of EASY_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to the directory containing your " . DS . "easy core directory and your " . DS . "vendors root directory."), E_USER_ERROR);
}
App::uses('Dispatcher', 'Routing');
App::uses('Mapper', 'Routing');
$dispatcher = new Dispatcher();
$dispatcher->dispatch(new Request(Mapper::here()), new Response(array('charset' => Config::read('App.encoding'))));