summaryrefslogtreecommitdiff
path: root/app/Core
diff options
context:
space:
mode:
Diffstat (limited to 'app/Core')
-rw-r--r--app/Core/Base.php5
-rw-r--r--app/Core/Plugin/Hook.php29
-rw-r--r--app/Core/Plugin/Loader.php2
3 files changed, 30 insertions, 6 deletions
diff --git a/app/Core/Base.php b/app/Core/Base.php
index 2dec4b29..ba925ebe 100644
--- a/app/Core/Base.php
+++ b/app/Core/Base.php
@@ -70,11 +70,6 @@ use Pimple\Container;
* @property \Model\TaskPosition $taskPosition
* @property \Model\TaskStatus $taskStatus
* @property \Model\TaskValidator $taskValidator
- * @property \Model\Timetable $timetable
- * @property \Model\TimetableDay $timetableDay
- * @property \Model\TimetableExtra $timetableExtra
- * @property \Model\TimetableOff $timetableOff
- * @property \Model\TimetableWeek $timetableWeek
* @property \Model\Transition $transition
* @property \Model\User $user
* @property \Model\UserSession $userSession
diff --git a/app/Core/Plugin/Hook.php b/app/Core/Plugin/Hook.php
index 4fb55569..fa14af13 100644
--- a/app/Core/Plugin/Hook.php
+++ b/app/Core/Plugin/Hook.php
@@ -47,6 +47,18 @@ class Hook
}
/**
+ * Return true if the hook is used
+ *
+ * @access public
+ * @param string $hook
+ * @return boolean
+ */
+ public function exists($hook)
+ {
+ return isset($this->hooks[$hook]);
+ }
+
+ /**
* Merge listener results with input array
*
* @access public
@@ -67,4 +79,21 @@ class Hook
return $values;
}
+
+ /**
+ * Execute only first listener
+ *
+ * @access public
+ * @param string $hook
+ * @param array $params
+ * @return mixed
+ */
+ public function first($hook, array $params = array())
+ {
+ foreach ($this->getListeners($hook) as $listener) {
+ return call_user_func_array($listener, $params);
+ }
+
+ return null;
+ }
}
diff --git a/app/Core/Plugin/Loader.php b/app/Core/Plugin/Loader.php
index ffead9f6..45da135b 100644
--- a/app/Core/Plugin/Loader.php
+++ b/app/Core/Plugin/Loader.php
@@ -67,7 +67,7 @@ class Loader extends \Core\Base
$filename = __DIR__.'/../../../plugins/'.$plugin.'/Schema/'.ucfirst(DB_DRIVER).'.php';
if (file_exists($filename)) {
- require($filename);
+ require_once($filename);
$this->migrateSchema($plugin);
}
}