@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function render($request, Exception $exception) |
48 | 48 | { |
49 | - if(!env("APP_DEBUG") && $request->is('api/*')) { |
|
49 | + if (!env("APP_DEBUG") && $request->is('api/*')) { |
|
50 | 50 | return response(json_encode([ |
51 | 51 | 'success' => false, |
52 | 52 | 'message' => 'Server Error', |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'msg' => 'Server Error', |
57 | 57 | 'data'=>[] |
58 | 58 | ] |
59 | - ]),500)->header('Content-Type','application/json'); |
|
59 | + ]), 500)->header('Content-Type', 'application/json'); |
|
60 | 60 | }; |
61 | 61 | return parent::render($request, $exception); |
62 | 62 | } |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | -if (! function_exists('babel_path')) { |
|
67 | +if (!function_exists('babel_path')) { |
|
68 | 68 | /** |
69 | 69 | * Get the path to the application folder. |
70 | 70 | * |
71 | 71 | * @param string $path |
72 | 72 | * @return string |
73 | 73 | */ |
74 | - function babel_path($path = '') |
|
74 | + function babel_path($path='') |
|
75 | 75 | { |
76 | 76 | return app('path').DIRECTORY_SEPARATOR.'Babel'.($path ? DIRECTORY_SEPARATOR.$path : $path); |
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | -if (! function_exists('glob_recursive')) { |
|
80 | +if (!function_exists('glob_recursive')) { |
|
81 | 81 | /** |
82 | 82 | * Find pathnames matching a pattern recursively. |
83 | 83 | * |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | * @param int $flags Valid flags: GLOB_MARK |
86 | 86 | * @return array|false an array containing the matched files/directories, an empty array if no file matched or false on error. |
87 | 87 | */ |
88 | - function glob_recursive($pattern, $flags = 0) |
|
88 | + function glob_recursive($pattern, $flags=0) |
|
89 | 89 | { |
90 | - $files = glob($pattern, $flags); |
|
91 | - foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { |
|
92 | - $files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags)); |
|
90 | + $files=glob($pattern, $flags); |
|
91 | + foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { |
|
92 | + $files=array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags)); |
|
93 | 93 | } |
94 | 94 | return $files; |
95 | 95 | } |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | function delFile($dirName) |
124 | 124 | { |
125 | 125 | if (file_exists($dirName) && $handle=opendir($dirName)) { |
126 | - while (false!==($item = readdir($handle))) { |
|
127 | - if ($item!= "." && $item != "..") { |
|
126 | + while (false!==($item=readdir($handle))) { |
|
127 | + if ($item!="." && $item!="..") { |
|
128 | 128 | if (file_exists($dirName.'/'.$item) && is_dir($dirName.'/'.$item)) { |
129 | 129 | delFile($dirName.'/'.$item); |
130 | 130 | } else { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | if (!function_exists('convertMarkdownToHtml')) { |
143 | 143 | function convertMarkdownToHtml($md) |
144 | 144 | { |
145 | - return is_string($md)?Markdown::convertToHtml($md):''; |
|
145 | + return is_string($md) ?Markdown::convertToHtml($md) : ''; |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $periods[$j]=__("helper.time.singular.$periods[$j]"); |
187 | 187 | } |
188 | 188 | |
189 | - return __("helper.time.formatter",[ |
|
189 | + return __("helper.time.formatter", [ |
|
190 | 190 | "time" => $difference, |
191 | 191 | "unit" => $periods[$j], |
192 | 192 | "tense" => $tense, |
@@ -211,18 +211,18 @@ discard block |
||
211 | 211 | if (!function_exists('latex2Image')) { |
212 | 212 | function latex2Image($content) |
213 | 213 | { |
214 | - $callback = function ($matches) use (&$patch, &$display) { |
|
215 | - [$url,$width,$height]=LatexModel::info("$patch$matches[1]$patch"); |
|
214 | + $callback=function($matches) use (&$patch, &$display) { |
|
215 | + [$url, $width, $height]=LatexModel::info("$patch$matches[1]$patch"); |
|
216 | 216 | return "<img src=\"$url\" style=\"display: $display;\" class=\"rendered-tex\" width=\"$width\" height=\"$height\">"; |
217 | 217 | }; |
218 | - $patch = '$'; |
|
219 | - $display = 'inline-block'; |
|
220 | - $content = preg_replace_callback('/\\$\\$\\$(.*?)\\$\\$\\$/', $callback, $content); |
|
221 | - $content = preg_replace_callback('/\\\\\\((.*?)\\\\\\)/', $callback, $content); |
|
222 | - $patch = '$$'; |
|
223 | - $display = 'block'; |
|
224 | - $content = preg_replace_callback('/\\$\\$(.*?)\\$\\$/', $callback, $content); |
|
225 | - $content = preg_replace_callback('/\\\\\\[(.*?)\\\\\\]/', $callback, $content); |
|
218 | + $patch='$'; |
|
219 | + $display='inline-block'; |
|
220 | + $content=preg_replace_callback('/\\$\\$\\$(.*?)\\$\\$\\$/', $callback, $content); |
|
221 | + $content=preg_replace_callback('/\\\\\\((.*?)\\\\\\)/', $callback, $content); |
|
222 | + $patch='$$'; |
|
223 | + $display='block'; |
|
224 | + $content=preg_replace_callback('/\\$\\$(.*?)\\$\\$/', $callback, $content); |
|
225 | + $content=preg_replace_callback('/\\\\\\[(.*?)\\\\\\]/', $callback, $content); |
|
226 | 226 | return $content; |
227 | 227 | } |
228 | 228 | } |