@@ -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,23 +1,23 @@ discard block |
||
1 | 1 | <?php |
2 | -define('__APP_ROOT__',__DIR__ . '/../') ; |
|
3 | -require __APP_ROOT__.'bootstrap/bootstrap.php'; |
|
4 | -require __APP_ROOT__.'vendor/autoload.php'; |
|
2 | +define('__APP_ROOT__', __DIR__ . '/../'); |
|
3 | +require __APP_ROOT__ . 'bootstrap/bootstrap.php'; |
|
4 | +require __APP_ROOT__ . 'vendor/autoload.php'; |
|
5 | 5 | |
6 | 6 | $env = new \Core\Helpers\Env(); |
7 | 7 | defined('DS') || define('DS', DIRECTORY_SEPARATOR); |
8 | 8 | |
9 | 9 | /*Dynamic containers in services*/ |
10 | -$config_dir = scandir(__APP_ROOT__.'/config/'); |
|
10 | +$config_dir = scandir(__APP_ROOT__ . '/config/'); |
|
11 | 11 | $ex_config_folders = array('..', '.'); |
12 | -$filesInConfig = array_diff($config_dir,$ex_config_folders); |
|
12 | +$filesInConfig = array_diff($config_dir, $ex_config_folders); |
|
13 | 13 | if (!isset($configs)) { |
14 | 14 | $configs = array(); |
15 | 15 | } |
16 | -$i=0; |
|
17 | -foreach($filesInConfig as $config_file){ |
|
18 | - if($config_file === 'phpmig.php'){continue;} |
|
19 | - $file[$i] = include_once __APP_ROOT__.'config/'.$config_file; |
|
20 | - if(is_array($file[$i])){ |
|
16 | +$i = 0; |
|
17 | +foreach ($filesInConfig as $config_file) { |
|
18 | + if ($config_file === 'phpmig.php') {continue; } |
|
19 | + $file[$i] = include_once __APP_ROOT__ . 'config/' . $config_file; |
|
20 | + if (is_array($file[$i])) { |
|
21 | 21 | $configs = array_merge($configs, $file[$i]); |
22 | 22 | $i++; |
23 | 23 | } |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | $config['settings'] = $configs; |
28 | -require __APP_ROOT__.'core/Functions/general_helpers.php'; |
|
28 | +require __APP_ROOT__ . 'core/Functions/general_helpers.php'; |
|
29 | 29 | |
30 | 30 | $app = new \Core\App($config); |
31 | -if($config['settings']['app']['debug'] && !$config['settings']['tracy']['active']){ |
|
31 | +if ($config['settings']['app']['debug'] && !$config['settings']['tracy']['active']) { |
|
32 | 32 | error_reporting(-1); |
33 | 33 | ini_set('display_errors', 1); |
34 | 34 | ini_set('display_startup_errors', 1); |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | |
38 | 38 | use SlimFacades\Facade; |
39 | 39 | // get container app |
40 | -require __APP_ROOT__.'bootstrap/dependencies.php'; |
|
41 | -require __APP_ROOT__.'bootstrap/routes.php'; |
|
42 | -require __APP_ROOT__.'core/Functions/helpers.php'; |
|
43 | -if(php_sapi_name() != 'cli') { |
|
44 | - if($config['settings']['app']['debug'] && (int)$config['settings']['tracy']['active']){ |
|
40 | +require __APP_ROOT__ . 'bootstrap/dependencies.php'; |
|
41 | +require __APP_ROOT__ . 'bootstrap/routes.php'; |
|
42 | +require __APP_ROOT__ . 'core/Functions/helpers.php'; |
|
43 | +if (php_sapi_name() != 'cli') { |
|
44 | + if ($config['settings']['app']['debug'] && (int) $config['settings']['tracy']['active']) { |
|
45 | 45 | Tracy\Debugger::enable(Tracy\Debugger::DEVELOPMENT, $config['settings']['tracy']['path']); |
46 | 46 | } |
47 | 47 | Facade::setFacadeApplication($app); |
48 | 48 | |
49 | - require __APP_ROOT__.'bootstrap/middlewares.php'; |
|
49 | + require __APP_ROOT__ . 'bootstrap/middlewares.php'; |
|
50 | 50 | |
51 | 51 | $app->run(); |
52 | 52 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | 'm' => [400,250,70], |
11 | 11 | 'l' => [800,600,80], |
12 | 12 | 'thumb' => [250, 250,80,true], |
13 | - ], |
|
13 | + ], |
|
14 | 14 | ], |
15 | 15 | 'minquality' => 200 // kamtar az in width va height nemigirim |
16 | 16 | ] |
@@ -7,9 +7,9 @@ |
||
7 | 7 | 'quality' => 100, |
8 | 8 | 'user_photo' => [ |
9 | 9 | 'dimensions' => [ |
10 | - 'm' => [400,250,70], |
|
11 | - 'l' => [800,600,80], |
|
12 | - 'thumb' => [250, 250,80,true], |
|
10 | + 'm' => [400, 250, 70], |
|
11 | + 'l' => [800, 600, 80], |
|
12 | + 'thumb' => [250, 250, 80, true], |
|
13 | 13 | ], |
14 | 14 | ], |
15 | 15 | 'minquality' => 200 // kamtar az in width va height nemigirim |
@@ -7,70 +7,70 @@ |
||
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['settings']['image']['upload_path']); |
|
55 | + $dest = realpath('.' . $GLOBALS['settings']['image']['upload_path']); |
|
56 | 56 | |
57 | 57 | $defaultDimensions = $dimensions ? $dimensions : $GLOBALS['settings']['image'][$type]['dimensions']; |
58 | 58 | foreach ($defaultDimensions as $keys=>$dimension) |
59 | 59 | { |
60 | - if(!isset($dimension[2])) $dimension[2] = 100; // quality |
|
61 | - if(!isset($dimension[4])) $dimension[4] = 'jpg'; // quality |
|
60 | + if (!isset($dimension[2])) $dimension[2] = 100; // quality |
|
61 | + if (!isset($dimension[4])) $dimension[4] = 'jpg'; // quality |
|
62 | 62 | |
63 | - $destUrl = $dest.'/'.getImageDirName($photoid,$type).getImageFileName($photoid,$keys,$type); |
|
63 | + $destUrl = $dest . '/' . getImageDirName($photoid, $type) . getImageFileName($photoid, $keys, $type); |
|
64 | 64 | |
65 | - if(isset($dimension[3]) && $dimension[3] == true){ |
|
66 | - $image = $this->zoomCrop($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
|
65 | + if (isset($dimension[3]) && $dimension[3] == true) { |
|
66 | + $image = $this->zoomCrop($src, trim($destUrl), $dimension[0], $dimension[1], $dimension[2], $dimension[4]); |
|
67 | 67 | }else { |
68 | - $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
|
68 | + $image = $this->cropResize($src, trim($destUrl), $dimension[0], $dimension[1], $dimension[2], $dimension[4]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
72 | 72 | |
73 | - if($image ){ |
|
73 | + if ($image) { |
|
74 | 74 | $cropedArr[$keys] = $src; |
75 | 75 | } |
76 | 76 | } |
@@ -57,14 +57,20 @@ |
||
57 | 57 | $defaultDimensions = $dimensions ? $dimensions : $GLOBALS['settings']['image'][$type]['dimensions']; |
58 | 58 | foreach ($defaultDimensions as $keys=>$dimension) |
59 | 59 | { |
60 | - if(!isset($dimension[2])) $dimension[2] = 100; // quality |
|
61 | - if(!isset($dimension[4])) $dimension[4] = 'jpg'; // quality |
|
60 | + if(!isset($dimension[2])) { |
|
61 | + $dimension[2] = 100; |
|
62 | + } |
|
63 | + // quality |
|
64 | + if(!isset($dimension[4])) { |
|
65 | + $dimension[4] = 'jpg'; |
|
66 | + } |
|
67 | + // quality |
|
62 | 68 | |
63 | 69 | $destUrl = $dest.'/'.getImageDirName($photoid,$type).getImageFileName($photoid,$keys,$type); |
64 | 70 | |
65 | 71 | if(isset($dimension[3]) && $dimension[3] == true){ |
66 | 72 | $image = $this->zoomCrop($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
67 | - }else { |
|
73 | + } else { |
|
68 | 74 | $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
69 | 75 | } |
70 | 76 |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $setting = Config::get('settings.auth'); |
55 | 55 | if(1 || $setting['2step']){ |
56 | 56 | return $this->twoStepAuth($loginField,$password); |
57 | - }else{ |
|
57 | + } else{ |
|
58 | 58 | if ($this->checkPass($password,$user->password)) { |
59 | 59 | $_SESSION['user']['user_id'] = $user->id; |
60 | 60 | $_SESSION['user']['mobile'] = $user->mobile; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'type'=>'success', |
63 | 63 | 'message'=> 'Logined', |
64 | 64 | ]; |
65 | - }else{ |
|
65 | + } else{ |
|
66 | 66 | return [ |
67 | 67 | 'type'=>'error', |
68 | 68 | 'message'=> 'password mismatch', |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'type'=>'success', |
99 | 99 | 'message'=> 'Logined', |
100 | 100 | ]; |
101 | - }else{ |
|
101 | + } else{ |
|
102 | 102 | return [ |
103 | 103 | 'type'=>'error', |
104 | 104 | 'message'=> 'problem!', |
@@ -17,21 +17,21 @@ discard block |
||
17 | 17 | { |
18 | 18 | public function user() |
19 | 19 | { |
20 | - if(!isset($_SESSION['user']) && json_decode($_COOKIE['user'],true) !== null){ |
|
21 | - $_SESSION['user'] = json_decode($_COOKIE['user'],true); |
|
20 | + if (!isset($_SESSION['user']) && json_decode($_COOKIE['user'], true) !== null) { |
|
21 | + $_SESSION['user'] = json_decode($_COOKIE['user'], true); |
|
22 | 22 | } |
23 | 23 | return UserDataAccess::getUserById(isset($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : 0); |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function hasRole($roleName) |
27 | 27 | { |
28 | - if(!self::check()){ |
|
28 | + if (!self::check()) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | - $userRoles = UserDataAccess::getUserRoles(isset($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : 0); |
|
31 | + $userRoles = UserDataAccess::getUserRoles(isset($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : 0); |
|
32 | 32 | $hasAccess = false; |
33 | - foreach ($userRoles as $role){ |
|
34 | - if($role->name == $roleName){ |
|
33 | + foreach ($userRoles as $role) { |
|
34 | + if ($role->name == $roleName) { |
|
35 | 35 | $hasAccess = true; |
36 | 36 | break; |
37 | 37 | } |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | public function check() |
44 | 44 | { |
45 | - if(!isset($_SESSION['user']) && json_decode($_COOKIE['user'],true) !== null){ |
|
46 | - $_SESSION['user'] = json_decode($_COOKIE['user'],true); |
|
45 | + if (!isset($_SESSION['user']) && json_decode($_COOKIE['user'], true) !== null) { |
|
46 | + $_SESSION['user'] = json_decode($_COOKIE['user'], true); |
|
47 | 47 | } |
48 | 48 | return isset($_SESSION['user']['user_id']); |
49 | 49 | } |
50 | 50 | |
51 | - public function attempt(string $loginField,string $password) |
|
51 | + public function attempt(string $loginField, string $password) |
|
52 | 52 | { |
53 | 53 | $user = UserDataAccess::getUserLoginField($loginField); |
54 | 54 | if (!$user) { |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | ]; |
59 | 59 | } |
60 | 60 | $setting = Config::get('settings.auth'); |
61 | - if(1 || $setting['2step']){ |
|
62 | - return $this->twoStepAuth($loginField,$password); |
|
63 | - }else{ |
|
64 | - if ($this->checkPass($password,$user->password)) { |
|
61 | + if (1 || $setting['2step']) { |
|
62 | + return $this->twoStepAuth($loginField, $password); |
|
63 | + }else { |
|
64 | + if ($this->checkPass($password, $user->password)) { |
|
65 | 65 | $_SESSION['user']['user_id'] = $user->id; |
66 | 66 | $_SESSION['user']['mobile'] = $user->mobile; |
67 | 67 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'type'=>'success', |
76 | 76 | 'message'=> 'Logined', |
77 | 77 | ]; |
78 | - }else{ |
|
78 | + }else { |
|
79 | 79 | return [ |
80 | 80 | 'type'=>'error', |
81 | 81 | 'message'=> 'password mismatch', |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | |
91 | 91 | |
92 | 92 | |
93 | - public function checkPass($password,$database_pass) |
|
93 | + public function checkPass($password, $database_pass) |
|
94 | 94 | { |
95 | - if($database_pass == $password){ |
|
95 | + if ($database_pass == $password) { |
|
96 | 96 | return true; |
97 | 97 | } |
98 | 98 | return false; |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | |
103 | - public function twoStepAuth(string $loginField,string $password) |
|
103 | + public function twoStepAuth(string $loginField, string $password) |
|
104 | 104 | { |
105 | 105 | $user = UserDataAccess::getUserLoginField($loginField); |
106 | - if(UserDataAccess::checkToken($password,$loginField)){ |
|
106 | + if (UserDataAccess::checkToken($password, $loginField)) { |
|
107 | 107 | $_SESSION['user']['user_id'] = $user->id; |
108 | 108 | $_SESSION['user']['mobile'] = $user->mobile; |
109 | 109 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'type'=>'success', |
118 | 118 | 'message'=> 'Logined', |
119 | 119 | ]; |
120 | - }else{ |
|
120 | + }else { |
|
121 | 121 | return [ |
122 | 122 | 'type'=>'error', |
123 | 123 | 'message'=> 'problem!', |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | return [ |
3 | 3 | // Renderer settings |
4 | - 'view' => [ |
|
5 | - 'blade_template_path' => '../app/View/', // String or array of multiple paths |
|
6 | - 'blade_cache_path' => '../app/View/cache', // Mandatory by default, though could probably turn caching off for development |
|
7 | - 'template' => 'blade', // template name |
|
8 | - ], |
|
4 | + 'view' => [ |
|
5 | + 'blade_template_path' => '../app/View/', // String or array of multiple paths |
|
6 | + 'blade_cache_path' => '../app/View/cache', // Mandatory by default, though could probably turn caching off for development |
|
7 | + 'template' => 'blade', // template name |
|
8 | + ], |
|
9 | 9 | ]; |
10 | 10 | ?> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if($config['settings']['app']['debug'] && $config['settings']['tracy']['active']) { |
|
2 | +if ($config['settings']['app']['debug'] && $config['settings']['tracy']['active']) { |
|
3 | 3 | $app->add(new RunTracy\Middlewares\TracyMiddleware($app)); |
4 | 4 | } |
5 | 5 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | 'displayErrorDetails' => true, |
6 | 6 | 'addContentLengthHeader' => true, |
7 | 7 | 'determineRouteBeforeAppMiddleware' => true, |
8 | - 'debug'=>true , |
|
8 | + 'debug'=>true, |
|
9 | 9 | 'image' => [ |
10 | 10 | 'dir' => $APPROOT . '/public/uploads' |
11 | 11 | ], |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | $container = $app->getContainer(); |
6 | 6 | |
7 | 7 | /* database connection */ |
8 | -$container['db'] = function ($container) { |
|
8 | +$container['db'] = function($container) { |
|
9 | 9 | $db = $container['settings']['databases']['db']; |
10 | 10 | $pdo = new PDO("mysql:host=" . $db['host'] . ";dbname=" . $db['database'], |
11 | 11 | $db['username'], $db['password']); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // |
54 | 54 | |
55 | 55 | |
56 | -$container['generalErrorHandler'] = function ($container) { |
|
56 | +$container['generalErrorHandler'] = function($container) { |
|
57 | 57 | return new \Core\Handlers\GeneralErrorHandler($container); |
58 | 58 | }; |
59 | 59 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | // }; |
67 | 67 | |
68 | 68 | // Service factory for the ORM |
69 | -$container['validator'] = function () { |
|
69 | +$container['validator'] = function() { |
|
70 | 70 | return new App\Validation\Validator(); |
71 | 71 | }; |
72 | 72 | |
73 | 73 | |
74 | -$container['eloquent'] = function ($container) { |
|
74 | +$container['eloquent'] = function($container) { |
|
75 | 75 | $db = $container['settings']['databases']['db']; |
76 | 76 | |
77 | 77 | $capsule = new \Illuminate\Database\Capsule\Manager; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $capsule->bootEloquent(); |
91 | 91 | |
92 | 92 | // monolog |
93 | -$container['logger'] = function ($container) { |
|
93 | +$container['logger'] = function($container) { |
|
94 | 94 | $settings = $container->get('settings')['app']['logger']; |
95 | 95 | $logger = new Monolog\Logger($settings['name']); |
96 | 96 | $logger->pushProcessor(new Monolog\Processor\UidProcessor()); |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | }; |
100 | 100 | |
101 | 101 | // not found handler |
102 | -$container['notFoundHandler'] = function ($container) { |
|
103 | - return function (\Slim\Http\Request $request, \Slim\Http\Response $response) use ($container) { |
|
102 | +$container['notFoundHandler'] = function($container) { |
|
103 | + return function(\Slim\Http\Request $request, \Slim\Http\Response $response) use ($container) { |
|
104 | 104 | return $container['view']->render($response->withStatus(404), '404'); |
105 | 105 | }; |
106 | 106 | }; |
@@ -110,22 +110,22 @@ discard block |
||
110 | 110 | $translator = new \Core\Translator\Translator($container); |
111 | 111 | $translator->init(); |
112 | 112 | |
113 | -$container['translator'] = function () use ($translator) { |
|
113 | +$container['translator'] = function() use ($translator) { |
|
114 | 114 | return $translator; |
115 | 115 | }; |
116 | 116 | |
117 | 117 | |
118 | 118 | // Register provider |
119 | -$container['flash'] = function () { |
|
119 | +$container['flash'] = function() { |
|
120 | 120 | return new \Slim\Flash\Messages(); |
121 | 121 | }; |
122 | 122 | |
123 | 123 | |
124 | 124 | // |
125 | -$container['session'] = function ($container) { |
|
125 | +$container['session'] = function($container) { |
|
126 | 126 | $setting_session_driver = $container['settings']['session']['driver'] ?? 'session'; |
127 | 127 | $sessionOBJ = new \Core\Services\Session(); |
128 | - $session = $sessionOBJ->init($setting_session_driver) ; |
|
128 | + $session = $sessionOBJ->init($setting_session_driver); |
|
129 | 129 | return $session; |
130 | 130 | }; |
131 | 131 | |
@@ -136,17 +136,17 @@ discard block |
||
136 | 136 | |
137 | 137 | |
138 | 138 | // Register Blade View helper |
139 | -$container['view'] = function ($container) { |
|
139 | +$container['view'] = function($container) { |
|
140 | 140 | $messages = $container->flash->getMessages(); |
141 | 141 | |
142 | - if(!is_dir('../app/View/cache')){ |
|
142 | + if (!is_dir('../app/View/cache')) { |
|
143 | 143 | @mkdir('../app/View/cache'); |
144 | 144 | } |
145 | 145 | |
146 | 146 | |
147 | 147 | $viewSettings = $container['settings']['view']; |
148 | 148 | return new \Slim\Views\Blade( |
149 | - [$viewSettings['blade_template_path'].$viewSettings['template']], |
|
149 | + [$viewSettings['blade_template_path'] . $viewSettings['template']], |
|
150 | 150 | $viewSettings['blade_cache_path'], |
151 | 151 | null, |
152 | 152 | [ |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | }; |
159 | 159 | |
160 | 160 | // Register Blade View helper |
161 | -$container['json'] = function ($container) { |
|
161 | +$container['json'] = function($container) { |
|
162 | 162 | return new \Core\Handlers\JsonHandler(); |
163 | 163 | }; |
164 | 164 | |
165 | -$app->getContainer()['view']->getRenderer()->getCompiler()->directive('helloWorld', function(){ |
|
165 | +$app->getContainer()['view']->getRenderer()->getCompiler()->directive('helloWorld', function() { |
|
166 | 166 | |
167 | 167 | return "<?php echo 'Hello Directive'; ?>"; |
168 | 168 | }); |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | |
177 | 177 | |
178 | 178 | /*Dynamic containers in services*/ |
179 | -$dir = scandir(__APP_ROOT__.'/core/Services/'); |
|
179 | +$dir = scandir(__APP_ROOT__ . '/core/Services/'); |
|
180 | 180 | $ex_folders = array('..', '.'); |
181 | -$filesInServices = array_diff($dir,$ex_folders); |
|
181 | +$filesInServices = array_diff($dir, $ex_folders); |
|
182 | 182 | |
183 | -foreach($filesInServices as $service){ |
|
184 | - $content = preg_replace('/.php/','',$service); |
|
185 | - $container[$content] = function () use ($content){ |
|
186 | - $class = '\\Core\\Services\\'.$content ; |
|
183 | +foreach ($filesInServices as $service) { |
|
184 | + $content = preg_replace('/.php/', '', $service); |
|
185 | + $container[$content] = function() use ($content){ |
|
186 | + $class = '\\Core\\Services\\' . $content; |
|
187 | 187 | return new $class(); |
188 | 188 | }; |
189 | 189 | } |
@@ -9,11 +9,11 @@ |
||
9 | 9 | 'showSlimEnvironmentPanel' => 1, |
10 | 10 | 'showSlimRequestPanel' => 1, |
11 | 11 | 'showSlimResponsePanel' => 1, |
12 | - 'showSlimContainer' =>1 , |
|
12 | + 'showSlimContainer' =>1, |
|
13 | 13 | 'showEloquentORMPanel' => 1, |
14 | - 'showIdiormPanel' => 1,// > 0 mean you enable logging |
|
14 | + 'showIdiormPanel' => 1, // > 0 mean you enable logging |
|
15 | 15 | // but show or not panel you decide in browser in panel selector |
16 | - 'showDoctrinePanel' => 'em',// here also enable logging and you must enter your Doctrine container name |
|
16 | + 'showDoctrinePanel' => 'em', // here also enable logging and you must enter your Doctrine container name |
|
17 | 17 | // and also as above show or not panel you decide in browser in panel selector |
18 | 18 | 'showProfilerPanel' => 1, |
19 | 19 | 'showVendorVersionsPanel' => 1, |