Ignore:
Timestamp:
10/04/13 22:09:05 (6 years ago)
Author:
mistic100
Message:

add light mode: no script loaded
tests in migration task
add an id to the div on picture page

Location:
extensions/SocialButtons
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • extensions/SocialButtons/admin.php

    r21232 r24757  
    1212    'position' => $_POST['position'], 
    1313    'on_index' => get_boolean($_POST['on_index']), 
     14    'light' => isset($_POST['light']), 
    1415    'twitter' => array( 
    1516      'enabled' => isset($_POST['twitter']['enabled']), 
  • extensions/SocialButtons/include/install.inc.php

    r23201 r24757  
    1111      'position' => 'toolbar', 
    1212      'on_index' => true, 
     13      'light' => false, 
    1314      'twitter' => array( 
    1415        'enabled' => true, 
     
    4243    { 
    4344      $temp = is_string($conf['TumblrShare']) ? unserialize($conf['TumblrShare']) : $conf['TumblrShare']; 
    44       $default_config['tumblr']['type'] = $temp['type']; 
    45       $default_config['tumblr']['img_size'] = $temp['img_size']; 
     45      if (!empty($temp['type']))      $default_config['tumblr']['type'] =    $temp['type']; 
     46      if (!empty($temp['img_size']))  $default_config['tumblr']['img_size'] = $temp['img_size']; 
    4647    } 
    4748    if (isset($conf['TweetThis'])) 
    4849    { 
    4950      $temp = is_string($conf['TweetThis']) ? unserialize($conf['TweetThis']) : $conf['TweetThis']; 
    50       $default_config['twitter']['size'] = $temp['size']; 
    51       $default_config['twitter']['count'] = $temp['count'] ? 'bubble' : 'none'; 
    52       $default_config['twitter']['via'] = $temp['via']; 
     51      if (!empty($temp['type']))  $default_config['twitter']['size'] = $temp['size']; 
     52      if (!empty($temp['count'])) $default_config['twitter']['count'] = $temp['count'] ? 'bubble' : 'none'; 
     53      if (!empty($temp['via']))   $default_config['twitter']['via'] =  $temp['via']; 
    5354    } 
    5455    if (isset($conf['GooglePlusOne'])) 
    5556    { 
    5657      $temp = is_string($conf['GooglePlusOne']) ? unserialize($conf['GooglePlusOne']) : $conf['GooglePlusOne']; 
    57       $default_config['google']['size'] = $temp['size']; 
    58       $default_config['google']['annotation'] = $temp['annotation']; 
     58      if (!empty($temp['size']))        $default_config['google']['size'] =      $temp['size']; 
     59      if (!empty($temp['annotation']))  $default_config['google']['annotation'] = $temp['annotation']; 
    5960    } 
    6061     
     
    6465  else 
    6566  { 
    66     $new_conf = unserialize($conf['SocialButtons']); 
     67    $new_conf = is_string($conf['SocialButtons']) ? unserialize($conf['SocialButtons']) : $conf['SocialButtons']; 
    6768     
    6869    if (empty($new_conf['pinterest'])) 
     
    7475        ); 
    7576    } 
     77     
    7678    if (!isset($new_conf['on_index'])) 
    7779    { 
     
    8486    } 
    8587     
     88    if (!isset($new_conf['light'])) 
     89    { 
     90      $new_conf['light'] = false; 
     91    } 
     92     
    8693    $conf['SocialButtons'] = serialize($new_conf); 
    8794    conf_update_param('SocialButtons', $conf['SocialButtons']); 
  • extensions/SocialButtons/include/pinterest.inc.php

    r23202 r24757  
    44function socialbutt_pinterest($basename, $root_url, &$tpl_vars, &$buttons) 
    55{ 
    6   // only on piture page 
     6  // only on picture page 
    77  if ($basename != 'picture') 
    88  { 
  • extensions/SocialButtons/include/twitter.inc.php

    r20374 r24757  
    66  global $conf, $template, $user; 
    77   
    8  $twitter_langs = array( 
     8  $twitter_langs = array( 
    99    'fr','en','ar','ja','es','de','it','id','pt','ko','tr','ru','nl','fil','msa','zh-tw', 
    1010    'zh-cn','hi','no','sv','fi','da','pl','hu','fa','he','ur','th','uk','ca','el','eu','cs' 
  • extensions/SocialButtons/language/en_UK/plugin.lang.php

    r21233 r24757  
    1313$lang['on photo and album'] = 'on photo and album'; 
    1414$lang['only on photo'] = 'only on photo'; 
     15$lang['Light mode'] = 'Light mode'; 
     16$lang['When light mode is activated no external script is loaded, it <b>speeds up the load of the page and disables user tracking</b> but also disables annotations and in-page popups.'] = 'When light mode is activated no external script is loaded, it <b>speeds up the load of the page and disables user tracking</b> but also disables annotations and in-page popups.'; 
    1517?> 
  • extensions/SocialButtons/language/fr_FR/plugin.lang.php

    r21232 r24757  
    1515$lang['on photo and album'] = 'sur les photos et les albums'; 
    1616$lang['only on photo'] = 'uniquement sur les photos'; 
     17$lang['Light mode'] = 'Mode léger'; 
     18$lang['When light mode is activated no external script is loaded, it <b>speeds up the load of the page and disables user tracking</b> but also disables annotations and in-page popups.'] = 'Quand le mode léger est activé aucun script externe n\'est chargé, celà <b>accélère le chargement de la page est désactive le tracking des utilisateurs</b> mais désactive aussi les annotations et les popups détaillés.'; 
    1719?> 
  • extensions/SocialButtons/main.inc.php

    r23201 r24757  
    119119   
    120120   
    121   define('SOCIALBUTT_POSITION', $conf['SocialButtons']['position']); 
    122121  $tpl_vars = array( 
    123122    'share_url' => $share_url, 
    124123    'position' => $conf['SocialButtons']['position'], 
     124    'light' => $conf['SocialButtons']['light'], 
    125125    'copyright' => '(from <a href="'.$share_url.'">'.$conf['gallery_title'].'</a>)', 
    126126    ); 
     
    177177  { 
    178178    case 'index': 
    179       foreach ($buttons as $button) { 
    180         $template->add_index_button('<li>'.$button.'</li>', 100); 
     179      foreach ($buttons as $button) 
     180      { 
     181        $template->add_index_button($button, 100); 
    181182      } 
    182183      break; 
    183184    case 'toolbar': 
    184       foreach ($buttons as $button) { 
     185      foreach ($buttons as $button) 
     186      { 
    185187        $template->add_picture_button($button, 100); 
    186188      } 
    187189      break; 
    188190    default; 
     191      define('SOCIALBUTT_POSITION', $conf['SocialButtons']['position']); 
    189192      $template->assign('SOCIALBUTT_BUTTONS', $buttons); 
    190193      $template->set_prefilter('picture', 'socialbutt_add_button_prefilter'); 
     
    198201    case 'top': 
    199202      $search = '<div id="theImage">'; 
    200       $add = '<div>{foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}</div>'; 
     203      $add = '<div id="socialButtons">{foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}</div>'; 
    201204      break; 
    202205       
    203206    case 'bottom': 
    204207      $search = '{$ELEMENT_CONTENT}'; 
    205       $add = '<div>{foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}</div>'; 
     208      $add = '<div id="socialButtons">{foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}</div>'; 
    206209      break; 
    207210  } 
  • extensions/SocialButtons/maintain.inc.php

    r20358 r24757  
    2424function plugin_uninstall()  
    2525{ 
    26   pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "SocialButtons" LIMIT 1;'); 
     26  global $conf; 
     27   
     28  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "SocialButtons";'); 
     29  unset($conf['SocialButtons']); 
    2730} 
    2831 
  • extensions/SocialButtons/template/admin.tpl

    r23201 r24757  
    33{html_style}{literal} 
    44.socialbutt.disabled thead img { 
     5  -webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */ 
    56  filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='grayscale'><feColorMatrix type='saturate' values='0'/></filter></svg>#grayscale"); /* Firefox 10+ */ 
    67  filter: gray; /* IE6-9 */ 
    7   -webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */ 
    88} 
    9 {/literal}{/html_style} 
     9{/literal} 
     10{if $light} 
     11.not-light {ldelim} display:none; } 
     12{/if} 
     13{/html_style} 
    1014 
    1115{footer_script}{literal} 
     
    2327  } 
    2428}); 
     29 
     30jQuery("input#light_mode").on('change', function() { 
     31  if ($(this).is(":checked")) { 
     32    $('.not-light').hide(); 
     33  } 
     34  else { 
     35    $('.not-light').show(); 
     36  } 
     37}); 
     38 
     39jQuery(".showInfo").tipTip({ 
     40  delay: 0, 
     41  fadeIn: 200, 
     42  fadeOut: 200, 
     43  maxWidth: '300px', 
     44  defaultPosition: 'bottom' 
     45}); 
    2546{/literal}{/footer_script} 
    2647 
     
    5475    </td> 
    5576  </tr> 
     77  <tr class="property"> 
     78    <td> 
     79      <label for="light_mode">{'Light mode'|@translate}</label> 
     80    </td> 
     81    <td> 
     82      <input type="checkbox" id="light_mode" name="light" {if $light}checked="checked"{/if}/> 
     83      <a class="showInfo" title="{'When light mode is activated no external script is loaded, it <b>speeds up the load of the page and disables user tracking</b> but also disables annotations and in-page popups.'|@translate}">i</a> 
     84    </td> 
     85  </tr> 
    5686</table> 
    5787</div> 
     
    87117      </label></td> 
    88118    </tr> 
    89     <tr class="property"> 
     119    <tr class="property not-light"> 
    90120      <td> 
    91121        {'Annotation'|@translate} 
     
    145175      </label></td> 
    146176    </tr> 
    147     <tr class="property"> 
     177    <tr class="property not-light"> 
    148178      <td> 
    149179        {'Annotation'|@translate} 
     
    180210      </td> 
    181211    </tr> 
    182     <tr class="property"> 
     212    <tr class="property not-light"> 
    183213      <td> 
    184214        {'Annotation'|@translate} 
     
    221251      </label></td> 
    222252    </tr> 
    223     <tr class="property"> 
     253    <tr class="property not-light"> 
    224254      <td> 
    225255        {'Annotation'|@translate} 
  • extensions/SocialButtons/template/facebook.tpl

    r23201 r24757  
    11{strip} 
     2{if $SOCIALBUTT.light} 
     3<a href="https://www.facebook.com/sharer.php?u={$SOCIALBUTT.share_url|urlencode}&t={$PAGE_TITLE|cat:' | '|cat:$GALLERY_TITLE|urlencode}" rel="nofollow" 
     4  onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=500');return false;" target="_blank"> 
     5  <img src="{$ROOT_PATH}{$SOCIALBUTT_PATH}template/images/facebook_{$SOCIALBUTT.FACEBOOK.color}.png" alt="Share on Facebook"></a> 
     6{else} 
    27{footer_script}jQuery('body').prepend('<div id="fb-root"></div>');{/footer_script} 
    38{combine_script id='facebook_jssdk' load='footer' path='https://connect.facebook.net/'|cat:$SOCIALBUTT.FACEBOOK.lang|cat:'/all.js#xfbml=1'} 
    4  
    59<div style="display:inline-block;" class="fb-like" data-send="false" data-show-faces="false"  
    610  data-href="{$SOCIALBUTT.share_url}" data-layout="{$SOCIALBUTT.FACEBOOK.layout}" data-colorscheme="{$SOCIALBUTT.FACEBOOK.color}"></div> 
     11{/if} 
    712{/strip} 
  • extensions/SocialButtons/template/google.tpl

    r23201 r24757  
    11{strip} 
     2{if $SOCIALBUTT.light} 
     3<a title="Google +" href="https://plus.google.com/share?url={$SOCIALBUTT.share_url|urlencode}&hl={$SOCIALBUTT.GOOGLE.lang}" rel="nofollow"  
     4  onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=390,width=480');return false;" target="_blank"> 
     5  <img src="{$ROOT_PATH}{$SOCIALBUTT_PATH}template/images/google_{$SOCIALBUTT.GOOGLE.size}.png" alt="Share on Google+"></a> 
     6{else} 
    27{combine_script id='google_plusone' load='footer' path='https://apis.google.com/js/plusone.js'} 
    3  
    48<script type="text/javascript">window.___gcfg = {ldelim}lang: '{$SOCIALBUTT.GOOGLE.lang}'};</script> 
    59<div style="display:inline-block;" class="g-plusone" data-size="{$SOCIALBUTT.GOOGLE.size}" data-annotation="{$SOCIALBUTT.GOOGLE.annotation}" data-href="{$SOCIALBUTT.share_url}" data-recommendations="false"></div> 
     10{/if} 
    611{/strip} 
  • extensions/SocialButtons/template/pinterest.tpl

    r23201 r24757  
    11{strip} 
    2 {combine_script id='pinterest_pinit' load='footer' path='https://assets.pinterest.com/js/pinit.js'} 
    3  
    4 <a href="http://pinterest.com/pin/create/button/?url={$SOCIALBUTT.share_url|urlencode}&media={$SOCIALBUTT.PINTEREST.source|urlencode}&description={$SOCIALBUTT.PINTEREST.title|cat:' '|cat:$SOCIALBUTT.copyright|urlencode}"  
    5   class="pin-it-button" count-layout="{$SOCIALBUTT.PINTEREST.layout}"><img border="0" src="http://assets.pinterest.com/images/PinExt.png" title="Pin It"/></a> 
     2<a href="http://pinterest.com/pin/create/button/?url={$SOCIALBUTT.share_url|urlencode}&media={$SOCIALBUTT.PINTEREST.source|urlencode}&description={$SOCIALBUTT.PINTEREST.title|cat:' '|cat:$SOCIALBUTT.copyright|urlencode}" rel="nofollow" 
     3{if $SOCIALBUTT.light} 
     4  onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=470,width=600');return false;" target="_blank" 
     5{else} 
     6  class="pin-it-button" count-layout="{$SOCIALBUTT.PINTEREST.layout}" 
     7  {combine_script id='pinterest_pinit' load='footer' path='https://assets.pinterest.com/js/pinit.js'} 
     8{/if} 
     9><img border="0" src="http://assets.pinterest.com/images/PinExt.png" title="Pin It"/></a> 
    610{/strip} 
  • extensions/SocialButtons/template/style.css

    r20403 r24757  
    117117  content:"\2611"; 
    118118} 
     119 
     120 
     121.showInfo { 
     122  position:static; 
     123  display:inline-block; 
     124  padding:1px 6px; 
     125  width:4px; 
     126  height:14px; 
     127  line-height:14px; 
     128  font-size:0.8em; 
     129} 
  • extensions/SocialButtons/template/tumblr.tpl

    r23201 r24757  
    11{strip} 
    2 {combine_script id='tumblr_share' load='footer' path='http://platform.tumblr.com/v1/share.js'} 
    3  
    42{if $SOCIALBUTT.TUMBLR.mode=='photo'} 
    53{capture assign="inline_tags"}{foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first},{/if}{$tag.name}{/foreach}{/capture} 
    6 <a href="http://www.tumblr.com/share/photo?source={$SOCIALBUTT.TUMBLR.source|urlencode}&caption={$SOCIALBUTT.TUMBLR.title|cat:' '|cat:$SOCIALBUTT.copyright|urlencode}&clickthru={$SOCIALBUTT.share_url|urlencode}&tags={$inline_tags|urlencode}" 
     4<a href="http://www.tumblr.com/share/photo?source={$SOCIALBUTT.TUMBLR.source|urlencode}&caption={$SOCIALBUTT.TUMBLR.title|cat:' '|cat:$SOCIALBUTT.copyright|urlencode}&clickthru={$SOCIALBUTT.share_url|urlencode}&tags={$inline_tags|urlencode}" rel="nofollow"  
    75{else} 
    8 <a href="http://www.tumblr.com/share/link?url={$SOCIALBUTT.share_url|urlencode}&name={$SOCIALBUTT.TUMBLR.title|cat:' | '|cat:$GALLERY_TITLE|urlencode}&description={$CONTENT_DESCRIPTION|cat:$SOCIALBUTT.copyright|urlencode}" 
     6<a href="http://www.tumblr.com/share/link?url={$SOCIALBUTT.share_url|urlencode}&name={$SOCIALBUTT.TUMBLR.title|cat:' | '|cat:$GALLERY_TITLE|urlencode}&description={$CONTENT_DESCRIPTION|cat:$SOCIALBUTT.copyright|urlencode}" rel="nofollow"  
     7{/if} 
     8{if $SOCIALBUTT.light} 
     9  onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=430,width=500');return false;" target="_blank" 
     10{else} 
     11  {combine_script id='tumblr_share' load='footer' path='http://platform.tumblr.com/v1/share.js'} 
    912{/if} 
    1013><img src="http://platform.tumblr.com/v1/{$SOCIALBUTT.TUMBLR.type}.png" alt="Share on Tumblr"></a> 
  • extensions/SocialButtons/template/twitter.tpl

    r23201 r24757  
    11{strip} 
    2 {combine_script id='twitter_widgets' load='footer' path='https://platform.twitter.com/widgets.js'} 
    3  
    4 <a href="https://twitter.com/share?url={$SOCIALBUTT.share_url|urlencode}&text={$PAGE_TITLE|cat:' | '|cat:$GALLERY_TITLE|urlencode}{if $SOCIALBUTT.TWITTER.via}&via={$SOCIALBUTT.TWITTER.via}{/if}"  
     2<a href="https://twitter.com/share?url={$SOCIALBUTT.share_url|urlencode}&text={$PAGE_TITLE|cat:' | '|cat:$GALLERY_TITLE|urlencode}{if $SOCIALBUTT.TWITTER.via}&via={$SOCIALBUTT.TWITTER.via}{/if}" rel="nofollow" 
     3{if $SOCIALBUTT.light} 
     4  onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=470,width=600');return false;" target="_blank" 
     5{else} 
    56  data-url="{$SOCIALBUTT.share_url}" data-lang="{$SOCIALBUTT.TWITTER.lang}" data-via="{$SOCIALBUTT.TWITTER.via}" 
    6   data-size="{$SOCIALBUTT.TWITTER.size}" data-count="{$SOCIALBUTT.TWITTER.count}" class="twitter-share-button"> 
    7   <img src="{$ROOT_PATH}{$SOCIALBUTT_PATH}template/images/twitter_{$SOCIALBUTT.TWITTER.size}.png" alt="Share on Twitter"></a> 
     7  data-size="{$SOCIALBUTT.TWITTER.size}" data-count="{$SOCIALBUTT.TWITTER.count}" class="twitter-share-button" 
     8  {combine_script id='twitter_widgets' load='footer' path='https://platform.twitter.com/widgets.js'} 
     9{/if} 
     10><img src="{$ROOT_PATH}{$SOCIALBUTT_PATH}template/images/twitter_{$SOCIALBUTT.TWITTER.size}.png" alt="Share on Twitter"></a> 
    811{/strip} 
Note: See TracChangeset for help on using the changeset viewer.