plugin_config = $config; } public function loc_begin_page_header() { global $template; if (!empty($_GET['display_mode']) && $_GET['display_mode']=='cumulus') { $template->assign('display_mode', 'cumulus'); } $template->set_filenames(array('tags'=> PWG_CUMULUS_PLUGIN_TEMPLATE . '/tags.tpl')); $template->assign('PWG_CUMULUS_SWF', PWG_CUMULUS_PLUGIN_SWF); $template->assign('PWG_CUMULUS_IMGS', PWG_CUMULUS_PLUGIN_IMGS); $template->assign('PWG_CUMULUS_WIDTH', $this->plugin_config->pwg_cumulus_width); $template->assign('PWG_CUMULUS_HEIGHT', $this->plugin_config->pwg_cumulus_height); $template->assign('PWG_CUMULUS_HREF', get_root_url().'tags.php?display_mode=cumulus'); $template->assign('PWG_CUMULUS_MODE_TRANSPARENT', $this->plugin_config->pwg_cumulus_mode_transparent); $template->assign('PWG_CUMULUS_BGCOLOR', $this->plugin_config->pwg_cumulus_bgcolor); $template->assign('PWG_CUMULUS_COLOR1', '0x'.$this->plugin_config->pwg_cumulus_color1); $template->assign('PWG_CUMULUS_COLOR2', '0x'.$this->plugin_config->pwg_cumulus_color2); $template->assign('PWG_CUMULUS_HICOLOR', '0x'.$this->plugin_config->pwg_cumulus_hicolor); if (!empty($template->smarty->tpl_vars['tags'])) { foreach ($template->smarty->tpl_vars['tags']->value as $key => &$tag) { $tag['display_name'] = urlencode($tag['name']); $tag['size'] = $this->plugin_config->pwg_cumulus_coeff * $tag['level']; } } } public function blockmanager_register_blocks($menu_ref_arr) { if (!$this->plugin_config->pwg_cumulus_in_main_menu) { return; } $menu = &$menu_ref_arr[0]; if ($menu->get_id() != 'menubar') { return; } $menu->register_block(new RegisteredBlock('mbCumulus', 'Cumulus', 'piwigo')); } public function blockmanager_apply($menu_ref_arr) { global $template; if (!$this->plugin_config->pwg_cumulus_in_main_menu) { return; } load_language('plugin.lang', PWG_CUMULUS_PLUGIN_LANG); $menu = &$menu_ref_arr[0]; if ($menu->get_id() != 'menubar') { return; } include_once(PHPWG_ROOT_PATH.'include/block.class.php'); if (($mbCumulus = $menu->get_block('mbTags'))!==null) { if (empty($mbCumulus->data)) { return; } if ($this->plugin_config->position_order!=null && $this->plugin_config->position_block_id!=null) { $related_block = $menu->get_block($this->plugin_config->position_block_id); if ($this->plugin_config->position_order=='after') { $mbCumulus->set_position($related_block->get_position()+1); } else { $mbCumulus->set_position($related_block->get_position()-1); } } $template->assign('PWG_CUMULUS_SWF', PWG_CUMULUS_PLUGIN_SWF); $template->assign('PWG_CUMULUS_IMGS', PWG_CUMULUS_PLUGIN_IMGS); $template->assign('PWG_CUMULUS_WIDTH', htmlspecialchars($this->plugin_config->pwg_cumulus_width,ENT_COMPAT,'UTF-8')); $template->assign('PWG_CUMULUS_HEIGHT', htmlspecialchars($this->plugin_config->pwg_cumulus_height,ENT_COMPAT,'UTF-8')); $template->assign('PWG_CUMULUS_WIDTH_IN_MENU', htmlspecialchars($this->plugin_config->pwg_cumulus_width_in_menu,ENT_COMPAT,'UTF-8')); $template->assign('PWG_CUMULUS_HEIGHT_IN_MENU', htmlspecialchars($this->plugin_config->pwg_cumulus_height_in_menu,ENT_COMPAT,'UTF-8')); $template->assign('PWG_CUMULUS_MODE_TRANSPARENT', $this->plugin_config->pwg_cumulus_mode_transparent); $template->assign('PWG_CUMULUS_BGCOLOR', htmlspecialchars($this->plugin_config->pwg_cumulus_bgcolor,ENT_COMPAT,'UTF-8')); $template->assign('PWG_CUMULUS_COLOR1', '0x'.htmlspecialchars($this->plugin_config->pwg_cumulus_color1,ENT_COMPAT,'UTF-8')); $template->assign('PWG_CUMULUS_COLOR2', '0x'.htmlspecialchars($this->plugin_config->pwg_cumulus_color2,ENT_COMPAT,'UTF-8')); $template->assign('PWG_CUMULUS_HICOLOR', '0x'.htmlspecialchars($this->plugin_config->pwg_cumulus_hicolor,ENT_COMPAT,'UTF-8')); foreach ($mbCumulus->data as &$tag) { $tag['size'] = $this->plugin_config->pwg_cumulus_coeff * $tag['level']; if (!empty($tag['U_ADD'])) { $tag['URL'] = $tag['U_ADD']; } $tag['display_name'] = urlencode($tag['name']); } $template->assign('PWG_CUMULUS_TAGS', $mbCumulus->data); $mbCumulus->template = PWG_CUMULUS_PLUGIN_TEMPLATE . '/menubar_tags.tpl'; } } }