Added possibility for templates to register a central function
serendipity_plugin_api_event_hook() and serendipity_plugin_api_pre_event_hook()
This commit is contained in:
parent
f47a3e9b83
commit
efbb45c006
@ -3,6 +3,15 @@
|
||||
Version 1.5 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
* Added possibility for templates to register a central function
|
||||
serendipity_plugin_api_event_hook() and
|
||||
serendipity_plugin_api_pre_event_hook() that can be used to
|
||||
use plugin API interaction WITHOUT actual plugins. So special
|
||||
plugins can be bundled within a template, without the need to
|
||||
seperately install them. The "pre" function is called BEFORE
|
||||
all normal plugins are executed, the normal function is called
|
||||
AFTER plugin execution. (garvinhicking)
|
||||
|
||||
* Change javascript non-wysiwyg insertion methods to propery
|
||||
return to scrollposition, patch by onli
|
||||
|
||||
|
@ -1006,6 +1006,11 @@ class serendipity_plugin_api
|
||||
// skip the execution of any follow-up plugins.
|
||||
$plugins = serendipity_plugin_api::get_event_plugins();
|
||||
|
||||
if (function_exists('serendipity_plugin_api_pre_event_hook')) {
|
||||
$apifunc = 'serendipity_plugin_api_pre_event_hook';
|
||||
$apifunc($event_name, $bag, $eventData, $addData);
|
||||
}
|
||||
|
||||
if (is_array($plugins)) {
|
||||
// foreach() operates on copies of values, but we want to operate on references, so we use while()
|
||||
@reset($plugins);
|
||||
@ -1028,6 +1033,12 @@ class serendipity_plugin_api
|
||||
$plugin_data['p']->event_hook($event_name, $bag, $eventData, $addData);
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('serendipity_plugin_api_event_hook')) {
|
||||
$apifunc = 'serendipity_plugin_api_event_hook';
|
||||
$apifunc($event_name, $bag, $eventData, $addData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -13,6 +13,18 @@ include dirname(__FILE__) . '/lang_en.inc.php';
|
||||
|
||||
$serendipity['smarty']->assign(array('currpage'=> "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']));
|
||||
|
||||
function serendipity_plugin_api_event_hook($event, &$bag, &$eventData, $addData = null) {
|
||||
global $serendipity;
|
||||
|
||||
switch($event) {
|
||||
case 'frontend_footer':
|
||||
echo '<!--PLUGIN API-->';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if ($serendipity['GET']['adminModule'] == 'templates') {
|
||||
$css_files = glob(dirname(__FILE__) . '/*_style.css');
|
||||
foreach($css_files AS $css_file) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user