本文整理汇总了PHP中eZTemplate::isDebugEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplate::isDebugEnabled方法的具体用法?PHP eZTemplate::isDebugEnabled怎么用?PHP eZTemplate::isDebugEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplate
的用法示例。
在下文中一共展示了eZTemplate::isDebugEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleResourceData
function handleResourceData($tpl, $handler, &$resourceData, $method, &$extraParameters)
{
// &$templateRoot, &$text, &$tstamp, $uri, $resourceName, &$path, &$keyData
$templateRoot =& $resourceData['root-node'];
$text =& $resourceData['text'];
$tstamp =& $resourceData['time-stamp'];
$uri =& $resourceData['uri'];
$resourceName =& $resourceData['resource'];
$path =& $resourceData['template-filename'];
$keyData =& $resourceData['key-data'];
$localeData =& $resourceData['locales'];
if (!file_exists($path)) {
return false;
}
$tstamp = filemtime($path);
$result = false;
$canCache = true;
$templateRoot = null;
if (!$handler->servesStaticData()) {
$canCache = false;
}
if (!$tpl->isCachingAllowed()) {
$canCache = false;
}
$keyData = 'file:' . $path;
if ($method == eZTemplate::RESOURCE_FETCH) {
if ($canCache) {
if ($handler->hasCompiledTemplate($keyData, $uri, $resourceData, $path, $extraParameters, $tstamp)) {
$resourceData['compiled-template'] = true;
return true;
}
}
if ($canCache) {
$templateRoot = $handler->cachedTemplateTree($keyData, $uri, $resourceName, $path, $extraParameters, $tstamp);
}
if ($templateRoot !== null) {
return true;
}
if (is_readable($path)) {
$text = file_get_contents($path);
$text = preg_replace("/\n|\r\n|\r/", "\n", $text);
$tplINI = $tpl->ini();
$charset = $tplINI->variable('CharsetSettings', 'DefaultTemplateCharset');
$locales = array();
$pos = strpos($text, "\n");
if ($pos !== false) {
$line = substr($text, 0, $pos);
if (preg_match("/^\\{\\*\\?template(.+)\\?\\*\\}/", $line, $tpl_arr)) {
$args = explode(" ", trim($tpl_arr[1]));
foreach ($args as $arg) {
$vars = explode('=', trim($arg));
switch ($vars[0]) {
case 'charset':
$val = $vars[1];
if ($val[0] == '"' and strlen($val) > 0 and $val[strlen($val) - 1] == '"') {
$val = substr($val, 1, strlen($val) - 2);
}
$charset = $val;
break;
case 'locale':
$val = $vars[1];
if ($val[0] == '"' and strlen($val) > 0 and $val[strlen($val) - 1] == '"') {
$val = substr($val, 1, strlen($val) - 2);
}
$locales = explode(',', $val);
break;
}
}
}
}
/* Setting locale to allow standard PHP functions to handle
* strtoupper/lower() */
$defaultLocale = trim($tplINI->variable('CharsetSettings', 'DefaultTemplateLocale'));
if ($defaultLocale != '') {
$locales = array_merge($locales, explode(',', $defaultLocale));
}
$localeData = $locales;
if ($locales && count($locales)) {
setlocale(LC_CTYPE, $locales);
}
if (eZTemplate::isDebugEnabled()) {
eZDebug::writeNotice("{$path}, {$charset}");
}
$codec = eZTextCodec::instance($charset, false, false);
if ($codec) {
eZDebug::accumulatorStart('template_resource_conversion', 'template_total', 'String conversion in template resource');
$text = $codec->convertString($text);
eZDebug::accumulatorStop('template_resource_conversion');
}
$result = true;
}
} else {
if ($method == eZTemplate::RESOURCE_QUERY) {
$result = true;
}
}
return $result;
}
示例2: resourceFor
function resourceFor($uri, &$res, &$template)
{
$args = explode(":", $uri);
if (isset($args[1])) {
$res = $args[0];
$template = $args[1];
} else {
$template = $uri;
}
if (eZTemplate::isDebugEnabled()) {
eZDebug::writeNotice("eZTemplate: Loading template \"{$template}\" with resource \"{$res}\"");
}
if (isset($this->Resources[$res]) and is_object($this->Resources[$res])) {
return $this->Resources[$res];
}
return $this->DefaultResource;
}