public function nth($nth)
{
if (empty($nth)) {
$nth = 2;
}
$offset = 0;
$negative = false;
if ('even' == $nth) {
$nth = 2;
} elseif ('odd' == $nth) {
$negative = true;
$nth = 2;
} elseif (false !== strpos($nth, '+')) {
$nth = explode('+', $nth);
if (isset($nth[1])) {
$offset += (int) trim($nth[1]);
}
$nth = (int) trim($nth[0], ' n');
} elseif (false !== strpos($nth, '-')) {
$nth = explode('-', $nth);
if (isset($nth[1])) {
$offset -= (int) trim($nth[1]);
}
$nth = (int) trim($nth[0], ' n');
}
$nth = (int) $nth;
$offset = (int) $offset;
if (0 == $this->row_number % $nth + $offset) {
return $negative ? false : true;
}
return $negative ? true : false;
}