1 | <?php |
---|
2 | |
---|
3 | function plugin_install() |
---|
4 | { |
---|
5 | $params = array( |
---|
6 | 'gvideo' => array('480','640','true','en'), |
---|
7 | 'ytube' => array('480','640','1'), |
---|
8 | 'dm' => array('480','640','1'), |
---|
9 | 'wideo' => array('480', '640', 'true'), |
---|
10 | 'vimeo' => array('480', '640', '1') |
---|
11 | ); |
---|
12 | |
---|
13 | $q = 'REPLACE INTO ' . CONFIG_TABLE . ' (param,value,comment) |
---|
14 | VALUES ("PY_GVideo","' . addslashes(serialize($params)) . '" , "PY Gvideo plugin parameters");'; |
---|
15 | pwg_query($q); |
---|
16 | } |
---|
17 | |
---|
18 | // La table de config se met à jour automatiquemlent lors de l'activation |
---|
19 | function plugin_activate() |
---|
20 | { |
---|
21 | global $conf; |
---|
22 | |
---|
23 | // Suppression des anciens paramètres (version < 1.7.o) |
---|
24 | if (isset($conf['pywaie_gvideo'])) |
---|
25 | { |
---|
26 | pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param LIKE "pywaie_%";'); |
---|
27 | } |
---|
28 | |
---|
29 | // Vérification des nouveaux paramètres |
---|
30 | if (!isset($conf['PY_GVideo']) |
---|
31 | or ($params = unserialize($conf['PY_GVideo']) and !isset($params['vimeo']))) |
---|
32 | { |
---|
33 | plugin_install(); |
---|
34 | } |
---|
35 | } |
---|
36 | |
---|
37 | function plugin_uninstall() |
---|
38 | { |
---|
39 | global $conf; |
---|
40 | |
---|
41 | // Suppression des anciens paramètres (version < 1.7.o) |
---|
42 | if (isset($conf['pywaie_gvideo'])) |
---|
43 | { |
---|
44 | pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param LIKE "pywaie_%";'); |
---|
45 | } |
---|
46 | |
---|
47 | pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param = "PY_GVideo";'); |
---|
48 | } |
---|
49 | |
---|
50 | ?> |
---|