aboutsummaryrefslogtreecommitdiffstats
path: root/core/namespace/Application.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/namespace/Application.php')
-rw-r--r--core/namespace/Application.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/namespace/Application.php b/core/namespace/Application.php
index 5690841..140baac 100644
--- a/core/namespace/Application.php
+++ b/core/namespace/Application.php
@@ -1,5 +1,6 @@
<?php
use ORM\EntityInterface;
+use Parsers\FunctionParser;
class Application {
@@ -214,6 +215,18 @@ class Application {
}
#===============================================================================
+ # Add a custom content function
+ #===============================================================================
+ public static function addContentFunction(string $name, callable $callback): void {
+ if(!preg_match('#^([0-9A-Z_]+)$#', $name)) {
+ throw new Exception('The name for adding a content function must
+ contain only numbers, uppercase letters and underscores!');
+ }
+
+ FunctionParser::register($name, $callback);
+ }
+
+ #===============================================================================
# Exit application with a custom message and status code
#===============================================================================
public static function exit($message = '', $code = 503): void {