From 9c77a3cf1293651356ef1e68233d2ace3d2b76d2 Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Sun, 3 Jul 2022 23:28:08 +0530 Subject: [PATCH 1/3] .gitignore: Remove redundant entry --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index c67111cdca..ff377854ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ backend/mirror.gif backend/mirror.png backend/mirror.jpg -backend/mirror.jpg backend/GeoIP.dat .idea .DS_Store From 24406af9c96edac1fd48cb7cdbd933cf7214a1bd Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Sun, 3 Jul 2022 23:31:59 +0530 Subject: [PATCH 2/3] Minor optimizations with ternary operators --- .router.php | 2 +- images/logo.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.router.php b/.router.php index d40eda6049..723801a273 100644 --- a/.router.php +++ b/.router.php @@ -1,7 +1,7 @@ Date: Sun, 3 Jul 2022 23:32:12 +0530 Subject: [PATCH 3/3] Use `const` instead of `define()` where appropriate `const` is quite faster because of the compile-time optimizations. Because the replaced statements are not declaring constant conditionally, it's safe to use `const` in all of these places. --- include/prepend.inc | 6 +++--- include/site.inc | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/prepend.inc b/include/prepend.inc index 04adab8302..3870dbaf0a 100644 --- a/include/prepend.inc +++ b/include/prepend.inc @@ -131,9 +131,9 @@ function myphpnet_language($langcode = FALSE) return false; } -define("MYPHPNET_URL_NONE", FALSE); -define("MYPHPNET_URL_FUNC", 'quickref'); -define("MYPHPNET_URL_MANUAL", 'manual'); +const MYPHPNET_URL_NONE = false; +const MYPHPNET_URL_FUNC = 'quickref'; +const MYPHPNET_URL_MANUAL = 'manual'; // Set URL search fallback preference function myphpnet_urlsearch($type = FALSE) diff --git a/include/site.inc b/include/site.inc index 2e804a0690..b54bd80343 100644 --- a/include/site.inc +++ b/include/site.inc @@ -2,16 +2,16 @@ // Define some constants, and $MIRRORS array // Mirror type constants -define('MIRROR_DOWNLOAD', 0); -define('MIRROR_STANDARD', 1); -define('MIRROR_SPECIAL', 2); -define('MIRROR_VIRTUAL', 3); +const MIRROR_DOWNLOAD = 0; +const MIRROR_STANDARD = 1; +const MIRROR_SPECIAL = 2; +const MIRROR_VIRTUAL = 3; // Mirror status constants -define('MIRROR_OK', 0); -define('MIRROR_NOTACTIVE', 1); -define('MIRROR_OUTDATED', 2); -define('MIRROR_DOESNOTWORK', 3); +const MIRROR_OK = 0; +const MIRROR_NOTACTIVE = 1; +const MIRROR_OUTDATED = 2; +const MIRROR_DOESNOTWORK = 3; $MIRRORS = array( "https://www.php.net/" => array(