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


PHP Bundle::handles方法代码示例

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


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

示例1: function

<?php

/**
 * Register all the classes that are used by Basset with the autoloader.
 */
Autoloader::map(array('Basset' => __DIR__ . DS . 'classes' . DS . 'basset.php', 'Basset\\Asset' => __DIR__ . DS . 'classes' . DS . 'asset.php', 'Basset\\Cache' => __DIR__ . DS . 'classes' . DS . 'cache.php', 'Basset\\Config' => __DIR__ . DS . 'classes' . DS . 'config.php', 'Basset\\Container' => __DIR__ . DS . 'classes' . DS . 'container.php', 'Basset\\Vendor\\CSSCompress' => __DIR__ . DS . 'classes' . DS . 'vendor' . DS . 'csscompress.php', 'Basset\\Vendor\\JSMin' => __DIR__ . DS . 'classes' . DS . 'vendor' . DS . 'jsmin.php', 'Basset\\Vendor\\URIRewriter' => __DIR__ . DS . 'classes' . DS . 'vendor' . DS . 'urirewriter.php', 'Basset\\Vendor\\lessc' => __DIR__ . DS . 'classes' . DS . 'vendor' . DS . 'less.php'));
if (starts_with(URI::current(), Bundle::option('basset', 'handles'))) {
    /**
     * In this before filter we'll grab the compiled assets for this route and return them here.
     * 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');
    });
}
开发者ID:nenoraith,项目名称:sowcomposer,代码行数:31,代码来源:start.php

示例2: function

Route::filter('mwi.admin_controller_start', function ($controller) {
    $permissions = new \Permissions\Check(\Request::route(), $controller);
    if (!Bundle::exists('auth')) {
        return;
    }
    // Fix route bundle if
    // its an administration route
    $uri = Request::route()->uri;
    $uri_parts = explode('/', $uri);
    // check if is set
    // check if first part is administration uri
    // check if is not only the dashboard http://site.com/[admin]
    if (isset($uri_parts['0']) and $uri_parts['0'] = ADM_URI and count($uri_parts) > 1) {
        unset($uri_parts['0']);
        $uri = implode('/', $uri_parts);
        Request::route()->bundle = Bundle::handles($uri);
        $controller->bundle = Request::route()->bundle;
    }
    $result = $permissions::can(Auth::user());
    if (isset($result)) {
        if (!$result->is_allowed) {
            if (Request::ajax()) {
                return 'not permited';
            } else {
                return \Response::error('401', get_object_vars($result));
            }
        }
    } else {
        if (Request::ajax()) {
            return View::make('permissions::partials.ajax_not_authorized_page_details')->render();
        } else {
开发者ID:juaniiie,项目名称:mwi,代码行数:31,代码来源:start.php

示例3: testHandlesMethodReturnsBundleThatHandlesURI

 /**
  * Test Bundle::handles method.
  *
  * @group laravel
  */
 public function testHandlesMethodReturnsBundleThatHandlesURI()
 {
     Bundle::register('foo', array('handles' => 'foo-bar'));
     $this->assertEquals('foo', Bundle::handles('foo-bar/admin'));
     unset(Bundle::$bundles['foo']);
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:11,代码来源:bundle.test.php


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