當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZTemplateCompiler::isDevelopmentModeEnabled方法代碼示例

本文整理匯總了PHP中eZTemplateCompiler::isDevelopmentModeEnabled方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZTemplateCompiler::isDevelopmentModeEnabled方法的具體用法?PHP eZTemplateCompiler::isDevelopmentModeEnabled怎麽用?PHP eZTemplateCompiler::isDevelopmentModeEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZTemplateCompiler的用法示例。


在下文中一共展示了eZTemplateCompiler::isDevelopmentModeEnabled方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generatePHPCodeChildren


//.........這裏部分代碼省略.........
                                                                                $key = $resourceObject->cacheKey($keyData, $tmpResourceData, $templatePath, $node[5]);
                                                                                $cacheFileName = eZTemplateCompiler::compilationFilename($key, $tmpResourceData);
                                                                                $directory = eZTemplateCompiler::compilationDirectory();
                                                                                $phpScript = eZDir::path(array($directory, $cacheFileName));
                                                                                $phpScriptText = $php->thisVariableText($phpScript, 0, 0, false);
                                                                                $resourceMap[$uriKey] = array('key' => $uriKey, 'uri' => $uri, 'phpscript' => $phpScript);
                                                                            }
                                                                        }
                                                                    }
                                                                    if ($useComments) {
                                                                        $variablePlacement = $node[6];
                                                                        if ($variablePlacement) {
                                                                            $originalText = eZTemplateCompiler::fetchTemplatePiece($variablePlacement);
                                                                            $php->addComment("Resource Acquisition:", true, true, array('spacing' => $spacing));
                                                                            $php->addComment($originalText, true, true, array('spacing' => $spacing));
                                                                        }
                                                                    }
                                                                    if ($hasCompiledCode) {
                                                                        if ($resourceVariableName) {
                                                                            $phpScriptText = '$phpScript';
                                                                            $phpScriptArray = array();
                                                                            foreach ($resourceMap as $resourceMapItem) {
                                                                                $phpScriptArray[$resourceMapItem['key']] = $resourceMapItem['phpscript'];
                                                                            }
                                                                            if (!$resourceFilename) {
                                                                                $php->addVariable("phpScriptArray", $phpScriptArray, eZPHPCreator::VARIABLE_ASSIGNMENT, array('spacing' => $spacing));
                                                                                $resourceVariableNameText = "\${$resourceVariableName}";
                                                                                $php->addCodePiece("\$phpScript = isset( \$phpScriptArray[{$resourceVariableNameText}] ) ? \$phpScriptArray[{$resourceVariableNameText}] : false;\n", array('spacing' => $spacing));
                                                                            } else {
                                                                                $php->addVariable("phpScript", $phpScriptArray[$node[10]], eZPHPCreator::VARIABLE_ASSIGNMENT, array('spacing' => $spacing));
                                                                            }
                                                                            // The default is to only check if it exists
                                                                            $modificationCheckText = "file_exists( {$phpScriptText} )";
                                                                            if (eZTemplateCompiler::isDevelopmentModeEnabled()) {
                                                                                $modificationCheckText = "@filemtime( {$phpScriptText} ) > filemtime( {$uriText} )";
                                                                            }
                                                                            $php->addCodePiece("\$resourceFound = false;\nif " . ($resourceData['use-comments'] ? "/*TC:" . __LINE__ . "*/" : "") . "( {$phpScriptText} !== false and {$modificationCheckText} )\n{\n", array('spacing' => $spacing));
                                                                        } else {
                                                                            $php->addCodePiece("\$resourceFound = false;\n", array('spacing' => $spacing));
                                                                            $phpScript = $resourceMap[0]['phpscript'];
                                                                            $phpScriptText = $php->thisVariableText($phpScript, 0, 0, false);
                                                                            // Not sure where this should come from
                                                                            //                         if ( $resourceIndex > 0 )
                                                                            //                             $php->addCodePiece( "else " );
                                                                            // The default is to only check if it exists
                                                                            $modificationCheckText = "file_exists( {$phpScriptText} )";
                                                                            if (eZTemplateCompiler::isDevelopmentModeEnabled()) {
                                                                                $modificationCheckText = "@filemtime( {$phpScriptText} ) > filemtime( {$uriText} )";
                                                                            }
                                                                            $php->addCodePiece("if " . ($resourceData['use-comments'] ? "/*TC:" . __LINE__ . "*/" : "") . "( {$modificationCheckText} )\n{\n", array('spacing' => $spacing));
                                                                        }
                                                                        /* Generate code to do a namespace switch and includes the template */
                                                                        $code = "\$resourceFound = true;\n\$namespaceStack[] = array( \$rootNamespace, \$currentNamespace );\n";
                                                                        if ($newRootNamespace) {
                                                                            $newRootNamespaceText = $php->thisVariableText($newRootNamespace, 0, 0, false);
                                                                            $code .= "\$currentNamespace = \$rootNamespace = !\$currentNamespace ? {$newRootNamespaceText} : ( \$currentNamespace . ':' . {$newRootNamespaceText} );\n";
                                                                        } else {
                                                                            $code .= "\$rootNamespace = \$currentNamespace;\n";
                                                                        }
                                                                        $code .= "\$tpl->createLocalVariablesList();\n" . "\$tpl->appendTemplateFetch( {$uriText} );\n" . "include( '" . eZTemplateCompiler::TemplatePrefix() . "' . {$phpScriptText} );\n" . "\$tpl->unsetLocalVariables();\n" . "\$tpl->destroyLocalVariablesList();\n" . "list( \$rootNamespace, \$currentNamespace ) = array_pop( \$namespaceStack );\n";
                                                                        $php->addCodePiece($code, array('spacing' => $spacing + 4));
                                                                        if ($useFallbackCode) {
                                                                            $php->addCodePiece("}\nelse\n{\n    \$resourceFound = true;\n", array('spacing' => $spacing));
                                                                        } else {
                                                                            $php->addCodePiece("}\n", array('spacing' => $spacing));
                                                                        }
開發者ID:runelangseid,項目名稱:ezpublish,代碼行數:67,代碼來源:eztemplatecompiler.php


注:本文中的eZTemplateCompiler::isDevelopmentModeEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。