本文整理汇总了PHP中Zend_Loader_Autoloader::autoload方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Loader_Autoloader::autoload方法的具体用法?PHP Zend_Loader_Autoloader::autoload怎么用?PHP Zend_Loader_Autoloader::autoload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Loader_Autoloader
的用法示例。
在下文中一共展示了Zend_Loader_Autoloader::autoload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAdapter
/**
* Set adapter to use
*
* @param mixed $adapters
* @param bool $force
* @return void
*/
public static function setAdapter($adapters = null, $force = false)
{
$adapters = (array) $adapters;
if (!$force) {
$adapters = array_unique(array_merge($adapters, array(self::ADAPTER_GD, self::ADAPTER_IMAGEMAGICK)));
}
$name = null;
foreach ($adapters as $adapter) {
if (Zend_Loader_Autoloader::autoload($adapter)) {
if (call_user_func($adapter . '::isAvailable')) {
$name = $adapter;
break;
}
} elseif (Zend_Loader_Autoloader::autoload('Zend_Image_Adapter_' . $adapter)) {
if (call_user_func('Zend_Image_Adapter_' . $adapter . '::isAvailable')) {
$name = 'Zend_Image_Adapter_' . $adapter;
break;
}
} else {
require_once 'Zend/Image/Exception.php';
throw new Zend_Image_Exception("Could not find adapter '" . $adapter . "'");
}
}
if ($name) {
self::$_adapterToUse = $name;
return $name;
}
require_once 'Zend/Image/Exception.php';
throw new Zend_Image_Exception('Was not able to detect an available adapter');
}
示例2: autoload
/**
* autoload
* @author Cornelius Hansjakob <cha@massiveart.com>
* @version 1.0
*/
public static function autoload($class)
{
try {
$sysConfig = Zend_Registry::get('SysConfig');
$zooConfig = Zend_Registry::get('ZooConfig');
$webConfig = Zend_Registry::get('WebConfig');
if (strpos($class, 'Zend_') === false && strpos($class, 'ZendX_') === false) {
/**
* check if given $className exists and file exists
*/
if (array_key_exists($class, self::$arrClasses)) {
if (file_exists(GLOBAL_ROOT_PATH . $sysConfig->path->root . self::$arrClasses[$class])) {
require_once GLOBAL_ROOT_PATH . $sysConfig->path->root . self::$arrClasses[$class];
}
}
} else {
/**
* load Zend Class
*/
parent::autoload($class);
}
return $class;
} catch (Exception $e) {
return false;
}
}
示例3: _initAutoloader
protected function _initAutoloader()
{
$loader = function ($className) {
$className = str_replace('\\', '_', $className);
Zend_Loader_Autoloader::autoload($className);
};
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->pushAutoloader($loader, 'Application\\');
}
示例4: factory
public static function factory($repString)
{
// Check if we are referring to a class
Zend_Loader_Autoloader::autoload($repString);
if (!class_exists($repString)) {
throw new Exception('Only class-based representations are supported at this time!');
}
$rep = new $repString();
return $rep;
}
示例5: init
public function init()
{
$this->setTitle('Enter FTP Information')->setDescription('Please provide your FTP login information so that the installer can connect to your server, extract the new files, and set permissions automatically. If you would rather not use FTP to set permissions automatically, you can choose "None" as the connection type and PHP will attempt to set the necessary permissions. This method can be slightly less reliable, so we strongly suggest using FTP.');
// init adapter
$adapterMultiOptions = array();
$adapterMultiOptions[''] = '';
$adapterMultiOptions['ftp'] = 'FTP' . (function_exists('ftp_ssl_connect') ? '/FTPS' : '');
if (function_exists('ssh2_connect') && function_exists('ssh2_sftp')) {
$adapterMultiOptions['ssh'] = 'SSH/SFTP';
}
$adapterMultiOptions['system'] = 'None';
$this->addElement('Select', 'adapter', array('label' => 'FTP Connection Type', 'required' => true, 'allowEmpty' => false, 'multiOptions' => $adapterMultiOptions, 'onchange' => '$(this).getParent("form").submit();', 'style' => 'margin-bottom: 15px;'));
$this->addElement('Hidden', 'previousAdapter', array('order' => 10000, 'value' => $this->_adapterType));
$this->addElement('Hidden', 'step', array('order' => 10001, 'value' => 'adapter'));
$this->addElement('Hidden', 'return', array('order' => 10002));
$subform = null;
if ($this->_adapterType) {
$class = 'Install_Form_VfsInfo_' . ucfirst($this->_adapterType);
try {
if (Zend_Loader_Autoloader::autoload($class)) {
$subform = new $class();
}
} catch (Exception $e) {
$subform = null;
}
}
if ($subform) {
$this->prepareSubForm($subform);
$this->addSubForm($subform, 'config');
// Submit
$this->addElement('Button', 'execute', array('label' => 'Continue', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
$this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'href' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action' => 'index')), 'decorators' => array('ViewHelper')));
$this->addDisplayGroup(array('execute', 'cancel'), 'buttons');
}
// Modify decorators
$this->loadDefaultDecorators();
$this->getDecorator('FormErrors')->setSkipLabels(true);
/*
$ftpForm = new Install_Form_VfsInfo_Ftp();
$this->prepareSubForm($ftpForm);
$this->addSubForm($ftpForm, 'ftp');
$sshForm = new Install_Form_VfsInfo_Ssh();
$this->prepareSubForm($sshForm);
$this->addSubForm($sshForm, 'ssh');
$systemForm = new Install_Form_VfsInfo_System();
$this->prepareSubForm($systemForm);
$this->addSubForm($systemForm, 'system');
$this->loadDefaultDecorators();
$this->removeDecorator('FormErrors');
*
*/
}
示例6: subscribe
public function subscribe($action, $options = array())
{
if (is_string($action)) {
$action = ucfirst($action);
if (!Zend_Loader_Autoloader::autoload($action) && !(($action = 'Zend_Image_Action_' . $action) && Zend_Loader_Autoloader::autoload($action))) {
require_once 'Zend/Image/Exception.php';
throw new Zend_Image_Exception('Could not instantiate specified class');
}
$action = new $action($options);
} elseif ($action instanceof Zend_Image_Action_ActionInterface) {
$action->addOptions($options);
} else {
require_once 'Zend/Image/Exception.php';
throw new Zend_Image_Exception('Given object does not seem' . 'to be a valid Zend_Image Action');
}
$this->_actions[] = $action;
return $this;
}
示例7: _setupTransport
protected function _setupTransport($options)
{
if (!isset($options['type'])) {
$options['type'] = 'sendmail';
}
$transportName = $options['type'];
if (!Zend_Loader_Autoloader::autoload($transportName)) {
$transportName = ucfirst(strtolower($transportName));
if (!Zend_Loader_Autoloader::autoload($transportName)) {
$transportName = 'Zend_Mail_Transport_' . $transportName;
if (!Zend_Loader_Autoloader::autoload($transportName)) {
throw new Zend_Application_Resource_Exception("Specified Mail Transport '{$transportName}'" . 'could not be found');
}
}
}
unset($options['type']);
switch ($transportName) {
case 'Zend_Mail_Transport_Smtp':
if (!isset($options['host'])) {
throw new Zend_Application_Resource_Exception('A host is necessary for smtp transport,' . ' but none was given');
}
$transport = new $transportName($options['host'], $options);
break;
case 'Zend_Mail_Transport_Sendmail':
default:
$transport = new $transportName($options);
break;
}
return $transport;
}
示例8: getExports
/**
* Build list of exports with options
*
* Options:
* caption - mandatory
* img - (default null)
* cssClass - (default ui-icon-extlink)
* newWindow - (default true)
* url - (default actual url)
* onClick - (default null)
* _class - (reserved, used internaly)
*
* @return array
*/
public function getExports()
{
$res = array();
foreach ($this->_export as $name => $defs) {
if (!is_array($defs)) {
// only export name is passed, we need to get default option
$name = $defs;
$className = 'Bvb_Grid_Deploy_' . ucfirst($name);
// TODO support user defined classes
if (Zend_Loader_Autoloader::autoload($className) && method_exists($className, 'getExportDefaults')) {
// learn the defualt values
$defs = call_user_func(array($className, 'getExportDefaults'));
} else {
// there are no defaults, we need at least some caption
$defs = array('caption' => $name);
}
$defs['_class'] = $className;
}
$res[$name] = $defs;
}
return $res;
}
示例9: autoload
/**
* Automne autoload handler
*
* @return true
* @access public
*/
static function autoload($classname)
{
static $classes, $modules;
if (!isset($classes)) {
$classes = array('cms_stack' => PATH_PACKAGES_FS . '/common/stack.php', 'cms_contactdata' => PATH_PACKAGES_FS . '/common/contactdata.php', 'cms_contactdatas_catalog' => PATH_PACKAGES_FS . '/common/contactdatascatalog.php', 'cms_href' => PATH_PACKAGES_FS . '/common/href.php', 'cms_log_catalog' => PATH_PACKAGES_FS . '/common/logcatalog.php', 'cms_log' => PATH_PACKAGES_FS . '/common/log.php', 'cms_languagescatalog' => PATH_PACKAGES_FS . '/common/languagescatalog.php', 'cms_actions' => PATH_PACKAGES_FS . '/common/actions.php', 'cms_action' => PATH_PACKAGES_FS . '/common/action.php', 'cms_search' => PATH_PACKAGES_FS . '/common/search.php', 'cms_contactdatas_catalog' => PATH_PACKAGES_FS . '/common/contactdatascatalog.php', 'cms_email' => PATH_PACKAGES_FS . '/common/email.php', 'cms_emailscatalog' => PATH_PACKAGES_FS . '/common/emailscatalog.php', 'cms_query' => PATH_PACKAGES_FS . '/common/query.php', 'cms_date' => PATH_PACKAGES_FS . '/common/date.php', 'cms_language' => PATH_PACKAGES_FS . '/common/language.php', 'cms_oembed' => PATH_PACKAGES_FS . '/common/oembed.php', 'sensitiveio' => PATH_PACKAGES_FS . '/common/sensitiveio.php', 'io' => PATH_PACKAGES_FS . '/common/sensitiveio.php', 'cms_context' => PATH_PACKAGES_FS . '/dialogs/context.php', 'cms_wysiwyg_toolbar' => PATH_PACKAGES_FS . '/dialogs/toolbar.php', 'cms_dialog' => PATH_PACKAGES_FS . '/dialogs/dialog.php', 'cms_jsdialog' => PATH_PACKAGES_FS . '/dialogs/jsdialog.php', 'cms_view' => PATH_PACKAGES_FS . '/dialogs/view.php', 'cms_submenus' => PATH_PACKAGES_FS . '/dialogs/submenus.php', 'cms_submenu' => PATH_PACKAGES_FS . '/dialogs/submenu.php', 'cms_dialog_listboxes' => PATH_PACKAGES_FS . '/dialogs/dialoglistboxes.php', 'cms_dialog_href' => PATH_PACKAGES_FS . '/dialogs/dialoghref.php', 'cms_fileupload_dialog' => PATH_PACKAGES_FS . '/dialogs/fileupload.php', 'cms_loadingdialog' => PATH_PACKAGES_FS . '/dialogs/loadingDialog.php', 'cms_texteditor' => PATH_PACKAGES_FS . '/dialogs/texteditor.php', 'cms_stats' => PATH_PACKAGES_FS . '/dialogs/stats.php', 'cms_patch' => PATH_PACKAGES_FS . '/files/patch.php', 'cms_file' => PATH_PACKAGES_FS . '/files/filesManagement.php', 'cms_archive' => PATH_PACKAGES_FS . '/files/archive.php', 'cms_gzip_file' => PATH_PACKAGES_FS . '/files/archive-gzip.php', 'cms_tar_file' => PATH_PACKAGES_FS . '/files/archive-tar.php', 'cms_zip_file' => PATH_PACKAGES_FS . '/files/archive-zip.php', 'cms_fileupload' => PATH_PACKAGES_FS . '/files/fileupload.php', 'cms_cache' => PATH_PACKAGES_FS . '/files/cache.php', 'cms_image' => PATH_PACKAGES_FS . '/files/image.php', 'cms_module' => PATH_MODULES_FS . '/module.php', 'cms_modulescodes' => PATH_MODULES_FS . '/modulesCodes.php', 'cms_modulevalidation' => PATH_MODULES_FS . '/moduleValidation.php', 'cms_superresource' => PATH_MODULES_FS . '/super_resource.php', 'cms_modulecategory' => PATH_MODULES_FS . '/modulecategory.php', 'cms_modulescatalog' => PATH_MODULES_FS . '/modulescatalog.php', 'cms_modulecategories_catalog' => PATH_MODULES_FS . '/modulecategoriescatalog.php', 'cms_modulestags' => PATH_MODULES_FS . '/modulesTags.php', 'cms_moduleclientspace' => PATH_MODULES_FS . '/moduleclientspace.php', 'cms_superresource' => PATH_MODULES_FS . '/super_resource.php', 'cms_polymod' => PATH_MODULES_FS . '/polymod.php', 'cms_modulepolymodvalidation' => PATH_MODULES_FS . '/modulePolymodValidation.php', 'cms_module_export' => PATH_MODULES_FS . '/export.php', 'cms_module_import' => PATH_MODULES_FS . '/import.php', 'cms_rowscatalog' => PATH_MODULES_FS . '/standard/rowscatalog.php', 'cms_row' => PATH_MODULES_FS . '/standard/row.php', 'cms_block' => PATH_MODULES_FS . '/standard/block.php', 'cms_block_file' => PATH_MODULES_FS . '/standard/blockfile.php', 'cms_block_flash' => PATH_MODULES_FS . '/standard/blockflash.php', 'cms_block_image' => PATH_MODULES_FS . '/standard/blockimage.php', 'cms_blockscatalog' => PATH_MODULES_FS . '/standard/blockscatalog.php', 'cms_block_text' => PATH_MODULES_FS . '/standard/blocktext.php', 'cms_block_varchar' => PATH_MODULES_FS . '/standard/blockvarchar.php', 'cms_block_link' => PATH_MODULES_FS . '/standard/blocklink.php', 'cms_moduleclientspace_standard' => PATH_MODULES_FS . '/standard/clientspace.php', 'cms_moduleclientspace_standard_catalog' => PATH_MODULES_FS . '/standard/clientspacescatalog.php', 'cms_xmltag_admin' => PATH_MODULES_FS . '/standard/tags/admin.php', 'cms_xmltag_noadmin' => PATH_MODULES_FS . '/standard/tags/noadmin.php', 'cms_xmltag_edit' => PATH_MODULES_FS . '/standard/tags/edit.php', 'cms_xmltag_noedit' => PATH_MODULES_FS . '/standard/tags/noedit.php', 'cms_xmltag_title' => PATH_MODULES_FS . '/standard/tags/title.php', 'cms_xmltag_page' => PATH_MODULES_FS . '/standard/tags/page.php', 'cms_xmltag_website' => PATH_MODULES_FS . '/standard/tags/website.php', 'cms_xmltag_anchor' => PATH_MODULES_FS . '/standard/tags/anchor.php', 'cms_xmltag_header' => PATH_MODULES_FS . '/standard/tags/header.php', 'cms_xmltag_redirect' => PATH_MODULES_FS . '/standard/tags/redirect.php', 'cms_xmltag_xml' => PATH_MODULES_FS . '/standard/tags/xml.php', 'cms_xmltag_js_add' => PATH_MODULES_FS . '/standard/tags/js-add.php', 'cms_xmltag_css_add' => PATH_MODULES_FS . '/standard/tags/css-add.php', 'cms_linxescatalog' => PATH_PACKAGES_FS . '/pageContent/linxescatalog.php', 'cms_xml2array' => PATH_PACKAGES_FS . '/pageContent/xml2Array.php', 'cms_linx' => PATH_PACKAGES_FS . '/pageContent/linx.php', 'cms_linxcondition' => PATH_PACKAGES_FS . '/pageContent/linxcondition.php', 'cms_linxdisplay' => PATH_PACKAGES_FS . '/pageContent/linxdisplay.php', 'cms_linxnodespec' => PATH_PACKAGES_FS . '/pageContent/linxnodespec.php', 'cms_xmltag' => PATH_PACKAGES_FS . '/pageContent/xmltag.php', 'cms_xmlparser' => PATH_PACKAGES_FS . '/pageContent/xmlparser.php', 'cms_domdocument' => PATH_PACKAGES_FS . '/pageContent/xmldomdocument.php', 'cms_array2xml' => PATH_PACKAGES_FS . '/pageContent/array2Xml.php', 'cms_array2csv' => PATH_PACKAGES_FS . '/pageContent/array2csv.php', 'processmanager' => PATH_PACKAGES_FS . '/scripts/backgroundScript/processmanager.php', 'backgroundscript' => PATH_PACKAGES_FS . '/scripts/backgroundScript/backgroundscript.php', 'cms_scriptsmanager' => PATH_PACKAGES_FS . '/scripts/scriptsmanager.php', 'cms_tree' => PATH_PACKAGES_FS . '/tree/tree.php', 'cms_page' => PATH_PACKAGES_FS . '/tree/page.php', 'cms_pagetemplatescatalog' => PATH_PACKAGES_FS . '/tree/pagetemplatescatalog.php', 'cms_pagetemplate' => PATH_PACKAGES_FS . '/tree/pagetemplate.php', 'cms_websitescatalog' => PATH_PACKAGES_FS . '/tree/websitescatalog.php', 'cms_website' => PATH_PACKAGES_FS . '/tree/website.php', 'cms_profile_user' => PATH_PACKAGES_FS . '/user/profileuser.php', 'cms_profile' => PATH_PACKAGES_FS . '/user/profile.php', 'cms_modulecategoriesclearances' => PATH_PACKAGES_FS . '/user/profilemodulecategoriesclearances.php', 'cms_profile_userscatalog' => PATH_PACKAGES_FS . '/user/profileuserscatalog.php', 'cms_profile_usersgroupscatalog' => PATH_PACKAGES_FS . '/user/profileusersgroupscatalog.php', 'cms_profile_usersgroup' => PATH_PACKAGES_FS . '/user/profileusersgroup.php', 'cms_session' => PATH_PACKAGES_FS . '/user/session.php', 'cms_auth' => PATH_PACKAGES_FS . '/user/auth.php', 'cms_resource' => PATH_PACKAGES_FS . '/workflow/resource.php', 'cms_resourcestatus' => PATH_PACKAGES_FS . '/workflow/resourcestatus.php', 'cms_resourcevalidationinfo' => PATH_PACKAGES_FS . '/workflow/resourcevalidationinfo.php', 'cms_resourcevalidation' => PATH_PACKAGES_FS . '/workflow/resourcevalidation.php', 'cms_resourcevalidationscatalog' => PATH_PACKAGES_FS . '/workflow/resourcevalidationscatalog.php', 'fckeditor' => PATH_MAIN_FS . '/fckeditor/fckeditor.php', 'ckeditor' => PATH_MAIN_FS . '/ckeditor/ckeditor.php', 'jsmin' => PATH_MAIN_FS . '/jsmin/jsmin.php', 'cssmin' => PATH_MAIN_FS . '/cssmin/cssmin.php', 'phpexcel' => PATH_MAIN_FS . '/phpexcel/PHPExcel.php', 'phpexcel_iofactory' => PATH_MAIN_FS . '/phpexcel/PHPExcel/IOFactory.php', 'lessc' => PATH_MAIN_FS . '/lessphp/lessc.inc.php');
}
$file = '';
if (isset($classes[strtolower($classname)])) {
$file = $classes[strtolower($classname)];
} elseif (strpos($classname, 'CMS_module_') === 0) {
//modules lazy loading
if (file_exists(PATH_MODULES_FS . '/' . substr($classname, 11) . '.php')) {
$file = PATH_MODULES_FS . '/' . substr($classname, 11) . '.php';
} else {
//here, we need to stop
return false;
}
}
if (!$file) {
//Zend Framework
if (substr(strtolower($classname), 0, 5) == 'zend_') {
chdir(PATH_MAIN_FS);
require_once PATH_MAIN_FS . '/Zend/Loader/Autoloader.php';
if (!Zend_Loader_Autoloader::autoload($classname)) {
return false;
}
/*only for stats*/
if (STATS_DEBUG) {
CMS_stats::$filesLoaded++;
}
if (STATS_DEBUG && VIEW_SQL) {
CMS_stats::$filesTable[] = array('class' => $classname, 'from' => io::getCallInfos(3));
CMS_stats::$memoryTable[] = array('class' => $classname, 'memory' => memory_get_usage(), 'peak' => memory_get_peak_usage());
}
return true;
}
//try modules Autoload
if (!isset($modules)) {
$modules = CMS_modulesCatalog::getAll("id");
}
$polymodDone = false;
foreach ($modules as $codename => $module) {
if ((!$polymodDone && $module->isPolymod() || !$module->isPolymod()) && method_exists($module, 'load')) {
if (!$polymodDone && $module->isPolymod()) {
$polymodDone = true;
}
$file = $module->load($classname);
} elseif ($polymodDone && $module->isPolymod()) {
unset($modules[$codename]);
}
if ($file) {
break;
}
}
//in case this website do not use any polymod module
if (!$polymodDone && !$file) {
require_once PATH_MODULES_FS . '/polymod.php';
$file = CMS_polymod::load($classname);
}
}
if ($file) {
require_once $file;
/*only for stats*/
if (defined('STATS_DEBUG') && defined('VIEW_SQL')) {
if (STATS_DEBUG) {
CMS_stats::$filesLoaded++;
}
if (STATS_DEBUG && VIEW_SQL) {
CMS_stats::$filesTable[] = array('file' => $file, 'class' => $classname, 'from' => io::getCallInfos(3));
CMS_stats::$memoryTable[] = array('file' => $file, 'class' => $classname, 'memory' => memory_get_usage(), 'peak' => memory_get_peak_usage());
}
}
}
}
示例10: setTagStorage
/**
* @return Zend_Cache_Backend|Zend_Cache_Backend_Interface|Zend_Cache_Backend_ExtendedInterface
*/
public function setTagStorage($tagStorage)
{
if (is_string($tagStorage)) {
$namespaces = array('', 'App_Cache_Backend_TagStorage_');
foreach ($namespaces as $ns) {
if (Zend_Loader_Autoloader::autoload($ns . $tagStorage)) {
$newtagStorage = $ns . $tagStorage;
break;
}
}
if (!$newtagStorage) {
Zend_Cache::throwException("Tag storage class not found");
}
$tagStorage = new $newtagStorage();
}
if (!$tagStorage instanceof App_Cache_Backend_TagStorage_Interface) {
Zend_Cache::throwException("Class must be implement App_Cache_Backend_TagStorage_Interface");
}
$this->_tagStorage = $tagStorage;
return $this;
}
示例11: autoload
/**
* Attempts to autoload a class by name, checking it against known class
* name prefixes for libraries (using an optional user provided path
* resolution method), or for other files using the Zend Framework naming
* conventions in one or more registered paths.
* Autoloading come preconfigured to look in the APPLICATION_PATH/models/
* (matching any class), and LIBRARY_PATH/Saf/ (matching prefix 'Saf_') paths.
* Libraries alway take precidence over other matching rules.
* The first existing match file will be included.
* If a $specialLoader is specified, only that loader is searched.
* Special loaders are only searched when specified.
* @param string $className name of class to be found/loaded
* @param string $specialLoader limits the search to a specific special loader
*
*/
public static function autoload($className, $specialLoader = '')
{
if (class_exists($className, FALSE)) {
return TRUE;
}
if (!self::$_autoloadingInstalled && class_exists('Zend_Loader_Autoloader', FALSE)) {
$zendAutoloader = Zend_Loader_Autoloader::getInstance();
$currentSetting = $zendAutoloader->suppressNotFoundWarnings();
$zendAutoloader->suppressNotFoundWarnings(TRUE);
$zendResult = Zend_Loader_Autoloader::autoload($className);
$zendAutoloader->suppressNotFoundWarnings($currentSetting);
return $zendResult;
}
if (!self::$_initialized) {
self::initializeAutoloader(FALSE);
}
if ($specialLoader) {
if (!is_array($specialLoader)) {
$specialLoader = array();
}
foreach ($specialLoader as $loader) {
if (array_key_exists($specialLoader, self::$_specialAutoloaders)) {
foreach (self::$_specialAutoloaders[$specialLoader] as $callableList) {
foreach ($callableList as $callableSet) {
if (is_array($callableSet)) {
$callableInstance = $callableSet[0];
$callableReflector = $callableSet[1];
} else {
$callableInstance = NULL;
$callableReflector = $callableSet;
}
$classFile = $callableReflector->invoke($callableInstance, $className);
if ($classFile && self::fileExistsInPath($classFile)) {
require_once $classFile;
if (!class_exists($className, FALSE)) {
throw new Exception('Failed to special autoload class' . (class_exists('Saf_Debug', FALSE) && Saf_Debug::isEnabled() ? " {$className}" : '') . '. Found class file, but no definition inside.');
}
return TRUE;
}
}
}
} else {
throw new Exception('Failed to special autoload class' . (class_exists('Saf_Debug', FALSE) && Saf_Debug::isEnabled() ? " {$className}" : '') . '. invalid loader specified.');
}
}
return FALSE;
}
foreach (self::$_libraries as $classPrefix => $callableList) {
if (strpos($className, $classPrefix) === 0) {
foreach ($callableList as $callableSet) {
if (is_array($callableSet)) {
$callableInstance = $callableSet[0];
$callableReflector = $callableSet[1];
} else {
$callableInstance = NULL;
$callableReflector = $callableSet;
}
// if (!is_object($callableReflector)) {
// print_r(array($className,$classPrefix,$callableList));
// throw new Exception('huh');
// }
$classFile = $callableReflector->invoke($callableInstance, $className);
if ($classFile && self::fileExistsInPath($classFile)) {
require_once $classFile;
if (!class_exists($className, FALSE)) {
throw new Exception('Failed to autoload class' . (class_exists('Saf_Debug', FALSE) && Saf_Debug::isEnabled() ? " {$className}" : '') . '. Found a library, but no definition inside.');
}
return TRUE;
}
}
}
}
foreach (self::$_autoloaders as $classPrefix => $pathList) {
if ('' == $classPrefix || strpos($className, $classPrefix) === 0) {
foreach ($pathList as $path) {
$classFile = self::resolveClassPath($className, $path);
if ($classFile && self::fileExistsInPath($classFile)) {
require_once $classFile;
if (!class_exists($className, FALSE)) {
throw new Exception('Failed to autoload class' . (class_exists('Saf_Debug', FALSE) && Saf_Debug::isEnabled() ? " {$className}" : '') . '. Found a file, but no definition inside.');
}
return TRUE;
}
}
}
//.........这里部分代码省略.........
示例12: __construct
/**
* @param array $data
*/
public function __construct(array $options = array())
{
$this->options = $options;
if (!Zend_Loader_Autoloader::autoload('OFC_Chart')) {
die("You must have Open Flash Chart installed in order to use this deploy. Please check this page for more information: http://code.google.com/p/zfdatagrid/wiki/Bvb_Grid_Deploy");
}
parent::__construct($options);
}
示例13: die
*/
/**
* This is the base libarary of functions for running each example from the
* command line.
* handles command line options, and interactive choices, and then
* runs the main loop for the chosen example cluster: group, user, institution
*/
// must be run from the command line
if (isset($_SERVER['REMOTE_ADDR']) || isset($_SERVER['GATEWAY_INTERFACE'])) {
die('Direct access to this script is forbidden.');
}
$path = realpath('../../libs/zend');
set_include_path($path . PATH_SEPARATOR . get_include_path());
include "Console/Getopt.php";
include 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::autoload('Zend_Loader');
// disable the WSDL cache
ini_set("soap.wsdl_cache_enabled", "0");
// get the WSSE SOAP client class
require_once 'wsse_soap_client.php';
/**
* command line help text
*/
function help_text()
{
return "\n Options are:\n --username - Web Services simple authentication username\n --password - Web Services simple authentication password\n --bausername - basic authentication username to get past basic auth\n --bapassword - basic authentication password to get past basic auth\n --servicegroup - service group as specified in webservice configuration that contains the necessary functions to call\n --url - the URL of the Web Service to call eg: http://your.mahara.local.net/webservice/soap/server.php\n ";
}
//fetch arguments
$args = Console_Getopt::readPHPArgv();
//checking errors for argument fetching
if (PEAR::isError($args)) {
示例14: translate
public static function translate($term, &$config = array(), $depth = 0)
{
$zendAutoloader = Zend_Loader_Autoloader::getInstance();
$currentZendAutoloaderSetting = $zendAutoloader->suppressNotFoundWarnings();
$zendAutoloader->suppressNotFoundWarnings(TRUE);
if ($depth > self::MAX_DEREF_DEPTH) {
throw new Exepction('Model Reflection error: translated too deeply.');
}
$myMute = Saf_Debug::mute();
if (!array_key_exists('_lateBindingParams', $config)) {
$config['_lateBindingParams'] = array();
}
$model = array();
$modelIsIterable = FALSE;
$allowsNonString = array_key_exists('allowNonStrings', $config) && $config['allowNonStrings'];
$termIsIterable = !array_key_exists('termIterable', $config) || $config['termIterable'];
$term = trim($term);
if (strpos($term, '*') === 0) {
$term = substr($term, 1);
//#TODO #2.0.0 if not unique, pull from cache
}
if ($termIsIterable && strpos($term, ';') !== FALSE) {
$terms = explode(';', $term);
} else {
$terms = array($term);
}
try {
foreach ($terms as $currentTerm) {
$conditional = FALSE;
if (strpos($currentTerm, '?') === 0) {
$conditional = TRUE;
$currentTerm = trim(substr($currentTerm, 1));
}
$currentTerm = trim(self::_translateVariables($currentTerm, $conditional, $config));
if (strpos($currentTerm, '=') !== FALSE) {
$tagParts = explode('=', $currentTerm, 2);
$model[] = self::_translateTag(trim($tagParts[0]), trim($tagParts[1]), $conditional, $config, $depth + 1);
} else {
if (self::_validClassName($currentTerm)) {
//#TODO #2.0.0 branch this out so it is framework agnostic
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->suppressNotFoundWarnings(TRUE);
try {
if (Zend_Loader_Autoloader::autoload($currentTerm)) {
$modelObject = new $currentTerm();
$model[] = $modelObject;
} else {
//#TODO #1.1.0
$model[] = $currentTerm;
}
} catch (Exception $e) {
$model[] = $currentTerm;
}
$autoloader->suppressNotFoundWarnings(FALSE);
} else {
$nextComment = strpos($currentTerm, '<!--');
$nextObjectRef = strpos($currentTerm, '->');
while ($nextComment !== FALSE && $nextObjectRef !== FALSE && $nextComment < $nextObjectRef) {
$nextComment = strpos($currentTerm, '<!--', $nextObjectRef + 1);
$nextObjectRef = strpos($currentTerm, '->', $nextObjectRef + 1);
}
$nextClassRef = strpos($currentTerm, '::');
//#TODO #2.0.0 simplify this logic since it can only be the first in the stack.
if ($nextObjectRef !== FALSE && ($nextClassRef === FALSE || $nextObjectRef < $nextClassRef)) {
$termObject = substr($currentTerm, 0, strpos($currentTerm, '->'));
$termRest = substr($currentTerm, strpos($currentTerm, '->') + 2);
$model[] = self::_translateObject($termObject, $termRest, $conditional, $config, $depth + 1);
} else {
if ($nextClassRef !== FALSE) {
$termClass = substr($currentTerm, 0, strpos($currentTerm, '::'));
$termRest = substr($currentTerm, strpos($currentTerm, '::') + 2);
$model[] = self::_translateClass($termClass, $termRest, $conditional, $config, $depth + 1);
//call_user_func(array($termParts[0],$termParts[1]));
} else {
$model[] = $currentTerm;
}
}
}
}
}
} catch (Exception $e) {
Saf_Debug::unmute($myMute);
throw $e;
}
Saf_Debug::unmute($myMute);
$zendAutoloader->suppressNotFoundWarnings($currentZendAutoloaderSetting);
return $allowsNonString ? $modelIsIterable ? $model : $model[0] : implode('', $model);
}
示例15: testClosuresRegisteredWithAutoloaderShouldBeUtilized
/**
* @group ZF-10024
*/
public function testClosuresRegisteredWithAutoloaderShouldBeUtilized()
{
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
$this->markTestSkipped(__METHOD__ . ' requires PHP version 5.3.0 or greater');
}
$closure = (require_once dirname(__FILE__) . '/_files/AutoloaderClosure.php');
$this->autoloader->pushAutoloader($closure);
$this->assertTrue(Zend_Loader_Autoloader::autoload('AutoloaderTest_AutoloaderClosure'));
}