Completed
Pull Request — master (#588)
by
unknown
14:32
created
xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/UnorderedList.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@
 block discarded – undo
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
         );
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/XoopsCode.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -42,112 +42,112 @@
 block discarded – undo
42 42
 
43 43
         $shortcodes->addShortcode(
44 44
             'siteurl',
45
-            function ($attributes, $content, $tagName) use ($shortcodes) {
45
+            function($attributes, $content, $tagName) use ($shortcodes) {
46 46
                 $url = ltrim($attributes[0], '=');
47 47
                 $url = \Xoops::getInstance()->url($url);
48
-                $newcontent = '<a href="' .$url. '">' . $shortcodes->process($content) . '</a>';
48
+                $newcontent = '<a href="'.$url.'">'.$shortcodes->process($content).'</a>';
49 49
                 return $newcontent;
50 50
             }
51 51
         );
52 52
 
53 53
         $shortcodes->addShortcode(
54 54
             'url',
55
-            function ($attributes, $content, $tagName) use ($shortcodes) {
55
+            function($attributes, $content, $tagName) use ($shortcodes) {
56 56
                 $url = ltrim($attributes[0], '=');
57 57
                 $url = \Xoops::getInstance()->url($url);
58
-                $newcontent = '<a href="' .$url. '">' . $shortcodes->process($content) . '</a>';
58
+                $newcontent = '<a href="'.$url.'">'.$shortcodes->process($content).'</a>';
59 59
                 return $newcontent;
60 60
             }
61 61
         );
62 62
 
63 63
         $shortcodes->addShortcode(
64 64
             'color',
65
-            function ($attributes, $content, $tagName) use ($shortcodes) {
65
+            function($attributes, $content, $tagName) use ($shortcodes) {
66 66
                 $color = ltrim($attributes[0], '=');
67
-                $color = preg_match('/^[a-f0-9]{3}$|^[a-f0-9]{6}$/i', $color) ? '#' . $color : $color;
68
-                $newcontent = '<span style="color: ' .$color. '">' . $shortcodes->process($content) . '</span>';
67
+                $color = preg_match('/^[a-f0-9]{3}$|^[a-f0-9]{6}$/i', $color) ? '#'.$color : $color;
68
+                $newcontent = '<span style="color: '.$color.'">'.$shortcodes->process($content).'</span>';
69 69
                 return $newcontent;
70 70
             }
71 71
         );
72 72
 
73 73
         $shortcodes->addShortcode(
74 74
             'size',
75
-            function ($attributes, $content, $tagName) use ($shortcodes) {
75
+            function($attributes, $content, $tagName) use ($shortcodes) {
76 76
                 $size = ltrim($attributes[0], '=');
77
-                $newcontent = '<span style="font-size: ' .$size. '">' . $shortcodes->process($content) . '</span>';
77
+                $newcontent = '<span style="font-size: '.$size.'">'.$shortcodes->process($content).'</span>';
78 78
                 return $newcontent;
79 79
             }
80 80
         );
81 81
 
82 82
         $shortcodes->addShortcode(
83 83
             'font',
84
-            function ($attributes, $content, $tagName) use ($shortcodes) {
84
+            function($attributes, $content, $tagName) use ($shortcodes) {
85 85
                 $font = ltrim($attributes[0], '=');
86
-                $newcontent = '<span style="font-family: ' .$font. '">' . $shortcodes->process($content) . '</span>';
86
+                $newcontent = '<span style="font-family: '.$font.'">'.$shortcodes->process($content).'</span>';
87 87
                 return $newcontent;
88 88
             }
89 89
         );
90 90
 
91 91
         $shortcodes->addShortcode(
92 92
             'email',
93
-            function ($attributes, $content, $tagName) {
94
-                $newcontent = '<a href="mailto:' . trim($content) . '</a>';
93
+            function($attributes, $content, $tagName) {
94
+                $newcontent = '<a href="mailto:'.trim($content).'</a>';
95 95
                 return $newcontent;
96 96
             }
97 97
         );
98 98
 
99 99
         $shortcodes->addShortcode(
100 100
             'b',
101
-            function ($attributes, $content, $tagName) use ($shortcodes) {
102
-                $newcontent = '<strong>' . $shortcodes->process($content) . '</strong>';
101
+            function($attributes, $content, $tagName) use ($shortcodes) {
102
+                $newcontent = '<strong>'.$shortcodes->process($content).'</strong>';
103 103
                 return $newcontent;
104 104
             }
105 105
         );
106 106
 
107 107
         $shortcodes->addShortcode(
108 108
             'i',
109
-            function ($attributes, $content, $tagName) use ($shortcodes) {
110
-                $newcontent = '<em>' . $shortcodes->process($content) . '</em>';
109
+            function($attributes, $content, $tagName) use ($shortcodes) {
110
+                $newcontent = '<em>'.$shortcodes->process($content).'</em>';
111 111
                 return $newcontent;
112 112
             }
113 113
         );
114 114
 
115 115
         $shortcodes->addShortcode(
116 116
             'u',
117
-            function ($attributes, $content, $tagName) use ($shortcodes) {
118
-                $newcontent = '<u>' . $shortcodes->process($content) . '</u>';
117
+            function($attributes, $content, $tagName) use ($shortcodes) {
118
+                $newcontent = '<u>'.$shortcodes->process($content).'</u>';
119 119
                 return $newcontent;
120 120
             }
121 121
         );
122 122
 
123 123
         $shortcodes->addShortcode(
124 124
             'd',
125
-            function ($attributes, $content, $tagName) use ($shortcodes) {
126
-                $newcontent = '<del>' . $shortcodes->process($content) . '</del>';
125
+            function($attributes, $content, $tagName) use ($shortcodes) {
126
+                $newcontent = '<del>'.$shortcodes->process($content).'</del>';
127 127
                 return $newcontent;
128 128
             }
129 129
         );
130 130
 
131 131
         $shortcodes->addShortcode(
132 132
             'center',
133
-            function ($attributes, $content, $tagName) use ($shortcodes) {
134
-                $newcontent = '<div style="text-align: center;">' . $shortcodes->process($content) . '</div>';
133
+            function($attributes, $content, $tagName) use ($shortcodes) {
134
+                $newcontent = '<div style="text-align: center;">'.$shortcodes->process($content).'</div>';
135 135
                 return $newcontent;
136 136
             }
137 137
         );
138 138
 
139 139
         $shortcodes->addShortcode(
140 140
             'left',
141
-            function ($attributes, $content, $tagName) use ($shortcodes) {
142
-                $newcontent = '<div style="text-align: left;">' . $shortcodes->process($content) . '</div>';
141
+            function($attributes, $content, $tagName) use ($shortcodes) {
142
+                $newcontent = '<div style="text-align: left;">'.$shortcodes->process($content).'</div>';
143 143
                 return $newcontent;
144 144
             }
145 145
         );
146 146
 
147 147
         $shortcodes->addShortcode(
148 148
             'right',
149
-            function ($attributes, $content, $tagName) use ($shortcodes) {
150
-                $newcontent = '<div style="text-align: right;">' . $shortcodes->process($content) . '</div>';
149
+            function($attributes, $content, $tagName) use ($shortcodes) {
150
+                $newcontent = '<div style="text-align: right;">'.$shortcodes->process($content).'</div>';
151 151
                 return $newcontent;
152 152
             }
153 153
         );
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/Clickable.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -53,41 +53,41 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/Embed.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/Iframe.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/SoundCloud.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
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'],
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/Rtsp.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 
85 85
         $this->shortcodes->addShortcode(
86 86
             'rtsp',
87
-            function ($attributes, $content, $tagName) {
87
+            function($attributes, $content, $tagName) {
88 88
                 $args = ltrim($attributes[0], '=');
89 89
                 list($width, $height) = explode(',', $args);
90 90
                 $url = $content;
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/Mp3.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
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
                 ];
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Text/Sanitizer/DefaultConfiguration.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.