|
@@ 340-353 (lines=14) @@
|
| 337 |
|
* @param array $options |
| 338 |
|
* @return string |
| 339 |
|
*/ |
| 340 |
|
public function getNextPostLink($title = '{title}', $sameType = true, $sameTerm = false, $options = []) |
| 341 |
|
{ |
| 342 |
|
if ($nextPost = $this->getNextPost($sameType, $sameTerm)) { |
| 343 |
|
$title = preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) use ($nextPost) { |
| 344 |
|
$attribute = $matches[1]; |
| 345 |
|
|
| 346 |
|
return $nextPost->{$attribute}; |
| 347 |
|
}, $title); |
| 348 |
|
|
| 349 |
|
return Html::a($title, $nextPost->url, $options); |
| 350 |
|
} |
| 351 |
|
|
| 352 |
|
return ''; |
| 353 |
|
} |
| 354 |
|
|
| 355 |
|
/** |
| 356 |
|
* @param bool $sameType |
|
@@ 396-409 (lines=14) @@
|
| 393 |
|
* @param array $options |
| 394 |
|
* @return string |
| 395 |
|
*/ |
| 396 |
|
public function getPrevPostLink($title = '{title}', $sameType = true, $sameTerm = false, $options = []) |
| 397 |
|
{ |
| 398 |
|
if ($prevPost = $this->getPrevPost($sameType, $sameTerm)) { |
| 399 |
|
$title = preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) use ($prevPost) { |
| 400 |
|
$attribute = $matches[1]; |
| 401 |
|
|
| 402 |
|
return $prevPost->{$attribute}; |
| 403 |
|
}, $title); |
| 404 |
|
|
| 405 |
|
return Html::a($title, $prevPost->url, $options); |
| 406 |
|
} |
| 407 |
|
|
| 408 |
|
return ''; |
| 409 |
|
} |
| 410 |
|
|
| 411 |
|
/** |
| 412 |
|
* Generate excerpt of post model. |