source: extensions/SocialButtons/include/reddit.inc.php @ 24758

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

add reddit button

File size: 1.3 KB
Line 
1<?php
2defined('SOCIALBUTT_PATH') or die('Hacking attempt!');
3
4function 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  // config
23  $tpl_vars['REDDIT'] = $conf['SocialButtons']['reddit'];
24 
25  // button language
26  if ( in_array(str_replace('_','-',strtolower($user['language'])), $reddit_langs) )
27  {
28    $tpl_vars['REDDIT']['lang'] = str_replace('_','-',strtolower($user['language']));
29  }
30  if ( in_array(substr($user['language'],0,2), $reddit_langs) )
31  {
32    $tpl_vars['REDDIT']['lang'] = substr($user['language'],0,2);
33  }
34  else
35  {
36    $tpl_vars['REDDIT']['lang'] = 'en';
37  }
38 
39 
40  $template->set_filename('reddit_button', realpath(SOCIALBUTT_PATH .'template/reddit.tpl'));
41  $buttons[] = 'reddit_button';
42}
43
44?>
Note: See TracBrowser for help on using the repository browser.