@@ -2,7 +2,7 @@ |
||
2 | 2 | <div class="grid-container"> |
3 | 3 | <div class="grid-box-2"> |
4 | 4 | <div class="grid-inner"> |
5 | - <div<?= isset($value) ? ' style="background-image:url(\'' . $request::$subfolders . 'images/' . $value . '\');"' : '' ?> class="selected-image" id="<?= $field->slug ?>_selectedImage"></div> |
|
5 | + <div<?= isset($value) ? ' style="background-image:url(\''.$request::$subfolders.'images/'.$value.'\');"' : '' ?> class="selected-image" id="<?= $field->slug ?>_selectedImage"></div> |
|
6 | 6 | </div> |
7 | 7 | </div> |
8 | 8 | <div class="grid-box-10"> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <? |
2 | 2 | if (isset($summernoteInstances)) { |
3 | - $summernoteInstances += 1; |
|
3 | + $summernoteInstances += 1; |
|
4 | 4 | } else { |
5 | - $summernoteInstances = 1; |
|
5 | + $summernoteInstances = 1; |
|
6 | 6 | } |
7 | 7 | ?> |
8 | 8 | <div class="rte"> |
@@ -26,6 +26,6 @@ discard block |
||
26 | 26 | </script> |
27 | 27 | <? |
28 | 28 | if (!isset($GLOBALS['rteList'])) { |
29 | - $GLOBALS['rteList'] = array(); |
|
29 | + $GLOBALS['rteList'] = array(); |
|
30 | 30 | } |
31 | 31 | $GLOBALS['rteList'][] = 'summernote_' . str_replace(']', '-', str_replace('[', '-', $fieldPrefix)) . $field->slug . '_rte_' . $summernoteInstances ?> |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | } |
7 | 7 | ?> |
8 | 8 | <div class="rte"> |
9 | - <div id="summernote_<?= str_replace(']', '-', str_replace('[', '-', $fieldPrefix)) . $field->slug ?>_rte_<?= $summernoteInstances ?>" class="summernote"><?= isset($value) ? $value : '' ?></div> |
|
9 | + <div id="summernote_<?= str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug ?>_rte_<?= $summernoteInstances ?>" class="summernote"><?= isset($value) ? $value : '' ?></div> |
|
10 | 10 | </div> |
11 | 11 | <textarea style="display:none;" id="summernote_<?= $field->slug ?>_container_<?= $summernoteInstances ?>" name="<?= $fieldPrefix ?>[<?= $field->slug ?>][]"></textarea> |
12 | 12 | <script> |
13 | 13 | $(document).ready(function () { |
14 | - $('#summernote_<?=str_replace(']', '-', str_replace('[', '-', $fieldPrefix)) . $field->slug?>_rte_<?=$summernoteInstances?>').summernote({ |
|
14 | + $('#summernote_<?=str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug?>_rte_<?=$summernoteInstances?>').summernote({ |
|
15 | 15 | height: 300, |
16 | 16 | toolbar: [ |
17 | 17 | /*[groupname, [button list]]*/ |
@@ -28,4 +28,4 @@ discard block |
||
28 | 28 | if (!isset($GLOBALS['rteList'])) { |
29 | 29 | $GLOBALS['rteList'] = array(); |
30 | 30 | } |
31 | -$GLOBALS['rteList'][] = 'summernote_' . str_replace(']', '-', str_replace('[', '-', $fieldPrefix)) . $field->slug . '_rte_' . $summernoteInstances ?> |
|
31 | +$GLOBALS['rteList'][] = 'summernote_'.str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug.'_rte_'.$summernoteInstances ?> |
@@ -17,14 +17,14 @@ |
||
17 | 17 | </div> |
18 | 18 | <div class="documentActions grid-box-4"> |
19 | 19 | <? renderAction('Edit', |
20 | - '', |
|
21 | - $request::$subfolders . $cmsPrefix . '/documents/edit-folder?slug=' . $slugPrefix . $document->slug, |
|
22 | - 'pencil'); ?> |
|
20 | + '', |
|
21 | + $request::$subfolders . $cmsPrefix . '/documents/edit-folder?slug=' . $slugPrefix . $document->slug, |
|
22 | + 'pencil'); ?> |
|
23 | 23 | <? renderAction('Delete', |
24 | - 'error', |
|
25 | - $request::$subfolders . $cmsPrefix . '/documents/delete-folder?slug=' . $slugPrefix . $document->slug, |
|
26 | - 'trash', |
|
27 | - 'return confirm(\'Are you sure you want to delete this document?\');'); ?> |
|
24 | + 'error', |
|
25 | + $request::$subfolders . $cmsPrefix . '/documents/delete-folder?slug=' . $slugPrefix . $document->slug, |
|
26 | + 'trash', |
|
27 | + 'return confirm(\'Are you sure you want to delete this document?\');'); ?> |
|
28 | 28 | </div> |
29 | 29 | <ul class="documents grid-wrapper nested<?= $root ? ' root' : '' ?>"> |
30 | 30 | <? foreach ($document->getContent() as $subDocument) : ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | { ?> |
11 | 11 | <div class="grid-box-8"> |
12 | 12 | <h3> |
13 | - <a class="btn documentTitle openFolder" data-slug="<?= $slugPrefix . $document->slug ?>" title="Open"> |
|
13 | + <a class="btn documentTitle openFolder" data-slug="<?= $slugPrefix.$document->slug ?>" title="Open"> |
|
14 | 14 | <i class="fa fa-folder-o "></i> <?= $document->title ?> |
15 | 15 | </a> |
16 | 16 | </h3> |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | <div class="documentActions grid-box-4"> |
19 | 19 | <? renderAction('Edit', |
20 | 20 | '', |
21 | - $request::$subfolders . $cmsPrefix . '/documents/edit-folder?slug=' . $slugPrefix . $document->slug, |
|
21 | + $request::$subfolders.$cmsPrefix.'/documents/edit-folder?slug='.$slugPrefix.$document->slug, |
|
22 | 22 | 'pencil'); ?> |
23 | 23 | <? renderAction('Delete', |
24 | 24 | 'error', |
25 | - $request::$subfolders . $cmsPrefix . '/documents/delete-folder?slug=' . $slugPrefix . $document->slug, |
|
25 | + $request::$subfolders.$cmsPrefix.'/documents/delete-folder?slug='.$slugPrefix.$document->slug, |
|
26 | 26 | 'trash', |
27 | 27 | 'return confirm(\'Are you sure you want to delete this document?\');'); ?> |
28 | 28 | </div> |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | <? foreach ($document->getContent() as $subDocument) : ?> |
31 | 31 | <li class="grid-container"> |
32 | 32 | <? if ($subDocument->type == 'document') : ?> |
33 | - <? renderDocument($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/', $request); ?> |
|
33 | + <? renderDocument($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/', $request); ?> |
|
34 | 34 | <? elseif ($subDocument->type == 'folder') : ?> |
35 | - <? renderFolder($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/', false, $request); ?> |
|
35 | + <? renderFolder($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/', false, $request); ?> |
|
36 | 36 | <? endif ?> |
37 | 37 | </li> |
38 | 38 | <? endforeach ?> |
@@ -25,7 +25,7 @@ |
||
25 | 25 | <? foreach ($image->set as $key => $set) : ?> |
26 | 26 | <div class="sets"> |
27 | 27 | <label><?= $key ?></label> |
28 | - <img src="<?= $request::$subfolders . 'images/' . $set ?>"/> |
|
28 | + <img src="<?= $request::$subfolders.'images/'.$set ?>"/> |
|
29 | 29 | </div> |
30 | 30 | <? endforeach ?> |
31 | 31 | <? endif ?> |
@@ -97,7 +97,7 @@ |
||
97 | 97 | </main> |
98 | 98 | <script> |
99 | 99 | var subfolders = '<?=$request::$subfolders?>', |
100 | - cmsSubfolders = '<?=$request::$subfolders . $cmsPrefix?>'; |
|
100 | + cmsSubfolders = '<?=$request::$subfolders.$cmsPrefix?>'; |
|
101 | 101 | </script> |
102 | 102 | <script src="<?= $request::$subfolders ?>js/cms.js"></script> |
103 | 103 | </body> |
@@ -3,7 +3,7 @@ |
||
3 | 3 | <? include('documents/function.renderFolder.php'); ?> |
4 | 4 | <script>window.onload = function () { |
5 | 5 | History.init(); |
6 | - History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders . $cmsPrefix?>/documents?path=/'); |
|
6 | + History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders.$cmsPrefix?>/documents?path=/'); |
|
7 | 7 | };</script> |
8 | 8 | <section class="documents"> |
9 | 9 | <h2><i class="fa fa-file-text-o"></i> Documents</h2> |
@@ -11,131 +11,131 @@ |
||
11 | 11 | |
12 | 12 | class CloudControl |
13 | 13 | { |
14 | - public static function run() |
|
15 | - { |
|
16 | - new Application(); |
|
17 | - } |
|
18 | - |
|
19 | - public static function postInstall(Event $event) |
|
20 | - { |
|
21 | - $event->getIO()->write("Post install"); |
|
22 | - self::checkInstall($event); |
|
23 | - } |
|
24 | - |
|
25 | - public static function postUpdate(Event $event) |
|
26 | - { |
|
27 | - $event->getIO()->write("Post update"); |
|
28 | - self::checkInstall($event); |
|
29 | - } |
|
30 | - |
|
31 | - /** |
|
32 | - * @param Event $event |
|
33 | - */ |
|
34 | - private static function checkInstall(Event $event) |
|
35 | - { |
|
36 | - $event->getIO()->write("*** Checking installation of Cloud Control framework ***"); |
|
37 | - |
|
38 | - $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); |
|
39 | - $rootDir = realpath($vendorDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR); |
|
40 | - |
|
41 | - $baseConfigTargetPath = $rootDir . DIRECTORY_SEPARATOR . 'config.json'; |
|
42 | - $configObject = self::getConfig($baseConfigTargetPath); |
|
43 | - |
|
44 | - $configObject->{'vendorDir'} = realpath($vendorDir); |
|
45 | - $configObject->{'rootDir'} = $rootDir; |
|
46 | - $configObject->{'templateDir'} = self::createDir($event, $rootDir, 'templates'); |
|
47 | - $configObject->{'storageDir'} = self::createDir($event, $rootDir, $configObject->{'storageDir'}); |
|
48 | - $configObject->{'publicDir'} = self::createDir($event, $rootDir, 'public'); |
|
49 | - $configObject->{'jsDir'} = self::createDir($event, $configObject->{'publicDir'}, 'js'); |
|
50 | - $configObject->{'cssDir'} = self::createDir($event, $configObject->{'publicDir'}, 'css'); |
|
51 | - $configObject->{'imagesDir'} = self::createDir($event, $configObject->{'publicDir'}, 'images'); |
|
52 | - $configObject->{'filesDir'} = self::createDir($event, $configObject->{'publicDir'}, 'files'); |
|
53 | - |
|
54 | - // TODO Fie FilesStorage to use filesDir from config, similar to ImagesStorage |
|
55 | - |
|
56 | - $baseStorageDefaultPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.json'; |
|
57 | - $baseStorageSqlPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.sql'; |
|
58 | - |
|
59 | - self::createStorage($configObject->{'storageDir'}, $baseStorageDefaultPath, $baseStorageSqlPath); |
|
60 | - self::saveConfig($event, $baseConfigTargetPath, $configObject); |
|
61 | - self::copyInstallFile($event, 'public.htaccess', $configObject->{'publicDir'}, '.htaccess'); |
|
62 | - self::copyInstallFile($event, 'root.htaccess', $configObject->{'rootDir'}, '.htaccess'); |
|
63 | - self::copyInstallFile($event, 'base.php', $configObject->{'templateDir'}); |
|
64 | - self::copyInstallFile($event, 'cms.css', $configObject->{'cssDir'}); |
|
65 | - self::copyInstallFile($event, 'cms.js', $configObject->{'jsDir'}); |
|
66 | - self::copyInstallFile($event, 'index.php', $configObject->{'publicDir'}); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * @param Event $event |
|
71 | - * @param $baseConfigTargetPath |
|
72 | - * @param $configObject |
|
73 | - * @internal param $rootDir |
|
74 | - * @internal param $vendorDir |
|
75 | - * @internal param $templateDir |
|
76 | - * @internal param $storageDir |
|
77 | - * @internal param $baseConfigDefaultPath |
|
78 | - * @internal param $baseConfigTargetPath |
|
79 | - * @internal param $storageDir |
|
80 | - */ |
|
81 | - private static function saveConfig(Event $event, $baseConfigTargetPath, $configObject) |
|
82 | - { |
|
83 | - file_put_contents($baseConfigTargetPath, json_encode($configObject)); |
|
84 | - $event->getIO()->write("Saved config to: " . $baseConfigTargetPath); |
|
85 | - } |
|
86 | - |
|
87 | - private static function copyInstallFile(Event $event, $sourceFileName, $destinationPath, $destinationFileName = null) |
|
88 | - { |
|
89 | - $sourceFilePath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_' . $sourceFileName); |
|
90 | - |
|
91 | - if (file_exists($sourceFilePath) && realpath($destinationPath) !== false) { |
|
92 | - if ($destinationFileName !== null) { |
|
93 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $destinationFileName); |
|
94 | - } else { |
|
95 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $sourceFileName); |
|
96 | - } |
|
97 | - |
|
98 | - $event->getIO()->write("Copied file: " . $sourceFileName . ' to ' . $destinationPath); |
|
99 | - } else { |
|
100 | - $event->getIO()->write("[ERROR] Couldnt copy file: " . $sourceFileName . ' to ' . $destinationPath); |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * @param $storageDir |
|
106 | - * @param $baseStorageDefaultPath |
|
107 | - * @param $baseStorageSqlPath |
|
108 | - */ |
|
109 | - private static function createStorage($storageDir, $baseStorageDefaultPath, $baseStorageSqlPath) |
|
110 | - { |
|
111 | - $repository = new Repository($storageDir); |
|
112 | - $repository->init($baseStorageDefaultPath, $baseStorageSqlPath); |
|
113 | - } |
|
114 | - |
|
115 | - private static function createDir(Event $event, $rootDir, $dirName) |
|
116 | - { |
|
117 | - $dir = $rootDir . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR; |
|
118 | - if (!is_dir($dir)) { |
|
119 | - mkdir($dir); |
|
120 | - $event->getIO()->write("Created dir: " . $dir); |
|
121 | - } |
|
122 | - return realpath($dir); |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * @param $configTargetPath |
|
127 | - * @return mixed |
|
128 | - */ |
|
129 | - private static function getConfig($configTargetPath) |
|
130 | - { |
|
131 | - $baseConfigDefaultPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_config.json'); |
|
132 | - |
|
133 | - if (file_exists($configTargetPath)) { |
|
134 | - $config = json_decode(file_get_contents($configTargetPath)); |
|
135 | - } else { |
|
136 | - $config = json_decode(file_get_contents($baseConfigDefaultPath)); |
|
137 | - } |
|
138 | - return $config; |
|
139 | - } |
|
14 | + public static function run() |
|
15 | + { |
|
16 | + new Application(); |
|
17 | + } |
|
18 | + |
|
19 | + public static function postInstall(Event $event) |
|
20 | + { |
|
21 | + $event->getIO()->write("Post install"); |
|
22 | + self::checkInstall($event); |
|
23 | + } |
|
24 | + |
|
25 | + public static function postUpdate(Event $event) |
|
26 | + { |
|
27 | + $event->getIO()->write("Post update"); |
|
28 | + self::checkInstall($event); |
|
29 | + } |
|
30 | + |
|
31 | + /** |
|
32 | + * @param Event $event |
|
33 | + */ |
|
34 | + private static function checkInstall(Event $event) |
|
35 | + { |
|
36 | + $event->getIO()->write("*** Checking installation of Cloud Control framework ***"); |
|
37 | + |
|
38 | + $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); |
|
39 | + $rootDir = realpath($vendorDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR); |
|
40 | + |
|
41 | + $baseConfigTargetPath = $rootDir . DIRECTORY_SEPARATOR . 'config.json'; |
|
42 | + $configObject = self::getConfig($baseConfigTargetPath); |
|
43 | + |
|
44 | + $configObject->{'vendorDir'} = realpath($vendorDir); |
|
45 | + $configObject->{'rootDir'} = $rootDir; |
|
46 | + $configObject->{'templateDir'} = self::createDir($event, $rootDir, 'templates'); |
|
47 | + $configObject->{'storageDir'} = self::createDir($event, $rootDir, $configObject->{'storageDir'}); |
|
48 | + $configObject->{'publicDir'} = self::createDir($event, $rootDir, 'public'); |
|
49 | + $configObject->{'jsDir'} = self::createDir($event, $configObject->{'publicDir'}, 'js'); |
|
50 | + $configObject->{'cssDir'} = self::createDir($event, $configObject->{'publicDir'}, 'css'); |
|
51 | + $configObject->{'imagesDir'} = self::createDir($event, $configObject->{'publicDir'}, 'images'); |
|
52 | + $configObject->{'filesDir'} = self::createDir($event, $configObject->{'publicDir'}, 'files'); |
|
53 | + |
|
54 | + // TODO Fie FilesStorage to use filesDir from config, similar to ImagesStorage |
|
55 | + |
|
56 | + $baseStorageDefaultPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.json'; |
|
57 | + $baseStorageSqlPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.sql'; |
|
58 | + |
|
59 | + self::createStorage($configObject->{'storageDir'}, $baseStorageDefaultPath, $baseStorageSqlPath); |
|
60 | + self::saveConfig($event, $baseConfigTargetPath, $configObject); |
|
61 | + self::copyInstallFile($event, 'public.htaccess', $configObject->{'publicDir'}, '.htaccess'); |
|
62 | + self::copyInstallFile($event, 'root.htaccess', $configObject->{'rootDir'}, '.htaccess'); |
|
63 | + self::copyInstallFile($event, 'base.php', $configObject->{'templateDir'}); |
|
64 | + self::copyInstallFile($event, 'cms.css', $configObject->{'cssDir'}); |
|
65 | + self::copyInstallFile($event, 'cms.js', $configObject->{'jsDir'}); |
|
66 | + self::copyInstallFile($event, 'index.php', $configObject->{'publicDir'}); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * @param Event $event |
|
71 | + * @param $baseConfigTargetPath |
|
72 | + * @param $configObject |
|
73 | + * @internal param $rootDir |
|
74 | + * @internal param $vendorDir |
|
75 | + * @internal param $templateDir |
|
76 | + * @internal param $storageDir |
|
77 | + * @internal param $baseConfigDefaultPath |
|
78 | + * @internal param $baseConfigTargetPath |
|
79 | + * @internal param $storageDir |
|
80 | + */ |
|
81 | + private static function saveConfig(Event $event, $baseConfigTargetPath, $configObject) |
|
82 | + { |
|
83 | + file_put_contents($baseConfigTargetPath, json_encode($configObject)); |
|
84 | + $event->getIO()->write("Saved config to: " . $baseConfigTargetPath); |
|
85 | + } |
|
86 | + |
|
87 | + private static function copyInstallFile(Event $event, $sourceFileName, $destinationPath, $destinationFileName = null) |
|
88 | + { |
|
89 | + $sourceFilePath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_' . $sourceFileName); |
|
90 | + |
|
91 | + if (file_exists($sourceFilePath) && realpath($destinationPath) !== false) { |
|
92 | + if ($destinationFileName !== null) { |
|
93 | + copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $destinationFileName); |
|
94 | + } else { |
|
95 | + copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $sourceFileName); |
|
96 | + } |
|
97 | + |
|
98 | + $event->getIO()->write("Copied file: " . $sourceFileName . ' to ' . $destinationPath); |
|
99 | + } else { |
|
100 | + $event->getIO()->write("[ERROR] Couldnt copy file: " . $sourceFileName . ' to ' . $destinationPath); |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * @param $storageDir |
|
106 | + * @param $baseStorageDefaultPath |
|
107 | + * @param $baseStorageSqlPath |
|
108 | + */ |
|
109 | + private static function createStorage($storageDir, $baseStorageDefaultPath, $baseStorageSqlPath) |
|
110 | + { |
|
111 | + $repository = new Repository($storageDir); |
|
112 | + $repository->init($baseStorageDefaultPath, $baseStorageSqlPath); |
|
113 | + } |
|
114 | + |
|
115 | + private static function createDir(Event $event, $rootDir, $dirName) |
|
116 | + { |
|
117 | + $dir = $rootDir . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR; |
|
118 | + if (!is_dir($dir)) { |
|
119 | + mkdir($dir); |
|
120 | + $event->getIO()->write("Created dir: " . $dir); |
|
121 | + } |
|
122 | + return realpath($dir); |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * @param $configTargetPath |
|
127 | + * @return mixed |
|
128 | + */ |
|
129 | + private static function getConfig($configTargetPath) |
|
130 | + { |
|
131 | + $baseConfigDefaultPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_config.json'); |
|
132 | + |
|
133 | + if (file_exists($configTargetPath)) { |
|
134 | + $config = json_decode(file_get_contents($configTargetPath)); |
|
135 | + } else { |
|
136 | + $config = json_decode(file_get_contents($baseConfigDefaultPath)); |
|
137 | + } |
|
138 | + return $config; |
|
139 | + } |
|
140 | 140 | |
141 | 141 | } |
142 | 142 | \ No newline at end of file |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | $event->getIO()->write("*** Checking installation of Cloud Control framework ***"); |
37 | 37 | |
38 | 38 | $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); |
39 | - $rootDir = realpath($vendorDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR); |
|
39 | + $rootDir = realpath($vendorDir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR); |
|
40 | 40 | |
41 | - $baseConfigTargetPath = $rootDir . DIRECTORY_SEPARATOR . 'config.json'; |
|
41 | + $baseConfigTargetPath = $rootDir.DIRECTORY_SEPARATOR.'config.json'; |
|
42 | 42 | $configObject = self::getConfig($baseConfigTargetPath); |
43 | 43 | |
44 | 44 | $configObject->{'vendorDir'} = realpath($vendorDir); |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | |
54 | 54 | // TODO Fie FilesStorage to use filesDir from config, similar to ImagesStorage |
55 | 55 | |
56 | - $baseStorageDefaultPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.json'; |
|
57 | - $baseStorageSqlPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.sql'; |
|
56 | + $baseStorageDefaultPath = __DIR__.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'_storage.json'; |
|
57 | + $baseStorageSqlPath = __DIR__.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'_storage.sql'; |
|
58 | 58 | |
59 | 59 | self::createStorage($configObject->{'storageDir'}, $baseStorageDefaultPath, $baseStorageSqlPath); |
60 | 60 | self::saveConfig($event, $baseConfigTargetPath, $configObject); |
@@ -81,23 +81,23 @@ discard block |
||
81 | 81 | private static function saveConfig(Event $event, $baseConfigTargetPath, $configObject) |
82 | 82 | { |
83 | 83 | file_put_contents($baseConfigTargetPath, json_encode($configObject)); |
84 | - $event->getIO()->write("Saved config to: " . $baseConfigTargetPath); |
|
84 | + $event->getIO()->write("Saved config to: ".$baseConfigTargetPath); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | private static function copyInstallFile(Event $event, $sourceFileName, $destinationPath, $destinationFileName = null) |
88 | 88 | { |
89 | - $sourceFilePath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_' . $sourceFileName); |
|
89 | + $sourceFilePath = realpath(__DIR__.DIRECTORY_SEPARATOR.'install/_'.$sourceFileName); |
|
90 | 90 | |
91 | 91 | if (file_exists($sourceFilePath) && realpath($destinationPath) !== false) { |
92 | 92 | if ($destinationFileName !== null) { |
93 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $destinationFileName); |
|
93 | + copy($sourceFilePath, realpath($destinationPath).DIRECTORY_SEPARATOR.$destinationFileName); |
|
94 | 94 | } else { |
95 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $sourceFileName); |
|
95 | + copy($sourceFilePath, realpath($destinationPath).DIRECTORY_SEPARATOR.$sourceFileName); |
|
96 | 96 | } |
97 | 97 | |
98 | - $event->getIO()->write("Copied file: " . $sourceFileName . ' to ' . $destinationPath); |
|
98 | + $event->getIO()->write("Copied file: ".$sourceFileName.' to '.$destinationPath); |
|
99 | 99 | } else { |
100 | - $event->getIO()->write("[ERROR] Couldnt copy file: " . $sourceFileName . ' to ' . $destinationPath); |
|
100 | + $event->getIO()->write("[ERROR] Couldnt copy file: ".$sourceFileName.' to '.$destinationPath); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | |
115 | 115 | private static function createDir(Event $event, $rootDir, $dirName) |
116 | 116 | { |
117 | - $dir = $rootDir . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR; |
|
117 | + $dir = $rootDir.DIRECTORY_SEPARATOR.$dirName.DIRECTORY_SEPARATOR; |
|
118 | 118 | if (!is_dir($dir)) { |
119 | 119 | mkdir($dir); |
120 | - $event->getIO()->write("Created dir: " . $dir); |
|
120 | + $event->getIO()->write("Created dir: ".$dir); |
|
121 | 121 | } |
122 | 122 | return realpath($dir); |
123 | 123 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private static function getConfig($configTargetPath) |
130 | 130 | { |
131 | - $baseConfigDefaultPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_config.json'); |
|
131 | + $baseConfigDefaultPath = realpath(__DIR__.DIRECTORY_SEPARATOR.'install/_config.json'); |
|
132 | 132 | |
133 | 133 | if (file_exists($configTargetPath)) { |
134 | 134 | $config = json_decode(file_get_contents($configTargetPath)); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | } |
18 | 18 | } else { |
19 | 19 | ob_clean(); |
20 | - echo <<<END |
|
20 | + echo <<<END |
|
21 | 21 | <!DOCTYPE html> |
22 | 22 | <html> |
23 | 23 | <head> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | $debug_backtrace = current(debug_backtrace()); |
13 | 13 | if (PHP_SAPI == 'cli') { |
14 | - echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n"; |
|
14 | + echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n"; |
|
15 | 15 | foreach (func_get_args() as $data) { |
16 | 16 | var_dump($data); |
17 | 17 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | <body> |
30 | 30 | END; |
31 | 31 | |
32 | - echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>"; |
|
32 | + echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>"; |
|
33 | 33 | echo '<pre>'; |
34 | 34 | foreach (func_get_args() as $data) { |
35 | 35 | echo "<code>"; |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | */ |
54 | 54 | function utf8Convert($array) |
55 | 55 | { |
56 | - array_walk_recursive($array, function(&$item){ |
|
57 | - if(!mb_detect_encoding($item, 'utf-8', true)){ |
|
56 | + array_walk_recursive($array, function(&$item) { |
|
57 | + if (!mb_detect_encoding($item, 'utf-8', true)) { |
|
58 | 58 | $item = utf8_encode($item); |
59 | 59 | } |
60 | 60 | }); |
@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | class NotFoundComponent extends BaseComponent |
14 | 14 | { |
15 | - public function run(Storage $storage) |
|
16 | - { |
|
17 | - parent::run($storage); |
|
18 | - header("HTTP/1.0 404 Not Found"); |
|
19 | - } |
|
15 | + public function run(Storage $storage) |
|
16 | + { |
|
17 | + parent::run($storage); |
|
18 | + header("HTTP/1.0 404 Not Found"); |
|
19 | + } |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | \ No newline at end of file |