summaryrefslogtreecommitdiffstats
path: root/core/functions.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-03-10 21:46:12 +0100
committerThomas Lange <code@nerdmind.de>2017-03-10 21:46:12 +0100
commite33c245d910e55b8cab407a03e669470509a705d (patch)
treee958504564ab47e72e0d3dcfe0b967440007b1d9 /core/functions.php
parentaae885b9784466ab412e4010893808867e93c213 (diff)
downloadblog-1.1.tar.gz
blog-1.1.tar.xz
blog-1.1.zip
Several changes have been made in this commit, which together with the previous commits result in version 1.1:v1.1
+ The rules for the Apache and nginx configuration have been changed and redirects now all requests to the index.php. + A router class has been added which now handles all requests that arrives at the application on the index.php. + Short-hand functions "PAGE", "POST" and "USER" for use in templates added to get specific item data by ID. + More language variables have been added to the core language.
Diffstat (limited to 'core/functions.php')
-rw-r--r--core/functions.php42
1 files changed, 39 insertions, 3 deletions
diff --git a/core/functions.php b/core/functions.php
index 726e96f..471c14f 100644
--- a/core/functions.php
+++ b/core/functions.php
@@ -308,9 +308,9 @@ function excerpt($string, $length = 500, $replace = ' […]') {
return $string;
}
-#====================================================================================================
+#===============================================================================
# Generate a valid slug URL part from a string
-#====================================================================================================
+#===============================================================================
function makeSlugURL($string) {
$string = strtolower($string);
$string = str_replace(['ä', 'ö', 'ü', 'ß'], ['ae', 'oe', 'ue', 'ss'], $string);
@@ -319,4 +319,40 @@ function makeSlugURL($string) {
return trim($string, '-');
}
-?>
+
+#===============================================================================
+# Function to get data from specific page in templates
+#===============================================================================
+function PAGE($id) {
+ try {
+ $Page = Page\Factory::build($id);
+ return generatePageItemData($Page);
+ } catch(Page\Exception $Exception) {
+ return NULL;
+ }
+}
+
+#===============================================================================
+# Function to get data from specific post in templates
+#===============================================================================
+function POST($id) {
+ try {
+ $Post = Post\Factory::build($id);
+ return generatePostItemData($Post);
+ } catch(Post\Exception $Exception) {
+ return NULL;
+ }
+}
+
+#===============================================================================
+# Function to get data from specific user in templates
+#===============================================================================
+function USER($id) {
+ try {
+ $User = User\Factory::build($id);
+ return generateUserItemData($User);
+ } catch(User\Exception $Exception) {
+ return NULL;
+ }
+}
+?> \ No newline at end of file