Invoke Parsedown directly
This commit is contained in:
parent
4efd787460
commit
9eae104402
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use App\Services\Plugin;
|
||||
use App\Services\PluginManager;
|
||||
use Illuminate\Http\Request;
|
||||
use Parsedown;
|
||||
|
||||
class PluginController extends Controller
|
||||
{
|
||||
@ -38,7 +39,8 @@ class PluginController extends Controller
|
||||
|
||||
$title = $plugin->title;
|
||||
$path = $plugin->getPath().'/'.$readmePath;
|
||||
$content = resolve('parsedown')->text(file_get_contents($path));
|
||||
$parsedown = new Parsedown();
|
||||
$content = $parsedown->text(file_get_contents($path));
|
||||
|
||||
return view('admin.plugin.readme', compact('content', 'title'));
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ use Auth;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Option;
|
||||
use Parsedown;
|
||||
use Session;
|
||||
use Storage;
|
||||
use View;
|
||||
@ -210,6 +211,8 @@ class SkinlibController extends Controller
|
||||
];
|
||||
$grid = $filter->apply('grid:skinlib.upload', $grid);
|
||||
|
||||
$parsedown = new Parsedown();
|
||||
|
||||
return view('skinlib.upload')
|
||||
->with('grid', $grid)
|
||||
->with('extra', [
|
||||
@ -223,7 +226,7 @@ class SkinlibController extends Controller
|
||||
'scorePublic' => intval(option('score_per_storage')),
|
||||
'scorePrivate' => intval(option('private_score_per_storage')),
|
||||
'award' => intval(option('score_award_per_texture')),
|
||||
'contentPolicy' => app('parsedown')->text(option_localized('content_policy')),
|
||||
'contentPolicy' => $parsedown->text(option_localized('content_policy')),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
use Parsedown;
|
||||
use Session;
|
||||
use URL;
|
||||
use View;
|
||||
@ -63,6 +64,8 @@ class UserController extends Controller
|
||||
];
|
||||
$grid = $filter->apply('grid:user.index', $grid);
|
||||
|
||||
$parsedown = new Parsedown();
|
||||
|
||||
return view('user.index')->with([
|
||||
'statistics' => [
|
||||
'players' => $this->calculatePercentageUsed($user->players->count(), option('score_per_player')),
|
||||
@ -74,7 +77,7 @@ class UserController extends Controller
|
||||
'player' => option('score_per_player'),
|
||||
'closet' => option('score_per_closet_item'),
|
||||
],
|
||||
'announcement' => app('parsedown')->text(option_localized('announcement')),
|
||||
'announcement' => $parsedown->text(option_localized('announcement')),
|
||||
'grid' => $grid,
|
||||
'extra' => ['unverified' => option('require_verification') && !$user->verified],
|
||||
]);
|
||||
@ -391,9 +394,11 @@ class UserController extends Controller
|
||||
});
|
||||
$notification->markAsRead();
|
||||
|
||||
$parsedown = new Parsedown();
|
||||
|
||||
return [
|
||||
'title' => $notification->data['title'],
|
||||
'content' => app('parsedown')->text($notification->data['content']),
|
||||
'content' => $parsedown->text($notification->data['content']),
|
||||
'time' => $notification->created_at->toDateTimeString(),
|
||||
];
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
$this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher'));
|
||||
$this->app->singleton(\App\Services\Option::class);
|
||||
$this->app->alias(\App\Services\Option::class, 'options');
|
||||
$this->app->singleton('parsedown', \Parsedown::class);
|
||||
$this->app->singleton(\App\Services\Webpack::class);
|
||||
$this->app->singleton(\App\Services\Filter::class);
|
||||
$this->app->singleton('oauth.providers', function () {
|
||||
|
@ -611,7 +611,7 @@ class UserControllerTest extends TestCase
|
||||
->get('/user/notifications/'.$notification->id)
|
||||
->assertJson([
|
||||
'title' => $notification->data['title'],
|
||||
'content' => app('parsedown')->text($notification->data['content']),
|
||||
'content' => (new Parsedown())->text($notification->data['content']),
|
||||
'time' => $notification->created_at->toDateTimeString(),
|
||||
]);
|
||||
$notification->refresh();
|
||||
|
Loading…
Reference in New Issue
Block a user