本文整理汇总了PHP中Mapper::here方法的典型用法代码示例。如果您正苦于以下问题:PHP Mapper::here方法的具体用法?PHP Mapper::here怎么用?PHP Mapper::here使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapper
的用法示例。
在下文中一共展示了Mapper::here方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check
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: isPublic
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: menu
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: parseUrl
/**
* 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: form
/**
* 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: ini_set
* 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'))));