Permalink Manager Lite - Version 2.0.5.3.1

Version Description

  • New filter - "permalink_manager_empty_tag_replacement"
  • Fix for term placeholder tags in taxonomies permastructures
  • Page pagination improvement (404 error page for non-existing pages)
  • New settings field for pagination redirect
Download this release

Release Info

Developer mbis
Plugin Icon 128x128 Permalink Manager Lite
Version 2.0.5.3.1
Comparing to
See all releases

Code changes from version 2.0.5.3 to 2.0.5.3.1

README.txt CHANGED
@@ -7,7 +7,7 @@ Tags: urls, permalinks, custom permalinks, url, permalink, woocommerce permalink
7
  Requires at least: 4.0
8
  Requires PHP: 5.4
9
  Tested up to: 4.9
10
- Stable tag: 2.0.5.3
11
 
12
  Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
13
 
@@ -98,11 +98,17 @@ A. Currently there is no 100% guarantee that Permalink Manager will work correct
98
 
99
  == Changelog ==
100
 
 
 
 
 
 
 
101
  = 2.0.5.3 =
102
  * Hotfix for redirects - redirect chain no longer occurs (WPML)
103
- * Better support for trailing slashes
104
- * Now $wp_query->is_404() is set to false when custom URI is detected
105
  * Hotfix for ACF custom fields in terms
 
106
 
107
  = 2.0.5.2.2 =
108
  * Hotfix for admin requests (+ compatibility with WooCommerce TM Extra Product Options)
7
  Requires at least: 4.0
8
  Requires PHP: 5.4
9
  Tested up to: 4.9
10
+ Stable tag: 2.0.5.3.1
11
 
12
  Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
13
 
98
 
99
  == Changelog ==
100
 
101
+ = 2.0.5.3.1 =
102
+ * New filter - "permalink_manager_empty_tag_replacement"
103
+ * Fix for term placeholder tags in taxonomies permastructures
104
+ * Page pagination improvement (404 error page for non-existing pages)
105
+ * New settings field for pagination redirect
106
+
107
  = 2.0.5.3 =
108
  * Hotfix for redirects - redirect chain no longer occurs (WPML)
109
+ * Now $wp_query->is_404() is set to false when custom URI is detected
 
110
  * Hotfix for ACF custom fields in terms
111
+ * Fix for trailing slash (in admin dashboard), also the trailing slashes are removed from permalinks containing GET parameters or hastags (often used by 3rd party plugins)
112
 
113
  = 2.0.5.2.2 =
114
  * Hotfix for admin requests (+ compatibility with WooCommerce TM Extra Product Options)
includes/core/permalink-manager-admin-functions.php CHANGED
@@ -524,6 +524,9 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
524
  $permalink = get_permalink($row['ID']);
525
  }
526
 
 
 
 
527
  $main_content .= "<tr{$alternate_class}>";
528
  $main_content .= '<td class="row-title column-primary" data-colname="' . __('Title', 'permalink-manager') . '">' . $row['item_title'] . "<a target=\"_blank\" href=\"{$permalink}\"><span class=\"small\">{$permalink}</span></a>" . '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __('Show more details', 'permalink-manager') . '</span></button></td>';
529
  $main_content .= '<td data-colname="' . __('Old URI', 'permalink-manager') . '">' . urldecode($row['old_uri']) . '</td>';
@@ -603,36 +606,46 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
603
  $html .= "<div class=\"inside\">";
604
 
605
  // 4. Custom URI
 
 
 
 
 
 
 
606
  $html .= sprintf("<div><label for=\"custom_uri\" class=\"strong\">%s %s</label><span>%s</span></div>",
607
  __("Current URI", "permalink-manager"),
608
  ($element->ID) ? Permalink_Manager_Admin_Functions::help_tooltip(__("The custom URI can be edited only if 'Auto-update the URI' feature is not enabled.", "permalink-manager")) : "",
609
- Permalink_Manager_Admin_Functions::generate_option_field("custom_uri", array("extra_atts" => "data-default=\"{$default_uri}\"", "input_class" => "widefat custom_uri", "value" => urldecode($uri)))
610
  );
611
 
612
- // 5. Auto-update URI
613
- if(!empty($auto_update_choices)) {
614
- $html .= sprintf("<div><label for=\"auto_auri\" class=\"strong\">%s %s</label><span>%s</span></div>",
615
- __("Auto-update the URI", "permalink-manager"),
616
- Permalink_Manager_Admin_Functions::help_tooltip(__("If enabled, the 'Current URI' field will be automatically changed to 'Default URI' (displayed below) after the post is saved or updated.", "permalink-manager")),
617
- Permalink_Manager_Admin_Functions::generate_option_field("auto_update_uri", array("type" => "select", "input_class" => "widefat auto_update", "value" => $auto_update_val, "choices" => $auto_update_choices))
618
- );
619
- }
620
-
621
- // 6. Default URI
622
- $html .= sprintf(
623
- "<div class=\"default-permalink-row columns-container\"><span class=\"column-3_4\"><strong>%s:</strong> %s</span><span class=\"column-1_4\"><a href=\"#\" class=\"restore-default\"><span class=\"dashicons dashicons-image-rotate\"></span> %s</a></span></div>",
624
- __("Default URI", "permalink-manager"), esc_html($default_uri),
625
- __("Restore to Default URI", "permalink-manager")
626
- );
627
 
628
- // 7. Native URI info
629
- if(!empty($permalink_manager_options['general']['redirect']) && ((!empty($element->post_status) && in_array($element->post_status, array('auto-draft', 'trash', 'draft'))) == false)) {
630
  $html .= sprintf(
631
- "<div class=\"default-permalink-row columns-container\"><span><strong>%s</strong> <a href=\"%s\">%s</a></span></div>",
632
- __("Automatic redirect for native URI enabled:", "permalink-manager"),
633
- "{$home_with_prefix}{$native_uri}",
634
- urldecode($native_uri)
635
  );
 
 
 
 
 
 
 
 
 
 
636
  }
637
 
638
  // 8. Custom redirects
524
  $permalink = get_permalink($row['ID']);
525
  }
526
 
527
+ // Decode permalink
528
+ $permalink = urldecode(urldecode($permalink));
529
+
530
  $main_content .= "<tr{$alternate_class}>";
531
  $main_content .= '<td class="row-title column-primary" data-colname="' . __('Title', 'permalink-manager') . '">' . $row['item_title'] . "<a target=\"_blank\" href=\"{$permalink}\"><span class=\"small\">{$permalink}</span></a>" . '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __('Show more details', 'permalink-manager') . '</span></button></td>';
532
  $main_content .= '<td data-colname="' . __('Old URI', 'permalink-manager') . '">' . urldecode($row['old_uri']) . '</td>';
606
  $html .= "<div class=\"inside\">";
607
 
608
  // 4. Custom URI
609
+ if(get_option('page_on_front') == $id) {
610
+ $custom_uri_field = Permalink_Manager_Admin_Functions::generate_option_field("custom_uri", array("type" => "hidden", "extra_atts" => "data-default=\"{$default_uri}\"", "input_class" => "widefat custom_uri", "value" => urldecode($uri)));
611
+ $custom_uri_field .= __("The custom URI cannot be edited on frontpage.", "permalink-manager");
612
+ } else {
613
+ $custom_uri_field = Permalink_Manager_Admin_Functions::generate_option_field("custom_uri", array("extra_atts" => "data-default=\"{$default_uri}\"", "input_class" => "widefat custom_uri", "value" => urldecode($uri)));
614
+ }
615
+
616
  $html .= sprintf("<div><label for=\"custom_uri\" class=\"strong\">%s %s</label><span>%s</span></div>",
617
  __("Current URI", "permalink-manager"),
618
  ($element->ID) ? Permalink_Manager_Admin_Functions::help_tooltip(__("The custom URI can be edited only if 'Auto-update the URI' feature is not enabled.", "permalink-manager")) : "",
619
+ $custom_uri_field
620
  );
621
 
622
+ // Three fields that should be hidden on front-page
623
+ if(get_option('page_on_front') != $id) {
624
+ // 5. Auto-update URI
625
+ if(!empty($auto_update_choices)) {
626
+ $html .= sprintf("<div><label for=\"auto_auri\" class=\"strong\">%s %s</label><span>%s</span></div>",
627
+ __("Auto-update the URI", "permalink-manager"),
628
+ Permalink_Manager_Admin_Functions::help_tooltip(__("If enabled, the 'Current URI' field will be automatically changed to 'Default URI' (displayed below) after the post is saved or updated.", "permalink-manager")),
629
+ Permalink_Manager_Admin_Functions::generate_option_field("auto_update_uri", array("type" => "select", "input_class" => "widefat auto_update", "value" => $auto_update_val, "choices" => $auto_update_choices))
630
+ );
631
+ }
 
 
 
 
 
632
 
633
+ // 6. Default URI
 
634
  $html .= sprintf(
635
+ "<div class=\"default-permalink-row columns-container\"><span class=\"column-3_4\"><strong>%s:</strong> %s</span><span class=\"column-1_4\"><a href=\"#\" class=\"restore-default\"><span class=\"dashicons dashicons-image-rotate\"></span> %s</a></span></div>",
636
+ __("Default URI", "permalink-manager"), esc_html($default_uri),
637
+ __("Restore to Default URI", "permalink-manager")
 
638
  );
639
+
640
+ // 7. Native URI info
641
+ if(!empty($permalink_manager_options['general']['redirect']) && ((!empty($element->post_status) && in_array($element->post_status, array('auto-draft', 'trash', 'draft'))) == false)) {
642
+ $html .= sprintf(
643
+ "<div class=\"default-permalink-row columns-container\"><span><strong>%s</strong> <a href=\"%s\">%s</a></span></div>",
644
+ __("Automatic redirect for native URI enabled:", "permalink-manager"),
645
+ "{$home_with_prefix}{$native_uri}",
646
+ urldecode($native_uri)
647
+ );
648
+ }
649
  }
650
 
651
  // 8. Custom redirects
includes/core/permalink-manager-core-functions.php CHANGED
@@ -10,31 +10,42 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
10
  }
11
 
12
  function init_hooks() {
 
 
13
  // Trigger only in front-end
14
  if(!is_admin()) {
15
  // Use the URIs set in this plugin
16
  add_filter( 'request', array($this, 'detect_post'), 0, 1 );
17
 
18
- // Trailing slashes
19
- add_filter( 'permalink_manager_filter_final_term_permalink', array($this, 'control_trailing_slashes'), 9);
20
- add_filter( 'permalink_manager_filter_final_post_permalink', array($this, 'control_trailing_slashes'), 9);
21
- add_filter( 'permalink_manager_filter_post_sample_permalink', array($this, 'control_trailing_slashes'), 9);
22
-
23
  // Redirect from old URIs to new URIs + adjust canonical redirect settings
24
  add_action( 'template_redirect', array($this, 'new_uri_redirect_and_404'), 1);
25
  add_action( 'wp', array($this, 'adjust_canonical_redirect'), 0, 1);
26
 
27
  // Case insensitive permalinks
28
- add_action( 'parse_request', array($this, 'case_insensitive_permalinks'), 0);
29
- add_action( 'parse_request', array($this, 'fix_pagination_pages'), 0);
 
 
 
 
 
30
  }
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  /**
34
  * The most important Permalink Manager function
35
  */
36
  function detect_post($query) {
37
- global $wpdb, $wp, $wp_rewrite, $permalink_manager_uris, $wp_filter, $permalink_manager_options, $pm_item_id;
38
 
39
  // Check if any custom URI is used and we are not in WP-Admin dashboard
40
  if(!(is_array($permalink_manager_uris)) || empty($query)) return $query;
@@ -67,8 +78,8 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
67
  $uri_parts['endpoint'] = (!empty($regex_parts[2])) ? $regex_parts[2] : "";
68
  $uri_parts['endpoint_value'] = (!empty($regex_parts[3])) ? $regex_parts[3] : "";
69
 
70
- // Allow to filter the results by third-parties
71
- $uri_parts = apply_filters('permalink-manager-detect-uri', $uri_parts, $request_url, $endpoints);
72
 
73
  // Stop the function if $uri_parts is empty
74
  if(empty($uri_parts)) return $query;
@@ -274,7 +285,7 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
274
  * 7. Set global with detected item id
275
  */
276
  if(!empty($element_id)) {
277
- $pm_item_id = $element_id;
278
 
279
  // Make the redirects more clever - see new_uri_redirect_and_404() method
280
  $query['do_not_redirect'] = 1;
@@ -287,7 +298,7 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
287
  if(isset($_REQUEST['debug_url'])) {
288
  $debug_info['old_query_vars'] = $old_query;
289
  $debug_info['new_query_vars'] = $query;
290
- $debug_info['detected_id'] = $pm_item_id;
291
 
292
  $debug_txt = json_encode($debug_info);
293
  $debug_txt = "<textarea style=\"width:100%;height:300px\">{$debug_txt}</textarea>";
@@ -303,8 +314,15 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
303
  function control_trailing_slashes($permalink) {
304
  global $permalink_manager_options;
305
 
 
 
 
306
  $trailing_slash_setting = (!empty($permalink_manager_options['general']['trailing_slashes'])) ? $permalink_manager_options['general']['trailing_slashes'] : "";
307
 
 
 
 
 
308
  if(in_array($trailing_slash_setting, array(1, 10))) {
309
  $permalink = trailingslashit($permalink);
310
  } else if(in_array($trailing_slash_setting, array(2, 20))) {
@@ -327,15 +345,23 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
327
  if(empty($post->ID)) { return; }
328
 
329
  // 3. Check if pagination is detected
330
- if(empty($wp_query->query_vars['page'])) { return; }
 
331
 
332
  // 4. Count post pages
333
  $num_pages = substr_count(strtolower($post->post_content), '<!--nextpage-->') + 1;
334
- if($wp_query->query_vars['page'] > $num_pages) {
335
- $wp_query->set('p', null);
336
- $wp_query->set('pagename', null);
337
- $wp_query->set('page_id', null);
 
338
  $wp_query->set_404();
 
 
 
 
 
 
339
  }
340
  }
341
 
@@ -343,13 +369,13 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
343
  * Redirects
344
  */
345
  function new_uri_redirect_and_404() {
346
- global $wp_query, $permalink_manager_uris, $permalink_manager_redirects, $permalink_manager_options, $wp, $pm_item_id;
347
 
348
  // Do not redirect on author pages & front page
349
  if(is_author() || is_front_page() || is_home()) { return false; }
350
 
351
  // Unset 404 if custom URI is detected
352
- if(isset($pm_item_id)) {
353
  $wp_query->is_404 = false;
354
  }
355
 
@@ -359,6 +385,7 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
359
  // Get the redirection mode & trailing slashes settings
360
  $redirect_mode = (!empty($permalink_manager_options['general']['redirect'])) ? $permalink_manager_options['general']['redirect'] : false;
361
  $trailing_slashes_mode = (!empty($permalink_manager_options['general']['trailing_slashes'])) ? $permalink_manager_options['general']['trailing_slashes'] : false;
 
362
 
363
  // Get query string
364
  $query_string = $_SERVER['QUERY_STRING'];
@@ -369,13 +396,8 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
369
  /**
370
  * 1A. Custom redirects
371
  */
372
- if(empty($wp_query->query_vars['do_not_redirect']) && !empty($permalink_manager_redirects) && is_array($permalink_manager_redirects) && !empty($wp->request)) {
373
- $uri = urldecode(trim($wp->request, "/ "));
374
-
375
- // Filter endpoints
376
- $endpoints = apply_filters("permalink-manager-endpoints", "page|feed|embed|attachment|track");
377
- preg_match("/^(.+?)(?:\/($endpoints))?(?:\/([\d]+))?\/?$/i", $uri, $regex_parts);
378
- $uri = (!empty($regex_parts[1])) ? $regex_parts[1] : $uri;
379
 
380
  // Check if the URI is not assigned to any post/term's redirects
381
  foreach($permalink_manager_redirects as $element => $redirects) {
@@ -394,6 +416,9 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
394
  }
395
  }
396
 
 
 
 
397
  /**
398
  * 1B. Enhance native redirect
399
  */
@@ -422,27 +447,41 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
422
  }
423
 
424
  /**
425
- * 2. Check trailing slashes
426
  */
427
- if($trailing_slashes_mode) {
428
- $home_dir = parse_url($home_url, PHP_URL_PATH);
429
- $old_request = strtok($_SERVER['REQUEST_URI'], "?");
 
 
 
 
 
 
 
 
 
430
 
431
- // Fix for WP installed in directories
432
- $old_request = ltrim(str_replace($home_dir, "", $old_request), "/");
433
- $ends_with_slash = (substr($old_request, -1) == "/") ? true : false;
 
 
434
 
435
- // Homepage should be ignored
436
- if($old_request != "/") {
437
  // 2A. Force trailing slashes
438
  if($trailing_slashes_mode == 10 && $ends_with_slash == false) {
439
- $correct_permalink = (!empty($correct_permalink)) ? "{$correct_permalink}/" : "{$home_url}/{$old_request}/";
440
  }
441
  // 2B. Remove trailing slashes
442
  else if($trailing_slashes_mode == 20 && $ends_with_slash == true) {
443
- $correct_permalink = (!empty($correct_permalink)) ? $correct_permalink : "{$home_url}/{$old_request}";
444
  $correct_permalink = trim($correct_permalink, "/");
445
  }
 
 
 
 
 
446
  }
447
  }
448
 
@@ -453,6 +492,9 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
453
  // Append query string
454
  $correct_permalink = (!empty($query_string)) ? "{$correct_permalink}?{$query_string}" : $correct_permalink;
455
 
 
 
 
456
  wp_safe_redirect($correct_permalink, $redirect_mode);
457
  exit();
458
  }
@@ -503,10 +545,23 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
503
  function case_insensitive_permalinks() {
504
  global $permalink_manager_options, $permalink_manager_uris;
505
 
506
- if(!empty($permalink_manager_options['general']['case_insensitive_permalinks']) && !empty($_SERVER['REQUEST_URI'])) {
507
  $_SERVER['REQUEST_URI'] = strtolower($_SERVER['REQUEST_URI']);
508
  $permalink_manager_uris = array_map('strtolower', $permalink_manager_uris);
509
  }
510
  }
511
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  }
10
  }
11
 
12
  function init_hooks() {
13
+ global $permalink_manager_options;
14
+
15
  // Trigger only in front-end
16
  if(!is_admin()) {
17
  // Use the URIs set in this plugin
18
  add_filter( 'request', array($this, 'detect_post'), 0, 1 );
19
 
 
 
 
 
 
20
  // Redirect from old URIs to new URIs + adjust canonical redirect settings
21
  add_action( 'template_redirect', array($this, 'new_uri_redirect_and_404'), 1);
22
  add_action( 'wp', array($this, 'adjust_canonical_redirect'), 0, 1);
23
 
24
  // Case insensitive permalinks
25
+ if(!empty($permalink_manager_options['general']['case_insensitive_permalinks'])) {
26
+ add_action( 'parse_request', array($this, 'case_insensitive_permalinks'), 0);
27
+ }
28
+ // Force 404 on non-existing pagination pages
29
+ if(!empty($permalink_manager_options['general']['pagination_redirect'])) {
30
+ add_action( 'wp', array($this, 'fix_pagination_pages'), 0);
31
+ }
32
  }
33
+
34
+ // Trailing slashes
35
+ add_filter( 'permalink_manager_filter_final_term_permalink', array($this, 'control_trailing_slashes'), 9);
36
+ add_filter( 'permalink_manager_filter_final_post_permalink', array($this, 'control_trailing_slashes'), 9);
37
+ add_filter( 'permalink_manager_filter_post_sample_permalink', array($this, 'control_trailing_slashes'), 9);
38
+
39
+ // Custom fields in permalinks
40
+ add_filter( 'permalink_manager_filter_default_post_uri', array($this, 'replace_empty_placeholder_tags'), 10, 5 );
41
+ add_filter( 'permalink_manager_filter_default_term_uri', array($this, 'replace_empty_placeholder_tags'), 10, 5 );
42
  }
43
 
44
  /**
45
  * The most important Permalink Manager function
46
  */
47
  function detect_post($query) {
48
+ global $wpdb, $wp, $wp_rewrite, $permalink_manager_uris, $wp_filter, $permalink_manager_options, $pm_query, $pm_uri_parts;
49
 
50
  // Check if any custom URI is used and we are not in WP-Admin dashboard
51
  if(!(is_array($permalink_manager_uris)) || empty($query)) return $query;
78
  $uri_parts['endpoint'] = (!empty($regex_parts[2])) ? $regex_parts[2] : "";
79
  $uri_parts['endpoint_value'] = (!empty($regex_parts[3])) ? $regex_parts[3] : "";
80
 
81
+ // Allow to filter the results by third-parties + store the URI parts with $pm_query global
82
+ $uri_parts = $pm_query = apply_filters('permalink-manager-detect-uri', $uri_parts, $request_url, $endpoints);
83
 
84
  // Stop the function if $uri_parts is empty
85
  if(empty($uri_parts)) return $query;
285
  * 7. Set global with detected item id
286
  */
287
  if(!empty($element_id)) {
288
+ $pm_query['id'] = $element_id;
289
 
290
  // Make the redirects more clever - see new_uri_redirect_and_404() method
291
  $query['do_not_redirect'] = 1;
298
  if(isset($_REQUEST['debug_url'])) {
299
  $debug_info['old_query_vars'] = $old_query;
300
  $debug_info['new_query_vars'] = $query;
301
+ $debug_info['detected_id'] = (!empty($pm_query['id'])) ? $pm_query['id'] : "-";
302
 
303
  $debug_txt = json_encode($debug_info);
304
  $debug_txt = "<textarea style=\"width:100%;height:300px\">{$debug_txt}</textarea>";
314
  function control_trailing_slashes($permalink) {
315
  global $permalink_manager_options;
316
 
317
+ // Ignore empty permalinks
318
+ if(empty($permalink)) { return $permalink; }
319
+
320
  $trailing_slash_setting = (!empty($permalink_manager_options['general']['trailing_slashes'])) ? $permalink_manager_options['general']['trailing_slashes'] : "";
321
 
322
+ // Do not append the trailing slash if permalink contains hashtag or get parameters
323
+ $url_parsed = parse_url($permalink);
324
+ if(!empty($url_parsed['query']) || !empty($url_parsed['fragment'])) { return untrailingslashit($permalink); }
325
+
326
  if(in_array($trailing_slash_setting, array(1, 10))) {
327
  $permalink = trailingslashit($permalink);
328
  } else if(in_array($trailing_slash_setting, array(2, 20))) {
345
  if(empty($post->ID)) { return; }
346
 
347
  // 3. Check if pagination is detected
348
+ $current_page = (!empty($wp_query->query_vars['page'])) ? $wp_query->query_vars['page'] : 1;
349
+ $current_page = (empty($wp_query->query_vars['page']) && !empty($wp_query->query_vars['paged'])) ? $wp_query->query_vars['paged'] : $current_page;
350
 
351
  // 4. Count post pages
352
  $num_pages = substr_count(strtolower($post->post_content), '<!--nextpage-->') + 1;
353
+
354
+ // 5. Block non-existent pages (Force 404 error)
355
+ if($current_page > 1 && ($current_page > $num_pages)) {
356
+ $wp_query->is_404 = true;
357
+ $wp_query->query = $wp_query->queried_object = $wp_query->queried_object_id = null;
358
  $wp_query->set_404();
359
+
360
+ status_header(404);
361
+ nocache_headers();
362
+ include(get_query_template('404'));
363
+
364
+ die();
365
  }
366
  }
367
 
369
  * Redirects
370
  */
371
  function new_uri_redirect_and_404() {
372
+ global $wp_query, $permalink_manager_uris, $permalink_manager_redirects, $permalink_manager_options, $wp, $pm_query, $pm_uri_parts;
373
 
374
  // Do not redirect on author pages & front page
375
  if(is_author() || is_front_page() || is_home()) { return false; }
376
 
377
  // Unset 404 if custom URI is detected
378
+ if(isset($pm_query['id'])) {
379
  $wp_query->is_404 = false;
380
  }
381
 
385
  // Get the redirection mode & trailing slashes settings
386
  $redirect_mode = (!empty($permalink_manager_options['general']['redirect'])) ? $permalink_manager_options['general']['redirect'] : false;
387
  $trailing_slashes_mode = (!empty($permalink_manager_options['general']['trailing_slashes'])) ? $permalink_manager_options['general']['trailing_slashes'] : false;
388
+ $trailing_slashes_redirect_mode = (!empty($permalink_manager_options['general']['trailing_slashes_redirect'])) ? $permalink_manager_options['general']['trailing_slashes_redirect'] : 301;
389
 
390
  // Get query string
391
  $query_string = $_SERVER['QUERY_STRING'];
396
  /**
397
  * 1A. Custom redirects
398
  */
399
+ if(empty($wp_query->query_vars['do_not_redirect']) && !empty($permalink_manager_redirects) && is_array($permalink_manager_redirects) && !empty($wp->request) && !empty($pm_query['uri'])) {
400
+ $uri = $pm_query['uri'];
 
 
 
 
 
401
 
402
  // Check if the URI is not assigned to any post/term's redirects
403
  foreach($permalink_manager_redirects as $element => $redirects) {
416
  }
417
  }
418
 
419
+ // Ignore WP-Content links
420
+ if(!empty($_SERVER['REQUEST_URI']) && (strpos($_SERVER['REQUEST_URI'], '/wp-content') !== false)) { return false; }
421
+
422
  /**
423
  * 1B. Enhance native redirect
424
  */
447
  }
448
 
449
  /**
450
+ * 2. Check trailing slashes (ignore links with query parameters)
451
  */
452
+ if($trailing_slashes_mode && empty($_SERVER['QUERY_STRING']) && !empty($_SERVER['REQUEST_URI'])) {
453
+ $home_dir = parse_url($home_url . "/dupa", PHP_URL_PATH);
454
+ $old_uri = $_SERVER['REQUEST_URI'];
455
+
456
+ // Fix for WP installed in directories (remove the directory name from the URI)
457
+ if(!empty($home_dir)) {
458
+ $home_dir_regex = preg_quote(trim($home_dir), "/");
459
+ $old_uri = preg_replace("/{$home_dir_regex}/", "", $old_uri, 1);
460
+ }
461
+
462
+ // Check if $old_uri ends with slash or not
463
+ $ends_with_slash = (substr($old_uri, -1) == "/") ? true : false;
464
 
465
+ // Ignore empty URIs
466
+ if($old_uri != "/") {
467
+ // Remove the trailing slashes (and add them again if needed below)
468
+ $old_uri = trim($old_uri, "/");
469
+ $correct_permalink = (!empty($correct_permalink)) ? trim($correct_permalink, "/") : "";
470
 
 
 
471
  // 2A. Force trailing slashes
472
  if($trailing_slashes_mode == 10 && $ends_with_slash == false) {
473
+ $correct_permalink = (!empty($correct_permalink)) ? "{$correct_permalink}/" : "{$home_url}/{$old_uri}/";
474
  }
475
  // 2B. Remove trailing slashes
476
  else if($trailing_slashes_mode == 20 && $ends_with_slash == true) {
477
+ $correct_permalink = (!empty($correct_permalink)) ? $correct_permalink : "{$home_url}/{$old_uri}";
478
  $correct_permalink = trim($correct_permalink, "/");
479
  }
480
+
481
+ // Use redirect mode set for trailing slash redirect
482
+ if(($trailing_slashes_mode == 20 && $ends_with_slash == true) || ($trailing_slashes_mode == 10 && $ends_with_slash == false)) {
483
+ $redirect_mode = $trailing_slashes_redirect_mode;
484
+ }
485
  }
486
  }
487
 
492
  // Append query string
493
  $correct_permalink = (!empty($query_string)) ? "{$correct_permalink}?{$query_string}" : $correct_permalink;
494
 
495
+ // Remove double slash
496
+ $correct_permalink = preg_replace('~(?<!https:|http:)[/\\\\]+~', "/", trim($correct_permalink));
497
+
498
  wp_safe_redirect($correct_permalink, $redirect_mode);
499
  exit();
500
  }
545
  function case_insensitive_permalinks() {
546
  global $permalink_manager_options, $permalink_manager_uris;
547
 
548
+ if(!empty($_SERVER['REQUEST_URI'])) {
549
  $_SERVER['REQUEST_URI'] = strtolower($_SERVER['REQUEST_URI']);
550
  $permalink_manager_uris = array_map('strtolower', $permalink_manager_uris);
551
  }
552
  }
553
 
554
+ /**
555
+ * Replace empty placeholder tags
556
+ */
557
+ public static function replace_empty_placeholder_tags($default_uri, $native_slug = "", $element = "", $slug = "", $native_uri = "") {
558
+ // Do not affect native URIs
559
+ if($native_uri == true) { return $default_uri; }
560
+
561
+ $empty_tag_replacement = apply_filters('permalink_manager_empty_tag_replacement', null, $element);
562
+ $default_uri = ($empty_tag_replacement || is_null($empty_tag_replacement)) ? str_replace("//", "/", preg_replace("/%(.+?)%/", $empty_tag_replacement, $default_uri)) : $default_uri;
563
+
564
+ return trim($default_uri, "/");
565
+ }
566
+
567
  }
includes/core/permalink-manager-helper-functions.php CHANGED
@@ -49,7 +49,9 @@ class Permalink_Manager_Helper_Functions extends Permalink_Manager_Class {
49
  static function get_disabled_post_types() {
50
  global $permalink_manager_options;
51
 
52
- $disabled_post_types = (!empty($permalink_manager_options['general']['partial_disable']['post_types'])) ? (array) $permalink_manager_options['general']['partial_disable']['post_types'] : array();
 
 
53
  return apply_filters('permalink-manager-disabled-post-types', $disabled_post_types);
54
  }
55
 
@@ -57,6 +59,7 @@ class Permalink_Manager_Helper_Functions extends Permalink_Manager_Class {
57
  global $permalink_manager_options;
58
 
59
  $disabled_taxonomies = (!empty($permalink_manager_options['general']['partial_disable']['taxonomies'])) ? (array) $permalink_manager_options['general']['partial_disable']['taxonomies'] : array();
 
60
  return apply_filters('permalink-manager-disabled-taxonomies', $disabled_taxonomies);
61
  }
62
 
@@ -277,7 +280,7 @@ class Permalink_Manager_Helper_Functions extends Permalink_Manager_Class {
277
  /**
278
  * Slugify function
279
  */
280
- public static function sanitize_title($str) {
281
  // Trim slashes & whitespaces
282
  $clean = trim($str, " /");
283
 
@@ -285,7 +288,8 @@ class Permalink_Manager_Helper_Functions extends Permalink_Manager_Class {
285
  $clean = remove_accents($clean);
286
 
287
  // $clean = iconv('UTF-8', 'ASCII//TRANSLIT', $clean);
288
- $clean = preg_replace("/[^\p{L}a-zA-Z0-9\/_\.|+ -]/u", '', $clean);
 
289
  $clean = strtolower(trim($clean, '-'));
290
  $clean = preg_replace("/[_|+ -]+/", "-", $clean);
291
 
49
  static function get_disabled_post_types() {
50
  global $permalink_manager_options;
51
 
52
+ $initial_disabled_post_types = array('revision', 'algolia_task', 'wc_voucher', 'wc_product_tab');
53
+ $disabled_post_types = (!empty($permalink_manager_options['general']['partial_disable']['post_types'])) ? array_merge((array) $permalink_manager_options['general']['partial_disable']['post_types'], $initial_disabled_post_types) : $initial_disabled_post_types;
54
+
55
  return apply_filters('permalink-manager-disabled-post-types', $disabled_post_types);
56
  }
57
 
59
  global $permalink_manager_options;
60
 
61
  $disabled_taxonomies = (!empty($permalink_manager_options['general']['partial_disable']['taxonomies'])) ? (array) $permalink_manager_options['general']['partial_disable']['taxonomies'] : array();
62
+
63
  return apply_filters('permalink-manager-disabled-taxonomies', $disabled_taxonomies);
64
  }
65
 
280
  /**
281
  * Slugify function
282
  */
283
+ public static function sanitize_title($str, $keep_percent_sign = false) {
284
  // Trim slashes & whitespaces
285
  $clean = trim($str, " /");
286
 
288
  $clean = remove_accents($clean);
289
 
290
  // $clean = iconv('UTF-8', 'ASCII//TRANSLIT', $clean);
291
+ $percent_sign = ($keep_percent_sign) ? "\%" : "";
292
+ $clean = preg_replace("/[^\p{L}a-zA-Z0-9{$percent_sign}\/_\.|+ -]/u", '', $clean);
293
  $clean = strtolower(trim($clean, '-'));
294
  $clean = preg_replace("/[_|+ -]+/", "-", $clean);
295
 
includes/core/permalink-manager-third-parties.php CHANGED
@@ -51,12 +51,6 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
51
  if(class_exists('Theme_My_Login')) {
52
  add_filter('permalink_manager_filter_final_post_permalink', array($this, 'tml_keep_query_parameters'), 9, 3);
53
  }
54
-
55
- // 7. WC_Voucher
56
- if(class_exists('WC_Voucher')) {
57
- add_filter('permalink-manager-disabled-post-types', array($this, 'disabled_post_types'), 0, 3);
58
- }
59
-
60
  }
61
 
62
  /**
@@ -294,10 +288,10 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
294
  * 5. WooCommerce
295
  */
296
  function woocommerce_detect($query) {
297
- global $woocommerce, $pm_item_id;
298
 
299
  // Fix shop page
300
- if(is_numeric($pm_item_id) && get_option('woocommerce_shop_page_id') == $pm_item_id) {
301
  $query['post_type'] = 'product';
302
  unset($query['pagename']);
303
  }
@@ -319,10 +313,10 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
319
  }
320
 
321
  function woocommerce_checkout_fix() {
322
- global $wp_query, $pm_item_id, $permalink_manager_options;
323
 
324
  // Redirect from Shop archive to selected page
325
- if(is_shop() && empty($pm_item_id)) {
326
  $redirect_mode = (!empty($permalink_manager_options['general']['redirect'])) ? $permalink_manager_options['general']['redirect'] : false;
327
  $redirect_shop = apply_filters('permalink-manager-redirect-shop-archive', false);
328
  $shop_page = get_option('woocommerce_shop_page_id');
@@ -350,17 +344,5 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
350
  return $permalink . $get_parameters;
351
  }
352
 
353
- /**
354
- * 7. Disabled post types (WC_Voucher)
355
- */
356
- function disabled_post_types($post_types) {
357
- if(!is_array($post_types)) { return $post_types; }
358
-
359
- $post_types[] = "wc_voucher";
360
-
361
- return $post_types;
362
- }
363
-
364
-
365
  }
366
  ?>
51
  if(class_exists('Theme_My_Login')) {
52
  add_filter('permalink_manager_filter_final_post_permalink', array($this, 'tml_keep_query_parameters'), 9, 3);
53
  }
 
 
 
 
 
 
54
  }
55
 
56
  /**
288
  * 5. WooCommerce
289
  */
290
  function woocommerce_detect($query) {
291
+ global $woocommerce, $pm_query;
292
 
293
  // Fix shop page
294
+ if(!empty($pm_query['id']) && is_numeric($pm_query['id']) && get_option('woocommerce_shop_page_id') == $pm_query['id']) {
295
  $query['post_type'] = 'product';
296
  unset($query['pagename']);
297
  }
313
  }
314
 
315
  function woocommerce_checkout_fix() {
316
+ global $wp_query, $pm_query, $permalink_manager_options;
317
 
318
  // Redirect from Shop archive to selected page
319
+ if(is_shop() && empty($pm_query['id'])) {
320
  $redirect_mode = (!empty($permalink_manager_options['general']['redirect'])) ? $permalink_manager_options['general']['redirect'] : false;
321
  $redirect_shop = apply_filters('permalink-manager-redirect-shop-archive', false);
322
  $shop_page = get_option('woocommerce_shop_page_id');
344
  return $permalink . $get_parameters;
345
  }
346
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  }
348
  ?>
includes/core/permalink-manager-uri-functions-post.php CHANGED
@@ -130,8 +130,8 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
130
  // Load all bases & post
131
  $post = is_object($post) ? $post : get_post($post);
132
 
133
- // Check if post ID is defined
134
- if(empty($post->ID)) { return ''; }
135
  $post_id = $post->ID;
136
  $post_type = $post->post_type;
137
  $post_name = (empty($post->post_name)) ? sanitize_title($post->post_title) : $post->post_name;
@@ -549,7 +549,7 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
549
  $autosave = (!empty($new_title) && empty($new_slug)) ? true : false;
550
 
551
  // Do not do anything if new slug is empty or page is front-page
552
- if(get_option('page_on_front') == $id) { return $html; }
553
 
554
  // Check if post type is disabled
555
  if(Permalink_Manager_Helper_Functions::is_disabled($post->post_type, 'post_type')) { return $html; }
@@ -563,10 +563,12 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
563
  $prefix = apply_filters('permalink-manager-post-permalink-prefix', '', $post, true);
564
 
565
  // Do not change anything if post is not saved yet (display sample permalink instead)
566
- if($autosave || empty($post->post_status)) {
567
- $sample_permalink_url = $default_uri;
 
 
 
568
  } else {
569
- //$uri = $sample_permalink_url = (!empty($permalink_manager_uris[$id])) ? $permalink_manager_uris[$id] : $default_uri;
570
  $uri = $sample_permalink_url = (!empty($permalink_manager_uris[$id])) ? $permalink_manager_uris[$id] : $native_uri;
571
  }
572
 
@@ -580,10 +582,7 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
580
 
581
  // Append new HTML output
582
  $html .= sprintf("<span class=\"sample-permalink-span\"><a href=\"%s\">%s</a></span>&nbsp;", strip_tags($sample_permalink), $sample_permalink);
583
-
584
- if(!empty($uri)) {
585
- $html .= Permalink_Manager_Admin_Functions::display_uri_box($post, $default_uri, $uri, $native_uri, "{$home_url}{$prefix}");
586
- }
587
 
588
  // Append hidden field with native slug
589
  $html .= (!empty($post->post_name)) ? "<input id=\"new-post-slug\" value=\"{$post->post_name}\" autocomplete=\"off\" type=\"hidden\">" : "";
@@ -599,10 +598,9 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
599
  }
600
 
601
  function quick_edit_column_content($column_name, $post_id) {
602
- if($column_name != "permalink-manager-col") { return; }
603
-
604
- $html = self::get_post_uri($post_id);
605
- echo $html;
606
  }
607
 
608
  function quick_edit_column_form($column_name, $post_type, $taxonomy = '') {
@@ -687,7 +685,10 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
687
  $old_uri = (isset($permalink_manager_uris[$post->ID])) ? $permalink_manager_uris[$post->ID] : $native_uri;
688
 
689
  // Use default URI if URI is cleared by user OR URI should be automatically updated
690
- $new_uri = (($_POST['custom_uri'] == '') || $auto_update_uri == 1) ? $default_uri : Permalink_Manager_Helper_Functions::sanitize_title($_POST['custom_uri']);
 
 
 
691
 
692
  // Save or remove "Auto-update URI" settings
693
  if(!empty($auto_update_uri_current)) {
130
  // Load all bases & post
131
  $post = is_object($post) ? $post : get_post($post);
132
 
133
+ // Check if post ID is defined (and front page permalinks should be empty)
134
+ if(empty($post->ID) || (get_option('page_on_front') == $post->ID)) { return ''; }
135
  $post_id = $post->ID;
136
  $post_type = $post->post_type;
137
  $post_name = (empty($post->post_name)) ? sanitize_title($post->post_title) : $post->post_name;
549
  $autosave = (!empty($new_title) && empty($new_slug)) ? true : false;
550
 
551
  // Do not do anything if new slug is empty or page is front-page
552
+ // if(get_option('page_on_front') == $id) { return $html; }
553
 
554
  // Check if post type is disabled
555
  if(Permalink_Manager_Helper_Functions::is_disabled($post->post_type, 'post_type')) { return $html; }
563
  $prefix = apply_filters('permalink-manager-post-permalink-prefix', '', $post, true);
564
 
565
  // Do not change anything if post is not saved yet (display sample permalink instead)
566
+ if(get_option('page_on_front') == $id) {
567
+ $uri = $sample_permalink_url = "";
568
+ }
569
+ else if($autosave || empty($post->post_status)) {
570
+ $uri = $sample_permalink_url = $default_uri;
571
  } else {
 
572
  $uri = $sample_permalink_url = (!empty($permalink_manager_uris[$id])) ? $permalink_manager_uris[$id] : $native_uri;
573
  }
574
 
582
 
583
  // Append new HTML output
584
  $html .= sprintf("<span class=\"sample-permalink-span\"><a href=\"%s\">%s</a></span>&nbsp;", strip_tags($sample_permalink), $sample_permalink);
585
+ $html .= Permalink_Manager_Admin_Functions::display_uri_box($post, $default_uri, $uri, $native_uri, "{$home_url}{$prefix}");
 
 
 
586
 
587
  // Append hidden field with native slug
588
  $html .= (!empty($post->post_name)) ? "<input id=\"new-post-slug\" value=\"{$post->post_name}\" autocomplete=\"off\" type=\"hidden\">" : "";
598
  }
599
 
600
  function quick_edit_column_content($column_name, $post_id) {
601
+ if($column_name == "permalink-manager-col") {
602
+ echo urldecode(self::get_post_uri($post_id));
603
+ }
 
604
  }
605
 
606
  function quick_edit_column_form($column_name, $post_type, $taxonomy = '') {
685
  $old_uri = (isset($permalink_manager_uris[$post->ID])) ? $permalink_manager_uris[$post->ID] : $native_uri;
686
 
687
  // Use default URI if URI is cleared by user OR URI should be automatically updated
688
+ $new_uri = (($_POST['custom_uri'] == '') || $auto_update_uri == 1) ? $default_uri : Permalink_Manager_Helper_Functions::sanitize_title($_POST['custom_uri'], true);
689
+
690
+ // Remove the empty placeholder tags
691
+ $new_uri = Permalink_Manager_Core_Functions::replace_empty_placeholder_tags($new_uri);
692
 
693
  // Save or remove "Auto-update URI" settings
694
  if(!empty($auto_update_uri_current)) {
includes/views/permalink-manager-settings.php CHANGED
@@ -80,7 +80,13 @@ class Permalink_Manager_Settings extends Permalink_Manager_Class {
80
  'input_class' => 'settings-select',
81
  'choices' => array(0 => __('Use default settings', 'permalink-manager'), 1 => __('Add trailing slashes', 'permalink-manager'), 10 => __('Add trailing slashes (+ auto-redirect links without them)', 'permalink-manager'), 2 => __('Remove trailing slashes', 'permalink-manager'), 20 => __('Remove trailing slashes (+ auto-redirect links with them)', 'permalink-manager'),),
82
  'description' => __('This option can be used to alter the native settings and control if trailing slash should be added or removed from the end of posts & terms permalinks.', 'permalink-manager')
83
- )
 
 
 
 
 
 
84
  )
85
  ),
86
  'advanced' => array(
80
  'input_class' => 'settings-select',
81
  'choices' => array(0 => __('Use default settings', 'permalink-manager'), 1 => __('Add trailing slashes', 'permalink-manager'), 10 => __('Add trailing slashes (+ auto-redirect links without them)', 'permalink-manager'), 2 => __('Remove trailing slashes', 'permalink-manager'), 20 => __('Remove trailing slashes (+ auto-redirect links with them)', 'permalink-manager'),),
82
  'description' => __('This option can be used to alter the native settings and control if trailing slash should be added or removed from the end of posts & terms permalinks.', 'permalink-manager')
83
+ ),
84
+ 'pagination_redirect' => array(
85
+ 'type' => 'single_checkbox',
86
+ 'label' => __('Force 404 on non-existing pagination pages', 'permalink-manager'),
87
+ 'input_class' => '',
88
+ 'description' => __('If enabled, the non-existing pagination pages (for single posts) will return 404 ("Not Found") error.', 'permalink-manager')
89
+ ),
90
  )
91
  ),
92
  'advanced' => array(
permalink-manager.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Permalink Manager Lite
5
  * Plugin URI: https://permalinkmanager.pro?utm_source=plugin
6
  * Description: Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
7
- * Version: 2.0.5.3
8
  * Author: Maciej Bis
9
  * Author URI: http://maciejbis.net/
10
  * License: GPL-2.0+
@@ -21,7 +21,7 @@ if (!defined('WPINC')) {
21
  // Define the directories used to load plugin files.
22
  define( 'PERMALINK_MANAGER_PLUGIN_NAME', 'Permalink Manager' );
23
  define( 'PERMALINK_MANAGER_PLUGIN_SLUG', 'permalink-manager' );
24
- define( 'PERMALINK_MANAGER_VERSION', '2.0.5.3' );
25
  define( 'PERMALINK_MANAGER_FILE', __FILE__ );
26
  define( 'PERMALINK_MANAGER_DIR', untrailingslashit( dirname( __FILE__ ) ) );
27
  define( 'PERMALINK_MANAGER_BASENAME', plugin_basename(__FILE__) );
@@ -150,10 +150,11 @@ class Permalink_Manager_Class {
150
  'force_custom_slugs' => 0,
151
  'auto_update_uris' => 0,
152
  'case_insensitive_permalinks' => 0,
 
153
  'redirect' => '301',
154
  'canonical_redirect' => 1,
155
  'trailing_slashes' => 0,
156
- 'setup_redirects' => 1,
157
  'auto_remove_duplicates' => 0,
158
  'partial_disable' => array(),
159
  'deep_detect' => 1
4
  * Plugin Name: Permalink Manager Lite
5
  * Plugin URI: https://permalinkmanager.pro?utm_source=plugin
6
  * Description: Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
7
+ * Version: 2.0.5.3.1
8
  * Author: Maciej Bis
9
  * Author URI: http://maciejbis.net/
10
  * License: GPL-2.0+
21
  // Define the directories used to load plugin files.
22
  define( 'PERMALINK_MANAGER_PLUGIN_NAME', 'Permalink Manager' );
23
  define( 'PERMALINK_MANAGER_PLUGIN_SLUG', 'permalink-manager' );
24
+ define( 'PERMALINK_MANAGER_VERSION', '2.0.5.3.1' );
25
  define( 'PERMALINK_MANAGER_FILE', __FILE__ );
26
  define( 'PERMALINK_MANAGER_DIR', untrailingslashit( dirname( __FILE__ ) ) );
27
  define( 'PERMALINK_MANAGER_BASENAME', plugin_basename(__FILE__) );
150
  'force_custom_slugs' => 0,
151
  'auto_update_uris' => 0,
152
  'case_insensitive_permalinks' => 0,
153
+ 'setup_redirects' => 1,
154
  'redirect' => '301',
155
  'canonical_redirect' => 1,
156
  'trailing_slashes' => 0,
157
+ 'pagination_redirect' => 1,
158
  'auto_remove_duplicates' => 0,
159
  'partial_disable' => array(),
160
  'deep_detect' => 1