Dotclear


Ignore:
Timestamp:
07/01/11 09:20:53 (14 years ago)
Author:
Dsls <dsls@…>
Branch:
default
Message:
  • New way of registering modules/themes, more extensible (backward compatible with previous method)
  • small fix on attachments plugin template tags

Closes #1223.

File:
1 edited

Legend:

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

    r270 r464  
    3939     @param    author         <b>string</b>       Module author name 
    4040     @param    version        <b>string</b>       Module version 
    41      @param    parent         <b>string</b>       Module parent 
    42      @param    priority       <b>integer</b>      Module priority 
     41     @param    properties     <b>array</b>        extra properties (currently available keys : parent, priority) 
    4342     */ 
    44      public function registerModule($name,$desc,$author,$version,$parent = null,$priority = 1000) 
     43     public function registerModule($name,$desc,$author,$version,$properties = array()) 
    4544     { 
     45          if (!is_array($properties)) { 
     46               //Fallback to legacy registerModule parameters 
     47               $args = func_get_args(); 
     48               $properties = array(); 
     49               if (isset($args[4])) { 
     50                    $properties['parent']=$args[4]; 
     51               } 
     52               if (isset($args[5])) { 
     53                    $properties['priority']= (integer)$args[5]; 
     54               } 
     55          } 
     56          $properties = array_merge( 
     57               array( 
     58                    'parent' => null, 
     59                    'priority' => 1000 
     60               ), $properties 
     61          ); 
    4662          if ($this->id) { 
    47                $this->modules[$this->id] = array( 
    48                'root' => $this->mroot, 
    49                'name' => $name, 
    50                'desc' => $desc, 
    51                'author' => $author, 
    52                'version' => $version, 
    53                'parent' => $parent, 
    54                'priority' => 1000, 
    55                'root_writable' => is_writable($this->mroot) 
     63               $this->modules[$this->id] = array_merge( 
     64                    $properties, 
     65                    array( 
     66                         'root' => $this->mroot, 
     67                         'name' => $name, 
     68                         'desc' => $desc, 
     69                         'author' => $author, 
     70                         'version' => $version, 
     71                         'root_writable' => is_writable($this->mroot) 
     72                    ) 
    5673               ); 
    5774          } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map