@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Transforms list tags into HTML5 |
19 | 19 | */ |
20 | -class Lists extends Html5BaseModule implements ModuleInterface{ |
|
20 | +class Lists extends Html5BaseModule implements ModuleInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Map of attribute value -> css property |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform() |
66 | 66 | * @internal |
67 | 67 | */ |
68 | - public function __transform(){ |
|
68 | + public function __transform() { |
|
69 | 69 | |
70 | - if(empty($this->content)){ |
|
70 | + if (empty($this->content)) { |
|
71 | 71 | return ''; |
72 | 72 | } |
73 | 73 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Transforms noparse tags into HTML5 |
20 | 20 | */ |
21 | -class Noparse extends Html5BaseModule implements ModuleInterface{ |
|
21 | +class Noparse extends Html5BaseModule 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 |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform() |
51 | 51 | * @internal |
52 | 52 | */ |
53 | - public function __transform(){ |
|
53 | + public function __transform() { |
|
54 | 54 | |
55 | - if(empty($this->content)){ |
|
55 | + if (empty($this->content)) { |
|
56 | 56 | return ''; |
57 | 57 | } |
58 | 58 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Transforms several simple text tags into HTML5 |
19 | 19 | */ |
20 | -class Simpletext extends Html5BaseModule implements ModuleInterface{ |
|
20 | +class Simpletext extends Html5BaseModule implements ModuleInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * An array of tags the module is able to process |
@@ -34,9 +34,9 @@ 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 | |
39 | - if(empty($this->content)){ |
|
39 | + if (empty($this->content)) { |
|
40 | 40 | return ''; |
41 | 41 | } |
42 | 42 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Transforms several single tags into HTML5 |
19 | 19 | */ |
20 | -class Singletags extends Html5BaseModule implements ModuleInterface{ |
|
20 | +class Singletags extends Html5BaseModule 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 'clear': |
49 | 49 | return '<br'.$this->getCssClass(['bb-clear', $this->bbtagIn(['both', 'left', 'right'], 'both')]).' />'; |
50 | 50 | default: |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Transforms several styled text tags into HTML5 |
19 | 19 | */ |
20 | -class StyledText extends Html5BaseModule implements ModuleInterface{ |
|
20 | +class StyledText extends Html5BaseModule implements ModuleInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * CSS classes for each tag |
@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform() |
49 | 49 | * @internal |
50 | 50 | */ |
51 | - public function __transform(){ |
|
51 | + public function __transform() { |
|
52 | 52 | |
53 | - if(empty($this->content)){ |
|
53 | + if (empty($this->content)) { |
|
54 | 54 | return ''; |
55 | 55 | } |
56 | 56 | |
57 | 57 | $style = []; |
58 | 58 | |
59 | - if(in_array($this->tag, ['color', 'font', 'size'])){ |
|
59 | + if (in_array($this->tag, ['color', 'font', 'size'])) { |
|
60 | 60 | $bbtag = $this->bbtag(); |
61 | 61 | |
62 | 62 | $style = [ |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @link http://www.w3.org/TR/html5/tabular-data.html |
22 | 22 | */ |
23 | -class Tables extends Html5BaseModule implements ModuleInterface{ |
|
23 | +class Tables extends Html5BaseModule implements ModuleInterface { |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * An array of tags the module is able to process |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform() |
46 | 46 | * @internal |
47 | 47 | */ |
48 | - public function __transform(){ |
|
49 | - switch(true){ |
|
48 | + public function __transform() { |
|
49 | + switch (true) { |
|
50 | 50 | case $this->tagIn(['tr', 'thead', 'tbody', 'tfoot']): |
51 | 51 | return $this->rows(); |
52 | 52 | case $this->tagIn(['td', 'th']): |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - private function table(){ |
|
65 | - if(empty($this->content)){ |
|
64 | + private function table() { |
|
65 | + if (empty($this->content)) { |
|
66 | 66 | return ''; |
67 | 67 | } |
68 | 68 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - private function col(){ |
|
79 | + private function col() { |
|
80 | 80 | $span = $this->getAttribute('span'); |
81 | 81 | |
82 | 82 | return '<col'.($span ? ' span="'.intval($span).'"' : '').$this->getCssClass().' />'; |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return string |
89 | 89 | */ |
90 | - private function colgroup(){ |
|
91 | - if(empty($this->content)){ |
|
90 | + private function colgroup() { |
|
91 | + if (empty($this->content)) { |
|
92 | 92 | return ''; |
93 | 93 | } |
94 | 94 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return string |
104 | 104 | */ |
105 | - private function caption(){ |
|
106 | - if(empty($this->content)){ |
|
105 | + private function caption() { |
|
106 | + if (empty($this->content)) { |
|
107 | 107 | return ''; |
108 | 108 | } |
109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - private function rows(){ |
|
119 | - if(empty($this->content)){ |
|
118 | + private function rows() { |
|
119 | + if (empty($this->content)) { |
|
120 | 120 | return ''; |
121 | 121 | } |
122 | 122 | |
@@ -128,34 +128,34 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return string |
130 | 130 | */ |
131 | - private function cells(){ |
|
131 | + private function cells() { |
|
132 | 132 | $style = []; |
133 | 133 | $align = $this->getAttribute('align'); |
134 | - if($align && in_array($align, self::TEXT_ALIGN)){ |
|
134 | + if ($align && in_array($align, self::TEXT_ALIGN)) { |
|
135 | 135 | $style['text-align'] = $align; |
136 | 136 | } |
137 | 137 | |
138 | 138 | $valign = $this->getAttribute('valign'); |
139 | - if($valign && in_array($valign, ['baseline', 'bottom', 'middle', 'top'])){ |
|
139 | + if ($valign && in_array($valign, ['baseline', 'bottom', 'middle', 'top'])) { |
|
140 | 140 | $style['vertical-align'] = $valign; |
141 | 141 | } |
142 | 142 | |
143 | - if($width = $this->getAttribute('width')){ |
|
143 | + if ($width = $this->getAttribute('width')) { |
|
144 | 144 | $style['width'] = $width; |
145 | 145 | } |
146 | 146 | |
147 | - if($this->getAttribute('nowrap')){ |
|
147 | + if ($this->getAttribute('nowrap')) { |
|
148 | 148 | $style['white-space'] = 'nowrap'; |
149 | 149 | } |
150 | 150 | |
151 | 151 | $span = ''; |
152 | - foreach(['colspan', 'rowspan'] as $s){ |
|
152 | + foreach (['colspan', 'rowspan'] as $s) { |
|
153 | 153 | $_span = $this->getAttribute($s); |
154 | - $span .= $_span ? ' '.$s.'="'.intval($_span).'"' : ''; |
|
154 | + $span .= $_span ? ' '.$s.'="'.intval($_span).'"' : ''; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | $abbr = ''; |
158 | - if($this->tag === 'th'){ |
|
158 | + if ($this->tag === 'th') { |
|
159 | 159 | $_abbr = $this->getAttribute('abbr'); |
160 | 160 | $abbr = $_abbr ? ' abbr="'.$_abbr.'"' : ''; |
161 | 161 | } |
@@ -72,10 +72,10 @@ |
||
72 | 72 | |
73 | 73 | if($this->flash){ |
74 | 74 | $player = '<object type="application/x-shockwave-flash" data="'.$video_url.'">' |
75 | - .'<param name="allowfullscreen" value="true">' |
|
76 | - .'<param name="wmode" value="opaque" />' |
|
77 | - .'<param name="movie" value="'.$video_url.'" />' |
|
78 | - .'</object>'; |
|
75 | + .'<param name="allowfullscreen" value="true">' |
|
76 | + .'<param name="wmode" value="opaque" />' |
|
77 | + .'<param name="movie" value="'.$video_url.'" />' |
|
78 | + .'</object>'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return '<div'.$cssclass.'>'.$player.'</div>'; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @todo |
22 | 22 | */ |
23 | -class Video extends Html5BaseModule implements ModuleInterface{ |
|
23 | +class Video extends Html5BaseModule implements ModuleInterface { |
|
24 | 24 | use RequestTrait; |
25 | 25 | |
26 | 26 | /** |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform() |
46 | 46 | * @internal |
47 | 47 | */ |
48 | - public function __transform(){ |
|
48 | + public function __transform() { |
|
49 | 49 | $this->setRequestCA($this->parserOptions->ca_info); |
50 | 50 | |
51 | - if(empty($this->content)){ |
|
51 | + if (empty($this->content)) { |
|
52 | 52 | return ''; |
53 | 53 | } |
54 | 54 | |
@@ -56,21 +56,21 @@ discard block |
||
56 | 56 | $this->flash = $this->getAttribute('flash'); |
57 | 57 | $cssclass = ['bb-video']; |
58 | 58 | |
59 | - if($this->getAttribute('wide')){ |
|
59 | + if ($this->getAttribute('wide')) { |
|
60 | 60 | $cssclass[] = 'wide'; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $cssclass = $this->getCssClass($cssclass); |
64 | 64 | |
65 | - if($video_url === false){ |
|
65 | + if ($video_url === false) { |
|
66 | 66 | return '<video src="'.$this->content.'"'.$cssclass.' preload="auto" controls="true"></video>'; |
67 | 67 | } |
68 | - else{ |
|
68 | + else { |
|
69 | 69 | |
70 | - if(!empty($video_url)){ |
|
70 | + if (!empty($video_url)) { |
|
71 | 71 | $player = '<iframe src="'.$video_url.'" allowfullscreen></iframe>'; |
72 | 72 | |
73 | - if($this->flash){ |
|
73 | + if ($this->flash) { |
|
74 | 74 | $player = '<object type="application/x-shockwave-flash" data="'.$video_url.'">' |
75 | 75 | .'<param name="allowfullscreen" value="true">' |
76 | 76 | .'<param name="wmode" value="opaque" />' |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return string |
93 | 93 | */ |
94 | - protected function getVideoURL(){ |
|
94 | + protected function getVideoURL() { |
|
95 | 95 | $bbtag = $this->bbtag(); |
96 | 96 | $url = parse_url($this->content); |
97 | 97 | $host = isset($url['host']) ? str_replace('www.', '', $url['host']) : false; |
98 | 98 | |
99 | 99 | // Process Vimeo videos |
100 | - if($this->tag === 'vimeo' || $bbtag === 'vimeo' || $host === 'vimeo.com'){ |
|
100 | + if ($this->tag === 'vimeo' || $bbtag === 'vimeo' || $host === 'vimeo.com') { |
|
101 | 101 | |
102 | 102 | // since the video id is the only numeric part in a common vimeo share url, we can safely strip anything which is not number |
103 | 103 | $id = preg_replace('/[^\d]/', '', $this->content); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | // access token needed - no coverage |
109 | 109 | // @codeCoverageIgnoreStart |
110 | - if(isset($response->link)){ |
|
110 | + if (isset($response->link)) { |
|
111 | 111 | // @todo add fancyness |
112 | 112 | return $this->flash ? 'https://vimeo.com/moogaloop.swf?clip_id='.$id : 'https://player.vimeo.com/video/'.$id; |
113 | 113 | } |
@@ -117,21 +117,21 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | // Process YouTube videos |
120 | - else if($this->tag === 'youtube' || $bbtag === 'youtube' || in_array($host, ['youtube.com', 'youtu.be'])){ |
|
120 | + else if ($this->tag === 'youtube' || $bbtag === 'youtube' || in_array($host, ['youtube.com', 'youtu.be'])) { |
|
121 | 121 | |
122 | - if($host === 'youtube.com'){ |
|
122 | + if ($host === 'youtube.com') { |
|
123 | 123 | parse_str($url['query'], $q); |
124 | 124 | $id = $q['v']; |
125 | 125 | } |
126 | - else if($host === 'youtu.be'){ |
|
126 | + else if ($host === 'youtu.be') { |
|
127 | 127 | $e = explode('/', $url['path'], 2); |
128 | 128 | $id = isset($e[1]) ? $e[1] : false; |
129 | 129 | } |
130 | - else{ |
|
130 | + else { |
|
131 | 131 | $id = $this->content; |
132 | 132 | } |
133 | 133 | |
134 | - if($id){ |
|
134 | + if ($id) { |
|
135 | 135 | |
136 | 136 | // check video (and get data) |
137 | 137 | $params = [ |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | // api key needed - no coverage |
146 | 146 | // @codeCoverageIgnoreStart |
147 | - if(isset($response->items, $response->items[0]) && $response->items[0]->id === $id){ |
|
147 | + if (isset($response->items, $response->items[0]) && $response->items[0]->id === $id) { |
|
148 | 148 | // @todo support playlists |
149 | 149 | return 'https://www.youtube.com/'.($this->flash ? 'v/' : 'embed/').preg_replace('/[^a-z\d-_]/i', '', $id); |
150 | 150 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | // Process ModDB videos @todo indiedb |
158 | - else if($this->tag === 'moddb' || $bbtag === 'moddb' || $host === 'moddb.com'){ |
|
158 | + else if ($this->tag === 'moddb' || $bbtag === 'moddb' || $host === 'moddb.com') { |
|
159 | 159 | |
160 | 160 | $id = $host === 'moddb.com' && strpos('http://www.moddb.com/media/', $this->content) === 0 |
161 | 161 | ? $url['path'] |
@@ -165,15 +165,15 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | // Process Daily Motion videos |
168 | - else if($this->tag === 'dmotion' || $bbtag === 'dmotion' || in_array($host, ['dailymotion.com', 'dai.ly'])){ |
|
168 | + else if ($this->tag === 'dmotion' || $bbtag === 'dmotion' || in_array($host, ['dailymotion.com', 'dai.ly'])) { |
|
169 | 169 | |
170 | - if($host === 'dailymotion.com'){ |
|
170 | + if ($host === 'dailymotion.com') { |
|
171 | 171 | $id = explode('_', str_replace('/video/', '', $url['path']), 2)[0]; |
172 | 172 | } |
173 | - else if($host === 'dai.ly'){ |
|
173 | + else if ($host === 'dai.ly') { |
|
174 | 174 | $id = $url['path']; |
175 | 175 | } |
176 | - else{ |
|
176 | + else { |
|
177 | 177 | $id = $this->content; |
178 | 178 | } |
179 | 179 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | // Process HTML5 video |
184 | - else{ |
|
184 | + else { |
|
185 | 185 | // @todo check video... |
186 | 186 | return false; |
187 | 187 | } |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | if($video_url === false){ |
66 | 66 | return '<video src="'.$this->content.'"'.$cssclass.' preload="auto" controls="true"></video>'; |
67 | - } |
|
68 | - else{ |
|
67 | + } else{ |
|
69 | 68 | |
70 | 69 | if(!empty($video_url)){ |
71 | 70 | $player = '<iframe src="'.$video_url.'" allowfullscreen></iframe>'; |
@@ -122,12 +121,10 @@ discard block |
||
122 | 121 | if($host === 'youtube.com'){ |
123 | 122 | parse_str($url['query'], $q); |
124 | 123 | $id = $q['v']; |
125 | - } |
|
126 | - else if($host === 'youtu.be'){ |
|
124 | + } else if($host === 'youtu.be'){ |
|
127 | 125 | $e = explode('/', $url['path'], 2); |
128 | 126 | $id = isset($e[1]) ? $e[1] : false; |
129 | - } |
|
130 | - else{ |
|
127 | + } else{ |
|
131 | 128 | $id = $this->content; |
132 | 129 | } |
133 | 130 | |
@@ -169,11 +166,9 @@ discard block |
||
169 | 166 | |
170 | 167 | if($host === 'dailymotion.com'){ |
171 | 168 | $id = explode('_', str_replace('/video/', '', $url['path']), 2)[0]; |
172 | - } |
|
173 | - else if($host === 'dai.ly'){ |
|
169 | + } else if($host === 'dai.ly'){ |
|
174 | 170 | $id = $url['path']; |
175 | - } |
|
176 | - else{ |
|
171 | + } else{ |
|
177 | 172 | $id = $this->content; |
178 | 173 | } |
179 | 174 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Transforms several code tags into Markdown |
20 | 20 | */ |
21 | -class Code extends MarkdownBaseModule implements ModuleInterface{ |
|
21 | +class Code 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 simple text tags into Markdown |
19 | 19 | */ |
20 | -class Headers extends MarkdownBaseModule implements ModuleInterface{ |
|
20 | +class Headers extends MarkdownBaseModule implements ModuleInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * An array of tags the module is able to process |
@@ -34,9 +34,9 @@ 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 | |
39 | - if(empty($this->content)){ |
|
39 | + if (empty($this->content)) { |
|
40 | 40 | return ''; |
41 | 41 | } |
42 | 42 |