Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24787
Modified Files:
Tag: branch-smarty
serendipity_config.inc.php serendipity_functions.inc.php
serendipity_genpage.inc.php
Log Message:
- Allow Smarty to hook certain event
- Rename the sidebar function to serendipity_printSidebar
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.419.2.20
retrieving revision 1.419.2.21
diff -u -d -r1.419.2.20 -r1.419.2.21
--- serendipity_functions.inc.php 19 Sep 2004 00:31:25 -0000 1.419.2.20
+++ serendipity_functions.inc.php 19 Sep 2004 20:06:35 -0000 1.419.2.21
@@ -213,11 +213,6 @@
$comments = serendipity_fetchComments($id);
}
- ob_start();
- serendipity_plugin_api::hook_event('frontend_comment', $nullParam);
- $data['frontend_comment'] = ob_get_contents();
- ob_end_clean();
-
$serendipity['smarty']->assign(
array(
'commentform_url' => $url,
@@ -229,7 +224,6 @@
'commentform_replyTo' => serendipity_generateCommentList($id, $comments, ((isset($data['replyTo']) && ($data['replyTo'])) ? $data['replyTo'] : 0)),
'commentform_subscribe' => isset($data['subscribe']) ? 'checked="checked"' : '',
'commentform_data' => isset($data['comment']) ? $data['comment'] : '',
- 'plugin_frontend_comment' => $data['frontend_comment'],
'is_commentform_showToolbar' => $showToolbar,
'is_allowSubscriptions' => $serendipity['allowSubscriptions'],
'is_moderate_comments' => $moderate_comments
@@ -1082,11 +1076,6 @@
$serendipity['smarty']->assign('footer_next_page', $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[page]=' . ($serendipity['GET']['page'] + 1) . $add_query);
}
}
-
- ob_start();
- serendipity_plugin_api::hook_event('entries_footer', $serendipity);
- $serendipity['smarty']->assign('plugin_entries_footer', ob_get_contents());
- ob_end_clean();
}
/**
@@ -3469,9 +3458,36 @@
}
}
-function serendipity_printSidebar($params, &$smarty) {
+function serendipity_smarty_hookPlugin($params, &$smarty) {
+ global $serendipity;
+ static $hookable = array('frontend_header',
+ 'entries_footer',
+ 'frontend_comment');
+
+ if ( !isset($params['hook']) ) {
+ $smarty->trigger_error(__FUNCTION__ .": missing 'hook' parameter");
+ return;
+ }
+ if ( !in_array($params['hook'], $hookable) ) {
+ $smarty->trigger_error(__FUNCTION__ .": illegal hook '". $params['hook'] ."'");
+ return;
+ }
+
+ if ( !isset($params['data']) ) {
+ $params['data'] = &$serendipity;
+ }
+ if ( !isset($params['adddata']) ) {
+ $params['add'] = null;
+ }
+
+ serendipity_plugin_api::hook_event($params['hook'], $params['data'], $params['add']);
+}
+
+
+function serendipity_smarty_printSidebar($params, &$smarty) {
if ( !isset($params['side']) ) {
$smarty->trigger_error(__FUNCTION__ .": missing 'side' parameter");
+ return;
}
echo serendipity_plugin_api::generate_plugins($params['side']);
}
Index: serendipity_genpage.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_genpage.inc.php,v
retrieving revision 1.33.2.7
retrieving revision 1.33.2.8
diff -u -d -r1.33.2.7 -r1.33.2.8
--- serendipity_genpage.inc.php 19 Sep 2004 00:31:25 -0000 1.33.2.7
+++ serendipity_genpage.inc.php 19 Sep 2004 20:06:36 -0000 1.33.2.8
@@ -38,12 +38,6 @@
)
);
-ob_start();
-serendipity_plugin_api::hook_event('frontend_header', $serendipity);
-$serendipity['smarty']->assign('plugin_frontend_header', ob_get_contents());
-ob_end_clean();
-
-
if ($serendipity['smarty_raw_mode']) {
include_once(serendipity_getTemplateFile('layout.php', 'serendipityPath'));
} else {
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.93.2.5
retrieving revision 1.93.2.6
diff -u -d -r1.93.2.5 -r1.93.2.6
--- serendipity_config.inc.php 19 Sep 2004 00:31:25 -0000 1.93.2.5
+++ serendipity_config.inc.php 19 Sep 2004 20:06:35 -0000 1.93.2.6
@@ -244,8 +244,8 @@
$serendipity['smarty']->register_modifier('emptyPrefix', 'serendipity_emptyPrefix');
$serendipity['smarty']->register_modifier('printf', 'serendipity_printf');
$serendipity['smarty']->register_modifier('formatTime', 'serendipity_smarty_formatTime');
-$serendipity['smarty']->register_function('serendipity_sidebar', 'serendipity_printSidebar');
-
+$serendipity['smarty']->register_function('serendipity_printSidebar', 'serendipity_smarty_printSidebar');
+$serendipity['smarty']->register_function('serendipity_hookPlugin', 'serendipity_smarty_hookPlugin');
/* vim: set sts=4 ts=4 expandtab : */
?>
|