本文整理汇总了PHP中Bundle::option方法的典型用法代码示例。如果您正苦于以下问题:PHP Bundle::option方法的具体用法?PHP Bundle::option怎么用?PHP Bundle::option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle::option方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: aliasIn
function aliasIn($ns)
{
$overridenPlarx = \Bundle::option('vane', 'ignorePlarx');
$ns = trim($ns, '\\');
foreach ($overridenPlarx as $class) {
\Autoloader::alias("Vane\\{$class}", "{$ns}\\{$class}");
}
Plarx::supersede($ns, $overridenPlarx);
}
示例2: array
<?php
namespace Vane;
\Bundle::$bundles['vane']['ignorePlarx'] = array('Str', 'HLEx', 'Log', 'Event', 'Validator');
if (!\Bundle::exists('plarx')) {
throw new Error('Vane requires Plarx bundle installed.');
} else {
\Bundle::start('plarx');
\Px\Plarx::supersede(__NAMESPACE__, \Bundle::option('vane', 'ignorePlarx'));
}
if (!\Bundle::exists('squall')) {
throw new Error('Vane requires Squall bundle installed.');
} else {
\Bundle::start('squall');
\Squall\initEx(__NAMESPACE__);
}
\Autoloader::namespaces(array(__NAMESPACE__ => __DIR__ . DS . 'classes'));
require_once __DIR__ . DS . 'core.php';
overrideHTMLki('vane::', __NAMESPACE__);
// vane::auth[:[!]perm[:[!]perm.2[...]]] [|filter:2 [|...]]
//
// This filter will always deny access for non-authorized users even if guest
// permissions allow for given features - this is so because protected controllers
// rely on current user being logged in.
\Route::filter('vane::auth', function ($feature_1 = null) {
$features = is_array($feature_1) ? $feature_1 : func_get_args();
$block = is_object(end($features)) ? array_pop($features) : null;
$user = \Auth::user();
if ($user and !$user instanceof UserInterface) {
$msg = "When using vane::auth filter object returned by Auth::user()" . " (" . get_class($user) . " here) must implement Vane\\UserInterface." . " This is not so - returned 403 for user {$user->id}.";
示例3: show
/**
* Return the URL to the asset route container.
*
* @param string $route
* @return string
*/
public static function show($route)
{
$methods = array('css' => 'style', 'js' => 'script');
// If the container is set to development mode then Basset will show all the assets that have been added
// up until now. This may be a problem if assets are added after the template view is rendered, however
// this is acceptable. Assets should be added as early as possible during the application logic.
$container = static::$routes[Bundle::option('basset', 'handles') . '/' . $route];
if ($container->config->get('development')) {
$response = '<!-- BASSET NOTICE: Some assets may not be displayed depending on where they were set during the application flow. -->';
return $response . PHP_EOL . $container->compile();
}
return HTML::$methods[File::extension($route)](URL::to_asset(Bundle::option('basset', 'handles') . '/' . $route));
}
示例4: 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();
});
}
示例5: Exception
<?php
if (Bundle::option('textpub', 'auto')) {
$paths = TextPub::option('paths') ?: Bundle::option('textpub', 'handles');
if (!$paths) {
throw new Exception("Text Publisher (textpub) requires 'paths' or/and" . " 'handles' options but none are set.");
}
TextPub::register('' . Router::$bundle, $paths);
}
示例6: bundleURL
static function bundleURL()
{
$handles = \Bundle::option(Request::$route->bundle, 'handles');
$handles = trim($handles, '/');
return $handles === '' ? '/' : "/{$handles}/";
}
示例7: testOptionMethodReturnsBundleOption
/**
* Test the Bundle::get method.
*
* @group laravel
*/
public function testOptionMethodReturnsBundleOption()
{
$this->assertFalse(Bundle::option('dashboard', 'auto'));
$this->assertEquals('dashboard', Bundle::option('dashboard', 'location'));
}