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


PHP Request::url方法代码示例

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


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

示例1: createHanlder

 public static function createHanlder()
 {
     if (preg_match('/\\/api\\//', \Request::url())) {
         return new ApiExceptionHandler();
     }
     return new WebExceptionHandler();
 }
开发者ID:trantung,项目名称:online_market,代码行数:7,代码来源:Factory.php

示例2: signInAsUser

 /**
  * Sign in as another user. 
  * @param $args array ($userId)
  */
 function signInAsUser($args)
 {
     $this->addCheck(new HandlerValidatorJournal($this));
     // only managers and admins have permission
     $this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_SITE_ADMIN, ROLE_ID_JOURNAL_MANAGER)));
     $this->validate();
     if (isset($args[0]) && !empty($args[0])) {
         $userId = (int) $args[0];
         $journal =& Request::getJournal();
         if (!Validation::canAdminister($journal->getId(), $userId)) {
             $this->setupTemplate();
             // We don't have administrative rights
             // over this user. Display an error.
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('pageTitle', 'manager.people');
             $templateMgr->assign('errorMsg', 'manager.people.noAdministrativeRights');
             $templateMgr->assign('backLink', Request::url(null, null, 'people', 'all'));
             $templateMgr->assign('backLinkLabel', 'manager.people.allUsers');
             return $templateMgr->display('common/error.tpl');
         }
         $userDao =& DAORegistry::getDAO('UserDAO');
         $newUser =& $userDao->getUser($userId);
         $session =& Request::getSession();
         // FIXME Support "stack" of signed-in-as user IDs?
         if (isset($newUser) && $session->getUserId() != $newUser->getId()) {
             $session->setSessionVar('signedInAs', $session->getUserId());
             $session->setSessionVar('userId', $userId);
             $session->setUserId($userId);
             $session->setSessionVar('username', $newUser->getUsername());
             Request::redirect(null, 'user');
         }
     }
     Request::redirect(null, Request::getRequestedPage());
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:38,代码来源:LoginHandler.inc.php

示例3: setupTemplate

 function setupTemplate()
 {
     parent::setupTemplate();
     $templateMgr =& TemplateManager::getManager();
     $pageHierarchy = array(array(Request::url(null, 'referral', 'index'), 'plugins.generic.referral.referrals'));
     $templateMgr->assign('pageHierarchy', $pageHierarchy);
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:7,代码来源:ReferralHandler.inc.php

示例4: createFilter

 public static function createFilter()
 {
     if (preg_match('/\\/api\\//', \Request::url())) {
         return new ApiFilters();
     }
     return new WebFilters();
 }
开发者ID:trantung,项目名称:online_market,代码行数:7,代码来源:Factory.php

示例5: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof TokenMismatchException) {
         //redirect to form an example of how I handle minedd
         return redirect()->to('/')->with('message', "Opps! Seems you couldn't submit form for a longtime. Please try again");
     }
     if ($this->isHttpException($e)) {
         switch ($e->getStatusCode()) {
             case 404:
                 $url = explode('/', \Request::url());
                 $referidos = User::where('type', '=', 'referrer')->get();
                 foreach ($referidos as $referido) {
                     if ($referido->code_referrer == $url[3]) {
                         return redirect()->route('site.singUp', [$referido->code_referrer]);
                     }
                 }
                 return redirect()->to('/404');
                 break;
                 // internal error
             // internal error
             case '500':
                 return redirect()->guest('/500');
                 break;
             default:
                 return $this->renderHttpException($e);
                 break;
         }
     } else {
         return parent::render($request, $e);
     }
 }
开发者ID:joseferrer1090,项目名称:hdsport,代码行数:38,代码来源:Handler.php

示例6: create

 public function create()
 {
     if (\Request::ajax()) {
         return response()->json(['url' => \Request::url(), 'title' => 'Contact | Jonas Vanderhaegen', 'path' => \Request::path(), 'view' => view('pages.messages.create')->render()]);
     }
     return view('pages.messages.create');
 }
开发者ID:jonasvanderhaegen,项目名称:jonasvanderhaegen.be,代码行数:7,代码来源:ContactController.php

示例7: before

 public static function before()
 {
     if (Request::get('lang')) {
         $langList = array_map(function ($a) {
             return $a['iso'];
         }, Language::getList());
         $lang = strtolower(Request::get('lang'));
         if (in_array($lang, $langList)) {
             Request::cookie(self::$langKeyCookie, $lang);
         }
         Request::redirect(Request::url(array('lang' => '')));
     }
     if (Request::get('confirm_email')) {
         connectionUserModel::create()->confirmationEmailLink(Request::get('confirm_email'));
         Request::get('email_confirm', true);
     }
     if (ConnectionHelper::isLogin() && Request::get('status') && Request::get('status') == connectionUserModel::STATUS_MODERATE) {
         $userLogin = ConnectionHelper::userLogin();
         connectionUserModel::create()->changeStatus($userLogin['id'], connectionUserModel::STATUS_MODERATE, 'Пользователь отправил профиль на проверку.');
         Request::redirect('/profile/');
     }
     if (Request::get('auth') && !ConnectionHelper::isLogin()) {
         Request::redirect('/login/');
     }
     if (ConnectionHelper::isLogin()) {
         ConnectionHelper::updateUserActive();
     }
 }
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:28,代码来源:Connection.app.php

示例8: getRegister

 /**
  * Show the application registration form.
  *
  * @return \Illuminate\Http\Response
  */
 public function getRegister()
 {
     if (\Request::ajax()) {
         return response()->json(['locale' => session()->get('locale', 'nl'), 'url' => \Request::url(), 'title' => 'Register | De Sessie', 'type' => 'pageload', 'path' => \Request::path(), 'view' => view('auth.register')->render()]);
     }
     return view('auth.register');
 }
开发者ID:jonasvanderhaegen,项目名称:Billboa,代码行数:12,代码来源:RegistersUsers.php

示例9: extractMetadataFromDataObject

 /**
  * @see MetadataDataObjectAdapter::extractMetadataFromDataObject()
  * @param $monograph Monograph
  * @return MetadataDescription
  */
 function extractMetadataFromDataObject($monograph)
 {
     assert(is_a($monograph, 'Monograph'));
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON);
     // Retrieve data that belongs to the publication format.
     $oaiDao = DAORegistry::getDAO('OAIDAO');
     /* @var $oaiDao OAIDAO */
     $publishedMonographDao = DAORegistry::getDAO('PublishedMonographDAO');
     $chapterDao = DAORegistry::getDAO('ChapterDAO');
     $monograph = $publishedMonographDao->getById($monograph->getId());
     $press = $oaiDao->getPress($monograph->getPressId());
     $description = $this->instantiateMetadataDescription();
     // Update status
     // Is communicated via an attribute, so property value is empty
     $description->addStatement('administrative_data/delivery/update_status[@type="urn_new"]', "");
     $urn = "";
     $scheme = "";
     $pubIdPlugins = PluginRegistry::loadCategory('pubIds');
     if (isset($pubIdPlugins) && array_key_exists('URNDNBPubIdPlugin', $pubIdPlugins) && $pubIdPlugins['URNDNBPubIdPlugin']->getEnabled() == true) {
         $urn = $pubIdPlugins['URNDNBPubIdPlugin']->getPubId($monograph);
         $namespaces = explode(':', $urn);
         $numberOfNamespaces = min(sizeof($namespaces), 3);
         $scheme = implode(":", array_slice($namespaces, 0, $numberOfNamespaces));
     }
     // URN
     $description->addStatement('record/identifier', $urn . ' [@scheme="' . $scheme . '"]');
     // URL
     $url = Request::url($press->getPath(), 'catalog', 'book', array($monograph->getId()));
     $description->addStatement('record/resource/identifier[@scheme="url", @type="frontpage", @role="primary"]', $url);
     // URL Mime type
     $description->addStatement('record/resource/format[@scheme="imt"]', "text/html");
     return $description;
 }
开发者ID:kadowa,项目名称:omp-xepicur-metadata-plugin,代码行数:38,代码来源:Epc10SchemaMonographAdapter.inc.php

示例10: saveProgramSettings

 /**
  * Save changes to program settings.
  */
 function saveProgramSettings()
 {
     $this->validate();
     $this->setupTemplate(true);
     $schedConf =& Request::getSchedConf();
     if (!$schedConf) {
         Request::redirect(null, null, 'index');
     }
     import('classes.manager.form.ProgramSettingsForm');
     $settingsForm = new ProgramSettingsForm();
     $settingsForm->readInputData();
     $formLocale = $settingsForm->getFormLocale();
     $programTitle = Request::getUserVar('programFileTitle');
     $editData = false;
     if (Request::getUserVar('uploadProgramFile')) {
         if (!$settingsForm->uploadProgram('programFile', $formLocale)) {
             $settingsForm->addError('programFile', Locale::translate('common.uploadFailed'));
         }
         $editData = true;
     } elseif (Request::getUserVar('deleteProgramFile')) {
         $settingsForm->deleteProgram('programFile', $formLocale);
         $editData = true;
     }
     if (!$editData && $settingsForm->validate()) {
         $settingsForm->execute();
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'program'), 'pageTitle' => 'schedConf.program', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.conferenceSiteManagement'));
         $templateMgr->display('common/message.tpl');
     } else {
         $settingsForm->display();
     }
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:35,代码来源:ManagerProgramHandler.inc.php

示例11: thankYou

 function thankYou($args)
 {
     $templateMgr =& TemplateManager::getManager();
     $journal =& Request::getJournal();
     $templateMgr->assign(array('currentUrl' => Request::url(null, null, 'donations'), 'pageTitle' => 'donations.thankYou', 'journalName' => $journal->getJournalTitle(), 'message' => 'donations.thankYouMessage'));
     $templateMgr->display('common/message.tpl');
 }
开发者ID:alenoosh,项目名称:ojs,代码行数:7,代码来源:DonationsHandler.inc.php

示例12: setupTemplate

 /**
  * Setup common template variables.
  * @param $subclass boolean set to true if caller is below this handler in the hierarchy
  */
 function setupTemplate($subclass = false)
 {
     parent::setupTemplate();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->setCacheability(CACHEABILITY_PUBLIC);
     $templateMgr->assign('pageHierachy', array(array(Request::url(null, null, 'announcements'), 'announcement.announcements')));
 }
开发者ID:anorton,项目名称:pkp-lib,代码行数:11,代码来源:PKPAnnouncementHandler.inc.php

示例13: setupTemplate

 /**
  * Setup common template variables.
  * @param $subclass boolean set to true if caller is below this handler in the hierarchy
  */
 function setupTemplate($subclass = false)
 {
     parent::setupTemplate();
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_ADMIN, LOCALE_COMPONENT_OJS_ADMIN, LOCALE_COMPONENT_OJS_MANAGER);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageHierarchy', $subclass ? array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'admin'), 'admin.siteAdmin')) : array(array(Request::url(null, 'user'), 'navigation.user')));
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:11,代码来源:AdminHandler.inc.php

示例14: __construct

 public function __construct()
 {
     $this->userIp = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::getClientIp() : $_SERVER['REMOTE_ADDR'];
     $this->userAgent = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::server('HTTP_USER_AGENT') : $_SERVER['HTTP_USER_AGENT'];
     $this->referrer = class_exists('\\Illuminate\\Support\\Facades\\URL') ? \URL::previous() : $_SERVER['HTTP_REFERER'];
     $this->permalink = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::url() : $_SERVER['REQUEST_URI'];
 }
开发者ID:nickurt,项目名称:laravel-akismet,代码行数:7,代码来源:Akismet.php

示例15: format

 /**
  * @param \Exception $exception
  * @return \Illuminate\Http\JsonResponse
  */
 public function format($exception)
 {
     // Define the response
     $result = ['errors' => trans('messages.sorry')];
     // Default response of 400
     $statusCode = 400;
     $addDebugData = $this->isDebugEnabled();
     switch (true) {
         case $exception instanceof HttpException:
             $statusCode = $exception->getStatusCode();
             $result['errors'] = $exception->getMessage();
             break;
         case $exception instanceof ValidationException:
             $result['errors'] = $exception->errors();
             $addDebugData = false;
             break;
     }
     // Prepare response
     $response = ['success' => false, 'result' => $result, 'meta' => ['version' => config('app.version.api'), 'request' => \Request::method() . ' ' . \Request::url(), 'debug' => $this->isDebugEnabled()]];
     // If the app is in debug mode && not Validation exception
     if ($addDebugData) {
         $response['debug'] = ['exception' => get_class($exception), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'trace' => $exception->getTrace()];
     }
     // Return a JSON response with the response array and status code
     return response()->json($response, $statusCode);
 }
开发者ID:xEdelweiss,项目名称:my-perfect-back-end,代码行数:30,代码来源:ExceptionAdapter.php


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