/** * Singleton Constructor */ private function __construct() { // Registro em Autocarregamento spl_autoload_register(array($this, 'load')); // ConfiguraĆ§Ć£o de Mapeamento $this->setMapper('Pokeflute', dirname(__FILE__))->setMapper('Model', APPLICATION_PATH . '/models'); }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit8bddd7593313484360a580a54c3a88ed', 'loadClassLoader'), true, false); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit8bddd7593313484360a580a54c3a88ed', 'loadClassLoader')); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(false); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $fileIdentifier => $file) { composerRequire8bddd7593313484360a580a54c3a88ed($fileIdentifier, $file); } return $loader; }
public function init() { if (isset($_GET[$this->grid_mode_var])) { $this->grid_mode = $_GET[$this->grid_mode_var]; } if (isset($_GET['exportType'])) { $this->exportType = $_GET['exportType']; } $lib = Yii::getPathOfAlias($this->libPath) . '.php'; if ($this->grid_mode == 'export' and !file_exists($lib)) { $this->grid_mode = 'grid'; Yii::log("PHP Excel lib not found({$lib}). Export disabled !", CLogger::LEVEL_WARNING, 'EExcelview'); } if ($this->grid_mode == 'export') { $this->title = $this->title ? $this->title : Yii::app()->getController()->getPageTitle(); $this->initColumns(); //parent::init(); //Autoload fix spl_autoload_unregister(array('YiiBase', 'autoload')); Yii::import($this->libPath, true); $this->objPHPExcel = new PHPExcel(); spl_autoload_register(array('YiiBase', 'autoload')); // Creating a workbook $this->objPHPExcel->getProperties()->setCreator($this->creator); $this->objPHPExcel->getProperties()->setTitle($this->title); $this->objPHPExcel->getProperties()->setSubject($this->subject); $this->objPHPExcel->getProperties()->setDescription($this->description); $this->objPHPExcel->getProperties()->setCategory($this->category); } else { parent::init(); } }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInitd530de204ef18056db76679ad2b19aa5', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitd530de204ef18056db76679ad2b19aa5', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitd530de204ef18056db76679ad2b19aa5::getInitializer($loader)); } else { $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } } $loader->register(true); return $loader; }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInitb0fe19ac4b81c9fa352d55fd4403522a', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitb0fe19ac4b81c9fa352d55fd4403522a', 'loadClassLoader')); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $fileIdentifier => $file) { composerRequireb0fe19ac4b81c9fa352d55fd4403522a($fileIdentifier, $file); } return $loader; }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit7374dd036509d2ffae2282c2a10a41ce', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit7374dd036509d2ffae2282c2a10a41ce', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); return $loader; }
/** * [__construct description] */ function __construct() { if (!defined("WOABSPATH")) { define("WOABSPATH", dirname(__FILE__)); } if (!defined("WOURI")) { define("WOURI", plugins_url("/", __FILE__)); } if (function_exists("__autoload")) { spl_autoload_register("__autoload"); } spl_autoload_register(array($this, 'autoload')); /** * Custom auth hook * This MUST run before anything just to be safe. 20 seems to be the highest so we will stay close with * priority set to 21 * * @since 3.1.3 */ add_filter('determine_current_user', array($this, '_wo_authenicate_bypass'), 10); /** * load all dependents * * @since 1.0.0 */ add_action("init", array(__CLASS__, "includes")); }
public function __construct($config = array()) { define('CP_VER', '2.0.2012.1203'); //ę”ę¶ēę¬å·,åäø¤ę®µč”Øē¤ŗååøę„ę define('CP_CORE_PATH', dirname(__FILE__)); //å½åę件ęåØēē®å½ require CP_CORE_PATH . '/cpConfig.class.php'; //å č½½é»č®¤é ē½® $this->appConfig = array_merge(cpConfig::get('APP'), $config); //åę°é ē½® cpConfig::set('APP', $this->appConfig); defined('DEBUG') or define('DEBUG', cpConfig::get('DEBUG')); date_default_timezone_set(cpConfig::get('TIMEZONE')); if ($this->appConfig['DEBUG']) { ini_set("display_errors", 1); error_reporting(E_ALL ^ E_NOTICE); //é¤äŗnoticeęē¤ŗļ¼å ¶ä»ē±»åēéčÆÆé½ę„å } else { ini_set("display_errors", 0); error_reporting(0); //ęéčÆÆę„åļ¼å ØéØå±č½ } spl_autoload_register(array($this, 'autoload')); //ę³Øåē±»ēčŖåØå č½½ //å č½½åøøēØå½ę°åŗ if (is_file(CP_CORE_PATH . '/../lib/common.function.php')) { require CP_CORE_PATH . '/../lib/common.function.php'; } //å č½½ę©å±å½ę°åŗ if (is_file(CP_CORE_PATH . '/../ext/extend.php')) { require CP_CORE_PATH . '/../ext/extend.php'; } }
public function __construct($pasta) { $this->pasta = $pasta; $this->proximaPasta = $pasta; $this->pasta .= "admin/class/config"; spl_autoload_register(array($this, 'loader')); }
public function __construct() { // manages plugin activation and deactivation register_activation_hook(__FILE__, array(&$this, 'activate')); register_deactivation_hook(__FILE__, array(&$this, 'deactivate')); // stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules) if (isset($_GET['action'], $_GET['plugin']) && 'deactivate' == $_GET['action'] && plugin_basename(__FILE__) == $_GET['plugin']) { return; } // loads the admin side of Polylang for the dashboard if (defined('DOING_AJAX') && DOING_AJAX && isset($_REQUEST['action']) && 'lingotek_language' == $_REQUEST['action']) { define('PLL_AJAX_ON_FRONT', false); add_filter('pll_model', create_function('$c', 'return "PLL_Admin_Model";')); } spl_autoload_register(array(&$this, 'autoload')); // autoload classes // init add_filter('pll_model', array(&$this, 'pll_model')); add_action('init', array(&$this, 'init')); add_action('admin_init', array(&$this, 'admin_init')); // add Lingotek locale to languages add_filter('pll_languages_list', array(&$this, 'pre_set_languages_list')); // flag title add_filter('pll_flag_title', array(&$this, 'pll_flag_title'), 10, 3); // adds a pointer upon plugin activation to draw attention to Lingotek if (!get_option('lingotek_token')) { add_action('init', array(&$this, 'lingotek_activation_pointer')); } // adds extra plugin compatibility - borrowed from Polylang if (!defined('LINGOTEK_PLUGINS_COMPAT') || LINGOTEK_PLUGINS_COMPAT) { Lingotek_Plugins_Compat::instance(); } }
public static function bootstrap($dispatch = true) { spl_autoload_register(array('Core', 'autoload')); if ($dispatch) { register_shutdown_function(array('Core', 'shutdown')); } }
public function actionErrorDispositionNotification() { spl_autoload_unregister(array('YiiBase', 'autoload')); require_once Yii::getPathOfAlias('ext') . "/yandex-money-payout/lib/autoload.php"; spl_autoload_register(array('YiiBase', 'autoload')); $settings = new \YandexMoney\Settings(); $settings->host = Yii::app()->params['yandexPayout']['host']; $settings->cert = Yii::app()->params['yandexPayout']['cert']; $settings->certPassword = Yii::app()->params['yandexPayout']['certPassword']; $settings->privateKey = Yii::app()->params['yandexPayout']['privateKey']; $settings->yaCert = Yii::app()->params['yandexPayout']['yaCert']; $provider = new PKCS7RequestProvider($settings); $api = new PayoutAPI($provider, Yii::app()->params['yandexPayout']['cardSynonimUrl']); $api->errorDepositionNotification(function ($request) { $result = new \YandexMoney\ErrorDepositionParams($request['clientOrderId']); $deposition = PayoutDeposition::model()->findByAttributes(array('clientOrderId' => $request['clientOrderId'])); if ($deposition) { $deposition->status = PayoutDeposition::STATUS_REJECTED; $deposition->errors = $request['error']; $deposition->save(); /** * @var PayoutTask $task */ $task = $deposition->payoutTask; $task->status = PayoutTask::STATUS_FAILED; $task->save(); } return $result; }); }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInitc1979ea69b1d8f4059205f2b1ddf2ab9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitc1979ea69b1d8f4059205f2b1ddf2ab9', 'loadClassLoader')); $includePaths = (require __DIR__ . '/include_paths.php'); array_push($includePaths, get_include_path()); set_include_path(join(PATH_SEPARATOR, $includePaths)); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitc1979ea69b1d8f4059205f2b1ddf2ab9::getInitializer($loader)); } else { $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } } $loader->register(true); return $loader; }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInite83a560ad34fa935b49ba11f5b6a4f3e', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInite83a560ad34fa935b49ba11f5b6a4f3e', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $file) { require $file; } return $loader; }
/** * Configures the environment for testing * * Does the following: * * * Loads the phpunit framework (for the web ui) * * Restores exception phpunit error handlers (for cli) * * registeres an autoloader to load test files */ public static function configure_environment($do_whitelist = TRUE, $do_blacklist = TRUE) { // During a webui request we need to manually load PHPUnit if (!class_exists('PHPUnit_Util_Filter', FALSE) and !function_exists('phpunit_autoload')) { try { include_once 'PHPUnit/Autoload.php'; } catch (ErrorException $e) { include_once 'PHPUnit/Framework.php'; } } // Allow PHPUnit to handle exceptions and errors if (Kohana::$is_cli) { restore_exception_handler(); restore_error_handler(); } spl_autoload_register(array('Kohana_Tests', 'autoload')); Kohana_Tests::$cache = ($cache = Kohana::cache('unittest_whitelist_cache')) === NULL ? array() : $cache; // As of PHPUnit v3.5 there are slight differences in the way files are black|whitelisted self::$phpunit_v35 = function_exists('phpunit_autoload'); $config = Kohana::config('unittest'); if ($do_whitelist and $config->use_whitelist) { self::whitelist(); } if ($do_blacklist and count($config['blacklist'])) { Kohana_Tests::blacklist($config->blacklist); } }
public function init() { if (!is_object($this->storeHandle)) { $this->storeHandle = new LtStoreMemory(); $this->fileStore = new LtStoreFile(); $this->fileStore->prefix = 'LtAutoloader-token-cache'; $this->fileStore->useSerialize = true; $this->fileStore->init(); } // Whether scanning directory if (0 == $this->storeHandle->get(".class_total") && 0 == $this->storeHandle->get(".function_total")) { $this->storeHandle->add(".class_total", 0); $this->storeHandle->add(".function_total", 0); $this->storeHandle->add(".functions", array(), 0); $autoloadPath = $this->preparePath($this->autoloadPath); foreach ($autoloadPath as $key => $path) { if (is_file($path)) { $this->addFileMap($path); unset($autoloadPath[$key]); } } $this->scanDirs($autoloadPath); unset($autoloadPath); } // Whether loading function files if ($this->conf["load_function"]) { $this->loadFunction(); } spl_autoload_register(array($this, "loadClass")); }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit0ff06a20d13931ad3d71bf10770c91f3', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit0ff06a20d13931ad3d71bf10770c91f3', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); $includePaths = (require __DIR__ . '/include_paths.php'); array_push($includePaths, get_include_path()); set_include_path(join(PATH_SEPARATOR, $includePaths)); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $file) { composerRequire0ff06a20d13931ad3d71bf10770c91f3($file); } return $loader; }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit205c915b9c7d3e718e7c95793ee67ffe', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit205c915b9c7d3e718e7c95793ee67ffe', 'loadClassLoader')); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $fileIdentifier => $file) { composerRequire0efb534ee20646bcb987f4359c38b3aa($fileIdentifier, $file); } return $loader; }
public static function register() { ini_set('unserialize_callback_func', 'spl_autoload_call'); if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) { throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance()))); } }
/** * constructor * * @since 0.1 */ public function __construct() { require_once PLL_INC . '/functions-wpcom-vip.php'; // VIP functions spl_autoload_register(array($this, 'autoload')); // autoload classes $install = new PLL_Install(POLYLANG_BASENAME); // stopping here if we are going to deactivate the plugin ( avoids breaking rewrite rules ) if ($install->is_deactivation()) { return; } // plugin initialization // take no action before all plugins are loaded add_action('plugins_loaded', array($this, 'init'), 1); // override load text domain waiting for the language to be defined // here for plugins which load text domain as soon as loaded :( if (!defined('PLL_OLT') || PLL_OLT) { PLL_OLT_Manager::instance(); } // extra code for compatibility with some plugins // loaded as soon as possible as we may need to act before other plugins are loaded if (!defined('PLL_PLUGINS_COMPAT') || PLL_PLUGINS_COMPAT) { PLL_Plugins_Compat::instance(); } }
protected function setUp() { $this->errorReporting = error_reporting(E_ALL); $this->loader = new ClassLoader(); spl_autoload_register(array($this->loader, 'loadClass'), true, true); DebugClassLoader::enable(); }
public static function init() { self::$lib_dir = realpath(__DIR__) . '/'; self::$bin_dir = realpath(__DIR__ . '/..') . '/'; self::$settings_dir = realpath(__DIR__ . '/../settings') . '/'; spl_autoload_register(__NAMESPACE__ . 'Config::autoload'); }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit46390df264f3e25339b844dea17d85e4', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit46390df264f3e25339b844dea17d85e4', 'loadClassLoader')); $includePaths = (require __DIR__ . '/include_paths.php'); array_push($includePaths, get_include_path()); set_include_path(join(PATH_SEPARATOR, $includePaths)); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $file) { composerRequire46390df264f3e25339b844dea17d85e4($file); } return $loader; }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit6fd8abf7952573012db12808cb1ee2a2', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit6fd8abf7952573012db12808cb1ee2a2', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $file) { composerRequire6fd8abf7952573012db12808cb1ee2a2($file); } return $loader; }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit088888535954cdb1cbf3de2d9ff38134', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit088888535954cdb1cbf3de2d9ff38134', 'loadClassLoader')); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $file) { composerRequire088888535954cdb1cbf3de2d9ff38134($file); } return $loader; }
public static function start() { spl_autoload_register('App::autoload'); self::dispatcher(); self::run('Util\\' . UTIL, ACTION); // \Util\Post::postfile(); }
public function __construct() { // FIXME maybe not available on every installations but widely used by WP plugins spl_autoload_register(array(&$this, 'autoload')); // autoload classes $install = new PLL_Install(POLYLANG_BASENAME); // stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules) if ($install->is_deactivation()) { return; } // plugin initialization // take no action before all plugins are loaded add_action('plugins_loaded', array(&$this, 'init'), 1); // override load text domain waiting for the language to be defined // here for plugins which load text domain as soon as loaded :( if (!defined('PLL_OLT') || PLL_OLT) { PLL_OLT_Manager::instance(); } // loads the API require_once PLL_INC . '/api.php'; // WPML API if (!defined('PLL_WPML_COMPAT') || PLL_WPML_COMPAT) { PLL_WPML_Compat::instance(); } // extra code for compatibility with some plugins if (!defined('PLL_PLUGINS_COMPAT') || PLL_PLUGINS_COMPAT) { PLL_Plugins_Compat::instance(); } }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit1eb5cffb2cab52b785cc53528b1e13a2', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit1eb5cffb2cab52b785cc53528b1e13a2', 'loadClassLoader')); $includePaths = (require __DIR__ . '/include_paths.php'); array_push($includePaths, get_include_path()); set_include_path(join(PATH_SEPARATOR, $includePaths)); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); return $loader; }
public function __construct(modX &$modx, array $config = array()) { $this->modx =& $modx; $basePath = $this->modx->getOption('moneybird.core_path', $config, $this->modx->getOption('core_path') . 'components/moneybird/'); $assetsUrl = $this->modx->getOption('moneybird.assets_url', $config, $this->modx->getOption('assets_url') . 'components/moneybird/'); $this->config = array_merge(array('basePath' => $basePath, 'corePath' => $basePath, 'modelPath' => $basePath . 'model/', 'processorsPath' => $basePath . 'processors/', 'templatesPath' => $basePath . 'templates/', 'chunksPath' => $basePath . 'elements/chunks/', 'jsUrl' => $assetsUrl . 'js/', 'cssUrl' => $assetsUrl . 'css/', 'assetsUrl' => $assetsUrl, 'connectorUrl' => $assetsUrl . 'connector.php', 'cacheOptions' => array(xPDO::OPT_CACHE_KEY => 'moneybird')), $config); $this->modx->addPackage('moneybird', $this->config['modelPath']); // autoloader for MoneyBird API stuff require_once $this->config['modelPath'] . 'api/ApiConnector.php'; spl_autoload_register('Moneybird\\ApiConnector::autoload'); try { $accountname = $this->modx->getOption('moneybird.account_name', $config, ''); $username = $this->modx->getOption('moneybird.auth_username', $config, ''); $password = $this->modx->getOption('moneybird.auth_password', $config, ''); if (empty($accountname) || empty($username) || empty($password)) { $this->modx->log(modX::LOG_LEVEL_ERROR, '[MoneyBird] Account name, username and/or password to connect with MoneyBird are empty!'); } // setup the transport and connector $transport = new Moneybird\HttpClient(); $transport->setAuth($username, $password); $this->api = new Moneybird\ApiConnector($accountname, $transport, new Moneybird\XmlMapper()); // some errors? $errors = $this->api->getErrors(); if (!empty($errors)) { foreach ($errors as $error) { $this->modx->log(modX::LOG_LEVEL_ERROR, '[MoneyBird] ' . $error->attribute . ': ' . $error->message); } } } catch (Exception $e) { $this->modx->log(modX::LOG_LEVEL_ERROR, '[MoneyBird] ' . $e->getMessage()); } }
protected function __construct($config) { if (count($config["db"]) != 4) { throw new \Exception("Le nombre d'arguments n'est pas valable!"); } spl_autoload_register(array(__CLASS__, 'autoload')); self::$config = $config; self::$database = new Core\Db\ConnectPDO(self::$config["db"]); self::$baseUrl = rtrim(dirname($_SERVER['PHP_SELF']), '/.\\'); $route = isset($_GET["r"]) ? $_GET["r"] : $_SERVER["REQUEST_URI"]; $url = parse_url($route); $path = preg_replace('/^' . preg_quote(self::$baseUrl, '/') . '\\//', "", $url["path"]); $query = @$url["query"]; $method = $_SERVER['REQUEST_METHOD']; $request = new Core\Http\Request($method, $path, $query); $dispatcher = new Core\Http\Dispatcher(); try { $dispatcher->handle($request); } catch (Exception $e) { $code = '404'; header($_SERVER["SERVER_PROTOCOL"] . " " . $code); $request = new Core\Http\Request('GET', 'Site/error', 'code=' . $code . '&message=' . $e->getMessage()); $dispatcher->handle($request); } }