@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | "antalsvar" => $antalsvar |
36 | 36 | ]); |
37 | 37 | |
38 | - if ($this->di->session->get("anvandarid")!=null) { |
|
38 | + if ($this->di->session->get("anvandarid") != null) { |
|
39 | 39 | $page->add("anax/v2/fragor/nyfraga", [ |
40 | 40 | "res" => $res, |
41 | 41 | "taggar" => $taggar, |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | "tagg" => $tagg |
75 | 75 | ]); |
76 | 76 | |
77 | - if ($this->di->session->get("anvandarid")!=null) { |
|
77 | + if ($this->di->session->get("anvandarid") != null) { |
|
78 | 78 | $page->add("anax/v2/fragor/nyfraga", [ |
79 | 79 | "res" => $res, |
80 | 80 | "taggar" => $taggar, |
@@ -104,14 +104,14 @@ |
||
104 | 104 | |
105 | 105 | |
106 | 106 | /** |
107 | - * Helper, Markdown formatting converting to HTML. |
|
108 | - * |
|
109 | - * @SuppressWarnings(PHPMD) |
|
110 | - * |
|
111 | - * @param string text The text to be converted. |
|
112 | - * |
|
113 | - * @return string the formatted text. |
|
114 | - */ |
|
107 | + * Helper, Markdown formatting converting to HTML. |
|
108 | + * |
|
109 | + * @SuppressWarnings(PHPMD) |
|
110 | + * |
|
111 | + * @param string text The text to be converted. |
|
112 | + * |
|
113 | + * @return string the formatted text. |
|
114 | + */ |
|
115 | 115 | public function markdown($text) |
116 | 116 | { |
117 | 117 | $text = MarkdownExtra::defaultTransform($text); |
@@ -94,7 +94,7 @@ |
||
94 | 94 | { |
95 | 95 | return preg_replace_callback( |
96 | 96 | '#\b(?<![href|src]=[\'"])https?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', |
97 | - function ($matches) { |
|
97 | + function($matches) { |
|
98 | 98 | return "<a href=\'{$matches[0]}\'>{$matches[0]}</a>"; |
99 | 99 | }, |
100 | 100 | $text |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $rankning->upp($id); |
82 | 82 | $inlagg = $rankning->vemsInlagg($id); |
83 | - $rankning->uppdatera($inlagg->userid, "r" .$inlagg->type, 1); |
|
83 | + $rankning->uppdatera($inlagg->userid, "r" . $inlagg->type, 1); |
|
84 | 84 | return $this->di->get("response")->redirect($retursida)->send(); |
85 | 85 | } |
86 | 86 | |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | |
127 | 127 | $rankning->uppdatera($userid, "fraga", 1); |
128 | 128 | |
129 | - if ($valdataggar!=null) { |
|
129 | + if ($valdataggar != null) { |
|
130 | 130 | foreach ($valdataggar as $value) { |
131 | 131 | array_push($taggar, $value); |
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | - if ($nyataggar!=null) { |
|
135 | + if ($nyataggar != null) { |
|
136 | 136 | $nyataggar = explode(",", $nyataggar); |
137 | 137 | $posta->nyaTaggar($nyataggar); |
138 | 138 | $i = 0; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $db = $this->di->get("db"); |
50 | 50 | $db->connect(); |
51 | 51 | $sql = "INSERT INTO `anvandare2` (`anvandarnamn`, `losenord`, `email`, `fraga`, `svar`, `kommentar`, `rfraga`, `rsvar`, `rkommentar`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);"; |
52 | - $db->execute($sql, [$anvandarnamn, MD5($losenord), $email, 0, 0 ,0 ,0 ,0 ,0]); |
|
52 | + $db->execute($sql, [$anvandarnamn, MD5($losenord), $email, 0, 0, 0, 0, 0, 0]); |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $db = $this->di->get("db"); |
59 | 59 | $db->connect(); |
60 | - $sql = 'UPDATE anvandare2 SET ' . $typ . ' = "' . $varde . '" WHERE anvandarid = ?;'; |
|
60 | + $sql = 'UPDATE anvandare2 SET ' . $typ . ' = "' . $varde . '" WHERE anvandarid = ?;'; |
|
61 | 61 | $db->execute($sql, [$this->di->session->get("anvandarid")]); |
62 | 62 | return; |
63 | 63 | } |
@@ -9,12 +9,12 @@ |
||
9 | 9 | class Slugify |
10 | 10 | { |
11 | 11 | /** |
12 | - * Create a slug of a string, to be used as url. |
|
13 | - * |
|
14 | - * @param string $str the string to format as slug. |
|
15 | - * |
|
16 | - * @return str the formatted slug. |
|
17 | - */ |
|
12 | + * Create a slug of a string, to be used as url. |
|
13 | + * |
|
14 | + * @param string $str the string to format as slug. |
|
15 | + * |
|
16 | + * @return str the formatted slug. |
|
17 | + */ |
|
18 | 18 | public function slugify($str) |
19 | 19 | { |
20 | 20 | $str = mb_strtolower(trim($str)); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function slugify($str) |
19 | 19 | { |
20 | 20 | $str = mb_strtolower(trim($str)); |
21 | - $str = str_replace(array('å','ä','ö'), array('a','a','o'), $str); |
|
21 | + $str = str_replace(array('å', 'ä', 'ö'), array('a', 'a', 'o'), $str); |
|
22 | 22 | $str = preg_replace('/[^a-z0-9-]/', '-', $str); |
23 | 23 | $str = trim(preg_replace('/-+/', '-', $str), '-'); |
24 | 24 | return $str; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | // Create the ul li menu from the array, use an anonomous recursive |
86 | 86 | // function that returns an array of values. |
87 | - $createMenu = function ( |
|
87 | + $createMenu = function( |
|
88 | 88 | $items, |
89 | 89 | $ulId = null, |
90 | 90 | $ulClass = null |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | // Is there a class set for this item, then use it |
131 | - $class = isset($item["class"]) && ! is_null($item["class"]) |
|
131 | + $class = isset($item["class"]) && !is_null($item["class"]) |
|
132 | 132 | ? $item["class"] |
133 | 133 | : null; |
134 | 134 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * Custom exception handler. |
13 | 13 | */ |
14 | -set_exception_handler(function ($exception) { |
|
14 | +set_exception_handler(function($exception) { |
|
15 | 15 | errorPage( |
16 | 16 | "<p><b>img.php: Uncaught exception:</b> <p>" |
17 | 17 | . $exception->getMessage() |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * Get configuration options from file, if the file exists, else use $config |
29 | 29 | * if its defined or create an empty $config. |
30 | 30 | */ |
31 | -$configFile = __DIR__.'/'.basename(__FILE__, '.php').'_config.php'; |
|
31 | +$configFile = __DIR__ . '/' . basename(__FILE__, '.php') . '_config.php'; |
|
32 | 32 | |
33 | 33 | if (is_file($configFile)) { |
34 | 34 | $config = require $configFile; |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * Manage size constants from config file, use constants to replace values |
405 | 405 | * for width and height. |
406 | 406 | */ |
407 | -$sizeConstant = getConfig('size_constant', function () { |
|
407 | +$sizeConstant = getConfig('size_constant', function() { |
|
408 | 408 | |
409 | 409 | // Set sizes to map constant to value, easier to use with width or height |
410 | 410 | $sizes = array( |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $gridColumns = 24; |
419 | 419 | |
420 | 420 | for ($i = 1; $i <= $gridColumns; $i++) { |
421 | - $sizes['c' . $i] = ($gridColumnWidth + $gridGutterWidth) * $i - $gridGutterWidth; |
|
421 | + $sizes['c' . $i] = ($gridColumnWidth + $gridGutterWidth)*$i - $gridGutterWidth; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | return $sizes; |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | } |
441 | 441 | |
442 | 442 | // Support width as % of original width |
443 | -if ($newWidth[strlen($newWidth)-1] == '%') { |
|
443 | +if ($newWidth[strlen($newWidth) - 1] == '%') { |
|
444 | 444 | is_numeric(substr($newWidth, 0, -1)) |
445 | 445 | or errorPage('Width % not numeric.', 404); |
446 | 446 | } else { |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | } |
466 | 466 | |
467 | 467 | // height |
468 | -if ($newHeight[strlen($newHeight)-1] == '%') { |
|
468 | +if ($newHeight[strlen($newHeight) - 1] == '%') { |
|
469 | 469 | is_numeric(substr($newHeight, 0, -1)) |
470 | 470 | or errorPage('Height % out of range.', 404); |
471 | 471 | } else { |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * aspect-ratio, ar - affecting the resulting image width, height and resize options |
483 | 483 | */ |
484 | 484 | $aspectRatio = get(array('aspect-ratio', 'ar')); |
485 | -$aspectRatioConstant = getConfig('aspect_ratio_constant', function () { |
|
485 | +$aspectRatioConstant = getConfig('aspect_ratio_constant', function() { |
|
486 | 486 | return array( |
487 | 487 | '3:1' => 3/1, |
488 | 488 | '3:2' => 3/2, |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | if ($negateAspectRatio) { |
507 | - $aspectRatio = 1 / $aspectRatio; |
|
507 | + $aspectRatio = 1/$aspectRatio; |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | is_null($aspectRatio) |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | if ($fillToFit !== null) { |
569 | 569 | |
570 | 570 | if (!empty($fillToFit)) { |
571 | - $bgColor = $fillToFit; |
|
571 | + $bgColor = $fillToFit; |
|
572 | 572 | verbose("fillToFit changed bgColor to = $bgColor"); |
573 | 573 | } |
574 | 574 |
@@ -25,5 +25,5 @@ |
||
25 | 25 | <pre><?= var_dump($session) ?></pre> |
26 | 26 | |
27 | 27 | <p> |
28 | - <a href="<?= url($mount."session") ?>">Back to session<a> |
|
28 | + <a href="<?= url($mount . "session") ?>">Back to session<a> |
|
29 | 29 | </p> |