summaryrefslogtreecommitdiffstats
path: root/core/include
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-05-05 02:38:39 +0200
committerThomas Lange <code@nerdmind.de>2017-05-05 02:38:39 +0200
commit796ea918866c15f0d59ce178d095022edfaf096d (patch)
treeae2891847e9371921b9834f727c0bd9cd2be42f6 /core/include
parent5b3e9c5b10d08d94b05b2afc38196eded71c7781 (diff)
downloadblog-796ea918866c15f0d59ce178d095022edfaf096d.tar.gz
blog-796ea918866c15f0d59ce178d095022edfaf096d.tar.xz
blog-796ea918866c15f0d59ce178d095022edfaf096d.zip
A significant increase in the response time has been achieved, since the template parameters "$ITEM['BODY']['TEXT']" and "$ITEM['BODY']['HTML']" are now no longer strings but closures (anonymous functions). This means that the underlying logic, which parses the content or converts it into Markdown, is not executed until one of these parameters is really needed and called in the template (which maybe significantly increases the response time on a long list of items which not use one of those two parameters).v2.1
This means that within templates you now have to call these parameters in the following way (note the brackets at the end, which represent a function call): <?=$ITEM['BODY']['TEXT']()?> <?=$ITEM['BODY']['HTML']()?> In the background, the anonymous functions are called and executes $Item->getBody() and $Item->getHTML() only when needed. Previously, $Item->getBody() and $Item->getHTML() were basically executed and the parsed content was passed to the template, regardless of whether these parameters are required in the template or not!
Diffstat (limited to 'core/include')
-rw-r--r--core/include/page/main.php2
-rw-r--r--core/include/post/main.php2
-rw-r--r--core/include/user/main.php2
3 files changed, 3 insertions, 3 deletions
diff --git a/core/include/page/main.php b/core/include/page/main.php
index bf3e03e..01579fc 100644
--- a/core/include/page/main.php
+++ b/core/include/page/main.php
@@ -47,7 +47,7 @@ try {
$MainTemplate->set('HTML', $PageTemplate);
$MainTemplate->set('HEAD', [
'NAME' => $page_data['ATTR']['NAME'],
- 'DESC' => description($page_data['BODY']['HTML'], Application::get('PAGE.DESCRIPTION_SIZE')),
+ 'DESC' => description($page_data['BODY']['HTML'](), Application::get('PAGE.DESCRIPTION_SIZE')),
'PERM' => $page_data['URL'],
'OG_IMAGES' => $page_data['FILE']['LIST']
]);
diff --git a/core/include/post/main.php b/core/include/post/main.php
index dc3cbdc..8cd0a49 100644
--- a/core/include/post/main.php
+++ b/core/include/post/main.php
@@ -47,7 +47,7 @@ try {
$MainTemplate->set('HTML', $PostTemplate);
$MainTemplate->set('HEAD', [
'NAME' => $post_data['ATTR']['NAME'],
- 'DESC' => description($post_data['BODY']['HTML'], Application::get('POST.DESCRIPTION_SIZE')),
+ 'DESC' => description($post_data['BODY']['HTML'](), Application::get('POST.DESCRIPTION_SIZE')),
'PERM' => $post_data['URL'],
'OG_IMAGES' => $post_data['FILE']['LIST']
]);
diff --git a/core/include/user/main.php b/core/include/user/main.php
index 79e0ea9..ba0d07b 100644
--- a/core/include/user/main.php
+++ b/core/include/user/main.php
@@ -62,7 +62,7 @@ try {
$MainTemplate->set('HTML', $UserTemplate);
$MainTemplate->set('HEAD', [
'NAME' => $user_data['ATTR']['FULLNAME'],
- 'DESC' => description($user_data['BODY']['HTML'], Application::get('USER.DESCRIPTION_SIZE')),
+ 'DESC' => description($user_data['BODY']['HTML'](), Application::get('USER.DESCRIPTION_SIZE')),
'PERM' => $User->getURL(),
'OG_IMAGES' => $User->getFiles()
]);