diff options
Diffstat (limited to 'core/helpers')
-rw-r--r-- | core/helpers/album.php | 2 | ||||
-rw-r--r-- | core/helpers/module.php | 10 | ||||
-rw-r--r-- | core/helpers/photo.php | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/core/helpers/album.php b/core/helpers/album.php index e3972975..dd62d693 100644 --- a/core/helpers/album.php +++ b/core/helpers/album.php @@ -54,7 +54,7 @@ class album_Core { mkdir($thumbnail_dir); } - Event::run("gallery.album.created", $album); + module::event("album_created", $album); return $album; } diff --git a/core/helpers/module.php b/core/helpers/module.php index fc76c033..afba658a 100644 --- a/core/helpers/module.php +++ b/core/helpers/module.php @@ -54,4 +54,14 @@ class module_Core { public static function installed() { return ORM::factory("module")->find_all(); } + + public static function event($name, &$data=null) { + foreach (self::installed() as $module) { + $class = "{$module->name}_event"; + $function = str_replace(".", "_", $name); + if (method_exists($class, $function)) { + call_user_func_array(array($class, $function), array($data)); + } + } + } } diff --git a/core/helpers/photo.php b/core/helpers/photo.php index 05fb2fb1..fc23c375 100644 --- a/core/helpers/photo.php +++ b/core/helpers/photo.php @@ -78,7 +78,7 @@ class photo_Core { ->set_resize($filename, 640, 480) ->save(); - Event::run("gallery.photo.created", $photo); + module::event("photo_created", $photo); return $result; } |