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

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

add reddit button

File size: 3.2 KB
Line 
1<?php
2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
3
4function socialbutt_install() 
5{
6  global $conf;
7 
8  if (empty($conf['SocialButtons']))
9  {
10    $default_config = array(
11      'position' => 'toolbar',
12      'on_index' => true,
13      'light' => false,
14      'twitter' => array(
15        'enabled' => true,
16        'size' => 'small',
17        'count' => 'bubble',
18        'via' => null,
19        ),
20      'google' => array(
21        'enabled' => true,
22        'size' => 'medium',
23        'annotation' => 'bubble',
24        ),
25      'tumblr' => array(
26        'enabled' => true,
27        'type' => 'share_1',
28        'img_size' => 'Original',
29        ),
30      'facebook' => array(
31        'enabled' => true,
32        'color' => 'light',
33        'layout' => 'button_count',
34        ),
35      'pinterest' => array(
36        'enabled' => true,
37        'layout' => 'horizontal',
38        'img_size' => 'Original',
39        ),
40      'reddit' => array(
41        'enabled' => true,
42        'type' => 'interactive',
43        'community' => null,
44        ),
45      );
46   
47    if (isset($conf['TumblrShare']))
48    {
49      $temp = is_string($conf['TumblrShare']) ? unserialize($conf['TumblrShare']) : $conf['TumblrShare'];
50      if (!empty($temp['type']))      $default_config['tumblr']['type'] =     $temp['type'];
51      if (!empty($temp['img_size']))  $default_config['tumblr']['img_size'] = $temp['img_size'];
52    }
53    if (isset($conf['TweetThis']))
54    {
55      $temp = is_string($conf['TweetThis']) ? unserialize($conf['TweetThis']) : $conf['TweetThis'];
56      if (!empty($temp['type']))  $default_config['twitter']['size'] =  $temp['size'];
57      if (!empty($temp['count'])) $default_config['twitter']['count'] = $temp['count'] ? 'bubble' : 'none';
58      if (!empty($temp['via']))   $default_config['twitter']['via'] =   $temp['via'];
59    }
60    if (isset($conf['GooglePlusOne']))
61    {
62      $temp = is_string($conf['GooglePlusOne']) ? unserialize($conf['GooglePlusOne']) : $conf['GooglePlusOne'];
63      if (!empty($temp['size']))        $default_config['google']['size'] =       $temp['size'];
64      if (!empty($temp['annotation']))  $default_config['google']['annotation'] = $temp['annotation'];
65    }
66   
67    $conf['SocialButtons'] = serialize($default_config);
68    conf_update_param('SocialButtons', $conf['SocialButtons']);
69  }
70  else
71  {
72    $new_conf = is_string($conf['SocialButtons']) ? unserialize($conf['SocialButtons']) : $conf['SocialButtons'];
73   
74    if (empty($new_conf['pinterest']))
75    {
76      $new_conf['pinterest'] = array(
77        'enabled' => true,
78        'layout' => 'horizontal',
79        'img_size' => 'Original',
80        );
81    }
82   
83    if (empty($new_conf['reddit']))
84    {
85      $new_conf['reddit'] = array(
86        'enabled' => false,
87        'type' => 'interactive',
88        'community' => null,
89        );
90    }
91   
92    if (!isset($new_conf['on_index']))
93    {
94      $new_conf['on_index'] = true;
95    }
96   
97    if ($new_conf['facebook']['layout'] == 'none')
98    {
99      $new_conf['facebook']['layout'] = 'button_count';
100    }
101   
102    if (!isset($new_conf['light']))
103    {
104      $new_conf['light'] = false;
105    }
106   
107    $conf['SocialButtons'] = serialize($new_conf);
108    conf_update_param('SocialButtons', $conf['SocialButtons']);
109  }
110}
111
112?>
Note: See TracBrowser for help on using the repository browser.