本文整理汇总了PHP中Illuminate\Support\Facades\URL类的典型用法代码示例。如果您正苦于以下问题:PHP URL类的具体用法?PHP URL怎么用?PHP URL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了URL类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setData
public function setData()
{
$current_page = $this->getPage(URL::current());
if (Input::all()) {
session()->put("{$this->prefix}.data." . $current_page['alias'], Input::all());
}
}
开发者ID:wolle404,项目名称:multipage,代码行数:7,代码来源:Multipage.php
示例2: checkForUpdate
public function checkForUpdate($gamertag = '')
{
if ($this->request->ajax() && !\Agent::isRobot()) {
try {
$account = Account::with('destiny.characters')->where('seo', Text::seoGamertag($gamertag))->firstOrFail();
// We don't care about non-panda members
if (!$account->isPandaLove()) {
$this->inactiveCounter = 1;
}
// check for 10 inactive checks
if ($account->destiny->inactiveCounter >= $this->inactiveCounter) {
return response()->json(['updated' => false, 'frozen' => true, 'last_update' => 'This account hasn\'t had new data in awhile. - <a href="' . URL::action('Destiny\\ProfileController@manualUpdate', [$account->seo]) . '" class="ui horizontal green label no_underline">Update Manually</a>']);
}
$char = $account->destiny->firstCharacter();
if ($char->updated_at->diffInMinutes() >= $this->refreshRateInMinutes) {
// update this
$this->dispatch(new UpdateAccount($account));
return response()->json(['updated' => true, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]);
}
return response()->json(['updated' => false, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]);
} catch (ModelNotFoundException $e) {
return response()->json(['error' => 'Gamertag not found']);
}
}
}
开发者ID:GMSteuart,项目名称:PandaLove,代码行数:25,代码来源:ProfileController.php
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
$item = static::queryAll()->withTrashed()->find($id);
$this->fireCMSControllerEvent('showing', [$item, $id]);
$panels = $this->_show($item);
$this->layout->content = View::make('laravel-cms::cms/panels')->with('panels', $panels);
$url = \HTMLize::create($item)->url();
if ('javascript:;' != $url && $url) {
$shortcut = new \stdClass();
$shortcut->url = $url;
$shortcut->title = '网页中查看';
$this->layout->shortcuts[] = $shortcut;
}
try {
$url = URL::action(static::$action . '.edit.form', [$id]);
} catch (\InvalidArgumentException $e) {
$url = null;
}
if ($url) {
$shortcut = new \stdClass();
$shortcut->url = $url;
$shortcut->title = '打开编辑';
$this->layout->shortcuts[] = $shortcut;
}
$this->layout->title = static::$name . '详情';
}
开发者ID:xjtuwangke,项目名称:laravel-cms,代码行数:33,代码来源:CMSDetailTrait.php
示例4: loadPageTitle
private function loadPageTitle()
{
$pageTitles = config('forone.nav_titles');
$curRouteName = Route::currentRouteName();
if (array_key_exists($curRouteName, $pageTitles)) {
return $pageTitles[$curRouteName];
} else {
// load menus title
$url = URL::current();
$menus = config('forone.menus');
foreach ($menus as $title => $menu) {
if (array_key_exists('children', $menu) && $menu['children']) {
foreach ($menu['children'] as $childTitle => $child) {
$pageTitle = $this->parseTitle($childTitle, $url, $child['active_uri']);
if ($pageTitle) {
return $pageTitle;
}
}
} else {
$pageTitle = $this->parseTitle($title, $url, $menu['active_uri']);
if ($pageTitle) {
return $pageTitle;
}
}
}
}
return $curRouteName;
}
开发者ID:Mrzhanglu,项目名称:ForoneAdmin,代码行数:28,代码来源:BaseController.php
示例5: distance
/**
* GET DISTANCE BETWEEN LOCATION AND CAFES
* @param $lat1
* @param $lon1
* @param $lat2
* @param $lon2
* @param $unit
* @param $limit
* @param $id
* @return array|bool
*/
public function distance($lat1, $lon1, $lat2, $lon2, $unit, $limit, $id)
{
$theta = $lon1 - $lon2;
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist);
$miles = $dist * 60 * 1.1515;
$unit = strtoupper($unit);
//$miles = round($miles);
$location = $this->cafe->find($id);
$phone = $location->phone ? '<br/>' . $location->phone : null;
if (strlen($location->image) < 1) {
$image = URL::asset('library/img/loc-noimg.jpg');
} else {
$image = URL::asset('uploads/store_images/' . $location->image);
}
$array = array();
if ($miles <= $limit) {
array_push($array, ['image' => $image, 'miles' => intval($miles), 'id' => $location->id, 'name' => $location->name, 'address' => $location->address . '<br/>' . $location->city . ', ' . $location->state . ' ' . $location->zip_code . $phone, 'lat' => $location->lat, 'lng' => $location->lng, 'state' => $location->state, 'country' => $location->country, 'bakery' => $location->bakery, 'icecream' => $location->icecream, 'coffee' => $location->coffee, 'frozenyogurt' => $location->frozenyogurt, 'smoothies' => $location->smoothies, 'wifi' => $location->wifi, 'curbside' => $location->curbside, 'cookie' => $location->cookie, 'savory' => $location->savory, 'map' => $location->maps_url, 'facebook' => $location->facebook_url, 'online_order' => $location->online_order, 'coming_soon' => $location->coming_soon]);
return $array;
}
return false;
//return $miles;
// if ($unit == "K") {
// return ($miles * 1.609344);
// } else if ($unit == "N") {
// return ($miles * 0.8684);
// } else {
// return round($miles). ' Miles';
// }
}
开发者ID:wearecolossal,项目名称:nestlecafe,代码行数:42,代码来源:LocationController.php
示例6: imageAvatar
protected function imageAvatar()
{
$path = 'upload/' . date('Ym/d/');
$filename = KRandom::getRandStr() . '.jpg';
if (!File::exists(public_path($path))) {
File::makeDirectory(public_path($path), 493, true);
}
while (File::exists(public_path($path) . $filename)) {
$filename = KRandom::getRandStr() . '.jpg';
}
$this->image->resize(new \Imagine\Image\Box(300, 300))->save(public_path($path) . $filename);
ImageModel::createUploadedImage($path . $filename, URL::asset($path . $filename));
$user = AuthModel::user();
$url = URL::asset($path . $filename);
if ($user) {
if ($user->profile) {
$user->profile->avatar = $url;
$user->profile->save();
} else {
ProfileModel::create(array('user_id' => $user->id, 'avatar' => $url));
}
} else {
}
return $url;
}
开发者ID:xjtuwangke,项目名称:laravel-cms,代码行数:25,代码来源:UploadifyController.php
示例7: redirect
function __construct()
{
if (false == self::$enabled) {
return redirect(URL::to('/'), 302)->send();
}
Commons::init();
}
开发者ID:fcolella,项目名称:docker,代码行数:7,代码来源:LandingController.php
示例8: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if (Auth::check()) {
return new RedirectResponse(URL::route('home'));
}
return $next($request);
}
开发者ID:clarkeash,项目名称:StyleCI,代码行数:15,代码来源:RedirectIfAuthenticated.php
示例9: rollback
public function rollback($entity, $id)
{
$modelString = 'Yab\\Quarx\\Models\\' . ucfirst($entity);
if (!class_exists($modelString)) {
$modelString = 'Yab\\Quarx\\Models\\' . ucfirst($entity) . 's';
}
if (!class_exists($modelString)) {
$modelString = 'Quarx\\Modules\\' . ucfirst(str_plural($entity)) . '.\\Models\\' . ucfirst(str_plural($entity));
}
if (!class_exists($modelString)) {
$modelString = 'Quarx\\Modules\\' . ucfirst(str_plural($entity)) . '\\Models\\' . ucfirst(str_singular($entity));
}
if (!class_exists($modelString)) {
$modelString = 'Quarx\\Modules\\' . ucfirst(str_singular($entity)) . '\\Models\\' . ucfirst(str_singular($entity));
}
if (!class_exists($modelString)) {
Quarx::notification('Could not rollback Model not found', 'warning');
return redirect(URL::previous());
}
$model = new $modelString();
$modelInstance = $model->find($id);
$archive = Archive::where('entity_id', $id)->where('entity_type', $modelString)->limit(1)->offset(1)->orderBy('id', 'desc')->first();
if (!$archive) {
Quarx::notification('Could not rollback', 'warning');
return redirect(URL::previous());
}
$archiveData = (array) json_decode($archive->entity_data);
$modelInstance->fill($archiveData);
$modelInstance->save();
Quarx::notification('Rollback was successful', 'success');
return redirect(URL::previous());
}
开发者ID:YABhq,项目名称:Quarx,代码行数:32,代码来源:QuarxFeatureController.php
示例10: latest
public function latest()
{
if ($this->isLoggedIn && $this->request->has('personal') && $this->request->get('personal') == 'true') {
$isCached = false;
$bans = $this->repository->getPersonalBans($this->user->settings()->playerIds());
} else {
$isCached = Cache::has('bans.latest');
$bans = $this->repository->getLatestBans();
}
if ($this->request->has('type') && $this->request->get('type') == 'rss') {
$feed = Feed::make();
$feed->title = sprintf('Latest Battlefield Bans by %s', Config::get('bfacp.site.title'));
$feed->description = sprintf('Latest Battlefield Bans by %s', Config::get('bfacp.site.title'));
$feed->setDateFormat('datetime');
$feed->link = URL::to('api/bans/latest?type=rss');
$feed->lang = 'en';
foreach ($bans as $ban) {
$title = sprintf('%s banned for %s', $ban['player']['SoldierName'], $ban['record']['record_message']);
$view = View::make('system.rss.ban_entry_content', ['playerId' => $ban['player']['PlayerID'], 'playerName' => $ban['player']['SoldierName'], 'banreason' => $ban['record']['record_message'], 'sourceName' => $ban['record']['source_name'], 'sourceId' => $ban['record']['source_id'], 'banReason' => $ban['record']['record_message']]);
$feed->add($title, $ban['record']['source_name'], $ban['player']['profile_url'], $ban['ban_startTime'], $title, $view->render());
}
return $feed->render('atom');
}
return MainHelper::response(['cols' => Lang::get('dashboard.bans.columns'), 'bans' => $bans], null, null, null, $isCached, true);
}
开发者ID:BP4U,项目名称:BFAdminCP,代码行数:25,代码来源:BansController.php
示例11: postRegister
public function postRegister()
{
$request = Request::instance();
$request->setTrustedProxies(array('192.0.0.1', '10.0.0.0/8', '127.0.0.1'));
if ($request->has("email")) {
$requestData = $request->all();
$rules = array("email" => "required|max:255|email");
$validator = Validator::make($requestData, $rules);
if ($validator->fails()) {
return redirect("/")->withErrors(array("Dit is geen correct e-mail adres."));
} else {
$email = $request->input("email");
$verificationCode = md5(uniqid(rand(), true));
DB::table("contestants")->insert(array("email" => $email, "verification_code" => $verificationCode, "verification_received" => false, "ip_address" => $request->getClientIp()));
$url = URL::action("HomeController@handleVerification", array("verify" => $verificationCode, "email" => $email));
$emailData = array("url" => $url);
Mail::send("email.email", $emailData, function ($message) use($email) {
$message->from("[email protected]", "Laravel Contest");
$message->subject("Deelname wedstrijd!");
$message->to($email);
});
$data = array("email" => $email);
return view("register.success", $data);
}
//Captcha
}
return redirect()->action("HomeController@getRegister");
}
开发者ID:BennoDev,项目名称:WebDevelopment,代码行数:28,代码来源:HomeController.php
示例12: testGetSourceSetAttribute
public function testGetSourceSetAttribute()
{
$srcset = $this->createSourceSet();
$base = URL::to('/');
$expected = "{$base}/path.jpg 200w, {$base}/path2.jpg 300w";
$this->assertEquals($expected, $srcset->getSrcSetAttribute());
}
开发者ID:OFFLINE-GmbH,项目名称:oc-responsive-images-plugin,代码行数:7,代码来源:SourceSetTest.php
示例13: create
public function create($modelName, $item = null, ModelConfig $config = null)
{
$page = new Page();
$header = new PageHeader();
$header->setText('Create ' . $modelName);
if ($item != null && isset($item->id)) {
$model = $this->aujaConfigurator->getModel($modelName);
$displayField = $this->aujaConfigurator->getDisplayField($model, $config);
$header->setText('Edit ' . (isset($item->{$displayField}) ? $item->{$displayField} : $modelName));
$deleteButton = new Button();
$deleteButton->setText(Lang::trans('Delete'));
$deleteButton->setConfirmationMessage(Lang::trans('Are you sure?'));
$deleteButton->setTarget(URL::route($this->aujaRouter->getDeleteName($modelName), $item->id));
$deleteButton->setMethod('delete');
$header->addButton($deleteButton);
}
$page->addPageComponent($header);
$form = new Form();
$action = $item == null || !isset($item->id) ? URL::route($this->aujaRouter->getStoreName($modelName)) : URL::route($this->aujaRouter->getUpdateName($modelName), $item->id);
$form->setAction($action);
$form->setMethod($item == null ? 'POST' : 'PUT');
$model = $this->aujaConfigurator->getModel($modelName);
$visibleFields = $this->aujaConfigurator->getVisibleFields($model, $config);
foreach ($visibleFields as $columnName) {
$column = $model->getColumn($columnName);
$formItem = $this->formItemFactory->getFormItem($model, $column, $item);
$form->addFormItem($formItem);
}
$submit = new SubmitFormItem();
$submit->setText(Lang::trans('Submit'));
$form->addFormItem($submit);
$page->addPageComponent($form);
return $page;
}
开发者ID:hramose,项目名称:Auja-Laravel,代码行数:34,代码来源:PageFactory.php
示例14: formatModel
public function formatModel($model)
{
$script_url = str_replace(['http://', 'https://'], ['', ''], URL::to('/')) . '/zl.js';
$model->form_code = '<form class="zlform" action="' . URL::action('\\Zephia\\ZLeader\\Http\\Controllers\\Api\\LeadController@store', ['slug' => $model->slug]) . '" method="post">' . "\r\n<!-- Fields: (zlfield_example) -->\r\n" . '</form>' . "\r\n";
$model->form_code .= "<script type=\"text/javascript\">" . "\r\n" . "(function(d,s,e,t){e=d.createElement(s);e.type='text/java'+s;e.async='async';" . "\r\n" . "e.src='http'+('https:'===location.protocol?'s://':'://')+'" . $script_url . "';t=d.getElementsByTagName(s)[0];" . "\r\n" . "t.parentNode.insertBefore(e,t);})(document,'script');" . "\r\n" . "</script>";
return $model;
}
开发者ID:zephia,项目名称:zleader,代码行数:7,代码来源:FormCRUD.php
示例15: product
public function product($id)
{
// Product Detail
$product = Product::find($id);
$producer = Producer::find($product->producer);
$producerItem = "<a href='" . URL::to('/') . "/producer/" . $producer->id . "/" . strtolower($producer->producer) . ".html'>" . $producer->producer . "</a>";
// Category
$productCategoryID = Product::find($id)->category_id;
// breadcrumb
$breadcrumb = $this->breadcrumb($productCategoryID, $id);
// Best Seller
$bestSeller = $this->bestSeller();
$image = Images::where('productID', $product['id'])->first();
$thumbnail = $image['imageSrc'];
$thumbnailImage = '<a class="preView" rel="' . URL::to('/') . '/' . $thumbnail . '"><img src="' . URL::to('/') . '/' . $thumbnail . '" alt="" class="img-responsive"></a>';
$images = Images::where('productID', $id)->get();
$listImages = "";
foreach ($images as $image) {
$img = $image['imageSrc'];
$listImages .= '<a href="' . URL::to('/') . '/' . $img . '" class="fancybox-button" rel="photos-lib"><img alt="Berry Lace Dress" src="' . URL::to('/') . '/' . $img . '"></a>';
}
$review = '<div class="fb-comments" data-href="' . URL::to('/') . '/product/' . $id . '"
data-num-posts="10" data-width="700px"></div>';
return view('home.product.detail')->with(['breadcrumb' => $breadcrumb, 'product' => $product, 'producer' => $producerItem, 'bestSeller' => $bestSeller, 'thumbnailImage' => $thumbnailImage, 'listImages' => $listImages, 'review' => $review]);
}
开发者ID:dhduc,项目名称:shopui,代码行数:25,代码来源:ProductController.php
示例16: block_btn_status_select
/**
* 启用禁用状态切换
* @param $item
* @return string
*/
public static function block_btn_status_select($item)
{
$url = URL::action(static::$action . '.edit.status');
if (Permission::checkMe(static::$action . '.edit.status')) {
$disabled = "";
} else {
$disabled = "disabled";
}
$current = $item->getStatus();
$token = Session::token();
$li = '';
$allowedStatus = $item->getAvailableNextStatus();
if (isset(static::$allowedStatus) && is_array(static::$allowedStatus)) {
$allowedStatus = array_intersect($allowedStatus, static::$allowedStatus);
}
foreach ($allowedStatus as $status) {
$li .= <<<LI
<li><a class="table-role-btn-switch" href="javascript:;" data-attr-id='{$item->id}' data-attr-token='{$token}' data-attr-url='{$url}' {$disabled}>{$status}</a></li>
LI;
}
$button = <<<BUTTON
<div class="btn-group" style="margin:0 auto;">
<button type="button" class="btn btn-xs btn-warning btn-current-status" {$disabled}>{$current}</button>
<button type="button" class="btn btn-xs btn-warning dropdown-toggle" data-toggle="dropdown" {$disabled}>
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
{$li}
</ul>
</div>
BUTTON;
return $button;
}
开发者ID:xjtuwangke,项目名称:laravel-cms,代码行数:39,代码来源:CMSStatusTrait.php
示例17: __construct
/**
* Create a new instance.
*
* @return void
*/
public function __construct()
{
//Set API base url if empty
if (empty($this->apiBaseUrl)) {
$this->apiBaseUrl = URL::to('/');
}
//Set API url if empty
if (empty($this->apiUrl)) {
$this->apiUrl = $this->apiBaseUrl . '/api/' . $this->apiVersion;
}
//Get the webste OAuth Client credentials
$oauthClient = OauthClient::where('name', '=', 'website')->first();
if (is_object($oauthClient)) {
$this->clientId = $oauthClient->id;
$this->clientSecret = $oauthClient->secret;
}
unset($oauthClient);
Blade::extend(function ($view) {
return preg_replace(array('#@translate\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@translate\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Translate::t("$1")', 'Translate::t(\'$1\')'), $view);
});
Blade::extend(function ($view) {
return preg_replace(array('#@option\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@option\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Option::getAttribute(\'$1\')', 'Option::getAttribute(\'$1\')'), $view);
});
Blade::extend(function ($view) {
return preg_replace(array('#@hasPermission\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@hasPermission\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Access::has(\'$1\')', 'Access::has(\'$1\')'), $view);
});
$this->getAccessToken();
View::share('basePath', Request::getBaseURL());
}
开发者ID:andrims21,项目名称:eBri,代码行数:34,代码来源:Base.php
示例18: setBest
public function setBest(Request $request, $id)
{
$comment = GuideComment::findOrFail($id);
$comment->isbest = $request->input('value');
$comment->save();
return redirect(URL::previous());
}
开发者ID:sandywalker,项目名称:xiehouxing,代码行数:7,代码来源:AdminGuideCommentController.php
示例19: build
public function build()
{
$output = "";
$this->attributes["class"] = "form-control";
if (parent::build() === false) {
return;
}
switch ($this->status) {
case "disabled":
case "show":
if ($this->type == 'hidden' || $this->value == "") {
$output = "";
} elseif (!isset($this->value)) {
$output = $this->layout['null_label'];
} else {
$output = nl2br(htmlspecialchars($this->value));
}
$output = "<div class='help-block'>" . $output . "</div>";
break;
case "create":
case "modify":
Rapyd::js('packages/zofe/rapyd/assets/tinymce/tinymce.min.js');
$output = Form::textarea($this->db_name, $this->value, $this->attributes);
$output .= Rapyd::script("\n tinymce.init({\n selector: 'textarea#" . $this->name . "',\n plugins: [\n 'advlist autolink link image lists charmap print preview hr anchor pagebreak',\n 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',\n 'save table contextmenu directionality emoticons template paste textcolor responsivefilemanager'\n ],\n toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | responsivefilemanager | print preview media fullpage | forecolor backcolor emoticons', \n image_advtab: true ,\n external_filemanager_path:'" . URL::to('/') . "/packages/filemanager/',\n filemanager_title:'Upload',\n });");
break;
case "hidden":
$output = Form::hidden($this->db_name, $this->value);
break;
default:
}
$this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
}
开发者ID:parabol,项目名称:laravel-cms,代码行数:32,代码来源:Redactor.php
示例20: setTop
public function setTop($id, $result, Request $request)
{
$note = Note::findOrFail($id);
$note->istop = $result;
$note->save();
return redirect(URL::previous());
}
开发者ID:sandywalker,项目名称:xiehouxing,代码行数:7,代码来源:AdminNoteController.php
注:本文中的Illuminate\Support\Facades\URL类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论