Version Description
Aug 09, 2021 =
-
Bugs
- Plugin not save persian alphabet
- Fix PHP Error on Deactivating the plugin
-
Enhancements
- Exclude processing for sitemap URLs
Download this release
Release Info
Developer | sasiddiqui |
Plugin | Custom Permalinks |
Version | 2.1.0 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.1.0
- assets/css/{about-plugins-2.0.1.min.css → about-plugins-2.1.0.min.css} +0 -0
- assets/js/{script-form-2.0.1.min.js → script-form-2.1.0.min.js} +0 -0
- changelog.txt +5 -0
- custom-permalinks.php +1 -1
- includes/class-custom-permalinks-form.php +15 -10
- includes/class-custom-permalinks-frontend.php +55 -5
- includes/class-custom-permalinks.php +2 -2
- readme.txt +9 -7
assets/css/{about-plugins-2.0.1.min.css → about-plugins-2.1.0.min.css}
RENAMED
File without changes
|
assets/js/{script-form-2.0.1.min.js → script-form-2.1.0.min.js}
RENAMED
File without changes
|
changelog.txt
CHANGED
@@ -2,6 +2,11 @@
|
|
2 |
|
3 |
This file contains only old changelog. See readme.txt for newer versions.
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
= 1.7.0 - Aug 20, 2020 =
|
6 |
|
7 |
* Bugs
|
2 |
|
3 |
This file contains only old changelog. See readme.txt for newer versions.
|
4 |
|
5 |
+
= 1.7.1 - Aug 30, 2020 =
|
6 |
+
|
7 |
+
* Bugs
|
8 |
+
* Fix PHP notice (start reporting with WordPress 5.5)
|
9 |
+
|
10 |
= 1.7.0 - Aug 20, 2020 =
|
11 |
|
12 |
* Bugs
|
custom-permalinks.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Custom Permalinks
|
4 |
* Plugin URI: https://www.custompermalinks.com/
|
5 |
* Description: Set custom permalinks on a per-post basis.
|
6 |
-
* Version: 2.0
|
7 |
* Requires at least: 2.6
|
8 |
* Requires PHP: 5.4
|
9 |
* Author: Sami Ahmed Siddiqui
|
3 |
* Plugin Name: Custom Permalinks
|
4 |
* Plugin URI: https://www.custompermalinks.com/
|
5 |
* Description: Set custom permalinks on a per-post basis.
|
6 |
+
* Version: 2.1.0
|
7 |
* Requires at least: 2.6
|
8 |
* Requires PHP: 5.4
|
9 |
* Author: Sami Ahmed Siddiqui
|
includes/class-custom-permalinks-form.php
CHANGED
@@ -198,6 +198,10 @@ class Custom_Permalinks_Form {
|
|
198 |
$permalink = remove_accents( $permalink );
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
201 |
$permalink = wp_strip_all_tags( $permalink );
|
202 |
// Preserve escaped octets.
|
203 |
$permalink = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $permalink );
|
@@ -206,14 +210,16 @@ class Custom_Permalinks_Form {
|
|
206 |
// Restore octets.
|
207 |
$permalink = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $permalink );
|
208 |
|
209 |
-
if (
|
210 |
-
if (
|
211 |
-
if (
|
212 |
-
if (
|
213 |
-
|
|
|
|
|
214 |
}
|
|
|
215 |
}
|
216 |
-
$permalink = utf8_uri_encode( $permalink );
|
217 |
}
|
218 |
}
|
219 |
|
@@ -270,7 +276,7 @@ class Custom_Permalinks_Form {
|
|
270 |
$permalink
|
271 |
);
|
272 |
|
273 |
-
|
274 |
$permalink = str_replace( '%c3%97', 'x', $permalink );
|
275 |
// Kill entities.
|
276 |
$permalink = preg_replace( '/&.+?;/', '', $permalink );
|
@@ -381,7 +387,6 @@ class Custom_Permalinks_Form {
|
|
381 |
if ( ! empty( $_REQUEST['custom_permalink'] )
|
382 |
&& $_REQUEST['custom_permalink'] !== $original_link
|
383 |
) {
|
384 |
-
$language_code = get_locale();
|
385 |
$language_code = apply_filters(
|
386 |
'wpml_element_language_code',
|
387 |
null,
|
@@ -616,7 +621,7 @@ class Custom_Permalinks_Form {
|
|
616 |
*
|
617 |
* @return void
|
618 |
*/
|
619 |
-
private function get_permalink_form( $permalink, $original
|
620 |
$render_containers = true, $postname = ''
|
621 |
) {
|
622 |
$encoded_permalink = htmlspecialchars( urldecode( $permalink ) );
|
@@ -754,7 +759,7 @@ class Custom_Permalinks_Form {
|
|
754 |
|
755 |
$this->delete_term_permalink( $term_id );
|
756 |
|
757 |
-
$language_code =
|
758 |
if ( isset( $term->term_taxonomy_id ) ) {
|
759 |
$term_type = 'category';
|
760 |
if ( isset( $term->taxonomy ) ) {
|
198 |
$permalink = remove_accents( $permalink );
|
199 |
}
|
200 |
|
201 |
+
if ( empty( $language_code ) ) {
|
202 |
+
$language_code = get_locale();
|
203 |
+
}
|
204 |
+
|
205 |
$permalink = wp_strip_all_tags( $permalink );
|
206 |
// Preserve escaped octets.
|
207 |
$permalink = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $permalink );
|
210 |
// Restore octets.
|
211 |
$permalink = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $permalink );
|
212 |
|
213 |
+
if ( 'en' === $language_code || strpos( $language_code, 'en_' ) === 0 ) {
|
214 |
+
if ( seems_utf8( $permalink ) ) {
|
215 |
+
if ( ! $allow_accents ) {
|
216 |
+
if ( function_exists( 'mb_strtolower' ) ) {
|
217 |
+
if ( ! $allow_caps ) {
|
218 |
+
$permalink = mb_strtolower( $permalink, 'UTF-8' );
|
219 |
+
}
|
220 |
}
|
221 |
+
$permalink = utf8_uri_encode( $permalink );
|
222 |
}
|
|
|
223 |
}
|
224 |
}
|
225 |
|
276 |
$permalink
|
277 |
);
|
278 |
|
279 |
+
// Convert × to 'x'.
|
280 |
$permalink = str_replace( '%c3%97', 'x', $permalink );
|
281 |
// Kill entities.
|
282 |
$permalink = preg_replace( '/&.+?;/', '', $permalink );
|
387 |
if ( ! empty( $_REQUEST['custom_permalink'] )
|
388 |
&& $_REQUEST['custom_permalink'] !== $original_link
|
389 |
) {
|
|
|
390 |
$language_code = apply_filters(
|
391 |
'wpml_element_language_code',
|
392 |
null,
|
621 |
*
|
622 |
* @return void
|
623 |
*/
|
624 |
+
private function get_permalink_form( $permalink, $original, $id,
|
625 |
$render_containers = true, $postname = ''
|
626 |
) {
|
627 |
$encoded_permalink = htmlspecialchars( urldecode( $permalink ) );
|
759 |
|
760 |
$this->delete_term_permalink( $term_id );
|
761 |
|
762 |
+
$language_code = '';
|
763 |
if ( isset( $term->term_taxonomy_id ) ) {
|
764 |
$term_type = 'category';
|
765 |
if ( isset( $term->taxonomy ) ) {
|
includes/class-custom-permalinks-frontend.php
CHANGED
@@ -119,7 +119,7 @@ class Custom_Permalinks_Frontend {
|
|
119 |
*
|
120 |
* @return string permalink with language information.
|
121 |
*/
|
122 |
-
public function wpml_permalink_filter( $permalink
|
123 |
$custom_permalink = $permalink;
|
124 |
$trailing_permalink = trailingslashit( home_url() ) . $custom_permalink;
|
125 |
if ( $language_code ) {
|
@@ -201,15 +201,55 @@ class Custom_Permalinks_Frontend {
|
|
201 |
return $posts;
|
202 |
}
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
/**
|
205 |
* Filter to rewrite the query if we have a matching post.
|
206 |
*
|
207 |
* @since 0.1.0
|
208 |
* @access public
|
209 |
*
|
210 |
-
* @param
|
211 |
*
|
212 |
-
* @return
|
213 |
*/
|
214 |
public function parse_request( $query ) {
|
215 |
global $wpdb;
|
@@ -222,8 +262,18 @@ class Custom_Permalinks_Frontend {
|
|
222 |
}
|
223 |
|
224 |
/*
|
225 |
-
*
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
*/
|
228 |
$original_url = null;
|
229 |
|
119 |
*
|
120 |
* @return string permalink with language information.
|
121 |
*/
|
122 |
+
public function wpml_permalink_filter( $permalink, $language_code ) {
|
123 |
$custom_permalink = $permalink;
|
124 |
$trailing_permalink = trailingslashit( home_url() ) . $custom_permalink;
|
125 |
if ( $language_code ) {
|
201 |
return $posts;
|
202 |
}
|
203 |
|
204 |
+
/**
|
205 |
+
* Check conditions if it matches then return true to stop processing the
|
206 |
+
* particular query like for sitemaps.
|
207 |
+
*
|
208 |
+
* @since 2.1.0
|
209 |
+
* @access private
|
210 |
+
*
|
211 |
+
* @param array $query Requested Query.
|
212 |
+
*
|
213 |
+
* @return bool Whether to process the query or not.
|
214 |
+
*/
|
215 |
+
private function exclude_query_proccess( $query ) {
|
216 |
+
$exclude = false;
|
217 |
+
|
218 |
+
/*
|
219 |
+
* Return Query for Sitemap pages.
|
220 |
+
*/
|
221 |
+
if ( isset( $query )
|
222 |
+
&& (
|
223 |
+
( isset( $query['sitemap'] ) && ! empty( $query['sitemap'] ) )
|
224 |
+
|| (
|
225 |
+
isset( $query['seopress_sitemap'] )
|
226 |
+
&& ! empty( $query['seopress_sitemap'] )
|
227 |
+
)
|
228 |
+
|| (
|
229 |
+
isset( $query['seopress_cpt'] )
|
230 |
+
&& ! empty( $query['seopress_cpt'] )
|
231 |
+
)
|
232 |
+
|| (
|
233 |
+
isset( $query['seopress_sitemap_xsl'] )
|
234 |
+
&& 1 === (int) $query['seopress_sitemap_xsl']
|
235 |
+
)
|
236 |
+
)
|
237 |
+
) {
|
238 |
+
$exclude = true;
|
239 |
+
}
|
240 |
+
|
241 |
+
return $exclude;
|
242 |
+
}
|
243 |
+
|
244 |
/**
|
245 |
* Filter to rewrite the query if we have a matching post.
|
246 |
*
|
247 |
* @since 0.1.0
|
248 |
* @access public
|
249 |
*
|
250 |
+
* @param array $query The array of requested query variables.
|
251 |
*
|
252 |
+
* @return array the URL which has to be parsed.
|
253 |
*/
|
254 |
public function parse_request( $query ) {
|
255 |
global $wpdb;
|
262 |
}
|
263 |
|
264 |
/*
|
265 |
+
* Return Query for Sitemap pages.
|
266 |
+
*/
|
267 |
+
$stop_query = $this->exclude_query_proccess( $query );
|
268 |
+
if ( $stop_query ) {
|
269 |
+
// Making it true to avoid redirect if query doesn't needs to be processed.
|
270 |
+
$this->parse_request_status = true;
|
271 |
+
return $query;
|
272 |
+
}
|
273 |
+
|
274 |
+
/*
|
275 |
+
* First, search for a matching custom permalink, and if found generate the
|
276 |
+
* corresponding original URL.
|
277 |
*/
|
278 |
$original_url = null;
|
279 |
|
includes/class-custom-permalinks.php
CHANGED
@@ -18,7 +18,7 @@ class Custom_Permalinks {
|
|
18 |
*
|
19 |
* @var string
|
20 |
*/
|
21 |
-
public $version = '2.0
|
22 |
|
23 |
/**
|
24 |
* Class constructor.
|
@@ -152,7 +152,7 @@ class Custom_Permalinks {
|
|
152 |
* @since 1.6.1
|
153 |
* @access public
|
154 |
*/
|
155 |
-
public function deactivate_details() {
|
156 |
include_once CUSTOM_PERMALINKS_PATH . 'admin/class-custom-permalinks-updates.php';
|
157 |
new Custom_Permalinks_Updates( 'deactivate' );
|
158 |
}
|
18 |
*
|
19 |
* @var string
|
20 |
*/
|
21 |
+
public $version = '2.1.0';
|
22 |
|
23 |
/**
|
24 |
* Class constructor.
|
152 |
* @since 1.6.1
|
153 |
* @access public
|
154 |
*/
|
155 |
+
public static function deactivate_details() {
|
156 |
include_once CUSTOM_PERMALINKS_PATH . 'admin/class-custom-permalinks-updates.php';
|
157 |
new Custom_Permalinks_Updates( 'deactivate' );
|
158 |
}
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: sasiddiqui
|
3 |
Tags: permalink, url, link, address, custom, redirect, custom post type, GDPR, GDPR Compliant
|
4 |
Tested up to: 5.8
|
5 |
-
Stable tag: 2.0
|
6 |
License: GPLv3
|
7 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
8 |
|
@@ -188,10 +188,17 @@ This process defines you the steps to follow either you are installing through W
|
|
188 |
|
189 |
== Changelog ==
|
190 |
|
191 |
-
= 2.0
|
192 |
|
193 |
* Bugs
|
194 |
* [Plugin not save persian alphabet](https://wordpress.org/support/topic/plugin-not-save-persian-alphabet/)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
* [404 error when post/page custom permalink is part of category custom permalink](https://github.com/samiahmedsiddiqui/custom-permalinks/issues/49)
|
196 |
|
197 |
= 2.0.0 - Jul 30, 2021 =
|
@@ -213,11 +220,6 @@ This process defines you the steps to follow either you are installing through W
|
|
213 |
* Removed deprecated functions
|
214 |
* Applied WPCS Standards
|
215 |
|
216 |
-
= 1.7.1 - Aug 30, 2020 =
|
217 |
-
|
218 |
-
* Bugs
|
219 |
-
* Fix PHP notice (start reporting with WordPress 5.5)
|
220 |
-
|
221 |
= Earlier versions =
|
222 |
|
223 |
* For the changelog of earlier versions, please refer to the separate changelog.txt file.
|
2 |
Contributors: sasiddiqui
|
3 |
Tags: permalink, url, link, address, custom, redirect, custom post type, GDPR, GDPR Compliant
|
4 |
Tested up to: 5.8
|
5 |
+
Stable tag: 2.1.0
|
6 |
License: GPLv3
|
7 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
8 |
|
188 |
|
189 |
== Changelog ==
|
190 |
|
191 |
+
= 2.1.0 - Aug 09, 2021 =
|
192 |
|
193 |
* Bugs
|
194 |
* [Plugin not save persian alphabet](https://wordpress.org/support/topic/plugin-not-save-persian-alphabet/)
|
195 |
+
* Fix PHP Error on Deactivating the plugin
|
196 |
+
* Enhancements
|
197 |
+
* Exclude processing for sitemap URLs
|
198 |
+
|
199 |
+
= 2.0.1 - Aug 02, 2021 =
|
200 |
+
|
201 |
+
* Bugs
|
202 |
* [404 error when post/page custom permalink is part of category custom permalink](https://github.com/samiahmedsiddiqui/custom-permalinks/issues/49)
|
203 |
|
204 |
= 2.0.0 - Jul 30, 2021 =
|
220 |
* Removed deprecated functions
|
221 |
* Applied WPCS Standards
|
222 |
|
|
|
|
|
|
|
|
|
|
|
223 |
= Earlier versions =
|
224 |
|
225 |
* For the changelog of earlier versions, please refer to the separate changelog.txt file.
|