Ignore:
Timestamp:
Jun 13, 2011, 10:54:28 PM (13 years ago)
Author:
nikrou
Message:

Remove dependency to swfObject
Allow admin to use animation in main menu

Location:
extensions/pwgCumulus/include
Files:
1 added
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • extensions/pwgCumulus/include/admin_main.inc.php

    r11226 r11344  
    2020// +-----------------------------------------------------------------------+
    2121
    22 /*
    23 Plugin Name: pwgCumulus
    24 Version: 0.5.3
    25 Description: add an amazing tag cloud
    26 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=263
    27 Author: nikrou
    28 Author URI: http://www.nikrou.net/
    29 */
     22$plugin_main = file_get_contents(dirname(__FILE__) . '/../main.inc.php');
     23$version = '';
    3024
    31 if (!defined('PHPWG_ROOT_PATH')) {
    32   die('Hacking attempt!');
     25if (preg_match('`Version: (.*)`', $plugin_main, $matches)) {
     26  $version = trim($matches[1]);
    3327}
    3428
    35 include_once(dirname(__FILE__).'/init.php');
    36 ?>
     29$template->assign('PWG_CUMULUS_PLUGIN_VERSION', $version);
  • extensions/pwgCumulus/include/admin_tags.inc.php

    r11226 r11344  
    2020// +-----------------------------------------------------------------------+
    2121
    22 if (!defined('PHPWG_ROOT_PATH')) {
    23   die('Hacking attempt!');
    24 }
    25 
    26 load_language('plugin.lang', PWG_CUMULUS_PLUGIN_LANG);
    27 
    28 $me = get_plugin_data($plugin_id);
    2922$save_config = false;
    3023
     
    4639  }
    4740
     41  if (!empty($_POST['pwg_cumulus_mode_transparent']) && !$me->pwg_cumulus_mode_transparent) {
     42    $me->pwg_cumulus_mode_transparent = true;
     43    $page['infos'][] = l10n('Transparent mode is used');
     44    $save_config = true;
     45  } elseif (empty($_POST['pwg_cumulus_mode_transparent']) && $me->pwg_cumulus_mode_transparent) {
     46    $me->pwg_cumulus_mode_transparent = false;
     47    $page['infos'][] = l10n('Transparent mode is not used');
     48    $save_config = true;
     49  }
     50  if (!empty($_POST['pwg_cumulus_bgcolor']) && trim($_POST['pwg_cumulus_bgcolor'])!=$me->pwg_cumulus_bgcolor) {
     51    $me->pwg_cumulus_bgcolor = str_replace('#', '', $_POST['pwg_cumulus_bgcolor']);
     52    $page['infos'][] = l10n('Background color updated');
     53    $save_config = true;
     54  }
    4855  if (!empty($_POST['pwg_cumulus_color1']) && trim($_POST['pwg_cumulus_color1'])!=$me->pwg_cumulus_color1) {
    4956    $me->pwg_cumulus_color1 = str_replace('#', '', $_POST['pwg_cumulus_color1']);
     
    6774}
    6875
    69 $GLOBALS['template']->set_filenames(array('plugin_admin_content' => PWG_CUMULUS_PLUGIN_TEMPLATE . '/admin.tpl'));
    70 $GLOBALS['template']->assign('PWG_CUMULUS_PLUGIN_CSS', PWG_CUMULUS_PLUGIN_CSS);
    71 $GLOBALS['template']->assign('PWG_CUMULUS_PLUGIN_JS', PWG_CUMULUS_PLUGIN_JS);
    72 $GLOBALS['template']->assign('PWG_CUMULUS_WIDTH', $me->pwg_cumulus_width);
    73 $GLOBALS['template']->assign('PWG_CUMULUS_HEIGHT', $me->pwg_cumulus_height);
    74 $GLOBALS['template']->assign('PWG_CUMULUS_COEFF', $me->pwg_cumulus_coeff);
    75 $GLOBALS['template']->assign('PWG_CUMULUS_COLOR1', $me->pwg_cumulus_color1);
    76 $GLOBALS['template']->assign('PWG_CUMULUS_COLOR2', $me->pwg_cumulus_color2);
    77 $GLOBALS['template']->assign('PWG_CUMULUS_HICOLOR', $me->pwg_cumulus_hicolor);
    78 $GLOBALS['template']->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
     76$template->assign('PWG_CUMULUS_WIDTH', $me->pwg_cumulus_width);
     77$template->assign('PWG_CUMULUS_HEIGHT', $me->pwg_cumulus_height);
     78$template->assign('PWG_CUMULUS_COEFF', $me->pwg_cumulus_coeff);
     79$template->assign('PWG_CUMULUS_MODE_TRANSPARENT', $me->pwg_cumulus_mode_transparent);
     80$template->assign('PWG_CUMULUS_BGCOLOR', $me->pwg_cumulus_bgcolor);
     81$template->assign('PWG_CUMULUS_COLOR1', $me->pwg_cumulus_color1);
     82$template->assign('PWG_CUMULUS_COLOR2', $me->pwg_cumulus_color2);
     83$template->assign('PWG_CUMULUS_HICOLOR', $me->pwg_cumulus_hicolor);
    7984?>
  • extensions/pwgCumulus/include/pwgCumulusConfig.class.php

    r6433 r11344  
    33// | pwgCumulus  - a plugin for Piwigo                                     |
    44// +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2009-2010 Nicolas Roudaire        http://www.nikrou.net  |
     5// | Copyright(C) 2009-2011 Nicolas Roudaire        http://www.nikrou.net  |
    66// +-----------------------------------------------------------------------+
    77// | This program is free software; you can redistribute it and/or modify  |
  • extensions/pwgCumulus/include/pwgCumulusContent.class.php

    r9038 r11344  
    2727
    2828  public function loc_begin_page_header() {
     29    global $template;
     30
    2931    if (!empty($_GET['display_mode']) && $_GET['display_mode']=='cumulus') {
    30       $GLOBALS['template']->assign('display_mode', 'cumulus');
     32      $template->assign('display_mode', 'cumulus');
    3133    }
    3234
    33     $GLOBALS['template']->set_filenames(array('tags'=> PWG_CUMULUS_PLUGIN_TEMPLATE . '/tags.tpl'));
    34    
    35     if (version_compare(PHPWG_VERSION, '2.2', '>=') || (PHPWG_VERSION=='Colibri')) {
    36       $GLOBALS['template']->func_combine_script(array('id' => 'swfobject',
    37                                                       'path' => PWG_CUMULUS_PLUGIN_JS. '/swfobject.js'
    38                                                       ),
    39                                                 $GLOBALS['template']->smarty
    40                                                 );
    41     } else {
    42       $GLOBALS['template']->func_known_script(array('id' => 'swfobject',
    43                                                     'src' => PWG_CUMULUS_PLUGIN_JS. '/swfobject.js'
    44                                                     ),
    45                                               $GLOBALS['template']->smarty
    46                                               );
     35    $template->set_filenames(array('tags'=> PWG_CUMULUS_PLUGIN_TEMPLATE . '/tags.tpl'));
     36       
     37    $template->assign('PWG_CUMULUS_SWF', PWG_CUMULUS_PLUGIN_SWF);
     38    $template->assign('PWG_CUMULUS_IMGS', PWG_CUMULUS_PLUGIN_IMGS);
     39
     40    $template->assign('PWG_CUMULUS_WIDTH', $this->plugin_config->pwg_cumulus_width);
     41    $template->assign('PWG_CUMULUS_HEIGHT', $this->plugin_config->pwg_cumulus_height);
     42    $template->assign('PWG_CUMULUS_HREF', get_root_url().'tags.php?display_mode=cumulus');
     43
     44    $template->assign('PWG_CUMULUS_MODE_TRANSPARENT', $this->plugin_config->pwg_cumulus_mode_transparent);
     45    $template->assign('PWG_CUMULUS_BGCOLOR', $this->plugin_config->pwg_cumulus_bgcolor);
     46    $template->assign('PWG_CUMULUS_COLOR1', '0x'.$this->plugin_config->pwg_cumulus_color1);
     47    $template->assign('PWG_CUMULUS_COLOR2', '0x'.$this->plugin_config->pwg_cumulus_color2);
     48    $template->assign('PWG_CUMULUS_HICOLOR', '0x'.$this->plugin_config->pwg_cumulus_hicolor);
     49
     50    if (!empty($template->smarty->_tpl_vars['tags'])) {
     51      foreach ($template->smarty->_tpl_vars['tags'] as $key => &$tag) {
     52        $tag['display_name'] = urlencode($tag['name']);
     53        $tag['size'] = $this->plugin_config->pwg_cumulus_coeff * $tag['level'];
     54      }
    4755    }
    48    
    49     $GLOBALS['template']->assign('PWG_CUMULUS_SWF', PWG_CUMULUS_PLUGIN_SWF);
    50     $GLOBALS['template']->assign('PWG_CUMULUS_IMGS', PWG_CUMULUS_PLUGIN_IMGS);
     56  }
    5157
    52     $GLOBALS['template']->assign('PWG_CUMULUS_WIDTH', $this->plugin_config->pwg_cumulus_width);
    53     $GLOBALS['template']->assign('PWG_CUMULUS_HEIGHT', $this->plugin_config->pwg_cumulus_height);
    54     $GLOBALS['template']->assign('PWG_CUMULUS_HREF', get_root_url().'tags.php?display_mode=cumulus');
     58  public function blockmanager_register_blocks($menu_ref_arr) {
     59    if (!$this->plugin_config->pwg_cumulus_in_main_menu) {
     60      return;
     61    }
     62    $menu = &$menu_ref_arr[0];
     63    if ($menu->get_id() != 'menubar') {
     64      return;
     65    }
     66    $menu->register_block(new RegisteredBlock('mbCumulus', 'Cumulus', 'piwigo'));
     67  }
    5568
    56     $GLOBALS['template']->assign('PWG_CUMULUS_COLOR1', '0x'.$this->plugin_config->pwg_cumulus_color1);
    57     $GLOBALS['template']->assign('PWG_CUMULUS_COLOR2', '0x'.$this->plugin_config->pwg_cumulus_color2);
    58     $GLOBALS['template']->assign('PWG_CUMULUS_HICOLOR', '0x'.$this->plugin_config->pwg_cumulus_hicolor);
    5969
    60     if (!empty($GLOBALS['template']->smarty->_tpl_vars['tags'])) {
    61       foreach ($GLOBALS['template']->smarty->_tpl_vars['tags'] as $key => &$tag) {
    62         $tag['display_name'] = urlencode($tag['name']);
    63         $tag['size'] = $this->plugin_config->pwg_cumulus_coeff*$tag['level'];
     70  public function blockmanager_apply($menu_ref_arr) {
     71    global $template;
     72
     73    if (!$this->plugin_config->pwg_cumulus_in_main_menu) {
     74      return;
     75    }
     76
     77    load_language('plugin.lang', PWG_CUMULUS_PLUGIN_LANG);
     78
     79    $menu = &$menu_ref_arr[0];
     80    if ($menu->get_id() != 'menubar') {
     81      return;
     82    }
     83
     84    include_once(PHPWG_ROOT_PATH.'include/block.class.php');
     85
     86    if (($mbCumulus = $menu->get_block('mbTags'))!==null) {
     87      if (empty($mbCumulus->data)) {
     88        return;
    6489      }
     90      if ($this->plugin_config->position_order!=null
     91          && $this->plugin_config->position_block_id!=null) {
     92        $related_block = $menu->get_block($this->plugin_config->position_block_id);
     93        if ($this->plugin_config->position_order=='after') {
     94          $mbCumulus->set_position($related_block->get_position()+1);
     95        } else {
     96          $mbCumulus->set_position($related_block->get_position()-1);
     97        }
     98      }
     99
     100      $template->assign('PWG_CUMULUS_SWF', PWG_CUMULUS_PLUGIN_SWF);
     101      $template->assign('PWG_CUMULUS_IMGS', PWG_CUMULUS_PLUGIN_IMGS);
     102     
     103      $template->assign('PWG_CUMULUS_WIDTH', $this->plugin_config->pwg_cumulus_width);
     104      $template->assign('PWG_CUMULUS_HEIGHT', $this->plugin_config->pwg_cumulus_height);
     105      $template->assign('PWG_CUMULUS_MODE_TRANSPARENT', $this->plugin_config->pwg_cumulus_mode_transparent);
     106      $template->assign('PWG_CUMULUS_BGCOLOR', $this->plugin_config->pwg_cumulus_bgcolor);
     107      $template->assign('PWG_CUMULUS_COLOR1', '0x'.$this->plugin_config->pwg_cumulus_color1);
     108      $template->assign('PWG_CUMULUS_COLOR2', '0x'.$this->plugin_config->pwg_cumulus_color2);
     109      $template->assign('PWG_CUMULUS_HICOLOR', '0x'.$this->plugin_config->pwg_cumulus_hicolor);
     110      foreach ($mbCumulus->data as &$tag) {
     111        $tag['size'] = $this->plugin_config->pwg_cumulus_coeff * $tag['level'];
     112        if (!empty($tag['U_ADD'])) {
     113          $tag['URL'] = $tag['U_ADD'];
     114        }
     115      }
     116      $template->assign('PWG_CUMULUS_TAGS', $mbCumulus->data);
     117      $mbCumulus->template = PWG_CUMULUS_PLUGIN_TEMPLATE . '/menubar_tags.tpl';
    65118    }
    66119  }
Note: See TracChangeset for help on using the changeset viewer.