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
|
Rev | Line | |
---|
[1981] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
| 3 | # This file is part of dcFilterDuplicate, a plugin for Dotclear 2. |
---|
| 4 | # |
---|
[2902] | 5 | # Copyright (c) 2009-2011 JC Denis and contributors |
---|
[1981] | 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 | |
---|
| 13 | if (!defined('DC_CONTEXT_ADMIN')){return;} |
---|
| 14 | |
---|
| 15 | # Get new version |
---|
| 16 | $new_version = $core->plugins->moduleInfo('dcFilterDuplicate','version'); |
---|
[2305] | 17 | $old_version = $core->getVersion('dcFilterDuplicate'); |
---|
| 18 | |
---|
[1981] | 19 | # Compare versions |
---|
[2305] | 20 | if (version_compare($old_version,$new_version,'>=')) {return;} |
---|
| 21 | |
---|
[1981] | 22 | # Install or update |
---|
[2305] | 23 | try |
---|
| 24 | { |
---|
| 25 | # Check version |
---|
[2753] | 26 | if (version_compare(str_replace("-r","-p",DC_VERSION),'2.2-alpha','<')) |
---|
[2305] | 27 | { |
---|
| 28 | throw new Exception('dcFilterDuplicate requires Dotclear 2.2'); |
---|
[1981] | 29 | } |
---|
[2305] | 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 | |
---|
[1981] | 35 | # Version |
---|
| 36 | $core->setVersion('dcFilterDuplicate',$new_version); |
---|
[2305] | 37 | |
---|
[1981] | 38 | return true; |
---|
| 39 | } |
---|
[2305] | 40 | catch (Exception $e) |
---|
| 41 | { |
---|
[1981] | 42 | $core->error->add($e->getMessage()); |
---|
| 43 | return false; |
---|
| 44 | } |
---|
| 45 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.