From c59702b5c59ef70ef63061689d35d9f3975ca407 Mon Sep 17 00:00:00 2001 From: Knah Date: Thu, 24 Mar 2016 15:47:07 +0100 Subject: [PATCH] [add] azerty layout --- index.php | 16 ++++++++-------- resources/index.html | 1 + src/Configuration.php | 4 ++++ src/RequestUtils.php | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/index.php b/index.php index e5d0cad..5098af2 100644 --- a/index.php +++ b/index.php @@ -28,31 +28,31 @@ if (!RequestUtils::isPost()) { $primary = RequestUtils::parsePrimaryColor(); $secondary = RequestUtils::parseSecondaryColor(); $spaceBarSize = RequestUtils::parseSpacebarSize(); - + // Setup configuration $cfg = new Configuration($seed, $pattern, $keyboardLayout, $spaceBarSize, $text, $primary, $secondary); $creator = new CardCreator($cfg); - + // Load SVG templates $front_template = $creator->getSvgTemplate('simple_back'); $back_template = $creator->getSvgTemplate('simple_front'); - + // Render SVG into tempfiles $front = $creator->renderIntoTempfile($front_template); $back = $creator->renderIntoTempfile($back_template); - + // Render the PDF $doc = PDFRenderer::render($front, $back); - + // Prepare response PDF file header RequestUtils::preparePdfHeader(strlen($doc)); - + // Ignore user abort to cleanup afterwards ignore_user_abort(true); - + // Strem the PDF echo $doc; - + // Cleanup temporary SVG images unlink($back); unlink($front); diff --git a/resources/index.html b/resources/index.html index 0acc0b2..a2b6966 100644 --- a/resources/index.html +++ b/resources/index.html @@ -49,6 +49,7 @@

What's your Keyboard layout?

diff --git a/src/Configuration.php b/src/Configuration.php index d19ef45..a6cf659 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -80,6 +80,10 @@ class Configuration */ public static function evalKeys($keys) { + // Return azerty + if (strtolower($keys) === 'azerty') { + return 'AZERTYUIOPQSDFGHJKLMWXCVBN'; + } // Return qwertz if (strtolower($keys) === 'qwertz') { return 'QWERTZUIOPASDFGHJKLYXCVBNM'; diff --git a/src/RequestUtils.php b/src/RequestUtils.php index 1c49495..0a5de11 100644 --- a/src/RequestUtils.php +++ b/src/RequestUtils.php @@ -105,7 +105,7 @@ class RequestUtils { if ( isset($_POST['keyboardlayout']) && - preg_match("/qwerty|qwertz/", $_POST['keyboardlayout']) + preg_match("/azerty|qwerty|qwertz/", $_POST['keyboardlayout']) ) { return strtolower($_POST['keyboardlayout']); }