Dotclear

source: inc/core/class.dc.plugins.php @ 2492:8a25f7bf147d

Revision 2492:8a25f7bf147d, 1.7 KB checked in by Denis Jean-Chirstian <contact@…>, 12 years ago (diff)

New class dcPlugins, fix backward compatibility with generic dcModules class and un-type modules

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_RC_PATH')) { return; }
13
14/**
15@ingroup DC_CORE
16@brief Plugins specific handler
17@since 2.6
18
19An instance of this class is provided by dcCore $plugins property
20and used for plugins.
21
22This class extends dcModules.
23*/
24class dcPlugins extends dcModules
25{   
26     protected static $type = 'plugin';
27
28     /**
29     This method registers a plugin in modules list. You should use this to
30     register a new plugin.
31     
32     <var>$priority</var> is an integer. Modules are sorted by priority and name.
33     Lowest priority comes first. This property is currently ignored when dealing
34     with themes.
35     
36     @param    name           <b>string</b>       Module name
37     @param    desc           <b>string</b>       Module description
38     @param    author         <b>string</b>       Module author name
39     @param    version        <b>string</b>       Module version
40     @param    properties     <b>array</b>        extra properties (currently available keys : permissions, priority, standalone_config, type)
41     */
42     public function registerModule($name,$desc,$author,$version,$properties = array())
43     {
44          # Fallback to legacy registerModule parameters
45          if (!is_array($properties)) {
46               $args = func_get_args();
47               $properties = array();
48               if (isset($args[4])) {
49                    $properties['permissions']=$args[4];
50               }
51               if (isset($args[5])) {
52                    $properties['priority']= (integer)$args[5];
53               }
54          }
55
56          parent::registerModule($name, $desc, $author, $version, $properties);
57     }
58}
Note: See TracBrowser for help on using the repository browser.

Sites map