@author Eduardo B Romero
Beispiel #1
1
 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();
 }
Beispiel #2
0
 /**
  * 自动载入函数
  */
 private function _setAutoload()
 {
     //自动载入函数
     require_once dirname(__FILE__) . '/../LaneSmartFW/Autoload.php';
     $autoload = new Autoload();
     $autoload->register();
 }
Beispiel #3
0
 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();
 }
Beispiel #4
0
 public static function getInstance()
 {
     if (self::$instance == NULL) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 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', '*****@*****.**') 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;
 }
Beispiel #6
0
 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);
 }
Beispiel #7
0
 /**
  * Get an instance of Autoload.
  *
  * @return self
  */
 public static final function init() : self
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Beispiel #8
0
 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);
     }
 }
Beispiel #9
0
 /**
  * Get the instane of Autoload
  *
  * @access public
  * @static
  * @return Autoload
  */
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new Autoload();
     }
     return self::$instance;
 }
Beispiel #10
0
	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);
	}
 /**
  * 
  * @return Autoload
  */
 public static function getInstance()
 {
     if (self::$instance === false) {
         self::$instance = new Autoload();
     }
     return self::$instance;
 }
 private function initAutoload()
 {
     if ($this->preferencesList->useRapidAuthorizationAutoload) {
         Autoload::instance()->init();
     }
     return;
 }
Beispiel #13
0
function __autoload($className)
{
    $classes = Autoload::getClasses();
    if ($classes[$className] && file_exists($classes[$className])) {
        require_once $classes[$className];
    }
}
Beispiel #14
0
 /**
  * Метод возвращает экземпляр класса-хранилища маппингов.
  * Может быть переопределён в 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();
 }
Beispiel #15
0
 /**
  * Returns the instance of this class. If not exists, create it.
  * @return instance
  */
 public static function getInstance()
 {
     if (self::$m_Instance === null) {
         self::$m_Instance = new static();
     }
     return self::$m_Instance;
 }
Beispiel #16
0
/**
 * 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;
}
Beispiel #17
0
 /**
  * Get instance of autoload (singleton)
  *
  * @return Autoload
  */
 public static function getInstance()
 {
     if (!Autoload::$instance) {
         Autoload::$instance = new Autoload();
     }
     return Autoload::$instance;
 }
function upgrade_module_1_2_0($eu_legal)
{
    $result = true;
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/cashondelivery.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/cashondelivery.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/gc_ganalytics.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/gc_ganalytics.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/moneybookers.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/moneybookers.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/paypal.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/paypal.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/sofortbanking.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/sofortbanking.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/trustedshops.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/trustedshops.zip');
    }
    Autoload::getInstance()->generateIndex();
    $result &= $eu_legal->deleteOverrides('CMSController');
    Autoload::getInstance()->generateIndex();
    return (bool) $result;
}
Beispiel #19
0
 public static function getInstance()
 {
     if (self::$instance == null) {
         $class = __CLASS__;
         self::$instance = new $class();
     }
     return self::$instance;
 }
Beispiel #20
0
 public static function suite()
 {
     Autoload::registerNamespaced();
     $suite = new PHPUnit_Framework_TestSuite('aStyler');
     $suite->addTest(tests_aStyler_Parser_SGML_AllTests::suite());
     $suite->addTest(tests_aStyler_Lexer_SGML_AllTests::suite());
     return $suite;
 }
Beispiel #21
0
	public function __construct($spaces, $external)
	{
		self::$spaces = (array) $spaces;
		$this->external = (string) $external;

		spl_autoload_register(array($this, 'find'), false);
		spl_autoload_register(array($this, 'external'), false);
	}
Beispiel #22
0
 static function init()
 {
     $processor = Config::getInstance()->language->processor;
     $classname = nameToClass($processor) . 'LanguageProcessor';
     Autoload::addVendor('language', $processor);
     self::$processor = new $classname();
     self::$processor->init();
 }
 public static function initialize()
 {
     if (self::$initialized) {
         return;
     }
     self::$paths = array();
     self::$initialized = true;
 }
Beispiel #24
0
 public static function shutDown()
 {
     if (null !== self::$_instance) {
         if (!spl_autoload_unregister(array(self::$_instance, '_autoload'))) {
             throw new RuntimeException('Could not stop the autoload');
         }
         self::$_instance = null;
     }
 }
Beispiel #25
0
 public static function shutDown()
 {
     if (null !== self::$m_instance) {
         if (slp_autoload_unregister(array(self::$m_instance, '_autoload'))) {
             throw new Exception("Impossible d'arrêter l'autoload : " . __CLASS__);
         }
         self::$m_instance = null;
     }
 }
Beispiel #26
0
 public static function init($directories)
 {
     self::$directories = (array) $directories;
     self::init_cache();
     spl_autoload_register("Autoload::cache", false);
     spl_autoload_register("Autoload::normal", false);
     spl_autoload_register("Autoload::wrapper", false);
     register_shutdown_function("Autoload::write_cache");
 }
Beispiel #27
0
 public static function shutDown()
 {
     if (null !== self::$_instance) {
         if (!spl_autoload_unregister(array(self::$_instance), '_autoload')) {
             throw new RuntimeException('autoload can\'t be disabled');
         }
         self::$_instance = null;
     }
 }
Beispiel #28
0
 private static function loadLibs()
 {
     if (is_file('config/libs' . PHP)) {
         self::$libs = unserialize(include $root . '/config/libs' . PHP);
     } else {
         self::$libsInfo = self::getlibsInfo();
         self::$libs = Ftp::getFilesFromYaml(self::$libsInfo);
     }
 }
Beispiel #29
0
 /**
  * Load config file, setup autoload paths
  *
  * @param string $file
  * @return void
  */
 public static function init($file)
 {
     if (is_readable(DOCUMENT_ROOT . '/' . $file)) {
         self::$paths = (require $file);
         spl_autoload_register(array('Autoload', 'load'));
     } else {
         exit("fail setup autoloding paths");
     }
 }
Beispiel #30
0
 /**
  * @covers AutoloadDir::isRebuilded
  */
 public function testIsRebuilded()
 {
     //Запросим путь к тестовому классу, чтобы он уже наверняка был найден на момент запроса.
     $this->assertNotNull(Autoload::inst()->getClassPath(ClassA::get__CLASS__()));
     //Мы должны найти нагш класс без перезагрузки, так как уже нашли его ранее
     $cpDir = new AutoloadDir(DirItem::inst(Autoload::DIR_TESTS));
     $this->assertNotNull($cpDir->getClassPath(ClassA::get__CLASS__()));
     $this->assertFalse($cpDir->isRebuilded());
 }