Changeset 3730:5c45a5df9a59 for inc/core/class.dc.themes.php
- Timestamp:
- 03/08/18 17:58:39 (8 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.themes.php
r2945 r3730 10 10 # 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 if (!defined('DC_RC_PATH')) { return;}12 if (!defined('DC_RC_PATH')) {return;} 13 13 14 14 /** … … 20 20 21 21 This class extends dcModules. 22 */22 */ 23 23 class dcThemes extends dcModules 24 24 { 25 25 protected static $type = 'theme'; 26 26 27 28 29 27 /** 28 This method registers a theme in modules list. You should use this to 29 register a new theme. 30 30 31 32 33 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'. 34 34 35 36 37 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. 38 38 39 @param name <b>string</b>Module name40 @param desc <b>string</b>Module description41 @param author <b>string</b>Module author name42 @param version <b>string</b>Module version43 @param properties <b>array</b>extra properties44 45 46 public function registerModule($name,$desc,$author,$version,$properties = array())47 48 49 50 $args= func_get_args();51 52 53 $properties['parent']=$args[4];54 55 56 $properties['priority']= (integer)$args[5];57 58 59 60 61 62 63 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 ); 65 65 66 67 66 parent::registerModule($name, $desc, $author, $version, $properties); 67 } 68 68 69 70 71 72 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. 73 73 74 @param id <b>string</b>Module ID75 @param ns <b>string</b>Namespace name76 77 public function loadNsFile($id,$ns=null)78 79 80 81 82 83 84 85 86 $this->loadModuleFile($this->modules[$parent]['root'].'/_public.php');87 88 $this->loadModuleFile($this->modules[$id]['root'].'/_public.php');89 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 } 92 92 }
Note: See TracChangeset
for help on using the changeset viewer.