Version Description
- Additional debug functions added
Download this release
Release Info
Developer | mbis |
Plugin | Permalink Manager Lite |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.4
- README.txt +10 -8
- includes/core/permalink-manager-actions.php +29 -6
- includes/core/permalink-manager-admin-functions.php +62 -48
- includes/core/permalink-manager-uri-functions-post.php +72 -29
- includes/views/permalink-manager-advanced.php +13 -10
- includes/views/permalink-manager-permastructs.php +5 -5
- includes/views/permalink-manager-settings.php +5 -1
- includes/views/permalink-manager-tools.php +2 -2
- includes/views/permalink-manager-uri-editor-post.php +2 -2
- includes/views/permalink-manager-uri-editor.php +2 -2
- languages/permalink-manager.pot +216 -366
- out/permalink-manager-admin.css +2 -0
- permalink-manager.php +30 -20
README.txt
CHANGED
@@ -5,7 +5,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
5 |
Tags: urls, permalinks, slugs, custom url, custom permalinks, uris, url, slug, permalink
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.7.3
|
8 |
-
Stable tag: 1.0.
|
9 |
|
10 |
Most advanced yet easy-to-use permalink plugin that helps to maintain & bulk change your URLs & slugs.
|
11 |
|
@@ -44,12 +44,6 @@ http://example.com/poland/cities/poznan === [not changed] ===> http://example.co
|
|
44 |
* Optional redirect (301 or 302) from old (native) permalinks to new (custom) permalinks.
|
45 |
* Possibility to disable native canonical redirects.
|
46 |
|
47 |
-
= Planned functionalities =
|
48 |
-
|
49 |
-
* REGEX for `Find and replace` section
|
50 |
-
* Support for WPML and another language plugins
|
51 |
-
* AJAX support.
|
52 |
-
|
53 |
== Installation ==
|
54 |
|
55 |
Go to `Plugins -> Add New` section from your admin account and search for `Permalink Manager`.
|
@@ -76,8 +70,16 @@ After the plugin is installed you can access its dashboard from this page: `Tool
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
= 1.0.1 =
|
80 |
-
*
|
81 |
|
82 |
= 1.0.0 =
|
83 |
* Further refactoring
|
5 |
Tags: urls, permalinks, slugs, custom url, custom permalinks, uris, url, slug, permalink
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.7.3
|
8 |
+
Stable tag: 1.0.2
|
9 |
|
10 |
Most advanced yet easy-to-use permalink plugin that helps to maintain & bulk change your URLs & slugs.
|
11 |
|
44 |
* Optional redirect (301 or 302) from old (native) permalinks to new (custom) permalinks.
|
45 |
* Possibility to disable native canonical redirects.
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
== Installation ==
|
48 |
|
49 |
Go to `Plugins -> Add New` section from your admin account and search for `Permalink Manager`.
|
70 |
|
71 |
== Changelog ==
|
72 |
|
73 |
+
= 1.0.4 =
|
74 |
+
* Additional debug functions added
|
75 |
+
|
76 |
+
= 1.0.2 =
|
77 |
+
* Post pagination fix
|
78 |
+
* Basic REGEX support
|
79 |
+
* 'permalink_manager_filter_final_post_permalink' filter added
|
80 |
+
|
81 |
= 1.0.1 =
|
82 |
+
* WPML support fixes
|
83 |
|
84 |
= 1.0.0 =
|
85 |
* Further refactoring
|
includes/core/permalink-manager-actions.php
CHANGED
@@ -15,15 +15,21 @@ class Permalink_Manager_Actions extends Permalink_Manager_Class {
|
|
15 |
public function trigger_action() {
|
16 |
global $permalink_manager_before_sections_html, $permalink_manager_after_sections_html;
|
17 |
|
18 |
-
// 1. Check if the form was submitted
|
19 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
$actions_map = array(
|
22 |
'uri_editor' => array('function' => 'update_all_permalinks', 'display_uri_table' => true),
|
23 |
'regenerate' => array('function' => 'regenerate_all_permalinks', 'display_uri_table' => true),
|
24 |
'find_and_replace' => array('function' => 'find_and_replace', 'display_uri_table' => true),
|
25 |
'permalink_manager_options' => array('function' => 'save_settings'),
|
26 |
-
'permalink_manager_permastructs' => array('function' => 'save_permastructures')
|
|
|
27 |
);
|
28 |
// Clear URIs & reset settings & permastructs also should be added here.
|
29 |
|
@@ -53,8 +59,7 @@ class Permalink_Manager_Actions extends Permalink_Manager_Class {
|
|
53 |
$permalink_manager_before_sections_html .= Permalink_Manager_Admin_Functions::get_alert_message($alert_content, 'updated');
|
54 |
$permalink_manager_after_sections_html .= Permalink_Manager_Admin_Functions::display_updated_slugs($updated_slugs_array);
|
55 |
} else {
|
56 |
-
$
|
57 |
-
$permalink_manager_before_sections_html .= Permalink_Manager_Admin_Functions::get_alert_message($alert_content, 'error');
|
58 |
}
|
59 |
}
|
60 |
}
|
@@ -96,7 +101,15 @@ class Permalink_Manager_Actions extends Permalink_Manager_Class {
|
|
96 |
$new_options = Permalink_Manager_Helper_Functions::multidimensional_array_map('untrailingslashit', $new_options);
|
97 |
foreach($new_options as $group_name => $group) {
|
98 |
if(is_array($group)) {
|
99 |
-
$group
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
$new_options[$group_name] = array_filter($group);
|
101 |
} else {
|
102 |
unset($new_options[$group_name]);
|
@@ -167,6 +180,16 @@ class Permalink_Manager_Actions extends Permalink_Manager_Class {
|
|
167 |
}
|
168 |
}
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
|
172 |
?>
|
15 |
public function trigger_action() {
|
16 |
global $permalink_manager_before_sections_html, $permalink_manager_after_sections_html;
|
17 |
|
18 |
+
// 1. Check if the form was submitted (make exception for clear sitemap cache function)
|
19 |
+
if(isset($_REQUEST['flush_sitemaps'])) {
|
20 |
+
$this->flush_sitemaps();
|
21 |
+
$permalink_manager_before_sections_html .= Permalink_Manager_Admin_Functions::get_alert_message(__( 'Sitemap was updated!', 'permalink-manager' ), 'updated');
|
22 |
+
|
23 |
+
return;
|
24 |
+
} else if(empty($_POST)) { return; }
|
25 |
|
26 |
$actions_map = array(
|
27 |
'uri_editor' => array('function' => 'update_all_permalinks', 'display_uri_table' => true),
|
28 |
'regenerate' => array('function' => 'regenerate_all_permalinks', 'display_uri_table' => true),
|
29 |
'find_and_replace' => array('function' => 'find_and_replace', 'display_uri_table' => true),
|
30 |
'permalink_manager_options' => array('function' => 'save_settings'),
|
31 |
+
'permalink_manager_permastructs' => array('function' => 'save_permastructures'),
|
32 |
+
'flush_sitemaps' => array('function' => 'save_permastructures'),
|
33 |
);
|
34 |
// Clear URIs & reset settings & permastructs also should be added here.
|
35 |
|
59 |
$permalink_manager_before_sections_html .= Permalink_Manager_Admin_Functions::get_alert_message($alert_content, 'updated');
|
60 |
$permalink_manager_after_sections_html .= Permalink_Manager_Admin_Functions::display_updated_slugs($updated_slugs_array);
|
61 |
} else {
|
62 |
+
$permalink_manager_before_sections_html .= Permalink_Manager_Admin_Functions::get_alert_message(__( '<strong>No slugs</strong> were updated!', 'permalink-manager' ), 'error');
|
|
|
63 |
}
|
64 |
}
|
65 |
}
|
101 |
$new_options = Permalink_Manager_Helper_Functions::multidimensional_array_map('untrailingslashit', $new_options);
|
102 |
foreach($new_options as $group_name => $group) {
|
103 |
if(is_array($group)) {
|
104 |
+
foreach($group as $element => $permastruct) {
|
105 |
+
// Trim slashes
|
106 |
+
$permastruct = trim($permastruct, "/");
|
107 |
+
|
108 |
+
// Do not store default permastructures
|
109 |
+
$default_permastruct = ($group_name == 'post_types') ? Permalink_Manager_Helper_Functions::get_default_permastruct($element, true) : "";
|
110 |
+
if($permastruct == $default_permastruct) { unset($group[$element]); }
|
111 |
+
}
|
112 |
+
// Do not store empty permastructures
|
113 |
$new_options[$group_name] = array_filter($group);
|
114 |
} else {
|
115 |
unset($new_options[$group_name]);
|
180 |
}
|
181 |
}
|
182 |
|
183 |
+
/**
|
184 |
+
* Clear sitemaps cache
|
185 |
+
*/
|
186 |
+
function flush_sitemaps($types = array()) {
|
187 |
+
// Reset sitemap's cache
|
188 |
+
if(class_exists('WPSEO_Sitemaps_Cache')) {
|
189 |
+
$sitemaps = WPSEO_Sitemaps_Cache::clear($types);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
}
|
194 |
|
195 |
?>
|
includes/core/permalink-manager-admin-functions.php
CHANGED
@@ -12,6 +12,7 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
|
|
12 |
public function __construct() {
|
13 |
add_action( 'admin_menu', array($this, 'add_menu_page') );
|
14 |
add_action( 'admin_init', array($this, 'init') );
|
|
|
15 |
}
|
16 |
|
17 |
/**
|
@@ -74,9 +75,8 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
|
|
74 |
public function add_menu_page() {
|
75 |
$this->menu_name = add_management_page( __('Permalink Manager', 'permalink-manager'), __('Permalink Manager', 'permalink-manager'), 'manage_options', $this->plugin_slug, array($this, 'display_section') );
|
76 |
|
77 |
-
|
78 |
-
add_action( '
|
79 |
-
add_action( 'admin_print_scripts-' . $this->menu_name, array($this, 'enqueue_scripts' ) );
|
80 |
}
|
81 |
|
82 |
/**
|
@@ -148,71 +148,80 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
|
|
148 |
|
149 |
switch($args['type']) {
|
150 |
case 'checkbox' :
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
break;
|
169 |
|
170 |
case 'radio' :
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
break;
|
178 |
|
179 |
case 'select' :
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
|
190 |
case 'number' :
|
191 |
-
|
192 |
-
|
193 |
|
194 |
case 'hidden' :
|
195 |
-
|
196 |
-
|
197 |
|
198 |
case 'textarea' :
|
199 |
-
|
200 |
-
|
201 |
|
202 |
case 'pre' :
|
203 |
-
|
204 |
-
|
205 |
|
206 |
case 'clearfix' :
|
207 |
-
|
208 |
|
209 |
case 'permastruct' :
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
|
214 |
default :
|
215 |
-
|
216 |
}
|
217 |
|
218 |
// Get the final HTML output
|
@@ -332,8 +341,8 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
|
|
332 |
|
333 |
$output = "<div id=\"permalink-manager\" class=\"wrap\">";
|
334 |
|
335 |
-
// Display alerts and another content if needed and the plugin header
|
336 |
-
$output .= $permalink_manager_before_sections_html;
|
337 |
$output .= "<h2 id=\"plugin-name-heading\">" . PERMALINK_MANAGER_PLUGIN_NAME . " <a href=\"" . PERMALINK_MANAGER_WEBSITE ."\" target=\"_blank\">" . __('by Maciej Bis', 'permalink-manager') . "</a></h2>";
|
338 |
|
339 |
// Display the tab navigation
|
@@ -451,4 +460,9 @@ class Permalink_Manager_Admin_Functions extends Permalink_Manager_Class {
|
|
451 |
return $output;
|
452 |
}
|
453 |
|
|
|
|
|
|
|
|
|
|
|
454 |
}
|
12 |
public function __construct() {
|
13 |
add_action( 'admin_menu', array($this, 'add_menu_page') );
|
14 |
add_action( 'admin_init', array($this, 'init') );
|
15 |
+
add_action( 'admin_notices', array($this, 'custom_admin_notices') );
|
16 |
}
|
17 |
|
18 |
/**
|
75 |
public function add_menu_page() {
|
76 |
$this->menu_name = add_management_page( __('Permalink Manager', 'permalink-manager'), __('Permalink Manager', 'permalink-manager'), 'manage_options', $this->plugin_slug, array($this, 'display_section') );
|
77 |
|
78 |
+
add_action( 'admin_init', array($this, 'enqueue_styles' ) );
|
79 |
+
add_action( 'admin_init', array($this, 'enqueue_scripts' ) );
|
|
|
80 |
}
|
81 |
|
82 |
/**
|
148 |
|
149 |
switch($args['type']) {
|
150 |
case 'checkbox' :
|
151 |
+
$fields .= '<div class="checkboxes">';
|
152 |
+
foreach($args['choices'] as $choice_value => $checkbox_label) {
|
153 |
+
$checked = (is_array($value) && in_array($choice_value, $value)) ? "checked='checked'" : "";
|
154 |
+
$fields .= "<label for='{$input_name}[]'><input type='checkbox' {$input_class} value='{$choice_value}' name='{$input_name}[]' {$checked} /> {$checkbox_label}</label>";
|
155 |
+
}
|
156 |
+
$fields .= '</div>';
|
157 |
|
158 |
+
// Add helper checkboxes for bulk actions
|
159 |
+
if(isset($args['select_all']) || isset($args['unselect_all'])) {
|
160 |
+
$select_all_label = (!empty($args['select_all'])) ? $args['select_all'] : __('Select all', 'permalink-manager');
|
161 |
+
$unselect_all_label = (!empty($args['unselect_all'])) ? $args['unselect_all'] : __('Unselect all', 'permalink-manager');
|
162 |
|
163 |
+
$fields .= "<p class=\"checkbox_actions extra-links\">";
|
164 |
+
$fields .= (isset($args['select_all'])) ? "<a href=\"#\" class=\"select_all\">{$select_all_label}</a> " : "";
|
165 |
+
$fields .= (isset($args['unselect_all'])) ? "<a href=\"#\" class=\"unselect_all\">{$unselect_all_label}</a>" : "";
|
166 |
+
$fields .= "</p>";
|
167 |
+
}
|
168 |
+
break;
|
169 |
+
|
170 |
+
case 'single_checkbox' :
|
171 |
+
$fields .= '<div class="checkboxes">';
|
172 |
+
$checked = ($value == 1) ? "checked='checked'" : "";
|
173 |
+
$checkbox_label = (isset($args['checkbox_label'])) ? $args['checkbox_label'] : '';
|
174 |
+
|
175 |
+
$fields .= "<label for='{$input_name}'><input type='checkbox' {$input_class} value='1' name='{$input_name}' {$checked} /> {$checkbox_label}</label>";
|
176 |
+
$fields .= '</div>';
|
177 |
break;
|
178 |
|
179 |
case 'radio' :
|
180 |
+
$fields .= '<div class="radios">';
|
181 |
+
foreach($args['choices'] as $choice_value => $checkbox_label) {
|
182 |
+
$checked = ($choice_value == $value) ? "checked='checked'" : "";
|
183 |
+
$fields .= "<label for='{$input_name}[]'><input type='radio' {$input_class} value='{$choice_value}' name='{$input_name}[]' {$checked} /> {$checkbox_label}</label>";
|
184 |
+
}
|
185 |
+
$fields .= '</div>';
|
186 |
break;
|
187 |
|
188 |
case 'select' :
|
189 |
+
$fields .= '<div class="select">';
|
190 |
+
$fields .= "<select name='{$input_name}' {$input_class}>";
|
191 |
+
foreach($args['choices'] as $choice_value => $checkbox_label) {
|
192 |
+
$selected = ($choice_value == $value) ? "selected='selected'" : "";
|
193 |
+
$fields .= "<option value='{$choice_value}' {$selected} />{$checkbox_label}</option>";
|
194 |
+
}
|
195 |
+
$fields .= '</select>';
|
196 |
+
$fields .= '</div>';
|
197 |
+
break;
|
198 |
|
199 |
case 'number' :
|
200 |
+
$fields .= "<input type='number' {$input_class} value='{$value}' name='{$input_name}' />";
|
201 |
+
break;
|
202 |
|
203 |
case 'hidden' :
|
204 |
+
$fields .= "<input type='hidden' {$input_class} value='{$value}' name='{$input_name}' />";
|
205 |
+
break;
|
206 |
|
207 |
case 'textarea' :
|
208 |
+
$fields .= "<textarea {$input_class} name='{$input_name}' {$placeholder} {$readonly} {$rows}>{$value}</textarea>";
|
209 |
+
break;
|
210 |
|
211 |
case 'pre' :
|
212 |
+
$fields .= "<pre {$input_class}>{$value}</pre>";
|
213 |
+
break;
|
214 |
|
215 |
case 'clearfix' :
|
216 |
+
return "<div class=\"clearfix\"></div>";
|
217 |
|
218 |
case 'permastruct' :
|
219 |
+
$siteurl = get_option('home');
|
220 |
+
$fields .= "<code>{$siteurl}/</code><input type='text' {$input_class} value='{$value}' name='{$input_name}' {$placeholder} {$readonly}/>";
|
221 |
+
break;
|
222 |
|
223 |
default :
|
224 |
+
$fields .= "<input type='text' {$input_class} value='{$value}' name='{$input_name}' {$placeholder} {$readonly}/>";
|
225 |
}
|
226 |
|
227 |
// Get the final HTML output
|
341 |
|
342 |
$output = "<div id=\"permalink-manager\" class=\"wrap\">";
|
343 |
|
344 |
+
// Display alerts [moved to custom_admin_notices() function] and another content if needed and the plugin header
|
345 |
+
// $output .= $permalink_manager_before_sections_html;
|
346 |
$output .= "<h2 id=\"plugin-name-heading\">" . PERMALINK_MANAGER_PLUGIN_NAME . " <a href=\"" . PERMALINK_MANAGER_WEBSITE ."\" target=\"_blank\">" . __('by Maciej Bis', 'permalink-manager') . "</a></h2>";
|
347 |
|
348 |
// Display the tab navigation
|
460 |
return $output;
|
461 |
}
|
462 |
|
463 |
+
function custom_admin_notices() {
|
464 |
+
global $permalink_manager_before_sections_html;
|
465 |
+
echo $permalink_manager_before_sections_html;
|
466 |
+
}
|
467 |
+
|
468 |
}
|
includes/core/permalink-manager-uri-functions-post.php
CHANGED
@@ -6,11 +6,14 @@
|
|
6 |
class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
7 |
|
8 |
public function __construct() {
|
9 |
-
add_filter( 'get_sample_permalink_html', array($this, 'edit_uri_box'), 999,
|
|
|
|
|
10 |
add_filter( '_get_page_link', array($this, 'custom_post_permalinks'), 999, 2);
|
11 |
add_filter( 'page_link', array($this, 'custom_post_permalinks'), 999, 2);
|
12 |
add_filter( 'post_link', array($this, 'custom_post_permalinks'), 999, 2);
|
13 |
add_filter( 'post_type_link', array($this, 'custom_post_permalinks'), 999, 2);
|
|
|
14 |
add_filter( 'permalink-manager-uris', array($this, 'exclude_homepage'), 999, 2);
|
15 |
add_action( 'save_post', array($this, 'update_post_uri'), 10, 3 );
|
16 |
add_action( 'wp_trash_post', array($this, 'remove_post_uri'), 10, 3 );
|
@@ -25,11 +28,16 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
25 |
$post = (is_integer($post)) ? get_post($post) : $post;
|
26 |
$post_type = $post->post_type;
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
29 |
return trim($permalink, "/");
|
30 |
}
|
31 |
|
32 |
-
// Apend the language code as a non-editable prefix
|
33 |
if(isset($sitepress_settings['language_negotiation_type']) && $sitepress_settings['language_negotiation_type'] == 1) {
|
34 |
$post_lang_details = apply_filters('wpml_post_language_details', NULL, $post->ID);
|
35 |
$language_code = (!empty($post_lang_details['language_code'])) ? "{$post_lang_details['language_code']}/" : '';
|
@@ -43,9 +51,11 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
43 |
$language_code = "";
|
44 |
}
|
45 |
|
46 |
-
//
|
47 |
-
if(get_option('
|
48 |
-
|
|
|
|
|
49 |
|
50 |
return $permalink;
|
51 |
}
|
@@ -90,7 +100,7 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
90 |
if(empty($post->ID)) { return ''; }
|
91 |
$post_id = $post->ID;
|
92 |
$post_type = $post->post_type;
|
93 |
-
$post_name = $post->post_name;
|
94 |
|
95 |
// Get the permastruct
|
96 |
$default_permastruct = Permalink_Manager_Helper_Functions::get_default_permastruct($post_type);
|
@@ -113,7 +123,8 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
113 |
}
|
114 |
|
115 |
// 2. Fix for hierarchical CPT (start)
|
116 |
-
$full_slug = ($native_uri == false) ? apply_filters('permalink_manager_filter_default_post_slug', get_page_uri($post), $post) : get_page_uri($post);
|
|
|
117 |
$post_type_tag = Permalink_Manager_Helper_Functions::get_post_tag($post_type);
|
118 |
|
119 |
// 3A. Do the replacement (post tag is removed now to enable support for hierarchical CPT)
|
@@ -167,14 +178,17 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
167 |
// Check if post types & statuses are not empty
|
168 |
if(empty($_POST['post_types']) || empty($_POST['post_statuses'])) { return false; }
|
169 |
|
|
|
|
|
|
|
170 |
// Reset variables
|
171 |
$updated_slugs_count = 0;
|
172 |
$updated_array = array();
|
173 |
$alert_type = $alert_content = $errors = '';
|
174 |
|
175 |
// Prepare default variables from $_POST object
|
176 |
-
$old_string = esc_sql($_POST['old_string']);
|
177 |
-
$new_string = esc_sql($_POST['new_string']);
|
178 |
$mode = isset($_POST['mode']) ? $_POST['mode'] : array('both');
|
179 |
$post_types_array = ($_POST['post_types']);
|
180 |
$post_statuses_array = ($_POST['post_statuses']);
|
@@ -194,13 +208,19 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
194 |
$default_uri = self::get_default_post_uri($row['ID']);
|
195 |
$old_uri = (isset($permalink_manager_uris[$row['ID']])) ? $permalink_manager_uris[$row['ID']] : $default_uri;
|
196 |
$old_slug = (strpos($old_uri, '/') !== false) ? substr($old_uri, strrpos($old_uri, '/') + 1) : $old_uri;
|
197 |
-
$old_base = (strpos($old_uri, '/') !== false) ? substr($old_uri, 0, strrpos( $old_uri, '/') ) : '';
|
198 |
|
199 |
-
//
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
//print_r("{$old_uri} - {$new_uri} - {$native_uri} - {$default_uri} \n");
|
206 |
|
@@ -209,7 +229,7 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
209 |
self::update_slug_by_id($new_post_name, $row['ID']);
|
210 |
}
|
211 |
|
212 |
-
if(($old_uri != $new_uri) || ($old_post_name != $new_post_name)) {
|
213 |
$permalink_manager_uris[$row['ID']] = $new_uri;
|
214 |
$updated_array[] = array('post_title' => $row['post_title'], 'ID' => $row['ID'], 'old_uri' => $old_uri, 'new_uri' => $new_uri, 'old_slug' => $old_post_name, 'new_slug' => $new_post_name);
|
215 |
$updated_slugs_count++;
|
@@ -366,20 +386,21 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
366 |
/**
|
367 |
* Allow to edit URIs from "Edit Post" admin pages
|
368 |
*/
|
369 |
-
function edit_uri_box($html, $id, $new_title, $new_slug) {
|
370 |
-
global $
|
|
|
|
|
|
|
371 |
|
372 |
-
//
|
373 |
-
$
|
374 |
-
// ... and saved drafts
|
375 |
-
$new_slug = (empty($new_slug) && !empty($post->post_title)) ? sanitize_title($post->post_title) : $new_slug;
|
376 |
|
377 |
-
// Do not do anything if new slug is empty
|
378 |
-
if(
|
379 |
|
380 |
$html = preg_replace("/(<strong>(.*)<\/strong>)(.*)/is", "$1 ", $html);
|
381 |
$default_uri = self::get_default_post_uri($id);
|
382 |
-
|
383 |
// Make sure that home URL ends with slash
|
384 |
$home_url = trim(get_option('home'), "/") . "/";
|
385 |
|
@@ -404,7 +425,7 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
404 |
$language_code .= ($language_code) ? "/" : "";
|
405 |
|
406 |
// Do not change anything if post is not saved yet (display sample permalink instead)
|
407 |
-
if(
|
408 |
$sample_permalink = $home_url . str_replace("//", "/", trim("{$language_code}{$default_uri}", "/"));
|
409 |
|
410 |
$html .= "<span><a href=\"{$sample_permalink}\">{$sample_permalink}</a></span>";
|
@@ -416,11 +437,26 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
416 |
return $html;
|
417 |
}
|
418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
/**
|
420 |
* Update URI from "Edit Post" admin page
|
421 |
*/
|
422 |
function update_post_uri($post_id, $post, $update) {
|
423 |
-
global $permalink_manager_uris;
|
424 |
|
425 |
// Fix for revisions
|
426 |
$is_revision = wp_is_post_revision($post_id);
|
@@ -428,7 +464,7 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
428 |
$post = get_post($post_id);
|
429 |
|
430 |
// Ignore auto-drafts & removed posts
|
431 |
-
if(in_array($post->post_status, array('auto-draft', 'trash')) ||
|
432 |
|
433 |
$default_uri = self::get_default_post_uri($post_id);
|
434 |
$native_uri = self::get_default_post_uri($post_id, true);
|
@@ -446,6 +482,13 @@ class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
|
446 |
$permalink_manager_uris[$post->ID] = $new_uri;
|
447 |
}
|
448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
update_option('permalink-manager-uris', $permalink_manager_uris);
|
450 |
}
|
451 |
|
6 |
class Permalink_Manager_URI_Functions_Post extends Permalink_Manager_Class {
|
7 |
|
8 |
public function __construct() {
|
9 |
+
add_filter( 'get_sample_permalink_html', array($this, 'edit_uri_box'), 999, 5 );
|
10 |
+
add_action( 'post_submitbox_misc_actions', array($this, 'display_post_link'), 99);
|
11 |
+
|
12 |
add_filter( '_get_page_link', array($this, 'custom_post_permalinks'), 999, 2);
|
13 |
add_filter( 'page_link', array($this, 'custom_post_permalinks'), 999, 2);
|
14 |
add_filter( 'post_link', array($this, 'custom_post_permalinks'), 999, 2);
|
15 |
add_filter( 'post_type_link', array($this, 'custom_post_permalinks'), 999, 2);
|
16 |
+
|
17 |
add_filter( 'permalink-manager-uris', array($this, 'exclude_homepage'), 999, 2);
|
18 |
add_action( 'save_post', array($this, 'update_post_uri'), 10, 3 );
|
19 |
add_action( 'wp_trash_post', array($this, 'remove_post_uri'), 10, 3 );
|
28 |
$post = (is_integer($post)) ? get_post($post) : $post;
|
29 |
$post_type = $post->post_type;
|
30 |
|
31 |
+
// 1A. Do not change permalink of frontpage
|
32 |
+
if(get_option('page_on_front') == $post->ID) {
|
33 |
+
return $permalink;
|
34 |
+
}
|
35 |
+
// 1B. Do not change permalink for drafts and future posts (+ remove trailing slash from them)
|
36 |
+
else if(in_array($post->post_status, array('draft', 'pending', 'auto-draft', 'future'))) {
|
37 |
return trim($permalink, "/");
|
38 |
}
|
39 |
|
40 |
+
// 2. Apend the language code as a non-editable prefix
|
41 |
if(isset($sitepress_settings['language_negotiation_type']) && $sitepress_settings['language_negotiation_type'] == 1) {
|
42 |
$post_lang_details = apply_filters('wpml_post_language_details', NULL, $post->ID);
|
43 |
$language_code = (!empty($post_lang_details['language_code'])) ? "{$post_lang_details['language_code']}/" : '';
|
51 |
$language_code = "";
|
52 |
}
|
53 |
|
54 |
+
// 3. Filter only the posts with custom permalink assigned
|
55 |
+
if(isset($permalink_manager_uris[$post->ID])) { $permalink = get_option('home') . "/{$language_code}{$permalink_manager_uris[$post->ID]}"; }
|
56 |
+
|
57 |
+
// 4. Additional filter
|
58 |
+
$permalink = apply_filters('permalink_manager_filter_final_post_permalink', user_trailingslashit($permalink), $post);
|
59 |
|
60 |
return $permalink;
|
61 |
}
|
100 |
if(empty($post->ID)) { return ''; }
|
101 |
$post_id = $post->ID;
|
102 |
$post_type = $post->post_type;
|
103 |
+
$post_name = (empty($post->post_name)) ? sanitize_title($post->post_title) : $post->post_name;
|
104 |
|
105 |
// Get the permastruct
|
106 |
$default_permastruct = Permalink_Manager_Helper_Functions::get_default_permastruct($post_type);
|
123 |
}
|
124 |
|
125 |
// 2. Fix for hierarchical CPT (start)
|
126 |
+
$full_slug = ($native_uri == false) ? apply_filters('permalink_manager_filter_default_post_slug', get_page_uri($post), $post, $post_name) : get_page_uri($post);
|
127 |
+
$full_slug = (empty($full_slug)) ? $post_name : $full_slug;
|
128 |
$post_type_tag = Permalink_Manager_Helper_Functions::get_post_tag($post_type);
|
129 |
|
130 |
// 3A. Do the replacement (post tag is removed now to enable support for hierarchical CPT)
|
178 |
// Check if post types & statuses are not empty
|
179 |
if(empty($_POST['post_types']) || empty($_POST['post_statuses'])) { return false; }
|
180 |
|
181 |
+
// Get homepage URL and ensure that it ends with slash
|
182 |
+
$home_url = trim(get_option('home'), "/") . "/";
|
183 |
+
|
184 |
// Reset variables
|
185 |
$updated_slugs_count = 0;
|
186 |
$updated_array = array();
|
187 |
$alert_type = $alert_content = $errors = '';
|
188 |
|
189 |
// Prepare default variables from $_POST object
|
190 |
+
$old_string = str_replace($home_url, '', esc_sql($_POST['old_string']));
|
191 |
+
$new_string = str_replace($home_url, '', esc_sql($_POST['new_string']));
|
192 |
$mode = isset($_POST['mode']) ? $_POST['mode'] : array('both');
|
193 |
$post_types_array = ($_POST['post_types']);
|
194 |
$post_statuses_array = ($_POST['post_statuses']);
|
208 |
$default_uri = self::get_default_post_uri($row['ID']);
|
209 |
$old_uri = (isset($permalink_manager_uris[$row['ID']])) ? $permalink_manager_uris[$row['ID']] : $default_uri;
|
210 |
$old_slug = (strpos($old_uri, '/') !== false) ? substr($old_uri, strrpos($old_uri, '/') + 1) : $old_uri;
|
|
|
211 |
|
212 |
+
// Do replacement on slugs (non-REGEX)
|
213 |
+
if(preg_match("/^\/.+\/[a-z]*$/i", $old_string)) {
|
214 |
+
// Use $_POST['old_string'] directly here & fix double slashes problem
|
215 |
+
$pattern = "~" . stripslashes(trim($_POST['old_string'], "/")) . "~";
|
216 |
+
|
217 |
+
$new_post_name = (in_array($mode, array('post_names'))) ? preg_replace($pattern, $new_string, $old_post_name) : $old_post_name;
|
218 |
+
$new_uri = preg_replace($pattern, $new_string, $old_uri);
|
219 |
+
}
|
220 |
+
else {
|
221 |
+
$new_post_name = (in_array($mode, array('post_names'))) ? str_replace($old_string, $new_string, $old_post_name) : $old_post_name; // Post name is changed only in first mode
|
222 |
+
$new_uri = str_replace($old_string, $new_string, $old_uri);
|
223 |
+
}
|
224 |
|
225 |
//print_r("{$old_uri} - {$new_uri} - {$native_uri} - {$default_uri} \n");
|
226 |
|
229 |
self::update_slug_by_id($new_post_name, $row['ID']);
|
230 |
}
|
231 |
|
232 |
+
if(($old_uri != $new_uri) || ($old_post_name != $new_post_name) && !(empty($new_uri))) {
|
233 |
$permalink_manager_uris[$row['ID']] = $new_uri;
|
234 |
$updated_array[] = array('post_title' => $row['post_title'], 'ID' => $row['ID'], 'old_uri' => $old_uri, 'new_uri' => $new_uri, 'old_slug' => $old_post_name, 'new_slug' => $new_post_name);
|
235 |
$updated_slugs_count++;
|
386 |
/**
|
387 |
* Allow to edit URIs from "Edit Post" admin pages
|
388 |
*/
|
389 |
+
function edit_uri_box($html, $id, $new_title, $new_slug, $post) {
|
390 |
+
global $permalink_manager_uris, $sitepress_settings;
|
391 |
+
|
392 |
+
// Detect auto drafts
|
393 |
+
$autosave = (!empty($new_title) && empty($new_slug)) ? true : false;
|
394 |
|
395 |
+
// Get the post object
|
396 |
+
$post = get_post($id);
|
|
|
|
|
397 |
|
398 |
+
// Do not do anything if new slug is empty or page is front-page
|
399 |
+
if( get_option('page_on_front') == $id) { return $html; }
|
400 |
|
401 |
$html = preg_replace("/(<strong>(.*)<\/strong>)(.*)/is", "$1 ", $html);
|
402 |
$default_uri = self::get_default_post_uri($id);
|
403 |
+
|
404 |
// Make sure that home URL ends with slash
|
405 |
$home_url = trim(get_option('home'), "/") . "/";
|
406 |
|
425 |
$language_code .= ($language_code) ? "/" : "";
|
426 |
|
427 |
// Do not change anything if post is not saved yet (display sample permalink instead)
|
428 |
+
if($autosave || empty($post->post_status)) {
|
429 |
$sample_permalink = $home_url . str_replace("//", "/", trim("{$language_code}{$default_uri}", "/"));
|
430 |
|
431 |
$html .= "<span><a href=\"{$sample_permalink}\">{$sample_permalink}</a></span>";
|
437 |
return $html;
|
438 |
}
|
439 |
|
440 |
+
function display_post_link($post) {
|
441 |
+
global $permalink_manager_uris;
|
442 |
+
|
443 |
+
// Do not display the link on drafts & scheduled posts
|
444 |
+
if(in_array($post->post_status, array('draft', 'pending', 'auto-draft', 'future'))) { return; }
|
445 |
+
|
446 |
+
$button_text = __('Go to the post', 'permalink-manager');
|
447 |
+
$permalink = get_permalink($post->ID);
|
448 |
+
|
449 |
+
$html = "<div class=\"misc-pub-section permalink-manager-link\" id=\"permalink-manager\">";
|
450 |
+
$html .= "<span class=\"image yoast-logo svg bad\"></span><span class=\"score-text\">" . PERMALINK_MANAGER_PLUGIN_NAME . ": <a href=\"{$permalink}\" target=\"_blank\">{$button_text}</a></div>";
|
451 |
+
|
452 |
+
echo $html;
|
453 |
+
}
|
454 |
+
|
455 |
/**
|
456 |
* Update URI from "Edit Post" admin page
|
457 |
*/
|
458 |
function update_post_uri($post_id, $post, $update) {
|
459 |
+
global $permalink_manager_uris, $permalink_manager_options, $permalink_manager_before_sections_html;
|
460 |
|
461 |
// Fix for revisions
|
462 |
$is_revision = wp_is_post_revision($post_id);
|
464 |
$post = get_post($post_id);
|
465 |
|
466 |
// Ignore auto-drafts & removed posts
|
467 |
+
if(in_array($post->post_status, array('auto-draft', 'trash')) || empty($post->post_name) || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) { return; }
|
468 |
|
469 |
$default_uri = self::get_default_post_uri($post_id);
|
470 |
$native_uri = self::get_default_post_uri($post_id, true);
|
482 |
$permalink_manager_uris[$post->ID] = $new_uri;
|
483 |
}
|
484 |
|
485 |
+
if(!empty($permalink_manager_options['miscellaneous']['debug_mode'])) {
|
486 |
+
$debug_data = "<pre>" . print_r($post, true) . "</pre><br />";
|
487 |
+
$debug_data .= "Update: " . print_r($update, true);
|
488 |
+
$debug_data .= "<br/>Native URI: <em>{$native_uri}</em><br/>Defualt URI: <em>{$default_uri}</em><br/>New URI: <em>{$new_uri}</em><br/>";
|
489 |
+
wp_die($debug_data);
|
490 |
+
}
|
491 |
+
|
492 |
update_option('permalink-manager-uris', $permalink_manager_uris);
|
493 |
}
|
494 |
|
includes/views/permalink-manager-advanced.php
CHANGED
@@ -10,8 +10,8 @@ class Permalink_Manager_Advanced extends Permalink_Manager_Class {
|
|
10 |
}
|
11 |
|
12 |
public function add_advanced_section($admin_sections) {
|
13 |
-
$admin_sections['
|
14 |
-
'name' => __('
|
15 |
'function' => array('class' => 'Permalink_Manager_Advanced', 'method' => 'output')
|
16 |
);
|
17 |
|
@@ -21,9 +21,12 @@ class Permalink_Manager_Advanced extends Permalink_Manager_Class {
|
|
21 |
public function output() {
|
22 |
global $permalink_manager_options, $permalink_manager_uris, $permalink_manager_permastructs, $wp_filter;
|
23 |
|
|
|
|
|
|
|
24 |
// Get permalink hooks
|
25 |
foreach(array('_get_page_link', 'post_link', 'page_link', 'post_type_link') as $hook) {
|
26 |
-
$permalink_hooks[$hook] =
|
27 |
}
|
28 |
|
29 |
$sections_and_fields = apply_filters('permalink-manager-advanced-fields', array(
|
@@ -35,28 +38,28 @@ class Permalink_Manager_Advanced extends Permalink_Manager_Class {
|
|
35 |
'description' => __('List of the URIs generated by this plugin.', 'permalink-manager'),
|
36 |
'label' => __('Array with URIs', 'permalink-manager'),
|
37 |
'input_class' => 'short-textarea widefat',
|
38 |
-
'value' => ($permalink_manager_uris) ?
|
39 |
),
|
40 |
'permastructs' => array(
|
41 |
'type' => 'textarea',
|
42 |
'description' => __('List of the permastructures.', 'permalink-manager'),
|
43 |
'label' => __('Array with permastructures', 'permalink-manager'),
|
44 |
'input_class' => 'short-textarea widefat',
|
45 |
-
'value' => ($permalink_manager_permastructs) ?
|
46 |
),
|
47 |
'settings' => array(
|
48 |
'type' => 'textarea',
|
49 |
-
'description' => __('
|
50 |
-
'label' => __('Array with settings used in this plugin.', 'permalink-manager'),
|
51 |
'input_class' => 'short-textarea widefat',
|
52 |
-
'value' =>
|
53 |
),
|
54 |
'hooks' => array(
|
55 |
'type' => 'textarea',
|
56 |
'description' => __('Permalink hooks.', 'permalink-manager'),
|
57 |
'label' => __('Array with list of permalink hooks used on this website.', 'permalink-manager'),
|
58 |
'input_class' => 'short-textarea widefat',
|
59 |
-
'value' =>
|
60 |
)
|
61 |
)
|
62 |
)
|
@@ -84,5 +87,5 @@ class Permalink_Manager_Advanced extends Permalink_Manager_Class {
|
|
84 |
|
85 |
return $output;
|
86 |
}
|
87 |
-
|
88 |
}
|
10 |
}
|
11 |
|
12 |
public function add_advanced_section($admin_sections) {
|
13 |
+
$admin_sections['debug'] = array(
|
14 |
+
'name' => __('Debug', 'permalink-manager'),
|
15 |
'function' => array('class' => 'Permalink_Manager_Advanced', 'method' => 'output')
|
16 |
);
|
17 |
|
21 |
public function output() {
|
22 |
global $permalink_manager_options, $permalink_manager_uris, $permalink_manager_permastructs, $wp_filter;
|
23 |
|
24 |
+
// Append PHP & plugin version
|
25 |
+
$permalink_manager_info = array_merge($permalink_manager_options, array('php_version' => phpversion(), 'plugin_version' => PERMALINK_MANAGER_VERSION));
|
26 |
+
|
27 |
// Get permalink hooks
|
28 |
foreach(array('_get_page_link', 'post_link', 'page_link', 'post_type_link') as $hook) {
|
29 |
+
$permalink_hooks[$hook] = $wp_filter[$hook];
|
30 |
}
|
31 |
|
32 |
$sections_and_fields = apply_filters('permalink-manager-advanced-fields', array(
|
38 |
'description' => __('List of the URIs generated by this plugin.', 'permalink-manager'),
|
39 |
'label' => __('Array with URIs', 'permalink-manager'),
|
40 |
'input_class' => 'short-textarea widefat',
|
41 |
+
'value' => ($permalink_manager_uris) ? json_encode($permalink_manager_uris, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) : ''
|
42 |
),
|
43 |
'permastructs' => array(
|
44 |
'type' => 'textarea',
|
45 |
'description' => __('List of the permastructures.', 'permalink-manager'),
|
46 |
'label' => __('Array with permastructures', 'permalink-manager'),
|
47 |
'input_class' => 'short-textarea widefat',
|
48 |
+
'value' => ($permalink_manager_permastructs) ? json_encode($permalink_manager_permastructs, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) : ''
|
49 |
),
|
50 |
'settings' => array(
|
51 |
'type' => 'textarea',
|
52 |
+
'description' => __('Plugin data.', 'permalink-manager'),
|
53 |
+
'label' => __('Array with settings used in this plugin & some additional information.', 'permalink-manager'),
|
54 |
'input_class' => 'short-textarea widefat',
|
55 |
+
'value' => json_encode($permalink_manager_info, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)
|
56 |
),
|
57 |
'hooks' => array(
|
58 |
'type' => 'textarea',
|
59 |
'description' => __('Permalink hooks.', 'permalink-manager'),
|
60 |
'label' => __('Array with list of permalink hooks used on this website.', 'permalink-manager'),
|
61 |
'input_class' => 'short-textarea widefat',
|
62 |
+
'value' => json_encode($permalink_hooks, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)
|
63 |
)
|
64 |
)
|
65 |
)
|
87 |
|
88 |
return $output;
|
89 |
}
|
90 |
+
|
91 |
}
|
includes/views/permalink-manager-permastructs.php
CHANGED
@@ -38,29 +38,29 @@ class Permalink_Manager_Permastructs extends Permalink_Manager_Class {
|
|
38 |
'append_content' => $post_types_notes,
|
39 |
'fields' => array()
|
40 |
),
|
41 |
-
|
42 |
'section_name' => __('Taxonomies', 'permalink-manager'),
|
43 |
'container' => 'row',
|
44 |
'append_content' => Permalink_Manager_Admin_Functions::pro_text(),
|
45 |
'fields' => array()
|
46 |
-
)
|
47 |
);
|
48 |
|
49 |
// 2. Woocommerce support
|
50 |
-
|
51 |
$fields['woocommerce'] = array(
|
52 |
'section_name' => "{$woocommerce_icon} " . __('WooCommerce', 'permalink-manager'),
|
53 |
'container' => 'row',
|
54 |
'append_content' => Permalink_Manager_Admin_Functions::pro_text(),
|
55 |
'fields' => array()
|
56 |
);
|
57 |
-
}
|
58 |
|
59 |
// 3. Append fields for all post types
|
60 |
foreach($all_post_types as $post_type) {
|
61 |
|
62 |
$default_permastruct = Permalink_Manager_Helper_Functions::get_default_permastruct($post_type['name'], true);
|
63 |
-
$current_permastruct = isset($permalink_manager_permastructs['post_types'][$post_type['name']]) ? $permalink_manager_permastructs['post_types'][$post_type['name']] :
|
64 |
|
65 |
$fields["post_types"]["fields"][$post_type['name']] = array(
|
66 |
'label' => $post_type['label'],
|
38 |
'append_content' => $post_types_notes,
|
39 |
'fields' => array()
|
40 |
),
|
41 |
+
'taxonomies' => array(
|
42 |
'section_name' => __('Taxonomies', 'permalink-manager'),
|
43 |
'container' => 'row',
|
44 |
'append_content' => Permalink_Manager_Admin_Functions::pro_text(),
|
45 |
'fields' => array()
|
46 |
+
)
|
47 |
);
|
48 |
|
49 |
// 2. Woocommerce support
|
50 |
+
if(class_exists('WooCommerce')) {
|
51 |
$fields['woocommerce'] = array(
|
52 |
'section_name' => "{$woocommerce_icon} " . __('WooCommerce', 'permalink-manager'),
|
53 |
'container' => 'row',
|
54 |
'append_content' => Permalink_Manager_Admin_Functions::pro_text(),
|
55 |
'fields' => array()
|
56 |
);
|
57 |
+
}
|
58 |
|
59 |
// 3. Append fields for all post types
|
60 |
foreach($all_post_types as $post_type) {
|
61 |
|
62 |
$default_permastruct = Permalink_Manager_Helper_Functions::get_default_permastruct($post_type['name'], true);
|
63 |
+
$current_permastruct = isset($permalink_manager_permastructs['post_types'][$post_type['name']]) ? $permalink_manager_permastructs['post_types'][$post_type['name']] : $default_permastruct;
|
64 |
|
65 |
$fields["post_types"]["fields"][$post_type['name']] = array(
|
66 |
'label' => $post_type['label'],
|
includes/views/permalink-manager-settings.php
CHANGED
@@ -108,11 +108,15 @@ class Permalink_Manager_Settings extends Permalink_Manager_Class {
|
|
108 |
'input_class' => 'settings-select',
|
109 |
'choices' => array(0 => __('Disable', 'permalink-manager'), 1 => __('Enable', 'permalink-manager')),
|
110 |
'description' => __('This function allows Wordpress to correct the URLs used by the visitors.', 'permalink-manager')
|
|
|
|
|
|
|
|
|
111 |
)
|
112 |
)
|
113 |
)
|
114 |
));
|
115 |
-
|
116 |
$output = Permalink_Manager_Admin_Functions::get_the_form($sections_and_fields, '', array('text' => __( 'Save settings', 'permalink-manager' ), 'class' => 'primary margin-top'), '', array('action' => 'permalink-manager', 'name' => 'permalink_manager_options'));
|
117 |
return $output;
|
118 |
}
|
108 |
'input_class' => 'settings-select',
|
109 |
'choices' => array(0 => __('Disable', 'permalink-manager'), 1 => __('Enable', 'permalink-manager')),
|
110 |
'description' => __('This function allows Wordpress to correct the URLs used by the visitors.', 'permalink-manager')
|
111 |
+
),
|
112 |
+
'debug_mode' => array(
|
113 |
+
'type' => 'single_checkbox',
|
114 |
+
'label' => __('Debug mode', 'permalink-manager')
|
115 |
)
|
116 |
)
|
117 |
)
|
118 |
));
|
119 |
+
|
120 |
$output = Permalink_Manager_Admin_Functions::get_the_form($sections_and_fields, '', array('text' => __( 'Save settings', 'permalink-manager' ), 'class' => 'primary margin-top'), '', array('action' => 'permalink-manager', 'name' => 'permalink_manager_options'));
|
121 |
return $output;
|
122 |
}
|
includes/views/permalink-manager-tools.php
CHANGED
@@ -56,7 +56,7 @@ class Permalink_Manager_Tools extends Permalink_Manager_Class {
|
|
56 |
'label' => __( 'Select mode', 'permalink-manager' ),
|
57 |
'type' => 'select',
|
58 |
'container' => 'row',
|
59 |
-
'choices' => array('both' => '<strong>' . __('Full URIs', 'permalink-manager') . '</strong>', '
|
60 |
'default' => array('both'),
|
61 |
),
|
62 |
'post_types' => array(
|
@@ -97,7 +97,7 @@ class Permalink_Manager_Tools extends Permalink_Manager_Class {
|
|
97 |
'label' => __( 'Select mode', 'permalink-manager' ),
|
98 |
'type' => 'select',
|
99 |
'container' => 'row',
|
100 |
-
'choices' => array('both' => '<strong>' . __('Full URIs', 'permalink-manager') . '</strong>', '
|
101 |
),
|
102 |
'post_types' => array(
|
103 |
'label' => __( 'Filter by post types', 'permalink-manager' ),
|
56 |
'label' => __( 'Select mode', 'permalink-manager' ),
|
57 |
'type' => 'select',
|
58 |
'container' => 'row',
|
59 |
+
'choices' => array('both' => '<strong>' . __('Full URIs', 'permalink-manager') . '</strong>', 'post_names' => '<strong>' . __('Custom & native slugs (post names)', 'permalink-manager') . '</strong>'),
|
60 |
'default' => array('both'),
|
61 |
),
|
62 |
'post_types' => array(
|
97 |
'label' => __( 'Select mode', 'permalink-manager' ),
|
98 |
'type' => 'select',
|
99 |
'container' => 'row',
|
100 |
+
'choices' => array('both' => '<strong>' . __('Full URIs', 'permalink-manager') . '</strong>', 'post_names' => '<strong>' . __('Custom & native slugs (post names)', 'permalink-manager') . '</strong>'),
|
101 |
),
|
102 |
'post_types' => array(
|
103 |
'label' => __( 'Filter by post types', 'permalink-manager' ),
|
includes/views/permalink-manager-uri-editor-post.php
CHANGED
@@ -96,7 +96,7 @@ class Permalink_Manager_URI_Editor_Post extends WP_List_Table {
|
|
96 |
case 'uri':
|
97 |
$output = Permalink_Manager_Admin_Functions::generate_option_field("uri[{$item['ID']}]", $field_args_base);
|
98 |
$output .= "<a class=\"small post_permalink\" href=\"{$permalink}\" target=\"_blank\"><span class=\"dashicons dashicons-admin-links\"></span> {$permalink}</a>";
|
99 |
-
return $output
|
100 |
|
101 |
case 'post_title':
|
102 |
$output = $item[ 'post_title' ];
|
@@ -112,7 +112,7 @@ class Permalink_Manager_URI_Editor_Post extends WP_List_Table {
|
|
112 |
return (!empty($post_lang_details['native_name'])) ? $post_lang_details['native_name'] : "-";
|
113 |
|
114 |
default:
|
115 |
-
|
116 |
}
|
117 |
}
|
118 |
|
96 |
case 'uri':
|
97 |
$output = Permalink_Manager_Admin_Functions::generate_option_field("uri[{$item['ID']}]", $field_args_base);
|
98 |
$output .= "<a class=\"small post_permalink\" href=\"{$permalink}\" target=\"_blank\"><span class=\"dashicons dashicons-admin-links\"></span> {$permalink}</a>";
|
99 |
+
return $output;
|
100 |
|
101 |
case 'post_title':
|
102 |
$output = $item[ 'post_title' ];
|
112 |
return (!empty($post_lang_details['native_name'])) ? $post_lang_details['native_name'] : "-";
|
113 |
|
114 |
default:
|
115 |
+
return $item[$column_name];
|
116 |
}
|
117 |
}
|
118 |
|
includes/views/permalink-manager-uri-editor.php
CHANGED
@@ -34,7 +34,7 @@ class Permalink_Manager_Uri_Editor extends Permalink_Manager_Class {
|
|
34 |
}
|
35 |
|
36 |
// Permalink Manager Pro: Display separate section for each taxonomy
|
37 |
-
|
38 |
foreach($taxonomies as $taxonomy_name => $taxonomy) {
|
39 |
// Check if taxonomy exists
|
40 |
if(!taxonomy_exists($taxonomy_name)) { continue; }
|
@@ -47,7 +47,7 @@ class Permalink_Manager_Uri_Editor extends Permalink_Manager_Class {
|
|
47 |
'html' => Permalink_Manager_Admin_Functions::pro_text(),
|
48 |
'pro' => true
|
49 |
);
|
50 |
-
}
|
51 |
|
52 |
// A little dirty hack to move wooCommerce product & taxonomies to the end of array
|
53 |
if(class_exists('WooCommerce')) {
|
34 |
}
|
35 |
|
36 |
// Permalink Manager Pro: Display separate section for each taxonomy
|
37 |
+
$taxonomies = Permalink_Manager_Helper_Functions::get_taxonomies_array('full');
|
38 |
foreach($taxonomies as $taxonomy_name => $taxonomy) {
|
39 |
// Check if taxonomy exists
|
40 |
if(!taxonomy_exists($taxonomy_name)) { continue; }
|
47 |
'html' => Permalink_Manager_Admin_Functions::pro_text(),
|
48 |
'pro' => true
|
49 |
);
|
50 |
+
}
|
51 |
|
52 |
// A little dirty hack to move wooCommerce product & taxonomies to the end of array
|
53 |
if(class_exists('WooCommerce')) {
|
languages/permalink-manager.pot
CHANGED
@@ -1,366 +1,216 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
"
|
6 |
-
"
|
7 |
-
"POT-
|
8 |
-
"
|
9 |
-
"
|
10 |
-
"
|
11 |
-
"Language: \n"
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"Content-
|
16 |
-
"
|
17 |
-
"X-Poedit-
|
18 |
-
"X-Poedit-
|
19 |
-
"X-Poedit-
|
20 |
-
"
|
21 |
-
"
|
22 |
-
"
|
23 |
-
"
|
24 |
-
"
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
msgid "
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
msgstr ""
|
63 |
-
|
64 |
-
#:
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
#:
|
102 |
-
msgid "
|
103 |
-
msgstr ""
|
104 |
-
|
105 |
-
#:
|
106 |
-
msgid "
|
107 |
-
msgstr ""
|
108 |
-
|
109 |
-
#:
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
#:
|
119 |
-
msgid "
|
120 |
-
msgstr ""
|
121 |
-
|
122 |
-
#:
|
123 |
-
msgid "
|
124 |
-
msgstr ""
|
125 |
-
|
126 |
-
#:
|
127 |
-
msgid "
|
128 |
-
msgstr ""
|
129 |
-
|
130 |
-
#:
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
msgid "
|
149 |
-
msgstr ""
|
150 |
-
|
151 |
-
#:
|
152 |
-
msgid "
|
153 |
-
msgstr ""
|
154 |
-
|
155 |
-
#:
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
"
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
msgstr ""
|
218 |
-
|
219 |
-
#: includes/views/permalink-manager-uri-editor.php:19
|
220 |
-
msgid "Permalink editor"
|
221 |
-
msgstr ""
|
222 |
-
|
223 |
-
#: includes/views/permalink-manager-tools.php:15
|
224 |
-
msgid "Tools"
|
225 |
-
msgstr ""
|
226 |
-
|
227 |
-
#: includes/views/permalink-manager-tools.php:18
|
228 |
-
#: includes/views/permalink-manager-tools.php:85
|
229 |
-
msgid "Find and replace"
|
230 |
-
msgstr ""
|
231 |
-
|
232 |
-
#: includes/views/permalink-manager-tools.php:22
|
233 |
-
msgid "Regenerate/Reset"
|
234 |
-
msgstr ""
|
235 |
-
|
236 |
-
#: includes/views/permalink-manager-tools.php:32
|
237 |
-
msgid ""
|
238 |
-
"<strong>A MySQL backup is highly recommended before using \"<em>Custom & "
|
239 |
-
"native slugs (post names)</em>\" mode!</strong>."
|
240 |
-
msgstr ""
|
241 |
-
|
242 |
-
#: includes/views/permalink-manager-tools.php:42
|
243 |
-
msgid "Find ..."
|
244 |
-
msgstr ""
|
245 |
-
|
246 |
-
#: includes/views/permalink-manager-tools.php:49
|
247 |
-
msgid "Replace with ..."
|
248 |
-
msgstr ""
|
249 |
-
|
250 |
-
#: includes/views/permalink-manager-tools.php:56
|
251 |
-
#: includes/views/permalink-manager-tools.php:97
|
252 |
-
msgid "Select mode"
|
253 |
-
msgstr ""
|
254 |
-
|
255 |
-
#: includes/views/permalink-manager-tools.php:59
|
256 |
-
#: includes/views/permalink-manager-tools.php:100
|
257 |
-
msgid "Full URIs"
|
258 |
-
msgstr ""
|
259 |
-
|
260 |
-
#: includes/views/permalink-manager-tools.php:59
|
261 |
-
#: includes/views/permalink-manager-tools.php:100
|
262 |
-
msgid "Only custom slugs"
|
263 |
-
msgstr ""
|
264 |
-
|
265 |
-
#: includes/views/permalink-manager-tools.php:59
|
266 |
-
#: includes/views/permalink-manager-tools.php:100
|
267 |
-
msgid "Custom & native slugs (post names)"
|
268 |
-
msgstr ""
|
269 |
-
|
270 |
-
#: includes/views/permalink-manager-tools.php:63
|
271 |
-
#: includes/views/permalink-manager-tools.php:103
|
272 |
-
msgid "Filter by post types"
|
273 |
-
msgstr ""
|
274 |
-
|
275 |
-
#: includes/views/permalink-manager-tools.php:72
|
276 |
-
#: includes/views/permalink-manager-tools.php:112
|
277 |
-
msgid "Filter by post statuses"
|
278 |
-
msgstr ""
|
279 |
-
|
280 |
-
#: includes/views/permalink-manager-tools.php:82
|
281 |
-
#: includes/views/permalink-manager-tools.php:122
|
282 |
-
msgid "Important notices"
|
283 |
-
msgstr ""
|
284 |
-
|
285 |
-
#: includes/views/permalink-manager-tools.php:124
|
286 |
-
msgid "Regenerate"
|
287 |
-
msgstr ""
|
288 |
-
|
289 |
-
#: includes/views/permalink-manager-permastructs.php:15
|
290 |
-
msgid "Permastructures"
|
291 |
-
msgstr ""
|
292 |
-
|
293 |
-
#: includes/views/permalink-manager-permastructs.php:29
|
294 |
-
#, php-format
|
295 |
-
msgid ""
|
296 |
-
"All available <a href=\"%s\" target=\"_blank\">structure tags</a> for "
|
297 |
-
"<strong>post types</strong> allowed are listed below."
|
298 |
-
msgstr ""
|
299 |
-
|
300 |
-
#: includes/views/permalink-manager-permastructs.php:31
|
301 |
-
msgid ""
|
302 |
-
"Please note that some of them can be used only for particular post types' "
|
303 |
-
"settings."
|
304 |
-
msgstr ""
|
305 |
-
|
306 |
-
#: includes/views/permalink-manager-permastructs.php:42
|
307 |
-
msgid "Taxonomies"
|
308 |
-
msgstr ""
|
309 |
-
|
310 |
-
#: includes/views/permalink-manager-permastructs.php:52
|
311 |
-
msgid "WooCommerce"
|
312 |
-
msgstr ""
|
313 |
-
|
314 |
-
#: includes/views/permalink-manager-permastructs.php:87
|
315 |
-
msgid "Save permastructures"
|
316 |
-
msgstr ""
|
317 |
-
|
318 |
-
#: includes/views/permalink-manager-uri-editor-post.php:46
|
319 |
-
msgid "Post title"
|
320 |
-
msgstr ""
|
321 |
-
|
322 |
-
#: includes/views/permalink-manager-uri-editor-post.php:47
|
323 |
-
msgid "Post name (native slug)"
|
324 |
-
msgstr ""
|
325 |
-
|
326 |
-
#: includes/views/permalink-manager-uri-editor-post.php:49
|
327 |
-
msgid "Full URI & Permalink"
|
328 |
-
msgstr ""
|
329 |
-
|
330 |
-
#: includes/views/permalink-manager-uri-editor-post.php:50
|
331 |
-
msgid "Post status"
|
332 |
-
msgstr ""
|
333 |
-
|
334 |
-
#: includes/views/permalink-manager-uri-editor-post.php:104
|
335 |
-
#: includes/views/permalink-manager-uri-editor-post.php:104
|
336 |
-
msgid "Edit"
|
337 |
-
msgstr ""
|
338 |
-
|
339 |
-
#: includes/views/permalink-manager-uri-editor-post.php:105
|
340 |
-
#: includes/views/permalink-manager-uri-editor-post.php:105
|
341 |
-
msgid "View"
|
342 |
-
msgstr ""
|
343 |
-
|
344 |
-
#: includes/views/permalink-manager-uri-editor-post.php:135
|
345 |
-
msgid "Update all the URIs below"
|
346 |
-
msgstr ""
|
347 |
-
|
348 |
-
#: includes/views/permalink-manager-uri-editor-post.php:136
|
349 |
-
msgid "Update all the URIs above"
|
350 |
-
msgstr ""
|
351 |
-
|
352 |
-
#. Description of the plugin
|
353 |
-
msgid ""
|
354 |
-
"Most advanced Permalink utility for Wordpress. It allows to bulk edit the "
|
355 |
-
"permalinks & permastructures and regenerate/reset all the URIs in your "
|
356 |
-
"Wordpress instance."
|
357 |
-
msgstr ""
|
358 |
-
|
359 |
-
#. URI of the plugin
|
360 |
-
#. Author URI of the plugin
|
361 |
-
msgid "http://maciejbis.net/"
|
362 |
-
msgstr ""
|
363 |
-
|
364 |
-
#. Author of the plugin
|
365 |
-
msgid "Maciej Bis"
|
366 |
-
msgstr ""
|
1 |
+
# Loco Gettext template
|
2 |
+
#, fuzzy
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Permalink Manager\n"
|
6 |
+
"Report-Msgid-Bugs-To: \n"
|
7 |
+
"POT-Creation-Date: Fri Jan 08 2016 20:08:17 GMT+0100 (CET)\n"
|
8 |
+
"POT-Revision-Date: Fri Jan 08 2016 20:08:23 GMT+0100 (CET)\n"
|
9 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
10 |
+
"Last-Translator: \n"
|
11 |
+
"Language-Team: \n"
|
12 |
+
"Language: \n"
|
13 |
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
+
"X-Poedit-Basepath: .\n"
|
19 |
+
"X-Poedit-SearchPath-0: ..\n"
|
20 |
+
"X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
|
21 |
+
"__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
|
22 |
+
"_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
|
23 |
+
"esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
|
24 |
+
"esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
|
25 |
+
"X-Generator: Loco - https://localise.biz/"
|
26 |
+
|
27 |
+
#. Name of the plugin
|
28 |
+
msgid "Permalink Manager"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#. URI of the plugin
|
32 |
+
msgid "http://maciejbis.net"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#. Description of the plugin
|
36 |
+
msgid ""
|
37 |
+
"A simple tool that allows to mass update of slugs that are used to build "
|
38 |
+
"permalinks for Posts, Pages and Custom Post Types."
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#. Author of the plugin
|
42 |
+
msgid "Maciej Bis"
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: ../permalink-manager.php:89
|
46 |
+
msgid "Find & Replace"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: ../permalink-manager.php:108
|
50 |
+
msgid "Regenerate"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: ../permalink-manager.php:135
|
54 |
+
msgid "Permalinks"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: ../permalink-manager.php:137
|
58 |
+
msgid ""
|
59 |
+
"You can disable/enable selected post types from the table below using "
|
60 |
+
"<strong>\"Screen Options\"</strong> (click on the upper-right button to show "
|
61 |
+
"it) section above."
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
#: ../permalink-manager.php:140
|
65 |
+
msgid "Find and replace"
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: ../permalink-manager.php:142 ../permalink-manager.php:147
|
69 |
+
msgid "<strong>You are doing it at your own risk!</strong>"
|
70 |
+
msgstr ""
|
71 |
+
|
72 |
+
#: ../permalink-manager.php:142
|
73 |
+
msgid ""
|
74 |
+
"A backup of MySQL database before using this tool is highly recommended. The "
|
75 |
+
"search & replace operation might be not revertible!"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: ../permalink-manager.php:145
|
79 |
+
msgid "Regenerate slugs"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: ../permalink-manager.php:147
|
83 |
+
msgid ""
|
84 |
+
"A backup of MySQL database before using this tool is highly recommended. The "
|
85 |
+
"regenerate process of slugs might be not revertible!"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: ../permalink-manager.php:160
|
89 |
+
msgid "by Maciej Bis"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: ../permalink-manager.php:210
|
93 |
+
msgid "Go To Permalink Manager"
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: ../permalink-manager.php:226
|
97 |
+
msgid "Post Types"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: ../permalink-manager.php:228 ../permalink-manager.php:257 ../permalink-manager.
|
101 |
+
#: php:273
|
102 |
+
msgid "All Post Types"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: ../permalink-manager.php:232
|
106 |
+
msgid "Post Statuses"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: ../permalink-manager.php:234 ../permalink-manager.php:263 ../permalink-manager.
|
110 |
+
#: php:279
|
111 |
+
msgid "All Post Statuses"
|
112 |
+
msgstr ""
|
113 |
+
|
114 |
+
#: ../permalink-manager.php:238
|
115 |
+
msgid "Per page"
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#: ../permalink-manager.php:247
|
119 |
+
msgid "Find ..."
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: ../permalink-manager.php:251
|
123 |
+
msgid "Replace with ..."
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: ../permalink-manager.php:255 ../permalink-manager.php:271
|
127 |
+
msgid "Post Types that should be affected"
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: ../permalink-manager.php:261 ../permalink-manager.php:277
|
131 |
+
msgid "Post Statuses that should be affected"
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: ../permalink-manager.php:347
|
135 |
+
#, php-format
|
136 |
+
msgid "<strong>\"%1s\"</strong> field is empty!"
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: ../permalink-manager.php:418
|
140 |
+
#, php-format
|
141 |
+
msgid "<strong>%d</strong> slug were updated!"
|
142 |
+
msgid_plural "<strong>%d</strong> slugs were updated!"
|
143 |
+
msgstr[0] ""
|
144 |
+
msgstr[1] ""
|
145 |
+
|
146 |
+
#: ../permalink-manager.php:419
|
147 |
+
#, php-format
|
148 |
+
msgid "<a href=\"%s\">Click here</a> to go to the list of updated slugs"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: ../permalink-manager.php:422
|
152 |
+
msgid "<strong>No slugs</strong> were updated!"
|
153 |
+
msgstr ""
|
154 |
+
|
155 |
+
#: ../permalink-manager.php:435 ../permalink-manager.php:447 ../inc/permalink-
|
156 |
+
#: manager-wp-table.php:30
|
157 |
+
msgid "Title"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: ../permalink-manager.php:436 ../permalink-manager.php:448
|
161 |
+
msgid "Old slug"
|
162 |
+
msgstr ""
|
163 |
+
|
164 |
+
#: ../permalink-manager.php:437 ../permalink-manager.php:449
|
165 |
+
msgid "New slug"
|
166 |
+
msgstr ""
|
167 |
+
|
168 |
+
#: ../permalink-manager.php:447
|
169 |
+
msgid "Show more details"
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
#: ../permalink-manager.php:454
|
173 |
+
msgid "List of updated posts"
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: ../inc/permalink-manager-screen-options.php:21
|
177 |
+
msgid "Apply"
|
178 |
+
msgstr ""
|
179 |
+
|
180 |
+
#: ../inc/permalink-manager-wp-table.php:31
|
181 |
+
msgid "Slug"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: ../inc/permalink-manager-wp-table.php:32
|
185 |
+
msgid "Date"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: ../inc/permalink-manager-wp-table.php:33
|
189 |
+
msgid "Permalink"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: ../inc/permalink-manager-wp-table.php:34
|
193 |
+
msgid "Post Status"
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
#: ../inc/permalink-manager-wp-table.php:35
|
197 |
+
msgid "Post Type"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: ../inc/permalink-manager-wp-table.php:81 ../inc/permalink-manager-wp-table.php:
|
201 |
+
#: 81
|
202 |
+
msgid "Edit"
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
#: ../inc/permalink-manager-wp-table.php:82 ../inc/permalink-manager-wp-table.php:
|
206 |
+
#: 82
|
207 |
+
msgid "View"
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: ../inc/permalink-manager-wp-table.php:124
|
211 |
+
msgid "Update all slugs below"
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: ../inc/permalink-manager-wp-table.php:125
|
215 |
+
msgid "Update all slugs above"
|
216 |
+
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
out/permalink-manager-admin.css
CHANGED
@@ -68,6 +68,8 @@
|
|
68 |
#permalink-manager .columns-container .column-1_3{width:33.33%}
|
69 |
#permalink-manager .columns-container .column-2_3{width:66.67%}
|
70 |
|
|
|
|
|
71 |
/**
|
72 |
* Breakpoints
|
73 |
*/
|
68 |
#permalink-manager .columns-container .column-1_3{width:33.33%}
|
69 |
#permalink-manager .columns-container .column-2_3{width:66.67%}
|
70 |
|
71 |
+
#slugdiv #post_name{width:100%}
|
72 |
+
|
73 |
/**
|
74 |
* Breakpoints
|
75 |
*/
|
permalink-manager.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
|
3 |
/**
|
4 |
* Plugin Name: Permalink Manager
|
5 |
-
* Plugin URI:
|
6 |
* Description: Most advanced Permalink utility for Wordpress. It allows to bulk edit the permalinks & permastructures and regenerate/reset all the URIs in your Wordpress instance.
|
7 |
-
* Version: 1.0.
|
8 |
* Author: Maciej Bis
|
9 |
* Author URI: http://maciejbis.net/
|
10 |
* License: GPL-2.0+
|
@@ -20,7 +20,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
20 |
// Define the directories used to load plugin files.
|
21 |
define( 'PERMALINK_MANAGER_PLUGIN_NAME', 'Permalink Manager' );
|
22 |
define( 'PERMALINK_MANAGER_PLUGIN_SLUG', 'permalink-manager' );
|
23 |
-
define( 'PERMALINK_MANAGER_VERSION', '1.0.
|
24 |
define( 'PERMALINK_MANAGER_DIR', untrailingslashit( dirname( __FILE__ ) ) );
|
25 |
define( 'PERMALINK_MANAGER_BASENAME', plugin_basename(__FILE__) );
|
26 |
define( 'PERMALINK_MANAGER_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) );
|
@@ -142,7 +142,7 @@ class Permalink_Manager_Class {
|
|
142 |
*/
|
143 |
$protocol = stripos($_SERVER['SERVER_PROTOCOL'], 'https') === true ? 'https://' : 'http://';
|
144 |
$request_url = "{$protocol}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
|
145 |
-
$home_url = trim(rtrim(
|
146 |
// Adjust prefix (it should be the same in both request & home_url)
|
147 |
$home_url = ($protocol == 'https://') ? str_replace("http://", "https://", $home_url) : str_replace("https://", "http://", $home_url);
|
148 |
|
@@ -153,27 +153,30 @@ class Permalink_Manager_Class {
|
|
153 |
// Remove .html suffix and domain name from URL and query (URLs ended with .html will work as aliases)
|
154 |
$request_url = trim(str_replace($home_url, "", $request_url), "/");
|
155 |
|
|
|
|
|
|
|
156 |
// Split the current URL into subparts (check if WPML is active)
|
157 |
if(isset($sitepress_settings['language_negotiation_type']) && $sitepress_settings['language_negotiation_type'] == 1) {
|
158 |
-
preg_match("/^(?:(\w{2})\/)?(
|
159 |
$lang = (!empty($url_parts[1])) ? $url_parts[1] : "";
|
160 |
$uri = (!empty($url_parts[2])) ? $url_parts[2] : "";
|
161 |
$endpoint = (!empty($url_parts[3])) ? $url_parts[3] : "";
|
162 |
$endpoint_value = (!empty($url_parts[4])) ? $url_parts[4] : "";
|
163 |
} else {
|
164 |
-
preg_match("/^(
|
165 |
$lang = false;
|
166 |
$uri = (!empty($url_parts[1])) ? $url_parts[1] : "";
|
167 |
$endpoint = (!empty($url_parts[2])) ? $url_parts[2] : "";
|
168 |
$endpoint_value = (!empty($url_parts[3])) ? $url_parts[3] : "";
|
169 |
}
|
170 |
|
|
|
|
|
|
|
171 |
// Ignore URLs with no URI grabbed
|
172 |
if(empty($uri)) return $query;
|
173 |
|
174 |
-
// Remove querystrings from URI
|
175 |
-
$uri = trim(strtok($uri, '?'), "/");
|
176 |
-
|
177 |
/**
|
178 |
* 2A. Check if found URI matches any element from custom uris array
|
179 |
*/
|
@@ -182,6 +185,13 @@ class Permalink_Manager_Class {
|
|
182 |
// Check again in case someone added .html suffix to particular post (with .html suffix)
|
183 |
$item_id = (empty($item_id)) ? array_search("{$uri}.html", $permalink_manager_uris) : $item_id;
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
// Clear the original query before it is filtered
|
186 |
$query = ($item_id) ? array() : $query;
|
187 |
|
@@ -224,9 +234,12 @@ class Permalink_Manager_Class {
|
|
224 |
|
225 |
// Fix for WPML languages mismatch
|
226 |
$post_lang_details = apply_filters('wpml_post_language_details', NULL, $item_id);
|
227 |
-
|
228 |
-
|
229 |
-
$
|
|
|
|
|
|
|
230 |
}
|
231 |
|
232 |
$post_to_load = get_post($item_id);
|
@@ -261,8 +274,8 @@ class Permalink_Manager_Class {
|
|
261 |
/**
|
262 |
* 2C. Endpoints
|
263 |
*/
|
264 |
-
if(!(empty($endpoint_value))) {
|
265 |
-
$endpoint = str_replace(array('page', 'trackback'), array('paged', 'tb'), $endpoint);
|
266 |
$query[$endpoint] = $endpoint_value;
|
267 |
}
|
268 |
|
@@ -292,18 +305,15 @@ class Permalink_Manager_Class {
|
|
292 |
}
|
293 |
|
294 |
// Get the real URL
|
295 |
-
$
|
296 |
-
$native_uri = Permalink_Manager_URI_Functions_Post::get_default_post_uri($permalink_manager_uris[$wp_query->queried_object_id], true);
|
297 |
-
|
298 |
-
$active_permalink = str_replace($native_uri, $permalink_manager_uris[$wp_query->queried_object_id], $current_url);
|
299 |
}
|
300 |
|
301 |
// Get the redirection mode
|
302 |
$redirect_mode = $permalink_manager_options['miscellaneous']['redirect'];
|
303 |
|
304 |
// Ignore default URIs (or do nothing if redirects are disabled)
|
305 |
-
if(!empty($
|
306 |
-
wp_redirect($
|
307 |
exit();
|
308 |
}
|
309 |
}
|
2 |
|
3 |
/**
|
4 |
* Plugin Name: Permalink Manager
|
5 |
+
* Plugin URI: https://permalinkmanager.pro
|
6 |
* Description: Most advanced Permalink utility for Wordpress. It allows to bulk edit the permalinks & permastructures and regenerate/reset all the URIs in your Wordpress instance.
|
7 |
+
* Version: 1.0.4
|
8 |
* Author: Maciej Bis
|
9 |
* Author URI: http://maciejbis.net/
|
10 |
* License: GPL-2.0+
|
20 |
// Define the directories used to load plugin files.
|
21 |
define( 'PERMALINK_MANAGER_PLUGIN_NAME', 'Permalink Manager' );
|
22 |
define( 'PERMALINK_MANAGER_PLUGIN_SLUG', 'permalink-manager' );
|
23 |
+
define( 'PERMALINK_MANAGER_VERSION', '1.0.4' );
|
24 |
define( 'PERMALINK_MANAGER_DIR', untrailingslashit( dirname( __FILE__ ) ) );
|
25 |
define( 'PERMALINK_MANAGER_BASENAME', plugin_basename(__FILE__) );
|
26 |
define( 'PERMALINK_MANAGER_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) );
|
142 |
*/
|
143 |
$protocol = stripos($_SERVER['SERVER_PROTOCOL'], 'https') === true ? 'https://' : 'http://';
|
144 |
$request_url = "{$protocol}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
|
145 |
+
$home_url = trim(rtrim(get_option('home'), '/'));
|
146 |
// Adjust prefix (it should be the same in both request & home_url)
|
147 |
$home_url = ($protocol == 'https://') ? str_replace("http://", "https://", $home_url) : str_replace("https://", "http://", $home_url);
|
148 |
|
153 |
// Remove .html suffix and domain name from URL and query (URLs ended with .html will work as aliases)
|
154 |
$request_url = trim(str_replace($home_url, "", $request_url), "/");
|
155 |
|
156 |
+
// Remove querystrings from URI
|
157 |
+
$request_url = strtok($request_url, '?');
|
158 |
+
|
159 |
// Split the current URL into subparts (check if WPML is active)
|
160 |
if(isset($sitepress_settings['language_negotiation_type']) && $sitepress_settings['language_negotiation_type'] == 1) {
|
161 |
+
preg_match("/^(?:(\w{2})\/)?(.+?)\/?(page|feed|embed|attachment|track)?(?:\/([\d+]))?\/?$/i", $request_url, $url_parts);
|
162 |
$lang = (!empty($url_parts[1])) ? $url_parts[1] : "";
|
163 |
$uri = (!empty($url_parts[2])) ? $url_parts[2] : "";
|
164 |
$endpoint = (!empty($url_parts[3])) ? $url_parts[3] : "";
|
165 |
$endpoint_value = (!empty($url_parts[4])) ? $url_parts[4] : "";
|
166 |
} else {
|
167 |
+
preg_match("/^(.+?)\/?(page|feed|embed|attachment|track)?(?:\/([\d+]))?\/?$/i", $request_url, $url_parts);
|
168 |
$lang = false;
|
169 |
$uri = (!empty($url_parts[1])) ? $url_parts[1] : "";
|
170 |
$endpoint = (!empty($url_parts[2])) ? $url_parts[2] : "";
|
171 |
$endpoint_value = (!empty($url_parts[3])) ? $url_parts[3] : "";
|
172 |
}
|
173 |
|
174 |
+
// Trim slashes
|
175 |
+
$uri = trim($uri, "/");
|
176 |
+
|
177 |
// Ignore URLs with no URI grabbed
|
178 |
if(empty($uri)) return $query;
|
179 |
|
|
|
|
|
|
|
180 |
/**
|
181 |
* 2A. Check if found URI matches any element from custom uris array
|
182 |
*/
|
185 |
// Check again in case someone added .html suffix to particular post (with .html suffix)
|
186 |
$item_id = (empty($item_id)) ? array_search("{$uri}.html", $permalink_manager_uris) : $item_id;
|
187 |
|
188 |
+
// Check again in case someone used post/tax IDs instead of slugs
|
189 |
+
$deep_detect_enabled = apply_filters('permalink_manager_deep_uri_detect', false);
|
190 |
+
if($deep_detect_enabled && (empty($item_id)) && isset($old_query['page'])) {
|
191 |
+
$item_id = array_search("{$uri}/{$endpoint_value}", $permalink_manager_uris);
|
192 |
+
$endpoint_value = $endpoint = "";
|
193 |
+
}
|
194 |
+
|
195 |
// Clear the original query before it is filtered
|
196 |
$query = ($item_id) ? array() : $query;
|
197 |
|
234 |
|
235 |
// Fix for WPML languages mismatch
|
236 |
$post_lang_details = apply_filters('wpml_post_language_details', NULL, $item_id);
|
237 |
+
if(is_array($post_lang_details)) {
|
238 |
+
$language_code = (!empty($post_lang_details['language_code'])) ? $post_lang_details['language_code'] : '';
|
239 |
+
if($lang && ($lang != $language_code)) {
|
240 |
+
$wpml_item_id = apply_filters('wpml_object_id', $item_id);
|
241 |
+
$item_id = (is_numeric($wpml_item_id)) ? $wpml_item_id : $item_id;
|
242 |
+
}
|
243 |
}
|
244 |
|
245 |
$post_to_load = get_post($item_id);
|
274 |
/**
|
275 |
* 2C. Endpoints
|
276 |
*/
|
277 |
+
if($item_id && !(empty($endpoint_value))) {
|
278 |
+
$endpoint = ($endpoint) ? str_replace(array('page', 'trackback'), array('paged', 'tb'), $endpoint) : "page";
|
279 |
$query[$endpoint] = $endpoint_value;
|
280 |
}
|
281 |
|
305 |
}
|
306 |
|
307 |
// Get the real URL
|
308 |
+
$correct_permalink = get_permalink($wp_query->queried_object_id);
|
|
|
|
|
|
|
309 |
}
|
310 |
|
311 |
// Get the redirection mode
|
312 |
$redirect_mode = $permalink_manager_options['miscellaneous']['redirect'];
|
313 |
|
314 |
// Ignore default URIs (or do nothing if redirects are disabled)
|
315 |
+
if(!empty($correct_permalink) && !empty($redirect_mode)) {
|
316 |
+
wp_redirect($correct_permalink, $redirect_mode);
|
317 |
exit();
|
318 |
}
|
319 |
}
|