@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | $id = $this->getThemeId($plugin, $file); |
63 | 63 | $title = $this->getThemeTitle(); |
64 | 64 | $description = $this->getThemeDescription($id, $plugin); |
65 | - $templateView = strtolower(last(explode('@',$id))); |
|
65 | + $templateView = strtolower(last(explode('@', $id))); |
|
66 | 66 | $template = $this->getTemplatePath($templateView, $plugin); |
67 | 67 | $css = $this->getCssPath($id, $plugin); |
68 | 68 | |
69 | 69 | // print and confirm the information of theme |
70 | - if($this->confirmInfo($file, $namespace.'\\'.$class, $plugin, $id, $title, $description, $template, $css) === false){ |
|
70 | + if ($this->confirmInfo($file, $namespace.'\\'.$class, $plugin, $id, $title, $description, $template, $css) === false) { |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->makeCss($plugin, $css); |
79 | 79 | |
80 | 80 | // composer.json 파일 수정 |
81 | - if($this->registerTheme($plugin, 'theme/'.$id, $namespace.'\\'.$class, $title, $description) === false) { |
|
81 | + if ($this->registerTheme($plugin, 'theme/'.$id, $namespace.'\\'.$class, $title, $description) === false) { |
|
82 | 82 | throw new \Exception('Writing to composer.json file was failed.'); |
83 | 83 | } |
84 | 84 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * DummyCssFile |
130 | 130 | */ |
131 | 131 | |
132 | - if($class === $pluginClass) { |
|
132 | + if ($class === $pluginClass) { |
|
133 | 133 | $pluginClass = $pluginClass.'Plugin'; |
134 | 134 | } |
135 | 135 | |
@@ -183,22 +183,22 @@ discard block |
||
183 | 183 | { |
184 | 184 | $id = $this->option('id'); |
185 | 185 | |
186 | - if(!$id) { |
|
187 | - $fileName = basename($file,'.php'); |
|
186 | + if (!$id) { |
|
187 | + $fileName = basename($file, '.php'); |
|
188 | 188 | $id = $plugin.'@'.strtolower($fileName); |
189 | 189 | } else { |
190 | - if(strpos('theme/', $id) === 0) { |
|
190 | + if (strpos('theme/', $id) === 0) { |
|
191 | 191 | $id = substr($id, 6); |
192 | 192 | } |
193 | 193 | |
194 | - if(strpos($id, '@') === false) { |
|
194 | + if (strpos($id, '@') === false) { |
|
195 | 195 | $id = $plugin.'@'.$id; |
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | 199 | $theme = \App::make('xe.theme')->getTheme($id); |
200 | 200 | |
201 | - if($theme !== null) { |
|
201 | + if ($theme !== null) { |
|
202 | 202 | throw new \Exception("Theme[$theme] already exists."); |
203 | 203 | } |
204 | 204 | |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | { |
218 | 218 | $paths = explode('/', $file); |
219 | 219 | |
220 | - if($paths[0] === str_replace(base_path().'/', '', app('xe.plugin')->getPluginsDir())) { |
|
220 | + if ($paths[0] === str_replace(base_path().'/', '', app('xe.plugin')->getPluginsDir())) { |
|
221 | 221 | array_shift($paths); |
222 | 222 | } |
223 | 223 | |
224 | 224 | $plugin = array_shift($paths); |
225 | 225 | |
226 | - if(app('xe.plugin')->getPlugin($plugin) === null) { |
|
226 | + if (app('xe.plugin')->getPlugin($plugin) === null) { |
|
227 | 227 | throw new \Exception("Unable to find a plugin to locate the theme file. plugin[$plugin] is not found."); |
228 | 228 | } |
229 | 229 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | protected function getThemeDescription($id, $plugin) |
252 | 252 | { |
253 | 253 | $description = $this->option('description'); |
254 | - if(!$description) { |
|
254 | + if (!$description) { |
|
255 | 255 | $description = sprintf( |
256 | 256 | '%s theme from %s plugin.', |
257 | 257 | ucfirst(last(explode('@', $id))), ucfirst($plugin) |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | protected function getThemeFile() |
270 | 270 | { |
271 | 271 | $filePath = $this->argument('file'); |
272 | - if(file_exists($filePath)) { |
|
272 | + if (file_exists($filePath)) { |
|
273 | 273 | throw new \Exception("file[$filePath] already exists."); |
274 | 274 | } |
275 | 275 | return $filePath; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | { |
289 | 289 | $entity = \App::make('xe.plugin')->getPlugin($plugin); |
290 | 290 | $viewFile = 'views/theme/'.$id.'.blade.php'; |
291 | - if(file_exists($entity->getPath($viewFile))) { |
|
291 | + if (file_exists($entity->getPath($viewFile))) { |
|
292 | 292 | throw new \Exception("template file[views/$viewFile] already exists."); |
293 | 293 | } |
294 | 294 | return $viewFile; |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | protected function getCssPath($id, $plugin) |
307 | 307 | { |
308 | 308 | $entity = \App::make('xe.plugin')->getPlugin($plugin); |
309 | - $file = strtolower(last(explode('@',$id))); |
|
309 | + $file = strtolower(last(explode('@', $id))); |
|
310 | 310 | $cssFile = 'assets/theme/'.$file.'.css'; |
311 | - if(file_exists($entity->getPath($cssFile))) { |
|
311 | + if (file_exists($entity->getPath($cssFile))) { |
|
312 | 312 | throw new \Exception("template file[views/$cssFile] already exists."); |
313 | 313 | } |
314 | 314 | return $cssFile; |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | ) |
345 | 345 | ); |
346 | 346 | |
347 | - while($confirm = $this->ask('Do you want to add theme? [yes|no]')) { |
|
348 | - if($confirm === 'yes') { |
|
347 | + while ($confirm = $this->ask('Do you want to add theme? [yes|no]')) { |
|
348 | + if ($confirm === 'yes') { |
|
349 | 349 | return true; |
350 | 350 | } else { |
351 | 351 | return false; |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | $this->files->put(base_path($file), $code); |
386 | 386 | |
387 | - if(!class_exists($namespace.'\\'.$class)) { |
|
387 | + if (!class_exists($namespace.'\\'.$class)) { |
|
388 | 388 | $this->files->delete(base_path($file)); |
389 | 389 | throw new \Exception("Unable to load the theme class file[$file]. please check autoload setting of composer.json"); |
390 | 390 | } |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | |
450 | 450 | if ($unescapeUnicode && function_exists('mb_convert_encoding')) { |
451 | 451 | // https://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-cha |
452 | - $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) { |
|
452 | + $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function($match) { |
|
453 | 453 | $l = strlen($match[1]); |
454 | 454 | |
455 | 455 | if ($l % 2) { |
456 | - return str_repeat('\\', $l - 1) . mb_convert_encoding( |
|
456 | + return str_repeat('\\', $l - 1).mb_convert_encoding( |
|
457 | 457 | pack('H*', $match[2]), |
458 | 458 | 'UTF-8', |
459 | 459 | 'UCS-2BE' |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $this->originComposerStr = $composerStr; |
530 | 530 | $json = json_decode($composerStr, true); |
531 | 531 | $component = data_get($json, 'extra.xpressengine.component'); |
532 | - if(isset($component[$id])) { |
|
532 | + if (isset($component[$id])) { |
|
533 | 533 | throw new \Exception(sprintf('component[%s] already exists.', $id)); |
534 | 534 | } |
535 | 535 | $component[$id] = []; |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | protected function clean($file, $plugin, $template, $css) |
589 | 589 | { |
590 | 590 | // delete theme class file |
591 | - if(is_writable(base_path($file))) { |
|
591 | + if (is_writable(base_path($file))) { |
|
592 | 592 | $this->files->delete(base_path($file)); |
593 | 593 | } |
594 | 594 | |
@@ -596,19 +596,19 @@ discard block |
||
596 | 596 | |
597 | 597 | // unregister component from composer.json |
598 | 598 | $composerFile = $pluginEntity->getPath('composer.json'); |
599 | - if($this->originComposerStr !== null && is_writable($composerFile)) { |
|
599 | + if ($this->originComposerStr !== null && is_writable($composerFile)) { |
|
600 | 600 | $this->files->put($composerFile, $this->originComposerStr); |
601 | 601 | } |
602 | 602 | |
603 | 603 | // delete template file |
604 | 604 | $templateFile = $pluginEntity->getPath($template); |
605 | - if(is_writable($templateFile)) { |
|
605 | + if (is_writable($templateFile)) { |
|
606 | 606 | $this->files->delete($templateFile); |
607 | 607 | } |
608 | 608 | |
609 | 609 | // delete css file |
610 | 610 | $cssFile = $pluginEntity->getPath($css); |
611 | - if(is_writable($cssFile)) { |
|
611 | + if (is_writable($cssFile)) { |
|
612 | 612 | $this->files->delete($cssFile); |
613 | 613 | } |
614 | 614 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $loop = 0; |
53 | 53 | try { |
54 | - while(true) { |
|
54 | + while (true) { |
|
55 | 55 | $files = $this->storage->paginate(['useCount' => 0, 'parentId' => null], 20); |
56 | 56 | if (count($files) < 1) { |
57 | 57 | break; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | private function intercept() |
84 | 84 | { |
85 | - intercept('XeStorage@remove', 'storage.optimize.log', function ($target, $file) { |
|
85 | + intercept('XeStorage@remove', 'storage.optimize.log', function($target, $file) { |
|
86 | 86 | |
87 | 87 | $this->bag[] = $file; |
88 | 88 | |
@@ -102,22 +102,22 @@ discard block |
||
102 | 102 | switch ($verbosity) { |
103 | 103 | case 2: |
104 | 104 | if ($file->parentId === null) { |
105 | - $this->info("\t" . $file->clientname); |
|
105 | + $this->info("\t".$file->clientname); |
|
106 | 106 | } |
107 | 107 | break; |
108 | 108 | case 3: |
109 | 109 | if ($file->parentId === null) { |
110 | - $this->line("\t" . |
|
111 | - $file->disk . "\t" . |
|
112 | - "<info>" . $file->clientname . "</info>\t" . |
|
110 | + $this->line("\t". |
|
111 | + $file->disk."\t". |
|
112 | + "<info>".$file->clientname."</info>\t". |
|
113 | 113 | bytes($file->size) |
114 | 114 | ); |
115 | 115 | } |
116 | 116 | break; |
117 | 117 | case 4: |
118 | - $this->line("\t" . |
|
119 | - $file->disk . "\t" . |
|
120 | - "<info>" . $file->clientname . "</info>\t" . |
|
118 | + $this->line("\t". |
|
119 | + $file->disk."\t". |
|
120 | + "<info>".$file->clientname."</info>\t". |
|
121 | 121 | bytes($file->size) |
122 | 122 | ); |
123 | 123 | break; |