diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/application.php | 34 | ||||
-rw-r--r-- | core/functions.php | 12 | ||||
-rw-r--r-- | core/include/category/list.php | 6 | ||||
-rw-r--r-- | core/include/category/main.php | 6 | ||||
-rw-r--r-- | core/include/page/list.php | 4 | ||||
-rw-r--r-- | core/include/post/list.php | 4 | ||||
-rw-r--r-- | core/include/search/main.php | 2 | ||||
-rw-r--r-- | core/include/user/list.php | 4 | ||||
-rw-r--r-- | core/namespace/Application.php | 12 | ||||
-rw-r--r-- | core/namespace/Factory.php | 2 | ||||
-rw-r--r-- | core/namespace/HTTP.php | 38 | ||||
-rw-r--r-- | core/namespace/Language.php | 4 | ||||
-rw-r--r-- | core/namespace/Migrator.php | 2 | ||||
-rw-r--r-- | core/namespace/ORM/Entity.php | 2 | ||||
-rw-r--r-- | core/namespace/ORM/Repositories/CategoryRepository.php | 4 | ||||
-rw-r--r-- | core/namespace/ORM/Repository.php | 10 | ||||
-rw-r--r-- | core/namespace/ORM/RepositorySearch.php | 6 | ||||
-rw-r--r-- | core/namespace/Parsers/ArgumentParser.php | 4 | ||||
-rw-r--r-- | core/namespace/Parsers/MarkdownParser.php | 2 | ||||
-rw-r--r-- | core/namespace/Router.php | 6 | ||||
-rw-r--r-- | core/namespace/Template/Template.php | 2 | ||||
-rw-r--r-- | core/script/convert_content_tags.php | 10 |
22 files changed, 88 insertions, 88 deletions
diff --git a/core/application.php b/core/application.php index cb2e5b2..80ea1e7 100644 --- a/core/application.php +++ b/core/application.php @@ -42,14 +42,14 @@ set_exception_handler(function(Throwable $Exception) { #=============================================================================== # Initialize HTTP class and remove all arrays from $_GET and $_POST #=============================================================================== -HTTP::init($_GET, $_POST, $_FILES, TRUE); +HTTP::init($_GET, $_POST, $_FILES, true); #=============================================================================== # Set default configuration #=============================================================================== foreach([ 'CORE.LANGUAGE' => 'en', - 'CORE.SEND_304' => FALSE, + 'CORE.SEND_304' => false, 'BLOGMETA.NAME' => 'Example blog', 'BLOGMETA.DESC' => 'This is an example blog.', 'BLOGMETA.HOME' => 'Home', @@ -59,7 +59,7 @@ foreach([ 'DATABASE.BASENAME' => 'blog', 'DATABASE.USERNAME' => 'blog', 'DATABASE.PASSWORD' => '', - 'MIGRATOR.ENABLED' => TRUE, + 'MIGRATOR.ENABLED' => true, 'TEMPLATE.NAME' => 'default', 'TEMPLATE.LANG' => 'en', 'ADMIN.TEMPLATE' => 'admin', @@ -67,15 +67,15 @@ foreach([ 'PATHINFO.PROT' => $_SERVER['REQUEST_SCHEME'] ?? 'https', 'PATHINFO.HOST' => $_SERVER['HTTP_HOST'] ?? 'localhost', 'PATHINFO.BASE' => '', - 'WRAP_EMOTICONS' => TRUE, + 'WRAP_EMOTICONS' => true, 'CATEGORY.DIRECTORY' => 'category', 'PAGE.DIRECTORY' => 'page', 'POST.DIRECTORY' => 'post', 'USER.DIRECTORY' => 'user', - 'CATEGORY.SLUG_URLS' => TRUE, - 'PAGE.SLUG_URLS' => TRUE, - 'POST.SLUG_URLS' => TRUE, - 'USER.SLUG_URLS' => TRUE, + 'CATEGORY.SLUG_URLS' => true, + 'PAGE.SLUG_URLS' => true, + 'POST.SLUG_URLS' => true, + 'USER.SLUG_URLS' => true, 'CATEGORY.LIST_SIZE' => 10, 'PAGE.LIST_SIZE' => 10, 'POST.LIST_SIZE' => 10, @@ -85,10 +85,10 @@ foreach([ 'PAGE.DESCRIPTION_SIZE' => 200, 'POST.DESCRIPTION_SIZE' => 200, 'USER.DESCRIPTION_SIZE' => 200, - 'CATEGORY.REDIRECT_SINGLE' => FALSE, - 'PAGE.REDIRECT_SINGLE' => FALSE, - 'POST.REDIRECT_SINGLE' => FALSE, - 'USER.REDIRECT_SINGLE' => FALSE, + 'CATEGORY.REDIRECT_SINGLE' => false, + 'PAGE.REDIRECT_SINGLE' => false, + 'POST.REDIRECT_SINGLE' => false, + 'USER.REDIRECT_SINGLE' => false, 'CATEGORY.LIST_SORT' => 'name ASC', 'PAGE.LIST_SORT' => 'time_insert DESC', 'POST.LIST_SORT' => 'time_insert DESC', @@ -133,7 +133,7 @@ if(Application::get('MIGRATOR.ENABLED')) { #=============================================================================== # Override configuration if admin #=============================================================================== -if(defined('ADMINISTRATION') AND ADMINISTRATION === TRUE) { +if(defined('ADMINISTRATION') and ADMINISTRATION === true) { #=========================================================================== # Enable sessions @@ -143,7 +143,7 @@ if(defined('ADMINISTRATION') AND ADMINISTRATION === TRUE) { #=========================================================================== # Authentication check #=========================================================================== - if(defined('AUTHENTICATION') AND !Application::isAuthenticated()) { + if(defined('AUTHENTICATION') and !Application::isAuthenticated()) { HTTP::redirect(Application::getAdminURL('auth.php')); } @@ -164,7 +164,7 @@ $Database = Application::getDatabase(); #=============================================================================== # Check if "304 Not Modified" and ETag header should be sent #=============================================================================== -if(Application::get('CORE.SEND_304') AND !defined('ADMINISTRATION')) { +if(Application::get('CORE.SEND_304') and !defined('ADMINISTRATION')) { #=========================================================================== # Fetch timestamps of the last modified entities @@ -195,7 +195,7 @@ if(Application::get('CORE.SEND_304') AND !defined('ADMINISTRATION')) { #=========================================================================== # Return "304 Not Modified" if the clients ETag value matches #=========================================================================== - if(strpos($_SERVER['HTTP_IF_NONE_MATCH'] ?? '', $etag) !== FALSE) { - Application::exit(NULL, 304); + if(strpos($_SERVER['HTTP_IF_NONE_MATCH'] ?? '', $etag) !== false) { + Application::exit(null, 304); } } diff --git a/core/functions.php b/core/functions.php index 15a5318..ffc1e1c 100644 --- a/core/functions.php +++ b/core/functions.php @@ -32,7 +32,7 @@ function createPaginationTemplate($current, $last, string $location): Template { #=============================================================================== # Helper function to reduce duplicate code #=============================================================================== -function generateCategoryItemTemplate(Category $Category, bool $is_root = FALSE): Template { +function generateCategoryItemTemplate(Category $Category, bool $is_root = false): Template { $CategoryRepository = Application::getRepository('Category'); foreach($CategoryRepository->findWithParents($Category->getID()) as $Category) { @@ -121,8 +121,8 @@ function generateItemTemplateData(EntityInterface $Entity): array { 'ARGV' => $arguments, 'ATTR' => $attribute, - 'PREV' => FALSE, - 'NEXT' => FALSE, + 'PREV' => false, + 'NEXT' => false, 'FILE' => [ 'LIST' => $images, @@ -292,7 +292,7 @@ function generateSlug($string, $separator = '-') { #=========================================================================== # Callback for (CATEGORY|PAGE|POST|USER) content function #=========================================================================== -function getEntityMarkdownLink($ns, $id, $text = NULL, $info = NULL): string { +function getEntityMarkdownLink($ns, $id, $text = null, $info = null): string { if(!$Entity = Application::getRepository($ns)->find($id)) { return sprintf('`{%s: *Reference error*}`', strtoupper($ns)); } @@ -301,7 +301,7 @@ function getEntityMarkdownLink($ns, $id, $text = NULL, $info = NULL): string { $href = Application::getEntityURL($Entity); $text = $text ?: "»{$title}«"; - if($info === NULL) { + if($info === null) { $info = sprintf('%s »%s«', Application::getLanguage()->text(strtolower($ns)), $title); @@ -399,7 +399,7 @@ foreach(['CATEGORY', 'PAGE', 'POST', 'USER'] as $function) { // Get Markdown formatted entity link Application::addContentFunction($function, - function($id, $text = NULL, $title = NULL) use($entity) { + function($id, $text = null, $title = null) use($entity) { return getEntityMarkdownLink($entity, $id, $text, $title); }); diff --git a/core/include/category/list.php b/core/include/category/list.php index 62881a6..6894801 100644 --- a/core/include/category/list.php +++ b/core/include/category/list.php @@ -21,14 +21,14 @@ $lastSite = ceil($count / $site_size); $currentSite = HTTP::GET('site') ?? 1; $currentSite = intval($currentSite); -if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { +if($currentSite < 1 or ($currentSite > $lastSite and $lastSite > 0)) { Application::error404(); } #=============================================================================== # Single redirect #=============================================================================== -if(Application::get('CATEGORY.REDIRECT_SINGLE') === TRUE AND $count === 1) { +if(Application::get('CATEGORY.REDIRECT_SINGLE') === true and $count === 1) { $Category = $CategoryRepository->getLast(); HTTP::redirect(Application::getEntityURL($Category)); } @@ -42,7 +42,7 @@ $categories = $CategoryRepository->getPaginatedTree( ); foreach($categories as $Category) { - $templates[] = generateCategoryItemTemplate($Category, TRUE); + $templates[] = generateCategoryItemTemplate($Category, true); } #=============================================================================== diff --git a/core/include/category/main.php b/core/include/category/main.php index 0fcece3..b1741b3 100644 --- a/core/include/category/main.php +++ b/core/include/category/main.php @@ -12,7 +12,7 @@ $UserRepository = Application::getRepository('User'); if(Application::get('CATEGORY.SLUG_URLS')) { if(!$categories = $CategoryRepository->findWithParentsBy('slug', $param)) { if($categories = $CategoryRepository->findWithParents($param)) { - $redirect_scheduled = TRUE; + $redirect_scheduled = true; } } } @@ -20,7 +20,7 @@ if(Application::get('CATEGORY.SLUG_URLS')) { else { if(!$categories = $CategoryRepository->findWithParents($param)) { if($categories = $CategoryRepository->findWithParentsBy('slug', $param)) { - $redirect_scheduled = TRUE; + $redirect_scheduled = true; } } } @@ -80,7 +80,7 @@ $lastSite = ceil($count / $site_size); $currentSite = HTTP::GET('site') ?? 1; $currentSite = intval($currentSite); -if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { +if($currentSite < 1 or ($currentSite > $lastSite and $lastSite > 0)) { Application::error404(); } diff --git a/core/include/page/list.php b/core/include/page/list.php index a02fd33..5fb4706 100644 --- a/core/include/page/list.php +++ b/core/include/page/list.php @@ -22,14 +22,14 @@ $lastSite = ceil($count / $site_size); $currentSite = HTTP::GET('site') ?? 1; $currentSite = intval($currentSite); -if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { +if($currentSite < 1 or ($currentSite > $lastSite and $lastSite > 0)) { Application::error404(); } #=============================================================================== # Single redirect #=============================================================================== -if(Application::get('PAGE.REDIRECT_SINGLE') === TRUE AND $count === 1) { +if(Application::get('PAGE.REDIRECT_SINGLE') === true and $count === 1) { $Page = $PageRepository->getLast(); HTTP::redirect(Application::getEntityURL($Page)); } diff --git a/core/include/post/list.php b/core/include/post/list.php index c696419..8dfd183 100644 --- a/core/include/post/list.php +++ b/core/include/post/list.php @@ -22,14 +22,14 @@ $lastSite = ceil($count / $site_size); $currentSite = HTTP::GET('site') ?? 1; $currentSite = intval($currentSite); -if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { +if($currentSite < 1 or ($currentSite > $lastSite and $lastSite > 0)) { Application::error404(); } #=============================================================================== # Single redirect #=============================================================================== -if(Application::get('POST.REDIRECT_SINGLE') === TRUE AND $count === 1) { +if(Application::get('POST.REDIRECT_SINGLE') === true and $count === 1) { $Post = $PostRepository->getLast(); HTTP::redirect(Application::getEntityURL($Post)); } diff --git a/core/include/search/main.php b/core/include/search/main.php index de7be9a..99d43ea 100644 --- a/core/include/search/main.php +++ b/core/include/search/main.php @@ -51,7 +51,7 @@ $form_data = [ $search_data = [ 'TEXT' => $search, - 'INFO' => isset($message) ? $message : FALSE, + 'INFO' => isset($message) ? $message : false, ]; #=============================================================================== diff --git a/core/include/user/list.php b/core/include/user/list.php index ec8416d..e0b54a9 100644 --- a/core/include/user/list.php +++ b/core/include/user/list.php @@ -21,14 +21,14 @@ $lastSite = ceil($count / $site_size); $currentSite = HTTP::GET('site') ?? 1; $currentSite = intval($currentSite); -if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { +if($currentSite < 1 or ($currentSite > $lastSite and $lastSite > 0)) { Application::error404(); } #=============================================================================== # Single redirect #=============================================================================== -if(Application::get('USER.REDIRECT_SINGLE') === TRUE AND $count === 1) { +if(Application::get('USER.REDIRECT_SINGLE') === true and $count === 1) { $User = $UserRepository->getLast(); HTTP::redirect(Application::getEntityURL($User)); } diff --git a/core/namespace/Application.php b/core/namespace/Application.php index 2d5a23c..3dee818 100644 --- a/core/namespace/Application.php +++ b/core/namespace/Application.php @@ -29,7 +29,7 @@ class Application { # Get configuration value #=============================================================================== public static function get($config) { - return self::$configuration[$config] ?? NULL; + return self::$configuration[$config] ?? null; } #=============================================================================== @@ -42,8 +42,8 @@ class Application { #=============================================================================== # Return singleton Database instance #=============================================================================== - public static function getDatabase($force = FALSE): Database { - if(!self::$Database instanceof Database OR $force === TRUE) { + public static function getDatabase($force = false): Database { + if(!self::$Database instanceof Database or $force === true) { $hostname = self::get('DATABASE.HOSTNAME'); $basename = self::get('DATABASE.BASENAME'); $username = self::get('DATABASE.USERNAME'); @@ -70,8 +70,8 @@ class Application { #=============================================================================== # Return singleton Language instance #=============================================================================== - public static function getLanguage($force = FALSE): Language { - if(!self::$Language instanceof Language OR $force === TRUE) { + public static function getLanguage($force = false): Language { + if(!self::$Language instanceof Language or $force === true) { $template_name = self::get('TEMPLATE.NAME'); $template_lang = self::get('TEMPLATE.LANG'); @@ -237,7 +237,7 @@ class Application { #=============================================================================== # Exit application with a custom message and status code #=============================================================================== - public static function exit(?string $message = NULL, int $code = 503): void { + public static function exit(?string $message = null, int $code = 503): void { http_response_code($code); exit($message); } diff --git a/core/namespace/Factory.php b/core/namespace/Factory.php index 779b890..e30895d 100644 --- a/core/namespace/Factory.php +++ b/core/namespace/Factory.php @@ -13,6 +13,6 @@ abstract class Factory implements FactoryInterface { # Gets an instance of a class from the runtime instance cache #=============================================================================== protected static function fetchInstance($identifier) { - return self::$storage[get_called_class()][$identifier] ?? FALSE; + return self::$storage[get_called_class()][$identifier] ?? false; } } diff --git a/core/namespace/HTTP.php b/core/namespace/HTTP.php index 9145539..90efa44 100644 --- a/core/namespace/HTTP.php +++ b/core/namespace/HTTP.php @@ -1,8 +1,8 @@ <?php class HTTP { - private static $GET = NULL; - private static $POST = NULL; - private static $FILE = NULL; + private static $GET = null; + private static $POST = null; + private static $FILE = null; #=============================================================================== # HTTP protocol versions @@ -76,7 +76,7 @@ class HTTP { #=============================================================================== # Initialize $GET, $POST and $FILE #=============================================================================== - public static function init($GET, $POST, $FILE, $removeArrays = FALSE, $trimValues = TRUE) { + public static function init($GET, $POST, $FILE, $removeArrays = false, $trimValues = true) { self::$GET = $GET; self::$POST = $POST; self::$FILE = $FILE; @@ -86,8 +86,8 @@ class HTTP { self::$POST = self::removeArrayValues(self::$POST); } - self::$GET = ($trimValues === TRUE ? self::trim(self::$GET) : self::$GET ); - self::$POST = ($trimValues === TRUE ? self::trim(self::$POST) : self::$POST); + self::$GET = ($trimValues === true ? self::trim(self::$GET) : self::$GET ); + self::$POST = ($trimValues === true ? self::trim(self::$POST) : self::$POST); } #=============================================================================== @@ -116,38 +116,38 @@ class HTTP { private static function issetData($data, $arguments): bool { foreach($arguments as $key) { if(is_array($key)) { - if(!isset($data[key($key)]) OR $data[key($key)] !== $key[key($key)]) { - return FALSE; + if(!isset($data[key($key)]) or $data[key($key)] !== $key[key($key)]) { + return false; } } - else if(!isset($data[$key]) OR !is_string($data[$key])) { - return FALSE; + else if(!isset($data[$key]) or !is_string($data[$key])) { + return false; } } - return TRUE; + return true; } #=============================================================================== # Return GET value #=============================================================================== public static function GET($parameter) { - return self::$GET[$parameter] ?? NULL; + return self::$GET[$parameter] ?? null; } #=============================================================================== # Return POST value #=============================================================================== public static function POST($parameter) { - return self::$POST[$parameter] ?? NULL; + return self::$POST[$parameter] ?? null; } #=============================================================================== # Return FILE value #=============================================================================== public static function FILE($parameter) { - return self::$FILE[$parameter] ?? NULL; + return self::$FILE[$parameter] ?? null; } #=============================================================================== @@ -182,13 +182,13 @@ class HTTP { # Get cookie #=============================================================================== public static function getCookie($name) { - return $_COOKIE[$name] ?? NULL; + return $_COOKIE[$name] ?? null; } #=============================================================================== # Return HTTP request method or check if request method equals with $method #=============================================================================== - public static function requestMethod($method = NULL) { + public static function requestMethod($method = null) { if(!empty($method)) { return ($_SERVER['REQUEST_METHOD'] === $method); } @@ -200,7 +200,7 @@ class HTTP { # Return REQUEST_URI #=============================================================================== public static function requestURI() { - return $_SERVER['REQUEST_URI'] ?? FALSE; + return $_SERVER['REQUEST_URI'] ?? false; } #=============================================================================== @@ -213,10 +213,10 @@ class HTTP { #=============================================================================== # Sends a HTTP redirect to the client #=============================================================================== - public static function redirect($location, $code = 303, $exit = TRUE) { + public static function redirect($location, $code = 303, $exit = true) { http_response_code($code); self::sendHeader("Location: {$location}"); - $exit AND exit(); + $exit and exit(); } #=============================================================================== diff --git a/core/namespace/Language.php b/core/namespace/Language.php index a2facb0..804f3d5 100644 --- a/core/namespace/Language.php +++ b/core/namespace/Language.php @@ -18,7 +18,7 @@ class Language { # Load another language file #=============================================================================== public function load($filename) { - if(file_exists($filename) AND is_readable($filename)) { + if(file_exists($filename) and is_readable($filename)) { require $filename; $this->text = array_merge($this->text, $LANGUAGE ?? []); } @@ -34,7 +34,7 @@ class Language { #=============================================================================== # Return language string with included arguments #=============================================================================== - public function text($name, $arguments = NULL): string { + public function text($name, $arguments = null): string { if(!isset($this->text[$name])) { return "{{$name}}"; } diff --git a/core/namespace/Migrator.php b/core/namespace/Migrator.php index 7b8d263..607c137 100644 --- a/core/namespace/Migrator.php +++ b/core/namespace/Migrator.php @@ -17,7 +17,7 @@ class Migrator { $Statement = $Database->query('SELECT schema_version FROM migration'); # Explicitly check for FALSE, because result can be "0" - if(($this->version = $Statement->fetchColumn()) === FALSE) { + if(($this->version = $Statement->fetchColumn()) === false) { throw new Exception('The migration table does exist, but there is no row containing the currently used on-disk schema version!'); } diff --git a/core/namespace/ORM/Entity.php b/core/namespace/ORM/Entity.php index 61b9371..5462b54 100644 --- a/core/namespace/ORM/Entity.php +++ b/core/namespace/ORM/Entity.php @@ -13,7 +13,7 @@ abstract class Entity implements EntityInterface { # Get attribute #=============================================================================== public function get(string $attribute) { - return $this->{$attribute} ?? NULL; + return $this->{$attribute} ?? null; } #=============================================================================== diff --git a/core/namespace/ORM/Repositories/CategoryRepository.php b/core/namespace/ORM/Repositories/CategoryRepository.php index 7c7b3f9..657940c 100644 --- a/core/namespace/ORM/Repositories/CategoryRepository.php +++ b/core/namespace/ORM/Repositories/CategoryRepository.php @@ -47,7 +47,7 @@ class CategoryRepository extends Repository { # element. PHP >= 8 will throw a PDOException when the number of # bound variables doesn't matches the number of tokens ("?") in # the SQL query, which is the case here if $value is NULL. - is_null($value) ? NULL : [$value] + is_null($value) ? null : [$value] ); # TODO: Virtual column _depth shall not be fetched into the entity class @@ -128,7 +128,7 @@ class CategoryRepository extends Repository { $UpdateStatement = $this->Database->prepare($query); $UpdateStatement->execute([$_parent, $Entity->get('parent')]); break; - } else if($_parent === NULL) { + } else if($_parent === null) { break; } } diff --git a/core/namespace/ORM/Repository.php b/core/namespace/ORM/Repository.php index e7750cb..ca3690f 100644 --- a/core/namespace/ORM/Repository.php +++ b/core/namespace/ORM/Repository.php @@ -23,7 +23,7 @@ abstract class Repository { return $Entity; } - return NULL; + return null; } #=============================================================================== @@ -60,7 +60,7 @@ abstract class Repository { # Gets an entity from the runtime cache #=============================================================================== protected function fetchInstance($identifier) { - return $this->entities[$identifier] ?? FALSE; + return $this->entities[$identifier] ?? false; } #=============================================================================== @@ -93,7 +93,7 @@ abstract class Repository { return $Statement->execute($params); } - return FALSE; + return false; } #=========================================================================== @@ -115,7 +115,7 @@ abstract class Repository { return $Statement->execute($params); } - return FALSE; + return false; } #=========================================================================== @@ -199,7 +199,7 @@ abstract class Repository { if(!empty($filter)) { foreach($filter as $column => $value) { - if($value === NULL) { + if($value === null) { $wheres[] = "$column IS NULL"; } else { $wheres[] = "$column = ?"; diff --git a/core/namespace/ORM/RepositorySearch.php b/core/namespace/ORM/RepositorySearch.php index aac46ef..66f27ea 100644 --- a/core/namespace/ORM/RepositorySearch.php +++ b/core/namespace/ORM/RepositorySearch.php @@ -8,7 +8,7 @@ trait RepositorySearch { #=============================================================================== # Get entities based on search query #=============================================================================== - public function search(string $search, array $filter = [], int $limit = NULL, int $offset = 0): array { + public function search(string $search, array $filter = [], int $limit = null, int $offset = 0): array { if(strlen($filter['year'] ?? '') !== 0) { $extend[] = 'YEAR(time_insert) = ? AND'; $params[] = $filter['year']; @@ -24,12 +24,12 @@ trait RepositorySearch { $params[] = $filter['day']; } - if(is_numeric($filter['user'] ?? NULL)) { + if(is_numeric($filter['user'] ?? null)) { $extend[] = 'user = ? AND'; $params[] = $filter['user']; } - if(is_numeric($filter['category'] ?? NULL)) { + if(is_numeric($filter['category'] ?? null)) { $extend[] = 'category = ? AND'; $params[] = $filter['category']; } diff --git a/core/namespace/Parsers/ArgumentParser.php b/core/namespace/Parsers/ArgumentParser.php index ab32fe1..4ac3b9c 100644 --- a/core/namespace/Parsers/ArgumentParser.php +++ b/core/namespace/Parsers/ArgumentParser.php @@ -10,8 +10,8 @@ class ArgumentParser implements ParserInterface { foreach(explode('|', $text) as $delimiter) { $part = explode('=', $delimiter); - $argumentK = $part[0] ?? NULL; - $argumentV = $part[1] ?? TRUE; + $argumentK = $part[0] ?? null; + $argumentV = $part[1] ?? true; if(preg_match('#^[[:word:]]+$#', $argumentK)) { $arguments[strtoupper($argumentK)] = $argumentV; diff --git a/core/namespace/Parsers/MarkdownParser.php b/core/namespace/Parsers/MarkdownParser.php index 27a18ad..b9ebc15 100644 --- a/core/namespace/Parsers/MarkdownParser.php +++ b/core/namespace/Parsers/MarkdownParser.php @@ -10,7 +10,7 @@ class MarkdownParser implements ParserInterface { #=========================================================================== public function __construct() { $this->Parsedown = new Parsedown(); - $this->Parsedown->setUrlsLinked(FALSE); + $this->Parsedown->setUrlsLinked(false); } #=========================================================================== diff --git a/core/namespace/Router.php b/core/namespace/Router.php index 803a8e0..ffb3154 100644 --- a/core/namespace/Router.php +++ b/core/namespace/Router.php @@ -34,7 +34,7 @@ class Router { #=============================================================================== public static function execute($path) { $path = ltrim($path, '/'); - $route_found = FALSE; + $route_found = false; foreach(self::$routes as $route) { if($route['type'] === 'redirect') { @@ -50,13 +50,13 @@ class Router { # Remove the first element from matches which contains the whole string. array_shift($matches); - $route_found = TRUE; + $route_found = true; call_user_func_array($route['callback'], $matches); } } } - if($route_found === FALSE) { + if($route_found === false) { Application::error404(); } } diff --git a/core/namespace/Template/Template.php b/core/namespace/Template/Template.php index 25034a2..4967a7f 100644 --- a/core/namespace/Template/Template.php +++ b/core/namespace/Template/Template.php @@ -27,7 +27,7 @@ class Template { # Get parameter #=============================================================================== public function get($name) { - return $this->parameters[$name] ?? NULL; + return $this->parameters[$name] ?? null; } #=============================================================================== diff --git a/core/script/convert_content_tags.php b/core/script/convert_content_tags.php index 7b879a3..e11e820 100644 --- a/core/script/convert_content_tags.php +++ b/core/script/convert_content_tags.php @@ -42,7 +42,7 @@ function convertContentTags(string $text, &$globalMatches): string { str_replace('"', '\\"', $matches['text']) ]; - if($linkTitle = $matches['title'] ?? FALSE) { + if($linkTitle = $matches['title'] ?? false) { $q = $matches['qmark']; $format = '{%s: %d, "%s", '.$q.'%s'.$q.'}'; $params[] = $linkTitle; @@ -95,10 +95,10 @@ HTTP::responseHeader(HTTP::HEADER_CONTENT_TYPE, HTTP::CONTENT_TYPE_TEXT); #=========================================================================== # Set "commit" variable based on GET parameter or CLI argument #=========================================================================== -$commit = FALSE; +$commit = false; if(isset($_GET['commit']) OR - (isset($argv[1]) AND $argv[1] === 'commit')) { - $commit = TRUE; + (isset($argv[1]) and $argv[1] === 'commit')) { + $commit = true; } #=========================================================================== @@ -121,7 +121,7 @@ foreach(['Category', 'Page', 'Post', 'User'] as $entityName) { $content = convertContentTags($content, $matches); if($matches) { - $foundMatches = TRUE; + $foundMatches = true; if($commit) { $Entity->set('body', $content); |