@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | //$xoops->cache()->delete($key); |
76 | 76 | $decorated = $xoops->cache()->cacheRead( |
77 | 77 | $key, |
78 | - function ($url) { |
|
78 | + function($url) { |
|
79 | 79 | $return = null; |
80 | 80 | try { |
81 | 81 | $info = \Embed\Embed::create($url); |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $height = $info->getHeight(); |
91 | 91 | $width = $info->getWidth(); |
92 | 92 | if ($this->enableResponsive($return) && !empty($height) && !empty($width)) { |
93 | - $ratio = (1.5 > ($width/$height)) ? '4by3' : '16by9'; |
|
94 | - $return = '<div class="embed-responsive embed-responsive-' . $ratio . '">' . $return . '</div>'; |
|
93 | + $ratio = (1.5 > ($width / $height)) ? '4by3' : '16by9'; |
|
94 | + $return = '<div class="embed-responsive embed-responsive-'.$ratio.'">'.$return.'</div>'; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | if (empty($return)) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | </div> |
120 | 120 | EOT; |
121 | 121 | |
122 | - if(empty($imageSrc)) { |
|
122 | + if (empty($imageSrc)) { |
|
123 | 123 | $imageSrc = \Xoops::getInstance()->url('media/xoops/images/icons/link-ext.svg'); |
124 | 124 | } |
125 | 125 | $box = sprintf($htmlTemplate, $link, $imageSrc, $title, $description); |
@@ -43,9 +43,9 @@ |
||
43 | 43 | { |
44 | 44 | $this->shortcodes->addShortcode( |
45 | 45 | 'iframe', |
46 | - function ($attributes, $content, $tagName) { |
|
47 | - $height = (int) ltrim($attributes[0], '='); |
|
48 | - $height = $height <10 ? 200 : $height; |
|
46 | + function($attributes, $content, $tagName) { |
|
47 | + $height = (int)ltrim($attributes[0], '='); |
|
48 | + $height = $height < 10 ? 200 : $height; |
|
49 | 49 | $url = trim($content); |
50 | 50 | $template = $this->config['template']; |
51 | 51 | $newContent = sprintf($template, $url, $height); |
@@ -93,7 +93,7 @@ |
||
93 | 93 | $shortcodes = $this->shortcodes; |
94 | 94 | $shortcodes->addShortcode( |
95 | 95 | 'soundcloud', |
96 | - function ($attributes, $content, $tagName) use ($shortcodes) { |
|
96 | + function($attributes, $content, $tagName) use ($shortcodes) { |
|
97 | 97 | $defaults = [ |
98 | 98 | 'url' => trim($content), |
99 | 99 | 'params' => $this->config['params'], |
@@ -82,7 +82,7 @@ |
||
82 | 82 | { |
83 | 83 | $this->shortcodes->addShortcode( |
84 | 84 | 'mp3', |
85 | - function ($attributes, $content, $tagName) { |
|
85 | + function($attributes, $content, $tagName) { |
|
86 | 86 | $defaults = [ |
87 | 87 | 'url' => trim($content), |
88 | 88 | ]; |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | public function buildDefaultConfiguration() |
58 | 58 | { |
59 | 59 | $this->registerComponent(\Xoops\Core\Text\Sanitizer::getDefaultConfig()); |
60 | - $extensions = File::getList(__DIR__ . '/Extensions'); |
|
60 | + $extensions = File::getList(__DIR__.'/Extensions'); |
|
61 | 61 | foreach ($extensions as $extensionFile) { |
62 | 62 | if (substr($extensionFile, -4) === '.php') { |
63 | - $class = __NAMESPACE__ . '\Extensions\\' . substr($extensionFile, 0, -4); |
|
63 | + $class = __NAMESPACE__.'\Extensions\\'.substr($extensionFile, 0, -4); |
|
64 | 64 | if (is_a($class, 'Xoops\Core\Text\Sanitizer\SanitizerConfigurable', true)) { |
65 | 65 | $this->registerComponent($class::getDefaultConfig()); |
66 | 66 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | \Xoops::getInstance()->events()->triggerEvent('core.sanitizer.configuration.defaults', $this); |
84 | 84 | |
85 | - return (array) $this; |
|
85 | + return (array)$this; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function getNames() |
45 | 45 | { |
46 | - return array_keys((array) $this); |
|
46 | + return array_keys((array)$this); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | |
120 | 120 | $likeSet = array(); |
121 | 121 | foreach ($this as $k => $v) { |
122 | - if (mb_substr($k, 0, mb_strlen($nameLike))==$nameLike) { |
|
123 | - $likeSet[$k]=$v; |
|
122 | + if (mb_substr($k, 0, mb_strlen($nameLike)) == $nameLike) { |
|
123 | + $likeSet[$k] = $v; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | return $likeSet; |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | { |
274 | 274 | $config = $this->getConfig(); |
275 | 275 | |
276 | - foreach ((array) $config['prefilters'] as $filter) { |
|
276 | + foreach ((array)$config['prefilters'] as $filter) { |
|
277 | 277 | $text = $this->executeFilter($filter, $text); |
278 | 278 | } |
279 | 279 | |
280 | - if (!(bool) $html) { |
|
280 | + if (!(bool)$html) { |
|
281 | 281 | // html not allowed, so escape any special chars |
282 | 282 | // don't mess with quotes or shortcodes will fail |
283 | 283 | $text = htmlspecialchars($text, ENT_NOQUOTES | ENT_SUBSTITUTE, 'UTF-8', false); |
@@ -285,20 +285,20 @@ discard block |
||
285 | 285 | |
286 | 286 | if ($xcode) { |
287 | 287 | $text = $this->prefilterCodeBlocks($text); |
288 | - $text = $this->xoopsCodeDecode($text, (bool) $image); |
|
288 | + $text = $this->xoopsCodeDecode($text, (bool)$image); |
|
289 | 289 | } |
290 | - if ((bool) $smiley) { |
|
290 | + if ((bool)$smiley) { |
|
291 | 291 | // process smiley |
292 | 292 | $text = $this->smiley($text); |
293 | 293 | } |
294 | - if ((bool) $br) { |
|
294 | + if ((bool)$br) { |
|
295 | 295 | $text = $this->nl2Br($text); |
296 | 296 | } |
297 | 297 | if ($xcode) { |
298 | 298 | $text = $this->postfilterCodeBlocks($text); |
299 | 299 | } |
300 | 300 | |
301 | - foreach ((array) $config['postfilters'] as $filter) { |
|
301 | + foreach ((array)$config['postfilters'] as $filter) { |
|
302 | 302 | $text = $this->executeFilter($filter, $text); |
303 | 303 | } |
304 | 304 | |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | $patterns = "/\[code([^\]]*?)\](.*)\[\/code\]/sU"; |
368 | 368 | $text = preg_replace_callback( |
369 | 369 | $patterns, |
370 | - function ($matches) { |
|
371 | - return '[code' . $matches[1] . ']' . base64_encode($matches[2]). '[/code]'; |
|
370 | + function($matches) { |
|
371 | + return '[code'.$matches[1].']'.base64_encode($matches[2]).'[/code]'; |
|
372 | 372 | }, |
373 | 373 | $text |
374 | 374 | ); |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | $patterns = "/\[code([^\]]*?)\](.*)\[\/code\]/sU"; |
389 | 389 | $text = preg_replace_callback( |
390 | 390 | $patterns, |
391 | - function ($matches) { |
|
392 | - return '<div class=\"xoopsCode\">' . |
|
391 | + function($matches) { |
|
392 | + return '<div class=\"xoopsCode\">'. |
|
393 | 393 | $this->executeFilter( |
394 | 394 | 'syntaxhighlight', |
395 | 395 | str_replace('\\\"', '\"', base64_decode($matches[2])), |
396 | 396 | $matches[1] |
397 | - ) . '</div>'; |
|
397 | + ).'</div>'; |
|
398 | 398 | }, |
399 | 399 | $text |
400 | 400 | ); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | { |
412 | 412 | $list = []; |
413 | 413 | foreach ($this->config as $name => $configs) { |
414 | - if (((bool) $configs['enabled']) && $configs['type'] === 'extension') { |
|
414 | + if (((bool)$configs['enabled']) && $configs['type'] === 'extension') { |
|
415 | 415 | $list[] = $name; |
416 | 416 | } |
417 | 417 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | { |
625 | 625 | if ($this->config->has($name)) { |
626 | 626 | $this->config[$name]['enabled'] = true; |
627 | - if($this->extensionsLoaded) { |
|
627 | + if ($this->extensionsLoaded) { |
|
628 | 628 | $this->extensionsLoaded = false; |
629 | 629 | } |
630 | 630 | $this->registerExtensions(); |
@@ -69,7 +69,7 @@ |
||
69 | 69 | || empty($this->handler->field_link) |
70 | 70 | ) { |
71 | 71 | trigger_error( |
72 | - "The link information is not set for '" . get_class($this->handler) . "' yet.", |
|
72 | + "The link information is not set for '".get_class($this->handler)."' yet.", |
|
73 | 73 | E_USER_WARNING |
74 | 74 | ); |
75 | 75 | return false; |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | { |
67 | 67 | if (!(class_exists($this->handler->className) && $object instanceof $this->handler->className)) { |
68 | 68 | trigger_error( |
69 | - "Object '" . get_class($object) . "' is not an instance of '" . $this->handler->className . "'", |
|
69 | + "Object '".get_class($object)."' is not an instance of '".$this->handler->className."'", |
|
70 | 70 | E_USER_NOTICE |
71 | 71 | ); |
72 | 72 | return false; |
73 | 73 | } |
74 | 74 | if (!$object->isDirty()) { |
75 | 75 | trigger_error( |
76 | - "Data entry is not inserted - the object '" . get_class($object) . "' is not dirty", |
|
76 | + "Data entry is not inserted - the object '".get_class($object)."' is not dirty", |
|
77 | 77 | E_USER_NOTICE |
78 | 78 | ); |
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | if (!$this->cleanVars($object)) { |
82 | 82 | trigger_error( |
83 | - "Insert failed in method 'cleanVars' of object '" . get_class($object) . "'" . $object->getHtmlErrors(), |
|
83 | + "Insert failed in method 'cleanVars' of object '".get_class($object)."'".$object->getHtmlErrors(), |
|
84 | 84 | E_USER_WARNING |
85 | 85 | ); |
86 | 86 | return false; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if ($object->isNew()) { |
90 | 90 | if (empty($object->cleanVars)) { |
91 | 91 | trigger_error( |
92 | - "Data entry is not inserted - no variable is changed in object of '" . get_class($object) . "'", |
|
92 | + "Data entry is not inserted - no variable is changed in object of '".get_class($object)."'", |
|
93 | 93 | E_USER_NOTICE |
94 | 94 | ); |
95 | 95 | return false; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | if (!(class_exists($this->handler->className) && $object instanceof $this->handler->className)) { |
133 | 133 | trigger_error( |
134 | - "Object '" . get_class($object) . "' is not an instance of '" . $this->handler->className . "'", |
|
134 | + "Object '".get_class($object)."' is not an instance of '".$this->handler->className."'", |
|
135 | 135 | E_USER_NOTICE |
136 | 136 | ); |
137 | 137 | return false; |