本文整理汇总了PHP中static::loader方法的典型用法代码示例。如果您正苦于以下问题:PHP static::loader方法的具体用法?PHP static::loader怎么用?PHP static::loader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::loader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLoader
public static function getLoader()
{
if (null !== static::$loader) {
return static::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'));
static::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = (require __DIR__ . '/autoload_namespaces.php');
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
}
$classMap = (require __DIR__ . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register();
require $vendorDir . '/c/lorem/testC.php';
require $vendorDir . '/z/foo/testA.php';
require $baseDir . '/root.php';
require $vendorDir . '/b/bar/testB.php';
require $vendorDir . '/d/d/testD.php';
require $vendorDir . '/e/e/testE.php';
return $loader;
}
示例2: init
/**
* 初始化加载器
*
* @return \Powernote\Autoloader\ClassAliasLoader
*/
public static function init()
{
if (static::$loader == null) {
static::$loader = new self();
}
return static::$loader;
}
示例3: initialize
public static function initialize($paths, $baseNamespace = 'App')
{
static::$baseNamespace = rtrim($baseNamespace, '\\') . '\\';
static::$config = new Config(APP_LOCAL ? $paths['config'] . 'local/' : $paths['config']);
static::$paths = $paths;
static::$loader = new Loader();
static::$loader->registerNamespaces([static::$baseNamespace . 'Assets' => $paths['assets'], static::$baseNamespace . 'Bootstrap' => $paths['bootstrap'], static::$baseNamespace . 'Components' => $paths['components'], static::$baseNamespace . 'Helpers' => $paths['helpers'], static::$baseNamespace . 'Libraries' => $paths['libraries'], static::$baseNamespace . 'Models' => $paths['models'], static::$baseNamespace . 'Modules' => $paths['modules']]);
static::$loader->register();
}
示例4: make
/**
* Makes autoloader.
*
* @return ClassLoader The class loader
*/
public static function make()
{
if (!static::$loader) {
$loader = new ClassLoader();
$loader->register();
static::$loader = $loader;
}
return static::$loader;
}
示例5: init
/**
* 初始化加载器
*
* @return \Powernote\Autoloader\ClassLoader
*/
public static function init()
{
if (static::$loader == null) {
static::$loader = new self();
// 添加框架名称空间加载路径
static::$loader->addNamespace('Powernote', realpath(__DIR__ . '/../'), true);
}
return static::$loader;
}
示例6: __construct
public function __construct()
{
global $autoloader;
static::$loader = $autoloader;
session_start();
parent::__construct();
require_once __DIR__ . '/version.php';
// Setup aliases
$this->setupAliases();
// Load translations
$this->loadTranslations();
// Load common functions
require __DIR__ . '/common.php';
// Load plugins
$this->loadPlugins();
}
示例7: getLoader
public static function getLoader()
{
if (null !== static::$loader) {
return static::$loader;
}
static::$loader = $loader = new \Composer\Autoload\ClassLoader();
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = (require __DIR__ . '/autoload_namespaces.php');
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
}
$classMap = (require __DIR__ . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register();
return $loader;
}
示例8: load
/**
* Load DI container config from the unit file into the given container builder.
*
* @param ContainerBuilder $builder
*
* @throws \RuntimeException
*/
public function load(ContainerBuilder $builder)
{
if (static::$loader === NULL) {
static::$loader = $this->createUnitLoader();
}
try {
$unit = (static::$loader)($this->assertFile($this->file));
} catch (\Throwable $e) {
throw new \RuntimeException(sprintf('Failed to include unit: "%s"', $this->file), 0, $e);
}
if (!$unit instanceof \Closure) {
$type = is_object($unit) ? get_class($unit) : gettype($unit);
throw new \RuntimeException(sprintf('Unit requires a closure, value returned by "%s" is %s', $this->file, $type));
}
try {
$unit($builder);
} catch (\Throwable $e) {
throw new \RuntimeException(sprintf('Failed to load unit "%s"', $this->file), 0, $e);
}
}
示例9: __construct
protected function __construct($registry)
{
if (!isset($registry)) {
$registry = new Registry();
$registry->set('db', DB::getDB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE));
}
$this->registry = $registry;
if (is_null(static::$newConfig)) {
static::$newConfig = $this->registry->get('config');
}
$this->config = static::$newConfig;
if (is_null(static::$db)) {
static::$db = $this->registry->get('db');
}
if (is_null(static::$loader)) {
static::$loader = $this->registry->get('load');
}
$this->load = static::$loader;
$this->log = $this->registry->get("log");
}
示例10: getLoader
public static function getLoader()
{
if (null !== static::$loader) {
return static::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitcaccbb1dae7e5bd0f3d1bf80a43364f8', 'loadClassLoader'));
static::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitcaccbb1dae7e5bd0f3d1bf80a43364f8', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = (require __DIR__ . '/autoload_namespaces.php');
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
}
$classMap = (require __DIR__ . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register();
return $loader;
}
示例11: getLoader
public static function getLoader()
{
if (null !== static::$loader) {
return static::$loader;
}
static::$loader = $loader = new \Composer\Autoload\ClassLoader();
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$includePaths = (require __DIR__ . '/include_paths.php');
array_push($includePaths, get_include_path());
set_include_path(join(PATH_SEPARATOR, $includePaths));
$map = (require __DIR__ . '/autoload_namespaces.php');
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
}
$classMap = (require __DIR__ . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register();
return $loader;
}
示例12: __construct
public function __construct()
{
global $autoloader;
parent::__construct();
static::$loader = $autoloader;
require __DIR__ . '/version.php';
// Connect to the database
$db = $this->config['db'][$this->config['environment']];
// $GLOBALS['db'] = DriverManager::getConnection([
$GLOBALS['db'] = ConnectionManager::create(['dbname' => $db['database'], 'user' => $db['username'], 'password' => $db['password'], 'host' => $db['host'], 'driver' => $db['driver'], 'prefix' => $db['prefix']]);
define('PREFIX', $db['prefix']);
unset($db);
// Alias some commonly used classes
class_alias('Avalon\\Templating\\View', 'View');
class_alias('Avalon\\Http\\Request', 'Request');
class_alias('Avalon\\Hook', 'Hook');
class_alias('Traq\\Helpers\\Errors', 'Errors');
class_alias('Traq\\Helpers\\Format', 'Format');
class_alias('Traq\\Helpers\\Ticketlist', 'Ticketlist');
class_alias('Traq\\Helpers\\TicketFilters', 'TicketFilters');
class_alias('Avalon\\Helpers\\HTML', 'HTML');
class_alias('Avalon\\Helpers\\Form', 'Form');
class_alias('Avalon\\Helpers\\TWBS', 'TWBS');
class_alias('Avalon\\Helpers\\Gravatar', 'Gravatar');
// Load commonly used functions
require __DIR__ . '/common.php';
View::loadFunctions();
// If a theme is set, prepend it's views directory
if (setting('theme') !== 'default') {
View::addPath(__DIR__ . '/../' . setting('theme') . '/views', true);
}
$this->loadTranslations();
$this->loadPlugins();
// Set mailer config
if (isset($this->config['email'])) {
Notification::setConfig($this->config['email']);
}
}
示例13: getLoader
public static function getLoader()
{
if (null !== static::$loader) {
return static::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit93f1e84b83781b432268394c32fb013f', 'loadClassLoader'));
static::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit93f1e84b83781b432268394c32fb013f', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = (require __DIR__ . '/autoload_namespaces.php');
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
}
$classMap = (require __DIR__ . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register();
require $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php';
require $vendorDir . '/kriswallsmith/assetic/src/functions.php';
return $loader;
}
示例14: init
/**
* Renderer initialisieren
*/
private static function init()
{
// Loader nur einmal pro Skriptlaufzeit erstellen
if (is_null(static::$loader)) {
// Autoloader der Renderers aktivieren
Twig_Autoloader::register();
// Basisverzeichnis des Renderers zuweisen
static::$loader = new Twig_Loader_Filesystem(DIR_TEMPLATES);
// UMGEBUNGS-EINSTELLUNGEN DES RENDERERS SETZEN
$twigSettings = array('cache' => DIR_COMPILED);
if (static::DEBUG) {
$twigSettings['debug'] = true;
// dump()-Methode zur Verfügung stellen
$twigSettings['auto_reload'] = true;
// Bei Templateänderungen sofort neu kompilieren
}
static::$twig = new Twig_Environment(static::$loader, $twigSettings);
// dump()-Methode zur Verfügung stellen
if (static::DEBUG) {
static::$twig->addExtension(new Twig_Extension_Debug());
}
// EIGENE METHODEN FUER RENDERER ZUWEISEN
$renderUrl = new Twig_SimpleFunction('url', array('Renderer', 'renderUrl'));
static::$twig->addFunction($renderUrl);
$renderPrice = new Twig_SimpleFunction('price', array('Renderer', 'renderPrice'), array('is_safe' => array('html')));
static::$twig->addFunction($renderPrice);
$renderLimitUnit = new Twig_SimpleFunction('unit', array('Renderer', 'renderLimitUnit'), array('is_safe' => array('html')));
static::$twig->addFunction($renderLimitUnit);
$formatNumber = new Twig_SimpleFunction('formatNumber', array('Renderer', 'formatNumber'));
static::$twig->addFunction($formatNumber);
$markError = new Twig_SimpleFunction('markError', array('Renderer', 'markError'));
static::$twig->addFunction($markError);
$getError = new Twig_SimpleFunction('getError', array('Renderer', 'getError'));
static::$twig->addFunction($getError);
}
}
示例15: _setLoader
protected static function _setLoader($loader)
{
static::$loader = $loader;
}