public function testAutoincluding() { Zend_Loader_AutoloaderFactory::factory(array('Zend_Loader_ClassMapAutoloader' => array(dirname(__FILE__) . '/_files/goodmap.php'))); $loader = Zend_Loader_AutoloaderFactory::getRegisteredAutoloader('Zend_Loader_ClassMapAutoloader'); $map = $loader->getAutoloadMap(); $this->assertTrue(is_array($map)); $this->assertEquals(2, count($map)); }
<?php define('APPLICATION_ENV', 'development'); try { // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); // Define application environment /** @noinspection PhpConstantReassignmentInspection */ defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array(APPLICATION_PATH, realpath(APPLICATION_PATH . '/../vendor/zendframework/zendframework1/library'), get_include_path()))); /** @noinspection PhpIncludeInspection */ require_once '../vendor/autoload.php'; // require_once '../library/Zend/Loader/AutoloaderFactory.php'; // require_once '../library/Zend/Loader/ClassMapAutoloader.php'; Zend_Loader_AutoloaderFactory::factory(array('Zend_Loader_StandardAutoloader' => array('prefixes' => array('Zend' => realpath(__DIR__ . '/../vendor/zendframework/zendframework1/library/Zend'), 'application' => APPLICATION_PATH), 'fallback_autoloader' => true))); /** Zend_Application */ //require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->bootstrap(); $application->run(); } catch (Exception $e) { try { $guid = Dfi_Error_Report::saveException($e); } catch (Exception $e) { $guid = false; } if (APPLICATION_ENV != 'development') { $url = "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s://" : "://") . $_SERVER['HTTP_HOST'] . '/'; header("Location: " . $url . "error/error" . ($guid ? '/guid/' . $guid : ''));
/** * Get an instance of the standard autoloader * * Used to attempt to resolve autoloader classes, using the * StandardAutoloader. The instance is marked as a fallback autoloader, to * allow resolving autoloaders not under the "Zend" or "Zend" namespaces. * * @return Zend_Loader_SplAutoloader */ protected static function getStandardAutoloader() { if (null !== self::$standardAutoloader) { return self::$standardAutoloader; } // Extract the filename from the classname $stdAutoloader = substr(strrchr(self::STANDARD_AUTOLOADER, '_'), 1); if (!class_exists(self::STANDARD_AUTOLOADER)) { #require_once dirname(__FILE__) . "/$stdAutoloader.php"; } $loader = new Zend_Loader_StandardAutoloader(); self::$standardAutoloader = $loader; return self::$standardAutoloader; }
$xhprofIni = new Zend_Config_Ini($pathToFile); if (null == ($config = $xhprofIni->get(APPLICATION_ENV)) && null == ($config = $xhprofIni->get('default'))) { require_once 'Zend/Application/Exception.php'; throw new Zend_Application_Exception("Błędne ustawienia dla XHprof w pliku xhprof.ini"); } if ($config->xhprof->enabled === '1') { $xhprofEnabled = true; require_once __DIR__ . '/../library/Zend/Loader/AutoloaderFactory.php'; Zend_Loader_AutoloaderFactory::factory(array( 'Zend_Loader_StandardAutoloader' => array( 'prefixes' => array( 'Xhprof' => __DIR__ . '/../library/Xhprof' ), 'fallback_autoloader' => true, ), )); } } /** Zend_Application */ require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); if(true === $xhprofEnabled){
$backendOptions = array("file_name_prefix" => APPLICATION_ENV . "_config", "cache_dir" => $appRootPath . "/data/cache", "cache_file_umask" => 0644); // getting a Zend_Cache_Core object $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); if (!($result = $cache->load('application'))) { require_once 'Zend/Config/Yaml.php'; require_once 'Core/Config/Yaml.php'; $result = new Core_Config_Yaml($config, APPLICATION_ENV); $result = $result->toArray(); $cache->save($result, 'application'); } $config = $result; } else { throw new Exception('Config not founded!'); } } $classFileIncCache = $appRootPath . '/data/cache/pluginLoaderCache.php'; if (file_exists($classFileIncCache)) { include_once $classFileIncCache; } Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache); require_once 'Zend/Loader/AutoloaderFactory.php'; require_once 'Zend/Loader/ClassMapAutoloader.php'; Zend_Loader_AutoloaderFactory::factory(array('Zend_Loader_ClassMapAutoloader' => array($appRootPath . '/vendor/uglide/zendframework1/library/autoload_classmap.php', $appRootPath . '/library/autoload_classmap.php'), 'Zend_Loader_StandardAutoloader' => array('autoloadernamespaces' => $config['autoloadernamespaces'], 'fallback_autoloader' => true))); require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application(APPLICATION_ENV, $config); $application->bootstrap()->run(); } catch (Exception $exception) { Core_ErrorHandler::saveErrorInLog($exception, 'exception'); Core_ErrorHandler::exitWithMessage('General Application Error!'); }
public function testPassingNoArgumentsToFactoryInstantiatesAndRegistersStandardAutoloader() { Zend_Loader_AutoloaderFactory::factory(); $loaders = Zend_Loader_AutoloaderFactory::getRegisteredAutoloaders(); $this->assertEquals(1, count($loaders)); $loader = array_shift($loaders); $this->assertTrue($loader instanceof Zend_Loader_StandardAutoloader); $test = array($loader, 'autoload'); $found = false; foreach (spl_autoload_functions() as $function) { if ($function === $test) { $found = true; break; } } $this->assertTrue($found, 'StandardAutoloader not registered with spl_autoload'); }
protected function _initAutoloader() { Zend_Loader_AutoloaderFactory::factory(array('Zend_Loader_StandardAutoloader' => array('prefixes' => array('ManipleForms_' => __DIR__ . '/library/')))); }
// Will be overwritten during initialization process // @see iMSCP_Initializer::_setDisplayErrors() ini_set('display_errors', 1); // Define paths define('GUI_ROOT_DIR', dirname(__DIR__)); define('LIBRARY_PATH', GUI_ROOT_DIR . '/library'); define('CACHE_PATH', GUI_ROOT_DIR . '/data/cache'); define('PERSISTENT_PATH', GUI_ROOT_DIR . '/data/persistent'); define('CONFIG_FILE_PATH', getenv('IMSCP_CONF') ?: '/etc/imscp/imscp.conf'); define('CONFIG_CACHE_FILE_PATH', CACHE_PATH . '/imscp_config.conf'); define('DBCONFIG_CACHE_FILE_PATH', CACHE_PATH . '/imscp_dbconfig.conf'); // Setup include path set_include_path(implode(PATH_SEPARATOR, array_unique(array_merge(array(LIBRARY_PATH, LIBRARY_PATH . '/vendor'), explode(PATH_SEPARATOR, get_include_path()))))); // Setup autoloader require_once LIBRARY_PATH . '/vendor/Zend/Loader/AutoloaderFactory.php'; Zend_Loader_AutoloaderFactory::factory(array('Zend_Loader_StandardAutoloader' => array('autoregister_zf' => true, 'prefixes' => array('iMSCP_' => LIBRARY_PATH . '/iMSCP', 'Crypt_' => LIBRARY_PATH . '/vendor/phpseclib/Crypt', 'File_' => LIBRARY_PATH . '/vendor/phpseclib/File', 'Math_' => LIBRARY_PATH . '/vendor/phpseclib/Math', 'Net_' => LIBRARY_PATH . '/vendor/Net')))); // Set handler for uncaught exceptions iMSCP_Registry::set('exceptionHandler', new iMSCP_Exception_Handler()); /** * Include core functions */ require_once LIBRARY_PATH . '/Functions/Admin.php'; require_once LIBRARY_PATH . '/Functions/Client.php'; require_once LIBRARY_PATH . '/Functions/Email.php'; require_once LIBRARY_PATH . '/Functions/Input.php'; require_once LIBRARY_PATH . '/Functions/Intl.php'; require_once LIBRARY_PATH . '/Functions/Layout.php'; require_once LIBRARY_PATH . '/Functions/Login.php'; require_once LIBRARY_PATH . '/Functions/Shared.php'; require_once LIBRARY_PATH . '/Functions/SoftwareInstaller.php'; require_once LIBRARY_PATH . '/Functions/Reseller.php';
protected function _initAutoloader() { Zend_Loader_AutoloaderFactory::factory(array('Zend_Loader_StandardAutoloader' => array('prefixes' => array('ManipleRequirejs_' => dirname(__FILE__) . '/library/')))); }