当前位置: 首页>>代码示例>>PHP>>正文


PHP eZPHPCreator::exists方法代码示例

本文整理汇总了PHP中eZPHPCreator::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPHPCreator::exists方法的具体用法?PHP eZPHPCreator::exists怎么用?PHP eZPHPCreator::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZPHPCreator的用法示例。


在下文中一共展示了eZPHPCreator::exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createCommonCompileTemplate

 static function createCommonCompileTemplate()
 {
     $php = new eZPHPCreator(eZTemplateCompiler::compilationDirectory(), 'common.php');
     if ($php->exists()) {
         return;
     }
     $php->addComment("This file contains functions which are common to all compiled templates.\n\n" . 'NOTE: This file is autogenerated and should not be modified, any changes will be lost!');
     $php->addSpace();
     $php->addDefine('EZ_TEMPLATE_COMPILER_COMMON_CODE', true);
     $php->addSpace();
     $namespaceStack = array();
     $php->addCodePiece("if ( !isset( \$namespaceStack ) )\n");
     $php->addVariable('namespaceStack', $namespaceStack, eZPHPCreator::VARIABLE_ASSIGNMENT, array('spacing' => 4));
     $php->addSpace();
     $lbracket = '{';
     $rbracket = '}';
     $initText = "if ( !function_exists( 'compiledfetchvariable' ) )\n{$lbracket}\n    function compiledFetchVariable( \$vars, \$namespace, \$name )\n    {$lbracket}\n        \$exists = ( array_key_exists( \$namespace, \$vars ) and\n                    array_key_exists( \$name, \$vars[\$namespace] ) );\n        if ( \$exists )\n        {$lbracket}\n            return \$vars[\$namespace][\$name];\n        {$rbracket}\n        return null;\n    {$rbracket}\n{$rbracket}\nif ( !function_exists( 'compiledfetchtext' ) )\n{$lbracket}\n    function compiledFetchText( \$tpl, \$rootNamespace, \$currentNamespace, \$namespace, \$var )\n    {$lbracket}\n        \$text = '';\n        \$tpl->appendElement( \$text, \$var, \$rootNamespace, \$currentNamespace );\n        return \$text;\n    {$rbracket}\n{$rbracket}\nif ( !function_exists( 'compiledAcquireResource' ) )\n{$lbracket}\n    function compiledAcquireResource( \$phpScript, \$key, &\$originalText,\n                                      \$tpl, \$rootNamespace, \$currentNamespace )\n    {\n        include( '" . eZTemplateCompiler::TemplatePrefix() . "' . \$phpScript );\n        if ( isset( \$text ) )\n        {\n            \$originalText .= \$text;\n            return true;\n        }\n        return false;\n    }\n{$rbracket}\nif ( !function_exists( 'compiledfetchattribute' ) )\n{$lbracket}\n    function compiledFetchAttribute( \$value, \$attributeValue )\n    {$lbracket}\n        if ( is_object( \$value ) )\n        {$lbracket}\n            if ( method_exists( \$value, \"attribute\" ) and\n                 method_exists( \$value, \"hasattribute\" ) )\n            {$lbracket}\n                if ( \$value->hasAttribute( \$attributeValue ) )\n                {$lbracket}\n                    return \$value->attribute( \$attributeValue );\n                {$rbracket}\n            {$rbracket}\n        {$rbracket}\n        else if ( is_array( \$value ) )\n        {$lbracket}\n            if ( isset( \$value[\$attributeValue] ) )\n            {$lbracket}\n                return \$value[\$attributeValue];\n            {$rbracket}\n        {$rbracket}\n        return null;\n    {$rbracket}\n{$rbracket}\n";
     $php->addCodePiece($initText);
     $php->store(true);
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:20,代码来源:eztemplatecompiler.php


注:本文中的eZPHPCreator::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。