/** * Private constructor that invokes only from 'getInstance' method */ private function __construct() { $this->_initializeLocale(); $model = new RM_Modules(); $allModules = $model->fetchAll(); $modules = $model->fetchAllEnabled(); foreach ($modules as $module) { $moduleObject = RM_Module_Manager::getModule($module->name); //We will get the last enabled module in the system //that implements one of our internal interfaces if ($moduleObject instanceof RM_Payments_Interface) { $this->_paymentSystem = $moduleObject; } if ($moduleObject instanceof RM_Extras_Interface) { $this->_extrasSystems[] = $moduleObject; } if ($moduleObject instanceof RM_Others_Interface) { $this->_othersSystems[] = $moduleObject; } if ($moduleObject instanceof RM_SEF_Manager_Interface) { $this->_sefManager = $moduleObject; } } $pluginModel = new RM_Plugins(); $allPlugins = $pluginModel->fetchAll(); $plugins = $pluginModel->fetchAllEnabled(); $this->_taxSystem = new RM_Taxes_Default(); foreach ($plugins as $plugin) { $pluginObject = RM_Plugin_Manager::getPlugin($plugin->name); if ($pluginObject instanceof RM_Taxes_Interface) { $this->_taxSystem = $pluginObject; } if ($pluginObject instanceof RM_Discounts_Plugin_Interface) { $this->_discounts[] = $pluginObject; } //We will assign only one deposit system (the last one enabled) if ($pluginObject instanceof RM_Deposit_Plugin_Interface) { $this->_depositSystem = $pluginObject; } } $this->_initializeTranslate($allModules, $allPlugins); }
/** * Initialize autoloading for modules and plugins */ public function initAuloadMP() { $isSafeMode = $this->isSafeMode(); $paths = array(); $modulesDAO = new RM_Modules(); $modules = $modulesDAO->fetchAll(); foreach ($modules as $module) { if ($isSafeMode && $module->core == 0) { continue; } $bothPath = RM_Module_Manager::getModuleFolderpath($module->name, $this->_rootPath) . DIRECTORY_SEPARATOR; $paths[] = $bothPath . RM_Module_Config::CLASSES; $paths[] = $bothPath . RM_Module_Config::CONTROLLERS; } $pluginsDAO = new RM_Plugins(); $plugins = $pluginsDAO->fetchAll(); foreach ($plugins as $plugin) { if ($isSafeMode && $plugin->core == 0) { continue; } $bothPath = RM_Plugin_Manager::getPluginFolderpath($plugin->name, $this->_rootPath) . DIRECTORY_SEPARATOR; $paths[] = $bothPath . RM_Plugin_Config::CLASSES; $paths[] = $bothPath . RM_Plugin_Config::CONTROLLERS; } $MPPathString = implode(PATH_SEPARATOR, $paths); set_include_path(get_include_path() . PATH_SEPARATOR . $MPPathString); }
/** * Return all module objects * * @todo RM_Modules has the very similar method: getAll. "In the end, there can be only one." * @return array - array with modules */ public static function getModules() { $model = new RM_Modules(); $modules = $model->fetchAll(); $moduleList = array(); foreach ($modules as $module) { $moduleClassName = self::_getClassname($module->name); $moduleList[] = new $moduleClassName(); } return $moduleList; }
/** * Returns data for the info grid (grid with language files) on the language page. * * This method returns the list data in JSON format. This is implicated in * lists.js * * @param request iso * @return json the json data for the list. */ public function infogridJsonAction() { $iso = $this->_getParam('iso'); $files = RM_Language_Manager::$files; $jsonFiles = array(); foreach ($files as $file) { $jsonFiles[] = array($file, RM_Language_Manager::TYPE_MAIN . ',' . RM_Language_Manager::TYPE_MAIN, $iso . ',' . $file . ',' . RM_Language_Manager::TYPE_MAIN . ',' . RM_Language_Manager::TYPE_MAIN); } $extensionFiles = RM_Language_Manager::$extensionFiles; $moduleModel = new RM_Modules(); $modules = $moduleModel->fetchAll(); foreach ($modules as $module) { foreach ($extensionFiles as $file) { $jsonFiles[] = array($file, RM_Language_Manager::TYPE_MODULE . ',' . $moduleModel->get($module->name)->getName(), $iso . ',' . $file . ',' . RM_Language_Manager::TYPE_MODULE . ',' . $module->name); } } $pluginModel = new RM_Plugins(); $plugins = $pluginModel->fetchAll(); foreach ($plugins as $plugin) { foreach ($extensionFiles as $file) { $jsonFiles[] = array($file, RM_Language_Manager::TYPE_PLUGIN . ',' . $pluginModel->get($plugin->name)->getName(), $iso . ',' . $file . ',' . RM_Language_Manager::TYPE_PLUGIN . ',' . $plugin->name); } } $json = new stdClass(); $json->total = count($jsonFiles); $json->data = $jsonFiles; return array('data' => $jsonFiles); }