Added new event hooks for plugin and template installation/update

This commit is contained in:
Garvin Hicking 2013-07-23 09:46:44 +02:00
parent e72aa19280
commit c5708f746c
3 changed files with 10 additions and 0 deletions

View File

@ -3,6 +3,9 @@
Version 2.0 ()
------------------------------------------------------------------------
* Added new event hooks "backend_plugins_install", "backend_plugins_update"
and "backend_templates_install".
* Implemented patch https://github.com/s9y/Serendipity/pull/15
* When switching templates, both the backend and the frontend

View File

@ -354,6 +354,8 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
$bag = new serendipity_property_bag;
$plugin->introspect($bag);
serendipity_plugin_api::hook_event('backend_plugins_install', $serendipity['GET']['install_plugin'], $fetchplugin_data);
if ($bag->is_set('configuration')) {
/* Only play with the plugin if there is something to play with */
echo '<script type="text/javascript">location.href = \'' . $serendipity['baseurl'] . '?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]=' . $inst . '\';</script>';
@ -363,6 +365,8 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
echo '<script type="text/javascript">location.href = \'' . $serendipity['baseurl'] . '?serendipity[adminModule]=plugins\';</script>';
die();
}
} else {
serendipity_plugin_api::hook_event('backend_plugins_update', $serendipity['GET']['install_plugin'], $fetchplugin_data);
}
}

View File

@ -67,6 +67,9 @@ if ($serendipity['GET']['adminAction'] == 'install' ) {
$themeInfo = serendipity_fetchTemplateInfo(htmlspecialchars($serendipity['GET']['theme']));
// A separate hook is used post installation, for plugins to possibly perform some actions
serendipity_plugin_api::hook_event('backend_templates_install', $serendipity['GET']['theme'], $themeInfo);
serendipity_set_config_var('template', htmlspecialchars($serendipity['GET']['theme']));
serendipity_set_config_var('template_engine', isset($themeInfo['engine']) ? $themeInfo['engine'] : 'default');
serendipity_set_config_var('last_template_change', time());