From d7fbd3c4601b5412d7e82ab6efd16774ee6e9e3a Mon Sep 17 00:00:00 2001 From: DispatchCode Date: Thu, 1 Dec 2022 10:54:53 +0000 Subject: [PATCH] Fix styling --- src/Http/Livewire/Modals/ModalImage.php | 4 +++- src/LaravelShortcodePlusServiceProvider.php | 6 ++---- src/Parsers/Gallery.php | 5 ++--- src/Parsers/Image.php | 9 +++------ tests/TestCase.php | 4 ++-- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/Http/Livewire/Modals/ModalImage.php b/src/Http/Livewire/Modals/ModalImage.php index 1b2fe7c..60a4303 100644 --- a/src/Http/Livewire/Modals/ModalImage.php +++ b/src/Http/Livewire/Modals/ModalImage.php @@ -7,12 +7,14 @@ class ModalImage extends Component { public $show; + public $path; + public $title; protected $listeners = [ 'showImageModal' => 'showImageModal', - 'doCloseModal' => 'doCloseModal' + 'doCloseModal' => 'doCloseModal', ]; public function mount($path = null, $title = null) diff --git a/src/LaravelShortcodePlusServiceProvider.php b/src/LaravelShortcodePlusServiceProvider.php index 639eb9d..5450fab 100644 --- a/src/LaravelShortcodePlusServiceProvider.php +++ b/src/LaravelShortcodePlusServiceProvider.php @@ -29,10 +29,8 @@ public function configurePackage(Package $package): void public function packageRegistered() { - Route::prefix('shortcode-plus')->name('shortcode-plus.')->group(function () - { - Route::get('/style.css', function () - { + Route::prefix('shortcode-plus')->name('shortcode-plus.')->group(function () { + Route::get('/style.css', function () { $contents = view('shortcode-plus::css.shortcodes')->render(); return response($contents, 200)->header('Content-Type', 'text/css'); diff --git a/src/Parsers/Gallery.php b/src/Parsers/Gallery.php index a349796..581da49 100644 --- a/src/Parsers/Gallery.php +++ b/src/Parsers/Gallery.php @@ -2,9 +2,9 @@ namespace Murdercode\LaravelShortcodePlus\Parsers; +use Murdercode\LaravelShortcodePlus\Helpers\ConfigHelper; use Murdercode\LaravelShortcodePlus\Helpers\ModelHelper; use Murdercode\LaravelShortcodePlus\Helpers\Sanitizer; -use Murdercode\LaravelShortcodePlus\Helpers\ConfigHelper; class Gallery { @@ -14,8 +14,7 @@ public static function parse(string $content): string return preg_replace_callback( '/\[gallery title="(.*?)" images="(.*?)"\]/', - function ($matches) use ($enable_modal) - { + function ($matches) use ($enable_modal) { $title = Sanitizer::escapeQuotes($matches[1]); $imagesArray = explode(',', $matches[2]); diff --git a/src/Parsers/Image.php b/src/Parsers/Image.php index d2a951a..ce05890 100644 --- a/src/Parsers/Image.php +++ b/src/Parsers/Image.php @@ -2,11 +2,10 @@ namespace Murdercode\LaravelShortcodePlus\Parsers; +use Murdercode\LaravelShortcodePlus\Helpers\ConfigHelper; use Murdercode\LaravelShortcodePlus\Helpers\ModelHelper; use Murdercode\LaravelShortcodePlus\Helpers\Sanitizer; -use Murdercode\LaravelShortcodePlus\Helpers\ConfigHelper; - class Image { public static function parse(string $content): string @@ -15,16 +14,14 @@ public static function parse(string $content): string return preg_replace_callback( '/\[image id="(\d+)"(?:\scaption="(.*?)")?(?:(.*?))\]/', - function ($matches) use ($enable_modal) - { + function ($matches) use ($enable_modal) { $id_image = $matches[1]; $caption = $matches[2] ? Sanitizer::escapeQuotes($matches[2]) : null; $model = new ModelHelper('image'); $image = $model->getModelClass()::find($id_image); - if (!$image) - { + if (! $image) { return 'Image not found'; } diff --git a/tests/TestCase.php b/tests/TestCase.php index 4ab58c6..a3ecf83 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -14,10 +14,10 @@ protected function setUp(): void parent::setUp(); Factory::guessFactoryNamesUsing( - fn (string $modelName) => 'Murdercode\\LaravelShortcodePlus\\Database\\Factories\\' . class_basename($modelName) . 'Factory' + fn (string $modelName) => 'Murdercode\\LaravelShortcodePlus\\Database\\Factories\\'.class_basename($modelName).'Factory' ); - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); } protected function getPackageProviders($app)