@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Transforms link tags into Markdown |
19 | 19 | */ |
20 | -class Links extends MarkdownBaseModule implements ModuleInterface{ |
|
20 | +class Links extends MarkdownBaseModule implements ModuleInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * An array of tags the module is able to process |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform() |
35 | 35 | * @internal |
36 | 36 | */ |
37 | - public function __transform(){ |
|
37 | + public function __transform() { |
|
38 | 38 | $url = $this->bbtag(); |
39 | 39 | |
40 | - if(!empty($this->content)){ |
|
40 | + if (!empty($this->content)) { |
|
41 | 41 | return $url && $this->checkUrl($url) |
42 | 42 | ? '['.$this->content.']('.$url.')' |
43 | - : $this->checkUrl($this->content) ? : $this->content; |
|
43 | + : $this->checkUrl($this->content) ?: $this->content; |
|
44 | 44 | } |
45 | 45 | |
46 | - return $this->checkUrl($url) ? : ''; |
|
46 | + return $this->checkUrl($url) ?: ''; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @link https://help.github.com/articles/writing-on-github/ |
24 | 24 | * @link https://guides.github.com/features/mastering-markdown/ |
25 | 25 | */ |
26 | -class MarkdownBaseModule extends BaseModule implements BaseModuleInterface{ |
|
26 | +class MarkdownBaseModule extends BaseModule implements BaseModuleInterface { |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Holds an array of FQN strings to the current base module's children |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return string |
50 | 50 | */ |
51 | - public function sanitize($content){ |
|
51 | + public function sanitize($content) { |
|
52 | 52 | return $content; |
53 | 53 | } |
54 | 54 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Transforms noparse tags into Markdown |
20 | 20 | */ |
21 | -class Noparse extends MarkdownBaseModule implements ModuleInterface{ |
|
21 | +class Noparse extends MarkdownBaseModule implements ModuleInterface { |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * An array of tags the module is able to process |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param \chillerlan\bbcode\BBTemp $bbtemp |
37 | 37 | */ |
38 | - public function __construct(BBTemp $bbtemp = null){ |
|
38 | + public function __construct(BBTemp $bbtemp = null) { |
|
39 | 39 | parent::__construct($bbtemp); |
40 | 40 | |
41 | 41 | // set self::$noparse_tags to self::$tags because none of these should be parsed |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform() |
50 | 50 | * @internal |
51 | 51 | */ |
52 | - public function __transform(){ |
|
52 | + public function __transform() { |
|
53 | 53 | |
54 | - if(empty($this->content)){ |
|
54 | + if (empty($this->content)) { |
|
55 | 55 | return ''; |
56 | 56 | } |
57 | 57 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Transforms several single tags into Markdown |
19 | 19 | */ |
20 | -class Singletags extends MarkdownBaseModule implements ModuleInterface{ |
|
20 | +class Singletags extends MarkdownBaseModule implements ModuleInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * An array of tags the module is able to process |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform() |
43 | 43 | * @internal |
44 | 44 | */ |
45 | - public function __transform(){ |
|
45 | + public function __transform() { |
|
46 | 46 | |
47 | - switch($this->tag){ |
|
47 | + switch ($this->tag) { |
|
48 | 48 | case 'br': |
49 | 49 | return $this->eol_token; |
50 | 50 | case 'hr': |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Transforms several styled text tags into Markdown |
19 | 19 | */ |
20 | -class StyledText extends MarkdownBaseModule implements ModuleInterface{ |
|
20 | +class StyledText extends MarkdownBaseModule implements ModuleInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * An array of tags the module is able to process |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform() |
35 | 35 | * @internal |
36 | 36 | */ |
37 | - public function __transform(){ |
|
38 | - if(empty($this->content)){ |
|
37 | + public function __transform() { |
|
38 | + if (empty($this->content)) { |
|
39 | 39 | return ''; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $str = [ |
43 | 43 | 'b' => '**', // bold |
44 | - 'c' => '`', // inline code |
|
44 | + 'c' => '`', // inline code |
|
45 | 45 | 'del' => '~~', // strikethrough |
46 | - 'i' => '_', // italic |
|
46 | + 'i' => '_', // italic |
|
47 | 47 | 's' => '~~', // strikethrough |
48 | 48 | 'strong' => '**', // bold |
49 | 49 | ][$this->tag]; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * The base module implements the basic functionality for each module (Markup: (X)HTML, XML, etc.) |
20 | 20 | */ |
21 | -class MarkupBaseModule extends BaseModule implements BaseModuleInterface{ |
|
21 | +class MarkupBaseModule extends BaseModule implements BaseModuleInterface { |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Allowed text-align modes |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return string |
104 | 104 | */ |
105 | - public function sanitize($content){ |
|
105 | + public function sanitize($content) { |
|
106 | 106 | return htmlspecialchars($content, ENT_NOQUOTES, 'UTF-8', false); |
107 | 107 | } |
108 | 108 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @see https://xkcd.com/221/ |
115 | 115 | */ |
116 | - protected function randomID(){ |
|
116 | + protected function randomID() { |
|
117 | 117 | return hash('crc32b', mt_rand().microtime(true)); |
118 | 118 | } |
119 | 119 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return string usable as (X)HTML/XML class attribute |
127 | 127 | */ |
128 | - protected function getCssClass(array $additional_classes = []){ |
|
128 | + protected function getCssClass(array $additional_classes = []) { |
|
129 | 129 | $classes = $this->getAttribute('class', '').' '.implode(' ', $additional_classes); |
130 | - $classes =preg_replace('/[^a-z\d\- ]/i', '', $classes); |
|
130 | + $classes = preg_replace('/[^a-z\d\- ]/i', '', $classes); |
|
131 | 131 | $classes = trim($classes); |
132 | 132 | |
133 | 133 | return !empty($classes) ? ' class="'.$classes.'"' : ''; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return string usable as (X)HTML/XML title attribute |
143 | 143 | */ |
144 | - protected function getTitle($title = ''){ |
|
144 | + protected function getTitle($title = '') { |
|
145 | 145 | $title = $this->getAttribute('title', $title); |
146 | 146 | |
147 | 147 | // @todo: filter |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @return string usable as (X)HTML/XML style attribute |
158 | 158 | */ |
159 | - protected function getStyle(array $style = []){ |
|
159 | + protected function getStyle(array $style = []) { |
|
160 | 160 | $out = []; |
161 | 161 | |
162 | - foreach($style as $property => $value){ |
|
162 | + foreach ($style as $property => $value) { |
|
163 | 163 | // @todo: if(in_array($property, $allowed))? |
164 | 164 | // handle exclusions of common user definable properties |
165 | - switch(true){ |
|
165 | + switch (true) { |
|
166 | 166 | // color |
167 | 167 | case in_array($property, ['background-color', 'color']) |
168 | 168 | && !preg_match('/^#([a-f\d]{3}){1,2}$/i', $value): |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | break; |
175 | 175 | } |
176 | 176 | |
177 | - if($value){ |
|
177 | + if ($value) { |
|
178 | 178 | $out[] = $property.':'.$value; |
179 | 179 | } |
180 | 180 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * The base module implements the basic functionality for each module (Mediawiki) |
20 | 20 | */ |
21 | -class MediawikiBaseModule extends BaseModule implements BaseModuleInterface{ |
|
21 | +class MediawikiBaseModule extends BaseModule implements BaseModuleInterface { |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Holds an array of FQN strings to the current base module's children |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return string |
39 | 39 | */ |
40 | - public function sanitize($content){ |
|
40 | + public function sanitize($content) { |
|
41 | 41 | // TODO: Implement sanitize() method. |
42 | 42 | return $content; |
43 | 43 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * Implements the module specific functionality |
19 | 19 | */ |
20 | -interface ModuleInterface{ |
|
20 | +interface ModuleInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Transforms the bbcode, called from BaseModuleInterface |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * |
18 | 18 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::getTags() |
19 | 19 | */ |
20 | -class Tagmap{ |
|
20 | +class Tagmap { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * An array of tags a module is able to process |