/** * Get the plugins CSS and combine these */ public function getPluginCSS() { $cacheDir = RM_Environment::getConnector()->getRootPath() . DIRECTORY_SEPARATOR . 'RM' . DIRECTORY_SEPARATOR . 'userdata' . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . 'css'; if (is_dir($cacheDir) == false) { $rmConfig = new RM_Config(); $chmodOctal = intval($rmConfig->getValue('rm_config_chmod_value'), 8); mkdir($cacheDir, $chmodOctal); } $cachedCSS = file_exists($cacheDir . DIRECTORY_SEPARATOR . "plugins.css"); if (!$cachedCSS) { $newfileContents = ""; $pluginsDAO = new RM_Plugins(); $plugins = $pluginsDAO->fetchAllEnabled(); $config = new RM_plugin_Config(); foreach ($plugins as $plugin) { $files = RM_plugin_Manager::getCssFiles($plugin->name); foreach ($files as $file) { // read in the css and change the relative paths then add to a cached css file that we will load $fileContents = file_get_contents(RM_Environment::getConnector()->getRootURL() . "RM/userdata/plugins/" . $plugin->name . "/" . RM_Module_Config::CSS . '/' . $file); $search = "/url\\(([^\\)]*)\\)/"; $replace = "url(../../../userdata/plugins/" . $plugin->name . "/images/\$1)"; $newfileContents .= preg_replace($search, $replace, $fileContents); } } $this->_saveCachedCSS($newfileContents, $cacheDir . DIRECTORY_SEPARATOR . "plugins.css"); } // return the cached CSS url so it can be included return RM_Environment::getConnector()->getRootURL() . "RM/userdata/temp/css/plugins.css"; }
/** * 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); }