aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)AuthorFilesLines
6 daysUse foreach to register entity content functionsThomas Lange1-65/+17
7 daysFunctionParser: No static property/methods anymoreThomas Lange3-7/+23
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"
7 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.
7 daysDefine default functions with "addContentFunction"Thomas Lange1-10/+20
Instead of calling the static method FunctionParser::register directly, use the wrapper method addContentFunction of the Application class.
2024-02-05Drop support for parsing/transforming content tagsHEADmasterThomas Lange1-31/+8
The *content tags* are deprecated since July 2021 and have been replaced by the more powerful *content functions*, but parsing/transforming the old syntax was still supported until today. This commit removes the logic to parse/transform the old *content tags* from the codebase completely. If you are still using the old syntax in your entities' content, you need to run a converter script. Please look at the wiki for more information about *content functions* and how to replace the old *content tags* with the converter script.
2024-02-05Add content tag converter scriptThomas Lange1-0/+142
This script is used to convert the old *content tag* syntax to the newer *content functions* syntax which has been introduced in July 2021. See the wiki page for *content tags* for more details.
2024-02-05Add (CATEGORY|PAGE|POST|USER)_URL content functionThomas Lange1-0/+39
These content functions will return the pure URL to the corresponding entity instead of a Markdown formatted link like the other functions.
2024-02-03Fix broken link to wiki page in first postThomas Lange1-1/+1
OLD: https://github.com/Nerdmind/Blog/wiki/Content-functions NEW: https://github.com/Nerdmind/Blog/wiki/Content_functions
2024-02-03Hotfix: Replace `"` with `'` in link title stringThomas Lange1-3/+12
Because there currently is no sane way to escape double quotes within a string intended to be used as title for a Markdown formatted link, just replace the double with single quotes until a better solution is found. Note: Just replacing with `"` will not work here because Parsedown escapes this further to `"`.
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
2022-08-03SET NAMES 'utf8mb4'Markus Hackspacher1-0/+1
with SET NAMES can you imort the file with the commandline: mysql -u root blog < core/db/database.sql
2022-03-14Include category data in feed item templateThomas Lange1-0/+17
Include the category data and the category tree data in the feed item template in the same way as on the post's "main" or "item" template. So in the feed item template, the available parameters are now: $POST (already existed before) $USER (already existed before) $CATEGORY (added with this commit) $CATEGORIES (added with this commit) See the template documentation in the wiki for more information.
2021-10-02Don't use suppression operator for "session_start"Thomas Lange1-1/+3
Don't use the suppression operator "@" for the "session_start" call in the migrations.php file, but rather check properly if there already is an active session by checking the "session_status" return value.
2021-09-19Rename some session array keysThomas Lange1-4/+4
* Rename "auth" to "USER_ID" * Rename "token" to "CSRF_TOKEN"
2021-08-29Check for "is_file" in the SPL class autoloaderThomas Lange1-4/+8
2021-08-26Don't use wrapper function "escapeHTML" internallyThomas Lange1-2/+2
Don't use the template function "escapeHTML" internally and replace all occurrences outside of the template files with "htmlspecialchars".
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-05Enhance error message for invalid CSRF tokenThomas Lange2-2/+2
2021-08-04Use "strpos" to validate "If-None-Match" headerThomas Lange1-14/+5
Remove those "trim" calls and use "strpos" to check if the ETag value generated by the system is contained somewhere in the "If-None-Match" request header sent by the client (if present). With this commit, the ETag header validation now also works with nginx. The nginx web server prefixes the "ETag" header generated by the system with the string "W/" which caused the previous validation code to fail. Instead of using multiple "trim" calls or "preg_replace", we now use a single, simple and fast "strpos" call to check if the system generated Etag hash value is contained in the "If-None-Match" request header.
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-08-03Show current page in categories <title> elementThomas Lange3-1/+12
Posts in a category are paginated, so display the number of the current page in square brackets within the categories <title> element.
2021-07-28Migrator: Don't recreate Language object anymoreThomas Lange2-13/+12
Do not force the recreation of the Language object in the migrations.php file anymore by changing the include position of the migrations.php (and the functions.php) in the application.php file a bit to the top.
2021-07-24Language: Put search query between HTML "code" tagThomas Lange2-2/+2
2021-07-24Create feed item's GUID manually in template fileThomas Lange2-12/+4
Do not rely on the "$POST['GUID']" template parameter anymore and create the GUID for the feed item manually in the feed item's template file. The application internal function "generatePseudoGUID" has been removed and the function "generateItemTemplateData" will not return the "GUID" part anymore (which was only used by the feed item template anyway). For backward compatibility, the "$POST['GUID']" template parameter will still be present in the feed item template, but not in other templates!
2021-07-24Remove configuration option "POST.FEED_GUID"Thomas Lange2-15/+5
Remove the configuration option "POST.FEED_GUID" that contained the name of the columns from the database which were passed to the SHA1 function for generating the pseudo GUID for the items in the RSS feed.
2021-07-24Use correct config option for redirect singlesThomas Lange4-4/+4
In addition to the last commit, use the correct configuration option in the code to check if single items should be redirected.
2021-07-24Rename configuration options "*.SINGLE_REDIRECT"Thomas Lange1-4/+4
Rename the config options "(CATEGORY|PAGE|POST|USER).SINGLE_REDIRECT" to to "(CATEGORY|PAGE|POST|USER).REDIRECT_SINGLE".
2021-07-23Decrease default feed size from 25 to 10 itemsThomas Lange1-1/+1
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-22Catch possible PDOException for search requestThomas Lange1-2/+6
Catch possible PDOException on search requests with queries like "*" and pass the exception message to the template for displaying.
2021-07-22Add pagination for search resultsThomas Lange2-7/+40
Add pagination for search results in the admin and default theme.
2021-07-22Bugfix: Escape "%" in URL params for sprintfThomas Lange1-0/+1
Escape possible percent characters ("%") in the URL params for sprintf. Otherwise the pagination template breaks if URL params which contain a percent sign are merged into the pagination URL.
2021-07-22Add LIMIT and OFFSET parameters for search methodThomas Lange1-3/+7
2021-07-22Merge GET parameters into pagination URLThomas Lange1-1/+4
2021-07-22Add demo category and update other demo entitiesThomas Lange1-4/+6
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 Lange6-22/+19
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 Lange3-1/+159
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 Lange7-43/+49
2021-07-19Add and use new parser/transformer classesThomas Lange5-83/+171
Classes: * Parsers\ArgumentParser * Parsers\EmoticonParser * Parsers\MarkdownParser Interfaces: * Parsers\ParserInterface
2021-07-19Replace option $ITEM.EMOTICONS with WRAP_EMOTICONSThomas Lange2-23/+2
This commit adds the configuration option "WRAP_EMOTICONS" to supersede the configuration options "(CATEGORY|PAGE|POST|USER).EMOTICONS". If the value of "WRAP_EMOTICONS" evaluates to TRUE, the emoticons found in the content of an item will be wrapped into a "<span>" element which gives the user a description of the emoticon in the "title" attribute.