Merge pull request #1226 from SamBrishes/patch-001

Extend plugins hook
This commit is contained in:
Diego Najar 2020-07-07 10:02:15 +02:00 committed by GitHub
commit 4627a3544b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);
}
}