new event hook

This commit is contained in:
Garvin Hicking 2009-12-20 17:51:22 +00:00
parent 5f9b465d46
commit 6bb6a39d25
2 changed files with 22 additions and 4 deletions

View File

@ -3,13 +3,14 @@
Version 1.6 () Version 1.6 ()
------------------------------------------------------------------------ ------------------------------------------------------------------------
* Upgraded to PEAR Cache_Lite 1.7.8
* Added experimental global variable $i18n_filename_utf8 that can * Added experimental global variable $i18n_filename_utf8 that can
be set in a serendipity_config_local.inc.php or language include be set in a serendipity_config_local.inc.php or language include
file, which will return Unicode-Permalinks. file, which will return Unicode-Permalinks.
(http://board.s9y.org/viewtopic.php?f=11&t=15896) (http://board.s9y.org/viewtopic.php?f=11&t=15896)
* Added event hook backend_sendcomment for sending comments and
being able to chang via plugin API (onli)
Version 1.5 () Version 1.5 ()
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@ -1110,6 +1110,21 @@ function serendipity_sendComment($comment_id, $to, $fromName, $fromEmail, $fromU
$deleteURI = serendipity_rewriteURL(PATH_DELETE . '/'. $path .'/' . $comment_id . '/' . $id . '-' . serendipity_makeFilename($title) . '.html', 'baseURL'); $deleteURI = serendipity_rewriteURL(PATH_DELETE . '/'. $path .'/' . $comment_id . '/' . $id . '-' . serendipity_makeFilename($title) . '.html', 'baseURL');
$approveURI = serendipity_rewriteURL(PATH_APPROVE . '/'. $path .'/' . $comment_id . '/' . $id . '-' . serendipity_makeFilename($title) . '.html', 'baseURL'); $approveURI = serendipity_rewriteURL(PATH_APPROVE . '/'. $path .'/' . $comment_id . '/' . $id . '-' . serendipity_makeFilename($title) . '.html', 'baseURL');
$eventData = array( 'comment_id' => $comment_id,
'entry_id' => $id,
'entryURI' => $entryURI,
'$path' => $path,
'deleteURI' => $deleteURI,
'approveURI' => $approveURI,
'moderate_comment' => $moderate_comment,
'action_more' => array());
serendipity_plugin_api::hook_event('backend_sendcomment', $eventData);
$action_more = '';
foreach($eventData['action_more'] as $action) {
$action_more .= "\n" . str_repeat(' ', 3) . $action;
}
if ($type == 'TRACKBACK') { if ($type == 'TRACKBACK') {
/******************* TRACKBACKS *******************/ /******************* TRACKBACKS *******************/
@ -1129,7 +1144,8 @@ function serendipity_sendComment($comment_id, $to, $fromName, $fromEmail, $fromU
. (($moderate_comment) ? "\n" . str_repeat(' ', 2) . THIS_TRACKBACK_NEEDS_REVIEW : '') . (($moderate_comment) ? "\n" . str_repeat(' ', 2) . THIS_TRACKBACK_NEEDS_REVIEW : '')
. "\n" . str_repeat(' ', 3) . str_pad(VIEW_ENTRY, 15) . ' -- '. $entryURI . "\n" . str_repeat(' ', 3) . str_pad(VIEW_ENTRY, 15) . ' -- '. $entryURI
. "\n" . str_repeat(' ', 3) . str_pad(DELETE_TRACKBACK, 15) . ' -- '. $deleteURI . "\n" . str_repeat(' ', 3) . str_pad(DELETE_TRACKBACK, 15) . ' -- '. $deleteURI
. (($moderate_comment) ? "\n" . str_repeat(' ', 3) . str_pad(APPROVE_TRACKBACK, 15) . ' -- '. $approveURI : ''); . (($moderate_comment) ? "\n" . str_repeat(' ', 3) . str_pad(APPROVE_TRACKBACK, 15) . ' -- '. $approveURI : '')
. $action_more;
} else { } else {
@ -1152,7 +1168,8 @@ function serendipity_sendComment($comment_id, $to, $fromName, $fromEmail, $fromU
. (($moderate_comment) ? "\n" . str_repeat(' ', 2) . THIS_COMMENT_NEEDS_REVIEW : '') . (($moderate_comment) ? "\n" . str_repeat(' ', 2) . THIS_COMMENT_NEEDS_REVIEW : '')
. "\n" . str_repeat(' ', 3) . str_pad(VIEW_COMMENT, 15) . ' -- '. $entryURI .'#c'. $comment_id . "\n" . str_repeat(' ', 3) . str_pad(VIEW_COMMENT, 15) . ' -- '. $entryURI .'#c'. $comment_id
. "\n" . str_repeat(' ', 3) . str_pad(DELETE_COMMENT, 15) . ' -- '. $deleteURI . "\n" . str_repeat(' ', 3) . str_pad(DELETE_COMMENT, 15) . ' -- '. $deleteURI
. (($moderate_comment) ? "\n" . str_repeat(' ', 3) . str_pad(APPROVE_COMMENT, 15) . ' -- '. $approveURI : ''); . (($moderate_comment) ? "\n" . str_repeat(' ', 3) . str_pad(APPROVE_COMMENT, 15) . ' -- '. $approveURI : '')
. $action_more;
} }
return serendipity_sendMail($to, $subject, $text, $fromEmail, null, $fromName); return serendipity_sendMail($to, $subject, $text, $fromEmail, null, $fromName);