@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | if (!$this->property('disableUrlMapping') && \Request::isMethod('get') && $searchTerm) { |
| 215 | 215 | // add ?cats[] query string |
| 216 | 216 | $cats = Input::get('cat'); |
| 217 | - $query = http_build_query(['cat' => $cats]); |
|
| 217 | + $query = http_build_query([ 'cat' => $cats ]); |
|
| 218 | 218 | $query = preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', $query); |
| 219 | - $query = !empty($query) ? '?' . $query : ''; |
|
| 219 | + $query = !empty($query) ? '?'.$query : ''; |
|
| 220 | 220 | |
| 221 | 221 | return Redirect::to( |
| 222 | 222 | $this->currentPageUrl([ |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $currentPage = $this->property('pageNumber'); |
| 237 | 237 | |
| 238 | 238 | if ($currentPage > ($lastPage = $this->posts->lastPage()) && $currentPage > 1) { |
| 239 | - return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage])); |
|
| 239 | + return Redirect::to($this->currentPageUrl([ $pageNumberParam => $lastPage ])); |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | } |
@@ -269,20 +269,20 @@ discard block |
||
| 269 | 269 | protected function listPosts() |
| 270 | 270 | { |
| 271 | 271 | // Filter posts |
| 272 | - $posts = BlogPost::where(function ($q) { |
|
| 272 | + $posts = BlogPost::where(function($q) { |
|
| 273 | 273 | $q->where('title', 'LIKE', "%{$this->searchTerm}%") |
| 274 | 274 | ->orWhere('content', 'LIKE', "%{$this->searchTerm}%") |
| 275 | 275 | ->orWhere('excerpt', 'LIKE', "%{$this->searchTerm}%"); |
| 276 | 276 | }); |
| 277 | 277 | |
| 278 | 278 | if (!is_null($this->property('includeCategories'))) { |
| 279 | - $posts = $posts->whereHas('categories', function ($q) { |
|
| 279 | + $posts = $posts->whereHas('categories', function($q) { |
|
| 280 | 280 | $q->whereIn('id', $this->property('includeCategories')); |
| 281 | 281 | }); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | if (!is_null($this->property('excludeCategories'))) { |
| 285 | - $posts = $posts->whereDoesntHave('categories', function ($q) { |
|
| 285 | + $posts = $posts->whereDoesntHave('categories', function($q) { |
|
| 286 | 286 | $q->whereIn('id', $this->property('excludeCategories')); |
| 287 | 287 | }); |
| 288 | 288 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | // filter categories |
| 291 | 291 | $cat = Input::get('cat'); |
| 292 | 292 | if ($cat) { |
| 293 | - $cat = is_array($cat) ? $cat : [$cat]; |
|
| 293 | + $cat = is_array($cat) ? $cat : [ $cat ]; |
|
| 294 | 294 | $posts->filterCategories($cat); |
| 295 | 295 | } |
| 296 | 296 | |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | /* |
| 305 | 305 | * Add a "url" helper attribute for linking to each post and category |
| 306 | 306 | */ |
| 307 | - $posts->each(function ($post) { |
|
| 307 | + $posts->each(function($post) { |
|
| 308 | 308 | $post->setUrl($this->postPage, $this->controller); |
| 309 | 309 | |
| 310 | - $post->categories->each(function ($category) { |
|
| 310 | + $post->categories->each(function($category) { |
|
| 311 | 311 | $category->setUrl($this->categoryPage, $this->controller); |
| 312 | 312 | }); |
| 313 | 313 | |
@@ -327,11 +327,11 @@ discard block |
||
| 327 | 327 | $searchTerm = preg_quote($this->searchTerm, '|'); |
| 328 | 328 | |
| 329 | 329 | // apply highlight |
| 330 | - $post->title = preg_replace('|(' . $searchTerm . ')|iu', '<mark>$1</mark>', $post->title); |
|
| 331 | - $post->excerpt = preg_replace('|(' . $searchTerm . ')|iu', '<mark>$1</mark>', $post->excerpt); |
|
| 330 | + $post->title = preg_replace('|('.$searchTerm.')|iu', '<mark>$1</mark>', $post->title); |
|
| 331 | + $post->excerpt = preg_replace('|('.$searchTerm.')|iu', '<mark>$1</mark>', $post->excerpt); |
|
| 332 | 332 | |
| 333 | 333 | $post->content_html = preg_replace( |
| 334 | - '~(?![^<>]*>)(' . $searchTerm . ')~ismu', |
|
| 334 | + '~(?![^<>]*>)('.$searchTerm.')~ismu', |
|
| 335 | 335 | '<mark>$1</mark>', |
| 336 | 336 | $post->content_html |
| 337 | 337 | ); |