You are here

protected function Pagination::parseSection in Pagination (Node) 7

Same name and namespace in other branches
  1. 6 pagination.module \Pagination::parseSection()

Handle splitting of sections in odd edge cases.

Parameters

$text: The text to parse.

$matches: An array of matches.

$start: An integer corresponding to the start tag position within the text.

$end: An integer corresponding to the end tag position within the text.

1 call to Pagination::parseSection()
Pagination::parseText in includes/Pagination.inc
Handle pagination depending on pagination style

File

includes/Pagination.inc, line 372

Class

Pagination
Handles all the pagination logic

Code

protected function parseSection(&$text, $matches, $start, $end) {
  $open = isset($matches[$start]) && !isset($matches[$end]) ? $matches[$start] : '';
  $close = isset($matches[$end]) && $matches[$end] && isset($matches[$start]) && !$matches[$start] ? $matches[$end] : '';
  $split = strpos($text, $matches[0]);
  $section = substr($text, 0, $split) . $close;
  $text = $open . substr($text, $split + strlen($matches[0]));
  return $section;
}