Extends Module

This commit is contained in:
Tobias Reich 2014-04-04 21:27:10 +02:00
parent 2400564a79
commit 68068969cb
3 changed files with 32 additions and 33 deletions

View File

@ -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;

29
php/modules/Module.php Normal file
View File

@ -0,0 +1,29 @@
<?php
###
# @name Module
# @author Tobias Reich
# @copyright 2014 by Tobias Reich
###
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
class Module {
protected $plugins = null;
protected 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;
}
}

View File

@ -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;