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.themes.php

    r2239 r2492  
    4141     @param    author         <b>string</b>       Module author name 
    4242     @param    version        <b>string</b>       Module version 
    43      @param    properties     <b>array</b>        extra properties (currently available keys : parent, priority, standalone_config) 
     43     @param    properties     <b>array</b>        extra properties  
     44     (currently available keys : parent, priority, standalone_config, type) 
    4445     */ 
    4546     public function registerModule($name,$desc,$author,$version,$properties = array()) 
    4647     { 
     48          # Fallback to legacy registerModule parameters 
    4749          if (!is_array($properties)) { 
    48                //Fallback to legacy registerModule parameters 
    4950               $args = func_get_args(); 
    5051               $properties = array(); 
     
    5657               } 
    5758          } 
     59          # Themes specifics properties 
    5860          $properties = array_merge( 
    59                array( 
    60                     'parent' => null, 
    61                     'priority' => 1000, 
    62                     'standalone_config' => false, 
    63                     'type' => null 
    64                ), $properties 
     61               array('parent' => null), 
     62               $properties, 
     63               array('permissions' => 'admin') // force themes perms 
    6564          ); 
    6665 
    67           if ($properties['type'] !== null && $properties['type'] != self::$type) { 
    68                $this->errors[] = sprintf( 
    69                     __('Module "%s" has type "%s" that mismatch required module type "%s".'), 
    70                     '<strong>'.html::escapeHTML($name).'</strong>', 
    71                     '<em>'.html::escapeHTML($properties['type']).'</em>', 
    72                     '<em>'.html::escapeHTML(self::$type).'</em>' 
    73                ); 
    74                return; 
    75           } 
    76  
    77           if ($this->id) { 
    78                $this->modules[$this->id] = array_merge( 
    79                     $properties, 
    80                     array( 
    81                          'root' => $this->mroot, 
    82                          'name' => $name, 
    83                          'desc' => $desc, 
    84                          'author' => $author, 
    85                          'version' => $version, 
    86                          'root_writable' => is_writable($this->mroot) 
    87                     ) 
    88                ); 
    89           } 
     66          parent::registerModule($name, $desc, $author, $version, $properties); 
    9067     }     
    9168      
     
    11491     } 
    11592} 
    116 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map