aboutsummaryrefslogtreecommitdiffstats
path: root/core/namespace
AgeCommit message (Collapse)AuthorFilesLines
8 daysFunctionParser: No static property/methods anymoreThomas Lange2-6/+14
Problem: When creating a new "FunctionParser" object, it should not know the previously registered content functions which were saved in a static class property and registered via static class method. If one creates a new "FunctionParser" object, one would expect that the array of registered content functions in that object is empty. Changes: - Make static property "functions" non-static - Make static method "register" non-static - Add new method "registerFromArray"
8 daysSave registered content functions in class arrayThomas Lange1-0/+9
Modify the Application class so that it keeps an array of all registered content functions and add the method "getContentFunctions" to return it.
2024-02-02Fix incorrect backslash escaping of `\\`Thomas Lange1-2/+2
The regular expression part `\\` must be written as `\\\\`, not `\\\` in a PHP string variable. Although both variants (`\\\\` and `\\\`) will be passed as `\` to the regex engine in this specific case, it's correct to use 4 backslashes, as the PHP manual tells you: https://www.php.net/manual/en/regexp.reference.escape.php
2024-02-02Rewrite and optimize FunctionParser classThomas Lange1-15/+54
* Rewrite regular expressions and make them easier to read. * Use named capture groups for backreferences and array keys. * Allow backslash-escaping of quotes inside string arguments. * Allow string arguments to be enclosed between single quotes.
2023-09-23Pass NULL instead of array containing NULL elementThomas Lange1-1/+7
2023-09-23Language: Cast parameter for "vsprintf" to arrayThomas Lange1-1/+1
Since PHP8, the second parameter for the "vsprintf" function MUST BE of type "array", so cast the $arguments variable to "array".
2023-09-23Language: Remove deprecated method "template"Thomas Lange1-7/+0
If your custom theme is still using that method, you can simply upgrade your theme by replacing all occurrences of "template" with "text": OLD: $Language->template NEW: $Language->text
2021-09-19Rename some session array keysThomas Lange1-4/+4
* Rename "auth" to "USER_ID" * Rename "token" to "CSRF_TOKEN"
2021-08-10Exclude "_modified" property from "getAll" methodThomas Lange1-0/+1
The "getAll" method of the Entity class should return an array with real attributes of the Entity object but not internally used properties.
2021-08-10Add "getModifiedKeys" method to EntityInterfaceThomas Lange1-0/+1
2021-08-10Declare "set" method of Entity class as voidThomas Lange2-4/+3
2021-08-10Add a better mechanism to detect Entity changesThomas Lange7-61/+68
Implement and use a better mechanism to detect changes of attributes of the Entity objects by using a private variable which keeps track of the changed Entity attributes ("properties") via the "set" method. The "insert" and "update" method of the Repository now calls the method "getModifiedKeys" of the Entity class to get a list of properties which have been changed and builds the database query accordingly. This makes the use of "FALSE" as default value for the Entity attributes obsolete, so they have been set to the initial PHP default ("NULL").
2021-08-04Add explicit parameter types for the "exit" methodThomas Lange1-1/+1
2021-08-04Move error page logic into the Application classThomas Lange1-4/+10
Move the logic for generating the error pages into the Application class to remove this ugly "require" call in the error403 and error404 methods.
2021-07-22Add user and category filter on post searchThomas Lange1-0/+10
Add a user and category filter option for the post search in the administration area. Filter on default theme is followed later.
2021-07-22Move repository search functionality into a traitThomas Lange4-99/+109
Move the methods for the search functionality of the abstract Repository class into a separate trait and use it in the Page and Post repository. The reason because of this is that only the Page and Post repositories having a search functionality, while the other repositories have not.
2021-07-22Add pagination for search resultsThomas Lange1-6/+18
Add pagination for search results in the admin and default theme.
2021-07-22Add LIMIT and OFFSET parameters for search methodThomas Lange1-3/+7
2021-07-22Do not redefine properties of Entity classThomas Lange4-12/+0
Do not redefine properties that are already defined in the Entity class.
2021-07-22Rename: Append "Repository" to repository classesThomas Lange5-18/+15
Rename the repository classes and append the name with "Repository" to prevent naming confusions with the entity classes.
2021-07-20Implement new *content functions* feature (readme)Thomas Lange2-0/+97
This commit implements a new feature called *content functions* that is similar but much more powerful than the already existing *content tags* which you may have already used (`{POST[1]}`, for example). You now can also add your own *content functions* to do some interesting things like embedding a YouTube video or other things to prevent typing repetitive lines of text or code in your entities content. Read the corresponding wiki page to learn more about this: https://github.com/Nerdmind/Blog/wiki/Content-functions
2021-07-20Rename and reorganize several "get count" methodsThomas Lange4-33/+42
2021-07-19Add and use new parser/transformer classesThomas Lange4-0/+146
Classes: * Parsers\ArgumentParser * Parsers\EmoticonParser * Parsers\MarkdownParser Interfaces: * Parsers\ParserInterface
2021-07-17Reduce the redundant mapping logic in repositoriesThomas Lange2-49/+33
Reduce the redundant mapping logic in the repository classes by using the new methods "fetchEntity" and "fetchEntities".
2021-07-11Modify parameter list for getAll methodThomas Lange1-3/+3
2021-07-11Reuse prepared statement in update methodThomas Lange1-4/+0
Reuse the already defined prepared statement in the update method of the Category repository instead of creating a new one.
2021-07-02Clarify comment in determineFallbackSchemaVersionThomas Lange1-1/+1
If the migration table does not yet exist, the user sits *either* at 0, 1, 2, 3 or 4; not *between* 0 and 4 (which would be 1, 2 or 3).
2021-07-01Add category system to categorize posts (readme)Thomas Lange5-6/+181
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-07-01Update database schema for coming category systemThomas Lange1-1/+1
This commit updates the database schema and adds a new migration for the upcoming category system. Please note that you need to have at least the following MySQL/MariaDB versions to use the category system later: MariaDB: 10.2.2 MySQL: 8.0
2021-07-01Bugfix: Explicitly check for FALSE in MigratorThomas Lange1-1/+2
Explicitly check for boolean FALSE because the result can be string "0" when directly upgrading from release v1.0 which has schema version "0".
2021-07-01Update database schema: Make id columns unsignedThomas Lange1-1/+1
This commit updates the database schema and adds a new migration to modify the signed integer columns to make them unsigned.
2021-06-29Add WHERE filter option to getCount methodThomas Lange1-4/+23
2021-06-28Bugfix: Remove explicit parameter type intThomas Lange1-3/+3
2021-06-27Allow NULL value comparison in WHERE clauseThomas Lange1-2/+6
2021-06-25Fix wrong property name in Repository classThomas Lange1-2/+2
2021-06-25Reorganize namespacesThomas Lange11-27/+44
2021-06-24Return NULL instead of config string if unsetThomas Lange1-1/+1
2021-06-24Implement database schema MigratorThomas Lange2-0/+196
This commit implements the new database schema Migrator which keeps track of the on-disk schema and the schema used by the codebase. It tries to makes future database schema upgrades user-friendlier.
2021-06-24Set Database attribute in Application classThomas Lange1-1/+13
2021-06-22Add missing static keywords and fix typosThomas Lange2-4/+4
2021-06-22Implement new Repository and Entity classesThomas Lange26-362/+480
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-21Rename "attr" method of Item class to "get"Thomas Lange2-4/+4
2021-06-21Remove getArguments method from Item classThomas Lange1-20/+0
2021-06-21Remove unused methods from Item classThomas Lange1-50/+0
2021-06-21Remove getGUID methods from Item classesThomas Lange4-35/+0
2021-06-21Remove getURL methods from Item classesThomas Lange4-34/+0
2021-06-21Use getEntityURL method of Application classThomas Lange1-1/+1
This commit replaces all calls to "$Item->getURL()" with calls to the previously added "getEntityURL" method of the "Application" class.
2021-06-21Add method getEntityURL to Application classThomas Lange1-0/+20
This commit adds the method "getEntityURL" to the "Application" class. This method takes an instance of "Item" as parameter and then builds the absolute URL of the item from its attribute data.
2021-06-20Call password_verify directly in login scriptThomas Lange1-7/+0
2021-06-19Rename CRUD methods of Attribute classThomas Lange1-3/+3