当前位置: 首页>>代码示例>>PHP>>正文


PHP App::after方法代码示例

本文整理汇总了PHP中App::after方法的典型用法代码示例。如果您正苦于以下问题:PHP App::after方法的具体用法?PHP App::after怎么用?PHP App::after使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App的用法示例。


在下文中一共展示了App::after方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: json_encode

| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    $data = json_encode(Input::all());
    $file = fopen(storage_path() . "/logs/route_logs.txt", 'a');
    fwrite($file, Request::path() . "\n\n");
    fwrite($file, $data);
    if ($data != "") {
        $t = date("Y-m-d G:i:s", time());
        $data = "\nFound matches at at " . $t . "\n----------------------------------\n\n";
    }
    fwrite($file, $data);
});
App::after(function ($request, $response) {
    return $response;
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
开发者ID:martiansideofthemoon,项目名称:Labman-Server,代码行数:31,代码来源:filters.php

示例2: function

| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    $authzToken = new Airavata\Model\Security\AuthzToken();
    $authzToken->accessToken = "emptyToken";
    $apiVersion = Airavata::getAPIVersion($authzToken);
    if (empty($apiVersion)) {
        return View::make("server-down");
    } else {
        Session::put('authz-token', $authzToken);
    }
});
App::after(function ($request, $response) {
    //
    // Test commit.
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
开发者ID:rekepalli,项目名称:airavata-php-gateway,代码行数:32,代码来源:filters.php

示例3: unset

| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    try {
        $user = DB::table('users')->first();
        unset($user);
    } catch (\PDOException $e) {
        if (!in_array($request->path(), array('install', 'install/db', 'install/api', 'install/user', 'install/complete'))) {
            return Redirect::to('/install', 302);
        }
    }
});
App::after(function ($request, $response) {
    if (get_class($response) != 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse') {
        $response->header('Cache-Control', 'no-cache, must-revalidate');
        $response->header('P3P', 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
    }
});
App::missing(function ($exception) {
    Log::error('URL : ' . URL::current());
    $error = new Andriynto\Ebri\Controllers\Error();
    return $error->_404();
});
/*
|--------------------------------------------------------------------------
| Auth Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify user logged in.
|
*/
开发者ID:andrims21,项目名称:eBri,代码行数:32,代码来源:filters.php

示例4: session_start

| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function () {
    if (!Request::is('api/*')) {
        session_start();
        if (in_array(BaseController::cookieGet('lang'), ['en', 'ru', 'by'])) {
            App::setLocale(BaseController::cookieGet('lang'));
        }
        if (!BaseController::sessionGet('token')) {
            BaseController::sessionSet('token', BaseController::randString(6));
        }
    }
});
App::after(function () {
});
/*
 *  Registration captcha check
 */
Route::filter('signup', function () {
    if (!BaseController::checkCaptcha()) {
        return View::make('verif.signup');
    }
});
/*
 *  Retrieving URL captcha check
 */
Route::filter('retrieve', function () {
    if (!BaseController::checkCaptcha()) {
        return View::make('verif.retrieve');
    }
开发者ID:libre-net-society,项目名称:onelon,代码行数:32,代码来源:filters.php

示例5: function

|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    //
});
App::after(function ($request, $response) {
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strpos($_SERVER['HTTP_USER_AGENT'], 'Safari')) {
        $response->header('P3P', 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
        //		header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
        //		header('P3P: CP="CAO PSA OUR"');
        //
    }
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
开发者ID:mazebeat,项目名称:encuesta_umayor,代码行数:32,代码来源:filters.php

示例6: function

    Cache::macro('want', function ($key, $minutes = 0, $callback) {
        if (!($data = Cache::get($key))) {
            $data = call_user_func($callback);
            if ($minutes == 0) {
                Cache::forever($key, $data);
            } else {
                Cache::put($key, $data, $minutes);
            }
        }
        return $data;
    });
});
App::after(function ($request, $response) {
    $sqlLogs = DB::getQueryLog();
    foreach ($sqlLogs as $sql) {
        Log::debug($sql['query'], ['time' => $sql['time']]);
    }
    Log::info("\n");
});
App::error(function (ModelNotFoundException $e) {
    return Response::make('记录不存在', 404);
});
App::error(function (NotFoundHttpException $e) {
    return Response::make('页面不存在', 404);
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
开发者ID:xiaohulidudu,项目名称:laravel-blog,代码行数:31,代码来源:filters.php

示例7: function

<?php

use RainLab\Translate\Models\Message;
use RainLab\Translate\Classes\Translator;
/*
 * Adds a custom route to check for the locale prefix.
 */
App::before(function ($request) {
    $translator = Translator::instance();
    if (!$translator->isConfigured()) {
        return;
    }
    $locale = Request::segment(1);
    if ($translator->setLocale($locale)) {
        Route::group(['prefix' => $locale], function () use($locale) {
            Route::any('{slug}', 'Cms\\Classes\\Controller@run')->where('slug', '(.*)?');
        });
        Route::any($locale, 'Cms\\Classes\\Controller@run');
    }
});
/*
 * Save any used messages to the contextual cache.
 */
App::after(function ($request) {
    Message::saveToCache();
});
开发者ID:janusnic,项目名称:OctoberCMS,代码行数:26,代码来源:routes.php

示例8: function

|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    //
});
App::after(function ($request, $response) {
    // Mencegah Kembali Login Setelah Logout dengan Menekan Tombol Back pada Browser
    $response->headers->set("Cache-Control", "no-cache,no-store, must-revalidate");
    $response->headers->set("Pragma", "no-cache");
    //HTTP 1.0
    $response->headers->set("Expires", " Sat, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter("auth", function () {
    if (Auth::guest()) {
开发者ID:hammunima,项目名称:gudangdkk,代码行数:32,代码来源:filters.php

示例9:

<?php

App::before(function () {
    Event::fire('clockwork.controller.start');
});
App::after(function () {
    Event::fire('clockwork.controller.end');
});
Backend\Classes\BackendController::extend(function ($controller) {
    $controller->middleware('Clockwork\\Support\\Laravel\\ClockworkMiddleware');
});
Cms\Classes\CmsController::extend(function ($controller) {
    $controller->middleware('Clockwork\\Support\\Laravel\\ClockworkMiddleware');
});
开发者ID:janusnic,项目名称:clockwork-plugin,代码行数:14,代码来源:init.php

示例10: function

| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
        $statusCode = 204;
        $headers = ['Access-Control-Allow-Origin' => '*', 'Allow' => 'GET, POST, PUT, OPTIONS', 'Access-Control-Allow-Headers' => 'Origin, Content-Type, Accept, Authorization, X-Requested-With', 'Access-Control-Allow-Credentials' => 'true'];
        return Response::make(null, $statusCode, $headers);
    }
});
App::after(function ($request, $response) {
    // para permitir los request desde sitios externos
    $response->headers->set('Access-Control-Allow-Origin', '*');
    $response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
    $response->headers->set('Access-Control-Allow-Headers', 'Origin, Content-Type, Accept, Authorization, X-Requested-With');
    $response->headers->set('Access-Control-Allow-Credentials', 'true');
    return $response;
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    // ...get database user
开发者ID:jhoansebastianlara,项目名称:esclinicadigital,代码行数:32,代码来源:filters.php

示例11: explode

    Route::controller('datasets', 'Tdt\\Core\\Ui\\DatasetController');
    Route::controller('users', 'Tdt\\Core\\Ui\\UserController');
    Route::controller('groups', 'Tdt\\Core\\Ui\\GroupController');
    Route::any('{all}', 'Tdt\\Core\\Ui\\UiController@handleRequest')->where('all', '.*');
});
/*
 * IMPORTANT!
 * The catch-all route to catch all other request is added last to allow packages to still have their own routes
 */
App::before(function () {
    // The (in)famous catch-all
    Route::any('{all}', 'Tdt\\Core\\BaseController@handleRequest')->where('all', '.*');
});
App::after(function ($request, $response) {
    // Remove cookie(s)
    $response->headers->removeCookie('tdt_auth');
    $response->headers->removeCookie('laravel_session');
});
/*
 * Proper error handling
 */
App::error(function ($exception, $code) {
    // Log error
    Log::error($exception);
    // Check Accept-header
    $accept_header = \Request::header('Accept');
    $mimes = explode(',', $accept_header);
    if (in_array('text/html', $mimes) || in_array('application/xhtml+xml', $mimes)) {
        // Create HTML response, seperate templates for status codes
        switch ($code) {
            case 403:
开发者ID:netsensei,项目名称:core,代码行数:31,代码来源:routes.php

示例12:

    }
    $cors = ServiceLocator::getInstance()->getService('CORSMiddleware');
    if ($response = $cors->verifyRequest($request)) {
        return $response;
    }
});
App::after(function ($request, $response) {
    // https://www.owasp.org/index.php/List_of_useful_HTTP_headers
    $response->headers->set('X-content-type-options', 'nosniff');
    $response->headers->set('X-xss-protection', '1; mode=block');
    // http://tools.ietf.org/html/rfc6797
    /**
     * The HSTS header field below stipulates that the HSTS Policy is to
     * remain in effect for one year (there are approximately 31536000
     * seconds in a year)
     * applies to the domain of the issuing HSTS Host and all of its
     * subdomains:
     */
    $response->headers->set('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
    //cache
    $response->headers->set('pragma', 'no-cache');
    $response->headers->set('Expires', '-1');
    $response->headers->set('cache-control', 'no-store, must-revalidate, no-cache');
    $cors = ServiceLocator::getInstance()->getService('CORSMiddleware');
    $cors->modifyResponse($request, $response);
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
开发者ID:smarcet,项目名称:openstackid,代码行数:32,代码来源:filters.php

示例13: function

/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    //
});
App::after(function ($request, $response) {
    $response->headers->set('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate');
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
开发者ID:shihab-92,项目名称:votting-system,代码行数:30,代码来源:filters.php

示例14: foreach

/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::after(function ($request, $response) {
    if ($request->isMethod('OPTIONS')) {
        $headers = App::make('api')->getConfig('headers');
        if (!empty($headers)) {
            foreach ($headers as $key => $value) {
                $response->header($key, $value);
            }
        }
        unset($headers);
    }
});
/*
|--------------------------------------------------------------------------
| OAuth Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify OAuth token.
|
*/
Route::filter('api.oauth', function () {
    $argList = array();
开发者ID:WillymarJ,项目名称:laravel-api,代码行数:31,代码来源:filters.php

示例15:

| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    //
});
App::after(function ($request, $response) {
    // Minification de l'HTML en sortie :
    if (App::Environment() != 'local') {
        if ($response instanceof Illuminate\Http\Response) {
            // récupération de la sortie :
            $output = $response->getOriginalContent();
            // Nettoyage des commentaires :
            $output = preg_replace('/<!--([^\\[|(<!)].*)/', '', $output);
            $output = preg_replace('/(?<!\\S)\\/\\/\\s*[^\\r\\n]*/', '', $output);
            // Suppression des espaces vides :
            $output = preg_replace('/\\s{2,}/', '', $output);
            $output = preg_replace('/(\\r?\\n)/', '', $output);
            // retour de la sortie minifier :
            $response->setContent($output);
        }
    }
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
开发者ID:Benoit-ROBIN,项目名称:u-hochiminh,代码行数:31,代码来源:filters.php


注:本文中的App::after方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。