mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-14 21:58:14 +00:00
Code cleanup.
This commit is contained in:
@@ -12,11 +12,9 @@ class HelpController extends BaseController
|
||||
*/
|
||||
public function show($route)
|
||||
{
|
||||
// no valid route
|
||||
$helpText = '<p>There is no help for this route!</p>';
|
||||
$helpTitle = 'Help';
|
||||
if (!Route::has($route)) {
|
||||
$helpText = '<p>There is no help for this route!</p>';
|
||||
$helpTitle = 'Help';
|
||||
|
||||
return Response::json(['title' => $helpTitle, 'text' => $helpText]);
|
||||
}
|
||||
|
||||
@@ -28,25 +26,17 @@ class HelpController extends BaseController
|
||||
return Response::json(['title' => $helpTitle, 'text' => $helpText]);
|
||||
}
|
||||
|
||||
// get the help-content from Github:
|
||||
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/' . e($route) . '.md';
|
||||
try {
|
||||
$content = file_get_contents($uri);
|
||||
} catch (ErrorException $e) {
|
||||
$content = '<p>There is no help for this route.</p>';
|
||||
}
|
||||
if (strlen($content) > 0) {
|
||||
$helpText = \Michelf\Markdown::defaultTransform($content);
|
||||
$helpTitle = $route;
|
||||
$helpText = \Michelf\Markdown::defaultTransform($content);
|
||||
$helpTitle = $route;
|
||||
|
||||
Cache::put('help.' . $route . '.text', $helpText, 10080); // a week.
|
||||
Cache::put('help.' . $route . '.title', $helpTitle, 10080);
|
||||
|
||||
return Response::json(['title' => $helpTitle, 'text' => $helpText]);
|
||||
}
|
||||
|
||||
$helpText = '<p>There is no help for this route!</p>';
|
||||
$helpTitle = 'Help';
|
||||
Cache::put('help.' . $route . '.text', $helpText, 10080); // a week.
|
||||
Cache::put('help.' . $route . '.title', $helpTitle, 10080);
|
||||
|
||||
return Response::json(['title' => $helpTitle, 'text' => $helpText]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user