/** * Get module output * * @param string $module_name Module name * @param array $params Module constructor parameters * @param template $parent_template Parent temlpate for module * @return string Module output */ function get_module_output($module_name, $params = array(), &$parent_template) { if ($module_name == 'ui_hooks') { $module = new ui_hooks($this, $params, $parent_template); return $module->get_output(); } $output = ''; if (key_exists($module_name, $this->_modules)) { if (!$this->load_module_file($module_name)) { $this->debug_push("core:", 'Box ' . $module_name . ' missing (' . $this->_modules[$module_name]['class_name'] . ' from file ' . $this->_modules[$module_name]['file'] . ')', 1); return false; } $this->_loaded_modules[$module_name] = array(); if (!isset($instance_id) || $instance_id === -1) { $instance_id = 0; } if (class_exists($this->_modules[$module_name]['class_name'])) { $module = new $this->_modules[$module_name]['class_name']($this, $params, $parent_template); if (is_a($module, 'module')) { $output = $module->get_output(); $module->__destruct(); unset($module); } } } else { $this->debug_push("core:", 'Called unregistered module ' . $module_name, 1); } return $output; }
/** * Uninstall Pages * * @param vivvo_site $site_manager * @param integer $step */ function uninstall(&$site_manager, $step = 1) { parent::uninstall($site_manager, $step); if ($step == 2) { //Uninstall procedure //Table $db =& $site_manager->get_db(); $dbm =& $site_manager->get_db_manager(); $db->manager->dropTable(VIVVO_DB_PREFIX . 'pages'); $site_manager->unregister_module('box_pages'); $site_manager->unregister_action('pages'); $pl_manager = $site_manager->get_plugin_manager(); $pl_manager->unregister('pages'); ui_hooks::unregister('plugin_pages_admin_content_subnav_hook'); } $output = $site_manager->get_output(); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n"; echo $output; }
function _main_nav() { $sm = vivvo_lite_site::get_instance(); if ($sm->check_token()) { $um = $sm->get_url_manager(); $id = $um->get_param('id'); $title = $um->get_param('title'); $href = $um->get_param('href'); $action = $um->get_param('action'); $plugin_name = $um->get_param('plugin_name'); if ($id and $title and $href and $plugin_name and $action) { if ($sm->user and $sm->user->can('MANAGE_PLUGIN', $plugin_name)) { $hook_name = 'plugin_' . $plugin_name . '_admin_main_nav_hook'; if ($action == 'register') { ui_hooks::register($hook_name, 'admin_main_nav', array('id' => $id, 'href' => $href, 'title' => $title), array('file' => 'lib/vivvo/functions.php', 'function' => 'main_nav_plugin_callback', 'params' => array('name' => $plugin_name))); } elseif ($action == 'unregister') { ui_hooks::unregister($hook_name); } else { $error = 'NO_ACTION'; } header('X-Vivvo-Action-Status: 1'); } else { $error = 'NO_PRIVILEGES'; } } else { $error = 'INVALID_TOKEN'; } if (!empty($error)) { header('X-Vivvo-Action-Status: 0'); header('X-Vivvo-Action-Error: ' . $error); } else { $sm->get_configuration()->load_configuration(true); } return $this->load_template($this->_template_root . 'components/menu.xml'); } }
function _uninstall() { $sm = vivvo_lite_site::get_instance(); if (!$sm->user or !$sm->user->is_admin()) { exit; } $sm = vivvo_lite_site::get_instance(); $pm = $sm->get_plugin_manager(); $um = $sm->get_url_manager(); $template = $sm->get_template(); if ($um->isset_param('plugin') && isset($pm->plugins[$um->get_param('plugin')])) { $plugin = $pm->get_plugin_definiton($um->get_param('plugin')); if ($plugin !== false) { $template->assign('PLUG_IN_NAME', $pm->plugins[$um->get_param('plugin')]['name']); $plugin->load_admin_lang(); ui_hooks::unregister('plugin_' . $um->get_param('plugin') . '_admin_main_nav_hook'); echo $plugin->uninstall($sm, $um->get_param('step')); } } exit; }
/** * Module constructor * * @param vivvo_site $site_manager * @param array $params * @param template $parent_template * @param bool $cache * @param bool $output */ public function __construct($site_manager, $params, $parent_template = NULL, $cache = true, $output = true) { if (self::$hooks === false) { self::$hooks = array(); $hooks = $site_manager->get_configuration()->get_configuration_property_list('ui_hooks'); foreach ($hooks as $name => $hook) { if (!isset(self::$hooks[$hook_name = $hook['hook']])) { self::$hooks[$hook_name] = array(); } if (is_array($hook_params = @unserialize($hook['params']))) { $handler = false; if (is_array($handler = @unserialize($hook['handler'])) and !empty($handler['file']) and !empty($handler['function'])) { $handler['loaded'] = false; if (empty($handler['params'])) { $handler['params'] = array(); } } else { $handler = false; } } $hook = array('name' => $name, 'params' => $hook_params); if ($handler) { $hook['handler'] = $handler; } self::$hooks[$hook_name][] = $hook; } } $this->module($site_manager, $params, $parent_template, $cache, $output); }
/** * Video box uninstall procedure * * @param vivvo_site $site_manager * @param integer $step */ public function uninstall(&$site_manager, $step = 1) { parent::uninstall($site_manager, $step); if ($step == 2) { $plugin_dir = VIVVO_FS_PLUGIN_ROOT . $this->get_root_dir(); $sqlRunner = new SQLRunner(array('db' => $site_manager->get_db(), 'filename' => $plugin_dir . 'db/uninstall.sql')); try { $sqlRunner->load() and $sqlRunner->run(); } catch (SQLRunnerException $e) { $this->set_error_code(14, $e->getMessage()); // error executing sql script file $this->uninstall($site_manager, 1); return; } ui_hooks::unregister('plugin_video_box_form_field'); $site_manager->get_url_manager()->unregister_url('xspf'); $site_manager->get_plugin_manager()->unregister($this->plugin_name); } $output = $site_manager->get_output(); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n"; echo $output; }