Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r8751 -r8860 --- trunk/core/kernel/application.php (.../application.php) (revision 8751) +++ trunk/core/kernel/application.php (.../application.php) (revision 8860) @@ -29,7 +29,15 @@ */ var $Parser; + /** + * New Parser (Experimental) + * + * @var NParser + */ + var $NParser; + + /** * Holds parser output buffer * @access private * @var string @@ -507,10 +515,14 @@ $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.'/parser/template.php'); + $this->registerClass('TemplatesCache', KERNEL_PATH.'/parser/template.php',null, 'kDBTagProcessor'); $this->registerClass('Template', KERNEL_PATH.'/parser/template.php'); $this->registerClass('TemplateParser', KERNEL_PATH.'/parser/template_parser.php',null, 'kDBTagProcessor'); + if (defined('NPARSER') && 'NPARSER') { + $this->registerClass('NParser', KERNEL_PATH.'/nparser/nparser.php'); + } + $this->registerClass('kEmailSendingHelper', KERNEL_PATH.'/utility/email_send.php', 'EmailSender', Array('kHelper')); $this->registerClass('kSocket', KERNEL_PATH.'/utility/socket.php', 'Socket'); @@ -727,7 +739,12 @@ $this->Debugger->appendMemoryUsage('Application before Parsing:'); } - $this->HTML = $this->Parser->ParseTemplate( $t ); + if (defined('NPARSER') && 'NPARSER') { + $this->HTML = $this->NParser->Run( $t ); + } + else { + $this->HTML = $this->Parser->ParseTemplate( $t ); + } if ($this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application after Parsing:'); @@ -736,10 +753,22 @@ function InitParser() { - if( !is_object($this->Parser) ) { - $this->Parser =& $this->recallObject('TemplateParser'); - $this->TemplatesCache =& $this->recallObject('TemplatesCache'); + 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; + } } + else { + if( !is_object($this->Parser) ) { + $this->Parser =& $this->recallObject('TemplateParser'); + $this->TemplatesCache =& $this->recallObject('TemplatesCache'); + } + } } /** @@ -1017,6 +1046,10 @@ function ProcessParsedTag($prefix, $tag, $params) { + if (defined('NPARSER') && NPARSER) { + $p = $this->Parser->GetProcessor($prefix); + return $p->ProcessParsedTag($tag, $params, $prefix); + } $a_tag = new Tag('',$this->Parser); $a_tag->Tag = $tag; @@ -2113,7 +2146,17 @@ fclose($fp); } - if( !$this->errorHandlers ) return true; + if( !$this->errorHandlers ) { + if ($errno == E_USER_ERROR) { + header('HTTP/1.0 500 Script Fatal Error'); + echo ('
+ Fatal Error: + '."$errstr in $errfile on line $errline".' +
'); + exit; + } + return true; + } $i = 0; // while (not foreach) because it is array of references in some cases $eh_count = count($this->errorHandlers);