1 | <?php |
---|
2 | defined('SOCIALBUTT_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | function socialbutt_google($basename, $root_url, &$tpl_vars, &$buttons) |
---|
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 | $buttons[] = 'google_button'; |
---|
46 | } |
---|