@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function setUp() |
62 | 62 | { |
63 | - if (!$this->config->has('purifier')) { |
|
63 | + if ( ! $this->config->has('purifier')) { |
|
64 | 64 | throw new Exception('Configuration parameters not loaded!'); |
65 | 65 | } |
66 | 66 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $config = HTMLPurifier_Config::createDefault(); |
71 | 71 | |
72 | 72 | // Allow configuration to be modified |
73 | - if (!$this->config->get('purifier.finalize')) { |
|
73 | + if ( ! $this->config->get('purifier.finalize')) { |
|
74 | 74 | $config->autoFinalize = false; |
75 | 75 | } |
76 | 76 | |
@@ -110,30 +110,30 @@ discard block |
||
110 | 110 | */ |
111 | 111 | private function addCustomDefinition(array $definitionConfig, $configObject = null) |
112 | 112 | { |
113 | - if (!$configObject) { |
|
113 | + if ( ! $configObject) { |
|
114 | 114 | $configObject = HTMLPurifier_Config::createDefault(); |
115 | 115 | $configObject->loadArray($this->getConfig()); |
116 | 116 | } |
117 | 117 | |
118 | 118 | // Setup the custom definition |
119 | - $configObject->set('HTML.DefinitionID', $definitionConfig['id']); |
|
120 | - $configObject->set('HTML.DefinitionRev', $definitionConfig['rev']); |
|
119 | + $configObject->set('HTML.DefinitionID', $definitionConfig[ 'id' ]); |
|
120 | + $configObject->set('HTML.DefinitionRev', $definitionConfig[ 'rev' ]); |
|
121 | 121 | |
122 | 122 | // Enable debug mode |
123 | - if (!isset($definitionConfig['debug']) || $definitionConfig['debug']) { |
|
123 | + if ( ! isset($definitionConfig[ 'debug' ]) || $definitionConfig[ 'debug' ]) { |
|
124 | 124 | $configObject->set('Cache.DefinitionImpl', null); |
125 | 125 | } |
126 | 126 | |
127 | 127 | // Start configuring the definition |
128 | 128 | if ($def = $configObject->maybeGetRawHTMLDefinition()) { |
129 | 129 | // Create the definition attributes |
130 | - if (!empty($definitionConfig['attributes'])) { |
|
131 | - $this->addCustomAttributes($definitionConfig['attributes'], $def); |
|
130 | + if ( ! empty($definitionConfig[ 'attributes' ])) { |
|
131 | + $this->addCustomAttributes($definitionConfig[ 'attributes' ], $def); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // Create the definition elements |
135 | - if (!empty($definitionConfig['elements'])) { |
|
136 | - $this->addCustomElements($definitionConfig['elements'], $def); |
|
135 | + if ( ! empty($definitionConfig[ 'elements' ])) { |
|
136 | + $this->addCustomElements($definitionConfig[ 'elements' ], $def); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | { |
153 | 153 | foreach ($attributes as $attribute) { |
154 | 154 | // Get configuration of attribute |
155 | - $required = !empty($attribute[3]) ? true : false; |
|
156 | - $onElement = $attribute[0]; |
|
157 | - $attrName = $required ? $attribute[1] . '*' : $attribute[1]; |
|
158 | - $validValues = $attribute[2]; |
|
155 | + $required = ! empty($attribute[ 3 ]) ? true : false; |
|
156 | + $onElement = $attribute[ 0 ]; |
|
157 | + $attrName = $required ? $attribute[ 1 ].'*' : $attribute[ 1 ]; |
|
158 | + $validValues = $attribute[ 2 ]; |
|
159 | 159 | |
160 | 160 | $definition->addAttribute($onElement, $attrName, $validValues); |
161 | 161 | } |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | { |
176 | 176 | foreach ($elements as $element) { |
177 | 177 | // Get configuration of element |
178 | - $name = $element[0]; |
|
179 | - $contentSet = $element[1]; |
|
180 | - $allowedChildren = $element[2]; |
|
181 | - $attributeCollection = $element[3]; |
|
182 | - $attributes = isset($element[4]) ? $element[4] : null; |
|
178 | + $name = $element[ 0 ]; |
|
179 | + $contentSet = $element[ 1 ]; |
|
180 | + $allowedChildren = $element[ 2 ]; |
|
181 | + $attributeCollection = $element[ 3 ]; |
|
182 | + $attributes = isset($element[ 4 ]) ? $element[ 4 ] : null; |
|
183 | 183 | |
184 | - if (!empty($attributes)) { |
|
184 | + if ( ! empty($attributes)) { |
|
185 | 185 | $definition->addElement($name, $contentSet, $allowedChildren, $attributeCollection, $attributes); |
186 | 186 | } else { |
187 | 187 | $definition->addElement($name, $contentSet, $allowedChildren, $attributeCollection); |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | $cachePath = $this->config->get('purifier.cachePath'); |
198 | 198 | |
199 | 199 | if ($cachePath) { |
200 | - if (!$this->files->isDirectory($cachePath)) { |
|
201 | - $this->files->makeDirectory($cachePath, $this->config->get('purifier.cacheFileMode', 0755),true); |
|
200 | + if ( ! $this->files->isDirectory($cachePath)) { |
|
201 | + $this->files->makeDirectory($cachePath, $this->config->get('purifier.cacheFileMode', 0755), true); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -220,19 +220,19 @@ discard block |
||
220 | 220 | */ |
221 | 221 | protected function getConfig($config = null) |
222 | 222 | { |
223 | - $default_config = []; |
|
224 | - $default_config['Core.Encoding'] = $this->config->get('purifier.encoding'); |
|
225 | - $default_config['Cache.SerializerPath'] = $this->config->get('purifier.cachePath'); |
|
226 | - $default_config['Cache.SerializerPermissions'] = $this->config->get('purifier.cacheFileMode', 0755); |
|
223 | + $default_config = [ ]; |
|
224 | + $default_config[ 'Core.Encoding' ] = $this->config->get('purifier.encoding'); |
|
225 | + $default_config[ 'Cache.SerializerPath' ] = $this->config->get('purifier.cachePath'); |
|
226 | + $default_config[ 'Cache.SerializerPermissions' ] = $this->config->get('purifier.cacheFileMode', 0755); |
|
227 | 227 | |
228 | - if (!$config) { |
|
228 | + if ( ! $config) { |
|
229 | 229 | $config = $this->config->get('purifier.settings.default'); |
230 | 230 | } elseif (is_string($config)) { |
231 | 231 | $config = $this->config->get('purifier.settings.'.$config); |
232 | 232 | } |
233 | 233 | |
234 | - if (!is_array($config)) { |
|
235 | - $config = []; |
|
234 | + if ( ! is_array($config)) { |
|
235 | + $config = [ ]; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | $config = $default_config + $config; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | public function clean($dirty, $config = null) |
250 | 250 | { |
251 | 251 | if (is_array($dirty)) { |
252 | - return array_map(function ($item) use ($config) { |
|
252 | + return array_map(function($item) use ($config) { |
|
253 | 253 | return $this->clean($item, $config); |
254 | 254 | }, $dirty); |
255 | 255 | } |