Changeset 15121


Ignore:
Timestamp:
May 19, 2012, 1:11:01 PM (9 years ago)
Author:
mistic100
Message:

update for Piwigo 2.4
change previews with new G+1 appearance
add Annotation parameter

Location:
extensions/GooglePlusOne
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • extensions/GooglePlusOne/admin.php

    r11600 r15121  
    55
    66load_language('plugin.lang', GPLUS1_PATH);
    7 $conf['GooglePlusOne'] = explode(',', $conf['GooglePlusOne']);
     7$conf['GooglePlusOne'] = unserialize($conf['GooglePlusOne']);
    88
    99if (isset($_POST['submit']))
    1010{
    1111  $conf['GooglePlusOne'] = array(
    12     $_POST['button_size'],
    13     $_POST['position'],
     12    'size' => $_POST['button_size'],
     13    'position' => $_POST['position'],
     14    'annotation' => $_POST['annotation'],
    1415    );
    1516 
    16   conf_update_param('GooglePlusOne', implode(',', $conf['GooglePlusOne']));
     17  conf_update_param('GooglePlusOne', serialize($conf['GooglePlusOne']));
    1718  array_push($page['infos'], l10n('Information data registered in database'));
    1819 
     
    2223
    2324$template->assign(array(
    24   'button_size' => $conf['GooglePlusOne'][0],
    25   'position' => $conf['GooglePlusOne'][1],
     25  'button_size' => $conf['GooglePlusOne']['size'],
     26  'position' => $conf['GooglePlusOne']['position'],
     27  'annotation' => $conf['GooglePlusOne']['annotation'],
    2628  'GPLUS1_PATH' => GPLUS1_PATH,
    2729));
  • extensions/GooglePlusOne/admin.tpl

    r11600 r15121  
    88
    99    <table class="gplus1_buttons">
     10      <tr class="property">
     11        <td>
     12          {'Button size'|@translate}
     13        </td>
     14        <td></td>
     15      </tr>
    1016      <tr>
    1117        <td><label>
     18          15px
    1219          <img src="{$GPLUS1_PATH}images/small.png"/>
    1320          <input type="radio" name="button_size" value="small" {if $button_size == 'small'}checked="checked"{/if}/>
    1421        </label></td>
    1522        <td><label>
     23          20px
    1624          <img src="{$GPLUS1_PATH}images/medium.png"/>
    1725          <input type="radio" name="button_size" value="medium" {if $button_size == 'medium'}checked="checked"{/if}/>
     
    2028      <tr>
    2129        <td><label>
     30          24px
    2231          <img src="{$GPLUS1_PATH}images/standard.png"/>
    2332          <input type="radio" name="button_size" value="standard" {if $button_size == 'standard'}checked="checked"{/if}/>
    2433        </label></td>
    2534        <td><label>
     35          60px
    2636          <img src="{$GPLUS1_PATH}images/tall.png"/>
    2737          <input type="radio" name="button_size" value="tall" {if $button_size == 'tall'}checked="checked"{/if}/>
     
    3949        </td>
    4050      </tr>
     51     
     52      <tr class="property">
     53        <td>
     54          {'Annotation'|@translate}
     55        </td>
     56        <td>
     57          <label><input type="radio" name="annotation" value="none" {if $annotation == 'none'}checked="checked"{/if}/> {'None'|@translate}</label>
     58          <label><input type="radio" name="annotation" value="bubble" {if $annotation == 'bubble'}checked="checked"{/if}/> {'Bubble'|@translate}</label>
     59          <label><input type="radio" name="annotation" value="inline" {if $annotation == 'inline'}checked="checked"{/if}/> {'Inline text'|@translate}</label>
     60        </td>
     61      </tr>
    4162      <tr class="submit">
    4263        <td colspan="2">
  • extensions/GooglePlusOne/images/index.php

    r11600 r15121  
    33// | Piwigo - a PHP based photo gallery                                    |
    44// +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
     5// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
    66// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    77// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
  • extensions/GooglePlusOne/index.php

    r11600 r15121  
    33// | Piwigo - a PHP based photo gallery                                    |
    44// +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
     5// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
    66// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    77// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
  • extensions/GooglePlusOne/language/en_UK/plugin.lang.php

    r11600 r15121  
    55$lang['Bottom'] = 'Bottom';
    66$lang['Toolbar'] = 'Toolbar';
     7$lang['Button size'] = 'Button size';
     8$lang['Annotation'] = 'Annotation';
     9$lang['Bubble'] = 'Bubble';
     10$lang['Inline text'] = 'Inline text';
    711
    812?>
  • extensions/GooglePlusOne/language/fr_FR/plugin.lang.php

    r11600 r15121  
    55$lang['Bottom'] = 'Bas';
    66$lang['Toolbar'] = 'Barre d\'outils';
     7$lang['Button size'] = 'Taille du bouton';
     8$lang['Annotation'] = 'Annotation';
     9$lang['Bubble'] = 'Bulle';
     10$lang['Inline text'] = 'Texte simple';
    711
    812?>
  • extensions/GooglePlusOne/main.inc.php

    r11600 r15121  
    2222  global $conf, $template, $user;
    2323 
    24   $conf['GooglePlusOne'] = explode(',', $conf['GooglePlusOne']);
     24  $conf['GooglePlusOne'] = unserialize($conf['GooglePlusOne']);
    2525  $conf['GooglePlusOne']['lang'] = array(
    26     'ar','bg','ca','hr','cs','da','nl','et','fi','fr','de','el','iw','hi',
    27     'hu','id','it','ja','ko','lv','lt','ms','no','fa','pl','ro','ru','sr',
    28     'sk','sl','es','sv','th','tr','uk','vi'
     26    'ar','bg','ca','zh-CN','zh-TW','hr','cs','da','nl','en-US','en-GB','et','fi','fr','de',
     27    'el','iw','hi','hu','id','it','ja','ko','lv','lt','ms','no','fa','pl','pt-BR','pt-PT',
     28    'ro','ru','sr','sk','sl','es','sv','th','tr','uk','vi',
    2929    );
     30   
     31  $template->assign(array(
     32    'GPLUS1_SIZE' => $conf['GooglePlusOne']['size'],
     33    'GPLUS1_ANNO' => $conf['GooglePlusOne']['annotation'],
     34  ));
    3035 
    3136  if (script_basename() == 'picture')
    3237  {
    33     $template->assign(array(
    34       'GPLUS1_SIZE' => $conf['GooglePlusOne'][0],
    35       'GPLUS1_POSITON' => $conf['GooglePlusOne'][1],
    36     ));
    37        
     38    $template->assign('GPLUS1_POSITON', $conf['GooglePlusOne']['position']);
    3839    $template->set_prefilter('picture', 'gplus1_add_button_prefilter');
    3940  }
    4041  else if (script_basename() == 'index')
    4142  {
    42     $template->assign(array(
    43       'GPLUS1_SIZE' => $conf['GooglePlusOne'][0],
    44       'GPLUS1_POSITON' => 'index',
    45     ));
    46        
     43    $template->assign('GPLUS1_POSITON', 'index');
    4744    $template->set_prefilter('index', 'gplus1_add_button_prefilter');
    4845  }
    4946 
    5047  // if the link is in the toolbar, we must use smallier buttons
    51   if ( script_basename() == 'index' OR  $conf['GooglePlusOne'][1] == 'toolbar')
     48  if ( script_basename() == 'index' OR  $conf['GooglePlusOne']['position'] == 'toolbar')
    5249  {
    53     if ($conf['GooglePlusOne'][0] == 'tall')
     50    if ($conf['GooglePlusOne']['size'] == 'tall' AND $conf['GooglePlusOne']['annotation'] == 'bubble')
    5451    {
    5552        $template->assign('GPLUS1_SIZE', 'standard');
     
    5855 
    5956  // button language
     57  if ( in_array(str_replace('_','-',$user['language']), $conf['GooglePlusOne']['lang']) )
     58  {
     59    $template->assign('GPLUS1_LANG', str_replace('_','-',$user['language']));
     60  }
    6061  if ( in_array(substr($user['language'],0,2), $conf['GooglePlusOne']['lang']) )
    6162  {
     
    7273  global $template;
    7374 
     75  $replace = '{combine_script id=\'google_plusone\' path=\'https://apis.google.com/js/plusone.js\'}
     76<script type="text/javascript">window.___gcfg = {ldelim}lang: \'{$GPLUS1_LANG}\'};</script>
     77<g:plusone size="{$GPLUS1_SIZE}" annotation="{$GPLUS1_ANNO}"></g:plusone>';
     78 
    7479  switch ($template->get_template_vars('GPLUS1_POSITON'))
    7580  {
    7681    case 'top':
    7782      $search = '<div id="theImage">';
    78       $replace = '<div><g:plusone size="{$GPLUS1_SIZE}"></g:plusone></div>';
     83      $replace = '<div>'.$replace.'</div>';
    7984      break;
    8085     
    8186    case 'bottom':
    8287      $search = '{$ELEMENT_CONTENT}';
    83       $replace = '<g:plusone size="{$GPLUS1_SIZE}"></g:plusone>';
    8488      break;
    8589     
    8690    case 'toolbar':
    87       $search = '{*caddie management END*}';
    88       $replace = '<g:plusone size="{$GPLUS1_SIZE}"></g:plusone>';
     91      $search = '<div class="actionButtons">';
    8992      break;
    9093     
    9194    case 'index': 
    9295      $search = '<ul class="categoryActions">';
    93       $replace = '<li><g:plusone size="{$GPLUS1_SIZE}"></g:plusone></li>';
     96      $replace = '<li>'.$replace.'</li>';
    9497      break;
    9598  }
    96   $replace = $search.$replace.'
    97 {combine_script id=\'google_plusone\' path=\'https://apis.google.com/js/plusone.js\'}
    98 <script type="text/javascript">{ldelim}lang: \'{$GPLUS1_LANG}\'}</script>';
    9999
    100   return str_replace($search, $replace, $content);
     100  return str_replace($search, $search.$replace, $content);
    101101}
    102102
     
    108108  function gplus1_plugin_admin_menu($menu)
    109109  {
    110     array_push(
    111       $menu,
    112       array(
    113         'NAME' => 'Google+1',
    114         'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
    115         )
    116       );
    117    
     110    array_push($menu, array(
     111      'NAME' => 'Google+1',
     112      'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
     113      ));
    118114    return $menu;
    119115  }
  • extensions/GooglePlusOne/maintain.inc.php

    r11600 r15121  
    11<?php
    22function plugin_install()
    3 {
    4   pwg_query('INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("GooglePlusOne","medium,toolbar","GooglePlusOne config");');
     3{
     4  $conf = array(
     5    'size' => 'medium',
     6    'position' => 'toolbar',
     7    'annotation' => 'inline',
     8    );
     9     
     10  conf_update_param('GooglePlusOne', serialize($conf));
     11}
     12
     13function plugin_activate()
     14{
     15  global $conf;
     16 
     17  if (@unserialize($conf['GooglePlusOne']) === false)
     18  {
     19    $conf = explode(',', $conf['GooglePlusOne']);
     20    $conf = array(
     21      'size' => $conf[0],
     22      'position' => $conf[1],
     23      'annotation' => 'bubble',
     24      );
     25     
     26    conf_update_param('GooglePlusOne', serialize($conf));
     27  }
    528}
    629
Note: See TracChangeset for help on using the changeset viewer.