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

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

add light mode: no script loaded
tests in migration task
add an id to the div on picture page

File size: 2.9 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      );
41   
42    if (isset($conf['TumblrShare']))
43    {
44      $temp = is_string($conf['TumblrShare']) ? unserialize($conf['TumblrShare']) : $conf['TumblrShare'];
45      if (!empty($temp['type']))      $default_config['tumblr']['type'] =     $temp['type'];
46      if (!empty($temp['img_size']))  $default_config['tumblr']['img_size'] = $temp['img_size'];
47    }
48    if (isset($conf['TweetThis']))
49    {
50      $temp = is_string($conf['TweetThis']) ? unserialize($conf['TweetThis']) : $conf['TweetThis'];
51      if (!empty($temp['type']))  $default_config['twitter']['size'] =  $temp['size'];
52      if (!empty($temp['count'])) $default_config['twitter']['count'] = $temp['count'] ? 'bubble' : 'none';
53      if (!empty($temp['via']))   $default_config['twitter']['via'] =   $temp['via'];
54    }
55    if (isset($conf['GooglePlusOne']))
56    {
57      $temp = is_string($conf['GooglePlusOne']) ? unserialize($conf['GooglePlusOne']) : $conf['GooglePlusOne'];
58      if (!empty($temp['size']))        $default_config['google']['size'] =       $temp['size'];
59      if (!empty($temp['annotation']))  $default_config['google']['annotation'] = $temp['annotation'];
60    }
61   
62    $conf['SocialButtons'] = serialize($default_config);
63    conf_update_param('SocialButtons', $conf['SocialButtons']);
64  }
65  else
66  {
67    $new_conf = is_string($conf['SocialButtons']) ? unserialize($conf['SocialButtons']) : $conf['SocialButtons'];
68   
69    if (empty($new_conf['pinterest']))
70    {
71      $new_conf['pinterest'] = array(
72        'enabled' => true,
73        'layout' => 'horizontal',
74        'img_size' => 'Original',
75        );
76    }
77   
78    if (!isset($new_conf['on_index']))
79    {
80      $new_conf['on_index'] = true;
81    }
82   
83    if ($new_conf['facebook']['layout'] == 'none')
84    {
85      $new_conf['facebook']['layout'] = 'button_count';
86    }
87   
88    if (!isset($new_conf['light']))
89    {
90      $new_conf['light'] = false;
91    }
92   
93    $conf['SocialButtons'] = serialize($new_conf);
94    conf_update_param('SocialButtons', $conf['SocialButtons']);
95  }
96}
97
98?>
Note: See TracBrowser for help on using the repository browser.