[add] azerty layout
This commit is contained in:
parent
9c3d5be2a2
commit
c59702b5c5
4 changed files with 14 additions and 9 deletions
16
index.php
16
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);
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
<div class="row" style="margin-top: 30px;">
|
||||
<p>What's your Keyboard layout?</p>
|
||||
<select type="text" name="keyboardlayout">
|
||||
<option value="azerty">AZERTY</option>
|
||||
<option value="qwerty">QWERTY</option>
|
||||
<option value="qwertz">QWERTZ</option>
|
||||
</select>
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
|
|
Reference in a new issue