本文整理汇总了PHP中Request::root方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::root方法的具体用法?PHP Request::root怎么用?PHP Request::root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::root方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLangSwitch
function getLangSwitch()
{
$local = App::getLocale();
$host = Config::get('app.host');
$fr = '/fr';
$de = '/de';
$en = '/en';
if ($host == 'convergedmaturity.com' || $host == 'convergedmaturity.co.uk' || $host == 'certus.convergedmaturity.co.uk' || $host == 'dellconverged.app' || $host == 'itf.convergedmaturity.com' || $host == 'infoniqa.convergedmaturity.com') {
$en = '';
} elseif ($host == 'convergedmaturity.fr') {
$fr = '';
} elseif ($host == 'bereit-fuer-konvergente-infrastruktur.de' || $host == 'niteflite.bereit-fuer-konvergente-infrastruktur.de') {
$de = '';
}
switch ($local) {
case 'en':
return "\n\t\t\t<li><a href=" . Request::root() . $fr . "><i class=\"flag fr\"></i> French</a></li>\n\t\t\t<li><a href=" . Request::root() . $de . "><i class=\"flag de\"></i> German</a></li>\n\t\t\t";
break;
case 'fr':
return "\n\t\t\t<li><a href=" . Request::root() . $en . "><i class=\"flag\"></i> English</a></li>\n\t\t\t<li><a href=" . Request::root() . $de . "><i class=\"flag de\"></i> German</a></li>\n\t\t\t";
break;
case 'de':
return "\n\t\t\t<li><a href=" . Request::root() . $en . "><i class=\"flag\"></i> English</a></li>\n\t\t\t<li><a href=" . Request::root() . $fr . "><i class=\"flag fr\"></i> French</a></li>\n\t\t\t";
break;
}
}
示例2: init
/**
* Initializes the Google Drive connection
*
* @param array $params Any connection params needed
* @return object
**/
public static function init($params = [])
{
// Get the params
$pparams = Plugin::params('filesystem', 'googledrive');
$app_id = isset($params['app_id']) && $params['app_id'] != '' ? $params['app_id'] : $pparams->get('app_id');
$app_secret = isset($params['app_secret']) && $params['app_secret'] != '' ? $params['app_secret'] : $pparams->get('app_secret');
$client = new \Google_Client();
$client->setClientId($app_id);
$client->setClientSecret($app_secret);
$client->addScope(Google_Service_Drive::DRIVE);
$client->setAccessType('offline');
$client->setApprovalPrompt('force');
$client->setIncludeGrantedScopes(true);
if (isset($params['app_token'])) {
$accessToken = $params['app_token'];
// json encode turned our array into an object, we need to undo that
$accessToken = (array) $accessToken;
} else {
\Session::set('googledrive.app_id', $app_id);
\Session::set('googledrive.app_secret', $app_secret);
\Session::set('googledrive.connection_to_set_up', Request::getVar('connection', 0));
// Set upp a return and redirect to Google for auth
$return = Request::getVar('return') ? Request::getVar('return') : Request::current(true);
$return = base64_encode($return);
$redirectUri = trim(Request::root(), '/') . '/developer/callback/googledriveAuthorize';
$client->setRedirectUri($redirectUri);
Session::set('googledrive.state', $return);
App::redirect($client->createAuthUrl());
}
$client->setAccessToken($accessToken);
$service = new \Google_Service_Drive($client);
$adapter = new \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter($service, 'root');
return $adapter;
}
示例3: getInput
/**
* Method to get the field input markup for a generic list.
* Use the multiple attribute to enable multiselect.
*
* @return string The field input markup.
*/
protected function getInput()
{
// Initialize variables.
$attributes = array('type' => 'text', 'value' => htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'), 'name' => $this->name, 'id' => $this->id, 'size' => $this->element['size'] ? (int) $this->element['size'] : '', 'maxlength' => $this->element['maxlength'] ? (int) $this->element['maxlength'] : '', 'class' => 'orcid' . ($this->element['class'] ? (string) $this->element['class'] : ''), 'autocomplete' => (string) $this->element['autocomplete'] == 'off' ? 'off' : '', 'readonly' => (string) $this->element['readonly'] == 'true' ? 'readonly' : '', 'disabled' => (string) $this->element['disabled'] == 'true' ? 'disabled' : '', 'onchange' => $this->element['onchange'] ? (string) $this->element['onchange'] : '');
$attr = array();
foreach ($attributes as $key => $value) {
if ($key != 'value' && !$value) {
continue;
}
$attr[] = $key . '="' . $value . '"';
}
$attr = implode(' ', $attr);
$html = array();
$html[] = '<div class="grid">';
$html[] = ' <div class="col span9">';
$html[] = ' <input ' . $attr . ' placeholder="####-####-####-####" />';
$html[] = ' <input type="hidden" name="base_uri" id="base_uri" value="' . rtrim(Request::base(true), '/') . '" />';
$html[] = ' </div>';
$html[] = ' <div class="col span3 omega">';
$html[] = ' <a class="btn button icon-search orcid-fetch" data-base="' . rtrim(Request::base(true), '/') . '" data-id="' . $this->id . '" href="' . Request::base() . '/' . Route::url('index.php?option=com_members&controller=orcid') . '">' . Lang::txt('COM_MEMBERS_PROFILE_ORCID_FIND') . '</a>';
$html[] = ' </div>';
$html[] = '</div>';
$html[] = '<p><img src="' . Request::root() . '/core/components/com_members/site/assets/img/orcid-logo.png" width="80" alt="ORCID" /> ' . Lang::txt('COM_MEMBERS_PROFILE_ORCID_ABOUT') . '</p>';
Behavior::framework(true);
Behavior::modal();
if (file_exists(PATH_ROOT . '/core/components/com_members/site/assets/js/orcid.js')) {
Document::addScript('/core/components/com_members/site/assets/js/orcid.js?t=' . filemtime(PATH_ROOT . '/core/components/com_members/site/assets/js/orcid.js'));
}
return implode($html);
}
示例4: postShorten
/**
* Shorten a new URL
*
* @return Response
*/
public function postShorten()
{
if (!\Auth::check()) {
return \Response::json(array('error' => array('code' => 'NOT-AUTH', 'http_code' => '403', 'message' => 'Forbidden')), 403);
}
$shortenValidator = \Validator::make(\Input::all(), array('url' => 'required|url'));
if ($shortenValidator->fails()) {
return \Response::json(array('error' => array('code' => 'SHORTEN-VALIDATOR-FAILED', 'http_code' => '400', 'message' => 'Bad Request', 'data' => array('validator_messages' => $shortenValidator->messages()))), 400);
}
$bigURL = \Input::get('url');
// User has gone over quota so cant shorten
if (\Auth::user()->quota_max != 0 && \Auth::user()->quota_used + 1 > \Auth::user()->quota_max) {
return \Response::json(array('error' => array('code' => 'QUOTA-USED', 'http_code' => '400', 'message' => 'Bad Request')), 403);
}
$dbLink = \Link::where('destination', '=', $bigURL)->first();
if (!isset($dbLink)) {
$dbLink = new \Link();
$dbLink->user_id = \Auth::user()->id;
$dbLink->code = $dbLink->generateCode();
$dbLink->destination = $bigURL;
$dbLink->clicks = "0";
$dbLink->save();
\Auth::user()->quota_used += 1;
\Auth::user()->save();
}
$linkCode = $dbLink->code;
$linkURL = \Request::root() . '/' . $linkCode;
return \Response::json(array('ok' => array('code' => 'LINK-SHORTENED', 'http_code' => '200', 'message' => 'OK', 'data' => array('url' => $linkURL, 'url_code' => $linkCode))), 200);
}
示例5: __construct
public function __construct(Order $order)
{
if (!$order) {
dd('vantar pöntun');
}
$this->order = $order;
$this->testing = false;
if (env('BORGUN_TEST') == true) {
$this->site = 'https://test.borgun.is/SecurePay/default.aspx';
$this->testing = true;
$this->PaymentGatewayId = '16';
$this->MerchantId = '9275444';
$this->SecretKey = '99887766';
} else {
$this->site = 'https://securepay.borgun.is/securepay/default.aspx';
$this->PaymentGatewayId = env('BORGUN_PAYMENTGATEWAYID');
$this->MerchantId = env('BORGUN_MERCHANTID');
$this->SecretKey = env('BORGUN_SECRETKEY');
}
$this->ReturnUrlSuccess = \Request::root() . '/payment/borgun/success';
$this->ReturnUrlSuccessServer = \Request::root() . '/payment/borgun/successserver';
$this->ReturnUrlCancel = \Request::root() . '/payment/borgun/cancel';
$this->ReturnUrlError = '';
$this->OrderId = $order->reference;
$this->Amount = $order->total();
$this->Currency = 'ISK';
$this->Language = 'IS';
}
示例6: onAfterRoute
/**
* Hook for after routing application
*
* @return void
*/
public function onAfterRoute()
{
if (!App::isAdmin() && !App::isSite()) {
return;
}
$client = 'Site';
if (App::isAdmin()) {
$client = 'Admin';
return;
}
// Check if active for this client (Site|Admin)
if (!$this->params->get('activate' . $client) || Request::getVar('format') == 'pdf') {
return;
}
Html::behavior('framework');
if ($this->params->get('jqueryui')) {
Html::behavior('framework', true);
}
if ($this->params->get('jqueryfb')) {
Html::behavior('modal');
}
if ($this->params->get('noconflict' . $client)) {
Document::addScript(Request::root(true) . '/core/assets/js/jquery.noconflict.js');
}
}
示例7: getUrlAttribute
public function getUrlAttribute()
{
$defaultLocale = config('gtcmslang.defaultLocale');
$propertyName = config('gtcms.premium') && config('gtcmslang.siteIsMultilingual') ? "slug_" . \App::getLocale() : "slug";
$langPrefix = \App::getLocale() == $defaultLocale ? '' : "/" . \App::getLocale();
return \Request::root() . $langPrefix . "/" . $this->{$propertyName};
}
示例8: init
/**
* Initializes the dropbox connection
*
* @param array $params Any connection params needed
* @return \League\Flysystem\Dropbox\DropboxAdapter
**/
public static function init($params = [])
{
// Get the params
$pparams = Plugin::params('filesystem', 'dropbox');
if (isset($params['app_token'])) {
$accessToken = $params['app_token'];
} else {
$info = ['key' => isset($params['app_key']) ? $params['app_key'] : $pparams->get('app_key'), 'secret' => isset($params['app_secret']) ? $params['app_secret'] : $pparams->get('app_secret')];
\Session::set('dropbox.app_key', $info['key']);
\Session::set('dropbox.app_secret', $info['secret']);
\Session::set('dropbox.connection_to_set_up', Request::getVar('connection', 0));
$appInfo = \Dropbox\AppInfo::loadFromJson($info);
$clientIdentifier = 'hubzero-cms/2.0';
$redirectUri = trim(Request::root(), '/') . '/developer/callback/dropboxAuthorize';
$csrfTokenStore = new \Dropbox\ArrayEntryStore($_SESSION, 'dropbox-auth-csrf-token');
$oauth = new \Dropbox\WebAuth($appInfo, $clientIdentifier, $redirectUri, $csrfTokenStore);
// Redirect to dropbox
// We hide the return url in the state field...that's not exactly what
// it was intended for, but it does the trick
$return = Request::getVar('return') ? Request::getVar('return') : Request::current(true);
$return = base64_encode($return);
App::redirect($oauth->start($return));
}
$app_secret = isset($params['app_secret']) ? $params['app_secret'] : $pparams->get('app_secret');
// Create the client
$client = new \Dropbox\Client($accessToken, $app_secret);
// Return the adapter
return new \League\Flysystem\Dropbox\DropboxAdapter($client, isset($params['subdir']) ? $params['subdir'] : null);
}
示例9: setBestLanguage
public static function setBestLanguage($lang)
{
$root = Request::root();
$ruroot = $root . '/ru';
$enroot = $root . '/en';
$deroot = $root . '/de';
$url = URL::previous();
//
Session::put('seg', $url);
$request = parse_url($url, PHP_URL_PATH);
$parse_array = explode("/", $request);
// превращаю в массив
if (in_array('login', $parse_array) or in_array('sign-up', $parse_array) or in_array('map', $parse_array)) {
if (in_array('ru', $parse_array) or in_array('en', $parse_array) or in_array('de', $parse_array)) {
$request = ltrim($request, '/ruden');
$myurl = $root . '/' . $lang . '/' . $request;
} else {
$myurl = $root . '/' . $lang . $request;
}
} elseif ($url == $ruroot or $url == $enroot or $url == $deroot or $url == "{$root}/") {
$myurl = $root . '/' . $lang;
} else {
$myurl = $url;
//Session::put('seg', $url);
}
return $myurl;
}
示例10: postShorten
/**
* Shorten a new URL
*
* @return Response
*/
public function postShorten()
{
// No big url
if (!\Input::has('bigurl')) {
return \Response::json(array('error' => array('code' => 'MISSING-PARAMETERS', 'http_code' => '400', 'message' => 'Bad Request')), 400);
}
$bigURL = \Input::get('bigurl');
$user = $this->apiKey->user;
// No user linked to API key - SHOULD NEVER HAPPEN
if (!isset($user)) {
return \Response::json(array('error' => array('code' => 'NOT-AUTH', 'http_code' => '403', 'message' => 'Forbidden: SHOULD NEVER HAPPEN!')), 403);
}
// User has gone over quota so cant shorten
if ($user->quota_max != 0 && $user->quota_used + 1 > $user->quota_max) {
return \Response::json(array('error' => array('code' => 'QUOTA-USED', 'http_code' => '400', 'message' => 'Bad Request')), 403);
}
if (filter_var($bigURL, FILTER_VALIDATE_URL) === false) {
return \Response::json(array('error' => array('code' => 'URL-INVALID', 'http_code' => '400', 'message' => 'Bad Request')), 400);
}
$dbLink = \Link::where('destination', '=', $bigURL)->first();
if (!isset($dbLink)) {
$dbLink = new \Link();
$dbLink->user_id = $user->id;
$dbLink->code = $dbLink->generateCode();
$dbLink->destination = $bigURL;
$dbLink->clicks = "0";
$dbLink->save();
$user->quota_used += 1;
$user->save();
}
$linkCode = $dbLink->code;
$linkURL = \Request::root() . '/' . $linkCode;
return \Response::json(array('ok' => array('code' => 'LINK-SHORTENED', 'http_code' => '200', 'message' => 'OK', 'data' => array('url' => $linkURL, 'url_code' => $linkCode))), 200);
}
示例11: logoutAction
public function logoutAction()
{
// Log out
if (Auth::User()) {
$user = new Usernhc();
$user_id = Auth::User()->id;
$user_info = $user->getUsernhcById($user_id);
$logs = new Logs();
$logs->ip = Request::getClientIp();
$logs->host = Request::root();
$logs->lastpage = '';
$logs->last_visit = date('Y-m-d H:i:s');
$logs->role_id = $user_info[0]->role_id;
$logs->data_id = rand(1, 11);
$logs->userid = $user_id;
$logs->save();
}
// Redirect to homepage
if (Auth::logout()) {
Auth::logout();
return Redirect::to('login')->with('success', 'ออกจากระบบสำเร็จ');
} else {
return Redirect::to('login')->with('success', 'ออกจากระบบสำเร็จ');
}
}
示例12: __construct
/**
* Create a new Manager object.
*
* @param array $config
* @param \Illuminate\Session\Store $session
*/
public function __construct($config, SessionStore $session)
{
$this->api = new SeeClickFix(array('client_id' => $config["laravel-seeclickfix-api::client_id"], 'client_secret' => $config["laravel-seeclickfix-api::client_secret"], 'redirect_uri' => \Request::root() . $config["laravel-seeclickfix-api::redirect_uri"], 'sandbox' => $config["laravel-seeclickfix-api::sandbox_mode"]));
$this->session = $session;
$this->config = $config;
// Get token from the session, if any
$this->check();
}
示例13: getLink
public function getLink()
{
$domain = \Config::get('shortener-domain', \Request::root());
$domain = !$domain ? \Request::root() : $domain;
$prefix = \Config::get('shortener-prefix', '+');
$prefix = empty($prefix) ? '+' : $prefix;
return str_replace(['https://', 'http://'], '', $domain . '/' . $prefix . $this->hash);
}
示例14: checkActiveMenu
public function checkActiveMenu()
{
$pathUrl = str_replace(Request::root() . "/", "", $this->getUrl());
if (Request::is($pathUrl) || Request::is($pathUrl . "/*")) {
return true;
} else {
return false;
}
}
示例15: __construct
public function __construct()
{
$docs = Doc::orderBy('updated_at', 'desc')->take(10)->get();
View::share('docs', $docs);
$socials = array('og_image' => Config::get('socials.og_image'), 'og_title' => Config::get('socials.og_title'), 'og_description' => Config::get('socials.og_description'), 'og_url' => Request::url(), 'og_site_name' => Request::root());
View::share('socials', $socials);
$params = array('hosts' => array('localhost:9200'));
$this->es = new Elasticsearch\Client($params);
}