source: extensions/ShareThis/maintain.class.php

Last change on this file was 31136, checked in by SergeD, 9 years ago

version 1.0.4 - see changelog for details

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1<?php
2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
3
4class sharethis_maintain extends PluginMaintain {
5
6  private $default_conf = array(
7    'facebook'   => false,
8    'pinterest'  => false,
9    'twitter'    => false,
10    'googleplus' => false,
11    'tumblr'     => false
12  );
13
14  function __construct($plugin_id) {
15    parent::__construct($plugin_id); // always call parent constructor
16  }
17
18  /**** Plugin installation */
19  function install($plugin_version, &$errors=array()) {
20    global $conf;
21
22    // add config parameter
23    if (empty($conf['sharethis'])):
24      conf_update_param('sharethis', $this->default_conf, true);
25    else:
26      $old_conf = safe_unserialize($conf['sharethis']);
27
28      foreach ($this->default_conf as $key => $value):
29        if (array_key_exists($key, $old_conf)):
30        else:
31          $old_conf[$key] = $value;
32        endif;
33      endforeach;
34
35      conf_update_param('sharethis', $old_conf, true);
36    endif;
37  }
38
39  /**** Plugin activation */
40  function activate($plugin_version, &$errors=array()) { }
41
42  /**** Plugin deactivation */
43  function deactivate() { }
44
45  /**** Plugin (auto)update */
46  function update($old_version, $new_version, &$errors=array()) {
47    $this->install($new_version, $errors);
48  }
49
50  /**** Plugin uninstallation */
51  function uninstall() {
52    // delete configuration
53    conf_delete_param('sharethis');
54  }
55}
Note: See TracBrowser for help on using the repository browser.