@@ -8,7 +8,7 @@ |
||
8 | 8 | /** |
9 | 9 | * @param Core\Services\AuthService\AuthService |
10 | 10 | * @return AuthService |
11 | - */ |
|
11 | + */ |
|
12 | 12 | protected static function getFacadeAccessor() |
13 | 13 | { |
14 | 14 | return 'ImageService'; |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Core\Facades; |
3 | 3 | |
4 | -use Core\Services\ImageService ; |
|
4 | +use Core\Services\ImageService; |
|
5 | 5 | use SlimFacades\Facade; |
6 | 6 | class Image extends Facade |
7 | 7 | { |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * @param Core\Services\AuthService\AuthService |
17 | 17 | * @return AuthService |
18 | - */ |
|
18 | + */ |
|
19 | 19 | protected static function getFacadeAccessor() |
20 | 20 | { |
21 | 21 | return 'FileService'; |
@@ -7,71 +7,71 @@ |
||
7 | 7 | class ImageService extends _Service |
8 | 8 | { |
9 | 9 | |
10 | - public function cropResize($src,$destUrl, $width, $height, $quality = 80,$fileExt = 'jpg') |
|
10 | + public function cropResize($src, $destUrl, $width, $height, $quality = 80, $fileExt = 'jpg') |
|
11 | 11 | { |
12 | 12 | $image = GImage::open($src); |
13 | 13 | $image->cropResize($width, $height); |
14 | - $destUrl = $destUrl.'.'.$fileExt; |
|
15 | - $image->save($destUrl, $fileExt = 'jpg', $quality ); |
|
14 | + $destUrl = $destUrl . '.' . $fileExt; |
|
15 | + $image->save($destUrl, $fileExt = 'jpg', $quality); |
|
16 | 16 | |
17 | 17 | |
18 | 18 | return $image; |
19 | 19 | } |
20 | 20 | |
21 | - public function scaleResize($src,$destUrl, $width, $height, $quality = 80,$fileExt = 'jpg') |
|
21 | + public function scaleResize($src, $destUrl, $width, $height, $quality = 80, $fileExt = 'jpg') |
|
22 | 22 | { |
23 | 23 | $image = GImage::open($src); |
24 | 24 | $image->scaleResize($width, $height); |
25 | - $destUrl = $destUrl.'.'.$fileExt; |
|
26 | - $image->save($destUrl, $fileExt = 'jpg', $quality ); |
|
25 | + $destUrl = $destUrl . '.' . $fileExt; |
|
26 | + $image->save($destUrl, $fileExt = 'jpg', $quality); |
|
27 | 27 | |
28 | 28 | |
29 | 29 | return $image; |
30 | 30 | } |
31 | 31 | |
32 | - public function resize($src,$destUrl, $width, $height, $quality = 80,$fileExt = 'jpg') |
|
32 | + public function resize($src, $destUrl, $width, $height, $quality = 80, $fileExt = 'jpg') |
|
33 | 33 | { |
34 | 34 | $image = GImage::open($src); |
35 | 35 | $image->resize($width, $height); |
36 | - $destUrl = $destUrl.'.'.$fileExt; |
|
37 | - $image->save($destUrl, $fileExt = 'jpg', $quality ); |
|
36 | + $destUrl = $destUrl . '.' . $fileExt; |
|
37 | + $image->save($destUrl, $fileExt = 'jpg', $quality); |
|
38 | 38 | |
39 | 39 | |
40 | 40 | return $image; |
41 | 41 | } |
42 | 42 | |
43 | - public function zoomCrop($src,$destUrl, $width, $height, $quality = 80,$fileExt = 'jpg') |
|
43 | + public function zoomCrop($src, $destUrl, $width, $height, $quality = 80, $fileExt = 'jpg') |
|
44 | 44 | { |
45 | 45 | $image = GImage::open($src); |
46 | 46 | $image->zoomCrop($width, $height); |
47 | - $destUrl = $destUrl.'.'.$fileExt; |
|
48 | - $image->save($destUrl, $fileExt = 'jpg', $quality ); |
|
47 | + $destUrl = $destUrl . '.' . $fileExt; |
|
48 | + $image->save($destUrl, $fileExt = 'jpg', $quality); |
|
49 | 49 | return $image; |
50 | 50 | } |
51 | 51 | |
52 | - public function createPhotos($src,$photoid,$type='user_photo', $dimensions = false) |
|
52 | + public function createPhotos($src, $photoid, $type = 'user_photo', $dimensions = false) |
|
53 | 53 | { |
54 | 54 | // Get default dimensions |
55 | - $dest = realpath('.'.$GLOBALS['container']['image']['upload_path']); |
|
55 | + $dest = realpath('.' . $GLOBALS['container']['image']['upload_path']); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | $defaultDimensions = $dimensions ? $dimensions : $GLOBALS['container']['image'][$type]['dimensions']; |
59 | 59 | foreach ($defaultDimensions as $keys=>$dimension) |
60 | 60 | { |
61 | - if(!isset($dimension[2])) $dimension[2] = 100; // quality |
|
62 | - if(!isset($dimension[4])) $dimension[4] = 'jpg'; // quality |
|
61 | + if (!isset($dimension[2])) $dimension[2] = 100; // quality |
|
62 | + if (!isset($dimension[4])) $dimension[4] = 'jpg'; // quality |
|
63 | 63 | |
64 | - $destUrl = $dest.'/'.getImageDirName($photoid,$type).getImageFileName($photoid,$keys,$type); |
|
64 | + $destUrl = $dest . '/' . getImageDirName($photoid, $type) . getImageFileName($photoid, $keys, $type); |
|
65 | 65 | |
66 | - if(isset($dimension[3]) && $dimension[3] == true){ |
|
67 | - $image = $this->zoomCrop($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
|
66 | + if (isset($dimension[3]) && $dimension[3] == true) { |
|
67 | + $image = $this->zoomCrop($src, trim($destUrl), $dimension[0], $dimension[1], $dimension[2], $dimension[4]); |
|
68 | 68 | }else { |
69 | - $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
|
69 | + $image = $this->cropResize($src, trim($destUrl), $dimension[0], $dimension[1], $dimension[2], $dimension[4]); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
73 | 73 | |
74 | - if($image ){ |
|
74 | + if ($image) { |
|
75 | 75 | $cropedArr[$keys] = $src; |
76 | 76 | } |
77 | 77 | } |
@@ -58,14 +58,20 @@ |
||
58 | 58 | $defaultDimensions = $dimensions ? $dimensions : $GLOBALS['container']['image'][$type]['dimensions']; |
59 | 59 | foreach ($defaultDimensions as $keys=>$dimension) |
60 | 60 | { |
61 | - if(!isset($dimension[2])) $dimension[2] = 100; // quality |
|
62 | - if(!isset($dimension[4])) $dimension[4] = 'jpg'; // quality |
|
61 | + if(!isset($dimension[2])) { |
|
62 | + $dimension[2] = 100; |
|
63 | + } |
|
64 | + // quality |
|
65 | + if(!isset($dimension[4])) { |
|
66 | + $dimension[4] = 'jpg'; |
|
67 | + } |
|
68 | + // quality |
|
63 | 69 | |
64 | 70 | $destUrl = $dest.'/'.getImageDirName($photoid,$type).getImageFileName($photoid,$keys,$type); |
65 | 71 | |
66 | 72 | if(isset($dimension[3]) && $dimension[3] == true){ |
67 | 73 | $image = $this->zoomCrop($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
68 | - }else { |
|
74 | + } else { |
|
69 | 75 | $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
70 | 76 | } |
71 | 77 |
@@ -6,17 +6,17 @@ |
||
6 | 6 | |
7 | 7 | class FileService extends _Service |
8 | 8 | { |
9 | - public function moveUploadedFile($directory,$fileName, UploadedFile $uploadedFile) |
|
10 | - { |
|
11 | - $extension = pathinfo($uploadedFile->getClientFilename(), PATHINFO_EXTENSION); |
|
12 | - $basename = bin2hex(random_bytes(8)); // see http://php.net/manual/en/function.random-bytes.php |
|
13 | - $filename = sprintf('%s.%0.8s', $fileName, $extension); |
|
14 | - $uploadedFile->moveTo($directory . DIRECTORY_SEPARATOR . $filename); |
|
15 | - return $directory . DIRECTORY_SEPARATOR . $filename; |
|
16 | - } |
|
17 | - public function delete($file) |
|
18 | - { |
|
19 | - @unlink($file); |
|
20 | - } |
|
9 | + public function moveUploadedFile($directory,$fileName, UploadedFile $uploadedFile) |
|
10 | + { |
|
11 | + $extension = pathinfo($uploadedFile->getClientFilename(), PATHINFO_EXTENSION); |
|
12 | + $basename = bin2hex(random_bytes(8)); // see http://php.net/manual/en/function.random-bytes.php |
|
13 | + $filename = sprintf('%s.%0.8s', $fileName, $extension); |
|
14 | + $uploadedFile->moveTo($directory . DIRECTORY_SEPARATOR . $filename); |
|
15 | + return $directory . DIRECTORY_SEPARATOR . $filename; |
|
16 | + } |
|
17 | + public function delete($file) |
|
18 | + { |
|
19 | + @unlink($file); |
|
20 | + } |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class FileService extends _Service |
8 | 8 | { |
9 | - public function moveUploadedFile($directory,$fileName, UploadedFile $uploadedFile) |
|
9 | + public function moveUploadedFile($directory, $fileName, UploadedFile $uploadedFile) |
|
10 | 10 | { |
11 | 11 | $extension = pathinfo($uploadedFile->getClientFilename(), PATHINFO_EXTENSION); |
12 | 12 | $basename = bin2hex(random_bytes(8)); // see http://php.net/manual/en/function.random-bytes.php |
@@ -5,18 +5,18 @@ discard block |
||
5 | 5 | $dir = scandir($path); |
6 | 6 | $ex_folders = array('..', '.'); |
7 | 7 | |
8 | - return array_diff($dir,$ex_folders); |
|
8 | + return array_diff($dir, $ex_folders); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | /*folder*/ |
12 | -function getImageDirName($photoid, $type = 'user_photo' ,$collectionNum =1000) |
|
12 | +function getImageDirName($photoid, $type = 'user_photo', $collectionNum = 1000) |
|
13 | 13 | { |
14 | 14 | $folderName = null; |
15 | 15 | switch ($type) { |
16 | 16 | case 'user_photo': |
17 | 17 | $folderName = (int) ($photoid / $collectionNum); |
18 | 18 | $folderName++; |
19 | - $dir = 'user_photo/'.$folderName.'/'; |
|
19 | + $dir = 'user_photo/' . $folderName . '/'; |
|
20 | 20 | break; |
21 | 21 | } |
22 | 22 | |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | return $folderName; |
28 | 28 | } |
29 | 29 | |
30 | -function getImageFileName($photoid,$fileType='l',$type='user_photo') |
|
30 | +function getImageFileName($photoid, $fileType = 'l', $type = 'user_photo') |
|
31 | 31 | { |
32 | 32 | $fileName = null; |
33 | 33 | |
34 | 34 | switch ($type) { |
35 | 35 | case 'user_photo': |
36 | - $fileName = 'user'.(int)$photoid.'-'.$fileType; |
|
36 | + $fileName = 'user' . (int) $photoid . '-' . $fileType; |
|
37 | 37 | break; |
38 | 38 | } |
39 | 39 |
@@ -2,22 +2,22 @@ discard block |
||
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | -function route(string $name ,array $params = []) |
|
5 | +function route(string $name, array $params = []) |
|
6 | 6 | { |
7 | 7 | $url = new \Core\Helpers\Url($GLOBALS['container']); |
8 | - return $url->get($name , $params); |
|
8 | + return $url->get($name, $params); |
|
9 | 9 | } |
10 | 10 | |
11 | -function url(string $name ,array $params = []) |
|
11 | +function url(string $name, array $params = []) |
|
12 | 12 | { |
13 | 13 | $url = new \Core\Helpers\Url($GLOBALS['container']); |
14 | - return $url->get($name , $params); |
|
14 | + return $url->get($name, $params); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // translate |
18 | -function trans($key , $replace = []){ |
|
18 | +function trans($key, $replace = []) { |
|
19 | 19 | $container = $GLOBALS['container']; |
20 | - return $container->translator->trans($key,$replace); |
|
20 | + return $container->translator->trans($key, $replace); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | function public_path(string $uri = '') { |
@@ -27,23 +27,23 @@ discard block |
||
27 | 27 | |
28 | 28 | $url = new \Core\Helpers\Url($container); |
29 | 29 | |
30 | - $url_asset = $url->getBasePath($request) .'/'. $uri; |
|
30 | + $url_asset = $url->getBasePath($request) . '/' . $uri; |
|
31 | 31 | return $url_asset; |
32 | 32 | } |
33 | 33 | |
34 | 34 | function asset(string $uri = '') { |
35 | 35 | $url = public_path(); |
36 | - $url_asset = $url.'assets/'.$uri; |
|
36 | + $url_asset = $url . 'assets/' . $uri; |
|
37 | 37 | return $url_asset; |
38 | 38 | } |
39 | 39 | |
40 | -function get_gravatar( $email, $s = 380, $d = 'mm', $r = 'g', $img = false, $atts = array() ) { |
|
40 | +function get_gravatar($email, $s = 380, $d = 'mm', $r = 'g', $img = false, $atts = array()) { |
|
41 | 41 | $url = 'https://www.gravatar.com/avatar/'; |
42 | - $url .= md5( strtolower( trim( $email ) ) ); |
|
42 | + $url .= md5(strtolower(trim($email))); |
|
43 | 43 | $url .= "?s=$s&d=$d&r=$r"; |
44 | - if ( $img ) { |
|
44 | + if ($img) { |
|
45 | 45 | $url = '<img src="' . $url . '"'; |
46 | - foreach ( $atts as $key => $val ) |
|
46 | + foreach ($atts as $key => $val) |
|
47 | 47 | $url .= ' ' . $key . '="' . $val . '"'; |
48 | 48 | $url .= ' />'; |
49 | 49 | } |
@@ -43,8 +43,9 @@ |
||
43 | 43 | $url .= "?s=$s&d=$d&r=$r"; |
44 | 44 | if ( $img ) { |
45 | 45 | $url = '<img src="' . $url . '"'; |
46 | - foreach ( $atts as $key => $val ) |
|
47 | - $url .= ' ' . $key . '="' . $val . '"'; |
|
46 | + foreach ( $atts as $key => $val ) { |
|
47 | + $url .= ' ' . $key . '="' . $val . '"'; |
|
48 | + } |
|
48 | 49 | $url .= ' />'; |
49 | 50 | } |
50 | 51 | return $url; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | $container = $app->getContainer(); |
5 | 5 | |
6 | 6 | /* database connection */ |
7 | -$container['db'] = function ($container) { |
|
7 | +$container['db'] = function($container) { |
|
8 | 8 | $db = $container['databases']['db']; |
9 | 9 | $pdo = new PDO("mysql:host=" . $db['host'] . ";dbname=" . $db['database'], |
10 | 10 | $db['username'], $db['password']); |
@@ -23,18 +23,18 @@ discard block |
||
23 | 23 | // |
24 | 24 | |
25 | 25 | |
26 | -$container['generalErrorHandler'] = function ($container) { |
|
26 | +$container['generalErrorHandler'] = function($container) { |
|
27 | 27 | return new \Core\Handlers\GeneralErrorHandler($container); |
28 | 28 | }; |
29 | 29 | |
30 | 30 | |
31 | 31 | // Service factory for the ORM |
32 | -$container['validator'] = function () { |
|
32 | +$container['validator'] = function() { |
|
33 | 33 | return new App\Validation\Validator(); |
34 | 34 | }; |
35 | 35 | |
36 | 36 | |
37 | -$container['eloquent'] = function ($container) { |
|
37 | +$container['eloquent'] = function($container) { |
|
38 | 38 | $db = $container['databases']['db']; |
39 | 39 | |
40 | 40 | $capsule = new \Illuminate\Database\Capsule\Manager; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | |
56 | 56 | // monolog |
57 | -$container['logger'] = function ($c) { |
|
57 | +$container['logger'] = function($c) { |
|
58 | 58 | $settings = $c->get('settings')['logger']; |
59 | 59 | $logger = new Monolog\Logger($settings['name']); |
60 | 60 | $logger->pushProcessor(new Monolog\Processor\UidProcessor()); |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | }; |
64 | 64 | |
65 | 65 | // not found handler |
66 | -$container['notFoundHandler'] = function ($container) { |
|
67 | - return function (\Slim\Http\Request $request, \Slim\Http\Response $response) use ($container) { |
|
66 | +$container['notFoundHandler'] = function($container) { |
|
67 | + return function(\Slim\Http\Request $request, \Slim\Http\Response $response) use ($container) { |
|
68 | 68 | return $container['view']->render($response->withStatus(404), '404'); |
69 | 69 | }; |
70 | 70 | }; |
@@ -74,23 +74,23 @@ discard block |
||
74 | 74 | $translator = new \Core\Translator\Translator($container); |
75 | 75 | $translator->init(); |
76 | 76 | |
77 | -$container['translator'] = function () use ($translator) { |
|
77 | +$container['translator'] = function() use ($translator) { |
|
78 | 78 | return $translator; |
79 | 79 | }; |
80 | 80 | |
81 | 81 | |
82 | 82 | // Register provider |
83 | -$container['flash'] = function () { |
|
83 | +$container['flash'] = function() { |
|
84 | 84 | return new \Slim\Flash\Messages(); |
85 | 85 | }; |
86 | 86 | |
87 | 87 | |
88 | 88 | // |
89 | -$container['session'] = function ($container) { |
|
89 | +$container['session'] = function($container) { |
|
90 | 90 | $setting_session_driver = $container['settings']['session']['driver'] ?? 'session'; |
91 | 91 | |
92 | 92 | $sessionOBJ = new \Core\Services\Session(); |
93 | - $session = $sessionOBJ->init($setting_session_driver) ; |
|
93 | + $session = $sessionOBJ->init($setting_session_driver); |
|
94 | 94 | return $session; |
95 | 95 | }; |
96 | 96 | |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | |
103 | 103 | |
104 | 104 | // Register Blade View helper |
105 | -$container['view'] = function ($container) { |
|
105 | +$container['view'] = function($container) { |
|
106 | 106 | $messages = $container->flash->getMessages(); |
107 | 107 | |
108 | - if(!is_dir('../app/View/cache')){ |
|
108 | + if (!is_dir('../app/View/cache')) { |
|
109 | 109 | @mkdir('../app/View/cache'); |
110 | 110 | } |
111 | 111 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $viewSettings = $container['settings']['view']; |
114 | 114 | |
115 | 115 | return new \Slim\Views\Blade( |
116 | - [$viewSettings['blade_template_path'].$viewSettings['template']], |
|
116 | + [$viewSettings['blade_template_path'] . $viewSettings['template']], |
|
117 | 117 | $viewSettings['blade_cache_path'], |
118 | 118 | null, |
119 | 119 | [ |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | }; |
126 | 126 | |
127 | 127 | // Register Blade View helper |
128 | -$container['json'] = function ($container) { |
|
128 | +$container['json'] = function($container) { |
|
129 | 129 | return new \Core\Handlers\JsonHandler(); |
130 | 130 | }; |
131 | 131 | |
132 | -$app->getContainer()['view']->getRenderer()->getCompiler()->directive('helloWorld', function(){ |
|
132 | +$app->getContainer()['view']->getRenderer()->getCompiler()->directive('helloWorld', function() { |
|
133 | 133 | |
134 | 134 | return "<?php echo 'Hello Directive'; ?>"; |
135 | 135 | }); |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | |
144 | 144 | |
145 | 145 | /*Dynamic containers in services*/ |
146 | -$dir = scandir(__APP_ROOT__.'/core/Services/'); |
|
146 | +$dir = scandir(__APP_ROOT__ . '/core/Services/'); |
|
147 | 147 | $ex_folders = array('..', '.'); |
148 | -$filesInServices = array_diff($dir,$ex_folders); |
|
148 | +$filesInServices = array_diff($dir, $ex_folders); |
|
149 | 149 | |
150 | -foreach($filesInServices as $service){ |
|
151 | - $content = preg_replace('/.php/','',$service); |
|
152 | - $container[$content] = function () use ($content){ |
|
153 | - $class = '\\Core\\Services\\'.$content ; |
|
150 | +foreach ($filesInServices as $service) { |
|
151 | + $content = preg_replace('/.php/', '', $service); |
|
152 | + $container[$content] = function() use ($content){ |
|
153 | + $class = '\\Core\\Services\\' . $content; |
|
154 | 154 | return new $class(); |
155 | 155 | }; |
156 | 156 | } |
@@ -17,12 +17,12 @@ |
||
17 | 17 | } |
18 | 18 | $i=0; |
19 | 19 | foreach($filesInConfig as $config_file){ |
20 | - if($config_file === 'phpmig.php'){continue;} |
|
21 | - $file[$i] = include_once __APP_ROOT__.'config/'.$config_file; |
|
22 | - if(is_array($file[$i])){ |
|
23 | - $configs = array_merge($configs, $file[$i]); |
|
24 | - $i++; |
|
25 | - } |
|
20 | + if($config_file === 'phpmig.php'){continue;} |
|
21 | + $file[$i] = include_once __APP_ROOT__.'config/'.$config_file; |
|
22 | + if(is_array($file[$i])){ |
|
23 | + $configs = array_merge($configs, $file[$i]); |
|
24 | + $i++; |
|
25 | + } |
|
26 | 26 | |
27 | 27 | } |
28 | 28 |
@@ -1,25 +1,25 @@ discard block |
||
1 | 1 | <?php |
2 | -define('__APP_ROOT__',__DIR__ . '/../') ; |
|
2 | +define('__APP_ROOT__', __DIR__ . '/../'); |
|
3 | 3 | $APPROOT = __APP_ROOT__; |
4 | -require __APP_ROOT__.'bootstrap/bootstrap.php'; |
|
5 | -require __APP_ROOT__.'vendor/autoload.php'; |
|
4 | +require __APP_ROOT__ . 'bootstrap/bootstrap.php'; |
|
5 | +require __APP_ROOT__ . 'vendor/autoload.php'; |
|
6 | 6 | |
7 | 7 | $env = new \Core\Helpers\Env(); |
8 | 8 | |
9 | 9 | defined('DS') || define('DS', DIRECTORY_SEPARATOR); |
10 | 10 | |
11 | 11 | /*Dynamic containers in services*/ |
12 | -$config_dir = scandir(__APP_ROOT__.'/config/'); |
|
12 | +$config_dir = scandir(__APP_ROOT__ . '/config/'); |
|
13 | 13 | $ex_config_folders = array('..', '.'); |
14 | -$filesInConfig = array_diff($config_dir,$ex_config_folders); |
|
14 | +$filesInConfig = array_diff($config_dir, $ex_config_folders); |
|
15 | 15 | if (!isset($configs)) { |
16 | 16 | $configs = array(); |
17 | 17 | } |
18 | -$i=0; |
|
19 | -foreach($filesInConfig as $config_file){ |
|
20 | - if($config_file === 'phpmig.php'){continue;} |
|
21 | - $file[$i] = include_once __APP_ROOT__.'config/'.$config_file; |
|
22 | - if(is_array($file[$i])){ |
|
18 | +$i = 0; |
|
19 | +foreach ($filesInConfig as $config_file) { |
|
20 | + if ($config_file === 'phpmig.php') {continue; } |
|
21 | + $file[$i] = include_once __APP_ROOT__ . 'config/' . $config_file; |
|
22 | + if (is_array($file[$i])) { |
|
23 | 23 | $configs = array_merge($configs, $file[$i]); |
24 | 24 | $i++; |
25 | 25 | } |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | $config = $configs; |
30 | -require __APP_ROOT__.'core/Functions/general_helpers.php'; |
|
30 | +require __APP_ROOT__ . 'core/Functions/general_helpers.php'; |
|
31 | 31 | |
32 | 32 | |
33 | 33 | $app = new \Core\App($config); |
34 | 34 | |
35 | -if($config['settings']['debug'] && !$config['settings']['tracy']['active']){ |
|
35 | +if ($config['settings']['debug'] && !$config['settings']['tracy']['active']) { |
|
36 | 36 | ini_set('display_errors', 1); |
37 | 37 | ini_set('display_startup_errors', 1); |
38 | 38 | error_reporting(E_ALL); |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | |
42 | 42 | use SlimFacades\Facade; |
43 | 43 | // get container app |
44 | -require __APP_ROOT__.'bootstrap/dependencies.php'; |
|
44 | +require __APP_ROOT__ . 'bootstrap/dependencies.php'; |
|
45 | 45 | |
46 | -require __APP_ROOT__.'bootstrap/routes.php'; |
|
47 | -require __APP_ROOT__.'core/Functions/helpers.php'; |
|
46 | +require __APP_ROOT__ . 'bootstrap/routes.php'; |
|
47 | +require __APP_ROOT__ . 'core/Functions/helpers.php'; |
|
48 | 48 | |
49 | -if(php_sapi_name() != 'cli') { |
|
50 | - if($config['settings']['debug'] && $config['settings']['tracy']['active']){ |
|
49 | +if (php_sapi_name() != 'cli') { |
|
50 | + if ($config['settings']['debug'] && $config['settings']['tracy']['active']) { |
|
51 | 51 | Tracy\Debugger::enable(Tracy\Debugger::DEVELOPMENT, $config['settings']['tracy']['path']); |
52 | 52 | } |
53 | 53 | Facade::setFacadeApplication($app); |
54 | 54 | |
55 | - require __APP_ROOT__.'bootstrap/middlewares.php'; |
|
55 | + require __APP_ROOT__ . 'bootstrap/middlewares.php'; |
|
56 | 56 | |
57 | 57 | $app->run(); |
58 | 58 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | 'displayErrorDetails' => true, |
8 | 8 | 'addContentLengthHeader' => false, |
9 | 9 | 'determineRouteBeforeAppMiddleware' => true, |
10 | - 'debug'=>true , |
|
10 | + 'debug'=>true, |
|
11 | 11 | 'image' => [ |
12 | 12 | 'dir' => $APPROOT . '/public/uploads' |
13 | 13 | ], |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | 'path' => __DIR__ . '/../storage/logs/app.log', |
25 | 25 | ], |
26 | 26 | 'db' => [ |
27 | - 'driver' => $env($APPROOT,'DB_DRIVER', 'mysql'), |
|
28 | - 'host' => $env($APPROOT,'DB_HOST', 'localhost'), |
|
29 | - 'database' => $env($APPROOT,'DB_NAME', 'cafesaba'), |
|
30 | - 'username' => $env($APPROOT,'DB_USERNAME', 'root'), |
|
31 | - 'password' => $env($APPROOT,'DB_PASS', ''), |
|
32 | - 'charset' => $env($APPROOT,'DB_CHARSET', 'utf8'), |
|
33 | - 'collation' => $env($APPROOT,'DB_COLLATION', 'utf8_unicode_ci'), |
|
34 | - 'prefix' => $env($APPROOT,'DB_PREFIX', ''), |
|
35 | - 'port' => $env($APPROOT,'DB_PORT', 3306), |
|
27 | + 'driver' => $env($APPROOT, 'DB_DRIVER', 'mysql'), |
|
28 | + 'host' => $env($APPROOT, 'DB_HOST', 'localhost'), |
|
29 | + 'database' => $env($APPROOT, 'DB_NAME', 'cafesaba'), |
|
30 | + 'username' => $env($APPROOT, 'DB_USERNAME', 'root'), |
|
31 | + 'password' => $env($APPROOT, 'DB_PASS', ''), |
|
32 | + 'charset' => $env($APPROOT, 'DB_CHARSET', 'utf8'), |
|
33 | + 'collation' => $env($APPROOT, 'DB_COLLATION', 'utf8_unicode_ci'), |
|
34 | + 'prefix' => $env($APPROOT, 'DB_PREFIX', ''), |
|
35 | + 'port' => $env($APPROOT, 'DB_PORT', 3306), |
|
36 | 36 | ], |
37 | 37 | 'view' => [ |
38 | 38 | 'path' => '../app/View', |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | 'showSlimEnvironmentPanel' => 1, |
53 | 53 | 'showSlimRequestPanel' => 1, |
54 | 54 | 'showSlimResponsePanel' => 1, |
55 | - 'showSlimContainer' =>1 , |
|
55 | + 'showSlimContainer' =>1, |
|
56 | 56 | 'showEloquentORMPanel' => 1, |
57 | - 'showIdiormPanel' => 0,// > 0 mean you enable logging |
|
57 | + 'showIdiormPanel' => 0, // > 0 mean you enable logging |
|
58 | 58 | // but show or not panel you decide in browser in panel selector |
59 | - 'showDoctrinePanel' => 'em',// here also enable logging and you must enter your Doctrine container name |
|
59 | + 'showDoctrinePanel' => 'em', // here also enable logging and you must enter your Doctrine container name |
|
60 | 60 | // and also as above show or not panel you decide in browser in panel selector |
61 | 61 | 'showProfilerPanel' => 1, |
62 | 62 | 'showVendorVersionsPanel' => 1, |