本文整理汇总了PHP中Autoload类的典型用法代码示例。如果您正苦于以下问题:PHP Autoload类的具体用法?PHP Autoload怎么用?PHP Autoload使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Autoload类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cmdRepo
function cmdRepo()
{
$file = new File('/home/billy/1.tar.bz2', true);
$target = new Dir('/home/billy/temp/1.unpack/includes', true);
//Packer::unpack($file, $target);
Packer::pack($target, new File(dirname(__FILE__) . '/2.tbz', true));
return;
$pm = new PM();
$pm->startup();
$rb = PM::getRollback();
$rb->push('delete', dirname(__FILE__) . '/_files/source', dirname(__FILE__) . '/_files/target/includes/Controller.php');
//$rb->push('delete', './_files/source', '_files/target/includes/Controller.php' );
//$r = $rb->pop();
$r = $rb->stepBack();
print_r($r);
return;
$ps = PM::getPackageSequence();
print_r($ps->get());
print_r($ps->getAfter('news', '2.3'));
//print_pre($ps->addPackage('news', '2.8'));
print_pre($ps->removePackage('news', '2.8'));
return;
Autoload::addDir(Dir::get($this->root, true)->getDir('repo'));
$rl = new RepositoryList($this->dataDir->getFile('source.list'));
$r = $rl->search(explode(' ', 'qt package'));
print_pre($r);
$pm->shutdown();
}
示例2: _setAutoload
/**
* 自动载入函数
*/
private function _setAutoload()
{
//自动载入函数
require_once dirname(__FILE__) . '/../LaneSmartFW/Autoload.php';
$autoload = new Autoload();
$autoload->register();
}
示例3: init
public function init()
{
require_once __DIR__ . '/class.autoload.php';
// 1. ИНИЦИАЛИЗАЦИЯ КЛАССА АВТОЗАГРУЗКИ
$loaddata = array('prefix' => 'class.');
$autoload = new Autoload($loaddata);
$autoload->add(FRAMEWORK_ROOT_FOLDER);
$autoload->add(PROJECT_ROOT_DIRECTORY);
$autoload->register();
// 2. ОСУЩЕСТВЛЕНИЕ ПОДКЛЮЧЕНИЯ К БАЗЕ ДАННЫХ
self::$instance->connection = new \framework\database\mySqlConnect('localhost', 'root', '', 'craiglist');
// 3. ЗАГРУЗКА ШАБЛОНА ПРОЕКТИРОВАНИЯ MVC
$controller = new \framework\mvc\FrontController(PROJECT_ROOT_DIRECTORY);
$controller->run();
}
示例4: install
public function install()
{
if (!defined('_IS_AGILE_DEV_') && !empty(self::$_newfiles) && !Tools::getValue("redirected")) {
$adminfolder = AgileInstaller::detect_admin_folder($_SERVER['SCRIPT_FILENAME']);
AgileInstaller::install_newfiles(self::$_newfiles, $this->name, $adminfolder, 2);
$result = AgileInstaller::install_health_check(self::$_newfiles, $this->name, $adminfolder);
if (!empty($result)) {
$this->_errors[] = '<a target="agile" style="text-decoration:underline;color:blue;" href="http://addons-modules.com/store/en/content/36-agile-module-installation-tips">' . $this->getL('Failed to update files due to permission issue, please visit here for more instructions.') . '</a>';
return false;
}
Tools::redirectAdmin("./index.php?controller=AdminModules&token=" . Tools::getValue("token") . "&install=" . $this->name . "&tab_module=" . $this->tab . " &module_name=" . $this->name . "&anchor=anchor" . $this->name . "&redirected=1");
}
$reterrs = AgileInstaller::CanModuleOverride($this->name);
if (!empty($reterrs)) {
$this->_errors = array_merge($this->_errors, $reterrs);
return false;
}
$reterrs = AgileInstaller::version_depencies($this->version_dependencies);
if (!empty($reterrs)) {
$this->_errors = array_merge($this->_errors, $reterrs);
return false;
}
if (!AgileInstaller::sql_install(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE)) {
return false;
}
if (!parent::install() or !Configuration::updateValue('AGILE_PAYPAL_BUSINESS', 'paypal@prestashop.com') or !Configuration::updateValue('AGILE_PAYPAL_SANDBOX', 1) or !Configuration::updateValue('AGILE_PAYPAL_FORCE_SUMMARY', '1') or !Configuration::updateValue('AGILE_PAYPAL_HIDE_COUNTRY', 0) or !Configuration::updateValue('AGILE_PAYPAL_HIDE_CARRIER', 0) or !Configuration::updateValue('AGILE_PAYPAL_HIDE_TERMS', 0) or !Configuration::updateValue('AGILE_PAYPAL_HEADER', '') or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_PAYMENT', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_DAILY', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_WEEKLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_MONTHLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_YEARLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_SUPPORT_SELLERS', 0) or !Configuration::updateValue('AGILE_PAYPAL_BUSINESS2', '') or !Configuration::updateValue('AGILE_PAYPAL_MICRO_AMOUNT', 0) or !Configuration::updateValue('AGILE_PAYPAL_EXPRESS_ENABLED', 1) or !Configuration::updateValue('AGILE_PAYPAL_AM_INTEGRATED', 0) or !Configuration::updateValue('AGILE_PAYPAL_AM_SHOW_CHOICE', 0) or !Configuration::updateValue('AGILE_PAYPAL_AM_NO_MIX_PRODUCT', 0) or !Configuration::updateValue('AGILE_PAYPAL_SUBSCRIBE_ONLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_CURRENCY', Configuration::get('PS_CURRENCY_DEFAULT')) or !$this->registerHook('agileexpresscheckout') or !$this->registerHook('displayShoppingCartFooter') or !$this->registerHook('displayProductButtons') or !$this->registerHook('displayPayment') or !$this->registerHook('displayPaymentReturn') or !$this->registerHook('displayFooter')) {
return false;
}
if (version_compare(_PS_VERSION_, '1.5', '>=')) {
Autoload::getInstance()->generateIndex();
}
return true;
}
示例5: toss
static function toss($message = null, $type = 'Exception', $code = 0, $previous = null)
{
if (!Autoload::loaded($type)) {
eval('class ' . $type . ' extends Exception{}');
}
throw new $type($message, $code, $previous);
}
示例6: init
/**
* Get an instance of Autoload.
*
* @return self
*/
public static final function init() : self
{
if (self::$instance == null) {
self::$instance = new self();
}
return self::$instance;
}
示例7: loadController
private static final function loadController()
{
$view = \View\ViewBundle::getInstance();
//$view -> setTemplate( KIT_VIEW_TEMPLATE );
////\View\ViewBundle::getInstance() -> setVar( 'path', self::$_path );
self::prepareController();
$space = 'App\\Controllers\\' . self::$_controller . 'Controller';
$e404 = ['controller' => self::$_controller, 'action' => self::$_action];
if (!\Autoload::nameSpaceExists($space)) {
return $view->e404($e404);
}
$cont = new $space();
$cont->setTpl(self::$_controller . '/' . self::$_action);
$act_method = "action" . self::$_action;
/**
* Проверка существования метода экшена и выполнение его, или стандартного
* метода 404 ошибки.
*/
if (method_exists($cont, $act_method)) {
$cont->{$act_method}(self::$_furl);
$cont->exir();
} else {
$view->e404($e404);
}
}
示例8: instance
/**
* Get the instane of Autoload
*
* @access public
* @static
* @return Autoload
*/
public static function instance()
{
if (!self::$instance) {
self::$instance = new Autoload();
}
return self::$instance;
}
示例9: get_modules
protected function get_modules(Query $query) {
$url = $query->url();
array_shift($url);
$url = array_filter($url);
if (empty($url)) {
return array();
}
$last = array_pop($url);
$last = preg_replace_callback('/_([a-z])/', function($res){
return strtoupper($res[1]);
}, $last);
$url[] = $last;
$class = implode('', array_map('ucfirst', $url));
$class = \Autoload::getDefaultNamespace() . '\Module\Ajax' . $class;
if (!class_exists($class)) {
if ($query->get('format') == 'json') {
return new AjaxJsonError($query);
} else {
return new AjaxError($query);
}
}
return new $class($query);
}
示例10: getInstance
/**
*
* @return Autoload
*/
public static function getInstance()
{
if (self::$instance === false) {
self::$instance = new Autoload();
}
return self::$instance;
}
示例11: initAutoload
private function initAutoload()
{
if ($this->preferencesList->useRapidAuthorizationAutoload) {
Autoload::instance()->init();
}
return;
}
示例12: __autoload
function __autoload($className)
{
$classes = Autoload::getClasses();
if ($classes[$className] && file_exists($classes[$className])) {
require_once $classes[$className];
}
}
示例13: inst
/**
* Метод возвращает экземпляр класса-хранилища маппингов.
* Может быть переопределён в config.ini
*/
private static final function inst()
{
if (isset(self::$inst)) {
return self::$inst;
//----
}
/*
* Получим название класса
*/
$class = ConfigIni::mappingStorage();
/*
* Класс совпадает с базовым?
*/
if (__CLASS__ == $class) {
return self::$inst = new MappingStorage();
}
/*
* Нам передан класс, который отличается от SDK
*/
$classPath = Autoload::inst()->getClassPath($class);
if (!PsCheck::isNotEmptyString($classPath)) {
return PsUtil::raise('Не удалось найти класс хранилища маппингов [{}]', $class);
}
/*
* Указанный класс должен быть наследником данного
*/
if (!PsUtil::isInstanceOf($class, __CLASS__)) {
return PsUtil::raise('Указанное хранилище маппингов [{}] не является наследником класса [{}]', $class, __CLASS__);
}
return self::$inst = new $class();
}
示例14: StartCurator
/**
* Preps the application for running, then runs it. If this function is called more than once, an E_USER_ERROR is triggered.
*
* @param string $root_dir The path to the root of the installation.
* @return void
*/
function StartCurator()
{
static $did_start = false;
// set up the exit status.
$exit_status = 0;
// make sure this is only run once.
if ($did_start === false) {
$autoload = Autoload::singleton();
// configure the autoloader.
try {
$autoload->setBaseDir(CURATOR_APP_DIR);
$autoload->register();
} catch (\Exception $e) {
Console::stderr('** Could not register the autoloader:');
Console::stderr(' ' . $e->getMessage());
die;
}
// once the autoloader is in place, we are started up.
$did_start = true;
try {
$app = new Application();
$exit_status = $app->run();
} catch (\Exception $e) {
Console::stderr('** Could not run the application:');
Console::stderr(' ' . $e->getMessage());
die;
}
} else {
// if we are called again, bail.
trigger_error('StartCurator called after already being called.', E_USER_ERROR);
}
// send the status back.
return $exit_status;
}
示例15: getInstance
/**
* Get instance of autoload (singleton)
*
* @return Autoload
*/
public static function getInstance()
{
if (!Autoload::$instance) {
Autoload::$instance = new Autoload();
}
return Autoload::$instance;
}