Dotclear


Ignore:
Timestamp:
03/08/18 17:58:39 (8 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Code formatting (PSR-2)

File:
1 edited

Legend:

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

    r2945 r3730  
    1010# 
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    12 if (!defined('DC_RC_PATH')) { return; } 
     12if (!defined('DC_RC_PATH')) {return;} 
    1313 
    1414/** 
     
    2020 
    2121This class extends dcModules. 
    22 */ 
     22 */ 
    2323class dcThemes extends dcModules 
    2424{ 
    25      protected static $type = 'theme'; 
     25    protected static $type = 'theme'; 
    2626 
    27      /** 
    28      This method registers a theme in modules list. You should use this to 
    29      register a new theme. 
     27    /** 
     28    This method registers a theme in modules list. You should use this to 
     29    register a new theme. 
    3030 
    31      <var>$parent</var> is a optional value to indicate them inheritance. 
    32      If <var>$parent</var> is null / not set, we simply fall back to 
    33      the standard behavior, by using 'default'. 
     31    <var>$parent</var> is a optional value to indicate them inheritance. 
     32    If <var>$parent</var> is null / not set, we simply fall back to 
     33    the standard behavior, by using 'default'. 
    3434 
    35      <var>$priority</var> is an integer. Modules are sorted by priority and name. 
    36      Lowest priority comes first. This property is currently ignored when dealing 
    37      with themes. 
     35    <var>$priority</var> is an integer. Modules are sorted by priority and name. 
     36    Lowest priority comes first. This property is currently ignored when dealing 
     37    with themes. 
    3838 
    39      @param    name           <b>string</b>       Module name 
    40      @param    desc           <b>string</b>       Module description 
    41      @param    author         <b>string</b>       Module author name 
    42      @param    version        <b>string</b>       Module version 
    43      @param    properties     <b>array</b>        extra properties 
    44      (currently available keys : parent, priority, standalone_config, type, tplset) 
    45      */ 
    46      public function registerModule($name,$desc,$author,$version,$properties = array()) 
    47      { 
    48           # Fallback to legacy registerModule parameters 
    49           if (!is_array($properties)) { 
    50                $args = func_get_args(); 
    51                $properties = array(); 
    52                if (isset($args[4])) { 
    53                     $properties['parent']=$args[4]; 
    54                } 
    55                if (isset($args[5])) { 
    56                     $properties['priority']= (integer)$args[5]; 
    57                } 
    58           } 
    59           # Themes specifics properties 
    60           $properties = array_merge( 
    61                array('parent' => null, 'tplset' => DC_DEFAULT_TPLSET), 
    62                $properties, 
    63                array('permissions' => 'admin') // force themes perms 
    64           ); 
     39    @param    name            <b>string</b>        Module name 
     40    @param    desc            <b>string</b>        Module description 
     41    @param    author        <b>string</b>        Module author name 
     42    @param    version        <b>string</b>        Module version 
     43    @param    properties    <b>array</b>        extra properties 
     44    (currently available keys : parent, priority, standalone_config, type, tplset) 
     45     */ 
     46    public function registerModule($name, $desc, $author, $version, $properties = array()) 
     47    { 
     48        # Fallback to legacy registerModule parameters 
     49        if (!is_array($properties)) { 
     50            $args      = func_get_args(); 
     51            $properties = array(); 
     52            if (isset($args[4])) { 
     53                $properties['parent'] = $args[4]; 
     54            } 
     55            if (isset($args[5])) { 
     56                $properties['priority'] = (integer) $args[5]; 
     57            } 
     58        } 
     59        # Themes specifics properties 
     60        $properties = array_merge( 
     61            array('parent' => null, 'tplset' => DC_DEFAULT_TPLSET), 
     62            $properties, 
     63            array('permissions' => 'admin') // force themes perms 
     64        ); 
    6565 
    66           parent::registerModule($name, $desc, $author, $version, $properties); 
    67      } 
     66        parent::registerModule($name, $desc, $author, $version, $properties); 
     67    } 
    6868 
    69      /** 
    70      Loads namespace <var>$ns</var> specific file for module with ID 
    71      <var>$id</var> 
    72      Note : actually, only 'public' namespace is supported with themes. 
     69    /** 
     70    Loads namespace <var>$ns</var> specific file for module with ID 
     71    <var>$id</var> 
     72    Note : actually, only 'public' namespace is supported with themes. 
    7373 
    74      @param    id        <b>string</b>       Module ID 
    75      @param    ns        <b>string</b>       Namespace name 
    76      */ 
    77      public function loadNsFile($id,$ns=null) 
    78      { 
    79           switch ($ns) { 
    80                case 'public': 
    81                     $parent = $this->modules[$id]['parent']; 
    82                     if ($parent) { 
    83                          // This is not a real cascade - since we don't call loadNsFile -, 
    84                          // thus limiting inclusion process. 
    85                          // TODO : See if we have to change this. 
    86                          $this->loadModuleFile($this->modules[$parent]['root'].'/_public.php'); 
    87                     } 
    88                     $this->loadModuleFile($this->modules[$id]['root'].'/_public.php'); 
    89                     break; 
    90           } 
    91      } 
     74    @param    id        <b>string</b>        Module ID 
     75    @param    ns        <b>string</b>        Namespace name 
     76     */ 
     77    public function loadNsFile($id, $ns = null) 
     78    { 
     79        switch ($ns) { 
     80            case 'public': 
     81                $parent = $this->modules[$id]['parent']; 
     82                if ($parent) { 
     83                    // This is not a real cascade - since we don't call loadNsFile -, 
     84                    // thus limiting inclusion process. 
     85                    // TODO : See if we have to change this. 
     86                    $this->loadModuleFile($this->modules[$parent]['root'] . '/_public.php'); 
     87                } 
     88                $this->loadModuleFile($this->modules[$id]['root'] . '/_public.php'); 
     89                break; 
     90        } 
     91    } 
    9292} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map