@@ -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 | |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | if (!function_exists('latex2Image')) { |
206 | 206 | function latex2Image($content) |
207 | 207 | { |
208 | - $callback = function ($matches) use (&$patch, &$display) { |
|
209 | - [$url,$width,$height]=LatexModel::info("$patch$matches[1]$patch"); |
|
208 | + $callback=function($matches) use (&$patch, &$display) { |
|
209 | + [$url, $width, $height]=LatexModel::info("$patch$matches[1]$patch"); |
|
210 | 210 | return "<img src=\"$url\" style=\"display: $display;\" class=\"rendered-tex\" width=\"$width\" height=\"$height\">"; |
211 | 211 | }; |
212 | - $patch = '$'; |
|
213 | - $display = 'inline-block'; |
|
214 | - $content = preg_replace_callback('/\\$\\$\\$(.*?)\\$\\$\\$/', $callback, $content); |
|
215 | - $content = preg_replace_callback('/\\\\\\((.*?)\\\\\\)/', $callback, $content); |
|
216 | - $patch = '$$'; |
|
217 | - $display = 'block'; |
|
218 | - $content = preg_replace_callback('/\\$\\$(.*?)\\$\\$/', $callback, $content); |
|
219 | - $content = preg_replace_callback('/\\\\\\[(.*?)\\\\\\]/', $callback, $content); |
|
212 | + $patch='$'; |
|
213 | + $display='inline-block'; |
|
214 | + $content=preg_replace_callback('/\\$\\$\\$(.*?)\\$\\$\\$/', $callback, $content); |
|
215 | + $content=preg_replace_callback('/\\\\\\((.*?)\\\\\\)/', $callback, $content); |
|
216 | + $patch='$$'; |
|
217 | + $display='block'; |
|
218 | + $content=preg_replace_callback('/\\$\\$(.*?)\\$\\$/', $callback, $content); |
|
219 | + $content=preg_replace_callback('/\\\\\\[(.*?)\\\\\\]/', $callback, $content); |
|
220 | 220 | return $content; |
221 | 221 | } |
222 | 222 | } |
223 | 223 | \ No newline at end of file |