Changeset 15122


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

update for Piwigo 2.4
change previews with new Twitter appearance
remove all custom buttons, keep only official
new options: display counter and via

Location:
extensions/TweetThis
Files:
2 added
3 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • extensions/TweetThis/admin.php

    r11425 r15122  
    55
    66load_language('plugin.lang', TWEET_PATH);
    7 $conf['TweetThis'] = explode(',', $conf['TweetThis']);
     7$conf['TweetThis'] = unserialize($conf['TweetThis']);
    88
    99if (isset($_POST['submit']))
    1010{
    1111  $conf['TweetThis'] = array(
    12     $_POST['button_style'],
    13     $_POST['position'],
     12    'size' => $_POST['button_size'],
     13    'position' => $_POST['position'],
     14    'count' => isset($_POST['count']),
     15    'via' => trim($_POST['via']),
    1416    );
    1517 
    16   conf_update_param('TweetThis', implode(',', $conf['TweetThis']));
     18  conf_update_param('TweetThis', serialize($conf['TweetThis']));
    1719  array_push($page['infos'], l10n('Information data registered in database'));
    1820 
     
    2224
    2325$template->assign(array(
    24   'button_style' => $conf['TweetThis'][0],
    25   'position' => $conf['TweetThis'][1],
     26  'button_size' => $conf['TweetThis']['size'],
     27  'position' => $conf['TweetThis']['position'],
     28  'count_check' => $conf['TweetThis']['count'] ? 'checked="checked"' : null,
     29  'via' => $conf['TweetThis']['via'],
    2630  'TWEET_PATH' => TWEET_PATH,
    2731));
  • extensions/TweetThis/admin.tpl

    r11514 r15122  
    88
    99    <table class="twitter_buttons">
    10       <tr>
    11         <td><label>
    12           <img src="{$TWEET_PATH}images/tweeth.png"/>
    13           <input type="radio" name="button_style" value="horizontal" {if $button_style == 'horizontal'}checked="checked"{/if}/>
    14         </label></td>
    15         <td><label>
    16           <img src="{$TWEET_PATH}images/tweetv.png"/>
    17           <input type="radio" name="button_style" value="vertical" {if $button_style == 'vertical'}checked="checked"{/if}/>
    18         </label></td>
    19         <td><label>
    20           <img src="{$TWEET_PATH}images/tweetn.png"/>
    21           <input type="radio" name="button_style" value="none" {if $button_style == 'none'}checked="checked"{/if}/>
    22         </label></td>
    23         <td>&nbsp;</td>
     10      <tr class="property">
     11        <td>
     12          {'Button size'|@translate}
     13        </td>
     14        <td></td>
    2415      </tr>
    2516      <tr>
    2617        <td><label>
    27           <img src="http://twitter-badges.s3.amazonaws.com/twitter-a.png"/>
    28           <input type="radio" name="button_style" value="twitter-a" {if $button_style == 'twitter-a'}checked="checked"{/if}/>
     18          <img src="{$TWEET_PATH}images/small.png"/>
     19          <input type="radio" name="button_size" value="small" {if $button_size == 'small'}checked="checked"{/if}/>
    2920        </label></td>
    3021        <td><label>
    31           <img src="http://twitter-badges.s3.amazonaws.com/t_logo-a.png"/>
    32           <input type="radio" name="button_style" value="t_logo-a" {if $button_style == 't_logo-a'}checked="checked"{/if}/>
    33         </label></td>
    34         <td><label>
    35           <img src="http://twitter-badges.s3.amazonaws.com/t_small-a.png"/>
    36           <input type="radio" name="button_style" value="t_small-a" {if $button_style == 't_small-a'}checked="checked"{/if}/>
    37         </label></td>
    38         <td><label>
    39           <img src="http://twitter-badges.s3.amazonaws.com/t_mini-a.png"/>
    40           <input type="radio" name="button_style" value="t_mini-a" {if $button_style == 't_mini-a'}checked="checked"{/if}/>
     22          <img src="{$TWEET_PATH}images/large.png"/>
     23          <input type="radio" name="button_size" value="large" {if $button_size == 'large'}checked="checked"{/if}/>
    4124        </label></td>
    4225      </tr>
    43       <tr>
    44         <td><label>
    45           <img src="http://twitter-badges.s3.amazonaws.com/twitter-b.png"/>
    46           <input type="radio" name="button_style" value="twitter-b" {if $button_style == 'twitter-b'}checked="checked"{/if}/>
    47         </label></td>
    48         <td><label>
    49           <img src="http://twitter-badges.s3.amazonaws.com/t_logo-b.png"/>
    50           <input type="radio" name="button_style" value="t_logo-b" {if $button_style == 't_logo-b'}checked="checked"{/if}/>
    51         </label></td>
    52         <td><label>
    53           <img src="http://twitter-badges.s3.amazonaws.com/t_small-b.png"/>
    54           <input type="radio" name="button_style" value="t_small-b" {if $button_style == 't_small-b'}checked="checked"{/if}/>
    55         </label></td>
    56         <td><label>
    57           <img src="http://twitter-badges.s3.amazonaws.com/t_mini-b.png"/>
    58           <input type="radio" name="button_style" value="t_mini-b" {if $button_style == 't_mini-b'}checked="checked"{/if}/>
    59         </label></td>
     26      <tr class="property">
     27        <td>
     28          <label for="count">{'Display counter'|@translate}</label>
     29        </td>
     30        <td>
     31          <input type="checkbox" id="count" name="count" value="1" {$count_check}/>
     32        </td>
    6033      </tr>
    61       <tr>
    62         <td><label>
    63           <img src="http://twitter-badges.s3.amazonaws.com/twitter-c.png"/>
    64           <input type="radio" name="button_style" value="twitter-c" {if $button_style == 'twitter-c'}checked="checked"{/if}/>
    65         </label></td>
    66         <td><label>
    67           <img src="http://twitter-badges.s3.amazonaws.com/t_logo-c.png"/>
    68           <input type="radio" name="button_style" value="t_logo-c" {if $button_style == 't_logo-c'}checked="checked"{/if}/>
    69         </label></td>
    70         <td><label>
    71           <img src="http://twitter-badges.s3.amazonaws.com/t_small-c.png"/>
    72           <input type="radio" name="button_style" value="t_small-c" {if $button_style == 't_small-c'}checked="checked"{/if}/>
    73         </label></td>
    74         <td><label>
    75           <img src="http://twitter-badges.s3.amazonaws.com/t_mini-c.png"/>
    76           <input type="radio" name="button_style" value="t_mini-c" {if $button_style == 't_mini-c'}checked="checked"{/if}/>
    77         </label></td>
    78       </tr>
    79      
    8034      <tr class="property">
    81         <td colspan="2">
     35        <td>
    8236          {'Button position on picture page'|@translate}
    8337        </td>
    84         <td colspan="2">
     38        <td>
    8539          <label><input type="radio" name="position" value="top" {if $position == 'top'}checked="checked"{/if}/> {'Top'|@translate}</label>
    8640          <label><input type="radio" name="position" value="bottom" {if $position == 'bottom'}checked="checked"{/if}/> {'Bottom'|@translate}</label>
     
    8842        </td>
    8943      </tr>
     44      <tr class="property">
     45        <td>
     46          {'Via'|@translate}
     47        </td>
     48        <td>
     49          @ <input type="text" name="via" value="{$via}"/>
     50        </td>
     51      </tr>
    9052      <tr class="submit">
    91         <td colspan="4">
     53        <td colspan="2">
    9254          <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" />
    9355        </td>
  • extensions/TweetThis/language/ca_ES/plugin.lang.php

    r14738 r15122  
    2323$lang['Bottom'] = 'Inferior';
    2424$lang['Button position on picture page'] = 'Posició del botó a la pàgina de la imatge';
    25 $lang['Share on Twitter'] = 'Compartir a Twitter';
    2625$lang['Toolbar'] = 'Barra d\'eines';
    2726$lang['Top'] = 'Superior';
  • extensions/TweetThis/language/cs_CZ/plugin.lang.php

    r11504 r15122  
    55$lang['Bottom'] = 'Dole';
    66$lang['Toolbar'] = 'Panel nástrojů';
    7 $lang['Share on Twitter'] = 'Sdílet na Twitteru';
    87
    98?>
  • extensions/TweetThis/language/de_DE/plugin.lang.php

    r13127 r15122  
    2323$lang['Bottom'] = 'Unten';
    2424$lang['Button position on picture page'] = 'Tastenposition auf der Bilderseite';
    25 $lang['Share on Twitter'] = 'Auf Twitter teilen';
    2625$lang['Toolbar'] = 'Symbolleiste';
    2726$lang['Top'] = 'Oben';
  • extensions/TweetThis/language/el_GR/plugin.lang.php

    r14953 r15122  
    2323$lang['Bottom'] = 'Κάτω μέρος';
    2424$lang['Button position on picture page'] = 'θέση Κουμπιού στη σελίδα της εικόνας';
    25 $lang['Share on Twitter'] = 'Μοιραστείτε το στο Twitter';
    2625$lang['Toolbar'] = 'Γραμμή Εργαλείων';
    2726$lang['Top'] = 'Κορυφή';
  • extensions/TweetThis/language/en_UK/plugin.lang.php

    r11476 r15122  
    55$lang['Bottom'] = 'Bottom';
    66$lang['Toolbar'] = 'Toolbar';
    7 $lang['Share on Twitter'] = 'Share on Twitter';
     7$lang['Button size'] = 'Button size';
     8$lang['Display counter'] = 'Display counts';
     9$lang['Via'] = 'Via';
    810
    911?>
  • extensions/TweetThis/language/es_ES/plugin.lang.php

    r11533 r15122  
    55$lang['Bottom'] = 'Abajo';
    66$lang['Toolbar'] = 'Barra de herramientas';
    7 $lang['Share on Twitter'] = 'Compartir en Twitter';
    87
    98?>
  • extensions/TweetThis/language/fr_FR/plugin.lang.php

    r11476 r15122  
    55$lang['Bottom'] = 'Bas';
    66$lang['Toolbar'] = 'Barre d\'outils';
    7 $lang['Share on Twitter'] = 'Partager sur Twitter';
     7$lang['Button size'] = 'Taille du bouton';
     8$lang['Display counter'] = 'Afficcher le compteur';
     9$lang['Via'] = 'Via';
    810
    911?>
  • extensions/TweetThis/language/hu_HU/plugin.lang.php

    r11774 r15122  
    55$lang['Bottom'] = 'Lent';
    66$lang['Toolbar'] = 'Eszköztár';
    7 $lang['Share on Twitter'] = 'Megosztás a Twitteren';
    87
    98?>
  • extensions/TweetThis/language/it_IT/plugin.lang.php

    r11605 r15122  
    55$lang['Bottom'] = 'Basso';
    66$lang['Toolbar'] = 'Barra degli strumenti';
    7 $lang['Share on Twitter'] = 'Condividere su Twitter';
    87
    98?>
  • extensions/TweetThis/language/lv_LV/plugin.lang.php

    r11643 r15122  
    55$lang['Bottom'] = 'Apakšā';
    66$lang['Toolbar'] = 'Rīkjoslā';
    7 $lang['Share on Twitter'] = 'Dalīties Tviterī';
    87
    98?>
  • extensions/TweetThis/language/nl_NL/plugin.lang.php

    r12050 r15122  
    44$lang['Bottom'] = 'Onder';
    55$lang['Toolbar'] = 'Werkbalk';
    6 $lang['Share on Twitter'] = 'Deel op Twitter';
    76$lang['Button position on picture page'] = 'Knop positie op afbeelding pagina';
    87
  • extensions/TweetThis/language/pl_PL/plugin.lang.php

    r12143 r15122  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['Share on Twitter'] = 'Udostępnij na Twitterze';
    2423$lang['Bottom'] = 'Dół';
    2524$lang['Button position on picture page'] = 'Miejsce umieszczenia przycisku';
  • extensions/TweetThis/language/pt_PT/plugin.lang.php

    r14501 r15122  
    2323$lang['Bottom'] = 'Base';
    2424$lang['Button position on picture page'] = 'Posição do botão na página da foto';
    25 $lang['Share on Twitter'] = 'Partilhar no Twiter';
    2625$lang['Toolbar'] = 'Barra de tarefas';
    2726$lang['Top'] = 'Topo';
  • extensions/TweetThis/language/ru_RU/plugin.lang.php

    r11643 r15122  
    55$lang['Bottom'] = 'Внизу';
    66$lang['Toolbar'] = 'На панели инструментов';
    7 $lang['Share on Twitter'] = 'Опубликовать в Twitter';
    87
    98?>
  • extensions/TweetThis/language/sk_SK/plugin.lang.php

    r11885 r15122  
    44$lang['Bottom'] = 'Dole';
    55$lang['Toolbar'] = 'Lišta nástrojov';
    6 $lang['Share on Twitter'] = 'Zdieľať na Twitteri';
    76$lang['Button position on picture page'] = 'Tlačidlo pozície na stránke fotiek';
    87
  • extensions/TweetThis/language/sv_SE/plugin.lang.php

    r11796 r15122  
    44$lang['Bottom'] = 'Botten';
    55$lang['Toolbar'] = 'Verktygsfältet';
    6 $lang['Share on Twitter'] = 'Dela på Twitter';
    76$lang['Button position on picture page'] = 'Knappens position på sidan';
    87
  • extensions/TweetThis/language/tr_TR/plugin.lang.php

    r11476 r15122  
    55$lang['Bottom'] = 'Alt';
    66$lang['Toolbar'] = 'menübar';
    7 $lang['Share on Twitter'] = 'Twitter\'da paylaş';
    87
    98?>
  • extensions/TweetThis/language/uk_UA/plugin.lang.php

    r13429 r15122  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['Share on Twitter'] = 'Поділитись на Twitter';
    2423$lang['Bottom'] = 'Низ';
    2524$lang['Button position on picture page'] = 'Положення кнопки на сторінці зображення';
  • extensions/TweetThis/language/vi_VN/plugin.lang.php

    r11534 r15122  
    55$lang['Bottom'] = 'Dưới cùng';
    66$lang['Toolbar'] = 'Thanh công cụ';
    7 $lang['Share on Twitter'] = 'Chia sẻ qua Twitter';
    87
    98?>
  • extensions/TweetThis/main.inc.php

    r12388 r15122  
    2020function tweet_add_button()
    2121{
    22   global $conf, $template;
    23   $conf['TweetThis'] = explode(',', $conf['TweetThis']);
     22  global $conf, $template, $user;
     23 
     24  $conf['TweetThis'] = unserialize($conf['TweetThis']);
     25  $conf['TweetThis']['lang'] = array(
     26    'no','de','zh-cn','en','pl','sv','zh-tw','tr','es','th','fa','hu','pt','it','ar','he',
     27    'ko','id','ru','ja','da','fi','hi','ur','fr','nl',
     28    );
     29 
     30  $template->assign(array(
     31    'TWEET_SIZE' => $conf['TweetThis']['size'],
     32    'TWEET_COUNT' => $conf['TweetThis']['count'],
     33    'TWEET_VIA' => $conf['TweetThis']['via'],
     34  ));
    2435 
    2536  if (script_basename() == 'picture')
    2637  {
    27     $template->assign(array(
    28       'TWEET_IMAGE' => $conf['TweetThis'][0],
    29       'TWEET_POSITON' => $conf['TweetThis'][1],
    30     ));
    31        
     38    $template->assign('TWEET_POSITON', $conf['TweetThis']['position']);
    3239    $template->set_prefilter('picture', 'tweet_add_button_prefilter');
    3340  }
    3441  else if (script_basename() == 'index')
    3542  {
    36     $template->assign(array(
    37       'TWEET_IMAGE' => $conf['TweetThis'][0],
    38       'TWEET_POSITON' => 'index',
    39     ));
    40        
     43    $template->assign('TWEET_POSITON', 'index');
    4144    $template->set_prefilter('index', 'tweet_add_button_prefilter');
    4245  }
    4346 
    44   // html change a bit if we use custom button, or official with counter
    45   if ( in_array( $conf['TweetThis'][0], array('none','horizontal','vertical') ) )
     47  // button language
     48  if ( in_array(str_replace('_','-',strtolower($user['language'])), $conf['TweetThis']['lang']) )
    4649  {
    47     $template->assign(array(
    48       'TWEET_IFRAME' => true,
    49       'TWEET_COUNTER' => $conf['TweetThis'][0],
    50     ));
     50    $template->assign('TWEET_LANG', str_replace('_','-',strtolower($user['language'])));
     51  }
     52  if ( in_array(substr($user['language'],0,2), $conf['TweetThis']['lang']) )
     53  {
     54    $template->assign('TWEET_LANG', substr($user['language'],0,2));
    5155  }
    5256  else
    5357  {
    54     $template->assign(array(
    55       'TWEET_IFRAME' => false,
    56       'TWEET_COUNTER' => 'none',
    57     ));
    58   }
    59  
    60   // if the link is in the toolbar, we must use smallier buttons
    61   if ( script_basename() == 'index' OR  $conf['TweetThis'][1] == 'toolbar')
    62   {
    63     switch ($conf['TweetThis'][0])
    64     {
    65       case 'vertical':
    66         $template->assign('TWEET_COUNTER', 'horizontal'); break;
    67       case 't_logo-a':
    68         $template->assign('TWEET_IMAGE', 't_small-a'); break;
    69       case 't_logo-b':
    70         $template->assign('TWEET_IMAGE', 't_small-b'); break;
    71       case 't_logo-c':
    72         $template->assign('TWEET_IMAGE', 't_small-c'); break;
    73     }
     58    $template->assign('TWEET_LANG', 'en');
    7459  }
    7560}
     
    7964  global $template;
    8065 
     66  $replace = '{combine_script id=\'twitter_widgets\' path=\'http://platform.twitter.com/widgets.js}
     67  <a href="https://twitter.com/share" class="twitter-share-button" data-lang="{$TWEET_LANG}" {if not empty($TWEET_VIA)}data-via="{$TWEET_VIA}"{/if} {if $TWEET_SIZE=="large"}data-size="large"{/if} {if not $TWEET_COUNT}data-count="none"{/if}>Tweet</a>';
     68 
    8169  switch ($template->get_template_vars('TWEET_POSITON'))
    8270  {
    8371    case 'top':
    8472      $search = '<div id="theImage">';
    85       $replace = '
    86 <div><a href="javascript:phpWGOpenWindow(\'http://twitter.com/share?count={$TWEET_COUNTER}\', \'{\'Share on Twitter\'|@translate}\', \'scrollbars=yes,width=550,height=370\')"
    87         class="{if $TWEET_IFRAME}twitter-share-button{/if}" title="{\'Share on Twitter\'|@translate}">
    88   {if $TWEET_IFRAME}Tweet{else}<img src="http://twitter-badges.s3.amazonaws.com/{$TWEET_IMAGE}.png"/>{/if}
    89 </a></div>
    90 ';
     73      $replace = '<div>'.$replace.'</div>';
    9174      break;
    9275     
    9376    case 'bottom':
    9477      $search = '{$ELEMENT_CONTENT}';
    95       $replace = '
    96 <a href="javascript:phpWGOpenWindow(\'http://twitter.com/share?count={$TWEET_COUNTER}\', \'{\'Share on Twitter\'|@translate}\', \'scrollbars=yes,width=550,height=370\')"
    97     class="{if $TWEET_IFRAME}twitter-share-button{/if}" title="{\'Share on Twitter\'|@translate}">
    98   {if $TWEET_IFRAME}Tweet{else}<img src="http://twitter-badges.s3.amazonaws.com/{$TWEET_IMAGE}.png"/>{/if}
    99 </a>
    100 ';
    10178      break;
    10279     
    10380    case 'toolbar':
    104       $search = '{*caddie management END*}';
    105       $replace = '
    106 <a href="javascript:phpWGOpenWindow(\'http://twitter.com/share?count={$TWEET_COUNTER}\', \'{\'Share on Twitter\'|@translate}\', \'scrollbars=yes,width=550,height=370\')"
    107     class="{if $TWEET_IFRAME}twitter-share-button{/if} pwg-button" title="{\'Share on Twitter\'|@translate}">
    108   {if $TWEET_IFRAME}Tweet{else}<img src="http://twitter-badges.s3.amazonaws.com/{$TWEET_IMAGE}.png"/>{/if}
    109 </a>
    110 ';
     81      $search = '<div class="actionButtons">';
    11182      break;
    11283     
    11384    case 'index': 
    11485      $search = '<ul class="categoryActions">';
    115       $replace = '
    116 {combine_script id=\'scripts\' path=\'themes/default/js/scripts.js\'}
    117 <li><a href="javascript:phpWGOpenWindow(\'http://twitter.com/share?count={$TWEET_COUNTER}\', \'{\'Share on Twitter\'|@translate}\', \'scrollbars=yes,width=550,height=370\')"
    118         class="{if $TWEET_IFRAME}twitter-share-button{/if} pwg-button" title="{\'Share on Twitter\'|@translate}">
    119   {if $TWEET_IFRAME}Tweet{else}<img src="http://twitter-badges.s3.amazonaws.com/{$TWEET_IMAGE}.png"/>{/if}
    120 </a></li>
    121 ';
     86      $replace = '<li>'.$replace.'</li>';
    12287      break;
    12388  }
    12489 
    125   $replace = $search . $replace . '{if $TWEET_IFRAME}{combine_script id=\'twitter_widgets\' path=\'http://platform.twitter.com/widgets.js}{/if}';
    126 
    127   return str_replace($search, $replace, $content);
     90  return str_replace($search, $search.$replace, $content);
    12891}
    12992
     
    13598  function tweet_plugin_admin_menu($menu)
    13699  {
    137     array_push(
    138       $menu,
    139       array(
    140         'NAME' => 'TweetThis',
    141         'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
    142         )
    143       );
    144    
     100    array_push($menu, array(
     101      'NAME' => 'TweetThis',
     102      'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
     103      ));
    145104    return $menu;
    146105  }
  • extensions/TweetThis/maintain.inc.php

    r12388 r15122  
    11<?php
    22function plugin_install()
    3 {
    4   pwg_query('INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("TweetThis","horizontal,toolbar","TweetThis config");');
     3{
     4  $conf = array(
     5    'size' => 'small',
     6    'position' => 'toolbar',
     7    'count' => true,
     8    'via' => null,
     9    );
     10     
     11  conf_update_param('TweetThis', serialize($conf));
     12}
     13
     14function plugin_activate()
     15{
     16  global $conf;
     17 
     18  if (@unserialize($conf['TweetThis']) === false)
     19  {
     20    $conf = explode(',', $conf['TweetThis']);
     21    $conf = array(
     22      'size' => 'small',
     23      'position' => $conf[1],
     24      'count' => $conf[1]=='horizontal' || $conf[1]=='vertical',
     25      'via' => null,
     26      );
     27     
     28    conf_update_param('TweetThis', serialize($conf));
     29  }
    530}
    631
  • extensions/TweetThis/style.css

    r11514 r15122  
    2323.twitter_buttons tr:last-child td {
    2424  border-bottom:none;
     25}
     26.twitter_buttons input {
     27  background:#eee;
     28  border:1px solid #aaa;
     29  border-radius:4px;
     30  box-shadow:inset 0 1px 0 rgba(0,0,0,0.05);
     31  padding:5px;
     32}
     33.twitter_buttons input:focus {
     34  background:#fff;
     35  border-color:#3399ff;
    2536}
    2637tr.property td, tr.submit td {
Note: See TracChangeset for help on using the changeset viewer.