Dotclear


Ignore:
Timestamp:
10/26/13 00:17:52 (12 years ago)
Author:
Denis Jean-Chirstian <contact@…>
Branch:
2.6
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.modules.php

    r2432 r2492  
    1616@brief Modules handler 
    1717 
    18 Provides an object to handle modules (themes or plugins). An instance of this 
    19 class is provided by dcCore $plugins property and used for plugins. 
     18Provides an object to handle modules (themes or plugins).  
    2019*/ 
    2120class dcModules 
     
    3635     protected static $_n; 
    3736 
    38      protected static $type = 'plugin'; 
     37     protected static $type = null; 
    3938      
    4039     public $core;  ///< <b>dcCore</b>  dcCore instance 
     
    161160     @param    author         <b>string</b>       Module author name 
    162161     @param    version        <b>string</b>       Module version 
    163      @param    properties     <b>array</b>        extra properties (currently available keys : permissions, priority) 
     162     @param    properties     <b>array</b>        extra properties  
     163     (currently available keys : permissions, priority, type) 
    164164     */ 
    165165     public function registerModule($name,$desc,$author,$version, $properties = array()) 
    166166     { 
     167          # Fallback to legacy registerModule parameters 
    167168          if (!is_array($properties)) { 
    168                //Fallback to legacy registerModule parameters 
    169169               $args = func_get_args(); 
    170170               $properties = array(); 
     
    176176               } 
    177177          } 
     178 
     179          # Default module properties 
    178180          $properties = array_merge( 
    179181               array( 
     
    185187          ); 
    186188 
    187           if ($properties['type'] !== null && $properties['type'] != self::$type) { 
     189          # Check module type 
     190          if (self::$type !== null && $properties['type'] !== null && $properties['type'] != self::$type) { 
    188191               $this->errors[] = sprintf( 
    189192                    __('Module "%s" has type "%s" that mismatch required module type "%s".'), 
     
    195198          } 
    196199 
     200          # Check module perms on admin side 
    197201          $permissions = $properties['permissions']; 
    198202          if ($this->ns == 'admin') { 
     
    204208          } 
    205209           
     210          # Check module install on multiple path 
    206211          if ($this->id) { 
    207212               $module_exists = array_key_exists($name,$this->modules_names); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map