function _cleanpager_rewrite_path in Clean Pagination 7
Same name and namespace in other branches
- 6 cleanpager.module \_cleanpager_rewrite_path()
Remove number at end of path
1 call to _cleanpager_rewrite_path()
- cleanpager_check_match in ./
cleanpager.module - Checks if the page should use clean pagination
File
- ./
cleanpager.module, line 383
Code
function _cleanpager_rewrite_path(&$pager = FALSE, &$page = NULL) {
static $q, $pr, $p;
global $_cleanpager_rewritten;
if (!isset($q)) {
$_cleanpager_rewritten = FALSE;
$q = _cleanpager_get_q();
$p = 0;
$pr = FALSE;
$q_array = explode('/', $q);
if (_cleanpager_is_pager_element(end($q_array))) {
$p = array_pop($q_array);
// Check for page/page_number
if (variable_get('cleanpager_use_additional_path', TRUE)) {
if (end($q_array) == CLEANPAGER_ADDITIONAL_PATH_VARIABLE) {
array_pop($q_array);
$pr = TRUE;
}
}
else {
$pr = TRUE;
}
if ($pr) {
// Store that the $_REQUEST and $_GET were rewritten.
$_cleanpager_rewritten = TRUE;
$q = implode('/', $q_array);
if (arg(0) == 'views' && arg(1) == 'ajax' && !empty($_POST['view_path'])) {
$_POST['view_path'] = $q;
$_POST['view_args'] = '';
$_POST['pager_element'] = $p;
}
else {
$_REQUEST['q'] = $_GET['q'] = $q;
}
$_REQUEST['page'] = $_GET['page'] = $p;
}
}
}
$page = $p;
$pager = $pr;
return $q;
}