@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | parent::__construct([ |
| 29 | 29 | 'title' => config('epesi.ui.title', 'EPESI'), |
| 30 | - 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
| 30 | + 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
| 31 | 31 | //TODO: set the skin from admin / user selection |
| 32 | - 'skin' => config('epesi.ui.skin', $this->skin), |
|
| 33 | - 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
|
| 34 | - 'catch_error_types' => config('app.debug') ? |
|
| 35 | - // debug mode |
|
| 36 | - E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : |
|
| 37 | - // production mode |
|
| 38 | - E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR |
|
| 32 | + 'skin' => config('epesi.ui.skin', $this->skin), |
|
| 33 | + 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
|
| 34 | + 'catch_error_types' => config('app.debug') ? |
|
| 35 | + // debug mode |
|
| 36 | + E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : |
|
| 37 | + // production mode |
|
| 38 | + E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR |
|
| 39 | 39 | ]); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -81,18 +81,18 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function renderException($exception) |
| 83 | 83 | { |
| 84 | - ob_start(); |
|
| 85 | - if ($exception instanceof TokenMismatchException) { |
|
| 86 | - $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
|
| 87 | - } |
|
| 88 | - elseif ($exception instanceof NotFoundHttpException) { |
|
| 89 | - $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
| 90 | - } |
|
| 91 | - else { |
|
| 92 | - $this->caughtException($exception); |
|
| 93 | - } |
|
| 84 | + ob_start(); |
|
| 85 | + if ($exception instanceof TokenMismatchException) { |
|
| 86 | + $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
|
| 87 | + } |
|
| 88 | + elseif ($exception instanceof NotFoundHttpException) { |
|
| 89 | + $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
| 90 | + } |
|
| 91 | + else { |
|
| 92 | + $this->caughtException($exception); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - return ob_get_clean(); |
|
| 95 | + return ob_get_clean(); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -102,20 +102,20 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function jsRedirectHomepage($message) |
| 104 | 104 | { |
| 105 | - $homepageUrl = url(HomePage\Models\HomePage::pathOfUser()); |
|
| 105 | + $homepageUrl = url(HomePage\Models\HomePage::pathOfUser()); |
|
| 106 | 106 | |
| 107 | - $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
| 107 | + $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
| 108 | 108 | |
| 109 | - if ($this->isJsonRequest()) { |
|
| 110 | - $this->outputResponseJSON([ |
|
| 111 | - 'success' => true, |
|
| 112 | - 'message' => $message, |
|
| 113 | - 'atkjs' => $redirectJs |
|
| 114 | - ]); |
|
| 115 | - } |
|
| 116 | - else { |
|
| 117 | - $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
|
| 118 | - } |
|
| 109 | + if ($this->isJsonRequest()) { |
|
| 110 | + $this->outputResponseJSON([ |
|
| 111 | + 'success' => true, |
|
| 112 | + 'message' => $message, |
|
| 113 | + 'atkjs' => $redirectJs |
|
| 114 | + ]); |
|
| 115 | + } |
|
| 116 | + else { |
|
| 117 | + $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
|
| 118 | + } |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function jsRedirectConfirm($page, $message) |
| 129 | 129 | { |
| 130 | - $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
| 130 | + $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
| 131 | 131 | |
| 132 | - return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
| 132 | + return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | //TODO: include below in app.js and app.css |
| 144 | 144 | |
| 145 | - $this->module()::requireCSS('epesi.css'); |
|
| 145 | + $this->module()::requireCSS('epesi.css'); |
|
| 146 | 146 | |
| 147 | 147 | $localJs = url('storage/system/js'); |
| 148 | 148 | $localCss = url('storage/system/css'); |
@@ -33,8 +33,7 @@ discard block |
||
| 33 | 33 | 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
| 34 | 34 | 'catch_error_types' => config('app.debug') ? |
| 35 | 35 | // debug mode |
| 36 | - E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : |
|
| 37 | - // production mode |
|
| 36 | + E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : // production mode |
|
| 38 | 37 | E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR |
| 39 | 38 | ]); |
| 40 | 39 | } |
@@ -149,35 +148,35 @@ discard block |
||
| 149 | 148 | |
| 150 | 149 | // jQuery |
| 151 | 150 | $urlJs = $this->cdn['jquery']?? $localJs; |
| 152 | - $this->requireJS($urlJs.'/jquery.min.js'); |
|
| 151 | + $this->requireJS($urlJs . '/jquery.min.js'); |
|
| 153 | 152 | |
| 154 | 153 | // Semantic UI |
| 155 | 154 | $urlJs = $this->cdn['semantic-ui']?? $localJs; |
| 156 | 155 | $urlCss = $this->cdn['semantic-ui']?? $localCss; |
| 157 | - $this->requireJS($urlJs.'/semantic.min.js'); |
|
| 158 | - $this->requireCSS($urlCss.'/semantic.min.css'); |
|
| 156 | + $this->requireJS($urlJs . '/semantic.min.js'); |
|
| 157 | + $this->requireCSS($urlCss . '/semantic.min.css'); |
|
| 159 | 158 | |
| 160 | 159 | // Serialize Object |
| 161 | 160 | $urlJs = $this->cdn['serialize-object']?? $localJs; |
| 162 | - $this->requireJS($urlJs.'/jquery.serialize-object.min.js'); |
|
| 161 | + $this->requireJS($urlJs . '/jquery.serialize-object.min.js'); |
|
| 163 | 162 | |
| 164 | 163 | // Agile UI |
| 165 | 164 | $urlJs = $this->cdn['atk']?? $localJs; |
| 166 | 165 | $urlCss = $this->cdn['atk']?? $localCss; |
| 167 | - $this->requireJS($urlJs.'/atkjs-ui.min.js'); |
|
| 168 | - $this->requireCSS($urlCss.'/agileui.css'); |
|
| 166 | + $this->requireJS($urlJs . '/atkjs-ui.min.js'); |
|
| 167 | + $this->requireCSS($urlCss . '/agileui.css'); |
|
| 169 | 168 | |
| 170 | 169 | // Draggable |
| 171 | 170 | $urlJs = $this->cdn['draggable']?? $localJs; |
| 172 | - $this->requireJS($urlJs.'/draggable.bundle.js'); |
|
| 171 | + $this->requireJS($urlJs . '/draggable.bundle.js'); |
|
| 173 | 172 | |
| 174 | 173 | // jQuery niceScroll |
| 175 | 174 | $urlJs = $this->cdn['jquery-nicescroll']?? $localJs; |
| 176 | - $this->requireJS($urlJs.'/jquery.nicescroll.js'); |
|
| 175 | + $this->requireJS($urlJs . '/jquery.nicescroll.js'); |
|
| 177 | 176 | |
| 178 | 177 | // clipboard.js |
| 179 | 178 | $urlJs = $this->cdn['clipboardjs']?? $localJs; |
| 180 | - $this->requireJS($urlJs.'/clipboard.js'); |
|
| 179 | + $this->requireJS($urlJs . '/clipboard.js'); |
|
| 181 | 180 | } |
| 182 | 181 | |
| 183 | 182 | /** |
@@ -260,7 +259,7 @@ discard block |
||
| 260 | 259 | |
| 261 | 260 | $key = md5(serialize(func_get_args())); |
| 262 | 261 | |
| 263 | - if (! isset($cache[$key])) { |
|
| 262 | + if (!isset($cache[$key])) { |
|
| 264 | 263 | $cache[$key] = true; |
| 265 | 264 | |
| 266 | 265 | parent::requireJS($url, $isAsync, $isDefer); |
@@ -84,11 +84,9 @@ discard block |
||
| 84 | 84 | ob_start(); |
| 85 | 85 | if ($exception instanceof TokenMismatchException) { |
| 86 | 86 | $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
| 87 | - } |
|
| 88 | - elseif ($exception instanceof NotFoundHttpException) { |
|
| 87 | + } elseif ($exception instanceof NotFoundHttpException) { |
|
| 89 | 88 | $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
| 90 | - } |
|
| 91 | - else { |
|
| 89 | + } else { |
|
| 92 | 90 | $this->caughtException($exception); |
| 93 | 91 | } |
| 94 | 92 | |
@@ -112,8 +110,7 @@ discard block |
||
| 112 | 110 | 'message' => $message, |
| 113 | 111 | 'atkjs' => $redirectJs |
| 114 | 112 | ]); |
| 115 | - } |
|
| 116 | - else { |
|
| 113 | + } else { |
|
| 117 | 114 | $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
| 118 | 115 | } |
| 119 | 116 | } |