Permalink Manager Lite - Version 2.0.5.3

Version Description

  • Hotfix for redirects - redirect chain no longer occurs (WPML)
  • Better support for trailing slashes
  • Now $wp_query->is_404() is set to false when custom URI is detected
  • Hotfix for ACF custom fields in terms
Download this release

Release Info

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

Code changes from version 2.0.5.2 to 2.0.5.3

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.2
11
 
12
  Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
13
 
@@ -98,6 +98,20 @@ A. Currently there is no 100% guarantee that Permalink Manager will work correct
98
 
99
  == Changelog ==
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  = 2.0.5.1/2.0.5.2 =
102
  * Hotfix for REGEX rule
103
  * yoast_attachment_redirect setting removed (it is no longer needed)
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
 
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)
109
+ * Hotfix for no-ASCII characters in custom URIs
110
+ * Hotfix for attachments
111
+
112
+ = 2.0.5.2.1 =
113
+ * Hotfix for endpoints redirect
114
+
115
  = 2.0.5.1/2.0.5.2 =
116
  * Hotfix for REGEX rule
117
  * yoast_attachment_redirect setting removed (it is no longer needed)
includes/core/permalink-manager-admin-functions.php CHANGED
@@ -587,6 +587,9 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
587
  $id = $element->term_id;
588
  }
589
 
 
 
 
590
  // 1. Button
591
  $html = sprintf("<span><button type=\"button\" class=\"button button-small hide-if-no-js\" id=\"permalink-manager-toggle\">%s</button></span>", __("Permalink Manager", "permalink-manager"));
592
 
@@ -618,7 +621,7 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
618
  // 6. Default URI
619
  $html .= sprintf(
620
  "<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>",
621
- __("Default URI", "permalink-manager"), urldecode(esc_html($default_uri)),
622
  __("Restore to Default URI", "permalink-manager")
623
  );
624
 
587
  $id = $element->term_id;
588
  }
589
 
590
+ // Decode default URI
591
+ $default_uri = urldecode($default_uri);
592
+
593
  // 1. Button
594
  $html = sprintf("<span><button type=\"button\" class=\"button button-small hide-if-no-js\" id=\"permalink-manager-toggle\">%s</button></span>", __("Permalink Manager", "permalink-manager"));
595
 
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
 
includes/core/permalink-manager-core-functions.php CHANGED
@@ -369,7 +369,7 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
369
  /**
370
  * 1A. Custom redirects
371
  */
372
- if(empty($wp_query->query['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
@@ -397,7 +397,7 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
397
  /**
398
  * 1B. Enhance native redirect
399
  */
400
- if(empty($wp_query->query['do_not_redirect']) && $redirect_mode && !empty($queried_object) && empty($correct_permalink)) {
401
  // Affect only posts with custom URI and old URIs
402
  if(!empty($queried_object->ID) && isset($permalink_manager_uris[$queried_object->ID]) && empty($wp_query->query['preview'])) {
403
  // Ignore posts with specific statuses
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
397
  /**
398
  * 1B. Enhance native redirect
399
  */
400
+ if(empty($wp_query->query_vars['do_not_redirect']) && $redirect_mode && !empty($queried_object) && empty($correct_permalink)) {
401
  // Affect only posts with custom URI and old URIs
402
  if(!empty($queried_object->ID) && isset($permalink_manager_uris[$queried_object->ID]) && empty($wp_query->query['preview'])) {
403
  // Ignore posts with specific statuses
includes/core/permalink-manager-third-parties.php CHANGED
@@ -51,6 +51,12 @@ 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
 
56
  /**
@@ -86,7 +92,7 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
86
  }
87
 
88
  if(!empty($languages_list)) {
89
- preg_match("/^(?:({$languages_list})\/)?(.+?)(?|\/({$endpoints})\/([^\/]+)|\/()([\d+]))?\/?$/i", $request_url, $regex_parts);
90
 
91
  $uri_parts['lang'] = (!empty($regex_parts[1])) ? $regex_parts[1] : "";
92
  $uri_parts['uri'] = (!empty($regex_parts[2])) ? $regex_parts[2] : "";
@@ -344,6 +350,17 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
344
  return $permalink . $get_parameters;
345
  }
346
 
 
 
 
 
 
 
 
 
 
 
 
347
 
348
  }
349
  ?>
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
  /**
92
  }
93
 
94
  if(!empty($languages_list)) {
95
+ preg_match("/^(?:({$languages_list})\/)?(.+?)(?|\/({$endpoints})\/?([^\/]*)|\/()([\d+]))?\/?$/i", $request_url, $regex_parts);
96
 
97
  $uri_parts['lang'] = (!empty($regex_parts[1])) ? $regex_parts[1] : "";
98
  $uri_parts['uri'] = (!empty($regex_parts[2])) ? $regex_parts[2] : "";
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
  ?>
includes/views/permalink-manager-uri-editor-post.php CHANGED
@@ -103,7 +103,7 @@ class Permalink_Manager_URI_Editor_Post extends WP_List_Table {
103
  $output .= '</div>';
104
 
105
  $output .= '<div class="row-actions">';
106
- $output .= sprintf("<span class=\"edit\"><a href=\"%s/wp-admin/post.php?post={$item['ID']}&amp;action=edit\" title=\"%s\">%s</a> | </span>", home_url(), __('Edit', 'permalink-manager'), __('Edit', 'permalink-manager'));
107
  $output .= '<span class="view"><a target="_blank" href="' . $permalink . '" title="' . __('View', 'permalink-manager') . ' ' . $item[ 'post_title' ] . '" rel="permalink">' . __('View', 'permalink-manager') . '</a> | </span>';
108
  $output .= '<span class="id">#' . $item[ 'ID' ] . '</span>';
109
  $output .= '</div>';
103
  $output .= '</div>';
104
 
105
  $output .= '<div class="row-actions">';
106
+ $output .= sprintf("<span class=\"edit\"><a href=\"%s/wp-admin/post.php?post={$item['ID']}&amp;action=edit\" title=\"%s\">%s</a> | </span>", get_option('home'), __('Edit', 'permalink-manager'), __('Edit', 'permalink-manager'));
107
  $output .= '<span class="view"><a target="_blank" href="' . $permalink . '" title="' . __('View', 'permalink-manager') . ' ' . $item[ 'post_title' ] . '" rel="permalink">' . __('View', 'permalink-manager') . '</a> | </span>';
108
  $output .= '<span class="id">#' . $item[ 'ID' ] . '</span>';
109
  $output .= '</div>';
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.2
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.2' );
25
  define( 'PERMALINK_MANAGER_FILE', __FILE__ );
26
  define( 'PERMALINK_MANAGER_DIR', untrailingslashit( dirname( __FILE__ ) ) );
27
  define( 'PERMALINK_MANAGER_BASENAME', plugin_basename(__FILE__) );
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
  // 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__) );