public function __construct() { parent::__construct(); $this->import('Config'); // Load required translation-fields classes \ClassLoader::addNamespace('TranslationFields'); \ClassLoader::addClass('TranslationFields\\TranslationFieldsWidgetHelper', 'system/modules/translation-fields/classes/TranslationFieldsWidgetHelper.php'); \ClassLoader::addClass('TranslationFields\\TranslationFieldsModel', 'system/modules/translation-fields/models/TranslationFieldsModel.php'); \ClassLoader::register(); }
public function __construct() { parent::__construct(); // Disable debug mode $GLOBALS['TL_CONFIG']['debugMode'] = false; // Load required classes \ClassLoader::addNamespace('Photoalbums2'); \ClassLoader::addClass('Photoalbums2\\Updater', 'system/modules/photoalbums2/classes/Updater.php'); \ClassLoader::register(); // Load updater $this->import('\\Photoalbums2\\Updater', 'Updater'); }
public function __construct() { parent::__construct(); // Disable debug mode $GLOBALS['TL_CONFIG']['debugMode'] = false; // Load required classes \ClassLoader::addNamespace('Craffft'); \ClassLoader::addClass('Craffft\\AccountMail\\Updater', 'system/modules/accountmail/library/Craffft/AccountMail/Updater.php'); \ClassLoader::register(); // Load updater $this->import('\\Craffft\\AccountMail\\Updater', 'Updater'); }
protected function loadResources() { $contextFile = $this->getContextCacheFile(); if (!$this->hotDeploy && !$this->oneOffRedeploy && file_exists($contextFile) && (include $contextFile) == true) { } else { $this->oneOffRedeploy = true; // ADD PSR-0 Compliant Classes from the APP /* * For the application itself we'll piggy back on composer's autoload class map if there's a composer.json * present. If not, the old school method. It is recommended to use composer though, for real mane. * */ if (defined('PATH_ROOT') && file_exists(PATH_ROOT . '/composer.json')) { if (!file_exists(PATH_ROOT . '/composer.lock') || !file_exists(PATH_ROOT . '/vendor/composer/autoload_classmap.php')) { throw new Exception('You must run "composer install -o" before booting the application.'); } $classMap = (include PATH_ROOT . '/vendor/composer/autoload_classmap.php'); foreach ($classMap as $className => $classPath) { ClassLoader::addClass($className, $classPath); } } else { if (defined('PATH_APP') && is_dir(PATH_APP . DIRECTORY_SEPARATOR . 'src')) { ClassLoader::addClassDirectory(PATH_APP . DIRECTORY_SEPARATOR . 'src'); } } //add new variable here $contextResources = $this->contextResources; $configurationLoader = new Configuration(); foreach ($contextResources as $contextResource) { if (!is_dir($contextResource)) { if (file_exists($contextResource) && strrchr($contextResource, '.') === '.xml') { $plugin = array(); $plugin['enabled'] = true; $plugin['id'] = basename($contextResource); $plugin['context'] = $this->loadContextFile($configurationLoader, $contextResource); if (array_key_exists('priority', $plugin['context'])) { $plugin['priority'] = $plugin['context']['priority']; } else { $plugin['priority'] = ++$this->lastPriority; } if ($plugin['priority'] > $this->lastPriority) { $this->lastPriority = $plugin['priority']; } $this->plugins[] = $plugin; continue; } else { throw new ApplicationContextException('Context resource does not exist: ' . $contextResource); } } //LOAD EXPLICIT PLUGIN DIRECTORY (NOT A DIRECTORY OF PLUGIN DIRECTORIES) if (file_exists($contextResource . DIRECTORY_SEPARATOR . 'plugin.xml')) { //$this->pluginDirectories[] = $contextResource.DIRECTORY_SEPARATOR; $plugin = $this->loadPluginDirectory($configurationLoader, new SplFileInfo($contextResource), $checkStatus = false); if ($plugin != null) { $this->plugins[] = $plugin; } } else { $objects = new DirectoryIterator($contextResource); foreach ($objects as $object) { if (!$object->isDot() && $object->isDir() && substr($object->getFilename(), 0, 1) != '.') { $this->pluginDirectories[] = $object->getPathname() . DIRECTORY_SEPARATOR; $plugin = $this->loadPluginDirectory($configurationLoader, new SplFileInfo($object->getPathname())); if ($plugin != null) { $this->plugins[] = $plugin; } } } } } usort($this->plugins, array(__CLASS__, '_priorityCompare')); foreach ($this->plugins as &$plugin) { if (!empty($plugin['directory'])) { $this->enabledPluginDirectories[] = $plugin['directory']; $const = $this->getPluginConstant($plugin); if (defined($const) === FALSE) { define($const, $plugin['directory']); } } if (!empty($plugin['context'])) { $objectsContext = $plugin['context']; if (isset($objectsContext['objects'])) { foreach ((array) $objectsContext['objects'] as $object) { $this->addObjectContext($object); } unset($plugin['context']['objects']); } if (isset($objectsContext['events'])) { foreach ((array) $objectsContext['events'] as $mode => $events) { foreach ($events as $event) { if (strtolower($mode) == 'unbind') { $this->addUnbindEventContext($event); } else { $this->addBindEventContext($event); } } } unset($plugin['context']['events']); } } } ClassLoader::addClass('Events', dirname(__FILE__) . 'Events.php'); } $this->contextEvents = $this->events; }