本文整理汇总了PHP中URI::current方法的典型用法代码示例。如果您正苦于以下问题:PHP URI::current方法的具体用法?PHP URI::current怎么用?PHP URI::current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URI
的用法示例。
在下文中一共展示了URI::current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_request
/**
* Processing Request
*
* @todo: add this to App::run();
* @return boolean
*/
public static function process_request()
{
$uri = static::$uri !== false ? static::$uri : URI::current();
$match = false;
foreach (static::$routes as $route) {
if ($route->match($uri)) {
$match = true;
}
}
return $match;
}
示例2: eval_route
private function eval_route()
{
$route = URI::current();
$formula = $this->get_formula($route, $action_count);
$m = new EvalMath();
$result = $m->e($formula);
if ($action_count <= 10 && $result !== false) {
return round($result, 0, PHP_ROUND_HALF_UP);
} else {
return 'Incorrect arithmetic route';
}
}
示例3: call
public function call()
{
$cacheEnabled = array_get($this->action, "cacheEnabled") && Config::item("application", "cache", true);
if ($cacheEnabled && ($data = Cache::get(URI::current()))) {
$headersEnd = strpos($data, "\n\n");
if ($headersEnd > 0) {
$headers = explode("\n", substr($data, 0, $headersEnd));
foreach ($headers as $header) {
header($header);
}
}
$data = substr($data, $headersEnd + 2);
return $data;
}
$response = $this->response();
if ($cacheEnabled) {
$headersList = implode("\n", headers_list());
Cache::save(URI::current(), $headersList . "\n\n" . $response, array_get($this->action, "cacheExpirationTime"));
} else {
Cache::remove(URI::current());
}
return $response;
}
示例4:
<span class="icon-bar"></span>
</a>
<a class="brand" href="#"><span style="color:#777">Laravel</span><span style="color:#ddd">Squi</span></a>
<div class="nav-collapse">
<ul class="nav">
<li <?php
if (URI::current() == 'squi/docs/form') {
echo 'class="active"';
}
?>
><a href="<?php
echo URL::to('squi/docs/form');
?>
">Form</a></li>
<li <?php
if (URI::current() == 'squi/docs/table') {
echo 'class="active"';
}
?>
><a href="<?php
echo URL::to('squi/docs/table');
?>
">Table</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<?php
示例5: page_title
/**
* Output heading
*
* Generate <h1>, <h2> etc
* @param array $args
*/
function page_title($args = array())
{
$args = array_merge(array('echo' => TRUE, 'a' => FALSE, 'tag' => 'h1', 'caption' => Xysti::page('caption'), 'href' => URI::current(), 'title' => Xysti::page('title')), $args);
$output = '';
$output .= '<' . $args['tag'] . '>';
if ($args['a']) {
$output .= '<a href="' . $args['href'] . '">';
}
$output .= $args['title'];
if ($args['caption']) {
$output .= ' <span class="caption">' . $args['caption'] . '</span>';
}
if ($args['a']) {
$output .= '</a>';
}
$output .= '</' . $args['tag'] . '>' . PHP_EOL;
if ($args['echo']) {
echo $output;
} else {
return $output;
}
}
示例6: compiled
/**
* Return the compiled output for a given container.
*
* @return string
*/
public static function compiled()
{
$hash = md5('basset::' . URI::current());
// Cache is the first priority, if a cached copy exists then Basset will return
// it before anything else.
if (Cache::has($hash)) {
return Cache::get($hash);
} elseif (File::exists($path = static::$routes[URI::current()]->config->get('compiling.directory') . DS . $hash)) {
return File::get($path);
}
// If nothing could be found we'll let them know by simply returning a not found
// error to the browser.
return '/* Basset could not load [' . URI::current() . '] */';
}
示例7: function
|--------------------------------------------------------------------------
| Filters
|--------------------------------------------------------------------------
*/
Route::filter('before', function () {
});
Route::filter('after', function ($response) {
});
Route::filter('csrf', function () {
if (Request::forged()) {
return Response::error('500');
}
});
Route::filter('auth', function () {
if (Auth::guest()) {
Session::put('return', URI::current());
return Redirect::to('login');
}
});
Route::filter('ajax', function () {
if (!Request::ajax()) {
return Response::error('404');
}
});
Route::filter('project', function () {
// find project id from issue object
if (Request::route()->parameters[0] == 0) {
return;
}
Project::load_project(Request::route()->parameters[0]);
if (!Project::current()) {
示例8: is_active
public function is_active($menuitem)
{
if ($menuitem['url'] == URI::current()) {
return true;
}
return false;
}
示例9: action
/**
* Determine the appropriate action parameter to use for a form.
*
* If no action is specified, the current request URI will be used.
*
* @param string $action
* @param bool $https
* @return string
*/
protected static function action($action, $https)
{
$uri = is_null($action) ? URI::current() : $action;
return HTML::entities(URL::to($uri, $https));
}
示例10: uri
/**
* Get the URI for the current request.
*
* @return string
*/
public static function uri()
{
return URI::current();
}
示例11: function
* This is what makes it possible for Basset routes to be adjusted prior to them being displayed.
*/
$handler = Bundle::handles(URI::current());
Route::filter("{$handler}::before", function () {
Config::set('session.driver', '');
return Basset::compiled();
});
/**
* After the Basset route is run we'll adjust the response object setting the appropriate content
* type for the assets.
*/
Route::filter("{$handler}::after", function ($response) {
$types = array('less' => 'text/css', 'sass' => 'text/css', 'scss' => 'text/css', 'css' => 'text/css', 'js' => 'text/javascript');
$extension = File::extension(Request::uri());
if (array_key_exists($extension, $types)) {
$response->header('Content-Type', $types[$extension]);
}
// To prevent any further output being added to any Basset routes we'll clear any events listening
// for the laravel.done event.
Event::clear('laravel.done');
});
}
/**
* If the current URI is not being handled by Basset then all registered Basset routes will be
* compiled once Laravel has finished doing its thing.
*/
if (!starts_with(URI::current(), Bundle::option('basset', 'handles'))) {
Event::listen('laravel.done', function () {
Basset::compile();
});
}
示例12: htmlspecialchars
</div>
</div>
<div class="content-wrap">
<div>
<div class="page_id">
<div class="page">
<?php
$cur = URI::segment(1);
$cur = htmlspecialchars($cur);
?>
@if(!empty($cur))
<?php
$url = explode('/', URI::current());
$str = '';
for ($i = 1; $i < count($url); $i++) {
$str .= ' / ' . htmlspecialchars(ucfirst($url[$i]));
}
?>
<a href="/{{URI::segment(1)}}">{{ htmlspecialchars(ucfirst(URI::segment(1))) }}</a>
<span style="font-size:75%">{{ htmlspecialchars($str) }}</span>
@else
<a href="/">Home</a>
@endif
</div>
</div>
<div class="page_id_border"></div>
</div>
<div class='content'>
示例13: implode
$allowed = true;
break;
}
}
if (!$allowed || count($pieces) == 0) {
return Response::code(403);
}
$path = implode(DS, $pieces);
if (!File::exists(J_PATH . $path) || is_dir(J_PATH . $path)) {
return Response::code(404);
}
$im = new Image(J_PATH . $path);
$im->resize((int) Request::get("width"), (int) Request::get("height"), Request::get("method", "fit"), Request::get("background", 0xffffff));
$im->header();
});
Router::register("*", "(:all)", function () {
Response::code(404);
if (Request::isLocal()) {
echo "URI: " . URI::full() . "<br>\n";
echo "Path Info: " . Request::pathInfo() . "\n";
}
return;
});
if (URI::isManager()) {
Structure::routes();
}
Request::$route = Router::route(Request::method(), URI::current());
Event::fire(J_EVENT_RESPONSE_START);
echo Request::$route->call();
Event::fire(J_EVENT_RESPONSE_END);
//echo "<br><br>" . round(elapsed_time() * 1000000) / 1000 . "ms";
示例14: function
return Response::error('500');
}
});
Route::filter('auth', function () {
if (Auth::guest()) {
return Redirect::to('/');
}
});
Route::filter('Sentry_auth', function () {
if (Sentry::guest()) {
return Redirect::to('/');
}
});
Route::filter('ip', function () {
// Create the Eloquent object Visit
$visit = new Track();
$browser = new Browser();
$visit->location = Locate::get('city') . ', ' . Locate::get('state') . ', ' . Locate::get('country');
$visit->ip_address = Request::ip();
$visit->request = URI::current();
if (Auth::check()) {
$visit->user_id = Auth::user()->id;
}
// Browser stats
$visit->browser = $browser->getBrowser();
$visit->browser_version = $browser->getVersion();
$visit->platform = $browser->getPlatform();
$visit->mobile = $browser->isMobile();
$visit->robot = $browser->isRobot();
$visit->save();
});
示例15: e
</div>
</form>
</td>
</tr>
</tfoot>
</table>
<h5>Sharing</h5>
<p>
<?php
echo e(__("r.projects.admin.sharing"));
?>
<form action="<?php
echo e(route('project_toggle_public', array($project->id)));
?>
?redirect=<?php
echo e(URI::current());
?>
" method="POST">
<div class="well">
<?php
if ($project->public) {
?>
<span class="public-status">Status: Public</span>
<button class="btn btn-danger">Set to Private</button>
<?php
} else {
?>
<span class="public-status">Status: Private</span>
<button class="btn btn-success">Set to Public (Recommended!)</button>
<?php
}