@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | { |
303 | 303 | $input = '@Alice @Bob @Bobby Junior @Bobby Tables @Dr. No'; |
304 | 304 | $expected = |
305 | - "<a href='/at/Alice'>@Alice</a>" . |
|
306 | - " @Bob " . |
|
307 | - "<a href='/at/Bobby+Junior'>@Bobby Junior</a>" . |
|
308 | - " @Bobby Tables " . |
|
305 | + "<a href='/at/Alice'>@Alice</a>". |
|
306 | + " @Bob ". |
|
307 | + "<a href='/at/Bobby+Junior'>@Bobby Junior</a>". |
|
308 | + " @Bobby Tables ". |
|
309 | 309 | "<a href='/at/Dr.+No'>@Dr. No</a>"; |
310 | 310 | |
311 | 311 | $result = $this->_Parser->parse($input); |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | public function testIframe() |
635 | 635 | { |
636 | 636 | //* test allowed domain |
637 | - $input = '[iframe height=349 width=560 ' . |
|
638 | - 'src=http://www.youtube.com/embed/HdoW3t_WorU ' . |
|
637 | + $input = '[iframe height=349 width=560 '. |
|
638 | + 'src=http://www.youtube.com/embed/HdoW3t_WorU '. |
|
639 | 639 | 'frameborder=0][/iframe]'; |
640 | 640 | $expected = [ |
641 | 641 | [ |
@@ -659,8 +659,8 @@ discard block |
||
659 | 659 | $this->assertHtml($expected, $result); |
660 | 660 | |
661 | 661 | //* test forbidden domains |
662 | - $input = '[iframe height=349 width=560 ' . |
|
663 | - 'src=http://www.youtubescam.com/embed/HdoW3t_WorU ' . |
|
662 | + $input = '[iframe height=349 width=560 '. |
|
663 | + 'src=http://www.youtubescam.com/embed/HdoW3t_WorU '. |
|
664 | 664 | 'frameborder=0][/iframe]'; |
665 | 665 | $pattern = '/src/i'; |
666 | 666 | $result = $this->_Parser->parse( |
@@ -672,8 +672,8 @@ discard block |
||
672 | 672 | |
673 | 673 | public function testIframeAllDomainsAllowed() |
674 | 674 | { |
675 | - $input = '[iframe height=349 width=560 ' . |
|
676 | - 'src=http://www.youtubescam.com/embed/HdoW3t_WorU ' . |
|
675 | + $input = '[iframe height=349 width=560 '. |
|
676 | + 'src=http://www.youtubescam.com/embed/HdoW3t_WorU '. |
|
677 | 677 | '][/iframe]'; |
678 | 678 | $expected = 'src="http://www.youtubescam.com/embed/HdoW3t_WorU'; |
679 | 679 | $this->MarkupSettings->setSingle('video_domains_allowed', '*'); |
@@ -683,8 +683,8 @@ discard block |
||
683 | 683 | |
684 | 684 | public function testIframeNoDomainAllowed() |
685 | 685 | { |
686 | - $input = '[iframe height=349 width=560 ' . |
|
687 | - 'src=http://www.youtubescam.com/embed/HdoW3t_WorU ' . |
|
686 | + $input = '[iframe height=349 width=560 '. |
|
687 | + 'src=http://www.youtubescam.com/embed/HdoW3t_WorU '. |
|
688 | 688 | '][/iframe]'; |
689 | 689 | $expected = '/src/i'; |
690 | 690 | $result = $this->_Parser->parse( |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | { |
935 | 935 | // [code]<citation mark>[/code] should not be cited |
936 | 936 | $input = h( |
937 | - "[code]\n" . $this->_Helper->getConfig('quote_symbol') . "\n[/code]" |
|
937 | + "[code]\n".$this->_Helper->getConfig('quote_symbol')."\n[/code]" |
|
938 | 938 | ); |
939 | 939 | $expected = '`span class=.*?richtext-citation`'; |
940 | 940 | $result = $this->_Parser->parse($input); |
@@ -951,11 +951,11 @@ discard block |
||
951 | 951 | public function testQuote() |
952 | 952 | { |
953 | 953 | $_qs = $this->MarkupSettings->get('quote_symbol'); |
954 | - $input = $_qs . ' fo [b]test[/b] ba'; |
|
954 | + $input = $_qs.' fo [b]test[/b] ba'; |
|
955 | 955 | $result = $this->_Parser->parse($input); |
956 | 956 | $expected = [ |
957 | 957 | 'span' => ['class' => 'richtext-citation'], |
958 | - $_qs . ' fo ', |
|
958 | + $_qs.' fo ', |
|
959 | 959 | 'strong' => [], |
960 | 960 | 'test', |
961 | 961 | '/strong', |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | //* test autoconversion for audio files |
988 | 988 | $html5AudioExtensions = ['m4a', 'ogg', 'mp3', 'wav', 'opus']; |
989 | 989 | foreach ($html5AudioExtensions as $extension) { |
990 | - $url = 'http://example.com/audio.' . $extension; |
|
990 | + $url = 'http://example.com/audio.'.$extension; |
|
991 | 991 | $input = "[video]{$url}[/video]"; |
992 | 992 | $result = $this->_Parser->parse($input); |
993 | 993 | $expected = [ |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $validator->add('url', ['url' => ['rule' => 'url']]); |
64 | 64 | $errors = $validator->errors(['url' => $url]); |
65 | 65 | if (empty($errors)) { |
66 | - $url = 'http://' . $url; |
|
66 | + $url = 'http://'.$url; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if (!empty($url) && preg_match('/\<img\s*?src=/', $text) !== 1) { |
80 | 80 | $host = DomainParser::domainAndTld($url); |
81 | 81 | if ($host !== false && $host !== env('SERVER_NAME')) { |
82 | - $out .= ' <span class=\'richtext-linkInfo\'>[' . $host . ']</span>'; |
|
82 | + $out .= ' <span class=\'richtext-linkInfo\'>['.$host.']</span>'; |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $_placeholder = ' … '; |
115 | - $leftMargin = (int)floor($_textWordMaxLength / 2); |
|
116 | - $rightMargin = (int)(-1 * ($_textWordMaxLength - $leftMargin - mb_strlen($_placeholder))); |
|
115 | + $leftMargin = (int) floor($_textWordMaxLength / 2); |
|
116 | + $rightMargin = (int) (-1 * ($_textWordMaxLength - $leftMargin - mb_strlen($_placeholder))); |
|
117 | 117 | |
118 | - $string = mb_substr($string, 0, $leftMargin) . $_placeholder . |
|
118 | + $string = mb_substr($string, 0, $leftMargin).$_placeholder. |
|
119 | 119 | mb_substr($string, $rightMargin); |
120 | 120 | |
121 | 121 | return $string; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function _decorateTarget($string) |
132 | 132 | { |
133 | - $decorator = function ($matches) { |
|
133 | + $decorator = function($matches) { |
|
134 | 134 | $out = ''; |
135 | 135 | $url = $matches[1]; |
136 | 136 | |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | $parsedUrl = parse_url($url); |
142 | 142 | |
143 | 143 | if (isset($parsedUrl['host'])) { |
144 | - if ($parsedUrl['host'] !== env('SERVER_NAME') && $parsedUrl['host'] !== "www." . env('SERVER_NAME')) { |
|
144 | + if ($parsedUrl['host'] !== env('SERVER_NAME') && $parsedUrl['host'] !== "www.".env('SERVER_NAME')) { |
|
145 | 145 | $out = " rel='external' target='_blank'"; |
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - return $matches[0] . $out; |
|
149 | + return $matches[0].$out; |
|
150 | 150 | }; |
151 | 151 | |
152 | 152 | return preg_replace_callback( |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | // add newline to wrapped lines |
123 | 123 | if (mb_strlen($line) > 60) { |
124 | - $out .= $line . "\n"; |
|
124 | + $out .= $line."\n"; |
|
125 | 125 | $line = ''; |
126 | 126 | } |
127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | $out = preg_replace( |
131 | 131 | "/^/m", |
132 | - $quoteSymbol . " ", |
|
132 | + $quoteSymbol." ", |
|
133 | 133 | $out |
134 | 134 | ); |
135 | 135 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | // serializing complex objects kills PHP |
282 | 282 | $serializable = array_filter( |
283 | 283 | $options, |
284 | - function ($value) { |
|
284 | + function($value) { |
|
285 | 285 | return !is_object($value); |
286 | 286 | } |
287 | 287 | ); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $this->_Parser->addCodeDefinition($builder->build()); |
336 | 336 | break; |
337 | 337 | case 'class': |
338 | - $class = '\Plugin\BbcodeParser\src\Lib\jBBCode\Definitions\\' . ucfirst($title); |
|
338 | + $class = '\Plugin\BbcodeParser\src\Lib\jBBCode\Definitions\\'.ucfirst($title); |
|
339 | 339 | $this->_Parser->addCodeDefinition(new $class($this->_Helper, $options)); |
340 | 340 | break; |
341 | 341 | default: |
@@ -355,10 +355,10 @@ discard block |
||
355 | 355 | return; |
356 | 356 | } |
357 | 357 | |
358 | - $folder = __DIR__ . '/jBBCode/Definitions/'; |
|
359 | - require_once $folder . 'JbbCodeDefinitions.php'; |
|
360 | - require_once $folder . 'JbbHtml5MediaCodeDefinition.php'; |
|
361 | - require_once $folder . 'JbbCodeCodeDefinition.php'; |
|
358 | + $folder = __DIR__.'/jBBCode/Definitions/'; |
|
359 | + require_once $folder.'JbbCodeDefinitions.php'; |
|
360 | + require_once $folder.'JbbHtml5MediaCodeDefinition.php'; |
|
361 | + require_once $folder.'JbbCodeCodeDefinition.php'; |
|
362 | 362 | |
363 | 363 | $this->areCombinedClassFilesLoaded = true; |
364 | 364 | } |
@@ -13,10 +13,10 @@ |
||
13 | 13 | $quoteSymbolSanitized = h($this->_sOptions->get('quote_symbol')); |
14 | 14 | $string = preg_replace( |
15 | 15 | // Begin of the text or a new line in the text, maybe one space afterwards |
16 | - '/(^|\n\r\s?)' . |
|
17 | - $quoteSymbolSanitized . |
|
16 | + '/(^|\n\r\s?)'. |
|
17 | + $quoteSymbolSanitized. |
|
18 | 18 | '\s(.*)(?!\<br)/m', |
19 | - "\\1<span class=\"richtext-citation\">" . $quoteSymbolSanitized . " \\2</span>", |
|
19 | + "\\1<span class=\"richtext-citation\">".$quoteSymbolSanitized." \\2</span>", |
|
20 | 20 | $string |
21 | 21 | ); |
22 | 22 |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | krsort($names); |
72 | - $baseUrl = $this->_sOptions->get('webroot') . $this->_sOptions->get('atBaseUrl'); |
|
72 | + $baseUrl = $this->_sOptions->get('webroot').$this->_sOptions->get('atBaseUrl'); |
|
73 | 73 | foreach ($names as $name => $v) { |
74 | 74 | $title = urlencode($name); |
75 | 75 | $link = $this->_url( |
76 | - $baseUrl . $title, |
|
76 | + $baseUrl.$title, |
|
77 | 77 | "@$name", |
78 | 78 | false |
79 | 79 | ); |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function _autolink($string) |
94 | 94 | { |
95 | - $replace = function ($matches) { |
|
95 | + $replace = function($matches) { |
|
96 | 96 | // exclude punctuation at end of sentence from URLs |
97 | 97 | $ignoredEndChars = implode('|', [',', '\?', ',', '\.', '\)', '!']); |
98 | 98 | preg_match( |
99 | - '/(?P<element>.*?)(?P<suffix>' . $ignoredEndChars . ')?$/', |
|
99 | + '/(?P<element>.*?)(?P<suffix>'.$ignoredEndChars.')?$/', |
|
100 | 100 | $matches['element'], |
101 | 101 | $m |
102 | 102 | ); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $matches = $m + $matches; |
105 | 105 | |
106 | 106 | if (strpos($matches['element'], '://') === false) { |
107 | - $matches['element'] = 'http://' . $matches['element']; |
|
107 | + $matches['element'] = 'http://'.$matches['element']; |
|
108 | 108 | } |
109 | 109 | $matches += [ |
110 | 110 | 'prefix' => '', |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | true |
119 | 119 | ); |
120 | 120 | |
121 | - return $matches['prefix'] . $url . $matches['suffix']; |
|
121 | + return $matches['prefix'].$url.$matches['suffix']; |
|
122 | 122 | }; |
123 | 123 | |
124 | 124 | //# autolink http://urls |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | //# autolink email |
139 | 139 | $string = preg_replace_callback( |
140 | 140 | "#(?<=^|[\n ])(?P<content>([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+))#i", |
141 | - function ($matches) { |
|
141 | + function($matches) { |
|
142 | 142 | return $this->_email($matches['content']); |
143 | 143 | }, |
144 | 144 | $string |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function _hashLink($string) |
158 | 158 | { |
159 | - $baseUrl = $this->_sOptions->get('webroot') . $this->_sOptions->get('hashBaseUrl'); |
|
159 | + $baseUrl = $this->_sOptions->get('webroot').$this->_sOptions->get('hashBaseUrl'); |
|
160 | 160 | $string = preg_replace_callback( |
161 | 161 | '/(?<=\s|^|])(?<tag>#)(?<element>\d+)(?!\w)/', |
162 | - function ($m) use ($baseUrl) { |
|
162 | + function($m) use ($baseUrl) { |
|
163 | 163 | $hash = $m['element']; |
164 | 164 | |
165 | - return $this->_url($baseUrl . $hash, '#' . $hash); |
|
165 | + return $this->_url($baseUrl.$hash, '#'.$hash); |
|
166 | 166 | }, |
167 | 167 | $string |
168 | 168 | ); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | // load config from app/Config/geshi.php |
25 | 25 | $this->Geshi->features = false; |
26 | 26 | |
27 | - $string = '<div class="geshi-wrapper"><pre lang="' . $type . '">' . $content . '</pre></div>'; |
|
27 | + $string = '<div class="geshi-wrapper"><pre lang="'.$type.'">'.$content.'</pre></div>'; |
|
28 | 28 | |
29 | 29 | $string = $this->Geshi->highlight($string); |
30 | 30 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | return $this->Html->link($url, $url, ['target' => '_blank']); |
72 | 72 | } |
73 | 73 | |
74 | - $loader = function () use ($url) { |
|
74 | + $loader = function() use ($url) { |
|
75 | 75 | $embed = ['url' => $url]; |
76 | 76 | |
77 | 77 | try { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | $callable = \Closure::fromCallable($loader); |
109 | 109 | |
110 | - $uid = 'embed-' . md5($url); |
|
110 | + $uid = 'embed-'.md5($url); |
|
111 | 111 | $info = Cache::remember($uid, $callable, 'bbcodeParserEmbed'); |
112 | 112 | |
113 | 113 | return $this->_sHelper->Html->div('js-embed', '', ['id' => $uid, 'data-embed' => json_encode($info)]); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | $ad = explode('|', $this->_sOptions->get('video_domains_allowed')); |
189 | - $trim = function ($v) { |
|
189 | + $trim = function($v) { |
|
190 | 190 | return trim($v); |
191 | 191 | }; |
192 | 192 | $this->_allowedVideoDomains = array_fill_keys(array_map($trim, $ad), 1); |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
274 | - $out = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="' . $width . '" height="' . $height . '"> |
|
275 | - <param name="movie" value="' . $url . '"></param> |
|
276 | - <embed src="' . $url . '" width="' . $width . '" height="' . $height . '" type="application/x-shockwave-flash" wmode="opaque" style="width:' . $width . 'px; height:' . $height . 'px;" id="VideoPlayback" flashvars=""> </embed> </object>'; |
|
274 | + $out = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'.$width.'" height="'.$height.'"> |
|
275 | + <param name="movie" value="' . $url.'"></param> |
|
276 | + <embed src="' . $url.'" width="'.$width.'" height="'.$height.'" type="application/x-shockwave-flash" wmode="opaque" style="width:'.$width.'px; height:'.$height.'px;" id="VideoPlayback" flashvars=""> </embed> </object>'; |
|
277 | 277 | |
278 | 278 | return $out; |
279 | 279 | } |
@@ -359,12 +359,12 @@ discard block |
||
359 | 359 | { |
360 | 360 | $listPieces = explode('[*]', $content); |
361 | 361 | unset($listPieces[0]); |
362 | - $listPieceProcessor = function ($li) { |
|
363 | - return '<li>' . $li . '</li>' . "\n"; |
|
362 | + $listPieceProcessor = function($li) { |
|
363 | + return '<li>'.$li.'</li>'."\n"; |
|
364 | 364 | }; |
365 | 365 | $listPieces = array_map($listPieceProcessor, $listPieces); |
366 | 366 | |
367 | - return '<ul>' . implode('', $listPieces) . '</ul>'; |
|
367 | + return '<ul>'.implode('', $listPieces).'</ul>'; |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | } |
387 | 387 | |
388 | 388 | $title = $this->_mbStrpad( |
389 | - ' ' . __('Spoiler') . ' ', |
|
389 | + ' '.__('Spoiler').' ', |
|
390 | 390 | $length, |
391 | 391 | '▇', |
392 | 392 | STR_PAD_BOTH |
393 | 393 | ); |
394 | 394 | |
395 | 395 | $json = json_encode(['string' => $content]); |
396 | - $id = 'spoiler_' . rand(0, 9999999999999); |
|
396 | + $id = 'spoiler_'.rand(0, 9999999999999); |
|
397 | 397 | |
398 | 398 | $out = <<<EOF |
399 | 399 | <div class="richtext-spoiler" style="display: inline;"> |
@@ -441,18 +441,18 @@ discard block |
||
441 | 441 | $result = null; |
442 | 442 | $repeat = ceil($strLen - $padStrLen + $padLen); |
443 | 443 | if ($dir == STR_PAD_RIGHT) { |
444 | - $result = $str . str_repeat($padStr, $repeat); |
|
444 | + $result = $str.str_repeat($padStr, $repeat); |
|
445 | 445 | $result = mb_substr($result, 0, $padLen); |
446 | 446 | } else { |
447 | 447 | if ($dir == STR_PAD_LEFT) { |
448 | - $result = str_repeat($padStr, $repeat) . $str; |
|
448 | + $result = str_repeat($padStr, $repeat).$str; |
|
449 | 449 | $result = mb_substr($result, -$padLen); |
450 | 450 | } else { |
451 | 451 | if ($dir == STR_PAD_BOTH) { |
452 | 452 | $length = ($padLen - $strLen) / 2; |
453 | 453 | $repeat = ceil($length / $padStrLen); |
454 | - $result = mb_substr(str_repeat($padStr, $repeat), 0, floor($length)) . |
|
455 | - $str . |
|
454 | + $result = mb_substr(str_repeat($padStr, $repeat), 0, floor($length)). |
|
455 | + $str. |
|
456 | 456 | mb_substr(str_repeat($padStr, $repeat), 0, ceil($length)); |
457 | 457 | } |
458 | 458 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | 'fullBase' => true, |
488 | 488 | ]; |
489 | 489 | |
490 | - $url = '/useruploads/' . $content; |
|
490 | + $url = '/useruploads/'.$content; |
|
491 | 491 | $image = $this->_sHelper->Html->image($url, $params); |
492 | 492 | |
493 | 493 | if ($node->getParent()->getTagName() === 'Document') { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $out = "<audio src='$content' controls='controls'>"; |
29 | 29 | $out .= Message::format( |
30 | 30 | __( |
31 | - 'Your browser does not support HTML5 audio. Please updgrade to a modern ' . |
|
31 | + 'Your browser does not support HTML5 audio. Please updgrade to a modern '. |
|
32 | 32 | 'browser. In order to watch this stream you need an HTML5 capable browser.', |
33 | 33 | true |
34 | 34 | ) |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | protected function _video($content) |
49 | 49 | { |
50 | 50 | // fix audio files mistakenly wrapped into an [video] tag |
51 | - if (preg_match('/(' . implode('|', self::$_html5AudioExtensions) . ')$/i', $content) === 1) { |
|
51 | + if (preg_match('/('.implode('|', self::$_html5AudioExtensions).')$/i', $content) === 1) { |
|
52 | 52 | return $this->_audio($content); |
53 | 53 | } |
54 | 54 | |
55 | 55 | $out = "<video src='$content' controls='controls' x-webkit-airplay='allow'>"; |
56 | 56 | $out .= Message::format( |
57 | 57 | __( |
58 | - 'Your browser does not support HTML5 video. Please updgrade to a modern ' . |
|
58 | + 'Your browser does not support HTML5 video. Please updgrade to a modern '. |
|
59 | 59 | 'browser. In order to watch this stream you need an HTML5 capable browser.', |
60 | 60 | true |
61 | 61 | ) |