You are here

function cleanpager_init in Clean Pagination 6

Same name and namespace in other branches
  1. 5 cleanpager.module \cleanpager_init()
  2. 7 cleanpager.module \cleanpager_init()

Implementation of hook_init().

File

./cleanpager.module, line 68

Code

function cleanpager_init() {

  // The current url looks like /test?page=1 but it should have clean pager
  if (variable_get('cleanpager_redirect_301', FALSE) && isset($_GET['page']) && ($path = cleanpager_path()) && drupal_match_path($path, variable_get('cleanpager_pages', ''))) {
    if (variable_get('cleanpager_use_additional_path', TRUE)) {
      $path .= '/' . CLEANPAGER_ADDITIONAL_PATH_VARIABLE;
    }
    $path .= '/' . $_GET['page'];
    drupal_goto($path, NULL, NULL, 301);
  }
  elseif (cleanpager_check_match()) {
    if (variable_get('cleanpager_use_seo_links', '') == 1) {
      drupal_add_js(drupal_get_path('module', 'cleanpager') . '/cleanpager.js');
    }
  }
}