Esempio n. 1
0
 /**
  * Dump the results of the currently established route.
  *
  * @return void
  */
 protected function route()
 {
     // We'll call the router using the method and URI specified by
     // the developer on the CLI. If a route is found, we will not
     // run the filters, but simply dump the result.
     $route = Router::route(Request::method(), URI::current());
     if (!is_null($route)) {
         var_dump($route->response());
     } else {
         echo '404: Not Found';
     }
 }
Esempio n. 2
0
 /**
  * Calls the specified route and returns its response.
  *
  * @param  string    $method
  * @param  string    $uri
  * @return Response
  */
 public static function forward($method, $uri)
 {
     return Router::route(strtoupper($method), $uri)->call();
 }
Esempio n. 3
0
 /**
  * Test foreign characters can be used in routes.
  *
  * @group laravel
  */
 public function testForeignCharsInRoutes()
 {
     Route::get(urlencode('مدرس_رياضيات') . '/(:any)', function () {
     });
     Route::get(urlencode('مدرس_رياضيات'), function () {
     });
     Route::get(urlencode('ÇœŪ'), function () {
     });
     Route::get(urlencode('私は料理が大好き'), function () {
     });
     $this->assertEquals(array(urlencode('مدرس_رياضيات')), Router::route('GET', urlencode('مدرس_رياضيات') . '/' . urlencode('مدرس_رياضيات'))->parameters);
     $this->assertEquals(urlencode('مدرس_رياضيات'), Router::route('GET', urlencode('مدرس_رياضيات'))->uri);
     $this->assertEquals(urlencode('ÇœŪ'), Router::route('GET', urlencode('ÇœŪ'))->uri);
     $this->assertEquals(urlencode('私は料理が大好き'), Router::route('GET', urlencode('私は料理が大好き'))->uri);
 }
Esempio n. 4
0
});
$uri = URI::current();
$languages = Config::get('application.languages', array());
$languages[] = Config::get('application.language');
foreach ($languages as $language) {
    if (preg_match("#^{$language}(?:\$|/)#i", $uri)) {
        Config::set('application.language', $language);
        $uri = trim(substr($uri, strlen($language)), '/');
        break;
    }
}
if ($uri == '') {
    $uri = '/';
}
URI::$uri = $uri;
Request::$route = Router::route(Request::method(), $uri);
$response = Request::$route->call();
$response->render();
if (Config::get('session.driver') !== '') {
    Session::save();
}
$response->send();
Event::fire('laravel.done', array($response));
$response->foundation->finish();
/**
 * laravel\log.php
 */
class Log
{
    public static function exception($e)
    {
Esempio n. 5
0
<?php

Route::get('(:bundle)/rejigger.js', array('as' => 'rejigger_js', function () {
    return View::make('rejigger::js');
}));
Route::get('(:bundle)/version', array('as' => 'rejigger_version', function () {
    // Don't let the controller mistake this for a regular AJAX call
    unset($_SERVER['HTTP_X_REQUESTED_WITH']);
    $uri = \Rejigger\URI::resolve(Input::get('uri'));
    $route = \Laravel\Routing\Router::route('GET', $uri);
    $response = $route->call();
    $version = md5($response->content);
    // Parse out resources (css & script)
    preg_match_all('/\\<script[^\\>]+src=\\"(?P<src>[^\\"]+)\\"[^\\>]*\\>/i', $response->content, $scripts);
    preg_match_all('/\\<link[^\\>]+href=\\"(?P<href>[^\\"]+)\\"[^\\>]*\\>/i', $response->content, $styles);
    preg_match_all('/\\<img[^\\>]+src=\\"(?P<src>[^\\"]+)\\"[^\\>]*\\>/i', $response->content, $images);
    $resources = array_merge($scripts['src'], $styles['href'], $images['src']);
    $public = path('public');
    foreach ($resources as $resource) {
        $resource = $public . str_replace(\Laravel\URL::base(), '', $resource);
        if (\Laravel\File::exists($resource)) {
            $version .= File::modified($resource);
        }
    }
    return '{ "version": "' . md5($version) . '" }';
}));