Changeset 2492:8a25f7bf147d
- Timestamp:
- 10/26/13 00:17:52 (10 years ago)
- Branch:
- 2.6
- Location:
- inc
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.core.php
r2198 r2492 87 87 $this->url = new dcUrlHandlers(); 88 88 89 $this->plugins = new dc Modules($this);89 $this->plugins = new dcPlugins($this); 90 90 91 91 $this->rest = new dcRestServer($this); -
inc/core/class.dc.modules.php
r2432 r2492 16 16 @brief Modules handler 17 17 18 Provides an object to handle modules (themes or plugins). An instance of this 19 class is provided by dcCore $plugins property and used for plugins. 18 Provides an object to handle modules (themes or plugins). 20 19 */ 21 20 class dcModules … … 36 35 protected static $_n; 37 36 38 protected static $type = 'plugin';37 protected static $type = null; 39 38 40 39 public $core; ///< <b>dcCore</b> dcCore instance … … 161 160 @param author <b>string</b> Module author name 162 161 @param version <b>string</b> Module version 163 @param properties <b>array</b> extra properties (currently available keys : permissions, priority) 162 @param properties <b>array</b> extra properties 163 (currently available keys : permissions, priority, type) 164 164 */ 165 165 public function registerModule($name,$desc,$author,$version, $properties = array()) 166 166 { 167 # Fallback to legacy registerModule parameters 167 168 if (!is_array($properties)) { 168 //Fallback to legacy registerModule parameters169 169 $args = func_get_args(); 170 170 $properties = array(); … … 176 176 } 177 177 } 178 179 # Default module properties 178 180 $properties = array_merge( 179 181 array( … … 185 187 ); 186 188 187 if ($properties['type'] !== null && $properties['type'] != self::$type) { 189 # Check module type 190 if (self::$type !== null && $properties['type'] !== null && $properties['type'] != self::$type) { 188 191 $this->errors[] = sprintf( 189 192 __('Module "%s" has type "%s" that mismatch required module type "%s".'), … … 195 198 } 196 199 200 # Check module perms on admin side 197 201 $permissions = $properties['permissions']; 198 202 if ($this->ns == 'admin') { … … 204 208 } 205 209 210 # Check module install on multiple path 206 211 if ($this->id) { 207 212 $module_exists = array_key_exists($name,$this->modules_names); -
inc/core/class.dc.themes.php
r2239 r2492 41 41 @param author <b>string</b> Module author name 42 42 @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) 44 45 */ 45 46 public function registerModule($name,$desc,$author,$version,$properties = array()) 46 47 { 48 # Fallback to legacy registerModule parameters 47 49 if (!is_array($properties)) { 48 //Fallback to legacy registerModule parameters49 50 $args = func_get_args(); 50 51 $properties = array(); … … 56 57 } 57 58 } 59 # Themes specifics properties 58 60 $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 65 64 ); 66 65 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); 90 67 } 91 68 … … 114 91 } 115 92 } 116 ?> -
inc/prepend.php
r2466 r2492 35 35 $__autoload['dcPostMedia'] = dirname(__FILE__).'/core/class.dc.postmedia.php'; 36 36 $__autoload['dcModules'] = dirname(__FILE__).'/core/class.dc.modules.php'; 37 $__autoload['dcPlugins'] = dirname(__FILE__).'/core/class.dc.plugins.php'; 37 38 $__autoload['dcThemes'] = dirname(__FILE__).'/core/class.dc.themes.php'; 38 39 $__autoload['dcRestServer'] = dirname(__FILE__).'/core/class.dc.rest.php';
Note: See TracChangeset
for help on using the changeset viewer.