From dc88dcb94feec21dfefc4d116bad682231f8dd76 Mon Sep 17 00:00:00 2001 From: Skayo Date: Thu, 16 Jan 2020 20:23:19 +0100 Subject: [PATCH] Fixed bug, changed default settings, added more info to composer.json --- composer.json | 14 +++++++++----- src/Cage.php | 2 +- src/controllers/AgeVerificationController.php | 6 ++++-- src/controllers/SettingsController.php | 1 - src/models/Settings.php | 10 +++++----- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index a3f4389..e1ba587 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "skayocrafts/cage", "description": "An Age-Verification-Gate Plugin for Craft CMS", "type": "craft-plugin", - "version": "1.0.0", + "version": "1.0.1", "keywords": [ "craft", "cms", @@ -30,18 +30,21 @@ "21" ], "support": { - "docs": "https://github.com/SkayoCrafts/cage/blob/master/README.md", - "issues": "https://github.com/SkayoCrafts/cage/issues" + "email": "contact@skayo.dev", + "docs": "https://skayocrafts.github.io/cage/docs", + "issues": "https://github.com/SkayoCrafts/Cage/issues", + "source": "https://github.com/SkayoCrafts/Cage" }, "license": "proprietary", "authors": [ { "name": "Skayo", - "homepage": "https://skayo.github.io" + "homepage": "https://skayo.github.io", + "email": "contact@skayo.dev" } ], "require": { - "craftcms/cms": "^3.0.0-RC1" + "craftcms/cms": "^3.1.0" }, "autoload": { "psr-4": { @@ -52,6 +55,7 @@ "name": "Cage", "handle": "cage", "changelogUrl": "https://raw.githubusercontent.com/SkayoCrafts/cage/master/CHANGELOG.md", + "documentationUrl": "https://skayocrafts.github.io/cage/docs", "class": "skayocrafts\\cage\\Cage" } } diff --git a/src/Cage.php b/src/Cage.php index f086bbe..7d976d6 100644 --- a/src/Cage.php +++ b/src/Cage.php @@ -100,7 +100,7 @@ class Cage extends Plugin { /** * @inheritDoc */ - public $minVersionRequired = '3.0.0'; + public $minVersionRequired = '3.1.0'; // Public Methods // ========================================================================= diff --git a/src/controllers/AgeVerificationController.php b/src/controllers/AgeVerificationController.php index a0066af..4eb0c41 100644 --- a/src/controllers/AgeVerificationController.php +++ b/src/controllers/AgeVerificationController.php @@ -83,7 +83,7 @@ public function actionIndex () { // Check logged in setting if ($settings->ignoreLoggedIn && Craft::$app->getUser() - ->getIdentity() === null) { + ->getIdentity() !== null) { return $response->redirect($referer); } @@ -137,7 +137,9 @@ public function actionIndex () { } if ($yearValid) { - $age = date('Y') - $year; + $birthDate = new DateTime($year . '-01-01'); + $today = new DateTime('today'); + $age = $birthDate->diff($today)->y; if ($age >= $requiredAge) { $userAge = $age; diff --git a/src/controllers/SettingsController.php b/src/controllers/SettingsController.php index 2ec827b..bc3a2f1 100644 --- a/src/controllers/SettingsController.php +++ b/src/controllers/SettingsController.php @@ -122,7 +122,6 @@ public function actionEditSettings (string $settingsSection = 'general') : Respo ->getConfigFromFile(strtolower(Cage::$plugin->handle)); $variables['overrides'] = array_keys($overrides); - /* */ return $this->renderTemplate("cage/settings/$settingsSection", $variables); diff --git a/src/models/Settings.php b/src/models/Settings.php index 878b977..46aecda 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -195,7 +195,7 @@ class Settings extends Model { * * @var string An RGB color */ - public $backgroundColor = "rgba(0, 0, 0, 0.6)"; + public $backgroundColor = "rgba(0, 0, 0, 0.9)"; /** * The background image of the age verification page @@ -258,14 +258,14 @@ class Settings extends Model { * * @var string An RGB color */ - public $textColor = 'rgb(0, 0, 0)'; + public $textColor = 'rgb(42, 42, 42)'; /** * The background color of the enter button * * @var string An RGB color */ - public $enterButtonBackgroundColor = 'rgb(221, 151, 0)'; + public $enterButtonBackgroundColor = 'rgb(0, 81, 255)'; /** * The text color of the enter button @@ -293,14 +293,14 @@ class Settings extends Model { * * @var string An RGB color */ - public $leaveButtonTextColor = 'rgb(0, 0, 0)'; + public $leaveButtonTextColor = 'rgb(0, 81, 255)'; /** * The border color of the leave button * * @var string An RGB color */ - public $leaveButtonBorderColor = 'rgba(0, 0, 0, 0.4)'; + public $leaveButtonBorderColor = 'rgb(0, 81, 255)'; /** * The background color of drop-downs/input fields