@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | date_default_timezone_set('UTC'); |
4 | 4 | |
5 | -$autoload_path = __DIR__ . '/vendor/autoload.php'; |
|
5 | +$autoload_path = __DIR__.'/vendor/autoload.php'; |
|
6 | 6 | $autoload_available = include_once($autoload_path); |
7 | 7 | if (!$autoload_available) { |
8 | 8 | die("Couldn't include '$autoload_path'. Did you run `composer install`?"); |
@@ -187,7 +187,7 @@ |
||
187 | 187 | |
188 | 188 | $this->apiVersion = $version; |
189 | 189 | |
190 | - $parser_class_name = '\ElggPluginManifestParser' . str_replace('.', '', $this->apiVersion); |
|
190 | + $parser_class_name = '\ElggPluginManifestParser'.str_replace('.', '', $this->apiVersion); |
|
191 | 191 | |
192 | 192 | // @todo currently the autoloader freaks out if a class doesn't exist. |
193 | 193 | try { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $html = str_replace(["\r\n", "\r"], "\n", $html); |
85 | 85 | |
86 | 86 | // allows preserving entities untouched |
87 | - $html = str_replace('&', $this->_unique . 'AMP', $html); |
|
87 | + $html = str_replace('&', $this->_unique.'AMP', $html); |
|
88 | 88 | |
89 | 89 | $this->_doc = new DOMDocument(); |
90 | 90 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | // Note: we create <autop> elements, which will later be converted to paragraphs |
116 | 116 | |
117 | 117 | // split AUTOPs into multiples at /\n\n+/ |
118 | - $html = preg_replace('/(' . $this->_unique . 'NL){2,}/', '</autop><autop>', $html); |
|
119 | - $html = str_replace([$this->_unique . 'BR', $this->_unique . 'NL', '<br>'], |
|
118 | + $html = preg_replace('/('.$this->_unique.'NL){2,}/', '</autop><autop>', $html); |
|
119 | + $html = str_replace([$this->_unique.'BR', $this->_unique.'NL', '<br>'], |
|
120 | 120 | '<br />', |
121 | 121 | $html); |
122 | 122 | $html = str_replace('<br /></autop>', '</autop>', $html); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $html = str_replace('</autop>', "</p>\n", $html); |
183 | 183 | |
184 | 184 | $html = str_replace('<br>', '<br />', $html); |
185 | - $html = str_replace($this->_unique . 'AMP', '&', $html); |
|
185 | + $html = str_replace($this->_unique.'AMP', '&', $html); |
|
186 | 186 | return $html; |
187 | 187 | } |
188 | 188 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | if ($alterInline) { |
237 | 237 | $isText = ($node->nodeType === XML_TEXT_NODE); |
238 | - $isLastInline = (! $node->nextSibling |
|
238 | + $isLastInline = (!$node->nextSibling |
|
239 | 239 | || ($node->nextSibling->nodeType === XML_ELEMENT_NODE |
240 | 240 | && in_array($node->nextSibling->nodeName, $this->_blocks))); |
241 | 241 | if ($isElement) { |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | // we're at the end of a sequence of text/inline elements |
259 | 259 | $nodeText = rtrim($nodeText); |
260 | 260 | } |
261 | - $nodeText = str_replace("\n", $this->_unique . 'NL', $nodeText); |
|
261 | + $nodeText = str_replace("\n", $this->_unique.'NL', $nodeText); |
|
262 | 262 | $tmpNode = $node; |
263 | 263 | $node = $node->nextSibling; // move loop to next node |
264 | 264 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | continue; |
270 | 270 | } |
271 | 271 | } |
272 | - if ($isBlock || ! $node->nextSibling) { |
|
272 | + if ($isBlock || !$node->nextSibling) { |
|
273 | 273 | if ($isBlock) { |
274 | 274 | if (in_array($node->nodeName, $this->_descendList)) { |
275 | 275 | $elsToProcess[] = $node; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $ltrimFirstTextNode = true; |
281 | 281 | } |
282 | 282 | if ($alterInline) { |
283 | - if (! $isBlock) { |
|
283 | + if (!$isBlock) { |
|
284 | 284 | $tmpNode = $node; |
285 | 285 | if ($isElement && false !== strpos($tmpNode->textContent, "\n")) { |
286 | 286 | $inlinesToProcess[] = $tmpNode; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $text = substr($text, 1); |
317 | 317 | $ignoreLeadingNewline = false; |
318 | 318 | } |
319 | - $node->nodeValue = str_replace("\n", $this->_unique . 'BR', $text); |
|
319 | + $node->nodeValue = str_replace("\n", $this->_unique.'BR', $text); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | } |
@@ -43,17 +43,17 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | // Create full path |
46 | - $path = $this->getVariable("cache_path") . $matrix; |
|
46 | + $path = $this->getVariable("cache_path").$matrix; |
|
47 | 47 | if (!is_dir($path)) { |
48 | 48 | mkdir($path, 0700, true); |
49 | 49 | } |
50 | 50 | |
51 | 51 | // Open the file |
52 | - if ((!file_exists($path . $filename)) && ($rw == "rb")) { |
|
52 | + if ((!file_exists($path.$filename)) && ($rw == "rb")) { |
|
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | |
56 | - return fopen($path . $filename, $rw); |
|
56 | + return fopen($path.$filename, $rw); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $key = md5($key); |
73 | 73 | |
74 | 74 | // prevent collision with un-hashed keys |
75 | - $key = "=" . $key; |
|
75 | + $key = "=".$key; |
|
76 | 76 | |
77 | 77 | return $key; |
78 | 78 | } |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | public function delete($key) { |
134 | 134 | $dir = $this->getVariable("cache_path"); |
135 | 135 | |
136 | - if (file_exists($dir . $key)) { |
|
137 | - return unlink($dir . $key); |
|
136 | + if (file_exists($dir.$key)) { |
|
137 | + return unlink($dir.$key); |
|
138 | 138 | } |
139 | 139 | return true; |
140 | 140 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | foreach ($files as $f) { |
158 | 158 | if (!in_array($f, $exclude)) { |
159 | - unlink($dir . $f); |
|
159 | + unlink($dir.$f); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -180,20 +180,20 @@ discard block |
||
180 | 180 | |
181 | 181 | $files = scandir($dir); |
182 | 182 | if (!$files) { |
183 | - throw new \IOException($dir . " is not a directory."); |
|
183 | + throw new \IOException($dir." is not a directory."); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | // Perform cleanup |
187 | 187 | foreach ($files as $f) { |
188 | 188 | if (!in_array($f, $exclude)) { |
189 | - $stat = stat($dir . $f); |
|
189 | + $stat = stat($dir.$f); |
|
190 | 190 | |
191 | 191 | // Add size |
192 | 192 | $size .= $stat['size']; |
193 | 193 | |
194 | 194 | // Is this older than my maximum date? |
195 | 195 | if (($this->getVariable("max_age") > 0) && (time() - $stat['mtime'] > $this->getVariable("max_age"))) { |
196 | - unlink($dir . $f); |
|
196 | + unlink($dir.$f); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | // @todo Size |
@@ -63,7 +63,7 @@ |
||
63 | 63 | $this->value_type, $this->owner_guid, $this->access_id); |
64 | 64 | |
65 | 65 | if (!$this->id) { |
66 | - throw new \IOException("Unable to save new " . get_class()); |
|
66 | + throw new \IOException("Unable to save new ".get_class()); |
|
67 | 67 | } |
68 | 68 | return $this->id; |
69 | 69 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | // check required files. |
170 | 170 | $have_req_files = true; |
171 | 171 | foreach ($this->requiredFiles as $file) { |
172 | - if (!is_readable($this->path . $file)) { |
|
172 | + if (!is_readable($this->path.$file)) { |
|
173 | 173 | $have_req_files = false; |
174 | 174 | $this->errorMsg = |
175 | 175 | _elgg_services()->translator->translate('ElggPluginPackage:InvalidPlugin:MissingFile', [$file]); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return bool |
212 | 212 | */ |
213 | 213 | private function hasReadableConfigFile() { |
214 | - $file = "{$this->path}/" . self::STATIC_CONFIG_FILENAME; |
|
214 | + $file = "{$this->path}/".self::STATIC_CONFIG_FILENAME; |
|
215 | 215 | if (!is_file($file)) { |
216 | 216 | return true; |
217 | 217 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @return bool |
331 | 331 | */ |
332 | 332 | private function loadManifest() { |
333 | - $file = $this->path . 'manifest.xml'; |
|
333 | + $file = $this->path.'manifest.xml'; |
|
334 | 334 | |
335 | 335 | try { |
336 | 336 | $this->manifest = new \ElggPluginManifest($file, $this->id); |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | break; |
463 | 463 | |
464 | 464 | default: |
465 | - $result = null;//skip further check |
|
465 | + $result = null; //skip further check |
|
466 | 466 | break; |
467 | 467 | } |
468 | 468 |
@@ -103,11 +103,11 @@ |
||
103 | 103 | $contents = []; |
104 | 104 | } |
105 | 105 | |
106 | - $contents = array_filter($contents, function ($metadata) use ($types) { |
|
106 | + $contents = array_filter($contents, function($metadata) use ($types) { |
|
107 | 107 | return in_array($metadata['type'], $types); |
108 | 108 | }); |
109 | 109 | |
110 | - return Collection\InMemory::fromArray(array_map(function ($metadata) { |
|
110 | + return Collection\InMemory::fromArray(array_map(function($metadata) { |
|
111 | 111 | if ($metadata['type'] === 'file') { |
112 | 112 | return new File($this, $metadata['path']); |
113 | 113 | } |
@@ -224,7 +224,7 @@ |
||
224 | 224 | if (DIRECTORY_SEPARATOR !== '/' || !function_exists('exec')) { |
225 | 225 | return ''; |
226 | 226 | } |
227 | - $type = @exec("file -b --mime-type " . escapeshellarg($file)); |
|
227 | + $type = @exec("file -b --mime-type ".escapeshellarg($file)); |
|
228 | 228 | return $type ? $type : ''; |
229 | 229 | } |
230 | 230 |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function upgradeCode($version, $quiet = false) { |
112 | 112 | $version = (int) $version; |
113 | - $upgrade_path = elgg_get_engine_path() . '/lib/upgrades/'; |
|
113 | + $upgrade_path = elgg_get_engine_path().'/lib/upgrades/'; |
|
114 | 114 | $processed_upgrades = $this->getProcessedUpgrades(); |
115 | 115 | |
116 | 116 | $upgrade_files = $this->getUpgradeFiles($upgrade_path); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | */ |
220 | 220 | protected function getUpgradeFiles($upgrade_path = null) { |
221 | 221 | if (!$upgrade_path) { |
222 | - $upgrade_path = elgg_get_engine_path() . '/lib/upgrades/'; |
|
222 | + $upgrade_path = elgg_get_engine_path().'/lib/upgrades/'; |
|
223 | 223 | } |
224 | 224 | $upgrade_path = sanitise_filepath($upgrade_path); |
225 | 225 | $handle = opendir($upgrade_path); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | while ($upgrade_file = readdir($handle)) { |
234 | 234 | // make sure this is a wellformed upgrade. |
235 | - if (is_dir($upgrade_path . '$upgrade_file')) { |
|
235 | + if (is_dir($upgrade_path.'$upgrade_file')) { |
|
236 | 236 | continue; |
237 | 237 | } |
238 | 238 | $upgrade_version = $this->getUpgradeFileVersion($upgrade_file); |