本文整理汇总了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();
}
示例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());
}
示例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);
}
示例4: createFilter
public static function createFilter()
{
if (preg_match('/\\/api\\//', \Request::url())) {
return new ApiFilters();
}
return new WebFilters();
}
示例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);
}
}
示例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');
}
示例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();
}
}
示例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');
}
示例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;
}
示例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();
}
}
示例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');
}
示例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')));
}
示例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')));
}
示例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'];
}
示例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);
}