Dotclear

Changeset 464:e6b2db1d228a


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.

Files:
18 edited

Legend:

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

    r270 r464  
    159159     @param    author         <b>string</b>       Module author name 
    160160     @param    version        <b>string</b>       Module version 
    161      @param    permissions    <b>string</b>       Module permissions 
    162      @param    priority       <b>integer</b>      Module priority 
    163      */ 
    164      public function registerModule($name,$desc,$author,$version,$permissions=null,$priority=1000) 
    165      { 
     161     @param    properties     <b>array</b>        extra properties (currently available keys : permissions, priority) 
     162     */ 
     163     public function registerModule($name,$desc,$author,$version, $properties = array()) 
     164     { 
     165          if (!is_array($properties)) { 
     166               //Fallback to legacy registerModule parameters 
     167               $args = func_get_args(); 
     168               $properties = array(); 
     169               if (isset($args[4])) { 
     170                    $properties['permissions']=$args[4]; 
     171               } 
     172               if (isset($args[5])) { 
     173                    $properties['priority']= (integer)$args[5]; 
     174               } 
     175          } 
     176          $properties = array_merge( 
     177               array( 
     178                    'permissions' => null, 
     179                    'priority' => 1000 
     180               ), $properties 
     181          ); 
     182          $permissions = $properties['permissions']; 
    166183          if ($this->ns == 'admin') { 
    167184               if ($permissions == '' && !$this->core->auth->isSuperAdmin()) { 
     
    177194               if (!$module_exists || ($module_exists && $module_overwrite)) { 
    178195                    $this->modules_names[$name] = $version; 
    179                     $this->modules[$this->id] = array( 
    180                          'root' => $this->mroot, 
    181                          'name' => $name, 
    182                          'desc' => $desc, 
    183                          'author' => $author, 
    184                          'version' => $version, 
    185                          'permissions' => $permissions, 
    186                          'priority' => $priority === null ? 1000 : (integer) $priority, 
    187                          'root_writable' => is_writable($this->mroot) 
     196                    $this->modules[$this->id] = array_merge( 
     197                         $properties, 
     198                         array( 
     199                              'root' => $this->mroot, 
     200                              'name' => $name, 
     201                              'desc' => $desc, 
     202                              'author' => $author, 
     203                              'version' => $version, 
     204                              'root_writable' => is_writable($this->mroot) 
     205                         ) 
    188206                    ); 
    189207               } 
  • 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          } 
  • plugins/aboutConfig/_define.php

    r270 r464  
    1616     /* Description*/         "Manage every blog configuration directive", 
    1717     /* Author */             "Olivier Meunier", 
    18      /* Version */            '0.3', 
    19      /* Permissions */        null 
     18     /* Version */            '0.3' 
    2019); 
    2120?> 
  • plugins/akismet/_define.php

    r270 r464  
    1717     /* Author */             "Olivier Meunier", 
    1818     /* Version */            '1.1', 
    19      /* Permissions */        'usage,contentadmin', 
    20      /* Priority */           200 
     19     array( 
     20          'permissions' =>    'usage,contentadmin', 
     21          'priority' =>       200 
     22     ) 
    2123); 
    2224?> 
  • plugins/antispam/_define.php

    r270 r464  
    1717     /* Author */             "Alain Vagner", 
    1818     /* Version */            '1.3.1', 
    19      /* Permissions */        'usage,contentadmin', 
    20      /* Priority */           10 
     19     array( 
     20          'permissions' =>    'usage,contentadmin', 
     21          'priority' =>       10 
     22     ) 
    2123); 
    2224?> 
  • plugins/attachments/_define.php

    r407 r464  
    1717     /* Author */        "Dotclear Team", 
    1818     /* Version */       '1.0', 
    19      /* Permissions */   'contentadmin,pages', 
    20      999 
     19     array( 
     20          'permissions' =>    'contentadmin,pages', 
     21          'priority' =>       999 
     22     ) 
    2123); 
    2224?> 
  • plugins/attachments/_public.php

    r415 r464  
    195195     } 
    196196      
    197      public function MediaURL($attr) 
     197     public static function MediaURL($attr) 
    198198     { 
    199199          $f = $GLOBALS['core']->tpl->getFilters($attr); 
     
    209209     > 
    210210     */ 
    211      public function EntryAttachmentCount($attr) 
     211     public static function EntryAttachmentCount($attr) 
    212212     { 
    213213          $none = 'no attachment'; 
  • plugins/blogroll/_define.php

    r270 r464  
    1717     /* Author */             "Olivier Meunier", 
    1818     /* Version */            '1.2', 
    19      /* Permissions */        'blogroll' 
     19     array( 
     20          'permissions' =>    'blogroll' 
     21     ) 
    2022); 
    2123?> 
  • plugins/blowupConfig/_define.php

    r270 r464  
    1717     /* Author */             "Olivier Meunier", 
    1818     /* Version */            '1.1', 
    19      /* Permissions */        'admin' 
     19     array( 
     20          'permissions' =>    'admin' 
     21     ) 
    2022); 
    2123?> 
  • plugins/fairTrackbacks/_define.php

    r270 r464  
    1717     /* Author */             "Olivier Meunier", 
    1818     /* Version */            '1.1', 
    19      /* Permissions */        'usage,contentadmin', 
    20      /* Priority */           200 
     19     array( 
     20          'permissions' =>    'usage,contentadmin', 
     21          'priority' =>       200 
     22     ) 
    2123); 
    2224?> 
  • plugins/importExport/_define.php

    r270 r464  
    1717     /* Author */             "Olivier Meunier", 
    1818     /* Version */            '2.4', 
    19      /* Permissions */        'admin', 
    20      /* Priority */           10 
     19     array( 
     20          'permissions' => 'admin', 
     21          'priority' => 10 
     22     ) 
    2123); 
    2224?> 
  • plugins/maintenance/_define.php

    r270 r464  
    1616     /* Description*/         "Maintain your database", 
    1717     /* Author */             "Olivier Meunier", 
    18      /* Version */            '1.1', 
    19      /* Permissions */        null 
     18     /* Version */            '1.1' 
    2019); 
    2120?> 
  • plugins/pages/_define.php

    r270 r464  
    1717     /* Author */        "Olivier Meunier", 
    1818     /* Version */       '1.1.1', 
    19      /* Permissions */   'contentadmin,pages', 
    20      999 
     19     array( 
     20          'permissions' =>    'contentadmin,pages', 
     21          'priority' =>  999 
     22     ) 
    2123); 
    2224?> 
  • plugins/pings/_define.php

    r270 r464  
    1717     /* Author */             "Olivier Meunier", 
    1818     /* Version */            '1.1', 
    19      /* Permissions */        'usage,contentadmin' 
     19     array( 
     20          'permissions' =>    'usage,contentadmin' 
     21     ) 
    2022); 
    2123?> 
  • plugins/tags/_define.php

    r270 r464  
    1717     /* Author */             "Olivier Meunier", 
    1818     /* Version */            '1.1', 
    19      /* Permissions */        'usage,contentadmin' 
     19     array( 
     20          'permissions' =>    'usage,contentadmin' 
     21     ) 
    2022); 
    2123?> 
  • plugins/themeEditor/_define.php

    r270 r464  
    1616     /* Description*/         "Theme Editor", 
    1717     /* Author */             "Olivier Meunier", 
    18      /* Version */            '0.9', 
    19      /* Permissions */        null 
     18     /* Version */            '0.9' 
    2019); 
    2120?> 
  • plugins/userPref/_define.php

    r3 r464  
    1616     /* Description*/         "Manage every user preference directive", 
    1717     /* Author */             "Franck Paul", 
    18      /* Version */            '0.1', 
    19      /* Permissions */        null 
     18     /* Version */            '0.1' 
    2019); 
    2120?> 
  • plugins/widgets/_define.php

    r270 r464  
    1717     /* Author */             "Olivier Meunier", 
    1818     /* Version */            '2', 
    19      /* Permissions */        'admin', 
    20      /* Priority */           1000000000 
     19     array( 
     20          'permissions' =>    'admin', 
     21          'priority' =>       1000000000 
     22     ) 
    2123); 
    2224?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map