<?php error_reporting(-1); date_default_timezone_set('UTC'); define('PATH_ROOT', realpath(dirname(__DIR__))); define('PATH_SYSTEM', PATH_ROOT . '/vendor/wb-crowdfusion/crowdfusion/system'); if (!file_exists(PATH_ROOT . '/composer.lock')) { die("Dependencies must be installed using composer:\n\nphp composer.phar install\n\n" . "See http://getcomposer.org for help with installing composer\n"); } include PATH_ROOT . '/vendor/autoload.php'; require PATH_SYSTEM . '/context/ApplicationContext.php'; $loader = new ClassLoader(); $loader->addDirectory(PATH_SYSTEM . '/core/classes/'); $loader->addDirectory(PATH_ROOT . '/classes/'); $loader->addClassDirectory(PATH_ROOT . '/tests/');
protected function loadPluginDirectory(Configuration $configurationLoader, SplFileInfo $dir, $checkStatus = true) { $pluginName = $dir->getBasename(); $realPath = $dir->getRealPath(); if ($checkStatus) { // read .plugin file for plugin info $plugin = $this->getPluginStatus($pluginName); if (is_null($plugin) || $plugin['enabled'] !== true) { return null; } // no plugin file, plugin is not installed if ($plugin['priority'] > $this->lastPriority) { $this->lastPriority = $plugin['priority']; } } else { $plugin = array("enabled" => true, "priority" => ++$this->lastPriority); } $plugin = array_merge(array('directory' => $realPath), $plugin); // add classes to classpath ClassLoader::addDirectory($realPath, $this->autoloadExtension, $this->bypassDirectoriesForAutoload); // ADD PSR-0/PEAR Compliant Classes if (file_exists($realPath . DIRECTORY_SEPARATOR . 'autoload_psr-0.php')) { $psrDirectories = (include $realPath . DIRECTORY_SEPARATOR . 'autoload_psr-0.php'); foreach ($psrDirectories as $psrDir) { ClassLoader::addClassDirectory($realPath . DIRECTORY_SEPARATOR . $psrDir); } } if (file_exists($realPath . DIRECTORY_SEPARATOR . 'autoload_pear.php')) { $pearDirectories = (include $realPath . DIRECTORY_SEPARATOR . 'autoload_pear.php'); foreach ($pearDirectories as $pearPrefix => $pearDir) { ClassLoader::addClassDirectory($realPath . DIRECTORY_SEPARATOR . $pearDir, $this->autoloadExtension, false, $pearPrefix); } } $plugin['id'] = $pluginName; if (!empty($this->bootstrapFile) && file_exists($realPath . DIRECTORY_SEPARATOR . $this->bootstrapFile)) { $plugin['bootstrapped'] = true; } // locate plugin context if (!empty($this->pluginContextFile) && ($contextXML = $realPath . DIRECTORY_SEPARATOR . $this->pluginContextFile) && file_exists($contextXML)) { $plugin['context'] = $this->loadContextFile($configurationLoader, $contextXML); } else { if (file_exists($realPath . DIRECTORY_SEPARATOR . $this->sharedContextFile)) { $plugin['context'] = $this->loadContextFile($configurationLoader, $realPath . DIRECTORY_SEPARATOR . $this->sharedContextFile); } } return $plugin; }