示例#1
0
 private function doRequest($URI, $data = [])
 {
     Input::$input = $data;
     Laravel\Routing\Filter::register(require APP_PATH . 'filters' . EXT);
     $loader = new Laravel\Routing\Loader(APP_PATH, ROUTE_PATH);
     $router = new Laravel\Routing\Router($loader, CONTROLLER_PATH);
     IoC::instance('laravel.routing.router', $router);
     Laravel\Request::$route = $router->route(Laravel\Request::method(), Laravel\URI::current());
     if (!is_null(Request::$route)) {
         $response = Request::$route->call();
     } else {
         Laravel\Routing\Filter::run(['before'], [], true);
         $response = Laravel\Response::json(['msg' => 'Not found'], 404);
         \Laravel\Routing\Filter::run(['after'], [$response], true);
     }
     ob_start();
     $response->send();
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
 }
/**
 * Get a CLI option from the argv $_SERVER variable.
 *
 * @param  string  $option
 * @param  mixed   $default
 * @return string
 */
function get_cli_option($option, $default = null)
{
    foreach (Laravel\Request::foundation()->server->get('argv') as $argument) {
        if (starts_with($argument, "--{$option}=")) {
            return substr($argument, strlen($option) + 3);
        }
    }
    return value($default);
}
示例#3
0
<?php

Autoloader::map(array('Recaptcha\\Recaptcha' => __DIR__ . DS . 'recaptcha' . EXT));
Laravel\Validator::register('recaptcha', function ($attribute, $value, $parameters) {
    $recaptcha = Recaptcha\Recaptcha::recaptcha_check_answer($parameters[0], Laravel\Request::ip(), Laravel\Input::get('recaptcha_challenge_field'), $value);
    return $recaptcha->is_valid;
});
示例#4
0
<?php

/*
 * TextPub configuration is based on the concept of 'paths' and is twofold:
 * global options are specified under the returned array() - they are used
 * as default values; path-specific options are set in global 'paths' array
 * option and keys appearing there override global ones.
 */
return array('ext' => array('txt', 'html' => 'raw', 'php' => 'php'), 'formatter' => array('HTML', 'entities'), 'layout' => 'textpub::text', 'index' => 'index', '404' => '_404', 'cache' => array(60 * 24, 'html' => false, 'php' => false), 'debug' => Laravel\Request::is_env('local'), 'as' => true, 'single' => false, 'redirToSlash' => true);
示例#5
0
<?php

if (Laravel\Request::cli()) {
    Laravel\Request::set_env(getenv('comspec') ? 'local' : 'production');
}
Laravel\Bundle::start('plarx');
示例#6
0
文件: accept.php 项目: ajb/rfpez
 public function setup()
 {
     Laravel\Request::set_env('test');
     Laravel\CLI\Command::run(array('sync:minimal'));
 }