Checks whether a menu item is active.
@param array $item the menu item to be checked.
@param string $route the route of the current request.
@return boolean whether the menu item is active.
324657
protected function isItemActive($item, $route)
    {
        if (isset($item['url']) && is_array($item['url']) && !strcasecmp(trim($item['url'][0], '/'), $route)) {
            unset($item['url']['#']);
            if (count($item['url']) > 1) {
                foreach (array_splice($item['url'], 1) as $name => $value) {
                    if (!isset($_GET[$name]) || $_GET[$name] != $value) {
                        return false;
                    }
                }
            }
            return true;
        }
        return false;
    }
480415
protected function constraintsAreSatisfied(Route $route): bool
	{
		foreach(array_merge($this->globalConstraints, $route->getConstraints()) as $constraint)
		{
			if($this->constraintFactory($constraint)->isSatisfied() === false)
			{
				return false;
			}
		}

		return true;
	}
576003
private function _isLink($item): bool
	{
		if ($item === null) {
			return true;
		} elseif (is_array($item)) {
			return !is_array(current($item));
		} else {
			throw new \InvalidArgumentException('Cms menu items is wrong in config.neon');
		}
	}
1023258
protected function isValidRoute()
    {
        try {

            $current = Route::current();
            if (!$current) {
                return false;
            }
            $action = $current->action;
            $as     = array_get($action, 'as');
            return str_contains($as, 'show') or str_contains($as, 'dashboard');
        } catch (Exception $ex) {
            return false;
        }
    }
99445
protected function isNotSameRouteHost(Route $route): bool
    {
        if ($this->host === null && $route->getHost() === null) {
            return false;
        }

        if ($this->host === null && $route->getHost() !== null) {
            return true;
        }

        return !$route->isSameHost($this->host, $this->hostConstraints);
    }
749772
protected function prepareValidRoute($route, $item, $query, array $options)
    {
        if (!!Arr::get($options, 'csrf', false)) {
            $query .= (!empty($query) ? '&' : '' ) . '_token=' . $this->app->make('session')->token();
            unset($options['csrf']);
        }
        if (!!Arr::get($options, 'sandbox', false)) {
            $query .= (!empty($query) ? '&' : '' ) . 'sandbox=' . Arr::get($options, 'sandbox');
            unset($options['sandbox']);
        }
        if (!empty($options)) {
            if (isset($options['sandbox']) && $options['sandbox'] == false) {
                unset($options['sandbox']);
            }
            $query .= (!empty($query) ? '&' : '' ) . http_build_query($options);
        }
        !empty($item) && $route = "{$route}.{$item}";
        empty($route) && $route = '';
        empty($query) || $route = "{$route}?{$query}";


        return $route;
    }
825149
public function shouldBeIncluded($item)
    {
        if (!is_object($item)) {
            return false;
        }

        $pageId = $this->getPageId($item);
        $showInMenu = get_field('hide_in_menu', $pageId) ? !get_field('hide_in_menu', $pageId) : true;
        $isNotTopLevelItem = !($item->post_type === 'page' && isset($item->post_parent) && $item->post_parent === 0);
        $showTopLevel = $this->args['include_top_level'];

        return ($showTopLevel || $isNotTopLevelItem) && $showInMenu;
    }
543277
public function checkRoute($route,$active=null,$inactive=null)
    {
        $this->setReturnValue($active,$inactive);

        if (is_array($route)) {
            $result = call_user_func_array(array($this,'routeIsDeeply'), $route);
        } else {
            $result = $this->routeIsDeeply($route);   
        }

        return $result ? $this->activeValue : $this->inActiveValue;
    }
644575
public function getActive($slug)
    {
        $bc = $this->getBreadCrumb();
        foreach ($bc as $bcItem) {
            if ($bcItem->getSlug() == $slug) {
                return true;
            }
        }

        return false;
    }
290151
public function isActive()
    {
        if ($this->inactive()) {
            return false;
        }

        $active = $this->getActiveAttribute();

        if (is_bool($active)) {
            return $active;
        }

        if ($active instanceof \Closure) {
            return call_user_func($active);
        }

        if ($this->hasRoute()) {
            return $this->getActiveStateFromRoute();
        }

        return $this->getActiveStateFromUrl();
    }
1341147
public function getPermFromRoute($route) {
    $menu_info = Config::get($this->config_path);

    foreach ($menu_info as $menu) {
      if ($menu[$this->route_variable_index] == $route) {
        return $menu[$this->pemissions_variable_index];
      }
    }
  }
556846
public function match($route, $method = 'GET', $options = [])
    {
        $this->count = 0;

        foreach ($this->routes as $routeItem) {
            $this->count++;

            if (!$this->matchOptions($routeItem, $method, $options)) {
                continue;
            }

            if ($this->matchRoute($route, $routeItem)) {
                return $routeItem;
            }
        }

        return false;
    }
1312613
protected function _execute($route) {
		Permit::$executed = $this->executed = $route;

		if (empty($route['rules'])) {
			return false;
		}

		if (isset($route['rules']['deny'])) {
			return $route['rules']['deny'] == true;
		}

		if (!isset($route['rules']['auth'])) {
			return false;
		}

		if (is_bool($route['rules']['auth'])) {
			$isAuthed = $this->Session->read("{$this->settings['path']}.{$this->settings['check']}");

			if ($route['rules']['auth'] == true && !$isAuthed) {
				return true;
			}

			if ($route['rules']['auth'] == false && $isAuthed) {
				return true;
			}

			return false;
		} elseif (!is_array($route['rules']['auth'])) {
			return false;
		}

		if ($this->user == false) {
			return true;
		}

		$fieldsBehavior = 'and';
		if (!empty($route['rules']['fields_behavior'])) {
			$fieldsBehavior = strtolower($route['rules']['fields_behavior']);
		}

		if (!in_array($fieldsBehavior, array('and', 'or'))) {
			$fieldsBehavior = 'and';
		}

		$count = count(Set::flatten($route['rules']['auth']));
		foreach ($route['rules']['auth'] as $path => $condition) {
			$path = '/' . str_replace('.', '/', $path);
			$path = preg_replace('/^([\/]+)/', '/', $path);

			$check = $condition;
			$continue = false;
			$decrement = 1;
			$values = Set::extract($path, $this->user);

			// Support for OR Model-syntax
			foreach (array('or', 'OR') as $anOr) {
				if (is_array($condition) && array_key_exists($anOr, $condition)) {
					$check = $condition[$anOr];
					$continue = true;
					$decrement = count($check);
				}
			}

			if ($fieldsBehavior == 'or') {
				$check = $condition;
				$continue = true;
				$decrement = count($check);
			}

			foreach ((array)$check as $cond) {
				if (in_array($cond, (array)$values)) {
					$count -= $decrement;
					if ($continue) {
						continue 2;
					}
				}
			}
		}

		return $count !== 0;
	}
674766
public function isSideMenuItemActive($item)
    {
        if ($this->contextSideMenuItemCode === true) {
            $this->contextSideMenuItemCode = null;
            return true;
        }

        return $this->contextOwner == $item->owner && $this->contextSideMenuItemCode == $item->code;
    }
534747
protected function checkIfProtected($item)
    {
        $this->performProtectedCheck($item);

        if (!is_string($item)) {
            return;
        }

        $prefix = $item;
        while (false !== $pos = strrpos($prefix, '.')) {
            $prefix = substr($item, 0, $pos);
            $this->performProtectedCheck($prefix);
            $prefix = rtrim($prefix, '.');
        }
    }
293380
private function IsActive()
    {
        $pageItem = $this->naviItem->GetPageItem();
        if (!$pageItem)
        {
            return false;
        }
        return $pageItem->GetPage()->Equals(PageRenderer::Page());
    }
793023
protected function filterByVersions(array $route)
    {
        foreach ($this->option('versions') as $version) {
            if (Str::contains($route['versions'], $version)) {
                return true;
            }
        }

        return false;
    }