本文整理汇总了PHP中Zend_Loader_Autoloader::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Loader_Autoloader::getInstance方法的具体用法?PHP Zend_Loader_Autoloader::getInstance怎么用?PHP Zend_Loader_Autoloader::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Loader_Autoloader
的用法示例。
在下文中一共展示了Zend_Loader_Autoloader::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$paths = array(get_include_path(), BASEPATH . '../application/third_party/zend/library');
set_include_path(implode(PATH_SEPARATOR, $paths));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
}
示例2: _initAutoload
protected function _initAutoload()
{
$moduleLoader = new Zend_Application_Module_Autoloader(array('namespace' => '', 'basePath' => APPLICATION_PATH));
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace(array('Flux_', 'Iste_', 'Spip_'));
return $moduleLoader;
}
示例3: init
public function init()
{
$options = $this->getOptions();
if (isset($options['base_path'])) {
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('ZFDebug');
$options = array('plugins' => array('Variables', 'File' => array('base_path' => $options['base_path']), 'Memory', 'Time', 'Registry', 'Exception'));
# Instantiate the database adapter and setup the plugin.
# Alternatively just add the plugin like above and rely on the autodiscovery feature.
if ($this->hasPluginResource('db')) {
$this->bootstrap('db');
$db = $this->getPluginResource('db')->getDbAdapter();
$options['plugins']['Database']['adapter'] = $db;
}
# Setup the cache plugin
if ($this->hasPluginResource('cache')) {
$this->bootstrap('cache');
$cache = $this->getPluginResource('cache')->getDbAdapter();
$options['plugins']['Cache']['backend'] = $cache->getBackend();
}
$debug = new ZFDebug_Controller_Plugin_Debug($options);
$this->bootstrap('frontController');
$frontController = $this->getResource('frontController');
$frontController->registerPlugin($debug);
}
}
示例4: run
public static function run()
{
#echo get_include_path();
#exit();
try {
// 設定ファイル読み込み
$config = new Zend_Config_Ini(INSTALL_DIR . 'application/configs/config.ini', 'production');
// Zend_Loader の設定(ファイル自動読み込み)
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);
Zend_Registry::set($config->registry->config, $config);
$view = new Tokyofr_View_Smarty($config->smarty->template_dir, $config->smarty->toArray());
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view)->setViewBasePathSpec($view->getEngine()->template_dir[0]);
$viewRenderer->setViewScriptPathSpec(':controller/:action.:suffix');
$viewRenderer->setViewScriptPathNoControllerSpec(':action.:suffix');
$viewRenderer->setViewSuffix('phtml');
Tokyofr_Controller_Front::run($config->path->controller);
} catch (Zend_Exception $e) {
//var_dump($e->getMessage());
exit("error.");
} catch (Exception $e) {
//var_dump($e->getMessage());
exit('error02');
}
}
示例5: _initAutoLoader
/**
* _initAutoLoader
*
* @return Zend_Loader_Autoloader
*/
public function _initAutoLoader()
{
$autoloader = Zend_Loader_Autoloader::getInstance();
$resourceLoader = new Zend_Loader_Autoloader_Resource(array('basePath' => APPLICATION_PATH, 'namespace' => 'Application', 'resourceTypes' => array('plugin' => array('path' => 'plugins/', 'namespace' => 'Plugin'), 'form' => array('path' => 'forms/', 'namespace' => 'Form'), 'model' => array('path' => 'models/', 'namespace' => 'Model'))));
$autoloader->pushAutoloader($resourceLoader);
return $autoloader;
}
示例6: _initAutoload
protected function _initAutoload()
{
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('Cola_');
$autoloader = new Zend_Application_Module_Autoloader(array('namespace' => 'Listmaker_', 'basePath' => dirname(__FILE__)));
return $autoloader;
}
示例7: __connect
public function __connect()
{
set_include_path(implode(PATH_SEPARATOR, array(WWW_ROOT . '/zend/library/', get_include_path())));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
$this->mail = new Zend_Mail_Storage_Imap(array('host' => $this->hostname, 'port' => $this->port, 'ssl' => $this->ssl, 'user' => $this->username, 'password' => $this->password));
}
示例8: bootstrap
public function bootstrap($env)
{
putenv('RUN_CLI_MODE=true');
define('RUN_CLI_MODE', true);
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../../../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : $env);
// bootstrap include_path and constants
require realpath(APPLICATION_PATH . '/../library/library.php');
/** Zend_Application */
require_once 'Zend/Application.php';
require_once 'Centurion/Application.php';
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance()->registerNamespace('Centurion_')->setDefaultAutoloader(create_function('$class', "include str_replace('_', '/', \$class) . '.php';"));
$classFileIncCache = realpath(APPLICATION_PATH . '/../data/cache') . '/pluginLoaderCache.tmp';
if (file_exists($classFileIncCache)) {
$fp = fopen($classFileIncCache, 'r');
flock($fp, LOCK_SH);
$data = file_get_contents($classFileIncCache);
flock($fp, LOCK_UN);
fclose($fp);
$data = @unserialize($data);
if ($data !== false) {
Centurion_Loader_PluginLoader::setStaticCachePlugin($data);
}
}
Centurion_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
// Create application, bootstrap, and run
$this->_application = new Centurion_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/');
$this->_application->bootstrap('db');
$this->_application->bootstrap('FrontController');
$this->_application->bootstrap('contrib');
}
示例9: _initZFDebug
protected function _initZFDebug()
{
// Setup autoloader with namespace
$autoloader = \Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('ZFDebug');
// Ensure the front controller is initialized
$this->bootstrap('FrontController');
// Retrieve the front controller from the bootstrap registry
$front = $this->getResource('FrontController');
// Only enable zfdebug if options have been specified for it
if ($this->hasOption('zfdebug')) {
// Create ZFDebug instance
$zfDebug = new \ZFDebug\Controller\Plugin\Debug($this->getOption('zfdebug'));
// Register ZFDebug with the front controller
$front->registerPlugin($zfDebug);
}
// In application.ini do the following:
//
// [development : production]
// zfdebug.plugins.Variables = null
// zfdebug.plugins.Time = null
// zfdebug.plugins.Memory = null
// ...
// Plugins that take objects as parameters like Database and Cache
// need to be registered manually:
$zfDebug->registerPlugin(new \ZFDebug\Controller\Plugin\Debug\Plugin\Database($db));
// Alternative configuration without application.ini
$options = ['plugins' => ['variables', 'database', 'file' => ['basePath' => '/Library/WebServer/Documents/budget', 'myLibrary' => 'Scienta'], 'memory', 'time', 'registry', 'exception']];
$zfDebug = new \ZFDebug\Controller\Plugin\Debug($options);
// Register ZFDebug with the front controller
$front->registerPlugin($zfDebug);
}
示例10: dispatchLoopStartup
/**
* Pre-dispatch hook to create and install a replacement View object.
*
* @param Zend_Controller_Request_Abstract $request The requst object.
*
* @return void
*/
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
// Unregister the built-in autoloader
spl_autoload_unregister(array('PHPTAL', 'autoload'));
// Register the autoloader through Zend
Zend_Loader_Autoloader::getInstance()->pushAutoloader(array('PHPTAL', 'autoload'), 'PHPTAL');
// We create an instance of our view wrapper and configure it
// It extends Zend_View so we can configure it the same way
$view = new Ztal_Tal_View($this->_options);
if (Zend_Registry::isRegistered('Zend_Translate')) {
//setup the translation facilities in PHPTal
$translator = new Ztal_Tal_ZendTranslateTranslator($this->_options);
$translator->useDomain($request->getControllerName());
$view->getEngine()->setTranslator($translator);
}
// Call out to an overloadable method to pickup the paths for
// templates for the current module
foreach ($this->_currentModuleTemplatePaths($request) as $currentPath) {
$view->addTemplateRepositoryPath($currentPath);
}
// We configure the view renderer in order to use our PHPTAL view
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setViewSuffix('phtml');
$view->layout()->setViewSuffix('phtml');
$viewRenderer->setView($view);
Zend_Registry::set('Ztal_View', $view);
}
示例11: _initAutoloaderNamespaces
public function _initAutoloaderNamespaces()
{
require_once APPLICATION_PATH . '/../library/vendor/Doctrine/lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
$autoloader = \Zend_Loader_Autoloader::getInstance();
$fmmAutoloader = new \Doctrine\Common\ClassLoader('Bisna');
$autoloader->pushAutoloader(array($fmmAutoloader, 'loadClass'), 'Bisna');
}
示例12: setupApplication
protected function setupApplication($namespace, $title, array $javascripts = array(), array $css = array())
{
Gecko_Model::setDefaultNamespace($namespace);
$loader = Zend_Loader_Autoloader::getInstance();
$autoloaders = $loader->getAutoloaders();
foreach ($autoloaders as $loader) {
$loader->addResourceType('row', 'models/Rows', 'Model_Row');
//$loader->addResourceType('service', 'services', 'Service');
}
$this->bootstrap('view');
$View = $this->getResource('view');
$View->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$View->addHelperPath(APPLICATION_PATH . '/views/helpers/', $namespace . '_View_Helper');
$View->addHelperPath('Gecko/View/Helper/', 'Gecko_View_Helper');
$View->doctype('HTML5');
$View->headTitle($title)->setSeparator(' > ');
$View->headMeta()->appendName('Content-type', 'text/html; charset=utf-8')->appendName('viewport', 'width=device-width, initial-scale=1');
$View->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
$defaultCss = array('/css/normalize.css');
$css = array_merge($defaultCss, $css);
foreach ($css as $cssPath) {
$View->headLink()->appendStylesheet($cssPath);
}
$defaultJavascript = array();
$javascripts = array_merge($defaultJavascript, $javascripts);
$View->jQuery()->setLocalPath('/js/jquery-1.11.1.min.js');
foreach ($javascripts as $jsPath) {
$View->jQuery()->addJavascriptFile($jsPath);
}
}
示例13: _initAutoload
protected function _initAutoload()
{
Zend_Loader_Autoloader::getInstance()->registerNamespace('PHPExcel');
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/helpers');
$autoloader = new Zend_Loader_Autoloader_Resource(array('namespace' => 'Default', 'basePath' => APPLICATION_PATH, 'resourceTypes' => array('form' => array('path' => 'forms', 'namespace' => 'Form'), 'model' => array('path' => 'models', 'namespace' => 'Model'), 'service' => array('path' => 'services', 'namespace' => 'Service'))));
return $autoloader;
}
示例14: prepare
public static function prepare()
{
self::setupEnvironment();
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
self::setupFrontController();
self::session();
}
示例15: init
public function init()
{
//get ini file options
$iniOptions = $this->getOptions();
//set ZFDebug to autoload
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('ZFDebug');
//initialized Front Controller
$bootstrap = $this->getBootstrap();
$bootstrap->bootstrap('frontController');
$frontController = $bootstrap->getResource('frontController');
if (RFLib_Core::getIsDeveloperMode() && trim($iniOptions['enable'])) {
//set ZFDebug options
$options = array('plugins' => array('Variables', 'File' => array('basePath' => APPLICATION_PATH . '/..'), 'Memory', 'Time', 'Registry', 'Exception'));
//add cache option if specified
if ($bootstrap->hasPluginResource('cache')) {
$bootstrap->bootstrap('cache');
$cache = $bootstrap->getPluginResource('cache')->getBackend();
$options['plugins']['Cache']['backend'] = $cache;
}
// add db option if specified
if ($bootstrap->hasPluginResource('db')) {
$bootstrap->bootstrap('db');
$db = $bootstrap->getPluginResource('db')->getDbAdapter();
$options['plugins']['Database']['adapter'] = $db;
}
$debug = new ZFDebug_Controller_Plugin_Debug($options);
$frontController->registerPlugin($debug);
}
}