@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function up(): void |
16 | 16 | { |
17 | - Schema::create('blog_etc_posts', static function (Blueprint $table) { |
|
17 | + Schema::create('blog_etc_posts', static function(Blueprint $table) { |
|
18 | 18 | $table->increments('id'); |
19 | 19 | |
20 | 20 | $table->string('slug')->unique(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $table->timestamps(); |
37 | 37 | }); |
38 | 38 | |
39 | - Schema::create('blog_etc_categories', static function (Blueprint $table) { |
|
39 | + Schema::create('blog_etc_categories', static function(Blueprint $table) { |
|
40 | 40 | $table->increments('id'); |
41 | 41 | |
42 | 42 | $table->string('category_name')->nullable(); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | }); |
49 | 49 | |
50 | 50 | // linking table: |
51 | - Schema::create('blog_etc_post_categories', static function (Blueprint $table) { |
|
51 | + Schema::create('blog_etc_post_categories', static function(Blueprint $table) { |
|
52 | 52 | $table->increments('id'); |
53 | 53 | |
54 | 54 | $table->unsignedInteger('blog_etc_post_id')->index(); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $table->foreign('blog_etc_category_id')->references('id')->on('blog_etc_categories')->onDelete('cascade'); |
59 | 59 | }); |
60 | 60 | |
61 | - Schema::create('blog_etc_comments', static function (Blueprint $table) { |
|
61 | + Schema::create('blog_etc_comments', static function(Blueprint $table) { |
|
62 | 62 | $table->increments('id'); |
63 | 63 | |
64 | 64 | $table->unsignedInteger('blog_etc_post_id')->index(); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -Route::group(['middleware' => ['web'], 'namespace' => '\WebDevEtc\BlogEtc\Controllers'], static function () { |
|
3 | +Route::group(['middleware' => ['web'], 'namespace' => '\WebDevEtc\BlogEtc\Controllers'], static function() { |
|
4 | 4 | /* The main public facing blog routes - show all posts, view a category, rss feed, view a single post, also the add comment route */ |
5 | - Route::group(['prefix' => config('blogetc.blog_prefix', 'blog')], static function () { |
|
5 | + Route::group(['prefix' => config('blogetc.blog_prefix', 'blog')], static function() { |
|
6 | 6 | Route::get('/', 'PostsController@index')->name('blogetc.index'); |
7 | 7 | |
8 | 8 | Route::get('/search', 'PostsController@search')->name('blogetc.search'); |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | |
14 | 14 | Route::get('/{blogPostSlug}', 'PostsController@show')->name('blogetc.single'); |
15 | 15 | |
16 | - Route::group(['middleware' => 'throttle:10,3'], static function () { |
|
16 | + Route::group(['middleware' => 'throttle:10,3'], static function() { |
|
17 | 17 | Route::post('save_comment/{blogPostSlug}', 'CommentsController@store')->name('blogetc.comments.add_new_comment'); |
18 | 18 | }); |
19 | 19 | }); |
20 | 20 | |
21 | 21 | /* Admin backend routes - CRUD for posts, categories, and approving/deleting submitted comments */ |
22 | - Route::group(['prefix' => config('blogetc.admin_prefix', 'blog_admin')], static function () { |
|
22 | + Route::group(['prefix' => config('blogetc.admin_prefix', 'blog_admin')], static function() { |
|
23 | 23 | Route::get('/', 'Admin\ManagePostsController@index')->name('blogetc.admin.index'); |
24 | 24 | |
25 | 25 | Route::get('/add_post', 'Admin\ManagePostsController@create')->name('blogetc.admin.create_post'); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | Route::patch('/edit_post/{blogPostId}', 'Admin\ManagePostsController@update')->name('blogetc.admin.update_post'); |
32 | 32 | |
33 | - Route::group(['prefix' => 'image_uploads'], static function () { |
|
33 | + Route::group(['prefix' => 'image_uploads'], static function() { |
|
34 | 34 | Route::get('/', 'BlogEtcImageUploadController@index')->name('blogetc.admin.images.all'); |
35 | 35 | |
36 | 36 | Route::get('/upload', 'BlogEtcImageUploadController@create')->name('blogetc.admin.images.upload'); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | Route::delete('/delete_post/{blogPostId}', 'Admin\ManagePostsController@destroy')->name('blogetc.admin.destroy_post'); |
42 | 42 | |
43 | - Route::group(['prefix' => 'comments'], static function () { |
|
43 | + Route::group(['prefix' => 'comments'], static function() { |
|
44 | 44 | Route::get('/', 'Admin\ManageCommentsController@index')->name('blogetc.admin.comments.index'); |
45 | 45 | |
46 | 46 | Route::patch('/{commentId}', 'Admin\ManageCommentsController@approve')->name('blogetc.admin.comments.approve'); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | Route::delete('/{commentId}', 'Admin\ManageCommentsController@destroy')->name('blogetc.admin.comments.delete'); |
49 | 49 | }); |
50 | 50 | |
51 | - Route::group(['prefix' => 'categories'], static function () { |
|
51 | + Route::group(['prefix' => 'categories'], static function() { |
|
52 | 52 | Route::get('/', 'Admin\ManageCategoriesController@index')->name('blogetc.admin.categories.index'); |
53 | 53 | |
54 | 54 | Route::get('/add_category', 'Admin\ManageCategoriesController@create')->name('blogetc.admin.categories.create_category'); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | $categoryCount = \WebDevEtc\BlogEtc\Models\Post::count(); |
13 | 13 | |
14 | - echo $categoryCount . ' ' . str_plural('Post', $categoryCount); |
|
14 | + echo $categoryCount.' '.str_plural('Post', $categoryCount); |
|
15 | 15 | |
16 | 16 | ?>)</span> |
17 | 17 | </h6> |
@@ -3,6 +3,6 @@ |
||
3 | 3 | use Illuminate\Database\Eloquent\Model; |
4 | 4 | use WebDevEtc\BlogEtc\Services\CommentsService; |
5 | 5 | |
6 | -return static function (/* @scrutinizer ignore-unused */ ?Model $user) { |
|
6 | +return static function(/* @scrutinizer ignore-unused */ ?Model $user) { |
|
7 | 7 | return CommentsService::COMMENT_TYPE_BUILT_IN === config('blogetc.comments.type_of_comments_to_show'); |
8 | 8 | }; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // However it will NOT delete the .jpg file on your file server. |
67 | 67 | // I recommend that you only change the enabled field before any images have been uploaded! |
68 | 68 | |
69 | - 'image_large' => [ // this key must start with 'image_'. This is what the DB column must be named |
|
69 | + 'image_large' => [// this key must start with 'image_'. This is what the DB column must be named |
|
70 | 70 | // width in pixels |
71 | 71 | 'w' => 1000, |
72 | 72 | //height |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // if true then we will crop and resize to exactly w/h. If false then it will maintain proportions, with a max width of 'w' and max height of 'h' |
81 | 81 | 'crop' => true, |
82 | 82 | ], |
83 | - 'image_medium' => [ // this key must start with 'image_'. This is what the DB column must be named |
|
83 | + 'image_medium' => [// this key must start with 'image_'. This is what the DB column must be named |
|
84 | 84 | // width in pixels |
85 | 85 | 'w' => 600, |
86 | 86 | //height |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | // if true then we will crop and resize to exactly w/h. If false then it will maintain proportions, with a max width of 'w' and max height of 'h'. If you use these images as part of your website template then you should probably have this to true. |
95 | 95 | 'crop' => true, |
96 | 96 | ], |
97 | - 'image_thumbnail' => [ // this key must start with 'image_'. This is what the DB column must be named |
|
97 | + 'image_thumbnail' => [// this key must start with 'image_'. This is what the DB column must be named |
|
98 | 98 | 'w' => 150, // width in pixels |
99 | 99 | 'h' => 150, //height |
100 | 100 | 'basic_key' => 'thumbnail', // same as the main key, but WITHOUT 'image_'. |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | 'rssfeed' => [ |
141 | 141 | 'should_shorten_text' => true, // boolean. Default: true. Should we shorten the text in rss feed? |
142 | 142 | 'text_limit' => 100, // max length of description text in the rss feed |
143 | - 'posts_to_show_in_rss_feed' => 10, // how many posts should we show in the rss feed |
|
143 | + 'posts_to_show_in_rss_feed' => 10, // how many posts should we show in the rss feed |
|
144 | 144 | 'cache_in_minutes' => 60, // how long (in minutes) to cache the RSS blog feed for. |
145 | 145 | 'description' => 'Our blog post RSS feed', //description for the RSS feed |
146 | 146 | 'language' => 'en', // see https://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes |
@@ -24,14 +24,14 @@ |
||
24 | 24 | // } |
25 | 25 | // }; |
26 | 26 | |
27 | - $show_error_if_has_value = static function ($attribute, $value, $fail) { |
|
27 | + $show_error_if_has_value = static function($attribute, $value, $fail) { |
|
28 | 28 | if ($value) { |
29 | 29 | // return $fail if this had a value... |
30 | 30 | return $fail($attribute.' must be empty'); |
31 | 31 | } |
32 | 32 | }; |
33 | 33 | |
34 | - $disabled_use_view_file = static function ($attribute, $value, $fail) { |
|
34 | + $disabled_use_view_file = static function($attribute, $value, $fail) { |
|
35 | 35 | if ($value) { |
36 | 36 | // return $fail if this had a value |
37 | 37 | return $fail('The use of custom view files is not enabled for this site, so you cannot submit a value for it'); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $smallest = null; |
36 | 36 | $smallest_size = -1; |
37 | 37 | foreach ($uploadedPhoto->uploaded_images as $file_key => $file) { |
38 | - $id = 'uploaded_' . ($uploadedPhoto->id) . '_' . $file_key; ?> |
|
38 | + $id = 'uploaded_'.($uploadedPhoto->id).'_'.$file_key; ?> |
|
39 | 39 | |
40 | 40 | <div class="col-md-12"> |
41 | 41 | <h6 class="text-center mt-3"> |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $this->legacyProcessUploadedImages($request, $new_blog_post); |
60 | 60 | |
61 | - if (! $new_blog_post->posted_at) { |
|
61 | + if (!$new_blog_post->posted_at) { |
|
62 | 62 | $new_blog_post->posted_at = Carbon::now(); |
63 | 63 | } |
64 | 64 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | foreach ((array) config('blogetc.image_sizes') as $size => $image_size_details) { |
123 | - if (! isset($sizes_to_upload[$size]) || ! $sizes_to_upload[$size] || ! $image_size_details['enabled']) { |
|
123 | + if (!isset($sizes_to_upload[$size]) || !$sizes_to_upload[$size] || !$image_size_details['enabled']) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function legacyProcessUploadedImages(LegacyGetImageFileInterface $request, Post $new_blog_post) |
151 | 151 | { |
152 | - if (! config('blogetc.image_upload_enabled')) { |
|
152 | + if (!config('blogetc.image_upload_enabled')) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | if (isset($image_size_details['crop']) && $image_size_details['crop']) { |
201 | 201 | $resizedImage = $resizedImage->fit($w, $h); |
202 | 202 | } else { |
203 | - $resizedImage = $resizedImage->resize($w, $h, static function ($constraint) { |
|
203 | + $resizedImage = $resizedImage->resize($w, $h, static function($constraint) { |
|
204 | 204 | $constraint->aspectRatio(); |
205 | 205 | }); |
206 | 206 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | protected function check_image_destination_path_is_writable($path) |
248 | 248 | { |
249 | - if (! is_writable($path)) { |
|
249 | + if (!is_writable($path)) { |
|
250 | 250 | throw new RuntimeException("Image destination path is not writable ($path)"); |
251 | 251 | } |
252 | 252 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | $attempt = str_slug($base.$suffix.$wh).$ext; |
279 | 279 | |
280 | - if (! File::exists($this->image_destination_path().'/'.$attempt)) { |
|
280 | + if (!File::exists($this->image_destination_path().'/'.$attempt)) { |
|
281 | 281 | // filename doesn't exist, let's use it! |
282 | 282 | return $attempt; |
283 | 283 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | protected function generate_base_filename(string $suggested_title) |
294 | 294 | { |
295 | 295 | $base = substr($suggested_title, 0, 100); |
296 | - if (! $base) { |
|
296 | + if (!$base) { |
|
297 | 297 | // if we have an empty string then we should use a random one: |
298 | 298 | $base = 'image-'.str_random(5); |
299 | 299 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | if (isset($imageSizeDetails['crop']) && $imageSizeDetails['crop']) { |
411 | 411 | $resizedImage = $resizedImage->fit($w, $h); |
412 | 412 | } else { |
413 | - $resizedImage = $resizedImage->resize($w, $h, static function (Constraint $constraint) { |
|
413 | + $resizedImage = $resizedImage->resize($w, $h, static function(Constraint $constraint) { |
|
414 | 414 | $constraint->aspectRatio(); |
415 | 415 | }); |
416 | 416 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | |
459 | 459 | $attempt = Str::slug($base.$suffix.$wh).$ext; |
460 | 460 | |
461 | - if (! $this::disk()->exists($this->imageDestinationPath().'/'.$attempt)) { |
|
461 | + if (!$this::disk()->exists($this->imageDestinationPath().'/'.$attempt)) { |
|
462 | 462 | return $attempt; |
463 | 463 | } |
464 | 464 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Illuminate\Database\Eloquent\Model; |
4 | 4 | use WebDevEtc\BlogEtc\Exceptions\BlogEtcAuthGateNotImplementedException; |
5 | 5 | |
6 | -return static function (/** @scrutinizer ignore-unused */ ?Model $user) { |
|
6 | +return static function(/** @scrutinizer ignore-unused */ ?Model $user) { |
|
7 | 7 | // Do not copy the internals for this gate, as it provides backwards compatibility. |
8 | 8 | if (!$user) { |
9 | 9 | return false; |