@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * @param string $name the desired attributes name |
| 224 | 224 | * @param mixed $default [optional] a default value in case the attribute isn't set, defaults to false |
| 225 | 225 | * |
| 226 | - * @return mixed the attribute's value in case it exists, otherwise $default |
|
| 226 | + * @return string the attribute's value in case it exists, otherwise $default |
|
| 227 | 227 | */ |
| 228 | 228 | public function getAttribute($name, $default = false){ |
| 229 | 229 | return isset($this->attributes[$name]) && !empty($this->attributes[$name]) ? $this->attributes[$name] : $default; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | * @param string $name the desired attributes name |
| 251 | 251 | * @param array $whitelist an array with whitelisted key -> value pairs |
| 252 | - * @param mixed $default [optional] a default value in case the attribute isn't set, defaults to false |
|
| 252 | + * @param string $default [optional] a default value in case the attribute isn't set, defaults to false |
|
| 253 | 253 | * |
| 254 | 254 | * @return mixed boolean if no $default is set, otherwise the whitelist value to the given key in case it exists or $default |
| 255 | 255 | */ |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * Checks if the current tag is whitelisted |
| 264 | 264 | * |
| 265 | 265 | * @param array $whitelist an array with whitelisted tag names |
| 266 | - * @param mixed $default [optional] a default value in case the tag isn't whitelisted |
|
| 266 | + * @param string $default [optional] a default value in case the tag isn't whitelisted |
|
| 267 | 267 | * |
| 268 | 268 | * @return mixed boolean if no $default is set, otherwise the whitelisted tag or $default |
| 269 | 269 | */ |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * shorthand for self::attributeIn('__BBTAG__', $array) |
| 315 | 315 | * |
| 316 | 316 | * @param array $array |
| 317 | - * @param mixed $default |
|
| 317 | + * @param string $default |
|
| 318 | 318 | * |
| 319 | 319 | * @return mixed |
| 320 | 320 | */ |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * |
| 328 | 328 | * @param string $url the URL to check |
| 329 | 329 | * |
| 330 | - * @return bool|string the url if valid, otherwise false |
|
| 330 | + * @return false|string the url if valid, otherwise false |
|
| 331 | 331 | */ |
| 332 | 332 | public function checkUrl($url){ |
| 333 | 333 | if(filter_var($url, FILTER_VALIDATE_URL) === false){ |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * The base module implements the basic functionality for each module |
| 20 | 20 | */ |
| 21 | -class BaseModule implements BaseModuleInterface{ |
|
| 21 | +class BaseModule implements BaseModuleInterface { |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * The current bbcode tag |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @param \chillerlan\bbcode\BBTemp $bbtemp |
| 116 | 116 | */ |
| 117 | - public function __construct(BBTemp $bbtemp = null){ |
|
| 118 | - if($bbtemp instanceof BBTemp){ |
|
| 117 | + public function __construct(BBTemp $bbtemp = null) { |
|
| 118 | + if ($bbtemp instanceof BBTemp) { |
|
| 119 | 119 | $this->setBBTemp($bbtemp); |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @return $this |
| 129 | 129 | */ |
| 130 | - public function setBBTemp(BBTemp $bbtemp){ |
|
| 131 | - foreach(['tag', 'attributes', 'content', 'parserOptions', 'languageInterface', 'depth'] as $var){ |
|
| 130 | + public function setBBTemp(BBTemp $bbtemp) { |
|
| 131 | + foreach (['tag', 'attributes', 'content', 'parserOptions', 'languageInterface', 'depth'] as $var) { |
|
| 132 | 132 | $this->{$var} = $bbtemp->{$var}; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return \chillerlan\bbcode\Modules\BaseModuleInfo |
| 142 | 142 | */ |
| 143 | - public function getInfo(){ |
|
| 143 | + public function getInfo() { |
|
| 144 | 144 | $info = new BaseModuleInfo; |
| 145 | 145 | |
| 146 | - foreach(['modules', 'eol_token'] as $option){ |
|
| 146 | + foreach (['modules', 'eol_token'] as $option) { |
|
| 147 | 147 | $info->{$option} = $this->{$option}; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @return \chillerlan\bbcode\Modules\Tagmap |
| 157 | 157 | * @see \chillerlan\bbcode\Modules\ModuleInterface |
| 158 | 158 | */ |
| 159 | - public function getTags(){ |
|
| 159 | + public function getTags() { |
|
| 160 | 160 | $tags = new Tagmap; |
| 161 | 161 | $tags->tags = $this->tags; |
| 162 | 162 | $tags->noparse_tags = $this->noparse_tags; |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | * @return $this |
| 172 | 172 | * @throws \chillerlan\bbcode\BBCodeException |
| 173 | 173 | */ |
| 174 | - public function checkTag(){ |
|
| 175 | - if(!$this->tag || !in_array($this->tag, $this->tags)){ |
|
| 174 | + public function checkTag() { |
|
| 175 | + if (!$this->tag || !in_array($this->tag, $this->tags)) { |
|
| 176 | 176 | throw new BBCodeException('tag ['.$this->tag.'] not supported.'); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @return string |
| 190 | 190 | */ |
| 191 | - public function eol($str, $eol = '', $count = null){ |
|
| 191 | + public function eol($str, $eol = '', $count = null) { |
|
| 192 | 192 | return str_replace($this->parserOptions->eol_placeholder, $eol, $str, $count); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @return $this |
| 201 | 201 | */ |
| 202 | - public function clearEOL($eol = null){ |
|
| 202 | + public function clearEOL($eol = null) { |
|
| 203 | 203 | $eol = $eol ?: $this->eol_token; |
| 204 | 204 | $this->content = str_replace($this->parserOptions->eol_placeholder, $eol, $this->content); |
| 205 | 205 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * |
| 212 | 212 | * @return $this |
| 213 | 213 | */ |
| 214 | - public function clearPseudoClosingTags(){ |
|
| 214 | + public function clearPseudoClosingTags() { |
|
| 215 | 215 | $this->content = preg_replace('#\[/('.$this->parserOptions->singletags.')]#is', '', $this->content); |
| 216 | 216 | |
| 217 | 217 | return $this; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * |
| 226 | 226 | * @return mixed the attribute's value in case it exists, otherwise $default |
| 227 | 227 | */ |
| 228 | - public function getAttribute($name, $default = false){ |
|
| 228 | + public function getAttribute($name, $default = false) { |
|
| 229 | 229 | return isset($this->attributes[$name]) && !empty($this->attributes[$name]) ? $this->attributes[$name] : $default; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * |
| 239 | 239 | * @return mixed boolean if no $default is set, otherwise the attribute's value in case it exists and is whitelisted or $default |
| 240 | 240 | */ |
| 241 | - public function attributeIn($name, array $whitelist, $default = false){ |
|
| 241 | + public function attributeIn($name, array $whitelist, $default = false) { |
|
| 242 | 242 | return isset($this->attributes[$name]) && in_array($this->attributes[$name], $whitelist) |
| 243 | 243 | ? $default !== false ? $this->attributes[$name] : true |
| 244 | 244 | : $default; |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @return mixed boolean if no $default is set, otherwise the whitelist value to the given key in case it exists or $default |
| 255 | 255 | */ |
| 256 | - public function attributeKeyIn($name, array $whitelist, $default = false){ |
|
| 256 | + public function attributeKeyIn($name, array $whitelist, $default = false) { |
|
| 257 | 257 | return isset($this->attributes[$name]) && array_key_exists($this->attributes[$name], $whitelist) |
| 258 | 258 | ? $default !== false ? $whitelist[$this->attributes[$name]] : true |
| 259 | 259 | : $default; |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * |
| 268 | 268 | * @return mixed boolean if no $default is set, otherwise the whitelisted tag or $default |
| 269 | 269 | */ |
| 270 | - public function tagIn(array $whitelist, $default = false){ |
|
| 270 | + public function tagIn(array $whitelist, $default = false) { |
|
| 271 | 271 | return in_array($this->tag, $whitelist) |
| 272 | 272 | ? $default !== false ? $this->tag : true |
| 273 | 273 | : $default; |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * @return string |
| 282 | 282 | * @codeCoverageIgnore |
| 283 | 283 | */ |
| 284 | - public function sanitize($content){ |
|
| 284 | + public function sanitize($content) { |
|
| 285 | 285 | return 'Implement sanitize() method!'; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * |
| 293 | 293 | * @see \chillerlan\bbcode\Modules\ModuleInterface::transform() |
| 294 | 294 | */ |
| 295 | - public function transform(){ |
|
| 295 | + public function transform() { |
|
| 296 | 296 | $this->checkTag(); |
| 297 | 297 | |
| 298 | 298 | /** @var $this \chillerlan\bbcode\Modules\ModuleInterface */ |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * |
| 307 | 307 | * @return mixed $this->attributes['__BBTAG__'] |
| 308 | 308 | */ |
| 309 | - protected function bbtag($default = false){ |
|
| 309 | + protected function bbtag($default = false) { |
|
| 310 | 310 | return $this->getAttribute($this->parserOptions->bbtag_placeholder, $default); |
| 311 | 311 | } |
| 312 | 312 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * |
| 319 | 319 | * @return mixed |
| 320 | 320 | */ |
| 321 | - protected function bbtagIn(array $array, $default = false){ |
|
| 321 | + protected function bbtagIn(array $array, $default = false) { |
|
| 322 | 322 | return $this->attributeIn($this->parserOptions->bbtag_placeholder, $array, $default); |
| 323 | 323 | } |
| 324 | 324 | |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | * |
| 330 | 330 | * @return bool|string the url if valid, otherwise false |
| 331 | 331 | */ |
| 332 | - public function checkUrl($url){ |
|
| 333 | - if(filter_var($url, FILTER_VALIDATE_URL) === false){ |
|
| 332 | + public function checkUrl($url) { |
|
| 333 | + if (filter_var($url, FILTER_VALIDATE_URL) === false) { |
|
| 334 | 334 | return false; |
| 335 | 335 | } |
| 336 | 336 | // todo: check against whitelist? |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | * |
| 347 | 347 | * @return string |
| 348 | 348 | */ |
| 349 | - public function wrap($content, $wrapper){ |
|
| 349 | + public function wrap($content, $wrapper) { |
|
| 350 | 350 | return $wrapper.$content.$wrapper; |
| 351 | 351 | } |
| 352 | 352 | |
@@ -101,7 +101,6 @@ |
||
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * Checks if an attribute exists and if it exists as key in a whitelist |
| 104 | - |
|
| 105 | 104 | * @param string $name the desired attributes name |
| 106 | 105 | * @param array $whitelist an array with whitelisted key -> value pairs |
| 107 | 106 | * @param mixed $default [optional] a default value in case the attribute isn't set, defaults to false |
@@ -259,7 +259,7 @@ |
||
| 259 | 259 | /** |
| 260 | 260 | * strng regexp bbcode killer |
| 261 | 261 | * |
| 262 | - * @param string|array $bbcode BBCode as string or matches as array - callback from preg_replace_callback() |
|
| 262 | + * @param string $bbcode BBCode as string or matches as array - callback from preg_replace_callback() |
|
| 263 | 263 | * |
| 264 | 264 | * @return string |
| 265 | 265 | * @throws \chillerlan\bbcode\BBCodeException |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @link http://www.developers-guide.net/c/152-bbcode-parser-mit-noparse-tag-selbst-gemacht.html |
| 29 | 29 | */ |
| 30 | -class Parser{ |
|
| 30 | +class Parser { |
|
| 31 | 31 | use ClassLoaderTrait; |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @param \chillerlan\bbcode\ParserOptions $options [optional] |
| 141 | 141 | */ |
| 142 | - public function __construct(ParserOptions $options = null){ |
|
| 142 | + public function __construct(ParserOptions $options = null) { |
|
| 143 | 143 | $this->setOptions(!$options ? new ParserOptions : $options); |
| 144 | 144 | $this->BBTemp = new BBTemp; |
| 145 | 145 | } |
@@ -151,22 +151,22 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @throws \chillerlan\bbcode\BBCodeException |
| 153 | 153 | */ |
| 154 | - public function setOptions(ParserOptions $options){ |
|
| 154 | + public function setOptions(ParserOptions $options) { |
|
| 155 | 155 | $this->parserOptions = $options; |
| 156 | 156 | $this->baseModuleInterface = $this->__loadClass($this->parserOptions->baseModuleInterface, BaseModuleInterface::class); |
| 157 | 157 | $this->languageInterface = $this->__loadClass($this->parserOptions->languageInterface, LanguageInterface::class); |
| 158 | 158 | |
| 159 | - if($this->parserOptions->parserExtensionInterface){ |
|
| 159 | + if ($this->parserOptions->parserExtensionInterface) { |
|
| 160 | 160 | $this->parserExtensionInterface = |
| 161 | 161 | $this->__loadClass($this->parserOptions->parserExtensionInterface, ParserExtensionInterface::class, $this->parserOptions); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $module_info = $this->baseModuleInterface->getInfo(); |
| 165 | - foreach($module_info->modules as $module){ |
|
| 165 | + foreach ($module_info->modules as $module) { |
|
| 166 | 166 | $this->moduleInterface = $this->__loadClass($module, ModuleInterface::class); |
| 167 | 167 | |
| 168 | 168 | $tagmap = $this->moduleInterface->getTags(); |
| 169 | - foreach($tagmap->tags as $tag){ |
|
| 169 | + foreach ($tagmap->tags as $tag) { |
|
| 170 | 170 | $this->tagmap[$tag] = $module; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | $this->parserOptions->eol_token = $module_info->eol_token; |
| 179 | 179 | $this->parserOptions->singletags = implode('|', $this->singletags); |
| 180 | 180 | |
| 181 | - if(is_array($this->parserOptions->allowed_tags) && !empty($this->parserOptions->allowed_tags)){ |
|
| 182 | - foreach($this->parserOptions->allowed_tags as $tag){ |
|
| 183 | - if(array_key_exists($tag, $this->tagmap)){ |
|
| 181 | + if (is_array($this->parserOptions->allowed_tags) && !empty($this->parserOptions->allowed_tags)) { |
|
| 182 | + foreach ($this->parserOptions->allowed_tags as $tag) { |
|
| 183 | + if (array_key_exists($tag, $this->tagmap)) { |
|
| 184 | 184 | $this->allowed_tags[] = $tag; |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | - else{ |
|
| 189 | - if($this->parserOptions->allow_all){ |
|
| 188 | + else { |
|
| 189 | + if ($this->parserOptions->allow_all) { |
|
| 190 | 190 | $this->allowed_tags = array_keys($this->tagmap); |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @return array |
| 199 | 199 | */ |
| 200 | - public function getTagmap(){ |
|
| 200 | + public function getTagmap() { |
|
| 201 | 201 | ksort($this->tagmap); |
| 202 | 202 | return $this->tagmap; |
| 203 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @return array |
| 209 | 209 | */ |
| 210 | - public function getAllowed(){ |
|
| 210 | + public function getAllowed() { |
|
| 211 | 211 | sort($this->allowed_tags); |
| 212 | 212 | return $this->allowed_tags; |
| 213 | 213 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @return array |
| 219 | 219 | */ |
| 220 | - public function getNoparse(){ |
|
| 220 | + public function getNoparse() { |
|
| 221 | 221 | sort($this->noparse_tags); |
| 222 | 222 | return $this->noparse_tags; |
| 223 | 223 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | * @return array |
| 229 | 229 | */ |
| 230 | - public function getSingle(){ |
|
| 230 | + public function getSingle() { |
|
| 231 | 231 | sort($this->singletags); |
| 232 | 232 | return $this->singletags; |
| 233 | 233 | } |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | * |
| 240 | 240 | * @return string |
| 241 | 241 | */ |
| 242 | - public function parse($bbcode){ |
|
| 243 | - if($this->parserOptions->sanitize){ |
|
| 242 | + public function parse($bbcode) { |
|
| 243 | + if ($this->parserOptions->sanitize) { |
|
| 244 | 244 | $bbcode = $this->baseModuleInterface->sanitize($bbcode); |
| 245 | 245 | } |
| 246 | 246 | |
@@ -264,12 +264,12 @@ discard block |
||
| 264 | 264 | * @return string |
| 265 | 265 | * @throws \chillerlan\bbcode\BBCodeException |
| 266 | 266 | */ |
| 267 | - protected function __parse($bbcode){ |
|
| 267 | + protected function __parse($bbcode) { |
|
| 268 | 268 | static $callback_count = 0; |
| 269 | 269 | $callback = false; |
| 270 | 270 | $preg_error = PREG_NO_ERROR; |
| 271 | 271 | |
| 272 | - if(is_array($bbcode) && isset($bbcode['tag'], $bbcode['attributes'], $bbcode['content'])){ |
|
| 272 | + if (is_array($bbcode) && isset($bbcode['tag'], $bbcode['attributes'], $bbcode['content'])) { |
|
| 273 | 273 | $tag = strtolower($bbcode['tag']); |
| 274 | 274 | $attributes = $this->getAttributes($bbcode['attributes']); |
| 275 | 275 | $content = $bbcode['content']; |
@@ -277,30 +277,30 @@ discard block |
||
| 277 | 277 | $callback = true; |
| 278 | 278 | $callback_count++; |
| 279 | 279 | } |
| 280 | - else if(is_string($bbcode) && !empty($bbcode)){ |
|
| 280 | + else if (is_string($bbcode) && !empty($bbcode)) { |
|
| 281 | 281 | $tag = null; |
| 282 | 282 | $attributes = []; |
| 283 | 283 | $content = $bbcode; |
| 284 | 284 | } |
| 285 | - else{ |
|
| 285 | + else { |
|
| 286 | 286 | return ''; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - if($callback_count < (int)$this->parserOptions->nesting_limit && !in_array($tag, $this->noparse_tags)){ |
|
| 289 | + if ($callback_count < (int)$this->parserOptions->nesting_limit && !in_array($tag, $this->noparse_tags)) { |
|
| 290 | 290 | $pattern = '#\[(?<tag>\w+)(?<attributes>(?:\s|=)[^]]*)?](?<content>(?:[^[]|\[(?!/?\1((?:\s|=)[^]]*)?])|(?R))*)\[/\1]#'; |
| 291 | 291 | $content = preg_replace_callback($pattern, __METHOD__, $content); |
| 292 | 292 | $preg_error = preg_last_error(); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | // still testing... |
| 296 | - if($preg_error !== PREG_NO_ERROR){ |
|
| 296 | + if ($preg_error !== PREG_NO_ERROR) { |
|
| 297 | 297 | // @codeCoverageIgnoreStart |
| 298 | 298 | $message = sprintf($this->languageInterface->parserExceptionCallback(), $tag, self::PREG_ERROR[$preg_error], $preg_error); |
| 299 | 299 | throw new BBCodeException($message); |
| 300 | 300 | // @codeCoverageIgnoreEnd |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - if($callback && isset($this->tagmap[$tag]) && in_array($tag, $this->allowed_tags)){ |
|
| 303 | + if ($callback && isset($this->tagmap[$tag]) && in_array($tag, $this->allowed_tags)) { |
|
| 304 | 304 | $this->BBTemp->tag = $tag; |
| 305 | 305 | $this->BBTemp->attributes = $attributes; |
| 306 | 306 | $this->BBTemp->content = $content; |
@@ -326,12 +326,12 @@ discard block |
||
| 326 | 326 | * @return array |
| 327 | 327 | * @throws \chillerlan\bbcode\BBCodeException |
| 328 | 328 | */ |
| 329 | - protected function getAttributes($attributes){ |
|
| 329 | + protected function getAttributes($attributes) { |
|
| 330 | 330 | $attr = []; |
| 331 | 331 | $pattern = '#(?<name>^|\w+)\=(\'?)(?<value>[^\']*?)\2(?: |$)#'; |
| 332 | 332 | |
| 333 | - if(preg_match_all($pattern, $attributes, $matches, PREG_SET_ORDER) > 0){ |
|
| 334 | - foreach($matches as $attribute){ |
|
| 333 | + if (preg_match_all($pattern, $attributes, $matches, PREG_SET_ORDER) > 0) { |
|
| 334 | + foreach ($matches as $attribute) { |
|
| 335 | 335 | $name = empty($attribute['name']) ? $this->parserOptions->bbtag_placeholder : strtolower(trim($attribute['name'])); |
| 336 | 336 | |
| 337 | 337 | $value = trim($attribute['value']); |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | $preg_error = preg_last_error(); |
| 345 | 345 | |
| 346 | - if($preg_error !== PREG_NO_ERROR){ |
|
| 346 | + if ($preg_error !== PREG_NO_ERROR) { |
|
| 347 | 347 | // @codeCoverageIgnoreStart |
| 348 | 348 | $message = sprintf($this->languageInterface->parserExceptionMatchall(), self::PREG_ERROR[$preg_error], $preg_error); |
| 349 | 349 | throw new BBCodeException($message); |
@@ -184,8 +184,7 @@ discard block |
||
| 184 | 184 | $this->allowed_tags[] = $tag; |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | - } |
|
| 188 | - else{ |
|
| 187 | + } else{ |
|
| 189 | 188 | if($this->parserOptions->allow_all){ |
| 190 | 189 | $this->allowed_tags = array_keys($this->tagmap); |
| 191 | 190 | } |
@@ -276,13 +275,11 @@ discard block |
||
| 276 | 275 | |
| 277 | 276 | $callback = true; |
| 278 | 277 | $callback_count++; |
| 279 | - } |
|
| 280 | - else if(is_string($bbcode) && !empty($bbcode)){ |
|
| 278 | + } else if(is_string($bbcode) && !empty($bbcode)){ |
|
| 281 | 279 | $tag = null; |
| 282 | 280 | $attributes = []; |
| 283 | 281 | $content = $bbcode; |
| 284 | - } |
|
| 285 | - else{ |
|
| 282 | + } else{ |
|
| 286 | 283 | return ''; |
| 287 | 284 | } |
| 288 | 285 | |
@@ -17,6 +17,6 @@ |
||
| 17 | 17 | /** |
| 18 | 18 | * Placeholder |
| 19 | 19 | */ |
| 20 | -class BBCodeException extends Exception{ |
|
| 20 | +class BBCodeException extends Exception { |
|
| 21 | 21 | |
| 22 | 22 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * @see \chillerlan\bbcode\Parser::__parse() |
| 21 | 21 | * @see \chillerlan\bbcode\Modules\BaseModule::setBBTemp() |
| 22 | 22 | */ |
| 23 | -class BBTemp{ |
|
| 23 | +class BBTemp { |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * The current bbcode tag |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * |
| 17 | 17 | */ |
| 18 | -class Chinese extends LanguageBase implements LanguageInterface{ |
|
| 18 | +class Chinese extends LanguageBase implements LanguageInterface { |
|
| 19 | 19 | |
| 20 | 20 | public $parserExceptionCallback = ''; |
| 21 | 21 | public $parserExceptionMatchall = ''; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * property -> LanguageInterface method name |
| 17 | 17 | */ |
| 18 | -class DefaultStrings extends LanguageBase implements LanguageInterface{ |
|
| 18 | +class DefaultStrings extends LanguageBase implements LanguageInterface { |
|
| 19 | 19 | |
| 20 | 20 | public $parserExceptionCallback = 'parserExceptionCallback'; |
| 21 | 21 | public $parserExceptionMatchall = 'parserExceptionMatchall'; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * |
| 17 | 17 | */ |
| 18 | -class English extends LanguageBase implements LanguageInterface{ |
|
| 18 | +class English extends LanguageBase implements LanguageInterface { |
|
| 19 | 19 | |
| 20 | 20 | public $parserExceptionCallback = 'preg_replace_callback() died on [%1$s] due to a %2$s (%3$s)'; |
| 21 | 21 | public $parserExceptionMatchall = 'preg_match_all() died due to a %1$s (%2$s)'; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * |
| 17 | 17 | */ |
| 18 | -class French extends LanguageBase implements LanguageInterface{ |
|
| 18 | +class French extends LanguageBase implements LanguageInterface { |
|
| 19 | 19 | |
| 20 | 20 | public $parserExceptionCallback = ''; |
| 21 | 21 | public $parserExceptionMatchall = ''; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * |
| 17 | 17 | */ |
| 18 | -class German extends LanguageBase implements LanguageInterface{ |
|
| 18 | +class German extends LanguageBase implements LanguageInterface { |
|
| 19 | 19 | |
| 20 | 20 | public $parserExceptionCallback = 'preg_replace_callback() verursachte einen %2$s (%3$s) am tag [%1$s]'; |
| 21 | 21 | public $parserExceptionMatchall = 'preg_match_all() verursachte einen %1$s (%2$s)'; |