/** * Set up a mock environment to test iBundle. * * @return null */ public function __construct() { // Start the bundle Bundle::start('ibundle'); // Set test ibundle cache file $this->cache_file = ibundle_config('file', Bundle::path('ibundle') . 'storage/test.cache'); }
/** * @return array of paths that we can find seeds */ protected function _getSeedFolders() { $bins = array(path('app') . 'seeds' . DIRECTORY_SEPARATOR); foreach (Bundle::$bundles as $bundle) { $bins[] = Bundle::path($bundle['location']) . 'seeds' . DIRECTORY_SEPARATOR; } return $bins; }
/** * Get the path to a view on disk. * * @param $view * * @return string * @throws \Exception */ protected function path($view) { $root = \Bundle::path(\Bundle::name($view)) . 'views'; $path = $root . DS . \Bundle::element($view); if (file_exists($path)) { return $path; } throw new \Exception("View [{$view}] does not exist."); }
/** * Start the generation process. * * @return void */ public function __construct($args) { parent::__construct($args); // we need a controller name if ($this->lower == null) { Common::error('You must specify a bundle name.'); } // add the directory copy to the writer $this->writer->copy_directory('Bundle', $this->lower, Bundle::path('bob') . 'templates/bundle', path('bundle') . $this->lower); $this->writer->write(); }
public static function refresh() { $default_data = array('service' => null, 'timestamp' => time(), 'ip' => self::ip(), 'city' => null, 'state' => null, 'state_code' => null, 'country' => null, 'country_code' => null, 'zipcode' => null, 'lat' => null, 'lng' => null); foreach (Config::get('locate::options.service_priority') as $service) { require_once Bundle::path('locate') . 'services/' . strtolower($service) . '.php'; $data = $service::run(); if ($data !== false) { $default_data['service'] = $service; break; } } Session::put('locate', isset($data) && is_array($data) ? array_merge($default_data, $data) : $default_data); }
function assetPath($url) { $url = asset($url); $base = rtrim(\URL::to_asset(''), '/') . '/'; if (S::unprefix($url, $base)) { if (strtok($url, '/') === 'bundles') { $bundle = strtok('/'); $path = strtok(null); return \Bundle::path($bundle) . 'public' . DS . ltrim($path, '\\/'); } else { return \path('public') . ltrim($url, '\\/'); } } }
/** * Creates a new instance for the specified Campaign Monitor API class * * @param string $class * @param string $arguments * @return CS_REST_$class Object */ public static function __callStatic($class, $arguments) { // Reset any string formatting $class = strtolower($class); // Include the class file require_once Bundle::path('campaignmonitor') . 'vendor/csrest_' . $class . '.php'; $options = array(Config::get('campaignmonitor.api_key')); if (isset($arguments[0])) { array_unshift($options, $arguments[0]); } // Load the class $class = 'CS_REST_' . ucfirst($class); $instance = new ReflectionClass($class); return $instance->newInstanceArgs($options); }
static function configure(\ThumbGen $thumb, array $input, array $options = null) { $options === null and $options = \Config::get('vanemart::thumb'); extract($options, EXTR_SKIP); $thumb->temp(\Bundle::path('vanemart') . 'public/thumbs')->type($type, $quality)->remoteCacheTTL($remoteCacheTTL)->size(array_get($input, 'width', 0), array_get($input, 'height', 0))->restrict('width', $widthMin, $widthMax)->restrict('height', $heightMin, $heightMax)->step($step, array_get($input, 'up'))->fill(array_get($input, 'fill')); if ($watermark) { if ($watermark['count'] == 1) { $thumb->watermark($watermark['file'], $watermark['y'], $watermark['x']); } else { $thumb->watermarks($watermark['count'], $watermark['file'], $watermark['x']); } } Event::fire('thumb.configure', array($thumb, compact('input', 'options'))); return $thumb; }
<?php Autoloader::namespaces(array('Auth' => Bundle::path('auth') . 'libraries'));
<?php Autoloader::namespaces(array('Multup' => Bundle::path('multup') . 'libraries')); Autoloader::map(array('Multup' => __DIR__ . DS . 'multup.php'));
<?php // map class name to file Autoloader::map(array('Hijri' => Bundle::path('hijri') . '/library/Hijri.php'));
<?php $root = Bundle::path('mimeil'); Autoloader::map(array('MiMeil' => $root . 'mimeil.php', 'LaMeil' => $root . 'lameil.php'));
<?php Autoloader::map(array('QR' => Bundle::path('qr') . 'qr.php'));
<?php /** * Part of the Nesty bundle for Laravel. * * @package Nesty * @version 1.0 * @author Cartalyst LLC * @license MIT License * @copyright (c) 2011 - 2012, Cartalyst LLC * @link http://cartalyst.com */ // Autoload classes Autoloader::namespaces(array('Nesty' => Bundle::path('nesty'))); // Set the global alias for Nesty Autoloader::alias('Nesty\\Nesty', 'Nesty');
<?php Autoloader::namespaces(array('Pages\\Model' => Bundle::path('pages') . 'models' . DS, 'Pages' => Bundle::path('pages') . 'libraries' . DS)); /** * Includes out Events file */ require_once 'events.php';
| */ Autoloader::directories(array(path('app') . 'models', path('app') . 'libraries')); /* |-------------------------------------------------------------------------- | Laravel View Loader |-------------------------------------------------------------------------- | | The Laravel view loader is responsible for returning the full file path | for the given bundle and view. Of course, a default implementation is | provided to load views according to typical Laravel conventions but | you may change this to customize how your views are organized. | */ Event::listen(View::loader, function ($bundle, $view) { return View::file($bundle, $view, Bundle::path($bundle) . 'views'); }); /* |-------------------------------------------------------------------------- | Laravel Language Loader |-------------------------------------------------------------------------- | | The Laravel language loader is responsible for returning the array of | language lines for a given bundle, language, and "file". A default | implementation has been provided which uses the default language | directories included with Laravel. | */ Event::listen(Lang::loader, function ($bundle, $language, $file) { return Lang::file($bundle, $language, $file); });
<?php Autoloader::directories(array(Bundle::path('loggy') . 'classes', Bundle::path('loggy') . 'config')); /* AutoLoader::map(array( 'Remote_Logger' => Bundle::path('loggy').'classes/remote_logger.php', )); */ Loggy::init();
<?php Autoloader::directories(array(Bundle::path('openexchange') . 'classes'));
/** * Get the path to a bundle's language file. * * @param string $bundle * @param string $language * @param string $file * @return string */ protected static function path($bundle, $language, $file) { return Bundle::path($bundle) . "language/{$language}/{$file}" . EXT; }
$cache = Config::get('twig::config.cache'); /** * Get various other Twig configuration items */ $debug = Config::get('twig::config.debug'); $autoescape = Config::get('twig::config.autoescape'); /** * Make the cache directory if it is enabled and doesn't exist. */ if ($cache and !is_dir($cache)) { mkdir($cache); } /** * Register the Twig library with the auto-loader */ Laravel\Autoloader::underscored(array('Twig' => Bundle::path('twig') . 'lib/Twig')); /** * Instantiate a new Laravel Twig loader */ include 'loader.php'; /** * If it's registered in the IoC, resolve from there... otherwise use default */ if (IoC::registered('twig::loader')) { $loader = IoC::resolve('twig::loader'); } else { $loader = new Laravel_Twig_Loader($ext); } /** * Hook into the Laravel view loader */
<?php Autoloader::directories(array(Bundle::path('laraveltwittersearch') . 'classes'));
<?php if (!File::exists(path('base') . 'vendor/autoload.php')) { throw new Exception('You need to run composer update to complete installation of this project.'); } require path('base') . 'vendor/autoload.php'; Autoloader::namespaces(array('Mail' => Bundle::path('mail'))); IoC::register('Mail', function () { return new Mail\Libraries\Mail(); });
<?php Autoloader::map(array('Flyswatter_Base_Controller' => Bundle::path('flyswatter') . 'controllers/base.php')); Autoloader::namespaces(array('Flyswatter\\Models' => Bundle::path('flyswatter') . 'models'));
<?php Autoloader::namespaces(array('Sendersuite' => Bundle::path('sendersuite') . 'lib')); // Register sendersuite in the IoC container Laravel\IoC::singleton('sendersuite', function () { $confProvider = new \Sendersuite\ConfigurationProvider(); if (\Laravel\Config::get('sendersuite::config.debugmode')) { $apiConnection = new \Sendersuite\EventConnection(); } else { $apiConnection = new \Sendersuite\HttpConnection(); } $ssApi = new \Sendersuite\Api($apiConnection, $confProvider); return $ssApi; });
<?php // Autoload Former's namespace Autoloader::namespaces(array('Former' => Bundle::path('former') . 'libraries'));
<?php // -------------------------------------------------------------- // Set constants // -------------------------------------------------------------- define('MUSTACHE_EXT', '.mustache'); // -------------------------------------------------------------- // Register classes // -------------------------------------------------------------- Autoloader::map(array('Mustache' => __DIR__ . DS . 'mustache' . EXT, 'LaylaMustache' => __DIR__ . DS . 'laylamustache' . EXT)); // -------------------------------------------------------------- // Add event listeners // -------------------------------------------------------------- Event::listen(View::loader, function ($bundle, $view) { return LaylaMustache::file($bundle, $view, Bundle::path($bundle) . 'views'); }); Event::listen(View::engine, function ($view) { // The Blade view engine should only handle the rendering of views which // end with the Blade extension. If the given view does not, we will // return false so the View can be rendered as normal. if (!str_contains($view->path, MUSTACHE_EXT)) { return; } if (count($view->data) > 1) { $mustache = new LaylaMustache(); return $mustache->render(File::get($view->path), $view->data()); } return File::get($view->path); });
<?php return array('type' => 'jpeg', 'quality' => 75, 'watermark' => array('count' => 2, 'file' => head(glob(Bundle::path('vanemart') . 'config/watermark.{png,jpg,jpeg,gif}', GLOB_BRACE)), 'y' => 0.5, 'x' => 0.5), 'widthMin' => 1, 'widthMax' => 1200, 'heightMin' => 1, 'heightMax' => 1200, 'step' => 50, 'remoteCacheTTL' => 86400);
<?php Autoloader::namespaces(array('Permissions\\Model' => Bundle::path('permissions') . 'models' . DS, 'Permissions' => Bundle::path('permissions') . 'libraries' . DS)); 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 {
<?php echo File::get(Bundle::path('rejigger') . 'jquery/jquery-1.7.2.min.js'); ?> var reJquery = jQuery.noConflict(true); var rejigger_version; var rejigger_version_uri = "<?php echo URL::to_route('rejigger_version'); ?> "; reJquery(document).ready(function() { rejigger(); }); function rejigger() { reJquery.get(rejigger_version_uri, { uri: window.location.href }, function(data) { if (data.charAt(0) == '{') { var json = (new Function("return " + data))(); if (typeof rejigger_version == 'undefined') { rejigger_version = json.version; } if (rejigger_version == json.version) { setTimeout("rejigger()", <?php echo Config::get('rejigger::settings.update_milliseconds', '1000'); ?>
<?php /** * This file is a part of Zend Framework. * Copyright (c) 2005-2010, Zend Technologies USA, Inc. * All rights reserved. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * See Zend Framework Performance Guide at: * http://framework.zend.com/manual/1.11/en/performance.classloading.html */ set_include_path(implode(PATH_SEPARATOR, array(__DIR__ . '/library', get_include_path()))); require_once Bundle::path('zend') . '/library/Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance();