/** * Pages install procedure * * @param vivvo_site $site_manager * @param integer $step */ function install(&$site_manager, $step = 1) { parent::install($site_manager, $step); if ($step == 2) { //install procedure here $db = $site_manager->get_db(); $mysql = $db->getServerVersion(); $fields = array('id' => array('type' => 'integer', 'autoincrement' => true), 'title' => array('type' => 'text', 'length' => 255, 'notnull' => 1, 'collation' => 'utf8_unicode_ci'), 'body' => array('type' => 'clob', 'notnull' => 0, 'default' => NULL, 'collate' => 'utf8_unicode_ci'), 'hide' => array('type' => 'integer', 'length' => 1, 'notnull' => 0, 'default' => NULL), 'sefriendly' => array('type' => 'text', 'length' => 255, 'notnull' => 1, 'collation' => 'utf8_general_ci'), 'template' => array('type' => 'text', 'length' => 255, 'collation' => 'latin1_swedish_ci'), 'order_number' => array('type' => 'integer', 'length' => 5, 'notnull' => 0, 'default' => NULL)); $options = array('comment' => 'Pages', 'charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'type' => 'MyISAM'); $table = VIVVO_DB_PREFIX . 'pages'; $dbm = $site_manager->get_db_manager(); if (!$dbm->table_exists(strtolower($table))) { $db->manager->createTable($table, $fields, $options); } else { $db->manager->alterTable(VIVVO_DB_PREFIX . 'pages', array('add' => array('hide' => array('type' => 'integer', 'length' => '1', 'notnull' => 0, 'default' => NULL))), false); } $site_manager->unregister_module('box_pages'); $site_manager->register_module('box_pages', 'box_pages', $this->get_root_dir() . 'box_pages.php'); $site_manager->unregister_action('page'); $site_manager->register_action('page', $this->get_root_dir() . 'service/Pages.action.php'); // register new plugin $pl_manager = $site_manager->get_plugin_manager(); $pl_manager->register('pages', $this->get_root_dir(), 'Pages'); ui_hooks::register('plugin_pages_admin_content_subnav_hook', 'admin_content_subnav', array('id' => 'menu_sub_plugin_pages', 'href' => 'plugins.php?plugin=pages', 'title' => 'Pages'), array('file' => 'lib/vivvo/functions.php', 'function' => 'main_nav_plugin_callback', 'params' => array('name' => 'pages'))); } $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; }
/** * Video box install procedure * * @param vivvo_site $site_manager * @param integer $step */ public function install(&$site_manager, $step = 1) { parent::install($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/install.sql')); try { $sqlRunner->load() and $sqlRunner->run(); } catch (SQLRunnerException $e) { $this->set_error_code(14, $e->getMessage()); // error executing sql script file $this->install($site_manager, 1); return; } ui_hooks::register('plugin_video_box_form_field', 'admin_article_form_before_body', array('lang_file' => $this->get_root_dir() . 'admin/lang/', 'gui_element' => 'file_picker', 'label' => '{LNG_PLUGIN_VIDEO_BOX_ADMIN_VIDEO}', 'name' => 'ARTICLE_video_attachment', 'value' => '{article.video_attachment}', 'input_id' => 'ARTICLE_video_attachment', 'link_id' => 'video_attachment_choose', 'options' => 'inputId: "ARTICLE_video_attachment", search_ext: "mp4,flv,mov", upload: true, butonLabel: "{LNG_PLUGIN_VIDEO_BOX_ADMIN_SELECT_VIDEO}", noneSelected: "{LNG_PLUGIN_VIDEO_BOX_ADMIN_NO_VIDEO_SELECTED}"'), array('file' => 'lib/vivvo/functions.php', 'function' => 'main_nav_plugin_callback', 'params' => array('name' => 'video_box'))); $site_manager->get_url_manager()->register_url('xspf', $this->get_root_dir() . 'url_handlers/xspf_url_handler.php', 'xspf_url_handler'); if (!$site_manager->_modules['box_paged_files']) { $site_manager->register_module('box_paged_files', 'box_paged_files', 'lib/vivvo/box/box_paged_files.php'); } $files = array('templates/xspf.tpl' => 'templates/_syndication/xspf.tpl', 'templates/box/plugin_video_box.tpl' => VIVVO_TEMPLATE_DIR . '/box/plugin_video_box.tpl', 'templates/box/plugin_video_headlines.tpl' => VIVVO_TEMPLATE_DIR . '/box/plugin_video_headlines.tpl', 'templates/box/plugin_video_playlist.tpl' => VIVVO_TEMPLATE_DIR . '/box/plugin_video_playlist.tpl', 'templates/box/plugin_video_article.tpl' => VIVVO_TEMPLATE_DIR . '/box/plugin_video_article.tpl', 'templates/box/plugin_video_player.tpl' => VIVVO_TEMPLATE_DIR . '/box/plugin_video_player.tpl', 'templates/box/plugin_video_tabs.tpl' => VIVVO_TEMPLATE_DIR . '/box/plugin_video_tabs.tpl', 'templates/summary/video_short.tpl' => VIVVO_TEMPLATE_DIR . '/summary/video_short.tpl', 'templates/article/two_column_video.tpl' => VIVVO_TEMPLATE_DIR . '/article/two_column_video.tpl', 'templates/category/non_equal_video.tpl' => VIVVO_TEMPLATE_DIR . '/category/non_equal_video.tpl', 'css/plugin_video.css' => 'themes/' . VIVVO_DEFAULT_THEME . '/css/plugin_video.css', 'img/button_play.gif' => 'themes/' . VIVVO_DEFAULT_THEME . '/img/button_play.gif', 'modifiers/video_box.modifier.php' => 'modifiers/video_box.modifier.php'); foreach ($files as $src => $dest) { @copy($plugin_dir . $src, VIVVO_FS_INSTALL_ROOT . $dest); } if (!is_dir(VIVVO_FS_ROOT . VIVVO_FS_FILES_DIR . 'video')) { @mkdir(VIVVO_FS_ROOT . VIVVO_FS_FILES_DIR . 'video', 0777); } $site_manager->get_plugin_manager()->register($this->plugin_name, $this->get_root_dir(), $this->plugin_title); } $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'); } }