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

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

remove "no caption" option for facebook (buggy)
fix urls
fix pinterest javascript

File size: 2.5 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      'twitter' => array(
14        'enabled' => true,
15        'size' => 'small',
16        'count' => 'bubble',
17        'via' => null,
18        ),
19      'google' => array(
20        'enabled' => true,
21        'size' => 'medium',
22        'annotation' => 'bubble',
23        ),
24      'tumblr' => array(
25        'enabled' => true,
26        'type' => 'share_1',
27        'img_size' => 'Original',
28        ),
29      'facebook' => array(
30        'enabled' => true,
31        'color' => 'light',
32        'layout' => 'button_count',
33        ),
34      'pinterest' => array(
35        'enabled' => true,
36        'layout' => 'horizontal',
37        'img_size' => 'Original',
38        ),
39      );
40   
41    if (isset($conf['TumblrShare']))
42    {
43      $temp = is_string($conf['TumblrShare']) ? unserialize($conf['TumblrShare']) : $conf['TumblrShare'];
44      $default_config['tumblr']['type'] = $temp['type'];
45      $default_config['tumblr']['img_size'] = $temp['img_size'];
46    }
47    if (isset($conf['TweetThis']))
48    {
49      $temp = is_string($conf['TweetThis']) ? unserialize($conf['TweetThis']) : $conf['TweetThis'];
50      $default_config['twitter']['size'] = $temp['size'];
51      $default_config['twitter']['count'] = $temp['count'] ? 'bubble' : 'none';
52      $default_config['twitter']['via'] = $temp['via'];
53    }
54    if (isset($conf['GooglePlusOne']))
55    {
56      $temp = is_string($conf['GooglePlusOne']) ? unserialize($conf['GooglePlusOne']) : $conf['GooglePlusOne'];
57      $default_config['google']['size'] = $temp['size'];
58      $default_config['google']['annotation'] = $temp['annotation'];
59    }
60   
61    $conf['SocialButtons'] = serialize($default_config);
62    conf_update_param('SocialButtons', $conf['SocialButtons']);
63  }
64  else
65  {
66    $new_conf = unserialize($conf['SocialButtons']);
67   
68    if (empty($new_conf['pinterest']))
69    {
70      $new_conf['pinterest'] = array(
71        'enabled' => true,
72        'layout' => 'horizontal',
73        'img_size' => 'Original',
74        );
75    }
76    if (!isset($new_conf['on_index']))
77    {
78      $new_conf['on_index'] = true;
79    }
80   
81    if ($new_conf['facebook']['layout'] == 'none')
82    {
83      $new_conf['facebook']['layout'] = 'button_count';
84    }
85   
86    $conf['SocialButtons'] = serialize($new_conf);
87    conf_update_param('SocialButtons', $conf['SocialButtons']);
88  }
89}
90
91?>
Note: See TracBrowser for help on using the repository browser.