aboutsummaryrefslogtreecommitdiffstats
path: root/core/include
AgeCommit message (Collapse)AuthorFilesLines
2021-07-01Bugfix: Use empty check instead of issetThomas Lange1-1/+1
If no category tree was found, the array is empty but isset evaluates to true. This fixes the mistake and uses an empty check instead.
2021-07-01Add function generateCategoryPostNaviTemplateThomas Lange1-1/+1
Add and use the function generateCategoryPostNaviTemplate to build the pagination template for posts in a category. This fixes a mistake. TODO: Get rid of that confusing function mess!
2021-07-01Add category system to categorize posts (readme)Thomas Lange3-0/+220
This commit implements a new category system to categorize posts. Each category can have an unlimited number of nested children categories. A single post don't necessarily need to be in a category, but it can. Each category can have a full content body like posts or pages, so you have enough space to describe the content of your categories. Please note that you need to have at least the following MySQL/MariaDB versions to use the category system, because it uses "WITH RECURSIVE" database queries, the so-called "Common-Table-Expressions (CTE)". MariaDB: 10.2.2 MySQL: 8.0 See: https://mariadb.com/kb/en/with/ See: https://dev.mysql.com/doc/refman/8.0/en/with.html
2021-06-22Implement new Repository and Entity classesThomas Lange9-292/+276
This commit adds new Repository and Entity classes which are better abstracted from the rest of the application. They dont know anymore about configuration options or how to parse to HTML because this is not the job for the ORM but for other parts of the application. The previous commits were a preparation for this big change. An entity now represents just a single record from a specific table of the database – nothing more. The repositories job is it to fetch or update records of the database and instantiate the entities. Another problem that was solved is the high amount of database queries that was needed before. For example, on the blogs home page first were all 10 latest post IDs fetched from the database and then another query was executed with "WHERE id = :id" for *each* single post?! ... This problem is solved with the new repository classes; they now use a single query to fetch and build the entities of the 10 latest posts. This change also solves the problem with database queries spread across the application and limits the exzessive use of try/catch blocks which were used before. The new classes make the whole code much cleaner. :)
2021-06-21Remove unnecessary $ItemTemplate variablesThomas Lange5-16/+4
2021-06-21Rename some template variablesThomas Lange6-14/+14
2021-06-21Rename "attr" method of Item class to "get"Thomas Lange7-8/+8
2021-06-21Use function getMarkdownImageURLsThomas Lange1-1/+1
2021-06-21Use getEntityURL method of Application classThomas Lange6-7/+7
This commit replaces all calls to "$Item->getURL()" with calls to the previously added "getEntityURL" method of the "Application" class.
2021-06-19Remove unused variableThomas Lange1-1/+0
2021-06-14Remove more redundant try/catch blocksThomas Lange9-352/+251
Remove all try/catch blocks where the exception handling did not differ from the exception handler already defined by "set_exception_handler".
2019-10-29Remove PHP closing tags and add LF to text filesThomas Lange9-9/+0
Remove the unnecessary PHP closing tags and ensure that *all* text files ending with a LF character.
2018-02-14Add configuration option "$ITEM.SINGLE_REDIRECT"Thomas Lange3-3/+33
Each option can be set to "TRUE" or "FALSE" (the default value is "FALSE"). For example, if you only have one user and "USER.SINGLE_REDIRECT" is set to "TRUE", then requests to "/user/" will be automatically redirected to "/user/username/".
2017-10-24You can now access item data in the main.php template (the file which ↵Thomas Lange3-0/+14
contains the basic HTML framework) for pages, posts and users. This makes it possible to use the optional argument field in the content editor to add additional HTML <meta> tags (or something else) for a specific page, post or user if you implement this functionality into your template. The following snippet shows how you can access the item data in the main.php template and which parameters are defined for each type of item (currently, there are three types: PAGE, POST and USER): if(isset($TYPE)) { switch($TYPE) { case 'PAGE': # $PAGE and associated $USER is accessible var_dump($PAGE['ARGV']); break; case 'POST': # $POST and associated $USER is accessible var_dump($POST['ARGV']); break; case 'USER': # $USER is accessible var_dump($USER['ARGV']); break; default: # Nothing } }
2017-10-24Some comments have been updated, unnecessary whitespace at the end of some ↵Thomas Lange3-3/+6
files was removed and some missing PHP closing tags were added.
2017-07-07The function "makeSlugURL" has been renamed to "generateSlug" because the ↵Thomas Lange1-2/+8
name was misleading because the function did not generate a complete URL, but only a partial string (the slug) for the final URL. By the way, some improvements were made to the code.
2017-05-30 Several changes have been made in this commit, which together with the ↵v2.2Thomas Lange4-15/+15
previous commits result in version 2.2 [changed template parameters]: + Implemented [core]: A new method called "getAll" has been added to the "Attribute" class which now returns all attributes as key->value array. The first parameter can be an array with attribute names which shall be excluded from returning. + Optimization [core]: The function "generateItemData" has been renamed to "generateItemTemplateData" and has been restructured to use the new implemented method "getAll" from the "Attribute" class. + Optimization [core]: The function "generateNaviTemplate" has been added and the functions "generatePageNaviTemplate", "generatePostNaviTemplate" and "generateUserNaviTemplate" have been restructured to make use of the new "generateNaviTemplate" function to reduce duplicate code. + Optimization [core]: Several files within the admin directory has been optimized to use the new "getAll" method of the "Attribute" class. + Optimization [core]: Several code optimizations have been made to the "HTTP" class. + Optimization [admin template]: All occurences of $PAGE['ID'], $POST['ID'] and $USER['ID'] have been replaced with $PAGE['ATTR']['ID'], $POST['ATTR']['ID'] and $USER['ATTR']['ID'] to make it more consistent. You now have to use ['ATTR']['ID'] instead of ['ID'] in your templates to get the ID of an item! Template upgrade to version 2.2 (only for customized templates): SEARCH: ['ID'] REPLACE: ['ATTR']['ID']
2017-05-05A significant increase in the response time has been achieved, since the ↵v2.1Thomas Lange3-3/+3
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). 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!
2017-04-24Nested function calls for generating the meta description are removed and a ↵Thomas Lange3-3/+3
function was added to perform this task.
2017-04-19Comments added and unnecessary "abs" function calls removed.Thomas Lange3-3/+12
2017-04-11The system directory has been moved to a non-public directory. After the ↵v1.2Thomas Lange9-0/+691
commit e33c245d910e55b8cab407a03e669470509a705d, it is no longer necessary that the directory is publicly accessible via HTTP because all requests are running through the router.