本文整理汇总了PHP中URL::current方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::current方法的具体用法?PHP URL::current怎么用?PHP URL::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($id = false)
{
parent::__construct();
$this->add("products");
$this->name = "form_slider";
$this->enctype = "multipart/form-data";
$this->action = URL::current();
$this->products = ProductDB::getAdminShow();
if (!$id) {
$this->text("title", "Название:");
$this->textarea("description", "Описание:");
$this->submit("insert_slider", "Сохранить");
} else {
$this->add("img");
$this->add("product_id");
$this->hidden("id", $id);
$obj = new SliderDB();
$obj->load($id);
$this->text("title", "Название:", $obj->title);
$img = ProductDB::getCellOnID($obj->product_id, "img");
$view = new View(Config::DIR_TMPL);
$this->img = $view->render("img", array("src" => Config::DIR_IMG_PRODUCT . $img), true);
$this->textarea("description", "Описание:", $obj->description);
$this->submit("update_slider", "Сохранить");
$this->product_id = $obj->product_id;
}
}
示例2: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if ($e instanceof VerifyCsrfToken) {
Log::error('CSRF Error', ['exception' => $e, 'url' => URL::current()]);
}
return parent::report($e);
}
示例3: __construct
public function __construct($view, $param)
{
parent::__construct();
$this->add("hornav");
$this->add("n");
$this->name = "form_viewgallery";
$this->enctype = "multipart/form-data";
$this->action = URL::current();
$viewgallery_obj = new ViewgalleryDB();
$viewgallery_obj->load($param["view_id"]);
$gallery_obj = new GalleryDB();
$gallery_obj->load($param["gallery_id"]);
$this->hornav = new Hornav();
$this->hornav->addData("Админпанель", URL::get("menu", "admin"));
$this->hornav->addData("Галерея", URL::get("viewgallery", "admin"));
$this->hornav->addData($viewgallery_obj->title, URL::get("listgallery", "admin", array("view_id" => $param["view_id"])));
$this->hornav->addData($gallery_obj->title, URL::get("listimg", "admin", array("view_id" => $param["view_id"], "gallery_id" => $param["gallery_id"])));
if (!$param["img_id"]) {
$this->hornav->addData("Добавить");
$this->file("img", "Картинка:");
$this->submit("insert_imggallery", "Сохранить");
} else {
$this->hidden("id", $param["img_id"]);
$gallery_obj = new GalleryDB();
$gallery_obj->load($param["img_id"]);
$this->hornav->addData("Изменить");
$this->file("img", "Картинка:");
$this->submit("update_imggallery", "Сохранить");
}
}
示例4: download
protected function download(Path $path)
{
// check basic auth headers as well, so if specified,
// client doesn't have to go through the login and cookie dance.
Auth::onceBasic("username");
// check we're logged in
if (!Auth::check()) {
Session::flash('redirect', URL::current());
return Redirect::route('login');
}
// record the download in the db
$record = $path->loadCreateRecord($path);
$record->downloaded_at = $record->freshTimestamp();
$record->increment('downloads');
$record->save();
$isMisc = strpos($path->getRelative(), '/Misc/') === 0;
if ($isMisc || $path->isSafeExtension()) {
// check if the extension is safe to download
$file = new AsciiSafeDownloadFile($path->getPathname());
// see comments in AsciiSafeDownloadFile class
$baseName = $path->getBasename();
$baseName = str_replace('%', '', $baseName);
try {
return Response::download($file, $baseName);
} catch (InvalidArgumentException $e) {
App::abort(500, 'This file has a malformed filename. Please contact an admin.');
}
} else {
App::abort(403, sprintf('File type "%s" not allowed', $path->getExtension()));
}
}
示例5: __construct
public function __construct($id = false)
{
parent::__construct();
$this->name = "form_section";
$this->enctype = "multipart/form-data";
$this->action = URL::current();
if (!$id) {
$this->text("title", "Название:", FormProcessor::getSessionData("title"));
$this->textarea("meta_desc", "Описание:", FormProcessor::getSessionData("meta_desc"));
$this->textarea("meta_key", "Ключевые слова:", FormProcessor::getSessionData("meta_key"));
$this->textarea("full_text", "Длинное описание:", FormProcessor::getSessionData("full_text"));
$this->text("alias", "ЧПУ ссылка", FormProcessor::getSessionData("alias"));
$this->submit("insert_section", "Сохранить");
} else {
$this->hidden("id", $id);
$obj = new SectionDB();
$obj->load($id);
$this->text("title", "Название:", $obj->title);
$this->textarea("meta_desc", "Описание:", $obj->meta_desc);
$this->textarea("meta_key", "Ключевые слова:", $obj->meta_key);
$this->textarea("full_text", "Длинное описание:", $obj->full_text);
$link = URL::get("section", "", array("id" => $id), true, "", false);
$alias = SefDB::getAliasOnLink($link);
$this->text("alias", "ЧПУ ссылка", $alias);
$this->submit("update_section", "Сохранить");
}
}
示例6: image
public function image()
{
if (!Auth::check()) {
Session::flash('redirect', URL::current());
return Redirect::route('login');
}
$relativePath = Input::get('path');
$filePath = Input::get('file');
$path = Path::fromRelative($relativePath);
if (!$path->exists()) {
App::abort(404, 'Archive not found');
}
$archive = Archive\Factory::open($path);
$imageStream = $archive->getEntryStream($filePath);
$imageData = stream_get_contents($imageStream);
$response = Response::make($imageData);
$ext = pathinfo($filePath, PATHINFO_EXTENSION);
switch ($ext) {
case 'jpg':
case 'jpeg':
$response->header('Content-Type', 'image/jpeg');
break;
case 'png':
$response->header('Content-Type', 'image/png');
break;
}
$response->header('Last-Modified', gmdate('D, d M Y H:i:s', $path->getMTime()) . ' GMT');
$response->header('Expires', gmdate('D, d M Y H:i:s', strtotime('+1 year')) . ' GMT');
$response->header('Cache-Control', 'public');
return $response;
}
示例7: __construct
public function __construct($id = false)
{
parent::__construct();
$this->add("sections");
$this->name = "form_category";
$this->enctype = "multipart/form-data";
$this->action = URL::current();
$this->sections = SectionDB::getAll();
if (!$id) {
$this->text("title", "Название:", FormProcessor::getSessionData("title"));
$this->textarea("meta_desc", "Описание:", FormProcessor::getSessionData("meta_desc"));
$this->textarea("meta_key", "Ключевые слова:", FormProcessor::getSessionData("meta_key"));
$this->text("alias", "ЧПУ ссылка", FormProcessor::getSessionData("alias"));
$this->checkbox("show", "Показывать:", "1");
$this->submit("insert_category", "Сохранить");
} else {
$this->add("section_id");
$this->hidden("id", $id);
$obj = new CategoryDB();
$obj->load($id);
$this->text("title", "Название:", $obj->title);
$this->textarea("meta_desc", "Описание:", $obj->meta_desc);
$this->textarea("meta_key", "Ключевые слова:", $obj->meta_key);
$link = URL::get("category", "", array("id" => $id), true, "", false);
$alias = SefDB::getAliasOnLink($link);
$this->text("alias", "ЧПУ ссылка", $alias);
$this->checkbox("show", "Показывать:", "1", "", (int) $obj->show);
$this->submit("update_category", "Сохранить");
$this->section_id = $obj->section_id;
}
}
示例8: getCallback
/**
* Handles authentication
*
* @param string $slug
* @return mixed
*/
public function getCallback($slug)
{
try {
$user = Social::authenticate($slug, URL::current(), function ($link, $provider, $token, $slug) {
if ($slug == 'facebook') {
// Retrieve the user in question for modificiation
$user = $link->getUser();
// Get user details
$data = $provider->getUserDetails($token)->getArrayCopy();
// Update user details
$user->facebook_uid = $data['uid'];
$user->save();
} else {
if ($slug == 'twitter') {
// Retrieve the user in question for modificiation
$user = $link->getUser();
// Get user details
$data = $provider->getUserDetails($token);
// Update user details
$user->twitter_nickname = $data->nickname;
$user->twitter_image_url = $data->imageUrl;
$user->save();
}
}
});
return Redirect::to('oauth/authenticated');
} catch (Exception $e) {
return Redirect::to('oauth')->withErrors($e->getMessage());
}
}
示例9: __construct
public function __construct($view, $param)
{
parent::__construct();
$this->add("hornav");
$this->add("n");
$this->name = "form_viewgallery";
$this->enctype = "multipart/form-data";
$this->action = URL::current();
$viewgallery_obj = new ViewgalleryDB();
$viewgallery_obj->load($param["view_id"]);
$this->hornav = new Hornav();
$this->hornav->addData("Админпанель", URL::get("menu", "admin"));
$this->hornav->addData("Галерея", URL::get("viewgallery", "admin"));
$this->hornav->addData($viewgallery_obj->title, URL::get("listgallery", "admin", array("view_id" => $param["view_id"])));
if (!$param["gallery_id"]) {
$this->hornav->addData("Добавить");
$this->text("title", "Название:", FormProcessor::getSessionData("title"));
$this->file("img", "Картинка:");
$this->textarea("meta_desc", "Описание:", FormProcessor::getSessionData("meta_desc"));
$this->textarea("meta_key", "Ключевые слова:", FormProcessor::getSessionData("meta_key"));
$this->submit("insert_listgallery", "Сохранить");
} else {
$this->hidden("id", $param["gallery_id"]);
$gallery_obj = new GalleryDB();
$gallery_obj->load($param["gallery_id"]);
$this->hornav->addData("Изменить");
$this->text("title", "Название:", $gallery_obj->title);
$this->file("img", "Картинка:");
$this->textarea("meta_desc", "Описание:", $gallery_obj->meta_desc);
$this->textarea("meta_key", "Ключевые слова:", $gallery_obj->meta_key);
$this->submit("update_listgallery", "Сохранить");
}
}
示例10: oauth
public function oauth($tokenid)
{
$successURL = isset($_GET['returnurl']) ? $_GET['returnurl'] : new URL('auth', 'invalidReturn');
$failureURL = isset($_GET['cancelurl']) ? $_GET['cancelurl'] : $successURL;
$grant = isset($_GET['grant']) ? (int) $_GET['grant'] === 1 : null;
$session = Session::getInstance();
$token = db()->table('token')->get('token', $tokenid)->fetch();
#No token, no access
if (!$token) {
throw new PublicException('No token', 404);
}
$this->view->set('token', $token);
$this->view->set('cancelURL', $failureURL);
$this->view->set('continue', (string) new URL('auth', 'oauth', $tokenid, array_merge($_GET->getRaw(), array('grant' => 1))));
if (!$session->getUser()) {
return $this->response->getHeaders()->redirect(new URL('user', 'login', array('returnto' => (string) URL::current())));
}
if ($grant === false) {
return $this->response->getHeaders()->redirect($failureURL);
}
if ($grant === true) {
$token->user = $this->user;
$token->store();
return $this->response->getHeaders()->redirect($successURL);
}
}
示例11: do_help
public function do_help()
{
$user = Sentry::getUser();
$subject = "Newsletter Help: " . Input::get('subject');
$emailbody = Input::get('message');
$from_name = $user->first_name . ' ' . $user->last_name;
$from_email = $user->email;
$admin = User::first();
$to_name = $admin->first_name . ' ' . $admin->last_name;
$to_email = $admin->email;
$rules = array('subject' => 'required|max:128', 'message' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('dashboard/help')->withErrors($validator);
} else {
$browser = new Browser();
$userbrowser = $browser->getBrowser() . ' ' . $browser->getVersion();
$userplatform = $browser->getPlatform();
$userIP = $_SERVER["REMOTE_ADDR"];
$page = URL::current();
$data = array('emailbody' => $emailbody, 'userbrowser' => $userbrowser, 'userplatform' => $userplatform, 'userIP' => $userIP, 'page' => $page);
$issent = Mail::send('emails.help-email', $data, function ($message) use($from_email, $from_name, $subject, $to_name, $to_email) {
$message->from($from_email, $from_name)->to($to_email, $to_name)->subject($subject);
});
if ($issent) {
return Redirect::to('dashboard/help')->with('success', 'Success! You will be contacted soon regarding your issue.');
} else {
return Redirect::to('dashboard/help')->with('error', 'An error was encountered sending the email. Please try again.');
}
}
}
示例12: current
public static function current($stripPages = true)
{
$url = str_replace(URL::to('/'), '', URL::current());
if ($stripPages === true) {
$url = str_replace('/pages/', '', $url);
}
return $url;
}
示例13: edit
public function edit()
{
$post = $this->request->post();
$post['author'] = $_SESSION['user']['username'];
$post['sesuatu'] = 'Powered by Xinix';
$this->get($this->request->getPathInfo())->save($post);
$this->app->redirect(\URL::current());
}
示例14: __construct
public function __construct()
{
$uri = str_replace(\URL::route('admin.index'), '', \URL::current());
$parts = explode('/', $uri);
$route_name = $parts[1];
$this->entity = \EntityDriver::findByRouteName($route_name);
$this->driver = new \EntityCrudDriver($this->entity->model_name);
}
示例15: __construct
public function __construct($options = null, $initialize = true, $error_messages = null)
{
$this->options = ['csrf_token' => ['name' => '_token', 'value' => csrf_token()], 'script_url' => \URL::current(), 'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')) . '/files/', 'upload_url' => $this->get_full_url() . '/files/'];
if ($options) {
$this->options = $options + $this->options;
}
parent::__construct($this->options, $initialize, $error_messages);
}