Extend plugins hook

This commit is contained in:
SamBrishes 2020-07-07 08:46:26 +02:00
parent c2274ca92c
commit 9f7759d912
2 changed files with 6 additions and 6 deletions

View file

@ -321,7 +321,7 @@ function createPage($args) {
$key = $pages->add($args);
if ($key) {
// Call the plugins after page created
Theme::plugins('afterPageCreate');
Theme::plugins('afterPageCreate', array($key));
reindexCategories();
reindexTags();
@ -371,7 +371,7 @@ function editPage($args) {
$key = $pages->edit($args);
if ($key) {
// Call the plugins after page modified
Theme::plugins('afterPageModify');
Theme::plugins('afterPageModify', array($key));
reindexCategories();
reindexTags();
@ -392,10 +392,10 @@ function editPage($args) {
function deletePage($key) {
global $pages;
global $syslog;
if ($pages->delete($key)) {
// Call the plugins after page deleted
Theme::plugins('afterPageDelete');
Theme::plugins('afterPageDelete', array($key));
reindexCategories();
reindexTags();

View file

@ -225,11 +225,11 @@ class Theme {
return self::javascript($files, $base, $attributes);
}
public static function plugins($type)
public static function plugins($type, $args = array())
{
global $plugins;
foreach ($plugins[$type] as $plugin) {
echo call_user_func(array($plugin, $type));
echo call_user_func_array(array($plugin, $type), $args);
}
}