aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2009-02-04 02:33:50 +0000
committerrvelices <rv-github@modusoptimus.com>2009-02-04 02:33:50 +0000
commit9428613b2da6132ef507e92461535283d48ecdc1 (patch)
tree0e4cbef5443faac056052c20c3197eac82cfd6d1
parent9a0510c88c16b5617d7714b0e958b0f71f0fd912 (diff)
merge 3120 from trunk
optimizations (php only) - removed unnecessary call to array_unique in get_image_ids_for_tags - put back in smarty exec time counting (debug mode) for each included template - prefix some smarty modifiers with @ in some templates - do not call format_date (still very slow due to mktime and date even after prev commit) from category_default.inc.php - if used in templates format_date can be used as a smarty modifier git-svn-id: http://piwigo.org/svn/branches/2.0@3121 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/category_default.inc.php35
-rw-r--r--include/functions_tag.inc.php3
-rw-r--r--include/smarty/libs/Smarty.class.php18
-rw-r--r--template/yoga/header.tpl4
-rw-r--r--template/yoga/mainpage_categories.tpl20
-rw-r--r--template/yoga/picture_content.tpl2
6 files changed, 42 insertions, 40 deletions
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index afb195a3a..da2386445 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -106,28 +106,25 @@ foreach ($pictures as $row)
$tpl_var =
array(
- 'ID' => $row['id'],
- 'TN_SRC' => $thumbnail_url,
- 'TN_ALT' => $row['file'],
- 'TN_TITLE' => get_thumbnail_title($row),
- 'ICON_TS' => get_icon($row['date_available']),
- 'URL' => $url,
+ 'ID' => $row['id'],
+ 'TN_SRC' => $thumbnail_url,
+ 'TN_ALT' => $row['file'],
+ 'TN_TITLE' => get_thumbnail_title($row),
+ 'ICON_TS' => get_icon($row['date_available']),
+ 'URL' => $url,
/* Fields for template-extension usage */
'FILE_PATH' => $row['path'],
- 'FILE_POSTED' => format_date($row['date_available'], 'mysql_datetime'),
- 'FILE_CREATED' => (empty($row['date_creation'])) ?
- '-': format_date($row['date_creation'], 'mysql_date'),
- 'FILE_DESC' => (empty($row['comment'])) ? '-' : $row['comment'],
- 'FILE_AUTHOR' => (empty($row['author'])) ? '-' : $row['author'],
+ 'FILE_POSTED' => $row['date_available'],
+ 'FILE_CREATED' => $row['date_creation'],
+ 'FILE_DESC' => $row['comment'],
+ 'FILE_AUTHOR' => $row['author'],
'FILE_HIT' => $row['hit'],
- 'FILE_SIZE' => (empty($row['filesize'])) ? '-' : $row['filesize'],
- 'FILE_WIDTH' => (empty($row['width'])) ? '-' : $row['width'],
- 'FILE_HEIGHT' => (empty($row['height'])) ? '-' : $row['height'],
- 'FILE_METADATE' => (empty($row['date_metadata_update'])) ?
- '-': format_date($row['date_metadata_update'], 'mysql_date'),
- 'FILE_RATE' => (empty($row['rate'])) ? '-' : $row['rate'],
- 'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
+ 'FILE_SIZE' => $row['filesize'],
+ 'FILE_WIDTH' => $row['width'],
+ 'FILE_HEIGHT' => $row['height'],
+ 'FILE_METADATE' => $row['date_metadata_update'],
+ 'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
true:false, /* lack of include/functions_picture.inc.php */
);
@@ -184,4 +181,4 @@ trigger_action('loc_end_index_thumbnails', $pictures);
$template->assign_var_from_handle('THUMBNAILS', 'index_thumbnails');
pwg_debug('end include/category_default.inc.php');
-?>
+?> \ No newline at end of file
diff --git a/include/functions_tag.inc.php b/include/functions_tag.inc.php
index fdb1674d7..033967ca4 100644
--- a/include/functions_tag.inc.php
+++ b/include/functions_tag.inc.php
@@ -189,8 +189,7 @@ SELECT image_id
{
$items = array_intersect($items, $images);
}
-
- return array_unique($items);
+ return $items;
break;
}
case 'OR':
diff --git a/include/smarty/libs/Smarty.class.php b/include/smarty/libs/Smarty.class.php
index 95ec67bab..8e56346f9 100644
--- a/include/smarty/libs/Smarty.class.php
+++ b/include/smarty/libs/Smarty.class.php
@@ -20,7 +20,7 @@
*
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
- * smarty-discussion-subscribe@googlegroups.com
+ * smarty-discussion-subscribe@googlegroups.com
*
* @link http://www.smarty.net/
* @copyright 2001-2005 New Digital Group, Inc.
@@ -1057,7 +1057,7 @@ class Smarty
} else {
// var non-existant, return valid reference
$_tmp = null;
- return $_tmp;
+ return $_tmp;
}
}
@@ -1116,7 +1116,7 @@ class Smarty
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
{
static $_cache_info = array();
-
+
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
? $this->error_reporting : error_reporting() & ~E_NOTICE);
@@ -1303,6 +1303,12 @@ class Smarty
error_reporting($_smarty_old_error_level);
return;
} else {
+ if ($this->debugging) {
+ // capture time for debugging info
+ $_params = array();
+ require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+ $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
+ }
error_reporting($_smarty_old_error_level);
if (isset($_smarty_results)) { return $_smarty_results; }
}
@@ -1932,10 +1938,10 @@ class Smarty
{
return eval($code);
}
-
+
/**
* Extracts the filter name from the given callback
- *
+ *
* @param callback $function
* @return string
*/
@@ -1950,7 +1956,7 @@ class Smarty
return $function;
}
}
-
+
/**#@-*/
}
diff --git a/template/yoga/header.tpl b/template/yoga/header.tpl
index 668d7c505..abe063799 100644
--- a/template/yoga/header.tpl
+++ b/template/yoga/header.tpl
@@ -6,13 +6,13 @@
<meta name="generator" content="Piwigo (aka PWG), see piwigo.org">
{if isset($meta_ref) }
{if isset($INFO_AUTHOR)}
-<meta name="author" content="{$INFO_AUTHOR|replace:'"':' '}">
+<meta name="author" content="{$INFO_AUTHOR|@replace:'"':' '}">
{/if}
{if isset($related_tags)}
<meta name="keywords" content="{foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first}, {/if}{$tag.name}{/foreach}">
{/if}
{if isset($COMMENT_IMG)}
-<meta name="description" content="{$COMMENT_IMG|strip_tags:false|replace:'"':' '}{if isset($INFO_FILE)} - {$INFO_FILE}{/if}">
+<meta name="description" content="{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}{if isset($INFO_FILE)} - {$INFO_FILE}{/if}">
{else}
<meta name="description" content="{$PAGE_TITLE}{if isset($INFO_FILE)} - {$INFO_FILE}{/if}">
{/if}
diff --git a/template/yoga/mainpage_categories.tpl b/template/yoga/mainpage_categories.tpl
index e56b637aa..e1cc953ff 100644
--- a/template/yoga/mainpage_categories.tpl
+++ b/template/yoga/mainpage_categories.tpl
@@ -6,7 +6,7 @@
<div class="thumbnailCategory">
<div class="illustration">
<a href="{$cat.URL}">
- <img src="{$cat.TN_SRC}" alt="{$cat.TN_ALT}" title="{$cat.NAME|replace:'"':' '} - {'hint_category'|@translate}">
+ <img src="{$cat.TN_SRC}" alt="{$cat.TN_ALT}" title="{$cat.NAME|@replace:'"':' '} - {'hint_category'|@translate}">
</a>
</div>
<div class="description">
@@ -14,15 +14,15 @@
<a href="{$cat.URL}">{$cat.NAME}</a>
{$cat.ICON_TS}
</h3>
- <div class="text">
- {if isset($cat.INFO_DATES) }
- <p class="dates">{$cat.INFO_DATES}</p>
- {/if}
- <p class="Nb_images">{$cat.CAPTION_NB_IMAGES}</p>
- {if not empty($cat.DESCRIPTION)}
- <p>{$cat.DESCRIPTION}</p>
- {/if}
- </div>
+ <div class="text">
+ {if isset($cat.INFO_DATES) }
+ <p class="dates">{$cat.INFO_DATES}</p>
+ {/if}
+ <p class="Nb_images">{$cat.CAPTION_NB_IMAGES}</p>
+ {if not empty($cat.DESCRIPTION)}
+ <p>{$cat.DESCRIPTION}</p>
+ {/if}
+ </div>
</div>
</div>
</li>
diff --git a/template/yoga/picture_content.tpl b/template/yoga/picture_content.tpl
index b6e148fdd..dcf0f6d24 100644
--- a/template/yoga/picture_content.tpl
+++ b/template/yoga/picture_content.tpl
@@ -4,7 +4,7 @@
{/if}
<img src="{$SRC_IMG}" style="width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;" alt="{$ALT_IMG}"
{if isset($COMMENT_IMG)}
- title="{$COMMENT_IMG|strip_tags:false|replace:'"':' '}" {else} title="{$current.TITLE|replace:'"':' '} - {$ALT_IMG}"
+ title="{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}" {else} title="{$current.TITLE|@replace:'"':' '} - {$ALT_IMG}"
{/if}>
{if isset($high) }
</a>