[20358] | 1 | <?php |
---|
| 2 | defined('SOCIALBUTT_PATH') or die('Hacking attempt!'); |
---|
| 3 | |
---|
[20374] | 4 | function socialbutt_twitter($basename, $root_url, &$tpl_vars, &$buttons) |
---|
[20358] | 5 | { |
---|
| 6 | global $conf, $template, $user; |
---|
| 7 | |
---|
[24757] | 8 | $twitter_langs = array( |
---|
[20358] | 9 | 'fr','en','ar','ja','es','de','it','id','pt','ko','tr','ru','nl','fil','msa','zh-tw', |
---|
| 10 | 'zh-cn','hi','no','sv','fi','da','pl','hu','fa','he','ur','th','uk','ca','el','eu','cs' |
---|
| 11 | ); |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | // config |
---|
| 15 | $tpl_vars['TWITTER'] = $conf['SocialButtons']['twitter']; |
---|
| 16 | |
---|
| 17 | // button language |
---|
| 18 | if ( in_array(str_replace('_','-',strtolower($user['language'])), $twitter_langs) ) |
---|
| 19 | { |
---|
| 20 | $tpl_vars['TWITTER']['lang'] = str_replace('_','-',strtolower($user['language'])); |
---|
| 21 | } |
---|
| 22 | if ( in_array(substr($user['language'],0,2), $twitter_langs) ) |
---|
| 23 | { |
---|
| 24 | $tpl_vars['TWITTER']['lang'] = substr($user['language'],0,2); |
---|
| 25 | } |
---|
| 26 | else |
---|
| 27 | { |
---|
| 28 | $tpl_vars['TWITTER']['lang'] = 'en'; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | $template->set_filename('twitter_button', realpath(SOCIALBUTT_PATH .'template/twitter.tpl')); |
---|
[20374] | 33 | $buttons[] = 'twitter_button'; |
---|
[20358] | 34 | } |
---|
| 35 | |
---|
| 36 | ?> |
---|