Custom Permalinks - Version 0.7.17

Version Description

  • Patch to address SSL problems, thanks to Amin Mirzaee
Download this release

Release Info

Developer michaeltyson
Plugin Icon Custom Permalinks
Version 0.7.17
Comparing to
See all releases

Code changes from version 0.7.16 to 0.7.17

Files changed (2) hide show
  1. custom-permalinks.php +10 -16
  2. readme.txt +5 -1
custom-permalinks.php CHANGED
@@ -41,7 +41,7 @@ Author URI: http://atastypixel.com/blog
41
  function custom_permalinks_post_link($permalink, $post) {
42
  $custom_permalink = get_post_meta( $post->ID, 'custom_permalink', true );
43
  if ( $custom_permalink ) {
44
- return get_home_url()."/".$custom_permalink;
45
  }
46
 
47
  return $permalink;
@@ -57,7 +57,7 @@ function custom_permalinks_post_link($permalink, $post) {
57
  function custom_permalinks_page_link($permalink, $page) {
58
  $custom_permalink = get_post_meta( $page, 'custom_permalink', true );
59
  if ( $custom_permalink ) {
60
- return get_home_url()."/".$custom_permalink;
61
  }
62
 
63
  return $permalink;
@@ -77,7 +77,7 @@ function custom_permalinks_term_link($permalink, $term) {
77
  $custom_permalink = custom_permalinks_permalink_for_term($term);
78
 
79
  if ( $custom_permalink ) {
80
- return get_home_url()."/".$custom_permalink;
81
  }
82
 
83
  return $permalink;
@@ -131,7 +131,7 @@ function custom_permalinks_redirect() {
131
  // Append any query compenent
132
  $url .= strstr($_SERVER['REQUEST_URI'], "?");
133
 
134
- wp_redirect( get_home_url()."/".$url, 301 );
135
  exit();
136
  }
137
  }
@@ -408,7 +408,7 @@ function custom_permalinks_form($permalink, $original="", $renderContainers=true
408
  <th scope="row"><?php _e('Custom Permalink', 'custom-permalink') ?></th>
409
  <td>
410
  <?php endif; ?>
411
- <?php echo get_home_url() ?>/
412
  <input type="text" class="text" value="<?php echo htmlspecialchars($permalink ? urldecode($permalink) : urldecode($original)) ?>"
413
  style="width: 250px; <?php if ( !$permalink ) echo 'color: #ddd;' ?>"
414
  onfocus="if ( this.style.color = '#ddd' ) { this.style.color = '#000'; }"
@@ -627,7 +627,7 @@ function custom_permalinks_admin_rows() {
627
  $row = array();
628
  $term = get_term($info['id'], ($info['kind'] == 'tag' ? 'post_tag' : 'category'));
629
  $row['id'] = $info['kind'].'.'.$info['id'];
630
- $row['permalink'] = get_home_url()."/".$permalink;
631
  $row['type'] = ucwords($info['kind']);
632
  $row['title'] = $term->name;
633
  $row['editlink'] = ( $info['kind'] == 'tag' ? 'edit-tags.php?action=edit&taxonomy=post_tag&tag_ID='.$info['id'] : 'edit-tags.php?action=edit&taxonomy=category&tag_ID='.$info['id'] );
@@ -663,7 +663,7 @@ function custom_permalinks_admin_rows() {
663
  function custom_permalinks_original_post_link($post_id) {
664
  remove_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 ); // original hook
665
  remove_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
666
- $originalPermalink = ltrim(str_replace(get_option('home'), '', get_permalink( $post_id )), '/');
667
  add_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 ); // original hook
668
  add_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
669
  return $originalPermalink;
@@ -678,7 +678,7 @@ function custom_permalinks_original_post_link($post_id) {
678
  function custom_permalinks_original_page_link($post_id) {
679
  remove_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
680
  remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
681
- $originalPermalink = ltrim(str_replace(get_home_url(), '', get_permalink( $post_id )), '/');
682
  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
683
  add_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
684
  return $originalPermalink;
@@ -694,7 +694,7 @@ function custom_permalinks_original_page_link($post_id) {
694
  function custom_permalinks_original_tag_link($tag_id) {
695
  remove_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
696
  remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
697
- $originalPermalink = ltrim(str_replace(get_home_url(), '', get_tag_link($tag_id)), '/');
698
  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
699
  add_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
700
  return $originalPermalink;
@@ -709,7 +709,7 @@ function custom_permalinks_original_tag_link($tag_id) {
709
  function custom_permalinks_original_category_link($category_id) {
710
  remove_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
711
  remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
712
- $originalPermalink = ltrim(str_replace(get_home_url(), '', get_category_link($category_id)), '/');
713
  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
714
  add_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
715
  return $originalPermalink;
@@ -744,12 +744,6 @@ function custom_permalinks_setup_admin() {
744
  wp_enqueue_script('admin-forms');
745
  }
746
 
747
- if ( !function_exists("get_home_url") ) {
748
- function get_home_url() {
749
- return get_option('home');
750
- }
751
- }
752
-
753
  # Check whether we're running within the WP environment, to avoid showing errors like
754
  # "Fatal error: Call to undefined function get_bloginfo() in C:\xampp\htdocs\custom-permalinks\custom-permalinks.php on line 753"
755
  # and similar errors that occurs when the script is called directly to e.g. find out the full path.
41
  function custom_permalinks_post_link($permalink, $post) {
42
  $custom_permalink = get_post_meta( $post->ID, 'custom_permalink', true );
43
  if ( $custom_permalink ) {
44
+ return home_url()."/".$custom_permalink;
45
  }
46
 
47
  return $permalink;
57
  function custom_permalinks_page_link($permalink, $page) {
58
  $custom_permalink = get_post_meta( $page, 'custom_permalink', true );
59
  if ( $custom_permalink ) {
60
+ return home_url()."/".$custom_permalink;
61
  }
62
 
63
  return $permalink;
77
  $custom_permalink = custom_permalinks_permalink_for_term($term);
78
 
79
  if ( $custom_permalink ) {
80
+ return home_url()."/".$custom_permalink;
81
  }
82
 
83
  return $permalink;
131
  // Append any query compenent
132
  $url .= strstr($_SERVER['REQUEST_URI'], "?");
133
 
134
+ wp_redirect( home_url()."/".$url, 301 );
135
  exit();
136
  }
137
  }
408
  <th scope="row"><?php _e('Custom Permalink', 'custom-permalink') ?></th>
409
  <td>
410
  <?php endif; ?>
411
+ <?php echo home_url() ?>/
412
  <input type="text" class="text" value="<?php echo htmlspecialchars($permalink ? urldecode($permalink) : urldecode($original)) ?>"
413
  style="width: 250px; <?php if ( !$permalink ) echo 'color: #ddd;' ?>"
414
  onfocus="if ( this.style.color = '#ddd' ) { this.style.color = '#000'; }"
627
  $row = array();
628
  $term = get_term($info['id'], ($info['kind'] == 'tag' ? 'post_tag' : 'category'));
629
  $row['id'] = $info['kind'].'.'.$info['id'];
630
+ $row['permalink'] = home_url()."/".$permalink;
631
  $row['type'] = ucwords($info['kind']);
632
  $row['title'] = $term->name;
633
  $row['editlink'] = ( $info['kind'] == 'tag' ? 'edit-tags.php?action=edit&taxonomy=post_tag&tag_ID='.$info['id'] : 'edit-tags.php?action=edit&taxonomy=category&tag_ID='.$info['id'] );
663
  function custom_permalinks_original_post_link($post_id) {
664
  remove_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 ); // original hook
665
  remove_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
666
+ $originalPermalink = ltrim(str_replace(home_url(), '', get_permalink( $post_id )), '/');
667
  add_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 ); // original hook
668
  add_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
669
  return $originalPermalink;
678
  function custom_permalinks_original_page_link($post_id) {
679
  remove_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
680
  remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
681
+ $originalPermalink = ltrim(str_replace(home_url(), '', get_permalink( $post_id )), '/');
682
  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
683
  add_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
684
  return $originalPermalink;
694
  function custom_permalinks_original_tag_link($tag_id) {
695
  remove_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
696
  remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
697
+ $originalPermalink = ltrim(str_replace(home_url(), '', get_tag_link($tag_id)), '/');
698
  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
699
  add_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
700
  return $originalPermalink;
709
  function custom_permalinks_original_category_link($category_id) {
710
  remove_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
711
  remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
712
+ $originalPermalink = ltrim(str_replace(home_url(), '', get_category_link($category_id)), '/');
713
  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
714
  add_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
715
  return $originalPermalink;
744
  wp_enqueue_script('admin-forms');
745
  }
746
 
 
 
 
 
 
 
747
  # Check whether we're running within the WP environment, to avoid showing errors like
748
  # "Fatal error: Call to undefined function get_bloginfo() in C:\xampp\htdocs\custom-permalinks\custom-permalinks.php on line 753"
749
  # and similar errors that occurs when the script is called directly to e.g. find out the full path.
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
4
  Tags: permalink, url, link, address, custom, redirect
5
  Requires at least: 2.6
6
  Tested up to: 3.3.1
7
- Stable tag: 0.7.16
8
 
9
  Set custom permalinks on a per-post, per-tag or per-category basis.
10
 
@@ -29,6 +29,10 @@ within that category.
29
 
30
  == Changelog ==
31
 
 
 
 
 
32
  = 0.7.16 =
33
 
34
  * Security and compatibility fixes by Hans-Michael Varbaek of Sense of Security
4
  Tags: permalink, url, link, address, custom, redirect
5
  Requires at least: 2.6
6
  Tested up to: 3.3.1
7
+ Stable tag: 0.7.17
8
 
9
  Set custom permalinks on a per-post, per-tag or per-category basis.
10
 
29
 
30
  == Changelog ==
31
 
32
+ = 0.7.17 =
33
+
34
+ * Patch to address SSL problems, thanks to Amin Mirzaee
35
+
36
  = 0.7.16 =
37
 
38
  * Security and compatibility fixes by Hans-Michael Varbaek of Sense of Security