@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected static $defaultConfiguration = [ |
36 | 36 | 'enabled' => true, |
37 | - 'clickable' => true, // Click to open an image in a new window in full size |
|
38 | - 'resize' => true, // Resize the image down to max_width set below |
|
39 | - 'max_width' => 300, // Maximum width of an image displayed on page |
|
37 | + 'clickable' => true, // Click to open an image in a new window in full size |
|
38 | + 'resize' => true, // Resize the image down to max_width set below |
|
39 | + 'max_width' => 300, // Maximum width of an image displayed on page |
|
40 | 40 | 'allowimage' => true, // true to allow images, false to force links only |
41 | 41 | ]; |
42 | 42 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $this->shortcodes->addShortcode( |
53 | 53 | 'img', |
54 | - function ($attributes, $content, $tagName) use ($config) { |
|
54 | + function($attributes, $content, $tagName) use ($config) { |
|
55 | 55 | $xoops = \Xoops::getInstance(); |
56 | 56 | $defaults = [ |
57 | 57 | 'id' => 0, |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ]; |
62 | 62 | $cleanAttributes = $this->shortcodes->shortcodeAttributes($defaults, $attributes); |
63 | 63 | if (0 !== $cleanAttributes['id']) { |
64 | - $cleanAttributes['url'] = $xoops->url('/image.php?id=' . $cleanAttributes['id']); |
|
64 | + $cleanAttributes['url'] = $xoops->url('/image.php?id='.$cleanAttributes['id']); |
|
65 | 65 | } |
66 | 66 | $url = $cleanAttributes['url']; |
67 | 67 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | true |
73 | 73 | ); |
74 | 74 | $class = ''; |
75 | - if ($cleanAttributes['align']!= '') { |
|
76 | - $class = ' class="' . $cleanAttributes['align'] . '"'; |
|
75 | + if ($cleanAttributes['align'] != '') { |
|
76 | + $class = ' class="'.$cleanAttributes['align'].'"'; |
|
77 | 77 | } |
78 | 78 | $width = $cleanAttributes['width']; |
79 | 79 | if (preg_match('/[0-9]{1}$/', $width)) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | protected static $defaultConfiguration = [ |
34 | 34 | 'enabled' => true, |
35 | 35 | 'censor_terminate' => false, //set to true if you want to trigger an error page |
36 | - 'censor_admin' => true, //set to false if you don't want to censor admin entries |
|
36 | + 'censor_admin' => true, //set to false if you don't want to censor admin entries |
|
37 | 37 | 'censor_words' => ['shit', 'piss', 'fuck', 'cunt', 'cocksucker', 'motherfucker', 'tits'], |
38 | 38 | 'censor_replace' => '%#$@!', |
39 | 39 | ]; |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | { |
50 | 50 | $xoops = \Xoops::getInstance(); |
51 | 51 | |
52 | - $enabled = (bool) $xoops->getConfig('censor_enable'); |
|
52 | + $enabled = (bool)$xoops->getConfig('censor_enable'); |
|
53 | 53 | |
54 | - $censorWords = (array) $xoops->getConfig('censor_words'); |
|
54 | + $censorWords = (array)$xoops->getConfig('censor_words'); |
|
55 | 55 | $censorWords = empty($censorWords) ? $this->config['censor_words'] : $censorWords; |
56 | 56 | |
57 | 57 | $censorReplace = $xoops->getConfig('censor_replace'); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if (false === stripos($text, $bad)) { |
74 | 74 | continue; |
75 | 75 | } |
76 | - if ((bool) $this->config['censor_terminate']) { |
|
76 | + if ((bool)$this->config['censor_terminate']) { |
|
77 | 77 | trigger_error("Censor words found", E_USER_ERROR); |
78 | 78 | return ''; |
79 | 79 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $text = trim($text); |
76 | 76 | $addedOpenTag = false; |
77 | 77 | if (!strpos($text, "<?php") && (substr($text, 0, 5) !== "<?php")) { |
78 | - $text = "<?php " . $text; |
|
78 | + $text = "<?php ".$text; |
|
79 | 79 | $addedOpenTag = true; |
80 | 80 | } |
81 | 81 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $length_open = ($addedOpenTag) ? $pos_open + 14 : 0; |
102 | 102 | $str_internal = substr($buffer, $length_open); |
103 | 103 | |
104 | - $buffer = $str_open . $str_internal; |
|
104 | + $buffer = $str_open.$str_internal; |
|
105 | 105 | return $buffer; |
106 | 106 | } |
107 | 107 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | //look for both open and closing tags in the correct order |
53 | 53 | $pattern = "/\[quote](.*)\[\/quote\]/sU"; |
54 | - $replacement = \XoopsLocale::C_QUOTE . '<div class="xoopsQuote"><blockquote>\\1</blockquote></div>'; |
|
54 | + $replacement = \XoopsLocale::C_QUOTE.'<div class="xoopsQuote"><blockquote>\\1</blockquote></div>'; |
|
55 | 55 | |
56 | 56 | $text = preg_replace($pattern, $replacement, $text, -1, $count); |
57 | 57 | //no more matches, return now |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected static $defaultConfiguration = [ |
33 | 33 | 'enabled' => false, |
34 | - 'tags' => array(), // Tags to be filtered out |
|
35 | - 'patterns' => [ // patterns to be used for filtering |
|
34 | + 'tags' => array(), // Tags to be filtered out |
|
35 | + 'patterns' => [// patterns to be used for filtering |
|
36 | 36 | 'search' => '', |
37 | 37 | 'replace' => '', |
38 | 38 | ], |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $tags[] = "VBSCRIPT"; |
83 | 83 | $tags[] = "JAVASCRIPT"; |
84 | 84 | foreach ($tags as $tag) { |
85 | - $search[] = "/<" . $tag . "[^>]*?>.*?<\/" . $tag . ">/si"; |
|
86 | - $replace[] = " [!" . strtoupper($tag) . " FILTERED!] "; |
|
85 | + $search[] = "/<".$tag."[^>]*?>.*?<\/".$tag.">/si"; |
|
86 | + $replace[] = " [!".strtoupper($tag)." FILTERED!] "; |
|
87 | 87 | } |
88 | 88 | // Set meta refresh tag |
89 | 89 | $search[] = "/<META[^>\/]*HTTP-EQUIV=(['\"])?REFRESH(\\1)[^>\/]*?\/>/si"; |
@@ -42,16 +42,16 @@ |
||
42 | 42 | |
43 | 43 | $shortcodes->addShortcode( |
44 | 44 | 'ul', |
45 | - function ($attributes, $content, $tagName) use ($shortcodes) { |
|
46 | - $newcontent = '<ul>' . $shortcodes->process($content) . '</ul>'; |
|
45 | + function($attributes, $content, $tagName) use ($shortcodes) { |
|
46 | + $newcontent = '<ul>'.$shortcodes->process($content).'</ul>'; |
|
47 | 47 | return $newcontent; |
48 | 48 | } |
49 | 49 | ); |
50 | 50 | |
51 | 51 | $shortcodes->addShortcode( |
52 | 52 | 'li', |
53 | - function ($attributes, $content, $tagName) use ($shortcodes) { |
|
54 | - $newcontent = '<li>' . $shortcodes->process($content) . '</li>'; |
|
53 | + function($attributes, $content, $tagName) use ($shortcodes) { |
|
54 | + $newcontent = '<li>'.$shortcodes->process($content).'</li>'; |
|
55 | 55 | return $newcontent; |
56 | 56 | } |
57 | 57 | ); |
@@ -53,41 +53,41 @@ discard block |
||
53 | 53 | $pattern = "/(^|[^]_a-z0-9-=\"'\/])([a-z]+?):\/\/([{$valid_chars}]+[{$end_chars}])/i"; |
54 | 54 | $text = preg_replace_callback( |
55 | 55 | $pattern, |
56 | - function ($match) { |
|
57 | - return $match[1] . "<a href=\"$match[2]://$match[3]\" title=\"$match[2]://$match[3]\"" |
|
56 | + function($match) { |
|
57 | + return $match[1]."<a href=\"$match[2]://$match[3]\" title=\"$match[2]://$match[3]\"" |
|
58 | 58 | . "rel=\"external\">$match[2]://".$this->truncate($match[3]).'</a>'; |
59 | 59 | }, |
60 | 60 | $text |
61 | 61 | ); |
62 | 62 | |
63 | - $pattern = "/(^|[^]_a-z0-9-=\"'\/:\.])www\.((([a-zA-Z0-9\-]*\.){1,}){1}([a-zA-Z]{2,6}){1})((\/([a-zA-Z0-9\-\._\?\,\'\/\\+&%\$#\=~])*)*)/i"; |
|
63 | + $pattern = "/(^|[^]_a-z0-9-=\"'\/:\.])www\.((([a-zA-Z0-9\-]*\.){1,}){1}([a-zA-Z]{2,6}){1})((\/([a-zA-Z0-9\-\._\?\,\'\/\\+&%\$#\=~])*)*)/i"; |
|
64 | 64 | $text = preg_replace_callback( |
65 | 65 | $pattern, |
66 | - function ($match) { |
|
67 | - return $match[1] ."<a href=\"http://www.$match[2]$match[6]\" " |
|
68 | - . "title=\"www.$match[2]$match[6]\" rel=\"external\">" . |
|
69 | - $this->truncate('www.'.$match[2].$match[6]) .'</a>'; |
|
66 | + function($match) { |
|
67 | + return $match[1]."<a href=\"http://www.$match[2]$match[6]\" " |
|
68 | + . "title=\"www.$match[2]$match[6]\" rel=\"external\">". |
|
69 | + $this->truncate('www.'.$match[2].$match[6]).'</a>'; |
|
70 | 70 | }, |
71 | 71 | $text |
72 | 72 | ); |
73 | 73 | |
74 | - $pattern = "/(^|[^]_a-z0-9-=\"'\/])ftp\.([a-z0-9\-]+)\.([{$valid_chars}]+[{$end_chars}])/i"; |
|
74 | + $pattern = "/(^|[^]_a-z0-9-=\"'\/])ftp\.([a-z0-9\-]+)\.([{$valid_chars}]+[{$end_chars}])/i"; |
|
75 | 75 | $text = preg_replace_callback( |
76 | 76 | $pattern, |
77 | - function ($match) { |
|
77 | + function($match) { |
|
78 | 78 | return $match[1]."<a href=\"ftp://ftp.$match[2].$match[3]\" " |
79 | 79 | . "title=\"ftp.$match[2].$match[3]\" rel=\"external\">" |
80 | - . $this->truncate('ftp.'.$match[2].$match[3]) .'</a>'; |
|
80 | + . $this->truncate('ftp.'.$match[2].$match[3]).'</a>'; |
|
81 | 81 | }, |
82 | 82 | $text |
83 | 83 | ); |
84 | 84 | |
85 | - $pattern = "/(^|[^]_a-z0-9-=\"'\/:\.])([-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+)@((?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?)/i"; |
|
85 | + $pattern = "/(^|[^]_a-z0-9-=\"'\/:\.])([-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+)@((?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?)/i"; |
|
86 | 86 | $text = preg_replace_callback( |
87 | 87 | $pattern, |
88 | - function ($match) { |
|
89 | - return $match[1]. "<a href=\"mailto:$match[2]@$match[3]\" title=\"$match[2]@$match[3]\">" |
|
90 | - . $this->truncate($match[2] . "@" . $match[3]) . '</a>'; |
|
88 | + function($match) { |
|
89 | + return $match[1]."<a href=\"mailto:$match[2]@$match[3]\" title=\"$match[2]@$match[3]\">" |
|
90 | + . $this->truncate($match[2]."@".$match[3]).'</a>'; |
|
91 | 91 | }, |
92 | 92 | $text |
93 | 93 | ); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | $len = (((mb_strlen($text) - $config['truncate_length']) - 5) / 2); |
113 | 113 | if ($len < 5) { |
114 | - $ret = mb_substr($text, 0, $len) . ' ... ' . mb_substr($text, -$len); |
|
114 | + $ret = mb_substr($text, 0, $len).' ... '.mb_substr($text, -$len); |
|
115 | 115 | } else { |
116 | 116 | $ret = mb_substr($text, 0, $config['truncate_length']); |
117 | 117 | } |
@@ -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); |