function _smart_paging_href_replace in Smart Paging 7
Same name and namespace in other branches
- 7.2 smart_paging.module \_smart_paging_href_replace()
Callback function for fixing ajax pagination links Similar to smart_paging_url_inbound_alter() but returns the fixed path with the page in the query string rather than in $_GET
1 string reference to '_smart_paging_href_replace'
- smart_paging_preprocess_views_view in ./
smart_paging.module - Intercept the views_view template to alter the pager links when AJAX is enabled
File
- ./
smart_paging.module, line 503 - Provides smart paging capability to Drupal contents.
Code
function _smart_paging_href_replace($match) {
$path = trim($match[1], '/');
$path_info = parse_url($path);
$args = arg(NULL, $path_info['path']);
$arg_count = count($args) - 1;
$page = $args[$arg_count];
$sub_page = $args[$arg_count - 1];
if ($arg_count > 2 && is_numeric($sub_page) && is_numeric($page)) {
if ($args[$arg_count - 2] == variable_get('smart_paging_path_prefix', 'page')) {
if (isset($path_info['query'])) {
parse_str($path_info['query'], $query_array);
}
$query_array['page'] = "{$sub_page},{$page}";
$path_info['query'] = http_build_query($query_array);
$alias = arg(NULL, $path_info['path']);
unset($alias[$arg_count - 2], $alias[$arg_count - 1], $alias[$arg_count]);
$path_info['path'] = implode('/', $alias);
}
}
return 'href="/' . $path_info['path'] . '?' . urldecode($path_info['query']) . '"';
}