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); $key = $pages->add($args);
if ($key) { if ($key) {
// Call the plugins after page created // Call the plugins after page created
Theme::plugins('afterPageCreate'); Theme::plugins('afterPageCreate', array($key));
reindexCategories(); reindexCategories();
reindexTags(); reindexTags();
@ -371,7 +371,7 @@ function editPage($args) {
$key = $pages->edit($args); $key = $pages->edit($args);
if ($key) { if ($key) {
// Call the plugins after page modified // Call the plugins after page modified
Theme::plugins('afterPageModify'); Theme::plugins('afterPageModify', array($key));
reindexCategories(); reindexCategories();
reindexTags(); reindexTags();
@ -395,7 +395,7 @@ function deletePage($key) {
if ($pages->delete($key)) { if ($pages->delete($key)) {
// Call the plugins after page deleted // Call the plugins after page deleted
Theme::plugins('afterPageDelete'); Theme::plugins('afterPageDelete', array($key));
reindexCategories(); reindexCategories();
reindexTags(); reindexTags();

View file

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