source: extensions/MenuRandomPhoto/maintain.inc.php @ 31810

Last change on this file since 31810 was 30050, checked in by JanisV, 10 years ago

Initial revision

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1<?php
2
3defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
4
5class MenuRandomPhoto_maintain extends PluginMaintain
6{
7  private $installed = false;
8
9  private $default_conf = array(
10    'height' => 150,
11    'square' => true,
12    'randompicture_preload' => 25,     // number preloaded random pictures
13    'title' => 'A random photo',
14    'delay' => 4000,
15  );
16
17  function __construct($plugin_id)
18  {
19    parent::__construct($plugin_id);
20  }
21
22  function install($plugin_version, &$errors=array())
23  {
24    global $conf;
25
26    if (empty($conf['MRP']))
27    {
28      $conf['MRP'] = serialize($this->default_conf);
29      conf_update_param('MRP', $conf['MRP']);
30    }
31    else
32    {
33      $new_conf = is_string($conf['MRP']) ? unserialize($conf['MRP']) : $conf['MRP'];
34
35      $conf['MRP'] = serialize($new_conf);
36      conf_update_param('MRP', $conf['MRP']);
37    }
38   
39    $this->installed = true;
40  }
41
42  function activate($plugin_version, &$errors=array())
43  {
44    if (!$this->installed)
45    {
46      $this->install($plugin_version, $errors);
47    }
48  }
49
50  function deactivate()
51  {
52  }
53
54  function uninstall()
55  {
56    conf_delete_param('MRP');
57  }
58}
59
60?>
Note: See TracBrowser for help on using the repository browser.