public function __construct() { Bundle::register('settings'); Bundle::start('settings'); Bundle::register('modules'); Bundle::start('modules'); }
public function __construct() { Bundle::register('modules'); Bundle::start('modules'); Bundle::register('navigation'); Bundle::start('navigation'); Bundle::register('pages'); Bundle::start('pages'); }
public function __construct() { // the required modules must be enabled already // at this point Bundle::register('email'); Bundle::start('email'); Bundle::register('settings'); Bundle::start('settings'); Bundle::register('modules'); Bundle::start('modules'); Bundle::register('navigation'); Bundle::start('navigation'); }
public static function publish($module_slug) { require path('sys') . 'cli' . DS . 'dependencies' . EXT; try { $module_assets_path = path('bundle') . $module_slug . DS . 'public' . DS; if (\File::exists($module_assets_path)) { \Bundle::register($module_slug); $publish_cmd = \Laravel\CLI\Command::run(array('bundle:publish', $module_slug)); \Bundle::disable($module_slug); return true; } return true; } catch (\Exception $e) { Log::error($e->getMessage()); Log::error('Failed to publish assets for module [' . $module_slug . '].'); return false; } }
public function __construct() { Bundle::register('groups'); Bundle::start('groups'); }
<?php /* |-------------------------------------------------------------------------- | Hipchat Library |-------------------------------------------------------------------------- | | Map Hipchat Library using PSR-0 standard namespace. | */ Autoloader::namespaces(array('Hipchat' => Bundle::path('hipchat') . 'libraries')); /* |-------------------------------------------------------------------------- | Load Bundle dependencies |-------------------------------------------------------------------------- | | Should load Hybrid bundle if it's not registered. | */ if (!Bundle::exists('hybrid')) { Bundle::register('hybrid'); Bundle::start('hybrid'); }
<?php Autoloader::namespaces(array('Modules\\Model' => Bundle::path('modules') . 'models', 'Modules' => Bundle::path('modules') . 'libraries')); $bundles = Modules\Model\Module::all(); foreach ($bundles as $key => $module) { Config::set('installed_modules.' . $module->slug, $module->slug); if ($module->enabled) { Config::set('enabled_modules.' . $module->slug, $module->slug); $options = json_decode($module->options, true); if ($options == null) { $options = array(); } if ($module->slug != 'modules' and $module->slug != 'settings') { Bundle::register($module->slug, $options); Bundle::start($module->slug); } } }
$options = array_change_key_case($options, CASE_UPPER); $_SERVER['CLI'] = $options; } /* |-------------------------------------------------------------------------- | Set The CLI Laravel Environment |-------------------------------------------------------------------------- | | Next we'll set the LARAVEL_ENV variable if the current request is from | the Artisan command-line interface. Since the environment is often | specified within an Apache .htaccess file, we need to set it here | when the request is not coming through Apache. | */ if (isset($_SERVER['CLI']['ENV'])) { $_SERVER['LARAVEL_ENV'] = $_SERVER['CLI']['ENV']; } /* |-------------------------------------------------------------------------- | Register The Laravel Bundles |-------------------------------------------------------------------------- | | Finally we will register all of the bundles that have been defined for | the application. None of them will be started, yet but will be setup | so that they may be started by the developer at any time. | */ $bundles = (require path('app') . 'bundles' . EXT); foreach ($bundles as $bundle => $config) { Bundle::register($bundle, $config); }
/** * Test the Bundle::names method. * * @group laravel */ public function testNamesMethodReturnsBundleNames() { Bundle::register('foo'); $this->assertEquals(array('dashboard', 'dummy', 'foo'), Bundle::names()); unset(Bundle::$bundles['foo']); }
/** * Generate a resized image (or pull from cache) and return the file name * * @param Model &$model * @param string $field * @param string $size * @param bool $use_cache * @return string */ private static function generate(&$model, $field, $size, $use_cache = true) { $original_file = $model->get_attribute($field); // no image? if (!$original_file) { return null; } // did we ask for the original? if ($size == 'original') { return $original_file; } // we could pass an array instead of a size // in which case we are specifiying directory and format for that particular size // cast it all to an array and proceed accordingly if (!is_array($size)) { $size = array('size' => $size); } // get the directory, format, method, quality and dimensions $directory = array_get($size, 'storage_dir', static::config($model, 'storage_dir', $field)); $format = array_get($size, 'thumbnail_format', static::config($model, 'thumbnail_format', $field)); $method = array_get($size, 'resize_method', static::config($model, 'resize_method', $field)); $quality = array_get($size, 'thumbnail_quality', static::config($model, 'thumbnail_quality', $field)); $dimensions = array_get($size, 'size', null); if (!$dimensions) { throw new \Exception("Can not generate thumbnail for {$field}: no dimensions given.", 1); } if ($format == 'auto') { $format = File::extension($original_file); } $new_file = rtrim($original_file, File::extension($original_file)) . Str::lower($dimensions) . '.' . $format; // if we already have a cached copy, return it if ($use_cache && File::exists($directory . DS . $new_file)) { return $new_file; } if (!File::exists($directory . DS . $original_file)) { throw new \Exception("Can not generate {$dimensions} thumbnail for {$field}: no original."); } list($dst_width, $dst_height) = explode('x', Str::lower($dimensions)); Bundle::register('resizer'); Bundle::start('resizer'); $success = Resizer::open($directory . DS . $original_file)->resize($dst_width, $dst_height, $method)->save($directory . DS . $new_file, $quality); if (!$success) { throw new \Exception("Could not generate thumbnail {$new_file}."); } return $new_file; }