Permalink Manager Lite - Version 2.0.5.7

Version Description

  • Hotfix for MultilingualPress plugin
Download this release

Release Info

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

Code changes from version 2.0.5.6.1 to 2.0.5.7

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.6
11
 
12
  Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
13
 
@@ -96,7 +96,10 @@ A. Currently there is no 100% guarantee that Permalink Manager will work correct
96
  7. Settings section.
97
 
98
 
99
- == Changelog ==
 
 
 
100
 
101
  = 2.0.5.6 =
102
  * The URIs for trashed posts are now correctly removed
7
  Requires at least: 4.0
8
  Requires PHP: 5.4
9
  Tested up to: 4.9
10
+ Stable tag: 2.0.5.7
11
 
12
  Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
13
 
96
  7. Settings section.
97
 
98
 
99
+ == Changelog ==
100
+
101
+ = 2.0.5.7 =
102
+ * Hotfix for MultilingualPress plugin
103
 
104
  = 2.0.5.6 =
105
  * The URIs for trashed posts are now correctly removed
includes/core/permalink-manager-actions.php CHANGED
@@ -10,9 +10,6 @@ class Permalink_Manager_Actions extends Permalink_Manager_Class {
10
 
11
  add_action('clean_permalinks_event', array($this, 'clean_permalinks_hook'));
12
  add_action('init', array($this, 'clean_permalinks_cronjob'));
13
-
14
- // Hotfix for Multisite
15
- add_filter('pre_update_option', array($this, 'update_custom_uris'), 9, 3);
16
  }
17
 
18
  /**
@@ -423,30 +420,6 @@ class Permalink_Manager_Actions extends Permalink_Manager_Class {
423
  }
424
  }
425
 
426
- /**
427
- * Hotfix for network
428
- */
429
- function update_custom_uris($new_value, $option, $old_value) {
430
- global $wpdb;
431
-
432
- // Trigger only if multisite is detected
433
- if(!is_multisite() || $option !== 'permalink-manager-uris') { return $new_value; }
434
-
435
- // Get non-cached array with URIs
436
- $permalink_manager_uris_raw = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option));
437
- $permalink_manager_uris = maybe_unserialize($permalink_manager_uris_raw);
438
-
439
- // Check if old value differs from the array set with $permalink_manager_uris global (by default they should be identical)
440
- $array_diff = array_diff((array) $permalink_manager_uris, (array) $old_value);
441
-
442
- if($array_diff) {
443
- // Stop the function
444
- $new_value = $old_value;
445
- }
446
-
447
- return $new_value;
448
- }
449
-
450
  }
451
 
452
  ?>
10
 
11
  add_action('clean_permalinks_event', array($this, 'clean_permalinks_hook'));
12
  add_action('init', array($this, 'clean_permalinks_cronjob'));
 
 
 
13
  }
14
 
15
  /**
420
  }
421
  }
422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  }
424
 
425
  ?>
includes/core/permalink-manager-uri-functions-post.php CHANGED
@@ -20,10 +20,10 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
20
  * URI Editor
21
  */
22
  add_filter( 'get_sample_permalink_html', array($this, 'edit_uri_box'), 99, 5 );
23
- add_action( 'save_post', array($this, 'update_post_uri'), 5, 1);
24
- add_action( 'edit_attachment', array($this, 'update_post_uri'), 5, 1 );
25
- add_action( 'wp_insert_post', array($this, 'new_post_uri'), 5, 1 );
26
- add_action( 'wp_trash_post', array($this, 'remove_post_uri'), 5, 1 );
27
 
28
  add_action( 'quick_edit_custom_box', array($this, 'quick_edit_column_form'), 99, 3);
29
  }
@@ -85,7 +85,7 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
85
  $permalink = "{$home_url}/" . urldecode("/{$permalink}");
86
  }
87
 
88
- // 5. Additional filter
89
  $permalink = apply_filters('permalink_manager_filter_final_post_permalink', user_trailingslashit($permalink), $post, $old_permalink);
90
 
91
  return $permalink;
@@ -620,11 +620,14 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
620
  * Update URI when new post is added
621
  */
622
  function new_post_uri($post_id) {
623
- global $permalink_manager_uris, $permalink_manager_options, $permalink_manager_before_sections_html;
624
 
625
  // Do not trigger if post is a revision
626
  if(wp_is_post_revision($post_id)) { return $post_id; }
627
 
 
 
 
628
  // Do not do anything if post is autosaved
629
  if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; }
630
 
20
  * URI Editor
21
  */
22
  add_filter( 'get_sample_permalink_html', array($this, 'edit_uri_box'), 99, 5 );
23
+ add_action( 'save_post', array($this, 'update_post_uri'), 99, 1);
24
+ add_action( 'edit_attachment', array($this, 'update_post_uri'), 99, 1 );
25
+ add_action( 'wp_insert_post', array($this, 'new_post_uri'), 99, 1 );
26
+ add_action( 'wp_trash_post', array($this, 'remove_post_uri'), 100, 1 );
27
 
28
  add_action( 'quick_edit_custom_box', array($this, 'quick_edit_column_form'), 99, 3);
29
  }
85
  $permalink = "{$home_url}/" . urldecode("/{$permalink}");
86
  }
87
 
88
+ // 6. Additional filter
89
  $permalink = apply_filters('permalink_manager_filter_final_post_permalink', user_trailingslashit($permalink), $post, $old_permalink);
90
 
91
  return $permalink;
620
  * Update URI when new post is added
621
  */
622
  function new_post_uri($post_id) {
623
+ global $post, $permalink_manager_uris, $permalink_manager_options, $permalink_manager_before_sections_html;
624
 
625
  // Do not trigger if post is a revision
626
  if(wp_is_post_revision($post_id)) { return $post_id; }
627
 
628
+ // Prevent language mismatch in MultilingualPress plugin
629
+ if(in_array($pagenow, array('post-new.php', 'post.php')) && empty($_POST['post_ID'])) { return $post_id; }
630
+
631
  // Do not do anything if post is autosaved
632
  if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; }
633
 
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.6
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.6' );
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.7
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.7' );
25
  define( 'PERMALINK_MANAGER_FILE', __FILE__ );
26
  define( 'PERMALINK_MANAGER_DIR', untrailingslashit( dirname( __FILE__ ) ) );
27
  define( 'PERMALINK_MANAGER_BASENAME', plugin_basename(__FILE__) );