Index: branches/5.3.x/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r15483 -r15698 --- branches/5.3.x/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 15483) +++ branches/5.3.x/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 15698) @@ -1,6 +1,6 @@ configData as $prefix => $config) { - if (isset($config['ConfigPriority'])) { - $prioritized_configs[$prefix] = $config['ConfigPriority']; + if ( $config->getConfigPriority() !== false ) { + $prioritized_configs[$prefix] = $config->getConfigPriority(); continue; } + $this->parseConfig($prefix); } @@ -264,23 +267,26 @@ $store_cache = $this->StoreCache; } - if ($store_cache || (defined('IS_INSTALL') && IS_INSTALL)) { + if ( $store_cache || (defined('IS_INSTALL') && IS_INSTALL) ) { // cache is not stored during install, but dynamic clones should be processed in any case $this->processDynamicClones(); $this->retrieveCollections(); } - if ($store_cache) { + if ( $store_cache ) { $this->_sortRewriteListeners(); $this->Application->HandleEvent(new kEvent('adm:OnAfterCacheRebuild')); $this->Application->cacheManager->UpdateUnitCache(); - if (defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_VALIDATE_CONFIGS') && DBG_VALIDATE_CONFIGS) { + if ( defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_VALIDATE_CONFIGS') && DBG_VALIDATE_CONFIGS ) { // validate configs here to have changes from OnAfterConfigRead hooks to prefixes foreach ($this->configData as $prefix => $config) { - if (!isset($config['TableName'])) continue; + if ( !$config->getTableName() ) { + continue; + } + $this->ValidateConfig($prefix); } } @@ -371,26 +377,26 @@ { foreach ($this->configData as $prefix => $config) { // collect replacement templates - if (array_key_exists('ReplacementTemplates', $config) && $config['ReplacementTemplates']) { - $this->Application->ReplacementTemplates = array_merge($this->Application->ReplacementTemplates, $config['ReplacementTemplates']); + if ( $config->getReplacementTemplates() ) { + $this->Application->ReplacementTemplates = array_merge($this->Application->ReplacementTemplates, $config->getReplacementTemplates()); } // collect rewrite listeners - if (array_key_exists('RewriteListener', $config) && $config['RewriteListener']) { - $rewrite_listeners = $config['RewriteListener']; + if ( $config->getRewriteListener() ) { + $rewrite_listeners = $config->getRewriteListener(); - if (!is_array($rewrite_listeners)) { + if ( !is_array($rewrite_listeners) ) { // when one method is used to build and parse url $rewrite_listeners = Array ($rewrite_listeners, $rewrite_listeners); } foreach ($rewrite_listeners as $index => $rewrite_listener) { - if (strpos($rewrite_listener, ':') === false) { + if ( strpos($rewrite_listener, ':') === false ) { $rewrite_listeners[$index] = $prefix . '_EventHandler:' . $rewrite_listener; } } - $rewrite_priority = array_key_exists('RewritePriority', $config) ? $config['RewritePriority'] : false; + $rewrite_priority = $config->getRewritePriority(); $this->Application->RewriteListeners[$prefix] = Array ('listener' => $rewrite_listeners, 'priority' => $rewrite_priority); } @@ -414,13 +420,13 @@ protected function parseClasses($prefix) { - $config =& $this->configData[$prefix]; + $config = $this->configData[$prefix]; $register_classes = $this->getClasses($prefix); foreach ($register_classes as $class_info) { $this->Application->registerClass( $class_info['class'], - $config['BasePath'] . DIRECTORY_SEPARATOR . $class_info['file'], + $config->getBasePath() . DIRECTORY_SEPARATOR . $class_info['file'], $class_info['pseudo'] ); @@ -432,57 +438,57 @@ protected function parseScheduledTasks($prefix) { - $config =& $this->configData[$prefix]; + $config = $this->configData[$prefix]; - if ( !isset($config['ScheduledTasks']) || !$config['ScheduledTasks'] ) { + if ( !$config->getScheduledTasks() ) { return ; } - $scheduled_tasks = $config['ScheduledTasks']; + $scheduled_tasks = $config->getScheduledTasks(); foreach ($scheduled_tasks as $short_name => $scheduled_task_info) { $event_status = array_key_exists('Status', $scheduled_task_info) ? $scheduled_task_info['Status'] : STATUS_ACTIVE; - $this->Application->delayUnitProcessing('registerScheduledTask', Array ( $short_name, $config['Prefix'] . ':' . $scheduled_task_info['EventName'], $scheduled_task_info['RunSchedule'], $event_status )); + $this->Application->delayUnitProcessing('registerScheduledTask', Array ( $short_name, $config->getPrefix() . ':' . $scheduled_task_info['EventName'], $scheduled_task_info['RunSchedule'], $event_status )); } } protected function parseHooks($prefix) { - $config =& $this->configData[$prefix]; + $config = $this->configData[$prefix]; - if ( !isset($config['Hooks']) || !$config['Hooks'] ) { - return ; + if ( !$config->getHooks() ) { + return; } - $hooks = $config['Hooks']; + $hooks = $config->getHooks(); foreach ($hooks as $hook) { - if ( isset($config['ParentPrefix']) && ($hook['HookToPrefix'] == $config['ParentPrefix']) ) { - trigger_error('Depricated Hook Usage [prefix: ' . $config['Prefix'] . '; do_prefix: ' . $hook['DoPrefix'] . '] use #PARENT# as HookToPrefix value, where HookToPrefix is same as ParentPrefix', defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_NOTICE); + if ( $config->getParentPrefix() && ($hook['HookToPrefix'] == $config->getParentPrefix()) ) { + trigger_error('Deprecated Hook Usage [prefix: ' . $config->getPrefix() . '; do_prefix: ' . $hook['DoPrefix'] . '] use #PARENT# as HookToPrefix value, where HookToPrefix is same as ParentPrefix', defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_NOTICE); } - if ($hook['HookToPrefix'] == '') { + if ( $hook['HookToPrefix'] == '' ) { // new: set hooktoprefix to current prefix if not set - $hook['HookToPrefix'] = $config['Prefix']; + $hook['HookToPrefix'] = $config->getPrefix(); } - if ( isset($config['ParentPrefix']) ) { + if ( $config->getParentPrefix() ) { // new: allow to set hook to parent prefix what ever it is - if ($hook['HookToPrefix'] == '#PARENT#') { - $hook['HookToPrefix'] = $config['ParentPrefix']; + if ( $hook['HookToPrefix'] == '#PARENT#' ) { + $hook['HookToPrefix'] = $config->getParentPrefix(); } - if ($hook['DoPrefix'] == '#PARENT#') { - $hook['DoPrefix'] = $config['ParentPrefix']; + if ( $hook['DoPrefix'] == '#PARENT#' ) { + $hook['DoPrefix'] = $config->getParentPrefix(); } } - elseif ($hook['HookToPrefix'] == '#PARENT#' || $hook['DoPrefix'] == '#PARENT#') { + elseif ( $hook['HookToPrefix'] == '#PARENT#' || $hook['DoPrefix'] == '#PARENT#' ) { // we need parent prefix but it's not set ! continue; } $hook_events = (array)$hook['HookToEvent']; - $do_prefix = $hook['DoPrefix'] == '' ? $config['Prefix'] : $hook['DoPrefix']; + $do_prefix = $hook['DoPrefix'] == '' ? $config->getPrefix() : $hook['DoPrefix']; foreach ($hook_events as $hook_event) { $hook_event = $hook['HookToPrefix'] . '.' . $hook['HookToSpecial'] . ':' . $hook_event; @@ -495,21 +501,25 @@ protected function parseAggregatedTags($prefix) { - $config =& $this->configData[$prefix]; - $aggregated_tags = isset($config['AggregateTags']) ? $config['AggregateTags'] : Array (); + $config = $this->configData[$prefix]; + $aggregated_tags = $config->getAggregateTags(); + if ( !$aggregated_tags ) { + return; + } + foreach ($aggregated_tags as $aggregate_tag) { - if ( isset($config['ParentPrefix']) ) { - if ($aggregate_tag['AggregateTo'] == $config['ParentPrefix']) { - trigger_error('Depricated Aggregate Tag Usage [prefix: '.$config['Prefix'].'; AggregateTo: '.$aggregate_tag['AggregateTo'].'] use #PARENT# as AggregateTo value, where AggregateTo is same as ParentPrefix', defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_NOTICE); + if ( $config->getParentPrefix() ) { + if ( $aggregate_tag['AggregateTo'] == $config->getParentPrefix() ) { + trigger_error('Deprecated Aggregate Tag Usage [prefix: ' . $config->getPrefix() . '; AggregateTo: ' . $aggregate_tag['AggregateTo'] . '] use #PARENT# as AggregateTo value, where AggregateTo is same as ParentPrefix', defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_NOTICE); } - if ($aggregate_tag['AggregateTo'] == '#PARENT#') { - $aggregate_tag['AggregateTo'] = $config['ParentPrefix']; + if ( $aggregate_tag['AggregateTo'] == '#PARENT#' ) { + $aggregate_tag['AggregateTo'] = $config->getParentPrefix(); } } - $aggregate_tag['LocalPrefix'] = $config['Prefix']; + $aggregate_tag['LocalPrefix'] = $config->getPrefix(); $this->Application->delayUnitProcessing('registerAggregateTag', Array ($aggregate_tag)); } } @@ -518,23 +528,23 @@ { global $debugger; - $config =& $this->configData[$prefix]; + $config = $this->configData[$prefix]; - $tablename = $config['TableName']; + $table_name = $config->getTableName(); $float_types = Array ('float', 'double', 'numeric'); - $table_found = $this->Conn->Query('SHOW TABLES LIKE "'.$tablename.'"'); - if (!$table_found) { + $table_found = $this->Conn->Query('SHOW TABLES LIKE "' . $table_name . '"'); + if ( !$table_found ) { // config present, but table missing, strange kUtil::safeDefine('DBG_RAISE_ON_WARNINGS', 1); - $debugger->appendHTML("Config Warning: Table $tablename missing, but prefix ".$config['Prefix']." requires it!"); + $debugger->appendHTML("Config Warning: Table $table_name missing, but prefix " . $prefix . " requires it!"); $debugger->WarningCount++; - return ; + return; } - $res = $this->Conn->Query('DESCRIBE '.$tablename); - $config_link = $debugger->getFileLink(FULL_PATH.$this->prefixFiles[$config['Prefix']], 1, $config['Prefix']); + $res = $this->Conn->Query('DESCRIBE ' . $table_name); + $config_link = $debugger->getFileLink(FULL_PATH . $this->prefixFiles[$prefix], 1, $prefix); $error_messages = Array ( 'field_not_found' => 'Field %s exists in the database, but is not defined in config', @@ -553,77 +563,78 @@ ); $config_errors = Array (); - $tablename = preg_replace('/^'.preg_quote(TABLE_PREFIX, '/').'(.*)/', '\\1', $tablename); // remove table prefix + $fields = $config->getFields(); + $table_name = preg_replace('/^' . preg_quote(TABLE_PREFIX, '/') . '(.*)/', '\\1', $table_name); // remove table prefix - // validate unit config field declaration in relation to database table structure - foreach ($res as $field) { - $f_name = $field['Field']; + if ( $fields ) { + // validate unit config field declaration in relation to database table structure + foreach ($res as $field) { + $f_name = $field['Field']; - if (getArrayValue($config, 'Fields')) { - if (preg_match('/l[\d]+_[\w]/', $f_name)) { + if ( preg_match('/l[\d]+_[\w]/', $f_name) ) { // skip multilingual fields continue; } - if (!array_key_exists ($f_name, $config['Fields'])) { + if ( !array_key_exists($f_name, $fields) ) { $config_errors[] = sprintf($error_messages['field_not_found'], $f_name); } else { $db_default = $field['Default']; - if (is_numeric($db_default)) { + if ( is_numeric($db_default) ) { $db_default = preg_match('/[\.,]/', $db_default) ? (float)$db_default : (int)$db_default; } $default_missing = false; - $options = $config['Fields'][$f_name]; + $options = $fields[$f_name]; $not_null = isset($options['not_null']) && $options['not_null']; $formatter = array_key_exists('formatter', $options) ? $options['formatter'] : false; - if (!array_key_exists('default', $options)) { + if ( !array_key_exists('default', $options) ) { $config_errors[] = sprintf($error_messages['default_missing'], $f_name); $default_missing = true; } - if ($field['Null'] != 'YES') { + if ( $field['Null'] != 'YES' ) { // field is NOT NULL in database (MySQL5 for null returns "NO", but MySQL4 returns "") - if ( $f_name != $config['IDField'] && !isset($options['not_null']) /*&& !isset($options['required'])*/ ) { + if ( $f_name != $config->getIDField() && !isset($options['not_null']) /*&& !isset($options['required'])*/ ) { $config_errors[] = sprintf($error_messages['not_null_error1'], $f_name); } - if ($not_null && !isset($options['default']) ) { + if ( $not_null && !isset($options['default']) ) { $config_errors[] = sprintf($error_messages['not_null_error2'], $f_name); } } - elseif ($not_null) { + elseif ( $not_null ) { $config_errors[] = sprintf($error_messages['not_null_error3'], $f_name); } - if (($formatter == 'kDateFormatter') && $not_null) { + if ( ($formatter == 'kDateFormatter') && $not_null ) { $config_errors[] = sprintf($error_messages['date_column_not_null_error'], $f_name); } // columns, holding userid should have NULL as default value - if (array_key_exists('type', $options) && !$default_missing) { + if ( array_key_exists('type', $options) && !$default_missing ) { // both type and default value set - if (preg_match('/ById$/', $f_name) && $options['default'] !== null) { + if ( preg_match('/ById$/', $f_name) && $options['default'] !== null ) { $config_errors[] = sprintf($error_messages['user_column_default_error'], $f_name); } } - if (!array_key_exists('type', $options)) { + if ( !array_key_exists('type', $options) ) { $config_errors[] = sprintf($error_messages['type_missing'], $f_name); } - if (!$default_missing && ($field['Type'] != 'text')) { + if ( !$default_missing && ($field['Type'] != 'text') ) { if ( is_null($db_default) && $not_null ) { $db_default = $options['type'] == 'string' ? '' : 0; } - if ($f_name == $config['IDField'] && $options['type'] != 'string' && $options['default'] !== 0) { + if ( $f_name == $config->getIDField() && $options['type'] != 'string' && $options['default'] !== 0 ) { $config_errors[] = sprintf($error_messages['invalid_default'], 'IDField ', $f_name, $this->varDump($options['default']), $this->varDump($field['Default'])); } - else if (((string)$options['default'] != '#NOW#') && ($db_default !== $options['default']) && !in_array($options['type'], $float_types)) { + else if ( ((string)$options['default'] != '#NOW#') && ($db_default !== $options['default']) && !in_array($options['type'], $float_types) ) { $config_errors[] = sprintf($error_messages['invalid_default'], '', $f_name, $this->varDump($options['default']), $this->varDump($db_default)); } } @@ -632,27 +643,29 @@ } // validate virtual fields - if ( array_key_exists('VirtualFields', $config) ) { - foreach ($config['VirtualFields'] as $f_name => $options) { - if (!array_key_exists('type', $options)) { + if ( $config->getVirtualFields() ) { + foreach ($config->getVirtualFields() as $f_name => $options) { + if ( !array_key_exists('type', $options) ) { $config_errors[] = sprintf($error_messages['virtual_type_missing'], $f_name); } - if (array_key_exists('not_null', $options)) { + if ( array_key_exists('not_null', $options) ) { $config_errors[] = sprintf($error_messages['virtual_not_null_error'], $f_name); } - if (!array_key_exists('default', $options)) { + if ( !array_key_exists('default', $options) ) { $config_errors[] = sprintf($error_messages['virtual_default_missing'], $f_name); } } } // validate calculated fields - if ( array_key_exists('CalculatedFields', $config) ) { - foreach ($config['CalculatedFields'] as $special => $calculated_fields) { - foreach ($calculated_fields as $calculated_field => $calculated_field_expr) { - if ( !isset($config['VirtualFields'][$calculated_field]) ) { + if ( $config->getCalculatedFieldSpecials() ) { + $virtual_fields = $config->getVirtualFields(); + + foreach ($config->getCalculatedFieldSpecials() as $special) { + foreach ($config->getCalculatedFieldsBySpecial($special) as $calculated_field => $calculated_field_expr) { + if ( !isset($virtual_fields[$calculated_field]) ) { $config_errors[] = sprintf($error_messages['invalid_calculated_field'], $calculated_field); } } @@ -661,9 +674,9 @@ $config_errors = array_unique($config_errors); } - if ($config_errors) { - $error_prefix = 'Config Error'.(count($config_errors) > 1 ? 's' : '').': for prefix '.$config_link.' ('.$tablename.') in unit config:
'; - $config_errors = $error_prefix.'   '.implode('
   ', $config_errors); + if ( $config_errors ) { + $error_prefix = 'Config Error' . (count($config_errors) > 1 ? 's' : '') . ': for prefix ' . $config_link . ' (' . $table_name . ') in unit config:
'; + $config_errors = $error_prefix . '   ' . implode('
   ', $config_errors); kUtil::safeDefine('DBG_RAISE_ON_WARNINGS', 1); $debugger->appendHTML($config_errors); @@ -678,60 +691,69 @@ function postProcessConfig($prefix, $config_key, $dst_prefix_var) { - $main_config =& $this->configData[$prefix]; - $sub_configs = isset($main_config[$config_key]) && $main_config[$config_key] ? $main_config[$config_key] : Array (); + $main_config = $this->configData[$prefix]; + $sub_configs = $main_config->getSetting($config_key); + if ( !$sub_configs ) { return Array (); } - unset($main_config[$config_key]); - $processed = array(); - foreach ($sub_configs as $sub_prefix => $sub_config) { - if ($config_key == 'AggregateConfigs' && !isset($this->configData[$sub_prefix])) { + $processed = Array (); + $main_config->setSetting($config_key, null); + + foreach ($sub_configs as $sub_prefix => $sub_config_data) { + if ( $config_key == 'AggregateConfigs' && !isset($this->configData[$sub_prefix]) ) { $this->loadConfig($sub_prefix); } - $sub_config['Prefix'] = $sub_prefix; - $this->configData[$sub_prefix] = kUtil::array_merge_recursive($this->configData[$$dst_prefix_var], $sub_config); + $sub_config_data['Prefix'] = $sub_prefix; + $sub_config_base = $this->configData[$$dst_prefix_var]->getRaw(); + $sub_config = new kUnitConfig($sub_prefix, kUtil::array_merge_recursive($sub_config_base, $sub_config_data)); + $this->configData[$sub_prefix] = $sub_config; + // when merging empty array to non-empty results non-empty array, but empty is required - foreach ($sub_config as $sub_key => $sub_value) { - if (!$sub_value) { - unset($this->configData[$sub_prefix][$sub_key]); + foreach ($sub_config_data as $sub_key => $sub_value) { + if ( !$sub_value && is_array($sub_value) ) { + $sub_config->setSetting($sub_key, null); } } - if ($config_key == 'Clones') { + + if ( $config_key == 'Clones' ) { $this->prefixFiles[$sub_prefix] = $this->prefixFiles[$prefix]; } $this->postProcessConfig($sub_prefix, $config_key, $dst_prefix_var); - if ($config_key == 'AggregateConfigs') { + + if ( $config_key == 'AggregateConfigs' ) { $processed = array_merge($this->postProcessConfig($sub_prefix, 'Clones', 'prefix'), $processed); } - elseif ($this->ProcessAllConfigs) { + elseif ( $this->ProcessAllConfigs ) { $this->parseConfig($sub_prefix); } + array_push($processed, $sub_prefix); } - if (!$prefix) { - // configs, that used only for cloning & not used ifself + if ( !$prefix ) { + // configs, that used only for cloning & not used itself unset($this->configData[$prefix]); } + return array_unique($processed); } function PreloadConfigFile($filename) { $config_found = file_exists(FULL_PATH . $filename) && $this->configAllowed($filename); - if (defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_PROFILE_INCLUDES') && DBG_PROFILE_INCLUDES) { + if ( defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_PROFILE_INCLUDES') && DBG_PROFILE_INCLUDES ) { if ( in_array($filename, get_included_files()) ) { return ''; } global $debugger; - if ($config_found) { + if ( $config_found ) { $file = FULL_PATH . $filename; $file_crc = crc32($file); @@ -741,26 +763,34 @@ $debugger->profilerAddTotal('includes', 'inc_' . $file_crc); } } - elseif ($config_found) { + elseif ( $config_found ) { include_once(FULL_PATH . $filename); } - if ($config_found) { - if (isset($config) && $config) { + if ( $config_found ) { + /* @var $config kUnitConfig|Array */ + + if ( isset($config) && $config ) { // config file is included for 1st time -> save it's content for future processing - $prefix = array_key_exists('Prefix', $config) ? $config['Prefix'] : ''; + if ( !is_object($config) ) { + $prefix = array_key_exists('Prefix', $config) ? $config['Prefix'] : ''; + $config = new kUnitConfig($prefix, $config); + } + else { + $prefix = $config->getPrefix(); + } - preg_match($this->_moduleFolderRegExp, $filename, $rets); - $config['ModuleFolder'] = str_replace(DIRECTORY_SEPARATOR, '/', $rets[1]); - $config['BasePath'] = dirname(FULL_PATH . $filename); + preg_match($this->_moduleFolderRegExp, $filename, $regs); + $config->setModuleFolder(str_replace(DIRECTORY_SEPARATOR, '/', $regs[1])); + $config->setBasePath(dirname(FULL_PATH . $filename)); - if (array_key_exists('AdminTemplatePath', $config)) { + if ( $config->getAdminTemplatePath() !== false ) { // append template base folder for admin templates path of this prefix - $module_templates = $rets[1] == 'core' ? '' : substr($rets[1], 8) . '/'; - $config['AdminTemplatePath'] = $module_templates . $config['AdminTemplatePath']; + $module_templates = $regs[1] == 'core' ? '' : substr($regs[1], 8) . '/'; + $config->setAdminTemplatePath($module_templates . $config->getAdminTemplatePath()); } - if (array_key_exists($prefix, $this->prefixFiles) && ($this->prefixFiles[$prefix] != $filename)) { + if ( array_key_exists($prefix, $this->prefixFiles) && ($this->prefixFiles[$prefix] != $filename) ) { trigger_error( 'Single unit config prefix "' . $prefix . '" ' . 'is used in multiple unit config files: ' . @@ -832,89 +862,49 @@ } /** - * Reads unit (specified by $prefix) - * option specified by $option + * Returns unit config for given prefix * * @param string $prefix - * @param string $name - * @param mixed $default - * @return string + * @return kUnitConfig * @access public */ - function getUnitOption($prefix, $name, $default = false) + public function getUnitConfig($prefix = null) { - if (preg_match('/(.*)\.(.*)/', $prefix, $rets)) { - if (!isset($this->configData[$rets[1]])) { - $this->loadConfig($rets[1]); - } - $ret = isset($this->configData[$rets[1]][$name][$rets[2]]) ? $this->configData[$rets[1]][$name][$rets[2]] : false; -// $ret = getArrayValue($this->configData, $rets[1], $name, $rets[2]); - } - else { - if (!isset($this->configData[$prefix])) { - $this->loadConfig($prefix); - } - $ret = isset($this->configData[$prefix][$name]) ? $this->configData[$prefix][$name] : false; -// $ret = getArrayValue($this->configData, $prefix, $name); - } - return $ret === false ? $default : $ret; - } - - /** - * Read all unit with $prefix options - * - * @param string $prefix - * @return Array - * @access public - */ - function getUnitOptions($prefix) - { - if (!isset($this->configData[$prefix])) { + if ( !isset($this->configData[$prefix]) ) { $this->loadConfig($prefix); } return $this->configData[$prefix]; } /** - * Set's new unit option value + * Returns prefixes of unit configs, that were registered * - * @param string $prefix - * @param string $name - * @param string $value + * @return Array * @access public */ - function setUnitOption($prefix, $name, $value) + public function getPrefixes() { - if ( preg_match('/(.*)\.(.*)/', $prefix, $rets) ) { - if ( !isset($this->configData[$rets[1]]) ) { - $this->loadConfig($rets[1]); - } - - $this->configData[$rets[1]][$name][$rets[2]] = $value; - } - else { - if ( !isset($this->configData[$prefix]) ) { - $this->loadConfig($prefix); - } - - $this->configData[$prefix][$name] = $value; - } + return array_keys($this->configData); } protected function getClasses($prefix) { - $config =& $this->configData[$prefix]; + $config = $this->configData[$prefix]; $class_params = Array ('ItemClass', 'ListClass', 'EventHandlerClass', 'TagProcessorClass'); - $register_classes = isset($config['RegisterClasses']) ? $config['RegisterClasses'] : Array (); + $register_classes = $config->getRegisterClasses(); foreach ($class_params as $param_name) { - if ( !isset($config[$param_name]) ) { + $value = $config->getSetting($param_name); + + if ( !$value ) { continue; } - $config[$param_name]['pseudo'] = $this->getPseudoByOptionName($param_name, $prefix); - $register_classes[] = $config[$param_name]; + $value['pseudo'] = $this->getPseudoByOptionName($param_name, $prefix); + $config->setSetting($param_name, $value); + + $register_classes[] = $value; } return $register_classes; @@ -1011,8 +1001,8 @@ $this->includeConfigFiles(MODULES_PATH); //make sure to re-read all configs $this->AfterConfigRead(); - foreach ($this->configData as $prefix => $config_data) { - $callback_function[0]->$callback_function[1]($prefix, $config_data, $params); + foreach ($this->configData as $prefix => $config) { + $callback_function[0]->$callback_function[1]($prefix, $config, $params); } }