Permalink Manager Lite - Version 2.0.6.3

Version Description

Download this release

Release Info

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

Code changes from version 2.0.6.2.1 to 2.0.6.3

README.txt CHANGED
@@ -7,7 +7,7 @@ Tags: urls, permalinks, custom permalinks, url, permalink, woocommerce permalink
7
  Requires at least: 4.4.0
8
  Requires PHP: 5.4
9
  Tested up to: 4.9
10
- Stable tag: 2.0.6.2.1
11
 
12
  Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
13
 
@@ -85,9 +85,12 @@ A. Currently there is no 100% guarantee that Permalink Manager will work correct
85
 
86
  == Changelog ==
87
 
88
- = 2.0.6.2 =
89
  * Japaneese translation added
90
  * Some minor improvements
 
 
 
91
 
92
  = 2.0.6.1 =
93
  * Hotfix for endpoints in REGEX
7
  Requires at least: 4.4.0
8
  Requires PHP: 5.4
9
  Tested up to: 4.9
10
+ Stable tag: 2.0.6.3
11
 
12
  Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
13
 
85
 
86
  == Changelog ==
87
 
88
+ = 2.0.6.2/2.0.6.3 =
89
  * Japaneese translation added
90
  * Some minor improvements
91
+ * New filters: permalink_manager_hide_uri_editor_term_{$term->taxonomy}, permalink_manager_hide_uri_editor_post_{$post->post_type} & permalink_manager_update_term_uri_{$this_term->taxonomy}, permalink_manager_update_post_uri_{$post->post_type}, permalink_manager_new_post_uri_{$post_object->post_type}
92
+ * Hotfix for default permalinks (no-hierarchical post types)
93
+ * Hotfix for attachments default permalinks + URI detect function
94
 
95
  = 2.0.6.1 =
96
  * Hotfix for endpoints in REGEX
includes/core/permalink-manager-uri-functions-post.php CHANGED
@@ -77,7 +77,7 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
77
  $permalink = "{$home_url}/" . Permalink_Manager_Helper_Functions::encode_uri("{$permalink_manager_uris[$post->ID]}");
78
  }
79
  } else if($post->post_type == 'attachment' && $post->post_parent > 0 && $post->post_parent != $post->ID && !empty($permalink_manager_uris[$post->post_parent])) {
80
- $permalink = "{$home_url}/{$permalink_manager_uris[$post->post_parent]}/{$post->post_name}";
81
  } else if(!empty($permalink_manager_options['general']['decode_uris'])) {
82
  $permalink = "{$home_url}/" . urldecode("/{$permalink}");
83
  }
@@ -135,7 +135,7 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
135
  // 1. Get the permastruct
136
  if($post_type == 'attachment') {
137
  $parent_page = ($post->post_parent > 0 && $post->post_parent != $post->ID) ? get_post($post->post_parent) : false;
138
- $default_permastruct = ($parent_page) ? trim(get_page_uri($parent_page->ID), "/") : "";
139
 
140
  if($native_uri) {
141
  $permastruct = $default_permastruct;
@@ -362,7 +362,9 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
362
  // Do replacement on slugs (non-REGEX)
363
  if(preg_match("/^\/.+\/[a-z]*$/i", $old_string)) {
364
  // Use $_POST['old_string'] directly here & fix double slashes problem
365
- $pattern = "~" . stripslashes(trim(sanitize_text_field($_POST['old_string']), "/")) . "~";
 
 
366
 
367
  $new_post_name = ($mode == 'slugs') ? preg_replace($pattern, $new_string, $old_post_name) : $old_post_name;
368
  $new_uri = ($mode != 'slugs') ? preg_replace($pattern, $new_string, $old_uri) : $old_uri;
77
  $permalink = "{$home_url}/" . Permalink_Manager_Helper_Functions::encode_uri("{$permalink_manager_uris[$post->ID]}");
78
  }
79
  } else if($post->post_type == 'attachment' && $post->post_parent > 0 && $post->post_parent != $post->ID && !empty($permalink_manager_uris[$post->post_parent])) {
80
+ $permalink = "{$home_url}/{$permalink_manager_uris[$post->post_parent]}/attachment/{$post->post_name}";
81
  } else if(!empty($permalink_manager_options['general']['decode_uris'])) {
82
  $permalink = "{$home_url}/" . urldecode("/{$permalink}");
83
  }
135
  // 1. Get the permastruct
136
  if($post_type == 'attachment') {
137
  $parent_page = ($post->post_parent > 0 && $post->post_parent != $post->ID) ? get_post($post->post_parent) : false;
138
+ $default_permastruct = ($parent_page) ? trim(get_page_uri($parent_page->ID), "/") . "/attachment" : "";
139
 
140
  if($native_uri) {
141
  $permastruct = $default_permastruct;
362
  // Do replacement on slugs (non-REGEX)
363
  if(preg_match("/^\/.+\/[a-z]*$/i", $old_string)) {
364
  // Use $_POST['old_string'] directly here & fix double slashes problem
365
+ $regex = stripslashes(trim(sanitize_text_field($_POST['old_string']), "/"));
366
+ $regex = preg_quote($regex, '~');
367
+ $pattern = "~{$regex}~";
368
 
369
  $new_post_name = ($mode == 'slugs') ? preg_replace($pattern, $new_string, $old_post_name) : $old_post_name;
370
  $new_uri = ($mode != 'slugs') ? preg_replace($pattern, $new_string, $old_uri) : $old_uri;
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.6.2.1
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.6.2.1' );
25
  define( 'PERMALINK_MANAGER_FILE', __FILE__ );
26
  define( 'PERMALINK_MANAGER_DIR', untrailingslashit(dirname(__FILE__)) );
27
  define( 'PERMALINK_MANAGER_BASENAME', dirname(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.6.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.6.3' );
25
  define( 'PERMALINK_MANAGER_FILE', __FILE__ );
26
  define( 'PERMALINK_MANAGER_DIR', untrailingslashit(dirname(__FILE__)) );
27
  define( 'PERMALINK_MANAGER_BASENAME', dirname(plugin_basename(__FILE__)));