Changeset 20374


Ignore:
Timestamp:
Jan 25, 2013, 4:51:02 PM (11 years ago)
Author:
mistic100
Message:

add pinterest, option to hide counter on facebook button

Location:
extensions/SocialButtons
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • extensions/SocialButtons/admin.php

    r20358 r20374  
    3232      'layout' => $_POST['facebook']['layout'],
    3333      ),
     34    'pinterest' => array(
     35      'enabled' => isset($_POST['pinterest']['enabled']),
     36      'layout' => $_POST['pinterest']['layout'],
     37      'img_size' => $_POST['pinterest']['img_size'],
     38      ),
    3439    );
    3540 
  • extensions/SocialButtons/include/facebook.inc.php

    r20358 r20374  
    22defined('SOCIALBUTT_PATH') or die('Hacking attempt!');
    33
    4 function socialbutt_facebook($basename, $root_url, &$tpl_vars)
     4function socialbutt_facebook($basename, $root_url, &$tpl_vars, &$buttons)
    55{
    66  global $conf, $template, $user;
     
    4242 
    4343  $template->set_filename('facebook_button', realpath(SOCIALBUTT_PATH .'template/facebook.tpl'));
    44   return 'facebook_button';
     44  $buttons[] = 'facebook_button';
    4545}
    4646
  • extensions/SocialButtons/include/google.inc.php

    r20358 r20374  
    22defined('SOCIALBUTT_PATH') or die('Hacking attempt!');
    33
    4 function socialbutt_google($basename, $root_url, &$tpl_vars)
     4function socialbutt_google($basename, $root_url, &$tpl_vars, &$buttons)
    55{
    66  global $conf, $template, $user;
     
    4343 
    4444  $template->set_filename('google_button', realpath(SOCIALBUTT_PATH .'template/google.tpl'));
    45   return 'google_button';
     45  $buttons[] = 'google_button';
    4646}
    4747
  • extensions/SocialButtons/include/install.inc.php

    r20358 r20374  
    3131        'layout' => 'button_count',
    3232        ),
     33      'pinterest' => array(
     34        'enabled' => true,
     35        'layout' => 'horizontal',
     36        'img_size' => 'Original',
     37        ),
    3338      );
    3439   
     
    5358    }
    5459   
    55    
    5660    $conf['SocialButtons'] = serialize($default_config);
    5761    conf_update_param('SocialButtons', $conf['SocialButtons']);
     62  }
     63  else
     64  {
     65    $new_conf = unserialize($conf['SocialButtons']);
     66    if (empty($new_conf['pinterest']))
     67    {
     68      $new_conf['pinterest'] = array(
     69        'enabled' => true,
     70        'layout' => 'horizontal',
     71        'img_size' => 'Original',
     72        );
     73      $conf['SocialButtons'] = serialize($new_conf);
     74      conf_update_param('SocialButtons', $conf['SocialButtons']);
     75    }
    5876  }
    5977}
  • extensions/SocialButtons/include/tumblr.inc.php

    r20358 r20374  
    22defined('SOCIALBUTT_PATH') or die('Hacking attempt!');
    33
    4 function socialbutt_tumblr($basename, $root_url, &$tpl_vars)
     4function socialbutt_tumblr($basename, $root_url, &$tpl_vars, &$buttons)
    55{
    6   global $conf, $template, $user;
     6  global $conf, $template;
    77 
    88  $tumblr_css = array(
     
    5151 
    5252  $template->set_filename('tumblr_button', realpath(SOCIALBUTT_PATH .'template/tumblr.tpl'));
    53   return 'tumblr_button';
     53  $buttons[] = 'tumblr_button';
    5454}
    5555
  • extensions/SocialButtons/include/twitter.inc.php

    r20358 r20374  
    22defined('SOCIALBUTT_PATH') or die('Hacking attempt!');
    33
    4 function socialbutt_twitter($basename, $root_url, &$tpl_vars)
     4function socialbutt_twitter($basename, $root_url, &$tpl_vars, &$buttons)
    55{
    66  global $conf, $template, $user;
     
    3131 
    3232  $template->set_filename('twitter_button', realpath(SOCIALBUTT_PATH .'template/twitter.tpl'));
    33   return 'twitter_button';
     33  $buttons[] = 'twitter_button';
    3434}
    3535
  • extensions/SocialButtons/main.inc.php

    r20358 r20374  
    125125  {
    126126    include_once(SOCIALBUTT_PATH . 'include/google.inc.php');
    127     $buttons[] = socialbutt_google($basename, $root_url, $tpl_vars);
     127    socialbutt_google($basename, $root_url, $tpl_vars, $buttons);
    128128  }
    129129  if ($conf['SocialButtons']['twitter']['enabled'])
    130130  {
    131131    include_once(SOCIALBUTT_PATH . 'include/twitter.inc.php');
    132     $buttons[] = socialbutt_twitter($basename, $root_url, $tpl_vars);
     132    socialbutt_twitter($basename, $root_url, $tpl_vars, $buttons);
    133133  }
    134134  if ($conf['SocialButtons']['facebook']['enabled'])
    135135  {
    136136    include_once(SOCIALBUTT_PATH . 'include/facebook.inc.php');
    137     $buttons[] = socialbutt_facebook($basename, $root_url, $tpl_vars);
     137    socialbutt_facebook($basename, $root_url, $tpl_vars, $buttons);
    138138  }
    139139  if ($conf['SocialButtons']['tumblr']['enabled'])
    140140  {
    141141    include_once(SOCIALBUTT_PATH . 'include/tumblr.inc.php');
    142     $buttons[] = socialbutt_tumblr($basename, $root_url, $tpl_vars);
     142    socialbutt_tumblr($basename, $root_url, $tpl_vars, $buttons);
     143  }
     144  if ($conf['SocialButtons']['pinterest']['enabled'] and $basename=='picture')
     145  {
     146    include_once(SOCIALBUTT_PATH . 'include/pinterest.inc.php');
     147    socialbutt_pinterest($basename, $root_url, $tpl_vars, $buttons);
    143148  }
    144149 
  • extensions/SocialButtons/template/admin.tpl

    r20358 r20374  
    5050<br>
    5151
    52 <div class="socialbutt">
     52
     53<div class="socialbutt"> {* <!-- twitter --> *}
     54<table>
     55  <thead>
     56    <tr><td colspan="2">
     57      <label title="{if $twitter.enabled}{'Disable'|@translate}{else}{'Enable'|@translate}{/if}">
     58        <img {if not $twitter.enabled}class="grayscale"{/if} src="{$SOCIALBUTT_PATH}template/images/twitter_logo.png"/>
     59        <input class="enable" style="display:none;" type="checkbox" name="twitter[enabled]" {if $twitter.enabled}checked="checked"{/if}/>
     60      </label>
     61    </td></tr>
     62  </thead>
     63  <tbody {if not $twitter.enabled}style="display:none;"{/if}>
     64    <tr class="property">
     65      <td>
     66        {'Button type'|@translate}
     67      </td>
     68      <td></td>
     69    </tr>
     70    <tr class="button">
     71      <td><label>
     72        20px
     73        <img src="{$SOCIALBUTT_PATH}template/images/twitter_small.png"/>
     74        <input type="radio" name="twitter[size]" value="small" {if $twitter.size=='small'}checked="checked"{/if}/>
     75      </label></td>
     76      <td><label>
     77        <input type="radio" name="twitter[size]" value="large" {if $twitter.size=='large'}checked="checked"{/if}/>
     78        <img src="{$SOCIALBUTT_PATH}template/images/twitter_large.png"/>
     79        28px
     80      </label></td>
     81    </tr>
     82    <tr class="property">
     83      <td>
     84        {'Annotation'|@translate}
     85      </td>
     86      <td>
     87        <label><input type="radio" name="twitter[count]" value="none" {if $twitter.count=='none'}checked="checked"{/if}/> {'None'|@translate}</label><br>
     88        <label><input type="radio" name="twitter[count]" value="bubble" {if $twitter.count=='bubble'}checked="checked"{/if}/> {'Bubble'|@translate}</label><br>
     89      </td>
     90    </tr>
     91    <tr class="property">
     92      <td>
     93        <label for="twitter_via">{'Via'|@translate}</label>
     94      </td>
     95      <td>
     96        @ <input type="text" id="twitter_via" name="twitter[via]" value="{$twitter.via}"/>
     97      </td>
     98    </tr>
     99  </tbody>
     100</table>
     101</div> {* <!-- twitter --> *}
     102
     103<div class="socialbutt"> {* <!-- google --> *}
     104<table>
     105  <thead>
     106    <tr><td colspan="2">
     107      <label title="{if $google.enabled}{'Disable'|@translate}{else}{'Enable'|@translate}{/if}">
     108        <img {if not $google.enabled}class="grayscale"{/if} src="{$SOCIALBUTT_PATH}template/images/google_logo.png"/>
     109        <input class="enable" style="display:none;" type="checkbox" name="google[enabled]" {if $google.enabled}checked="checked"{/if}/>
     110      </label>
     111    </td></tr>
     112  </thead>
     113  <tbody {if not $google.enabled}style="display:none;"{/if}>
     114    <tr class="property">
     115      <td>
     116        {'Button type'|@translate}
     117      </td>
     118      <td></td>
     119    </tr>
     120    <tr class="button">
     121      <td><label>
     122        15px
     123        <img src="{$SOCIALBUTT_PATH}template/images/google_small.png"/>
     124        <input type="radio" name="google[size]" value="small" {if $google.size=='small'}checked="checked"{/if}/>
     125      </label></td>
     126      <td><label>
     127        <input type="radio" name="google[size]" value="medium" {if $google.size=='medium'}checked="checked"{/if}/>
     128        <img src="{$SOCIALBUTT_PATH}template/images/google_medium.png"/>
     129        20px
     130      </label></td>
     131    </tr>
     132    <tr class="button">
     133      <td><label>
     134        24px
     135        <img src="{$SOCIALBUTT_PATH}template/images/google_standard.png"/>
     136        <input type="radio" name="google[size]" value="standard" {if $google.size=='standard'}checked="checked"{/if}/>
     137      </label></td>
     138      <td><label>
     139        <input type="radio" name="google[size]" value="tall" {if $google.size=='tall'}checked="checked"{/if}/>
     140        <img src="{$SOCIALBUTT_PATH}template/images/google_tall.png"/>
     141        60px
     142      </label></td>
     143    </tr>
     144    <tr class="property">
     145      <td>
     146        {'Annotation'|@translate}
     147      </td>
     148      <td>
     149        <label><input type="radio" name="google[annotation]" value="none" {if $google.annotation=='none'}checked="checked"{/if}/> {'None'|@translate}</label><br>
     150        <label><input type="radio" name="google[annotation]" value="bubble" {if $google.annotation=='bubble'}checked="checked"{/if}/> {'Bubble'|@translate}</label><br>
     151        <label><input type="radio" name="google[annotation]" value="inline" {if $google.annotation=='inline'}checked="checked"{/if}/> {'Inline text'|@translate}</label>
     152      </td>
     153    </tr>
     154  </tbody>
     155</table>
     156</div> {* <!-- google --> *}
     157
     158<br>
     159
     160<div class="socialbutt"> {* <!-- pinterest --> *}
     161<table>
     162  <thead>
     163    <tr><td colspan="2">
     164      <label title="{if $pinterest.enabled}{'Disable'|@translate}{else}{'Enable'|@translate}{/if}">
     165        <img {if not $pinterest.enabled}class="grayscale"{/if} src="{$SOCIALBUTT_PATH}template/images/pinterest_logo.png"/>
     166        <input class="enable" style="display:none;" type="checkbox" name="pinterest[enabled]" {if $pinterest.enabled}checked="checked"{/if}/>
     167      </label>
     168    </td></tr>
     169  </thead>
     170  <tbody {if not $pinterest.enabled}style="display:none;"{/if}>
     171    <tr class="property">
     172      <td>
     173        {'Shared picture size'|@translate}
     174      </td>
     175      <td>
     176        {html_options name="pinterest[img_size]" values=$img_sizes output=$img_sizes|translate selected=$pinterest.img_size}
     177      </td>
     178    </tr>
     179    <tr class="property">
     180      <td>
     181        {'Annotation'|@translate}
     182      </td>
     183      <td>
     184        <label><input type="radio" name="pinterest[layout]" value="none" {if $pinterest.layout=='none'}checked="checked"{/if}/> {'None'|@translate}</label><br>
     185        <label><input type="radio" name="pinterest[layout]" value="horizontal" {if $pinterest.layout=='horizontal'}checked="checked"{/if}/> {'Right bubble'|@translate}</label><br>
     186        <label><input type="radio" name="pinterest[layout]" value="vertical" {if $pinterest.layout=='vertical'}checked="checked"{/if}/> {'Top bubble'|@translate}</label>
     187      </td>
     188    </tr>
     189  </tbody>
     190</table>
     191</div> {* <!-- pinterest --> *}
     192
     193<div class="socialbutt"> {* <!-- facebook --> *}
     194<table>
     195  <thead>
     196    <tr><td colspan="2">
     197      <label title="{if $facebook.enabled}{'Disable'|@translate}{else}{'Enable'|@translate}{/if}">
     198        <img {if not $facebook.enabled}class="grayscale"{/if} src="{$SOCIALBUTT_PATH}template/images/facebook_logo.png"/>
     199        <input class="enable" style="display:none;" type="checkbox" name="facebook[enabled]" {if $facebook.enabled}checked="checked"{/if}/>
     200      </label>
     201    </td></tr>
     202  </thead>
     203  <tbody {if not $facebook.enabled}style="display:none;"{/if}>
     204    <tr class="property">
     205      <td>
     206        {'Button type'|@translate}
     207      </td>
     208      <td></td>
     209    </tr>
     210    <tr class="button">
     211      <td><label>
     212        <img src="{$SOCIALBUTT_PATH}template/images/facebook_light.png"/>
     213        <input type="radio" name="facebook[color]" value="light" {if $facebook.color=='light'}checked="checked"{/if}/>
     214      </label></td>
     215      <td><label>
     216        <input type="radio" name="facebook[color]" value="dark" {if $facebook.color=='dark'}checked="checked"{/if}/>
     217        <img src="{$SOCIALBUTT_PATH}template/images/facebook_dark.png"/>
     218      </label></td>
     219    </tr>
     220    <tr class="property">
     221      <td>
     222        {'Annotation'|@translate}
     223      </td>
     224      <td>
     225        <label><input type="radio" name="facebook[layout]" value="none" {if $facebook.layout=='none'}checked="checked"{/if}/> {'None'|@translate}</label><br>
     226        <label><input type="radio" name="facebook[layout]" value="button_count" {if $facebook.layout=='button_count'}checked="checked"{/if}/> {'Right bubble'|@translate}</label><br>
     227        <label><input type="radio" name="facebook[layout]" value="box_count" {if $facebook.layout=='box_count'}checked="checked"{/if}/> {'Top bubble'|@translate}</label><br>
     228        <label><input type="radio" name="facebook[layout]" value="standard" {if $facebook.layout=='standard'}checked="checked"{/if}/> {'Inline text'|@translate}</label>
     229      </td>
     230    </tr>
     231  </tbody>
     232</table>
     233</div> {* <!-- facebook --> *}
     234
     235<br>
     236
     237<div class="socialbutt"> {* <!-- tumblr --> *}
    53238<table>
    54239  <thead>
     
    117302  </tbody>
    118303</table>
    119 </div>
    120 
    121 <div class="socialbutt">
    122 <table>
    123   <thead>
    124     <tr><td colspan="2">
    125       <label title="{if $google.enabled}{'Disable'|@translate}{else}{'Enable'|@translate}{/if}">
    126         <img {if not $google.enabled}class="grayscale"{/if} src="{$SOCIALBUTT_PATH}template/images/google_logo.png"/>
    127         <input class="enable" style="display:none;" type="checkbox" name="google[enabled]" {if $google.enabled}checked="checked"{/if}/>
    128       </label>
    129     </td></tr>
    130   </thead>
    131   <tbody {if not $google.enabled}style="display:none;"{/if}>
    132     <tr class="property">
    133       <td>
    134         {'Button type'|@translate}
    135       </td>
    136       <td></td>
    137     </tr>
    138     <tr class="button">
    139       <td><label>
    140         15px
    141         <img src="{$SOCIALBUTT_PATH}template/images/google_small.png"/>
    142         <input type="radio" name="google[size]" value="small" {if $google.size=='small'}checked="checked"{/if}/>
    143       </label></td>
    144       <td><label>
    145         <input type="radio" name="google[size]" value="medium" {if $google.size=='medium'}checked="checked"{/if}/>
    146         <img src="{$SOCIALBUTT_PATH}template/images/google_medium.png"/>
    147         20px
    148       </label></td>
    149     </tr>
    150     <tr class="button">
    151       <td><label>
    152         24px
    153         <img src="{$SOCIALBUTT_PATH}template/images/google_standard.png"/>
    154         <input type="radio" name="google[size]" value="standard" {if $google.size=='standard'}checked="checked"{/if}/>
    155       </label></td>
    156       <td><label>
    157         <input type="radio" name="google[size]" value="tall" {if $google.size=='tall'}checked="checked"{/if}/>
    158         <img src="{$SOCIALBUTT_PATH}template/images/google_tall.png"/>
    159         60px
    160       </label></td>
    161     </tr>
    162     <tr class="property">
    163       <td>
    164         {'Annotation'|@translate}
    165       </td>
    166       <td>
    167         <label><input type="radio" name="google[annotation]" value="none" {if $google.annotation=='none'}checked="checked"{/if}/> {'None'|@translate}</label><br>
    168         <label><input type="radio" name="google[annotation]" value="bubble" {if $google.annotation=='bubble'}checked="checked"{/if}/> {'Bubble'|@translate}</label><br>
    169         <label><input type="radio" name="google[annotation]" value="inline" {if $google.annotation=='inline'}checked="checked"{/if}/> {'Inline text'|@translate}</label>
    170       </td>
    171     </tr>
    172   </tbody>
    173 </table>
    174 </div>
    175 
    176 <br>
    177 
    178 <div class="socialbutt">
    179 <table>
    180   <thead>
    181     <tr><td colspan="2">
    182       <label title="{if $twitter.enabled}{'Disable'|@translate}{else}{'Enable'|@translate}{/if}">
    183         <img {if not $twitter.enabled}class="grayscale"{/if} src="{$SOCIALBUTT_PATH}template/images/twitter_logo.png"/>
    184         <input class="enable" style="display:none;" type="checkbox" name="twitter[enabled]" {if $twitter.enabled}checked="checked"{/if}/>
    185       </label>
    186     </td></tr>
    187   </thead>
    188   <tbody {if not $twitter.enabled}style="display:none;"{/if}>
    189     <tr class="property">
    190       <td>
    191         {'Button type'|@translate}
    192       </td>
    193       <td></td>
    194     </tr>
    195     <tr class="button">
    196       <td><label>
    197         20px
    198         <img src="{$SOCIALBUTT_PATH}template/images/twitter_small.png"/>
    199         <input type="radio" name="twitter[size]" value="small" {if $twitter.size=='small'}checked="checked"{/if}/>
    200       </label></td>
    201       <td><label>
    202         <input type="radio" name="twitter[size]" value="large" {if $twitter.size=='large'}checked="checked"{/if}/>
    203         <img src="{$SOCIALBUTT_PATH}template/images/twitter_large.png"/>
    204         28px
    205       </label></td>
    206     </tr>
    207     <tr class="property">
    208       <td>
    209         {'Annotation'|@translate}
    210       </td>
    211       <td>
    212         <label><input type="radio" name="twitter[count]" value="none" {if $twitter.count=='none'}checked="checked"{/if}/> {'None'|@translate}</label><br>
    213         <label><input type="radio" name="twitter[count]" value="bubble" {if $twitter.count=='bubble'}checked="checked"{/if}/> {'Bubble'|@translate}</label><br>
    214       </td>
    215     </tr>
    216     <tr class="property">
    217       <td>
    218         <label for="twitter_via">{'Via'|@translate}</label>
    219       </td>
    220       <td>
    221         @ <input type="text" id="twitter_via" name="twitter[via]" value="{$twitter.via}"/>
    222       </td>
    223     </tr>
    224   </tbody>
    225 </table>
    226 </div>
    227 
    228 <div class="socialbutt">
    229 <table>
    230   <thead>
    231     <tr><td colspan="2">
    232       <label title="{if $facebook.enabled}{'Disable'|@translate}{else}{'Enable'|@translate}{/if}">
    233         <img {if not $facebook.enabled}class="grayscale"{/if} src="{$SOCIALBUTT_PATH}template/images/facebook_logo.png"/>
    234         <input class="enable" style="display:none;" type="checkbox" name="facebook[enabled]" {if $facebook.enabled}checked="checked"{/if}/>
    235       </label>
    236     </td></tr>
    237   </thead>
    238   <tbody {if not $facebook.enabled}style="display:none;"{/if}>
    239     <tr class="property">
    240       <td>
    241         {'Button type'|@translate}
    242       </td>
    243       <td></td>
    244     </tr>
    245     <tr class="button">
    246       <td><label>
    247         <img src="{$SOCIALBUTT_PATH}template/images/facebook_light.png"/>
    248         <input type="radio" name="facebook[color]" value="light" {if $facebook.color=='light'}checked="checked"{/if}/>
    249       </label></td>
    250       <td><label>
    251         <input type="radio" name="facebook[color]" value="dark" {if $facebook.color=='dark'}checked="checked"{/if}/>
    252         <img src="{$SOCIALBUTT_PATH}template/images/facebook_dark.png"/>
    253       </label></td>
    254     </tr>
    255     <tr class="property">
    256       <td>
    257         {'Annotation'|@translate}
    258       </td>
    259       <td>
    260         <label><input type="radio" name="facebook[layout]" value="button_count" {if $facebook.layout=='button_count'}checked="checked"{/if}/> {'Right bubble'|@translate}</label><br>
    261         <label><input type="radio" name="facebook[layout]" value="box_count" {if $facebook.layout=='box_count'}checked="checked"{/if}/> {'Top bubble'|@translate}</label><br>
    262         <label><input type="radio" name="facebook[layout]" value="standard" {if $facebook.layout=='standard'}checked="checked"{/if}/> {'Inline text'|@translate}</label>
    263       </td>
    264     </tr>
    265   </tbody>
    266 </table>
    267 </div>
     304</div> {* <!-- tumblr --> *}
    268305
    269306<br>
  • extensions/SocialButtons/template/facebook.tpl

    r20358 r20374  
    33{combine_script id='facebook_jssdk' load='async' path='https://connect.facebook.net/'|cat:$SOCIALBUTT.FACEBOOK.lang|cat:'/all.js#xfbml=1'}
    44
     5{if $SOCIALBUTT.FACEBOOK.layout=='none'}
     6{html_style}{literal}
     7.fb-like span { height: 22px !important; overflow: hidden; margin-right:10px; }
     8.fb-like iframe { top: -41px; }
     9{/literal}{/html_style}
     10{assign var=facebook_layout value='box_count'}
     11{else}
     12{assign var=facebook_layout value=$SOCIALBUTT.FACEBOOK.layout}
     13{/if}
     14
    515<div style="display:inline-block;" class="fb-like" data-send="false" data-show-faces="false"
    6   data-href="{$SOCIALBUTT.share_url}" data-layout="{$SOCIALBUTT.FACEBOOK.layout}" data-colorscheme="{$SOCIALBUTT.FACEBOOK.color}"></div>
     16  data-href="{$SOCIALBUTT.share_url}" data-layout="{$facebook_layout}" data-colorscheme="{$SOCIALBUTT.FACEBOOK.color}"></div>
    717{/strip}
Note: See TracChangeset for help on using the changeset viewer.