From 614216d98503cfbb3f5185dc1ee727018924dd27 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell <lonnieje@gmail.com> Date: Sun, 16 Dec 2018 23:15:55 -0600 Subject: [PATCH] Moved honeypot service out of the app Services file to the system Services where it belongs. --- app/Config/Services.php | 16 ---------------- system/Config/Services.php | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/app/Config/Services.php b/app/Config/Services.php index 3eab9153cb01..79a2afbab066 100644 --- a/app/Config/Services.php +++ b/app/Config/Services.php @@ -30,20 +30,4 @@ class Services extends CoreServices // // return new \CodeIgniter\Example(); // } - - public static function honeypot(BaseConfig $config = null, $getShared = true) - { - if ($getShared) - { - return static::getSharedInstance('honeypot', $config); - } - - if (is_null($config)) - { - $config = new \Config\Honeypot(); - } - - return new \CodeIgniter\Honeypot\Honeypot($config); - } - } diff --git a/system/Config/Services.php b/system/Config/Services.php index 3815d803729f..7cdc4fbd354b 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -252,6 +252,32 @@ public static function filters($config = null, bool $getShared = true) //-------------------------------------------------------------------- + /** + * The Honeypot provides a secret input on forms that bots should NOT + * fill in, providing an additional safeguard when accepting user input. + * + * @param \CodeIgniter\Config\BaseConfig|null $config + * @param boolean $getShared + * + * @return \CodeIgniter\Honeypot\Honeypot|mixed + */ + public static function honeypot(BaseConfig $config = null, $getShared = true) + { + if ($getShared) + { + return static::getSharedInstance('honeypot', $config); + } + + if (is_null($config)) + { + $config = new \Config\Honeypot(); + } + + return new \CodeIgniter\Honeypot\Honeypot($config); + } + + //-------------------------------------------------------------------- + /** * Acts as a factory for ImageHandler classes and returns an instance * of the handler. Used like Services::image()->withFile($path)->rotate(90)->save();