match() public static method

public static match ( $check, $url = null )
Esempio n. 1
0
 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;
 }
 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;
 }
Esempio n. 3
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;
 }
Esempio n. 4
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;
 }
Esempio n. 5
0
 /**
  * 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;
 }
Esempio n. 6
0
 /**
  * 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();
     }
 }