public function compile(IObject $aObject, ObjectContainer $aObjectContainer, TargetCodeOutputStream $aDev, CompilerManager $aCompilerManager) { if ($aObject instanceof \org\jecat\framework\ui\xhtml\ObjectBase and !$aObject->count()) { Assert::type("org\\jecat\\framework\\ui\\xhtml\\Text", $aObject, 'aObject'); $sText = $aObject->source(); // locale translate do { if (!trim($sText)) { break; } // 排除 script/style 等标签中的内容 if ($aParent = $aObject->parent() and $aParent instanceof Node and in_array(strtolower($aParent->tagName()), array('script', 'style'))) { break; } // 仅 title alt 等属性 if ($aObject instanceof AttributeValue and !in_array(strtolower($aObject->name()), array('title', 'alt'))) { break; } // 过滤 注释 和 doctype 声明 if (preg_match('/^\\s*<\\!.*>\\s*$/', $sText)) { break; } $sText = Locale::singleton()->trans($sText, null, 'ui'); } while (0); $aDev->output($sText); } else { $this->compileChildren($aObject, $aObjectContainer, $aDev, $aCompilerManager); } }
public function compile(IObject $aObject, ObjectContainer $aObjectContainer, TargetCodeOutputStream $aDev, CompilerManager $aCompilerManager) { if ($aObject instanceof \org\jecat\framework\ui\xhtml\ObjectBase and !$aObject->count()) { $aDev->write($aObject->source()); } else { $this->compileChildren($aObject, $aObjectContainer, $aDev, $aCompilerManager); } }