Generate a frontend url.

@param GenerateFrontendUrlEvent $event The event.

@return void
170031
public function handleGenerateFrontendUrl(GenerateFrontendUrlEvent $event)
    {
        /** @var Controller $controllerAdapter */
        $controllerAdapter = $this->framework->getAdapter(Controller::class);

        $url = $controllerAdapter->generateFrontendUrl(
            $event->getPageData(),
            $event->getParameters(),
            $event->getLanguage(),
            $event->getFixDomain()
        );

        $event->setUrl($url);
    }
788437
public function startup($event)
    {
        // startup-event
        $_event = new Event('Component.Manager.startup', $this, [
        ]);
        $this->Controller->eventManager()->dispatch($_event);

        if ($this->isPrefix()) {
            $this->_runCallback("startup", $event);

            // startup-event with Prefix
            $this->_runEvent("startup");
        }
    }
360810
public function col_ip($event) {
        // Get extra event data for origin and realuserid.
        $logextra = $event->get_logextra();

        $url = new moodle_url("/iplookup/index.php?ip={$logextra['ip']}&user=$event->userid");
        return $this->action_link($url, $logextra['ip'], 'ip');
    }
438428
public function onNodeResourceEventAlterChannels(Event $event)
    {
        if (!$this->groupManager || !$event instanceof ResourceEvent) {
            return;
        }

        $done = [];

        // Fetch site groups, and yes we don't really have a choice here
        $nodes = $this->entityManager->getStorage('node')->loadMultiple($event->getResourceIdList());
        foreach ($nodes as $node) {
            if ($node->group_id) {
                $groupId = (int)$node->group_id;
                $done[$groupId] = $groupId;
            }
        }

        foreach ($done as $groupId) {
            $event->addArbitraryChanId('admin:content:' . $groupId);
        }
    }
1299211
public function onFrontpageLastModified(ContentEvent $event)
    {
        $e = new ContentEvent();
        $frontpageRoute = $this->getParam('frontpage');
        if($frontpageRoute != 'frontpage') {
            $e->setRoute($frontpageRoute.'_lastmodified');
            $this->dispatch($frontpageRoute.'_lastmodified', $e);
            $lastmodified = $e->getLastModified();
        } else {
            $lastmodified = $event->getLastModified();
        }

        $event->setLastModified($lastmodified);

        return true;
    }
861504
public function clientOnURLSplit($event)
    {
        if (!($event instanceof Eresus_Event_UrlSectionFound))
        {
            return;
        }
        if (isset($this->events['clientOnURLSplit']))
        {
            foreach ($this->events['clientOnURLSplit'] as $plugin)
            {
                $this->items[$plugin]->clientOnURLSplit($event->getSectionInfo(), $event->getUrl());
            }
        }
    }
279409
public function handleAddToUrl(AddToUrlEvent $event)
    {
        /** @var Controller $controllerAdapter */
        $controllerAdapter = $this->framework->getAdapter(Controller::class);

        $event->setUrl($controllerAdapter->addToUrl($event->getSuffix()));
    }
687934
public function onRender(HomepageRenderEvent $event)
    {
        $services = $this->serviceManager->getServices();
        foreach ($services as $service) {
            $event->addRoute($service['$ref'], $service['profile']);
        }
    }
21622
public function onAfterRouting(Event $event)
    {
        $tmpl = <<<TMPL
{
    "registrar": [
        {
            "language": "php",
            "provider": "routing",
            "signature": [
                "Windwalker\\\\Core\\\\Router\\\\RouteBuilderTrait:to",
                "Windwalker\\\\Core\\\\Router\\\\RouteBuilderTrait:route",
                "Windwalker\\\\Core\\\\Router\\\\RouteBuilderTrait:generate",
                "Windwalker\\\\Core\\\\Router\\\\RouteBuilderTrait:fullRoute",
                "Windwalker\\\\Core\\\\Router\\\\RouteBuilderTrait:rawRoute",
                "Windwalker\\\\Core\\\\Router\\\\CoreRouter:to",
                "Windwalker\\\\Core\\\\Router\\\\CoreRouter:route",
                "Windwalker\\\\Core\\\\Router\\\\CoreRouter:generate",
                "Windwalker\\\\Core\\\\Router\\\\CoreRouter:fullRoute",
                "Windwalker\\\\Core\\\\Router\\\\CoreRouter:rawRoute"
            ]
        }
    ],
    "providers": [
        {
            "name": "routing",
            "lookup_strings": [
                %s
            ]
        }
    ]
}
TMPL;

        /** @var MainRouter $router */
        $router = $event['router'];

        $names = [];
        $routes = $router->getRoutes();

        foreach ($routes as $route) {
            $name = $route->getName();
            
            list($pkg, $name) = array_pad(explode('@', $name), -2, null);
            
            $names[] = StringHelper::quote($name, '"');
            
            if ($pkg) {
                $names[] = StringHelper::quote($pkg . '@' . $name, '"');
            }
        }
        
        $names = implode(",\r\n", $names);
        $content = sprintf($tmpl, $names);

        File::write(WINDWALKER_TEMP . '/ide/router/.ide-toolbox.metadata.json', $content);
    }
1186913
public function renderEvent(Event $event)
    {
        $parts = array_map('ucfirst', array_filter(preg_split('/_|\./', $event->name)));
        $name = 'on'.implode($parts);

        if (is_callable(array($this, $name))) {
            return call_user_func(array($this, $name), $event);
        } else {
            return null;
        }
    }
580156
public function handlePersistUpdateUrl(PersistEvent $event)
    {
        $document = $event->getDocument();

        if (!$document instanceof ShadowLocaleBehavior) {
            return;
        }

        if (!$document->isShadowLocaleEnabled()) {
            return;
        }

        $node = $event->getNode();
        $structure = $this->inspector->getStructureMetadata($document);

        if (false === $structure->hasPropertyWithTagName('sulu.rlp')) {
            return;
        }

        $locatorProperty = $structure->getPropertyByTagName('sulu.rlp');

        if ($node->getPropertyValueWithDefault(
            $this->encoder->localizedSystemName(
                $locatorProperty->getName(), $document->getLocale()
            ),
            null
        )) {
            return;
        }

        $shadowLocator = $node->getPropertyValueWithDefault(
            $this->encoder->localizedSystemName(
                $locatorProperty->getName(), $document->getShadowLocale()
            ),
            null
        );

        if (!$shadowLocator) {
            return;
        }

        $event->getAccessor()->set(
          'resourceSegment',
          $shadowLocator
        );
    }
579292
public function handleRedirect(RedirectEvent $event)
    {
        /** @var Controller $controllerAdapter */
        $controllerAdapter = $this->framework->getAdapter(Controller::class);

        $controllerAdapter->redirect($event->getNewLocation(), $event->getStatusCode());
    }
1318188
public function processRedirectAfterPublish(FormActionEvent $event): void
    {
        if ($event->getForm()['redirectUrlAfterPublish']->getData()) {
            return;
        }

        $this->resolveSystemUrlRedirect($event);
    }
689479
public function onBuildKernelWebHandler(PreBuildKernelWebHandlerEvent $event)
    {
        $siteAccess = $this->container->get('ezpublish.siteaccess');
        $request = $event->getRequest();
        $uriPart = [];

        // Convert matching type
        switch ($siteAccess->matchingType) {
            case 'default':
                $legacyAccessType = eZSiteAccess::TYPE_DEFAULT;
                break;

            case 'env':
                $legacyAccessType = eZSiteAccess::TYPE_SERVER_VAR;
                break;

            case 'uri:map':
            case 'uri:element':
            case 'uri:text':
            case 'uri:regexp':
                $legacyAccessType = eZSiteAccess::TYPE_URI;
                break;

            case 'host:map':
            case 'host:element':
            case 'host:text':
            case 'host:regexp':
                $legacyAccessType = eZSiteAccess::TYPE_HTTP_HOST;
                break;

            case 'port':
                $legacyAccessType = eZSiteAccess::TYPE_PORT;
                break;

            default:
                $legacyAccessType = eZSiteAccess::TYPE_CUSTOM;
        }

        // uri_part
        $pathinfo = str_replace($request->attributes->get('viewParametersString'), '', rawurldecode($request->getPathInfo()));
        $fragmentPathInfo = implode('/', $this->getFragmentPathItems());
        if ($fragmentPathInfo !== '_fragment') {
            $semanticPathinfo = $fragmentPathInfo;
        } else {
            $semanticPathinfo = $request->attributes->get('semanticPathinfo', $pathinfo);
        }

        $pos = mb_strrpos($pathinfo, $semanticPathinfo);
        if ($legacyAccessType !== eZSiteAccess::TYPE_DEFAULT && $pathinfo != $semanticPathinfo && $pos !== false) {
            if ($pos === 0) {
                $pos = mb_strlen($pathinfo) + 1;
            }
            $uriPart = mb_substr($pathinfo, 1, $pos - 1);
            $uriPart = explode('/', $uriPart);
        }

        // Handle host_uri match
        if ($siteAccess->matcher instanceof CompoundInterface) {
            $subMatchers = $siteAccess->matcher->getSubMatchers();
            if (!$subMatchers) {
                throw new \RuntimeException('Compound matcher used but not submatchers found.');
            }

            if (\count($subMatchers) == 2 && isset($subMatchers['Map\Host']) && isset($subMatchers['Map\URI'])) {
                $legacyAccessType = eZSiteAccess::TYPE_HTTP_HOST_URI;
                $uriPart = [$subMatchers['Map\URI']->getMapKey()];
            }
        }

        $event->getParameters()->set(
            'siteaccess',
            [
                'name' => $siteAccess->name,
                'type' => $legacyAccessType,
                'uri_part' => $uriPart,
            ]
        );
    }
835295
public function generateSegments(string $root = null): void
    {
        $path = rawurldecode($this->sourceData['path'] ?? '');
        if ($path && $path != '/') {
            // drop root if exists
            if ($root && $root != '/') {
                $root = '/'. trim($root, '/'). '/';
                // prevent wrong generate action
                if (strpos($path, $root) === false) {
                    throw new HttpException("Uri path '{$path}' has no root such '{$root}'");
                }

                $path = substr($path, strlen($root));

                // update segments root
                $this->segmentsRoot = $root;
            }

            $segments = array_map('trim', preg_split('~/+~', $path, -1, PREG_SPLIT_NO_EMPTY));
            if ($segments != null) {
                // push index next
                foreach ($segments as $i => $segment) {
                    $this->segments[$i + 1] = $segment;
                }
            }
        }
    }
688775
private function generateAddUrl(array $page): string
    {
        $event = new GenerateFrontendUrlEvent($page, null, $page['language']);

        $this->dispatcher->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);

        $url = UrlBuilder::fromUrl($event->getUrl() . '?')
            ->setQueryParameter('act', 'create');

        return $url->getUrl();
    }
143036
public function setMainUrl($entity)
    {
        // set main to first entry or to null
        if ($entity->getUrls()->isEmpty()) {
            $entity->setMainUrl(null);
        } else {
            $entity->setMainUrl($entity->getUrls()->first()->getUrl());
        }
    }