Static helper function to render Navigation.

@param string $navigationSource XML/HTML source, unordered list
@param string $requestedUri     requested URI
@param string $options          Navigation options

@return string
178399
public static function render($navigationFile, $requestedUri = false, $options = null)
    {
        $instance = new Navigation($navigationFile, $requestedUri);
        if ($options) {
            if (isset($options['breadcrumb'])) {
                $temp = $instance->filterBreadcrumb();
                if ($temp) {
                    return $instance->dom->saveXML($temp);
                }
            }
            if (isset($options['range']) && $temp = $instance->filterRange($options['range'])) {
                return $instance->dom->saveXML($temp);
            }
        } else {
            return $instance->dom->saveXML($instance->dom->documentElement);
        }
    }
1342932
public function uri($uri = null)
    {
        $page = $this->findPageByUri($uri);

        abort_if(!$page, '404');

        if ($page->private && !Auth::check()) {
            return redirect()->guest(route(app()->getLocale().'::login'));
        }

        if ($page->redirect && $page->subpages->count() > 0) {
            $childUri = $page->subpages->first()->uri();

            return redirect($childUri);
        }

        // get submenu
        $children = $this->repository->getSubMenu($page->uri);

        $templateDir = 'pages::'.config('typicms.template_dir', 'public').'.';
        $template = $page->template ?: 'default';

        if (!view()->exists($templateDir.$template)) {
            info('Template '.$template.' not found, switching to default template.');
            $template = 'default';
        }

        return response()->view($templateDir.$template, compact('children', 'page'));
    }
608476
public function breadcrumb(String $uri = NULL, Int $segmentCount = -1) 
    {
        $uris = $this->getURIsegments($uri, $segmentCount);
        $list = $this->breadcrumbOlList($uris);

        return $this->breadcrumbNav($list);
    }
834903
public function dispatchCandidateRoutes($requestUri) {
        $expUri = explode('/',$requestUri);
        $similaridades = [];

        if (count($this->candidateRoutes) > 1) {
            foreach ($this->candidateRoutes as $n => $rota) {
                $padrao = $rota->getPattern();
                if (preg_match('/\[:options\]/', $padrao)) {
                    unset($this->candidateRoutes[$n]);
                }
            }
        }

        foreach ($this->candidateRoutes as $n => $rota) {
            $padrao = $rota->getPattern();
            if (preg_match('/\[:options\]/', $padrao)) {
                $this->matchedRoute = $rota;
                $this->candidateRoutes = [];
                return;
            }

            $naoVariaveis = $this->getNonVariables($padrao);

            foreach ($naoVariaveis as $i => $valor) {
                if(!isset($similaridades[$n]))
                    $similaridades[$n] = 0;

                if (isset($expUri[$i]) && $expUri[$i] == $valor) {
                    $similaridades[$n] += 1;
                }
            }
        }

        $bigger = max(array_values($similaridades));
        $mostSimilar = array_search($bigger, $similaridades);
        $this->matchedRoute = $this->candidateRoutes[$mostSimilar];
        $this->candidateRoutes = [];
    }
685098
protected function seePageIs($uri)
    {
        $this->assertPageLoaded($uri = $this->prepareUrlForRequest($uri));

        $this->assertEquals(
            $uri, $this->currentUri, "Did not land on expected page [{$uri}].\n"
        );

        return $this;
    }
322881
public function url($requestedPath) {
		$requestedPath = trim($requestedPath);
		$requestedPath = '/' . ltrim($requestedPath, '/');

		return $this->rootUrl . $requestedPath;
	}
531469
protected function renderNavbarRightMenu(array $options)
    {
        // Get container to use
        $container = $options['rightMenu'];
        $this->parseContainer($container);
        if (null === $container) {
            $container = new Navigation;
        }

        // Set option
        $options['ulClass'] .= ' navbar-right';

        return $this->renderNavbarMenu($container, $options);
    }
143632
function buildHTML(navigation, first, sParentLink) {
    return '<ul class="nav' + (first ? ' sidenav' : '') + '">' + navigation.map(function(loc) {

      if (!loc || !loc.link) return '';
      loc.link = (opts.parentLink && sParentLink ? sParentLink + '-' : '') + loc.link;
      loc.$ele.attr('id', loc.link);

      return '<li><a href="#' + loc.link + '">' + escape(loc.text) + '</a>' + (loc.children ? buildHTML(loc.children, false, loc.link) : '') + '</li>';
    }).join('\n') + '</ul>';
  }
314041
protected function generateNavigation()
    {
        $contexts = [];

        foreach ($this->xpath->query('/x:webspace/x:navigation/x:contexts/x:context') as $contextNode) {
            /* @var \DOMNode $contextNode */
            $contexts[] = new NavigationContext(
                $contextNode->attributes->getNamedItem('key')->nodeValue,
                $this->loadMeta('x:meta/x:*', $contextNode)
            );
        }

        return new Navigation($contexts);
    }
784148
protected function renderNavigation(AbstractContainer $container, array $options)
    {
        // Start html
        $html = $this->renderNavbarContainerHeader($options)
            . $this->renderNavbarMenu($container, $options);

        // Add form if applicable
        if ($options['useForm']) {
            $html .= $this->renderNavbarForm($options);
        }

        // Add right aligned menu
        if ($options['rightMenu']) {
            $html .= $this->renderNavbarRightMenu($options);
        }

        // Finish html
        $html .= $this->renderNavbarContainerFooter();
        return $html;
    }
734022
public function navigation_tree(global_navigation $navigation, $expansionlimit, array $options = array()) {
        $navigation->add_class('navigation_node');
        $navigationattrs = array(
            'class' => 'block_tree list',
            'role' => 'tree',
            'data-ajax-loader' => 'block_navigation/nav_loader');
        $content = $this->navigation_node(array($navigation), $navigationattrs, $expansionlimit, $options);
        if (isset($navigation->id) && !is_numeric($navigation->id) && !empty($content)) {
            $content = $this->output->box($content, 'block_tree_box', $navigation->id);
        }
        return $content;
    }
320962
public function match(CalledUri $calledUri): MatchingRoutes
    {
        $allowedMethods = [];
        $matching       = [];
        foreach ($this->routes as $route) {
            /* @var $route \stubbles\webapp\routing\Route */
            if ($route->matches($calledUri)) {
                return new MatchingRoutes(
                        ['exact' => $route],
                        $route->allowedRequestMethods()
                );
            } elseif ($route->matchesPath($calledUri)) {
                $matching[] = $route;
                $allowedMethods = array_merge(
                        $allowedMethods,
                        $route->allowedRequestMethods()
                );
            }
        }

        return new MatchingRoutes($matching, array_unique($allowedMethods));
    }
1151180
protected function _buildSefRoute(&$uri)
    {
        $option = $uri->getVar('option');
        $menuId = $uri->getVar('Itemid');
        parent::_buildSefRoute($uri);

        if ($option == 'com_symfony' && !empty($menuId) && isset(self::$menuRepository)) {
            /** @var Menu $item */
            $item = self::$menuRepository->find($menuId);
            if ($item !== null) {
                $params = PathMatcher::parseParameters($item->getLink());
                if (isset($params['path'])) {
                    $uri->setPath($params['path']);
                }
            }
        }
    }
158367
public function setUri($uri)
    {
        if (null !== $uri && !is_string($uri)) {
            require_once 'Zend/Navigation/Exception.php';
            throw new Zend_Navigation_Exception(
                    'Invalid argument: $uri must be a string or null');
        }

        $this->_uri = $uri;
        return $this;
    }
79001
function requestURI( $uri )
    {
        $parsed = parse_url( $uri );

        $return = '';
        if ( isset( $parsed['user'] ) )
        {
            $return .= $parsed['user'] . '@' . $parsed['pass'];
        }
        $return .= rtrim( $parsed['path'], '/' ) . '/' . $this->Name;

        if ( isset( $parsed['query'] ) )
        {
            $return  .= '?' . $parsed['query'];
        }
        if ( isset( $parsed['fragment'] ) )
        {
            $return .= '#' . $parsed['fragment'];
        }

        return $return;
    }
520881
public function renderFragment($uri, $options = [])
    {
        $strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
        unset($options['strategy']);

        return $this->handler->render($uri, $strategy, $options);
    }
252181
def navigation_behavior(error)
      if get?
        raise error
      elsif has_errors? && default_action
        render rendering_options
      else
        redirect_to navigation_location
      end
    end