aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-03-09 03:37:56 +0000
committerrvelices <rv-github@modusoptimus.com>2007-03-09 03:37:56 +0000
commit81030a7ab40a481d6d8c93539162a4a035ea09d1 (patch)
tree69cf4d569a7185a000f896ca9e5a91020bb46b94
parentf266c3b4cb4dd517eb4ccf7aa4e5a46936e5ccff (diff)
plugins only:
- fix in category_default.inc.php (action parameters were wrong if show_nb_comments was true) - refactor actions and events in picture.php in order to give more flexibility to plugins - added some variables in index.tpl (not used by pwg itself) to allow plugins to add their own content git-svn-id: http://piwigo.org/svn/trunk@1882 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/category_default.inc.php2
-rw-r--r--picture.php34
-rw-r--r--template/yoga/index.tpl4
3 files changed, 21 insertions, 19 deletions
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index 48e16fa95..3c1ed5a6c 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -155,7 +155,7 @@ SELECT COUNT(*) AS nb_comments
WHERE image_id = '.$row['id'].'
AND validated = \'true\'
;';
- $row = mysql_fetch_array(pwg_query($query));
+ list($row['nb_comments']) = mysql_fetch_array(pwg_query($query));
$template->assign_block_vars(
'thumbnails.line.thumbnail.nb_comments',
array(
diff --git a/picture.php b/picture.php
index 2366987c6..71fb2d3eb 100644
--- a/picture.php
+++ b/picture.php
@@ -70,20 +70,16 @@ function default_picture_content($content, $element_info)
return $content;
}
- global $user, $page;
+ global $user, $page, $template;
- $my_template = new Template(
- PHPWG_ROOT_PATH.'template/'.$user['template'],
- $user['theme']
- );
- $my_template->set_filenames(
+ $template->set_filenames(
array('default_content'=>'picture_content.tpl')
);
if ( !isset($page['slideshow']) and isset($element_info['high_url']) )
{
$uuid = uniqid(rand());
- $my_template->assign_block_vars(
+ $template->assign_block_vars(
'high',
array(
'U_HIGH' => $element_info['high_url'],
@@ -91,14 +87,14 @@ function default_picture_content($content, $element_info)
)
);
}
- $my_template->assign_vars( array(
+ $template->assign_vars( array(
'SRC_IMG' => $element_info['image_url'],
'ALT_IMG' => $element_info['file'],
'WIDTH_IMG' => @$element_info['scaled_width'],
'HEIGHT_IMG' => @$element_info['scaled_height'],
)
);
- return $my_template->parse( 'default_content', true);
+ return $template->parse( 'default_content', true);
}
// +-----------------------------------------------------------------------+
@@ -482,13 +478,9 @@ if ($metadata_showable)
$page['body_id'] = 'thePicturePage';
-// maybe someone wants a special display (call it before page_header so that
-// they can add stylesheets)
-$element_content = trigger_event(
- 'render_element_content',
- '',
- $picture['current']
- );
+// allow plugins to change what we computed before passing data to template
+$picture = trigger_event('picture_pictures_data', $picture);
+
if (isset($picture['next']['image_url'])
and isset($picture['next']['is_picture']))
@@ -530,7 +522,6 @@ $template->assign_vars(
'PICTURE_TITLE' => $picture['current']['name'],
'PHOTO' => $title_nb,
'TITLE' => $picture['current']['name'],
- 'ELEMENT_CONTENT' => $element_content,
'LEVEL_SEPARATOR' => $conf['level_separator'],
@@ -801,6 +792,15 @@ if (isset($_GET['slideshow']))
);
}
+// maybe someone wants a special display (call it before page_header so that
+// they can add stylesheets)
+$element_content = trigger_event(
+ 'render_element_content',
+ '',
+ $picture['current']
+ );
+$template->assign_var( 'ELEMENT_CONTENT', $element_content );
+
// +-----------------------------------------------------------------------+
// | sub pages |
// +-----------------------------------------------------------------------+
diff --git a/template/yoga/index.tpl b/template/yoga/index.tpl
index cb50158e8..1224e0bf2 100644
--- a/template/yoga/index.tpl
+++ b/template/yoga/index.tpl
@@ -41,6 +41,7 @@
<!-- BEGIN mode_created -->
<li><a href="{mode_created.URL}" title="{lang:mode_created_hint}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/calendar_created.png" class="button" alt="{lang:mode_created_hint}"></a></li>
<!-- END mode_created -->
+ {PLUGIN_INDEX_ACTIONS}
</ul>
<h2>{TITLE}</h2>
@@ -62,6 +63,7 @@
</div> <!-- titrePage -->
+{PLUGIN_INDEX_CONTENT_BEGIN}
<!-- BEGIN calendar -->
<!-- BEGIN navbar -->
<div class="calendarBar">
@@ -104,5 +106,5 @@
</ul>
<!-- END related_tags -->
-
+{PLUGIN_INDEX_CONTENT_END}
</div> <!-- content -->