public function addBuiltInCovers($defaults = true) { $covers = array("forest.jpg", "bridge.jpg", "grass.jpg", "landscape.jpg", "sea.jpg", "sky.jpg", "feathers.jpg", "abstract-lines.jpg", "abstract-stripes.jpg", "line.jpg"); $defaultCovers = $defaults ? array("grass.jpg", "bridge.jpg", "forest.jpg") : array(); foreach ($covers as $fileName) { $filePath = $this->plugin->getRootDir() . "covers" . DS . $fileName; $this->addTemplate($filePath, null, in_array($fileName, $defaultCovers)); } }
public function initPlugin(OW_Plugin $pluginObject) { $this->addPackagePointers($pluginObject->getDto()); $initDirPath = $pluginObject->getRootDir(); if (OW::getApplication()->getContext() == OW::CONTEXT_MOBILE) { $initDirPath = $pluginObject->getMobileDir(); } else { if (OW::getApplication()->getContext() == OW::CONTEXT_API) { $initDirPath = $pluginObject->getApiDir(); } } if (file_exists($initDirPath . 'init.php')) { OW::getEventManager()->trigger(new OW_Event("core.performance_test", array("key" => "plugin_init.start", "pluginKey" => $pluginObject->getKey()))); include $initDirPath . 'init.php'; OW::getEventManager()->trigger(new OW_Event("core.performance_test", array("key" => "plugin_init.end", "pluginKey" => $pluginObject->getKey()))); } }
/** * Includes init script for provided plugin */ public function initPlugin(OW_Plugin $pluginObject) { $this->addPackagePointers($pluginObject->getDto()); $initDirPath = $pluginObject->getRootDir(); if (OW::getApplication()->getContext() == OW::CONTEXT_MOBILE) { $initDirPath = $pluginObject->getMobileDir(); } if (OW::getApplication()->getContext() == OW::CONTEXT_CLI) { $initDirPath = $pluginObject->getCliDir(); } else { if (OW::getApplication()->getContext() == OW::CONTEXT_API) { $initDirPath = $pluginObject->getApiDir(); } } OW::getEventManager()->trigger(new OW_Event("core.performance_test", array("key" => "plugin_init.start", "pluginKey" => $pluginObject->getKey()))); $this->pluginService->includeScript($initDirPath . BOL_PluginService::SCRIPT_INIT); OW::getEventManager()->trigger(new OW_Event("core.performance_test", array("key" => "plugin_init.end", "pluginKey" => $pluginObject->getKey()))); }
public function init() { OW::getAutoloader()->addPackagePointer("NEWSFEED_FORMAT", $this->plugin->getRootDir() . "formats" . DS); OW::getAutoloader()->addPackagePointer("NEWSFEED_MFORMAT", $this->plugin->getMobileDir() . "formats" . DS); OW::getEventManager()->bind(OW_EventManager::ON_PLUGINS_INIT, array($this, "collectFormats")); }
/** * Uninstalls plugin * * @param string $pluginKey */ public function uninstall($pluginKey) { if (empty($pluginKey)) { throw new LogicException("Empty plugin key provided for uninstall"); } $pluginDto = $this->findPluginByKey(trim($pluginKey)); if ($pluginDto === null) { throw new LogicException("Invalid plugin key - `{$pluginKey}` provided for uninstall!"); } $plugin = new OW_Plugin($pluginDto); // trigger event OW::getEventManager()->trigger(new OW_Event(OW_EventManager::ON_BEFORE_PLUGIN_UNINSTALL, array("pluginKey" => $pluginDto->getKey()))); $this->includeScript($plugin->getRootDir() . BOL_PluginService::SCRIPT_DEACTIVATE); $this->includeScript($plugin->getRootDir() . BOL_PluginService::SCRIPT_UNINSTALL); // delete plugin work dirs $dirsToRemove = array($plugin->getPluginFilesDir(), $plugin->getUserFilesDir(), $plugin->getPublicStaticDir()); foreach ($dirsToRemove as $dir) { if (file_exists($dir)) { UTIL_File::removeDir($dir); } } // remove plugin configs OW::getConfig()->deletePluginConfigs($pluginDto->getKey()); // delete language prefix $prefixId = BOL_LanguageService::getInstance()->findPrefixId($pluginDto->getKey()); if (!empty($prefixId)) { BOL_LanguageService::getInstance()->deletePrefix($prefixId, true); } //delete authorization stuff BOL_AuthorizationService::getInstance()->deleteGroup($pluginDto->getKey()); // drop plugin tables $tables = OW::getDbo()->queryForColumnList("SHOW TABLES LIKE '" . str_replace('_', '\\_', OW_DB_PREFIX) . $pluginDto->getKey() . "\\_%'"); if (!empty($tables)) { $query = "DROP TABLE "; foreach ($tables as $table) { $query .= "`" . $table . "`,"; } $query = substr($query, 0, -1); OW::getDbo()->query($query); } //remove entry in DB $this->deletePluginById($pluginDto->getId()); $this->updatePluginListCache(); // trigger event OW::getEventManager()->trigger(new OW_Event(OW_EventManager::ON_AFTER_PLUGIN_UNINSTALL, array("pluginKey" => $pluginDto->getKey()))); }