Changeset 26115


Ignore:
Timestamp:
Dec 23, 2013, 1:38:24 PM (10 years ago)
Author:
nikrou
Message:

Fix compatibility with piwigo 2.6 (smarty, i18n plural)

Location:
extensions/pwgCumulus
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/pwgCumulus/CHANGELOG

    r22066 r26115  
     1pwgCumulus 0.8.0 - 2013-12-23
     2================================
     3* Fix compatibility with piwigo 2.6 (smarty, i18n plural)
     4
    15pwgCumulus 0.7.1 - 2013-04-08
    26================================
  • extensions/pwgCumulus/include/pwgCumulusContent.class.php

    r21469 r26115  
    2222class pwgCumulusContent
    2323{
    24   public function __construct($config) {
    25     $this->plugin_config = $config;
    26   }
    27 
    28   public function loc_begin_page_header() {
    29     global $template;
    30 
    31     if (!empty($_GET['display_mode']) && $_GET['display_mode']=='cumulus') {
    32       $template->assign('display_mode', 'cumulus');
     24    public function __construct($config) {
     25        $this->plugin_config = $config;
    3326    }
    3427
    35     $template->set_filenames(array('tags'=> PWG_CUMULUS_PLUGIN_TEMPLATE . '/tags.tpl'));
     28    public function loc_begin_page_header() {
     29        global $template;
     30
     31        if (!empty($_GET['display_mode']) && $_GET['display_mode']=='cumulus') {
     32            $template->assign('display_mode', 'cumulus');
     33        }
     34
     35        $template->set_filenames(array('tags'=> PWG_CUMULUS_PLUGIN_TEMPLATE . '/tags.tpl'));
    3636       
    37     $template->assign('PWG_CUMULUS_SWF', PWG_CUMULUS_PLUGIN_SWF);
    38     $template->assign('PWG_CUMULUS_IMGS', PWG_CUMULUS_PLUGIN_IMGS);
     37        $template->assign('PWG_CUMULUS_SWF', PWG_CUMULUS_PLUGIN_SWF);
     38        $template->assign('PWG_CUMULUS_IMGS', PWG_CUMULUS_PLUGIN_IMGS);
    3939
    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');
     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');
    4343
    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);
     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);
    4949
    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       }
     50        if (!empty($template->smarty->tpl_vars['tags'])) {
     51            foreach ($template->smarty->tpl_vars['tags']->value as $key => &$tag) {
     52                $tag['display_name'] = urlencode($tag['name']);
     53                $tag['size'] = $this->plugin_config->pwg_cumulus_coeff * $tag['level'];
     54            }
     55        }
    5556    }
    56   }
    5757
    58   public function blockmanager_register_blocks($menu_ref_arr) {
    59     if (!$this->plugin_config->pwg_cumulus_in_main_menu) {
    60       return;
     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'));
    6167    }
    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   }
    6868
    6969
    70   public function blockmanager_apply($menu_ref_arr) {
    71     global $template;
     70    public function blockmanager_apply($menu_ref_arr) {
     71        global $template;
    7272
    73     if (!$this->plugin_config->pwg_cumulus_in_main_menu) {
    74       return;
     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;
     89            }
     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';
     118        }
    75119    }
    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;
    89       }
    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';
    118     }
    119   }
    120120}
  • extensions/pwgCumulus/language/ar_SA/plugin.lang.php

    r24857 r26115  
    6363$lang['Transparent mode is used'] = 'يتم استخدام طريقة شفافة';
    6464$lang['You can choose to add cumulus tag cloud in menu. You can define tags cloud position in the main menu by choosing its position related to another block'] = 'يمكنك الاختيار بان يضاف وسم السحاب الركامي في القائمة. يمكنك تحديد وضع وسم السحاب في القائمة الرئيسية اختيار وضعها المرتبط ببلوك اخر';
    65 ?>
  • extensions/pwgCumulus/language/nb_NO/plugin.lang.php

    r26020 r26115  
     1<?php
    12// +-----------------------------------------------------------------------+
    23// | pwgCumulus  - a plugin for Piwigo                                     |
     
    5859$lang['Transparent mode is not used'] = 'Gjennomsiktig modus ikke i bruk';
    5960$lang['Transparent mode is used'] = 'Gjennomsiktig modus i bruk';
    60 ?>
  • extensions/pwgCumulus/main.inc.php

    r22066 r26115  
    2222/*
    2323Plugin Name: pwgCumulus
    24 Version: 0.7.1
     24Version: 0.8.0
    2525Description: add an amazing tag cloud
    2626Plugin URI: http://piwigo.org/ext/extension_view.php?eid=263
  • extensions/pwgCumulus/template/tags.tpl

    r22066 r26115  
    3838  <div id="fullTagCloud">
    3939    {foreach from=$tags item=tag}
    40     <span><a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)}">{$tag.name}</a></span>
     40    <span><a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{$tag.counter|translate_dec:'%d photo':'%d photos'}">{$tag.name}</a></span>
    4141    {/foreach}
    4242  </div>
     
    6868            <tr class="tagLine">
    6969              <td><a href="{$tag.URL}">{$tag.name}</a></td>
    70               <td class="nbEntries">{$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)}</td>
     70              <td class="nbEntries">{$tag.counter|translate_dec:'%d photo':'%d photos'}</td>
    7171            </tr>
    7272            {/foreach}
Note: See TracChangeset for help on using the changeset viewer.