本文整理汇总了PHP中Uri::full方法的典型用法代码示例。如果您正苦于以下问题:PHP Uri::full方法的具体用法?PHP Uri::full怎么用?PHP Uri::full使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uri
的用法示例。
在下文中一共展示了Uri::full方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* set config keys and isntance wide settings
*
* @param key string Our instance key
*
* @return void
*/
private function __construct($key)
{
//our instance and distingushing key
$this->key = $key;
//if our key is the default
if ($this->key == 'default') {
//generate our cache key from the full url
$this->key = md5(Uri::full());
}
//get our cache settings
$this->config = Config::settings('cache');
//get our cache config from both system and app settings
$this->duration = $this->config['duration'];
//if we are in debug mode, force the duration to 0 (as in off)
$this->duration = IS_DEBUG === true ? $this->duration : 0;
//create our cache path
$this->dir = PUBLIC_PATH . rtrim($this->config['dir'], '/') . '/';
//set our language code
$this->lang_code = defined('LANG_CODE') ? '-' . LANG_CODE : '';
//create our filename default and append a language code to the filename if it exists
$this->file = $this->checkDir() . $this->key . $this->lang_code . '.' . ltrim($this->config['file_ext'], '.');
//has our file type been passed into the init: self::init('css')->concat($array);
if (isset($this->config[$this->key])) {
//check the cache dir is in place and add our file name
$this->file = $this->checkDir() . $this->config[$this->key];
}
//for debugging
$this->timestamp = Timer::mtime();
}
示例2: __construct
/**
* prevent normal instantiation
*
* @param key string The key that is used to seperate our instances
*
* @return void
*/
private function __construct($key)
{
//if our key is the default
if ($this->key == 'default') {
//generate our meta key from the full url - and make sure its just alphanumeric
$this->key = md5(Uri::full());
}
$this->config = Config::settings('meta');
}
示例3: __construct
/**
* setup the class
*
* @return void
*/
private function __construct()
{
//get the current uri
$this->uri_segments = $this->arguments = Uri::segments();
//get the current uri
$this->uri = rtrim(Uri::full(), '/');
$this->request_type = Input::server('request_method');
//get the route map from the config
$this->route_map = Config::settings('routeMap');
//add any additional routes, adding them to the route map
$this->routeMap();
}
示例4: notify
public function notify()
{
$uri = Uri::full('admin/comments/edit/' . $this->id);
$host = parse_url($_SERVER['HTTP_HOST'], PHP_URL_HOST) ?: 'localhost';
$from = 'notifications@' . $host;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$message = '<html>
<head>
<title>' . __('comments.notify_subject') . '</title>
<style>
body {font: 15px/25px "Helvetica Neue", "Open Sans", "DejaVu Sans", "Arial", sans-serif;}
table {margin: 1em 0; border-collapse: collapse;}
table td {padding: 6px 8px; border: 1px solid #ccc;}
h2, p {margin: 0 0 1em 0;}
</style>
</head>
<body>
<h2>' . __('comments.nofity_heading') . '</h2>
<table>
<tr>
<td>' . __('comments.name') . '</td>
<td>' . $this->name . '</td>
</tr>
<tr>
<td>' . __('comments.email') . '</td>
<td>' . $this->email . '</td>
</tr>
<tr>
<td>' . __('comments.text') . '</td>
<td>' . $this->text . '</td>
</tr>
</table>
<p><a href="' . $uri . '">' . __('comments.view_comment') . '</a></p>
</body>
</html>';
// notify administrators
foreach (User::where('role', '=', 'administrator')->get() as $user) {
$to = $user->real_name . ' <' . $user->email . '>';
mail($to, __('comments.notify_subject'), $message, $headers);
}
}
示例5: function
Notify::success(__('comments.created'));
// dont notify if we have marked as spam
if (!$spam and Config::meta('comment_notifications')) {
$comment->notify();
}
return Response::redirect($posts_page->slug . '/' . $slug . '#comment');
});
/**
* Rss feed
*/
Route::get(array('rss', 'feeds/rss'), function () {
$uri = 'http://' . $_SERVER['HTTP_HOST'];
$rss = new Rss(Config::meta('sitename'), Config::meta('description'), $uri, Config::app('language'));
$query = Post::where('status', '=', 'published')->sort(Base::table('posts.created'), 'desc');
foreach ($query->get() as $article) {
$rss->item($article->title, Uri::full(Registry::get('posts_page')->slug . '/' . $article->slug), $article->description, $article->created);
}
$xml = $rss->output();
return Response::create($xml, 200, array('content-type' => 'application/xml'));
});
/**
* Json feed
*/
Route::get('feeds/json', function () {
$json = Json::encode(array('meta' => Config::get('meta'), 'posts' => Post::where('status', '=', 'published')->sort(Base::table('posts.created'), 'desc')->get()));
return Response::create($json, 200, array('content-type' => 'application/json'));
});
/**
* Search
*/
Route::get(array('search', 'search/(:any)', 'search/(:any)/(:num)'), function ($slug = '', $offset = 1) {
示例6: full_url
/**
* Theme helpers functions
*/
function full_url($url = '')
{
return Uri::full($url);
}
示例7: Validator
$validator = new Validator(array('email' => $email));
$query = User::where('email', '=', $email);
$validator->add('valid', function ($email) use($query) {
return $query->count();
});
$validator->check('email')->is_email(__('users.email_missing'))->is_valid(__('users.email_not_found'));
if ($errors = $validator->errors()) {
Input::flash();
Notify::error($errors);
return Response::redirect('admin/amnesia');
}
$user = $query->fetch();
Session::put('user', $user->id);
$token = noise(8);
Session::put('token', $token);
$uri = Uri::full('admin/reset/' . $token);
$subject = __('users.recovery_subject');
$msg = __('users.recovery_message', $uri);
mail($user->email, $subject, $msg);
Notify::success(__('users.recovery_sent'));
return Response::redirect('admin/login');
}));
/*
Reset password
*/
Route::get('admin/reset/(:any)', array('before' => 'guest', 'main' => function ($key) {
$vars['messages'] = Notify::read();
$vars['token'] = Csrf::token();
$vars['key'] = $token = Session::get('token');
if ($token != $key) {
Notify::error(__('users.recovery_expired'));
示例8: computeUri
/**
* @throws \RuntimeException If request-uri does not match site base-url
* @return string
*/
private function computeUri()
{
$uri = Uri::full();
$pos = strpos($uri, '?');
$app = Config::get('app');
$app_url = empty($app['url']) ? "" : $app['url'];
$base_uri = parse_url($app_url);
$base_path = isset($base_uri['path']) ? $base_uri['path'] : "";
if (strlen($base_path) > 0) {
// if $base_path exists
if (strpos($uri, $base_path) == 0) {
$uri = substr($uri, strlen($base_path));
} else {
throw \RuntimeException('request uri does not match site base url');
}
}
if ($pos !== false) {
return substr($uri, 0, $pos);
}
return $uri;
}