KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
930B

  1. <?php
  2. class Paging extends Modules {
  3. public function __init() {
  4. $this->addAlias("markup_post_text", "makesafe", 8);
  5. $this->addAlias("markup_post_text", "split");
  6. }
  7. public function makesafe($text, $post) {
  8. return str_replace("<!--page-->", "(((page)))", $text);
  9. }
  10. public function split($text, $post) {
  11. if (!strpos($text, "(((page)))"))
  12. return $text;
  13. $text = preg_replace("/(<p>)?(\(\(\(page\)\)\))(<\/p>|<br \/>)?/", "\\2", $text);
  14. $split_pages = explode("(((page)))", $text);
  15. $post->paginated = new Paginator($split_pages, 1, (Route::current()->action == "view" ? "page" : "post_page"));
  16. return $post->paginated->result[0];
  17. }
  18. static function filter_post($post) {
  19. $post->next_page = false;
  20. $post->prev_page = false;
  21. }
  22. }