<?php Autoloader::map(array('Laravel\\Asset_Container' => path('sys') . 'asset.php')); Autoloader::namespaces(array('AssetCompressor' => __DIR__)); Autoloader::alias('AssetCompressor\\Asset', 'Asset');
<?php Autoloader::map(array('Flyswatter_Base_Controller' => Bundle::path('flyswatter') . 'controllers/base.php')); Autoloader::namespaces(array('Flyswatter\\Models' => Bundle::path('flyswatter') . 'models'));
<?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('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 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 Autoloader::namespaces(array('Auth' => Bundle::path('auth') . 'libraries'));
/** * Test the loading of classes mapped by namespaces. * * @group laravel */ public function testClassesMappedByNamespaceCanBeLoaded() { Autoloader::namespaces(array('Dashboard' => path('bundle') . 'dashboard' . DS . 'models')); $this->assertInstanceOf('Dashboard\\Repository', new Dashboard\Repository()); }
<?php /* |-------------------------------------------------------------------------- | OneAuth Library |-------------------------------------------------------------------------- | | Map OneAuth Library using PSR-0 standard namespace. | */ Autoloader::namespaces(array('OneAuth\\Auth' => Bundle::path('oneauth') . 'libraries' . DS . 'auth', 'OneAuth\\OAuth' => Bundle::path('oneauth') . 'libraries' . DS . 'oauth', 'OneAuth\\OAuth2' => Bundle::path('oneauth') . 'libraries' . DS . 'oauth2')); /* |-------------------------------------------------------------------------- | OneAuth Events Listener |-------------------------------------------------------------------------- | | Lets listen to when OneAuth logged a user using any of the supported | providers. | | OneAuth also listen to when user actually logged in to Laravel. | */ Event::listen('oneauth.logged', function ($client, $user_data) { // if user already logged in, don't do anything if (IoC::resolve('oneauth.driver: auth.check')) { return; } // OneAuth should login the user if user exist and is not logged in if (is_numeric($client->user_id) and $client->user_id > 0) { IoC::resolve('oneauth.driver: auth.login', array($client->user_id)); }
| | Define Basset's version. | */ define('BASSET_VERSION', '3.0.0'); /* |-------------------------------------------------------------------------- | Register PSR-0 Autoloading |-------------------------------------------------------------------------- | | Basset uses PSR-0 autoloading to lazily load the required files when | requested. Here we'll provide the namespaces and their corrosponding | locations. | */ Autoloader::namespaces(array('Assetic' => __DIR__ . '/vendor/assetic/src/Assetic', 'Basset' => __DIR__ . '/classes')); /* |-------------------------------------------------------------------------- | Basset Facade Alias |-------------------------------------------------------------------------- | | Alias Basset to the Basset Facade so that we can use a terser static | syntax to access methods. Lovely. | */ Autoloader::alias('Basset\\Facades\\Basset', 'Basset'); /* |-------------------------------------------------------------------------- | Register Basset with the IoC |-------------------------------------------------------------------------- |
public static function createClassMap() { $configAutoloader = Config::get('Autoloader'); $configClassMap = Config::get('ClassMap'); // Config/Autoloader.php dosyasından tarama // ayaraı kapalı ise tarama yapmaz. if ($configAutoloader['directoryScanning'] === false) { return false; } // ClassMap'in oluşturulması için hangi dizinlerin // taranması gerektiği Config/Autoloader.php dosyasında // yer alır. Bu dizinlerin bilgisi alınıyor. $classMap = $configAutoloader['classMap']; // Belirtilen dizinler ve alt dizinler taranıyor // ve sınıf haritaları oluşturuluyor... if (!empty($classMap)) { foreach ($classMap as $directory) { $classMaps = self::searchClassMap($directory, $directory); } } $classArray = array_diff_key(isset($classMaps['classes']) ? $classMaps['classes'] : array(), isset($configClassMap['classes']) ? $configClassMap['classes'] : array()); $eol = eol(); // Config/ClassMap.php $path = CONFIG_DIR . 'ClassMap.php'; // ---------------------------------------------------------------------------------------- // ClassMap dosyasının sınıflar bölümü oluşturuluyor. // ---------------------------------------------------------------------------------------- if (!is_file($path)) { $classMapPage = '<?php' . $eol; } else { $classMapPage = ''; } if (!empty($classArray)) { self::$classes = $classMaps['classes']; foreach ($classArray as $k => $v) { $classMapPage .= '$config[\'ClassMap\'][\'classes\'][\'' . $k . '\'] = \'' . $v . '\';' . $eol; } } $namespaceArray = array_diff_key(isset($classMaps['namespaces']) ? $classMaps['namespaces'] : array(), isset($configClassMap['namespaces']) ? $configClassMap['namespaces'] : array()); // ---------------------------------------------------------------------------------------- // ClassMap dosyasının isim alanları bölümü oluşturuluyor. // ---------------------------------------------------------------------------------------- if (!empty($namespaceArray)) { self::$namespaces = $classMaps['namespaces']; foreach ($namespaceArray as $k => $v) { $classMapPage .= '$config[\'ClassMap\'][\'namespaces\'][\'' . $k . '\'] = \'' . $v . '\';' . $eol; } } // ---------------------------------------------------------------------------------------- // ClassMap verisi yine aynı isimde bir dosya olarak oluşturuluyor. // ---------------------------------------------------------------------------------------- if (!file_put_contents($path, $classMapPage, FILE_APPEND)) { die(getErrorMessage('Error', 'fileNotWrite', $path)); } }
<?php Autoloader::namespaces(array('Install' => Bundle::path('install') . 'libraries')); if (!Session::has('adm_lang')) { Session::put('adm_lang', 'us'); } /* |-------------------------------------------------------------------------- | Set Application Security Key |-------------------------------------------------------------------------- | | The application security key is used by the encryption and cookie classes | to generate secure encrypted strings and hashes. At this poing we will | make sure that every installation contain an unique key with at least 32 | characters of random gibberish. | */ $app_installed = Config::get('application.installed'); $key_installed = Session::get('key_installed'); if (!$app_installed or !$key_installed) { Install\Installer::set_app_key(); Session::put('key_installed', true); } if (!defined('ADM_URI')) { define('ADM_URI', 'admin'); }
<?php /** * Bootstrapper for creating Twitter Bootstrap markup. * * @category HTML/UI * @package Boostrapper * @subpackage Twitter * @author Patrick Talmadge - <*****@*****.**> * @license MIT License <http://www.opensource.org/licenses/mit> * @link http://laravelbootstrapper.phpfogapp.com/ * * @see http://twitter.github.com/bootstrap/ */ // Autoload Boostrapper Autoloader::namespaces(array('Bootstrapper' => Bundle::path('bootstrapper') . 'src' . DS . 'Bootstrapper')); // Define main assets Asset::container('bootstrapper')->bundle('bootstrapper')->add('bootstrap', 'css/bootstrap.min.css')->add('bootstrap-responsive', 'css/bootstrap-responsive.min.css')->add('jquery', 'js/jquery-1.9.1.min.js')->add('bootstrap-js', 'js/bootstrap.min.js', 'jquery'); // Define unminified version of the assets Asset::container('bootstrapper-unminified')->bundle('bootstrapper')->add('bootstrap', 'css/bootstrap.css')->add('bootstrap-responsive', 'css/bootstrap-responsive.css')->add('jquery', 'js/jquery-1.9.1.js')->add('bootstrap-js', 'js/bootstrap.js', 'jquery');
define('SWIFT_REQUIRED_LOADED', true); // Load Swift utility class require __DIR__ . DS . 'libraries' . DS . 'swiftmailer' . DS . 'classes' . DS . 'Swift.php'; // Start the autoloader Swift::registerAutoload(); // Load the init script to set up dependency injection require __DIR__ . DS . 'libraries' . DS . 'swiftmailer' . DS . 'swift_init.php'; // Register the native quoted printable encoder to achieve much better // performance. This requires PHP 5.3, but since this is a Laravel bundle // I think it's safe to assume that that shouldn't be a problem. Swift::init(function () { Swift_DependencyContainer::getInstance()->register('mime.qpcontentencoder')->asAliasOf('mime.nativeqpcontentencoder'); }); // Map the Message classes. Autoloader::map(array('Swiftmailer\\Drivers\\Driver' => __DIR__ . DS . 'libraries' . DS . 'message' . DS . 'drivers' . DS . 'driver.php', 'Swiftmailer\\Drivers\\SMTP' => __DIR__ . DS . 'libraries' . DS . 'message' . DS . 'drivers' . DS . 'smtp.php', 'Swiftmailer\\Drivers\\Sendmail' => __DIR__ . DS . 'libraries' . DS . 'message' . DS . 'drivers' . DS . 'sendmail.php', 'Swiftmailer\\Drivers\\Mail' => __DIR__ . DS . 'libraries' . DS . 'message' . DS . 'drivers' . DS . 'mail.php')); Autoloader::namespaces(array('Email\\Model' => __DIR__ . DS . 'models' . DS, 'Email' => __DIR__ . DS . 'libraries' . DS)); /* |-------------------------------------------------------------------------- | Load Application Helpers file |-------------------------------------------------------------------------- | | Load all email helper functions available globaly in the application | */ include __DIR__ . DS . 'helpers.php'; /* |-------------------------------------------------------------------------- | Email Event Listners |-------------------------------------------------------------------------- | | Load email listners for module
<?php Log::info('Ravenly online'); Autoloader::namespaces(array('PhpLib' => Bundle::path('ravenly') . 'lib/PhpLib'));
<?php use Layla\API; // -------------------------------------------------------------- // Load helpers // -------------------------------------------------------------- require __DIR__ . DS . 'helpers' . EXT; // -------------------------------------------------------------- // Register the Base Controller // -------------------------------------------------------------- Autoloader::map(array('Admin_Base_Controller' => __DIR__ . DS . 'controllers' . DS . 'base' . EXT)); // -------------------------------------------------------------- // Register namespaces // -------------------------------------------------------------- Autoloader::namespaces(array('Admin' => __DIR__)); // -------------------------------------------------------------- // Register controllers // -------------------------------------------------------------- Route::pages(Config::get('routes'), 'admin', Config::get('layla.admin.url_prefix')); // -------------------------------------------------------------- // Start bundles // -------------------------------------------------------------- Bundle::start('thirdparty_bootsparks'); Bundle::start('thirdparty_menu'); // -------------------------------------------------------------- // Default Composer // -------------------------------------------------------------- View::composer('admin::layouts.default', function ($view) { $view->shares('url', prefix('admin') . '/'); Asset::container('header')->add('jquery', 'js/jquery.min.js')->add('bootstrap', 'bootstrap/css/bootstrap.css')->add('main', 'html/layla.css'); Asset::container('footer')->add('bootstrap', 'js/bootstrap.js');
<?php /* |-------------------------------------------------------------------------- | Auto-Loader Namespaces |-------------------------------------------------------------------------- | | Load namespaces here. This only shows the relevant Autoloader for this example | */ Autoloader::namespaces(array('AdminModels' => path('app') . 'models/admin'));
use Layla\DBManager; use Layla\API; // -------------------------------------------------------------- // Load helpers // -------------------------------------------------------------- require __DIR__ . DS . 'helpers' . EXT; // -------------------------------------------------------------- // Load bundles // -------------------------------------------------------------- //Bundle::start('thirdparty_dbmanager'); Bundle::start('thirdparty_bootsparks'); // -------------------------------------------------------------- // Load namespaces // -------------------------------------------------------------- Autoloader::namespaces(array('Domain' => __DIR__)); // -------------------------------------------------------------- // Filters // -------------------------------------------------------------- Route::filter('authority', function ($resource) { $action = Request::$route->parameters['0']; if (Authority::cannot($action, $resource)) { return Response::make('', 401); } }); Route::filter('auth', function () { if (Auth::guest()) { return Redirect::make('', 401); } }); // --------------------------------------------------------------
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}."; $deny = Log::error_Auth($msg); } elseif (!$user) {
<?php // register the class Autoloader::namespaces(array('FormBaseModel' => __DIR__)); // register the example code // you may remove or comment out the following lines to disable example routing Autoloader::map(array('ExampleForm' => __DIR__ . '/models/exampleform.php')); Route::any('form_examples/(:any?)/(:any?)/(:any?)/(:any?)/(:any?)', array('as' => 'form_examples', 'uses' => 'form-base-model::examples@(:1)', 'defaults' => array('index')));
| underscores as directory hierarchy indicators. | */ Autoloader::map(array('Laravel\\Database\\Eloquent\\Relationships\\Belongs_To' => path('sys') . 'database/eloquent/relationships/belongs_to' . EXT, 'Laravel\\Database\\Eloquent\\Relationships\\Has_Many' => path('sys') . 'database/eloquent/relationships/has_many' . EXT, 'Laravel\\Database\\Eloquent\\Relationships\\Has_Many_And_Belongs_To' => path('sys') . 'database/eloquent/relationships/has_many_and_belongs_to' . EXT, 'Laravel\\Database\\Eloquent\\Relationships\\Has_One' => path('sys') . 'database/eloquent/relationships/has_one' . EXT, 'Laravel\\Database\\Eloquent\\Relationships\\Has_One_Or_Many' => path('sys') . 'database/eloquent/relationships/has_one_or_many' . EXT)); /* |-------------------------------------------------------------------------- | Register The Symfony Components |-------------------------------------------------------------------------- | | Laravel makes use of the Symfony components where the situation is | applicable and it is possible to do so. This allows us to focus | on the parts of the framework that are unique and not re-do | plumbing code that others have written. | */ Autoloader::namespaces(array('Symfony\\Component\\Console' => path('sys') . 'vendor/Symfony/Component/Console', 'Symfony\\Component\\HttpFoundation' => path('sys') . 'vendor/Symfony/Component/HttpFoundation')); /* |-------------------------------------------------------------------------- | Magic Quotes Strip Slashes |-------------------------------------------------------------------------- | | Even though "Magic Quotes" are deprecated in PHP 5.3.x, they may still | be enabled on the server. To account for this, we will strip slashes | on all input arrays if magic quotes are enabled for the server. | */ if (magic_quotes()) { $magics = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); foreach ($magics as &$magic) { $magic = array_strip_slashes($magic); }
<?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::namespaces(array('extjs' => Bundle::path('extjs') . 'models')); Autoloader::map(array('lext' => Bundle::path('extjs') . 'libraries/lext.php'));
| Auto-Loader Mappings |-------------------------------------------------------------------------- | | Laravel uses a simple array of class to path mappings to drive the class | auto-loader. This simple approach helps avoid the performance problems | of searching through directories by convention. | | Registering a mapping couldn't be easier. Just pass an array of class | to path maps into the "map" function of Autoloader. Then, when you | want to use that class, just use it. It's simple! | */ /* Autoloader::map(array( 'LaraChat\\Chat' => __DIR__.'/larachat/chat.php' )); */ /* |-------------------------------------------------------------------------- | Auto-Loader Directories |-------------------------------------------------------------------------- | | The Laravel auto-loader can search directories for files using the PSR-0 | naming convention. This convention basically organizes classes by using | the class namespace to indicate the directory structure. | */ Autoloader::directories(array()); // Autoload classes Autoloader::namespaces(array('Larachat' => __DIR__ . DS));
<?php Autoloader::directories(array(Bundle::path('administrator') . 'Libraries')); Autoloader::namespaces(array('Admin' => Bundle::path('administrator'))); //set the config items if a user has provided an application config foreach (Config::get('administrator::administrator', array()) as $key => $option) { if (Config::has('administrator.' . $key)) { Config::set('administrator::administrator.' . $key, Config::get('administrator.' . $key)); } }
<?php Autoloader::namespaces(array('Multup' => Bundle::path('multup') . 'libraries')); Autoloader::map(array('Multup' => __DIR__ . DS . 'multup.php'));
<?php /** * /bundles/imwg/start.php * Imwg - Imagemanipulation with GD * * @package Laravel-Imwg * @version 1.0.1 * @author Nico R <*****@*****.**> * @link https://github.com/Sentences */ Autoloader::namespaces(array('ImageManipulationWithGd' => __DIR__ . DS . 'classes' . DS)); Autoloader::alias('ImageManipulationWithGd\\Imwg', 'Imwg'); // Merge user configuration files ImageManipulationWithGd\Config::merge();
<?php // Autoload Former's namespace Autoloader::namespaces(array('Former' => Bundle::path('former') . 'libraries'));
<?php Autoloader::namespaces(array('Chargebee' => Bundle::path('chargebee') . 'chargebee-php/lib/')); // include require_once __DIR__ . '/chargebee-php/lib/ChargeBee.php'; // load config $config = Config::get('chargebee'); ChargeBee_Environment::configure($config['site_name'], $config['site_api_key']);
<?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';
<?php namespace Blog; \Autoloader::namespaces(array('Blog\\Models' => \Bundle::path('blog') . 'models')); \Validator::register('date', function ($attribute, $value, $parameters) { $regex = '/^[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))$/'; return preg_match($regex, $value); }); \Validator::register('time', function ($attribute, $value, $parameters) { $regex = '/^(20|21|22|23|[01]\\d|\\d)(([:.][0-5]\\d){1,2})$/'; return preg_match($regex, $value); });