本文整理汇总了PHP中Mapper::match方法的典型用法代码示例。如果您正苦于以下问题:PHP Mapper::match方法的具体用法?PHP Mapper::match怎么用?PHP Mapper::match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapper
的用法示例。
在下文中一共展示了Mapper::match方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get(array $hashMap, $isNestedKeysName = false)
{
$pattern = $this->getPattern($isNestedKeysName);
$this->mapper->match($pattern, [$hashMap]);
$data = $this->mapper->current();
if (empty($data)) {
$result = $this->getEmptyArray($pattern);
} else {
$result = $this->arrayHelper->toTuple($data, $pattern);
}
return $result;
}
示例2: authorizedUser
public function authorizedUser()
{
$here = Mapper::here();
$user = $this->auth->user($this->auth->fields["username"]);
foreach ($this->userPermissions[$user] as $permission) {
if (Mapper::match($permission, $here)) {
return true;
}
}
return false;
}
示例3: 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;
}
示例4: 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;
}
示例5: match
/**
* Testa se a url informada é pai da atual.
* Alimenta o currentUrl para ser usado posteriormente
*
* @version 0.1 02/11/2010
* - Initial
* @param
* @return
*/
protected function match($row)
{
if (Mapper::match($row['href'])) {
$this->currentUrl = $row;
return true;
}
return false;
}
示例6: fetch
/**
* Busca no banco de dados de acordo com o submenu informado
*
* @version 0.1 11/06/2011 Initial
* 0.2 13/06/2011 Transformado em private
*/
private function fetch()
{
$this->results = $this->modelObject->all(array('conditions' => array('submenu' => $this->subMenuName)));
if (!empty($this->results)) {
foreach ($this->results as $result) {
if ($ma = Mapper::match($result['url'])) {
$this->current = $result;
if (!empty($this->pageTitle)) {
$this->current['label'] = $this->pageTitle;
}
}
#menuBuffer agrupa os elementos do menu pelos seus parent_id
$this->menuBuffer[$result['parent_id']][] = $result;
#breadcrumbsBuffer
$this->breadcrumbsBuffer[$result['id']] = $result;
}
#Adiciona o ítem atual à lista de breadcrumbs
$this->breadcrumbsItems[] = $this->current;
#Cria o $this->breadcrumbsItems
$this->organizeBreadcrumbs($this->current['parent_id']);
#Limpa os resultados da busca, dos breadcrumbs, etc, liberando memória
$this->results = array();
}
}