Dotclear

source: plugins/dcFilterDuplicate/_install.php @ 2902

Revision 2902, 1.3 KB checked in by JcDenis, 12 years ago (diff)

dcFlterDuplicate 0.4

  • Fixed call to blog object on prepend
  • New year copyright
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of dcFilterDuplicate, a plugin for Dotclear 2.
4#
5# Copyright (c) 2009-2011 JC Denis and contributors
6# jcdenis@gdwd.com
7#
8# Licensed under the GPL version 2.0 license.
9# A copy of this license is available in LICENSE file or at
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11# -- END LICENSE BLOCK ------------------------------------
12
13if (!defined('DC_CONTEXT_ADMIN')){return;}
14
15# Get new version
16$new_version = $core->plugins->moduleInfo('dcFilterDuplicate','version');
17$old_version = $core->getVersion('dcFilterDuplicate');
18
19# Compare versions
20if (version_compare($old_version,$new_version,'>=')) {return;}
21
22# Install or update
23try
24{
25     # Check version
26     if (version_compare(str_replace("-r","-p",DC_VERSION),'2.2-alpha','<'))
27     {
28          throw new Exception('dcFilterDuplicate requires Dotclear 2.2');
29     }
30     
31     # Settings
32     $core->blog->settings->addNamespace('dcFilterDuplicate');
33     $core->blog->settings->dcFilterDuplicate->put('dcfilterduplicate_minlen',30,'integer','Minimum lenght of comment to filter',false,true);
34
35     # Version
36     $core->setVersion('dcFilterDuplicate',$new_version);
37
38     return true;
39}
40catch (Exception $e)
41{
42     $core->error->add($e->getMessage());
43     return false;
44}
45?>
Note: See TracBrowser for help on using the repository browser.

Sites map