aboutsummaryrefslogtreecommitdiffstats
path: root/core/functions.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2024-11-15 15:34:19 +0100
committerThomas Lange <code@nerdmind.de>2024-11-15 15:56:58 +0100
commit7a6c176759a7b5bf6924447afb9f10f615c52563 (patch)
tree54853c44ca50589c0d36a3d62e68d8a7b3071e5a /core/functions.php
parentbd5fc17c9ba9fa69aadce903e054ec7e7f09749d (diff)
downloadblog-7a6c176759a7b5bf6924447afb9f10f615c52563.tar.gz
blog-7a6c176759a7b5bf6924447afb9f10f615c52563.tar.xz
blog-7a6c176759a7b5bf6924447afb9f10f615c52563.zip
Define default functions with "addContentFunction"
Instead of calling the static method FunctionParser::register directly, use the wrapper method addContentFunction of the Application class.
Diffstat (limited to 'core/functions.php')
-rw-r--r--core/functions.php30
1 files changed, 20 insertions, 10 deletions
diff --git a/core/functions.php b/core/functions.php
index 2155d96..d4337a4 100644
--- a/core/functions.php
+++ b/core/functions.php
@@ -373,69 +373,79 @@ function USER(int $id): array {
#===========================================================================
# Get base URL (optionally extended by $extend)
#===========================================================================
-FunctionParser::register('BASE_URL', function($extend = '') {
+Application::addContentFunction('BASE_URL',
+function($extend = '') {
return Application::getURL($extend);
});
#===========================================================================
# Get file URL (optionally extended by $extend)
#===========================================================================
-FunctionParser::register('FILE_URL', function($extend = '') {
+Application::addContentFunction('FILE_URL',
+function($extend = '') {
return Application::getFileURL($extend);
});
#===========================================================================
# Get Markdown formatted *category* link
#===========================================================================
-FunctionParser::register('CATEGORY', function($id, $text = NULL, $title = NULL) {
+Application::addContentFunction('CATEGORY',
+function($id, $text = NULL, $title = NULL) {
return getEntityMarkdownLink('Category', $id, $text, $title);
});
#===========================================================================
# Get Markdown formatted *page* link
#===========================================================================
-FunctionParser::register('PAGE', function($id, $text = NULL, $title = NULL) {
+Application::addContentFunction('PAGE',
+function($id, $text = NULL, $title = NULL) {
return getEntityMarkdownLink('Page', $id, $text, $title);
});
#===========================================================================
# Get Markdown formatted *post* link
#===========================================================================
-FunctionParser::register('POST', function($id, $text = NULL, $title = NULL) {
+Application::addContentFunction('POST',
+function($id, $text = NULL, $title = NULL) {
return getEntityMarkdownLink('Post', $id, $text, $title);
});
#===========================================================================
# Get Markdown formatted *user* link
#===========================================================================
-FunctionParser::register('USER', function($id, $text = NULL, $title = NULL) {
+Application::addContentFunction('USER',
+function($id, $text = NULL, $title = NULL) {
return getEntityMarkdownLink('User', $id, $text, $title);
});
#===========================================================================
# Get URL to a category entity
#===========================================================================
-FunctionParser::register('CATEGORY_URL', function($id) {
+Application::addContentFunction('CATEGORY_URL',
+function($id) {
return getEntityURL('Category', $id);
});
#===========================================================================
# Get URL to a page entity
#===========================================================================
-FunctionParser::register('PAGE_URL', function($id) {
+Application::addContentFunction('PAGE_URL',
+function($id) {
return getEntityURL('Page', $id);
});
#===========================================================================
# Get URL to a post entity
#===========================================================================
-FunctionParser::register('POST_URL', function($id) {
+Application::addContentFunction('POST_URL',
+function($id) {
return getEntityURL('Post', $id);
});
#===========================================================================
# Get URL to a user entity
#===========================================================================
-FunctionParser::register('USER_URL', function($id) {
+Application::addContentFunction('USER_URL',
+function($id) {
return getEntityURL('User', $id);
});