当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::getUri方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpFoundation\Request::getUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getUri方法的具体用法?PHP Request::getUri怎么用?PHP Request::getUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpFoundation\Request的用法示例。


在下文中一共展示了Request::getUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Creates and persists a thread with the specified id.
  *
  * @param mixed $id
  * @return ThreadInterface
  */
 public function create($id)
 {
     $thread = $this->threadManager->createThread();
     $thread->setId($id);
     $thread->setPermalink($this->request->getUri());
     $this->threadManager->addThread($thread);
     return $thread;
 }
开发者ID:helmer,项目名称:FOSCommentBundle,代码行数:14,代码来源:DefaultThreadCreator.php

示例2: createFromRequest

 /**
  * @param string $collectorName
  *
  * @return RequestObject
  */
 public function createFromRequest($collectorName)
 {
     $requestObject = new RequestObject();
     $requestObject->setHeaders($this->request->headers->all());
     $requestObject->setPostParameters($this->request->request->all());
     $requestObject->setQueryParameters($this->request->query->all());
     $requestObject->setContent($this->request->getContent());
     $requestObject->setCollector($collectorName);
     $requestObject->setUri($this->request->getUri());
     $requestObject->setMethod($this->request->getMethod());
     return $requestObject;
 }
开发者ID:deuzu,项目名称:request-collector-bundle,代码行数:17,代码来源:RequestObjectProvider.php

示例3: setTargetPath

 protected function setTargetPath(Request $request)
 {
     // Ne conservez pas de chemin cible pour les requêtes XHR et non-GET
     // Vous pouvez ajouter n'importe quelle logique supplémentaire ici
     // si vous le voulez
     if ($request->isXmlHttpRequest() || 'GET' !== $request->getMethod()) {
         return;
     }
     $session = $request->getSession();
     $session->set('_security.target_path', $request->getUri());
     $session->getFlashBag()->add('info', $request->getUri());
     return $this->redirect($this->generateUrl('heliosblog_accueil', array('blog' => $request->get('blog'))));
 }
开发者ID:HeliosDX,项目名称:BlogWim1,代码行数:13,代码来源:ExceptionListener.php

示例4: onAuthenticationSuccess

 public function onAuthenticationSuccess(Request $request, TokenInterface $token)
 {
     // If the user tried to access a protected resource and was forces to login
     // redirect him back to that resource
     if ($this->container->get('security.context')->isGranted('ROLE_SUPER_ADMIN') || $token->getUser()->hasRole('ROLE_ADMIN')) {
         $refererUri = $request->getSession()->get('_security.target_path');
         $url = $refererUri && $refererUri != $request->getUri() ? $refererUri : $this->router->generate('sonata_admin_dashboard');
     } else {
         $refererUri = $request->getSession()->get('_security.target_path');
         $url = $refererUri && $refererUri != $request->getUri() ? $refererUri : $this->router->generate('app_frontend_homepage');
     }
     return new RedirectResponse($url);
 }
开发者ID:edmangs,项目名称:PERIODISTAS,代码行数:13,代码来源:AuthenticationHandler.php

示例5: onKernelResponse

 /**
  * On kernel response event
  *
  * @param FilterResponseEvent $event
  */
 public function onKernelResponse(FilterResponseEvent $event)
 {
     // Only master request and 200 OK are processed
     if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType() && $event->getResponse()->isOk()) {
         $route = $this->router->match($this->request->getPathInfo());
         // Ignore internal route
         if (0 === stripos($route['_route'], '_')) {
             return;
         }
         $this->session->set('_unifik.last_master_request_uri', $this->request->getUri());
         $this->session->set('_unifik.last_master_request_route', $route);
     }
 }
开发者ID:pmdc,项目名称:UnifikSystemBundle,代码行数:18,代码来源:ResponseListener.php

示例6: getMetaData

 /**
  * Get the request formatted as meta data.
  *
  * @return array
  */
 public function getMetaData()
 {
     $data = [];
     $data['url'] = $this->request->getUri();
     $data['httpMethod'] = $this->request->getMethod();
     $data['params'] = $this->getInput() + $this->request->query->all();
     $data['clientIp'] = $this->request->getClientIp();
     if ($agent = $this->request->headers->get('User-Agent')) {
         $data['userAgent'] = $agent;
     }
     if ($headers = $this->request->headers->all()) {
         $data['headers'] = $headers;
     }
     return ['request' => $data];
 }
开发者ID:bugsnag,项目名称:bugsnag-silex,代码行数:20,代码来源:SilexRequest.php

示例7: execute

 /**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request GetHttpRequest */
     RequestNotSupportedException::assertSupports($this, $request);
     if (false == $this->httpRequest) {
         return;
     }
     $request->query = $this->httpRequest->query->all();
     $request->request = $this->httpRequest->request->all();
     $request->headers = $this->httpRequest->headers->all();
     $request->method = $this->httpRequest->getMethod();
     $request->uri = $this->httpRequest->getUri();
     $request->clientIp = $this->httpRequest->getClientIp();
     $request->userAgent = $this->httpRequest->headers->get('User-Agent');
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:18,代码来源:GetHttpRequestAction.php

示例8: run

 public function run()
 {
     $this->log('Processing uri: ' . $this->req->getUri());
     try {
         foreach ($this->middleware as $middleware) {
             $middleware->handle($this->req, $this->res);
         }
     } catch (\Exception $e) {
         $this->log($e->getMessage(), [], LogLevel::ERROR);
         foreach ($this->onException as $exceptionCallback) {
             call_user_func($exceptionCallback, $e);
         }
     }
     $this->log('Processed uri: ' . $this->req->getUri());
 }
开发者ID:bazo,项目名称:rest-router,代码行数:15,代码来源:App.php

示例9: ver

 /**
  * @param Request $request
  * @param Application $app
  * 
  * @return mixed
  */
 public function ver(Request $request, Application $app)
 {
     $archivo = $request->get('archivo');
     if (!empty($archivo)) {
         #$file    = fopen($archivo, 'r');
         #$content = fread($file, 8192);
         #fclose($file);
         $contenido = file_get_contents($archivo);
         return $app['twig']->render('backend/archivo/content.html.twig', array('content' => $contenido));
     } else {
         $explorer = $app['explorer'];
         if (strstr($request->getUri(), "protected") && $app['security']->isGranted('ROLE_SUPER_ADMIN')) {
             $files = array();
             $filesProtected = $explorer->getFilesProtected();
         } else {
             $files = $explorer->getFiles();
             if ($app['security']->isGranted('ROLE_SUPER_ADMIN')) {
                 $filesProtected = $explorer->getFilesProtected();
             } else {
                 $filesProtected = array();
             }
         }
         return $app['twig']->render('backend/archivo/list.html.twig', array('rows' => $files, 'rows_protected' => $filesProtected));
     }
 }
开发者ID:jamc92,项目名称:precursor-silex,代码行数:31,代码来源:Archivo.php

示例10: crud

 /**
  * @param Request $request
  * @param $mode
  * @param null $securekey
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 private function crud(Request $request, $mode, $securekey = null)
 {
     $locale = $request->getLocale();
     $defaultLocale = $this->container->getParameter("SSone.default_locale");
     $em = $this->getDoctrine()->getManager();
     $ls = $this->get('ssone.cms.Localiser');
     $altLinks = $ls->getAltAdminLangLinks($request->getUri());
     if ($mode == "new") {
         $module = new Module();
     } else {
         $module = $this->getDoctrine()->getRepository('SSoneCMSBundle:Module')->findBySecurekey($securekey);
     }
     $contentService = $this->get('ssone.cms.content');
     $form = $this->createForm(new ModuleTYPE($em, $contentService, $locale), $module);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $this->get('ssone.cms.recordauditor')->auditRecord($module);
         $uploader = $this->get('ssone.cms.fileuploader');
         if ($form['file_templatePath']->getData() && ($fp = $uploader->templateUpload($form['file_templatePath']->getData(), "module"))) {
             $module->setTemplatePath($fp);
         }
         switch ($mode) {
             case "new":
                 $em->persist($module);
                 break;
             case "delete":
                 $em->remove($module);
                 break;
         }
         $em->flush();
         return $this->redirect($this->generateUrl('ssone_cms_admin_modules_list'));
     }
     return $this->render('SSoneCMSBundle:Module:crud.html.twig', array('form' => $form->createView(), 'menuItemTitle' => $module->getName($defaultLocale), 'mode' => $mode, 'locale' => $locale, 'altLinks' => $altLinks));
 }
开发者ID:ssone,项目名称:cms-bundle,代码行数:40,代码来源:ModulesController.php

示例11: parseRequest

  /**
   * @param Request $request The request containing the query string to parse.
   * @return array
   *
   * @todo: Maybe this should return a FillPdfLinkContext object or something?
   *   Guess it depends on how much I end up needing to change it.
   */
  public function parseRequest(Request $request) {
    // @todo: Use Url::fromRequest when/if it lands in core. See https://www.drupal.org/node/2605530
    $path = $request->getUri();
    $request_url = $this->createUrlFromString($path);

    return $this->parseLink($request_url);
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:14,代码来源:FillPdfLinkManipulator.php

示例12: __construct

 /**
  * Constructor.
  *
  * NOTE:
  * For security reasons we don't store the request object here so the
  * values in the event remain immutable.
  *
  * @param Request $request
  */
 public function __construct(Request $request)
 {
     $this->clientIp = $request->getClientIp();
     $this->dateTime = $request->server->get('REQUEST_TIME');
     $this->uri = $request->getUri();
     $this->userName = $request->request->get('username');
 }
开发者ID:robbert-vdh,项目名称:bolt,代码行数:16,代码来源:AccessControlEvent.php

示例13: process

 /**
  * {@inheritdoc}
  */
 public function process(Request $request, RequestAttributes $requestAttributes)
 {
     $portalInformation = $requestAttributes->getAttribute('portalInformation');
     if (!$portalInformation instanceof PortalInformation) {
         return new RequestAttributes();
     }
     $attributes = ['requestUri' => $request->getUri()];
     if (null !== ($localization = $portalInformation->getLocalization())) {
         $request->setLocale($localization->getLocalization());
     }
     $attributes['portalInformation'] = $portalInformation;
     $attributes['getParameter'] = $request->query->all();
     $attributes['postParameter'] = $request->request->all();
     $attributes['matchType'] = $portalInformation->getType();
     $attributes['redirect'] = $portalInformation->getRedirect();
     $attributes['analyticsKey'] = $portalInformation->getAnalyticsKey();
     $attributes['portalUrl'] = $portalInformation->getUrl();
     $attributes['webspace'] = $portalInformation->getWebspace();
     $attributes['portal'] = $portalInformation->getPortal();
     if ($portalInformation->getType() === RequestAnalyzerInterface::MATCH_TYPE_REDIRECT) {
         return new RequestAttributes($attributes);
     }
     $attributes['localization'] = $portalInformation->getLocalization();
     $attributes['segment'] = $portalInformation->getSegment();
     list($resourceLocator, $format) = $this->getResourceLocatorFromRequest($portalInformation, $request);
     $attributes['urlExpression'] = $portalInformation->getUrlExpression();
     $attributes['resourceLocator'] = $resourceLocator;
     $attributes['format'] = $format;
     $attributes['resourceLocatorPrefix'] = substr($portalInformation->getUrl(), strlen($request->getHttpHost()));
     if (null !== $format) {
         $request->setRequestFormat($format);
     }
     return new RequestAttributes($attributes);
 }
开发者ID:sulu,项目名称:sulu,代码行数:37,代码来源:PortalInformationRequestProcessor.php

示例14: indexAction

 /**
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function indexAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $params = $request->get('search');
     $vertical = NULL;
     /* SEO */
     $url_parsed = parse_url($request->getUri());
     $url_path = $url_parsed['path'];
     if (isset($url_parsed['query'])) {
         $url_path .= '?' . $url_parsed['query'];
     }
     $post_parameters = $this->getPostParameters($request);
     $adSearchUrl = $this->get('rmc_core.ad_search_url_service');
     $adSearchUrl->parseUrl($url_path, $post_parameters);
     $urlFilters = $adSearchUrl->getFilters();
     $niceUrl = $adSearchUrl->getNiceUrlByFilters($urlFilters);
     $filters = $adSearchUrl->getNiceFilters();
     // redirect to smart url
     if ($adSearchUrl->is302 && $niceUrl != '/') {
         return $this->redirect($this->container->get('kernel')->getEnvironment() == 'dev' ? '/app_dev.php' . $niceUrl : $niceUrl);
     }
     //print_r($filters);exit;
     //echo 'NICE URL '.$adSearchUrl->getNiceUrlAdding(array('category1' => 2), $filters);
     if (isset($filters['vertical'])) {
         $vertical = $em->getRepository('Entity:Vertical')->find($filters['vertical']);
     }
     $searchManager = AdSearchFactory::getSearchManager($this->container, $vertical ? $vertical->getCode() : '');
     // choose based on search parameter otherwise use 'Ad'
     $filters['select'] = array('id');
     $filters['facet'] = true;
     // display the total number of documents found by solr
     $query = $searchManager->getSolrSearchService()->getQueryByCriteria($filters, NULL, true);
     $solrRegistry = $this->get('solarium.client_registry');
     $client = $solrRegistry->getClient('rmcslave');
     $pager = array($client, $query);
     $paginator = $this->get('knp_paginator');
     $resultset = $paginator->paginate($pager, $request->get('page', 1), $request->get('page_range', 10));
     $resultsetFacet = $resultset->getCustomParameter('result');
     $documents = $resultset->getItems();
     $data = $resultset->getPaginationData();
     $facets = $searchManager->getSolrSearchService()->getFacetFields($resultsetFacet);
     $facetBuilder = new AdSearchFacetBulderService($this->getDoctrine()->getManager(), $facets, $adSearchUrl);
     $niceFacets = $facetBuilder->getNiceFacets();
     //print_r($niceFacets);exit;
     //echo $documents->getTotalItemCount();exit;
     //echo 'NumFound: '.$resultset->getNumFound();exit;
     /*
             foreach ($documents as $doc)
             {
                 echo 'ID '.$doc->id."<br />";
             }*/
     $ids = RmcHelpers::getPrimaryKeys($documents);
     $ads = $em->getRepository('Entity:Ad')->findById($ids);
     $noLayout = $request->headers->get('X-PJAX') ? true : false;
     if ($noLayout) {
         return $this->render('RmcCoreAdSearchBundle:Default:pjaxIndex.html.twig', array('ads' => $ads, 'documents' => $documents, 'paginator' => $resultset, 'facetFields' => $niceFacets, 'noLayout' => $noLayout));
     } else {
         return $this->render('RmcCoreAdSearchBundle:Default:index.html.twig', array('ads' => $ads, 'documents' => $documents, 'paginator' => $resultset, 'facetFields' => $niceFacets, 'noLayout' => $noLayout));
     }
 }
开发者ID:jignesh-russmediatech,项目名称:rmcdemo,代码行数:64,代码来源:DefaultController.php

示例15: crud

 /**
  * @param Request $request
  * @param $mode
  * @param null $securekey
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 private function crud(Request $request, $mode, $securekey = null)
 {
     $locale = $request->getLocale();
     $defaultLocale = $this->container->getParameter("SSone.default_locale");
     $em = $this->getDoctrine()->getManager();
     $ls = $this->get('ssone.cms.Localiser');
     $altLinks = $ls->getAltAdminLangLinks($request->getUri());
     if ($mode == "new") {
         $menuItem = new MenuItem();
     } else {
         $menuItem = $this->getDoctrine()->getRepository('SSoneCMSBundle:MenuItem')->findBySecurekey($securekey);
     }
     $contentLibrary = $this->get('ssone.cms.content')->getAllForGroupedChoiceOptions();
     $fieldsRepository = $this->getDoctrine()->getRepository('SSoneCMSBundle:Field');
     $menuItems = $this->get('ssone.cms.navigation');
     $menuItems = $menuItems->buildFlatNavigationArray($menuItem->getId());
     $form = $this->createForm(new MenuItemTYPE($request->getLocale(), $mode, $contentLibrary, $menuItems, $fieldsRepository), $menuItem);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $this->handleParentChoice($menuItem, $em);
         $this->handleContentChoice($menuItem, $em);
         $this->get('ssone.cms.recordauditor')->auditRecord($menuItem);
         switch ($mode) {
             case "new":
                 $em->persist($menuItem);
                 break;
             case "delete":
                 $em->remove($menuItem);
                 break;
         }
         $em->flush();
         return $this->redirect($this->generateUrl('ssone_cms_admin_menuItems_list'));
     }
     return $this->render('SSoneCMSBundle:MenuItem:crud.html.twig', array('form' => $form->createView(), 'menuItemTitle' => $menuItem->getName($defaultLocale), 'mode' => $mode, 'locale' => $locale, "altLinks" => $altLinks));
 }
开发者ID:ssone,项目名称:cms-bundle,代码行数:41,代码来源:MenuItemsController.php


注:本文中的Symfony\Component\HttpFoundation\Request::getUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。