1 | <?php |
---|
2 | defined('SOCIALBUTT_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | function socialbutt_reddit($basename, $root_url, &$tpl_vars, &$buttons) |
---|
5 | { |
---|
6 | global $conf, $template, $user; |
---|
7 | |
---|
8 | $reddit_langs = array( |
---|
9 | 'en','ar','be','bg','ca','cs','da','de','el','en-au','en-ca','en-gb','en-us','eo', |
---|
10 | 'es','es-ar','et','eu','fa','fi','fr','he','hi','hr','hu','hy','id','is','it','ja', |
---|
11 | 'ko','la','leet','lol','lt','lv','nl','nn','no','pir','pl','pt','pt-pt','ro','ru', |
---|
12 | 'sk','sl','sr','sr-la','sv','ta','th','tr','uk','vi','zh' |
---|
13 | ); |
---|
14 | |
---|
15 | |
---|
16 | // fallback to simple image if JS not enabled |
---|
17 | if ($conf['SocialButtons']['light'] && $conf['SocialButtons']['reddit']['type'] == 'interactive') |
---|
18 | { |
---|
19 | $conf['SocialButtons']['reddit']['type'] = 'spreddit7'; |
---|
20 | } |
---|
21 | |
---|
22 | |
---|
23 | // config |
---|
24 | $tpl_vars['REDDIT'] = $conf['SocialButtons']['reddit']; |
---|
25 | |
---|
26 | // button language |
---|
27 | if ( in_array(str_replace('_','-',strtolower($user['language'])), $reddit_langs) ) |
---|
28 | { |
---|
29 | $tpl_vars['REDDIT']['lang'] = str_replace('_','-',strtolower($user['language'])); |
---|
30 | } |
---|
31 | if ( in_array(substr($user['language'],0,2), $reddit_langs) ) |
---|
32 | { |
---|
33 | $tpl_vars['REDDIT']['lang'] = substr($user['language'],0,2); |
---|
34 | } |
---|
35 | else |
---|
36 | { |
---|
37 | $tpl_vars['REDDIT']['lang'] = 'en'; |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | $template->set_filename('reddit_button', realpath(SOCIALBUTT_PATH .'template/reddit.tpl')); |
---|
42 | $buttons[] = 'reddit_button'; |
---|
43 | } |
---|
44 | |
---|
45 | ?> |
---|