Version Description
Download this release
Release Info
Developer | mbis |
Plugin | Permalink Manager Lite |
Version | 2.2.2 |
Comparing to | |
See all releases |
Code changes from version 2.2.1.2 to 2.2.2
- README.txt +8 -4
- includes/core/permalink-manager-admin-functions.php +12 -9
- includes/core/permalink-manager-core-functions.php +3 -2
- includes/core/permalink-manager-helper-functions.php +2 -2
- includes/core/permalink-manager-third-parties.php +92 -7
- includes/core/permalink-manager-uri-functions-post.php +22 -11
- includes/views/permalink-manager-settings.php +6 -0
- includes/views/permalink-manager-uri-editor-post.php +2 -2
- out/permalink-manager-admin.js +8 -0
- permalink-manager.php +16 -13
README.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
=== Permalink Manager
|
2 |
Contributors: mbis
|
3 |
Donate link: https://www.paypal.me/Bismit
|
4 |
License: GPLv3
|
@@ -6,8 +6,8 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
6 |
Tags: urls, permalinks, custom permalinks, url, permalink, woocommerce permalinks
|
7 |
Requires at least: 4.4.0
|
8 |
Requires PHP: 5.4
|
9 |
-
Tested up to: 5.
|
10 |
-
Stable tag: 2.2.
|
11 |
|
12 |
Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
|
13 |
|
@@ -87,7 +87,11 @@ A. Currently there is no 100% guarantee that Permalink Manager will work correct
|
|
87 |
|
88 |
== Changelog ==
|
89 |
|
90 |
-
= 2.2.
|
|
|
|
|
|
|
|
|
91 |
* Hotfix for function that detects custom URIs
|
92 |
* Custom URIs for WP All Import inported posts are now generated 30 seconds after the import job is completed
|
93 |
|
1 |
+
=== Permalink Manager Lite ===
|
2 |
Contributors: mbis
|
3 |
Donate link: https://www.paypal.me/Bismit
|
4 |
License: GPLv3
|
6 |
Tags: urls, permalinks, custom permalinks, url, permalink, woocommerce permalinks
|
7 |
Requires at least: 4.4.0
|
8 |
Requires PHP: 5.4
|
9 |
+
Tested up to: 5.2
|
10 |
+
Stable tag: 2.2.2
|
11 |
|
12 |
Advanced plugin that allows to set-up custom permalinks (bulk editors included), slugs and permastructures (WooCommerce compatible).
|
13 |
|
87 |
|
88 |
== Changelog ==
|
89 |
|
90 |
+
= 2.2.0 =
|
91 |
+
* Code improvement for "Quick Edit" inline form
|
92 |
+
* Support for Yoast SEO breadcrumbs added
|
93 |
+
|
94 |
+
= 2.2.1.1/2.2.1.2/2.2.1.3/2.2.1.4 =
|
95 |
* Hotfix for function that detects custom URIs
|
96 |
* Custom URIs for WP All Import inported posts are now generated 30 seconds after the import job is completed
|
97 |
|
includes/core/permalink-manager-admin-functions.php
CHANGED
@@ -40,26 +40,29 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
|
|
40 |
public function redirect_customizer() {
|
41 |
if(strpos($_SERVER['REQUEST_URI'], 'customize.php') && !empty($_GET['url'])) {
|
42 |
$old_url = $_GET['url'];
|
|
|
|
|
43 |
|
44 |
// Detect the post/term
|
45 |
$element = Permalink_Manager_Core_Functions::detect_post(null, $old_url, true);
|
46 |
|
47 |
if(!empty($element->ID)) {
|
48 |
-
$
|
49 |
} else if(!empty($element->term_id)) {
|
50 |
-
$
|
51 |
}
|
52 |
|
53 |
// Get the full URL
|
54 |
-
if(!empty($
|
55 |
-
$
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
59 |
|
60 |
// Redirect to customizer with native permalink
|
61 |
-
if($
|
62 |
-
wp_safe_redirect($
|
63 |
exit();
|
64 |
}
|
65 |
}
|
40 |
public function redirect_customizer() {
|
41 |
if(strpos($_SERVER['REQUEST_URI'], 'customize.php') && !empty($_GET['url'])) {
|
42 |
$old_url = $_GET['url'];
|
43 |
+
$old_path = trim(parse_url($old_url, PHP_URL_PATH), "/");
|
44 |
+
$old_query = parse_url($old_url, PHP_URL_QUERY);
|
45 |
|
46 |
// Detect the post/term
|
47 |
$element = Permalink_Manager_Core_Functions::detect_post(null, $old_url, true);
|
48 |
|
49 |
if(!empty($element->ID)) {
|
50 |
+
$correct_permalink = get_permalink($element->ID);
|
51 |
} else if(!empty($element->term_id)) {
|
52 |
+
$correct_permalink = get_term_link($element, $element->taxonomy);
|
53 |
}
|
54 |
|
55 |
// Get the full URL
|
56 |
+
if(!empty($correct_permalink)) {
|
57 |
+
$new_path = trim(parse_url($correct_permalink, PHP_URL_PATH), "/");
|
58 |
+
|
59 |
+
$new_customize_url = wp_customize_url();
|
60 |
+
$new_customize_url .= "?" . str_replace(urlencode($old_path), urlencode($new_path), parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY));
|
61 |
+
$new_customize_url .= ($old_query) ? "&{$old_query}" : "";
|
62 |
|
63 |
// Redirect to customizer with native permalink
|
64 |
+
if($old_path !== $new_path) {
|
65 |
+
wp_safe_redirect($new_customize_url);
|
66 |
exit();
|
67 |
}
|
68 |
}
|
includes/core/permalink-manager-core-functions.php
CHANGED
@@ -131,6 +131,7 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
|
|
131 |
// Decode both request URI & URIs array & make them lowercase (and save in a separate variable)
|
132 |
if(empty($element_id)) {
|
133 |
$uri = strtolower(urldecode($uri));
|
|
|
134 |
foreach($all_uris as $raw_uri => $uri_id) {
|
135 |
$raw_uri = strtolower(urldecode($raw_uri));
|
136 |
$all_uris[$raw_uri] = $uri_id;
|
@@ -142,7 +143,7 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
|
|
142 |
// Atempt 3.
|
143 |
// Check again in case someone used post/tax IDs instead of slugs
|
144 |
//if(empty($element_id) && $deep_detect_enabled && (isset($old_query['page']))) {
|
145 |
-
if($deep_detect_enabled && (
|
146 |
$element_id = $all_uris["{$uri}/{$endpoint_value}"];
|
147 |
$endpoint_value = $endpoint = "";
|
148 |
}
|
@@ -602,7 +603,7 @@ class Permalink_Manager_Core_Functions extends Permalink_Manager_Class {
|
|
602 |
/**
|
603 |
* 4. Prevent redirect loop
|
604 |
*/
|
605 |
-
if(!empty($correct_permalink) && !empty($wp->request) && !empty($redirect_type) && $redirect_type != 'slash_redirect') {
|
606 |
$current_uri = trim($wp->request, "/");
|
607 |
$redirect_uri = trim(parse_url($correct_permalink, PHP_URL_PATH), "/");
|
608 |
|
131 |
// Decode both request URI & URIs array & make them lowercase (and save in a separate variable)
|
132 |
if(empty($element_id)) {
|
133 |
$uri = strtolower(urldecode($uri));
|
134 |
+
|
135 |
foreach($all_uris as $raw_uri => $uri_id) {
|
136 |
$raw_uri = strtolower(urldecode($raw_uri));
|
137 |
$all_uris[$raw_uri] = $uri_id;
|
143 |
// Atempt 3.
|
144 |
// Check again in case someone used post/tax IDs instead of slugs
|
145 |
//if(empty($element_id) && $deep_detect_enabled && (isset($old_query['page']))) {
|
146 |
+
if($deep_detect_enabled && is_numeric($endpoint_value) && isset($all_uris["{$uri}/{$endpoint_value}"])) {
|
147 |
$element_id = $all_uris["{$uri}/{$endpoint_value}"];
|
148 |
$endpoint_value = $endpoint = "";
|
149 |
}
|
603 |
/**
|
604 |
* 4. Prevent redirect loop
|
605 |
*/
|
606 |
+
if(!empty($correct_permalink) && is_string($correct_permalink) && !empty($wp->request) && !empty($redirect_type) && $redirect_type != 'slash_redirect') {
|
607 |
$current_uri = trim($wp->request, "/");
|
608 |
$redirect_uri = trim(parse_url($correct_permalink, PHP_URL_PATH), "/");
|
609 |
|
includes/core/permalink-manager-helper-functions.php
CHANGED
@@ -138,7 +138,7 @@ class Permalink_Manager_Helper_Functions extends Permalink_Manager_Class {
|
|
138 |
if($is_taxonomy) {
|
139 |
return array('product_shipping_class');
|
140 |
} else {
|
141 |
-
return array('revision', 'algolia_task', 'fl_builder', 'fl-builder', 'fl-theme-layout', 'wc_product_tab', 'wc_voucher', 'wc_voucher_template', 'sliders');
|
142 |
}
|
143 |
}
|
144 |
|
@@ -198,7 +198,7 @@ class Permalink_Manager_Helper_Functions extends Permalink_Manager_Class {
|
|
198 |
static function get_post_types_array($format = null, $cpt = null, $all = false) {
|
199 |
global $wp_post_types;
|
200 |
|
201 |
-
$post_types = get_post_types(array('
|
202 |
$disabled_post_types = self::get_disabled_post_types();
|
203 |
|
204 |
// Include native post types
|
138 |
if($is_taxonomy) {
|
139 |
return array('product_shipping_class');
|
140 |
} else {
|
141 |
+
return array('revision', 'algolia_task', 'fl_builder', 'fl-builder', 'fl-theme-layout', 'wc_product_tab', 'wc_voucher', 'wc_voucher_template', 'sliders', 'thirstylink');
|
142 |
}
|
143 |
}
|
144 |
|
198 |
static function get_post_types_array($format = null, $cpt = null, $all = false) {
|
199 |
global $wp_post_types;
|
200 |
|
201 |
+
$post_types = get_post_types(array('publicly_queryable' => true, '_builtin' => false), 'objects', 'AND');
|
202 |
$disabled_post_types = self::get_disabled_post_types();
|
203 |
|
204 |
// Include native post types
|
includes/core/permalink-manager-third-parties.php
CHANGED
@@ -86,7 +86,7 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
|
|
86 |
|
87 |
// 4. WooCommerce
|
88 |
if(class_exists('WooCommerce')) {
|
89 |
-
add_filter('request', array($this, 'woocommerce_detect'),
|
90 |
add_filter('template_redirect', array($this, 'woocommerce_checkout_fix'), 9);
|
91 |
|
92 |
if(class_exists('WooCommerce') && class_exists('Permalink_Manager_Pro_Functions')) {
|
@@ -108,7 +108,8 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
|
|
108 |
}
|
109 |
|
110 |
// 6. Yoast SEO
|
111 |
-
add_filter('wpseo_xml_sitemap_post_url', array($this, 'yoast_fix_sitemap_urls'));
|
|
|
112 |
|
113 |
// 7. WooCommerce Wishlist Plugin
|
114 |
if(function_exists('tinv_get_option')) {
|
@@ -574,7 +575,7 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
|
|
574 |
* 4. WooCommerce
|
575 |
*/
|
576 |
function woocommerce_detect($query) {
|
577 |
-
global $woocommerce, $
|
578 |
|
579 |
$shop_page_id = get_option('woocommerce_shop_page_id');
|
580 |
|
@@ -582,7 +583,7 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
|
|
582 |
$shop_page_id = apply_filters('wpml_object_id', $shop_page_id, 'page', TRUE);
|
583 |
|
584 |
// Fix shop page
|
585 |
-
if(!empty($
|
586 |
$query['post_type'] = 'product';
|
587 |
unset($query['pagename']);
|
588 |
}
|
@@ -604,10 +605,10 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
|
|
604 |
}
|
605 |
|
606 |
function woocommerce_checkout_fix() {
|
607 |
-
global $wp_query, $
|
608 |
|
609 |
// Redirect from Shop archive to selected page
|
610 |
-
if(is_shop() && empty($
|
611 |
$redirect_mode = (!empty($permalink_manager_options['general']['redirect'])) ? $permalink_manager_options['general']['redirect'] : false;
|
612 |
$redirect_shop = apply_filters('permalink-manager-redirect-shop-archive', false);
|
613 |
$shop_page = get_option('woocommerce_shop_page_id');
|
@@ -649,7 +650,7 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
|
|
649 |
}
|
650 |
|
651 |
/**
|
652 |
-
* 6.
|
653 |
*/
|
654 |
function yoast_fix_sitemap_urls($permalink) {
|
655 |
if(class_exists('WPSEO_Utils')) {
|
@@ -662,6 +663,90 @@ class Permalink_Manager_Third_Parties extends Permalink_Manager_Class {
|
|
662 |
return $permalink;
|
663 |
}
|
664 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
/**
|
666 |
* 7. Support WooCommerce Wishlist Plugin
|
667 |
*/
|
86 |
|
87 |
// 4. WooCommerce
|
88 |
if(class_exists('WooCommerce')) {
|
89 |
+
add_filter('request', array($this, 'woocommerce_detect'), 20, 1);
|
90 |
add_filter('template_redirect', array($this, 'woocommerce_checkout_fix'), 9);
|
91 |
|
92 |
if(class_exists('WooCommerce') && class_exists('Permalink_Manager_Pro_Functions')) {
|
108 |
}
|
109 |
|
110 |
// 6. Yoast SEO
|
111 |
+
add_filter('wpseo_xml_sitemap_post_url', array($this, 'yoast_fix_sitemap_urls'), 9);
|
112 |
+
add_filter('wpseo_breadcrumb_links', array($this, 'yoast_fix_breadcrumbs'), 9);
|
113 |
|
114 |
// 7. WooCommerce Wishlist Plugin
|
115 |
if(function_exists('tinv_get_option')) {
|
575 |
* 4. WooCommerce
|
576 |
*/
|
577 |
function woocommerce_detect($query) {
|
578 |
+
global $woocommerce, $pm_query;
|
579 |
|
580 |
$shop_page_id = get_option('woocommerce_shop_page_id');
|
581 |
|
583 |
$shop_page_id = apply_filters('wpml_object_id', $shop_page_id, 'page', TRUE);
|
584 |
|
585 |
// Fix shop page
|
586 |
+
if(!empty($pm_query['id']) && is_numeric($pm_query['id']) && $shop_page_id == $pm_query['id']) {
|
587 |
$query['post_type'] = 'product';
|
588 |
unset($query['pagename']);
|
589 |
}
|
605 |
}
|
606 |
|
607 |
function woocommerce_checkout_fix() {
|
608 |
+
global $wp_query, $pm_query, $permalink_manager_options;
|
609 |
|
610 |
// Redirect from Shop archive to selected page
|
611 |
+
if(is_shop() && empty($pm_query['id'])) {
|
612 |
$redirect_mode = (!empty($permalink_manager_options['general']['redirect'])) ? $permalink_manager_options['general']['redirect'] : false;
|
613 |
$redirect_shop = apply_filters('permalink-manager-redirect-shop-archive', false);
|
614 |
$shop_page = get_option('woocommerce_shop_page_id');
|
650 |
}
|
651 |
|
652 |
/**
|
653 |
+
* 6. Yoast SEO hooks
|
654 |
*/
|
655 |
function yoast_fix_sitemap_urls($permalink) {
|
656 |
if(class_exists('WPSEO_Utils')) {
|
663 |
return $permalink;
|
664 |
}
|
665 |
|
666 |
+
function yoast_fix_breadcrumbs($links) {
|
667 |
+
// Get post type permastructure settings
|
668 |
+
global $permalink_manager_permastructs, $permalink_manager_uris, $permalink_manager_options, $post, $wpdb;
|
669 |
+
|
670 |
+
// Check if filter should be activated
|
671 |
+
if(empty($permalink_manager_options['general']['yoast_breadcrumbs'])) { return $links; }
|
672 |
+
|
673 |
+
// Get post type
|
674 |
+
$post_type = (!empty($post->post_type)) ? $post->post_type : '';
|
675 |
+
|
676 |
+
if(!empty($post_type) && !empty($permalink_manager_permastructs) && !empty($permalink_manager_permastructs['post_types'][$post_type])) {
|
677 |
+
$queried_element = get_queried_object();
|
678 |
+
if(!empty($queried_element->ID)) {
|
679 |
+
$element_id = $queried_element->ID;
|
680 |
+
} else if(!empty($queried_element->term_id)) {
|
681 |
+
$element_id = "tax-{$queried_element->term_id}";
|
682 |
+
} else {
|
683 |
+
return $links;
|
684 |
+
}
|
685 |
+
|
686 |
+
if(!empty($permalink_manager_uris[$element_id])) {
|
687 |
+
$custom_uri = preg_replace("/([^\/]+)$/", '', $permalink_manager_uris[$element_id]);
|
688 |
+
} else {
|
689 |
+
return $links;
|
690 |
+
}
|
691 |
+
|
692 |
+
$custom_uri_parts = explode('/', trim($custom_uri));
|
693 |
+
$breadcrumbs = array();
|
694 |
+
|
695 |
+
// Get Yoast meta
|
696 |
+
$yoast_meta_terms = get_option('wpseo_taxonomy_meta');
|
697 |
+
|
698 |
+
// Get internal breadcrumb elements
|
699 |
+
foreach($custom_uri_parts as $slug) {
|
700 |
+
if(empty($slug)) { continue; }
|
701 |
+
|
702 |
+
$available_taxonomies = Permalink_Manager_Helper_Functions::get_taxonomies_array();
|
703 |
+
$available_post_types = Permalink_Manager_Helper_Functions::get_post_types_array();
|
704 |
+
|
705 |
+
// A. Try to get term
|
706 |
+
if(!empty($available_taxonomies)) {
|
707 |
+
$sql = sprintf("SELECT t.term_id, t.name, tt.taxonomy FROM {$wpdb->terms} AS t LEFT JOIN {$wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE slug = '%s' AND tt.taxonomy IN ('%s') LIMIT 1", $slug, implode("','", array_keys($available_taxonomies)));
|
708 |
+
|
709 |
+
$element = $wpdb->get_row($sql);
|
710 |
+
}
|
711 |
+
|
712 |
+
// B. Try to get page/post
|
713 |
+
if(empty($element) && !empty($available_post_types)) {
|
714 |
+
$sql = sprintf("SELECT ID, post_title FROM {$wpdb->posts} WHERE post_name = '%s' AND post_status = 'publish' AND post_type IN ('%s') AND post_type != 'attachment' LIMIT 1", $slug, implode("','", array_keys($available_post_types)));
|
715 |
+
|
716 |
+
$element = $wpdb->get_row($sql);
|
717 |
+
}
|
718 |
+
|
719 |
+
if(!empty($element->term_id)) {
|
720 |
+
$title = (!empty($yoast_meta_terms[$element->taxonomy][$element->term_id]['wpseo_bctitle'])) ? $yoast_meta_terms[$element->taxonomy][$element->term_id]['wpseo_bctitle'] : $element->name;
|
721 |
+
|
722 |
+
$breadcrumbs[] = array(
|
723 |
+
'text' => $title,
|
724 |
+
'url' => get_term_link((int) $element->term_id, $element->taxonomy),
|
725 |
+
);
|
726 |
+
} else if(!empty($element->ID)) {
|
727 |
+
$title = get_post_meta($element->ID, '_yoast_wpseo_bctitle', true);
|
728 |
+
$title = (!empty($title)) ? $title : $element->post_title;
|
729 |
+
|
730 |
+
$breadcrumbs[] = array(
|
731 |
+
'text' => $title,
|
732 |
+
'url' => get_permalink($element->ID),
|
733 |
+
);
|
734 |
+
}
|
735 |
+
}
|
736 |
+
|
737 |
+
// Get new links
|
738 |
+
if(!empty($links) && is_array($links)) {
|
739 |
+
$first_element = reset($links);
|
740 |
+
$last_element = end($links);
|
741 |
+
$breadcrumbs = (!empty($breadcrumbs)) ? $breadcrumbs : array();
|
742 |
+
|
743 |
+
$links = array_merge(array($first_element), $breadcrumbs, array($last_element));
|
744 |
+
}
|
745 |
+
}
|
746 |
+
|
747 |
+
return array_filter($links);
|
748 |
+
}
|
749 |
+
|
750 |
/**
|
751 |
* 7. Support WooCommerce Wishlist Plugin
|
752 |
*/
|
includes/core/permalink-manager-uri-functions-post.php
CHANGED
@@ -35,14 +35,13 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
35 |
* Init
|
36 |
*/
|
37 |
function admin_init() {
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
}
|
46 |
}
|
47 |
|
48 |
/**
|
@@ -54,6 +53,9 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
54 |
// Do not filter permalinks in Customizer
|
55 |
if((function_exists('is_customize_preview') && is_customize_preview())) { return $permalink; }
|
56 |
|
|
|
|
|
|
|
57 |
$post = (is_integer($post)) ? get_post($post) : $post;
|
58 |
|
59 |
// Start with homepage URL
|
@@ -644,10 +646,15 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
644 |
}
|
645 |
|
646 |
function quick_edit_column_content($column_name, $post_id) {
|
647 |
-
global $permalink_manager_uris, $
|
648 |
|
649 |
if($column_name == "permalink-manager-col") {
|
650 |
-
|
|
|
|
|
|
|
|
|
|
|
651 |
}
|
652 |
}
|
653 |
|
@@ -745,8 +752,12 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
745 |
if(in_array($post->post_status, array('auto-draft', 'trash'))) { return $post_id; }
|
746 |
|
747 |
// Get auto-update URI setting (if empty use global setting)
|
748 |
-
|
749 |
-
|
|
|
|
|
|
|
|
|
750 |
|
751 |
$default_uri = self::get_default_post_uri($post_id);
|
752 |
$native_uri = self::get_default_post_uri($post_id, true);
|
35 |
* Init
|
36 |
*/
|
37 |
function admin_init() {
|
38 |
+
$post_types = Permalink_Manager_Helper_Functions::get_post_types_array();
|
39 |
|
40 |
+
// Add "URI Editor" to "Quick Edit" for all post_types
|
41 |
+
foreach($post_types as $post_type => $label) {
|
42 |
+
add_filter( "manage_{$post_type}_posts_columns" , array($this, 'quick_edit_column') );
|
43 |
+
add_filter( "manage_{$post_type}_posts_custom_column" , array($this, 'quick_edit_column_content'), 10, 2 );
|
44 |
+
}
|
|
|
45 |
}
|
46 |
|
47 |
/**
|
53 |
// Do not filter permalinks in Customizer
|
54 |
if((function_exists('is_customize_preview') && is_customize_preview())) { return $permalink; }
|
55 |
|
56 |
+
// Do not filter in Elementor
|
57 |
+
if(!empty($_GET['action']) && $_GET['action'] == 'elementor') { return $permalink; }
|
58 |
+
|
59 |
$post = (is_integer($post)) ? get_post($post) : $post;
|
60 |
|
61 |
// Start with homepage URL
|
646 |
}
|
647 |
|
648 |
function quick_edit_column_content($column_name, $post_id) {
|
649 |
+
global $permalink_manager_uris, $permalink_manager_options;
|
650 |
|
651 |
if($column_name == "permalink-manager-col") {
|
652 |
+
// Get auto-update settings
|
653 |
+
$auto_update_val = get_post_meta($post_id, "auto_update_uri", true);
|
654 |
+
$auto_update_uri = (!empty($auto_update_val)) ? $auto_update_val : $permalink_manager_options["general"]["auto_update_uris"];
|
655 |
+
|
656 |
+
$uri = (!empty($permalink_manager_uris[$post_id])) ? urldecode($permalink_manager_uris[$post_id]) : self::get_post_uri($post_id, true);
|
657 |
+
printf('<span class="permalink-manager-col-uri" data-auto_update="%s">%s</span>', intval($auto_update_uri), $uri);
|
658 |
}
|
659 |
}
|
660 |
|
752 |
if(in_array($post->post_status, array('auto-draft', 'trash'))) { return $post_id; }
|
753 |
|
754 |
// Get auto-update URI setting (if empty use global setting)
|
755 |
+
if(!empty($_POST["auto_update_uri"])) {
|
756 |
+
$auto_update_uri_current = intval($_POST["auto_update_uri"]);
|
757 |
+
} else if(!empty($_POST["action"]) && $_POST['action'] == 'inline-save') {
|
758 |
+
$auto_update_uri_current = get_post_meta($post_id, "auto_update_uri", true);
|
759 |
+
}
|
760 |
+
$auto_update_uri = (!empty($auto_update_uri_current)) ? $auto_update_uri_current : $permalink_manager_options["general"]["auto_update_uris"];
|
761 |
|
762 |
$default_uri = self::get_default_post_uri($post_id);
|
763 |
$native_uri = self::get_default_post_uri($post_id, true);
|
includes/views/permalink-manager-settings.php
CHANGED
@@ -112,6 +112,12 @@ class Permalink_Manager_Settings extends Permalink_Manager_Class {
|
|
112 |
'input_class' => '',
|
113 |
'description' => __('If checked, the custom URIs will not be assigned to the posts imported by Wp All Import Pro plugin.', 'permalink-manager')
|
114 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
'force_custom_slugs' => array(
|
116 |
'type' => 'select',
|
117 |
'label' => __('Use actual post/term titles (Force custom slugs)', 'permalink-manager'),
|
112 |
'input_class' => '',
|
113 |
'description' => __('If checked, the custom URIs will not be assigned to the posts imported by Wp All Import Pro plugin.', 'permalink-manager')
|
114 |
),
|
115 |
+
'yoast_breadcrumbs' => array(
|
116 |
+
'type' => 'single_checkbox',
|
117 |
+
'label' => __('Yoast SEO breadcrumbs', 'permalink-manager'),
|
118 |
+
'input_class' => '',
|
119 |
+
'description' => __('If checked, the Yoast SEO breadcrumbs will be filtered by Permalink Manager to mimic the current URL structure.', 'permalink-manager')
|
120 |
+
),
|
121 |
'force_custom_slugs' => array(
|
122 |
'type' => 'select',
|
123 |
'label' => __('Use actual post/term titles (Force custom slugs)', 'permalink-manager'),
|
includes/views/permalink-manager-uri-editor-post.php
CHANGED
@@ -138,8 +138,8 @@ class Permalink_Manager_URI_Editor_Post extends WP_List_Table {
|
|
138 |
function extra_tablenav($which) {
|
139 |
global $wpdb, $active_section, $active_subsection;
|
140 |
|
141 |
-
$button_top = __( '
|
142 |
-
$button_bottom = __( '
|
143 |
|
144 |
$html = "<div class=\"alignleft actions\">";
|
145 |
$html .= get_submit_button( ${"button_$which"}, 'primary alignleft', "update_all_slugs[{$which}]", false, array( 'id' => 'doaction', 'value' => 'update_all_slugs' ) );
|
138 |
function extra_tablenav($which) {
|
139 |
global $wpdb, $active_section, $active_subsection;
|
140 |
|
141 |
+
$button_top = __( 'Save all the URIs below', 'permalink-manager' );
|
142 |
+
$button_bottom = __( 'Save all the URIs above', 'permalink-manager' );
|
143 |
|
144 |
$html = "<div class=\"alignleft actions\">";
|
145 |
$html .= get_submit_button( ${"button_$which"}, 'primary alignleft', "update_all_slugs[{$which}]", false, array( 'id' => 'doaction', 'value' => 'update_all_slugs' ) );
|
out/permalink-manager-admin.js
CHANGED
@@ -472,6 +472,14 @@ jQuery(document).ready(function() {
|
|
472 |
// Fill with the Custom URI
|
473 |
custom_uri_field.val(custom_uri);
|
474 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
// Set the element ID
|
476 |
jQuery('#edit-' + post_id).find('.permalink-manager-edit-uri-element-id').val(post_id);
|
477 |
}
|
472 |
// Fill with the Custom URI
|
473 |
custom_uri_field.val(custom_uri);
|
474 |
|
475 |
+
// Get auto-update settings
|
476 |
+
auto_update = jQuery("#post-" + post_id).find(".permalink-manager-col-uri").attr('data-auto_update');
|
477 |
+
if(typeof auto_update !== "undefined" && auto_update == 1) {
|
478 |
+
custom_uri_field.attr('readonly', 'readonly');
|
479 |
+
}
|
480 |
+
|
481 |
+
console.log(auto_update);
|
482 |
+
|
483 |
// Set the element ID
|
484 |
jQuery('#edit-' + post_id).find('.permalink-manager-edit-uri-element-id').val(post_id);
|
485 |
}
|
permalink-manager.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Plugin Name: Permalink Manager
|
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.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.2.
|
25 |
define( 'PERMALINK_MANAGER_FILE', __FILE__ );
|
26 |
define( 'PERMALINK_MANAGER_DIR', untrailingslashit(dirname(__FILE__)) );
|
27 |
define( 'PERMALINK_MANAGER_BASENAME', dirname(plugin_basename(__FILE__)));
|
@@ -146,26 +146,28 @@ class Permalink_Manager_Class {
|
|
146 |
$all_taxonomies = Permalink_Manager_Helper_Functions::get_taxonomies_array();
|
147 |
$all_post_types = Permalink_Manager_Helper_Functions::get_post_types_array();
|
148 |
|
149 |
-
$default_settings = apply_filters('
|
150 |
'screen-options' => array(
|
151 |
'per_page' => 20,
|
152 |
'post_statuses' => array('publish'),
|
153 |
'group' => false,
|
154 |
),
|
155 |
'general' => array(
|
156 |
-
'force_custom_slugs' => 0,
|
157 |
-
'disable_slug_sanitization' => 0,
|
158 |
-
'show_native_slug_field' => 0,
|
159 |
'auto_update_uris' => 0,
|
|
|
|
|
160 |
'setup_redirects' => 1,
|
161 |
'redirect' => '301',
|
162 |
-
'canonical_redirect' => 1,
|
163 |
'trailing_slashes' => 0,
|
164 |
'pagination_redirect' => 0,
|
165 |
'auto_remove_duplicates' => 1,
|
|
|
|
|
|
|
|
|
|
|
166 |
'partial_disable' => array(),
|
167 |
'deep_detect' => 1,
|
168 |
-
'fix_language_mismatch' => 1
|
169 |
),
|
170 |
'licence' => array()
|
171 |
));
|
@@ -191,14 +193,14 @@ class Permalink_Manager_Class {
|
|
191 |
'txt' => sprintf(
|
192 |
__("Get access to extra features: full taxonomy and WooCommerce support, possibility to use custom fields inside the permalinks and more!<br /><strong>Buy Permalink Manager Pro <a href=\"%s\" target=\"_blank\">here</a> and save %s using \"%s\" coupon code!</strong> Valid until %s!", "permalink-manager"),
|
193 |
PERMALINK_MANAGER_WEBSITE,
|
194 |
-
'
|
195 |
-
'
|
196 |
-
'
|
197 |
),
|
198 |
'type' => 'notice-info',
|
199 |
'show' => 'pro_hide',
|
200 |
'plugin_only' => true,
|
201 |
-
'until' => '
|
202 |
)
|
203 |
));
|
204 |
|
@@ -255,6 +257,7 @@ class Permalink_Manager_Class {
|
|
255 |
*/
|
256 |
function deprecated_hooks_list($filters = true) {
|
257 |
$deprecated_filters = array(
|
|
|
258 |
'permalink_manager_options' => 'permalink-manager-options',
|
259 |
'permalink_manager_uris' => 'permalink-manager-uris',
|
260 |
'permalink_manager_alerts' => 'permalink-manager-alerts',
|
1 |
<?php
|
2 |
|
3 |
/**
|
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.2.2
|
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.2.2' );
|
25 |
define( 'PERMALINK_MANAGER_FILE', __FILE__ );
|
26 |
define( 'PERMALINK_MANAGER_DIR', untrailingslashit(dirname(__FILE__)) );
|
27 |
define( 'PERMALINK_MANAGER_BASENAME', dirname(plugin_basename(__FILE__)));
|
146 |
$all_taxonomies = Permalink_Manager_Helper_Functions::get_taxonomies_array();
|
147 |
$all_post_types = Permalink_Manager_Helper_Functions::get_post_types_array();
|
148 |
|
149 |
+
$default_settings = apply_filters('permalink_manager_default_options', array(
|
150 |
'screen-options' => array(
|
151 |
'per_page' => 20,
|
152 |
'post_statuses' => array('publish'),
|
153 |
'group' => false,
|
154 |
),
|
155 |
'general' => array(
|
|
|
|
|
|
|
156 |
'auto_update_uris' => 0,
|
157 |
+
'show_native_slug_field' => 0,
|
158 |
+
'canonical_redirect' => 1,
|
159 |
'setup_redirects' => 1,
|
160 |
'redirect' => '301',
|
|
|
161 |
'trailing_slashes' => 0,
|
162 |
'pagination_redirect' => 0,
|
163 |
'auto_remove_duplicates' => 1,
|
164 |
+
'fix_language_mismatch' => 1,
|
165 |
+
'pmxi_import_support' => 1,
|
166 |
+
'yoast_breadcrumbs' => 0,
|
167 |
+
'force_custom_slugs' => 0,
|
168 |
+
'disable_slug_sanitization' => 0,
|
169 |
'partial_disable' => array(),
|
170 |
'deep_detect' => 1,
|
|
|
171 |
),
|
172 |
'licence' => array()
|
173 |
));
|
193 |
'txt' => sprintf(
|
194 |
__("Get access to extra features: full taxonomy and WooCommerce support, possibility to use custom fields inside the permalinks and more!<br /><strong>Buy Permalink Manager Pro <a href=\"%s\" target=\"_blank\">here</a> and save %s using \"%s\" coupon code!</strong> Valid until %s!", "permalink-manager"),
|
195 |
PERMALINK_MANAGER_WEBSITE,
|
196 |
+
'25%',
|
197 |
+
'MAY2019',
|
198 |
+
'15.05'
|
199 |
),
|
200 |
'type' => 'notice-info',
|
201 |
'show' => 'pro_hide',
|
202 |
'plugin_only' => true,
|
203 |
+
'until' => '2019-05-14'
|
204 |
)
|
205 |
));
|
206 |
|
257 |
*/
|
258 |
function deprecated_hooks_list($filters = true) {
|
259 |
$deprecated_filters = array(
|
260 |
+
'permalink_manager_default_options' => 'permalink-manager-default-options',
|
261 |
'permalink_manager_options' => 'permalink-manager-options',
|
262 |
'permalink_manager_uris' => 'permalink-manager-uris',
|
263 |
'permalink_manager_alerts' => 'permalink-manager-alerts',
|