Index: branches/5.0.x/core/kernel/application.php =================================================================== diff -u -r12321 -r12323 --- branches/5.0.x/core/kernel/application.php (.../application.php) (revision 12321) +++ branches/5.0.x/core/kernel/application.php (.../application.php) (revision 12323) @@ -1,6 +1,6 @@ isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { + if (defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application before Init:'); } if (!$this->isDebugMode() && !constOn('DBG_ZEND_PRESENT')) { @@ -320,15 +312,15 @@ $this->RegisterDefaultBuildEvents(); $this->SetDefaultConstants(); - if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->Debugger->appendTimestamp('Before UnitConfigReader'); } $this->UnitConfigReader =& $this->recallObject('kUnitConfigReader'); $this->UnitConfigReader->scanModules(MODULES_PATH); $this->registerModuleConstants(); - if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->Debugger->appendTimestamp('After UnitConfigReader'); } @@ -339,13 +331,13 @@ $this->HttpQuery =& $this->recallObject('HTTPQuery'); - if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->Debugger->appendTimestamp('Processed HTTPQuery initial'); } $this->Session =& $this->recallObject('Session'); - if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->Debugger->appendTimestamp('Processed Session'); } @@ -363,7 +355,7 @@ $this->Session->ValidateExpired(); - if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->Debugger->appendTimestamp('Processed HTTPQuery AfterInit'); } @@ -372,17 +364,16 @@ $this->Phrases->Init('phrases'); - if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->Debugger->appendTimestamp('Loaded cache and phrases'); } $this->UnitConfigReader->AfterConfigRead(); - if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->Debugger->appendTimestamp('Processed AfterConfigRead'); } - /*// Module items are recalled during url parsing & PhrasesCache is needed already there, // because it's used in their build events. That's why phrases cache initialization is // called from kHTTPQuery in case when mod_rewrite is used @@ -403,7 +394,7 @@ $this->ValidateLogin(); - if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->Debugger->profileFinish('kernel4_startup'); } @@ -617,14 +608,12 @@ $this->registerClass('Params', KERNEL_PATH.'/utility/params.php'); $this->registerClass('kHelper', KERNEL_PATH.'/kbase.php'); - $this->registerClass('kCache', KERNEL_PATH.'/utility/cache.php', 'Cache', Array('Params')); - $this->registerClass('kHTTPQuery', KERNEL_PATH.'/utility/http_query.php', 'HTTPQuery', Array('Params') ); + $this->registerClass('kCache', KERNEL_PATH.'/utility/cache.php', 'Cache', 'Params'); + $this->registerClass('kHTTPQuery', KERNEL_PATH.'/utility/http_query.php', 'HTTPQuery', 'Params'); $this->registerClass('Session', KERNEL_PATH.'/session/session.php'); $this->registerClass('SessionStorage', KERNEL_PATH.'/session/session.php'); - - $this->registerClass('Params', KERNEL_PATH.'/utility/params.php', 'kActions'); $this->registerClass('kMultipleFilter', KERNEL_PATH.'/utility/filters.php'); @@ -636,25 +625,20 @@ $this->registerClass('kMainTagProcessor', KERNEL_PATH.'/processors/main_processor.php','m_TagProcessor', 'kTagProcessor'); $this->registerClass('kDBTagProcessor', KERNEL_PATH.'/db/db_tag_processor.php', null, 'kTagProcessor'); - - $this->registerClass('TemplatesCache', KERNEL_PATH.'/nparser/template.php',null, 'kDBTagProcessor'); - $this->registerClass('Template', KERNEL_PATH.'/nparser/template.php'); - + $this->registerClass('TemplatesCache', KERNEL_PATH.'/nparser/template_cache.php', null, Array ('kHelper', 'kDBTagProcessor')); $this->registerClass('NParser', KERNEL_PATH.'/nparser/nparser.php'); - $this->registerClass('kEmailSendingHelper', KERNEL_PATH.'/utility/email_send.php', 'EmailSender', Array('kHelper')); + $this->registerClass('kEmailSendingHelper', KERNEL_PATH.'/utility/email_send.php', 'EmailSender', 'kHelper'); $this->registerClass('kSocket', KERNEL_PATH.'/utility/socket.php', 'Socket'); if (file_exists(MODULES_PATH.'/in-commerce/units/currencies/currency_rates.php')) { $this->registerClass('kCurrencyRates', MODULES_PATH.'/in-commerce/units/currencies/currency_rates.php'); } - $this->registerClass('FCKeditor', FULL_PATH.'/admin/editor/cmseditor/fckeditor.php'); // need this? - /* Moved from MyApplication */ - $this->registerClass('InpSession',KERNEL_PATH.'/../units/general/inp_ses_storage.php','Session'); - $this->registerClass('InpSessionStorage',KERNEL_PATH.'/../units/general/inp_ses_storage.php','SessionStorage'); + $this->registerClass('InpSession',KERNEL_PATH.'/../units/general/inp_ses_storage.php', 'Session'); + $this->registerClass('InpSessionStorage',KERNEL_PATH.'/../units/general/inp_ses_storage.php', 'SessionStorage'); $this->registerClass('kCatDBItem',KERNEL_PATH.'/../units/general/cat_dbitem.php'); $this->registerClass('kCatDBItemExportHelper',KERNEL_PATH.'/../units/general/cat_dbitem_export.php', 'CatItemExportHelper'); @@ -792,7 +776,7 @@ $event_manager =& $this->recallObject('EventManager'); /* @var $event_manager kEventManager */ - if($this->isDebugMode() && constOn('DBG_SHOW_HTTPQUERY')) { + if (defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_SHOW_HTTPQUERY')) { $this->Debugger->appendHTML('HTTPQuery:'); $this->Debugger->dumpVars($this->HttpQuery->_Params); } @@ -812,7 +796,7 @@ */ function Run() { - if($this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { + if (defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application before Run:'); } @@ -862,48 +846,31 @@ $t = ltrim($cms_handler->GetDesignTemplate(), '/'); - if ($this->isDebugMode()) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->Debugger->appendHTML('Design Template: ' . $t . '; CategoryID: ' . $this->GetVar('m_cat_id')); } } /*else { $cms_handler->SetCatByTemplate(); }*/ - if($this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { + if (defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application before Parsing:'); } - if (defined('NPARSER') && 'NPARSER') { - $this->HTML = $this->NParser->Run( $t ); - } - else { - $this->HTML = $this->Parser->ParseTemplate( $t ); - } + $this->HTML = $this->Parser->Run($t); - if ($this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { + if (defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application after Parsing:'); } } function InitParser($theme_name = false) { - if (defined('NPARSER') && 'NPARSER') { - if( !is_object($this->NParser) ) { - $this->NParser =& $this->recallObject('NParser'); - $this->TemplatesCache =& $this->recallObject('TemplatesCache'); - - // can be removed in future -// $this->Parser =& $this->recallObject('TemplateParser'); - $this->Parser =& $this->NParser; - } + if( !is_object($this->Parser) ) { + $this->Parser =& $this->recallObject('NParser'); + $this->TemplatesCache =& $this->recallObject('TemplatesCache'); } - else { - if( !is_object($this->Parser) ) { - $this->Parser =& $this->recallObject('TemplateParser'); - $this->TemplatesCache =& $this->recallObject('TemplatesCache'); - } - } $this->TemplatesCache->forceThemeName = $theme_name; } @@ -918,11 +885,12 @@ function Done() { $this->HandleEvent( new kEvent('adm:OnBeforeShutdown') ); - if ($this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { + + if (defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application before Done:'); } - if ($this->isDebugMode()) { + if (defined('DEBUG_MODE') && $this->isDebugMode()) { $this->EventManager->RunRegularEvents(reAFTER); $this->Session->SaveData(); @@ -1254,34 +1222,11 @@ $this->cache[$name] = $tpl; } - /* Seems to be not used anywhere... /Kostja - - function SetTemplateBody($title,$body) - { - $templates_cache =& $this->recallObject('TemplatesCache'); - $templates_cache->SetTemplateBody($title,$body); - }*/ - - function ProcessTag($tag_data) - { - $a_tag = new Tag($tag_data,$this->Parser); - return $a_tag->DoProcessTag(); - } - function ProcessParsedTag($prefix, $tag, $params) { - if (defined('NPARSER') && NPARSER) { - $p = $this->Parser->GetProcessor($prefix); - return $p->ProcessParsedTag($tag, $params, $prefix); - } + $processor = $this->Parser->GetProcessor($prefix); - $a_tag = new Tag('',$this->Parser); - $a_tag->Tag = $tag; - $tmp=$this->Application->processPrefix($prefix); - $a_tag->Processor = $tmp['prefix']; - $a_tag->Special = $tmp['special']; - $a_tag->NamedParams = $params; - return $a_tag->DoProcessTag(); + return $processor->ProcessParsedTag($tag, $params, $prefix); } /** @@ -1306,7 +1251,10 @@ */ function ParseBlock($params, $pass_params = 0, $as_template = false) { - if (substr($params['name'], 0, 5) == 'html:') return substr($params['name'], 6); + if (substr($params['name'], 0, 5) == 'html:') { + return substr($params['name'], 6); + } + return $this->Parser->ParseBlock($params, $pass_params, $as_template); } @@ -1793,7 +1741,7 @@ $ret = ENV_VAR_NAME.'='; } - $ret .= $sid.(constOn('INPORTAL_ENV') ? '-' : ':'); + $ret .= $sid . '-'; // SID-TEMPLATE $encode = false; if (isset($params['__URLENCODE__'])) { @@ -2235,8 +2183,9 @@ */ function &recallTagProcessor($prefix) { - $this->InitParser(); // because kDBTagProcesor is in TemplateParser dependencies - $result =& $this->recallObject($prefix.'_TagProcessor'); + $this->InitParser(); // because kDBTagProcesor is in NParser dependencies + $result =& $this->recallObject($prefix . '_TagProcessor'); + return $result; }