本文整理汇总了PHP中Autoloader::namespaces方法的典型用法代码示例。如果您正苦于以下问题:PHP Autoloader::namespaces方法的具体用法?PHP Autoloader::namespaces怎么用?PHP Autoloader::namespaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autoloader
的用法示例。
在下文中一共展示了Autoloader::namespaces方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: path
<?php
Autoloader::map(array('Laravel\\Asset_Container' => path('sys') . 'asset.php'));
Autoloader::namespaces(array('AssetCompressor' => __DIR__));
Autoloader::alias('AssetCompressor\\Asset', 'Asset');
示例2:
<?php
Autoloader::map(array('Flyswatter_Base_Controller' => Bundle::path('flyswatter') . 'controllers/base.php'));
Autoloader::namespaces(array('Flyswatter\\Models' => Bundle::path('flyswatter') . 'models'));
示例3:
<?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');
示例4: function
<?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;
});
示例5: function
<?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 {
示例6:
<?php
Autoloader::namespaces(array('Auth' => Bundle::path('auth') . 'libraries'));
示例7: testClassesMappedByNamespaceCanBeLoaded
/**
* 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());
}
示例8: function
<?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));
}
示例9: define
|
| 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
|--------------------------------------------------------------------------
|
示例10: createClassMap
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));
}
}
示例11: define
<?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');
}
示例12:
<?php
/**
* Bootstrapper for creating Twitter Bootstrap markup.
*
* @category HTML/UI
* @package Boostrapper
* @subpackage Twitter
* @author Patrick Talmadge - <ptalmadge@gmail.com>
* @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');
示例13:
<?php
Log::info('Ravenly online');
Autoloader::namespaces(array('PhpLib' => Bundle::path('ravenly') . 'lib/PhpLib'));
示例14: function
<?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');
示例15: path
<?php
/*
|--------------------------------------------------------------------------
| Auto-Loader Namespaces
|--------------------------------------------------------------------------
|
| Load namespaces here. This only shows the relevant Autoloader for this example
|
*/
Autoloader::namespaces(array('AdminModels' => path('app') . 'models/admin'));