source: extensions/SocialButtons/include/google.inc.php @ 20358

Last change on this file since 20358 was 20358, checked in by mistic100, 11 years ago

create plugin SocialButtons

File size: 1.5 KB
Line 
1<?php
2defined('SOCIALBUTT_PATH') or die('Hacking attempt!');
3
4function socialbutt_google($basename, $root_url, &$tpl_vars)
5{
6  global $conf, $template, $user;
7 
8  $google_langs = array(
9    'af','am','ar','eu','bn','bg','ca','zh-HK','zh-CN','zh-TW','h','cs','da','nl',
10    'en-GB','en-US','et','fil','fi','fr','fr-CA','gl','de','el','gu','iw','hi','hu',
11    'is','id','it','ja','kn','ko','lv','lt','ms','ml','mr','no','fa','pl','pt-BR','pt-PT',
12    'ro','ru','sr','sk','sl','es','es-419','sw','sv','ta','te','th','tr','uk','ur','vi','zu'
13    );
14 
15 
16  // if the link is in the toolbar, we must use smaller buttons
17  if ( $conf['SocialButtons']['position'] == 'index' or  $conf['SocialButtons']['position'] == 'toolbar')
18  {
19    if ($conf['SocialButtons']['google']['size'] == 'tall' and $conf['SocialButtons']['google']['annotation'] == 'bubble')
20    {
21      $conf['SocialButtons']['google']['size'] = 'standard';
22    }
23  }
24 
25 
26  // config
27  $tpl_vars['GOOGLE'] = $conf['SocialButtons']['google'];
28 
29  // button language
30  if ( in_array(str_replace('_','-',$user['language']), $google_langs) )
31  {
32    $tpl_vars['GOOGLE']['lang'] = str_replace('_','-',$user['language']);
33  }
34  if ( in_array(substr($user['language'],0,2), $google_langs) )
35  {
36    $tpl_vars['GOOGLE']['lang'] = substr($user['language'],0,2);
37  }
38  else
39  {
40    $tpl_vars['GOOGLE']['lang'] = 'en-GB';
41  }
42 
43 
44  $template->set_filename('google_button', realpath(SOCIALBUTT_PATH .'template/google.tpl'));
45  return 'google_button';
46}
47
48?> 
Note: See TracBrowser for help on using the repository browser.