From 68068969cb8627b4c9d681da4326b3e17c393890 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 4 Apr 2014 21:27:10 +0200 Subject: [PATCH] Extends Module --- php/modules/Album.php | 17 +---------------- php/modules/Module.php | 29 +++++++++++++++++++++++++++++ php/modules/Session.php | 19 ++----------------- 3 files changed, 32 insertions(+), 33 deletions(-) create mode 100644 php/modules/Module.php diff --git a/php/modules/Album.php b/php/modules/Album.php index 26a4316..37fac4b 100644 --- a/php/modules/Album.php +++ b/php/modules/Album.php @@ -8,10 +8,9 @@ if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); -class Album { +class Album extends Module { private $database = null; - private $plugins = null; private $settings = null; private $albumIDs = null; @@ -27,20 +26,6 @@ class Album { } - private function plugins($name, $location, $args) { - - if (!isset($this->plugins, $name, $location, $args)) return false; - - # Parse - $location = ($location===0 ? 'before' : 'after'); - - # Call plugins - $this->plugins->activate($name . ":" . $location, $args); - - return true; - - } - public function add($title = 'Untitled', $public = 0, $visible = 1) { if (!isset($this->database)) return false; diff --git a/php/modules/Module.php b/php/modules/Module.php new file mode 100644 index 0000000..dd08751 --- /dev/null +++ b/php/modules/Module.php @@ -0,0 +1,29 @@ +plugins, $name, $location, $args)) return false; + + # Parse + $location = ($location===0 ? 'before' : 'after'); + + # Call plugins + $this->plugins->activate($name . ":" . $location, $args); + + return true; + + } + +} \ No newline at end of file diff --git a/php/modules/Session.php b/php/modules/Session.php index 52d4c1a..9dd1be7 100755 --- a/php/modules/Session.php +++ b/php/modules/Session.php @@ -8,10 +8,9 @@ if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); -class Session { +class Session extends Module { - private $plugins = null; - private $settings = null; + private $settings = null; public function __construct($plugins, $settings) { @@ -23,20 +22,6 @@ class Session { } - private function plugins($name, $location, $args) { - - if (!isset($this->plugins, $name, $location, $args)) return false; - - # Parse - $location = ($location===0 ? 'before' : 'after'); - - # Call plugins - $this->plugins->activate($name . ":" . $location, $args); - - return true; - - } - public function init($public, $version) { if (!isset($this->settings, $public, $version)) return false;