Related Posts for WordPress - Version 1.8.1

Version Description

Download this release

Release Info

Developer barrykooij
Plugin Icon 128x128 Related Posts for WordPress
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8.0 to 1.8.1

classes/class-related-word-manager.php CHANGED
@@ -164,7 +164,7 @@ class RP4WP_Related_Word_Manager {
164
  // $content = preg_replace( '/[^a-z0-9]+/i', ' ', $content );
165
 
166
  // UTF8 fix content
167
- $content = iconv( "utf-8", "us-ascii//TRANSLIT", utf8_encode( $content ) );
168
 
169
  // Split string into words
170
  $words = explode( ' ', $content );
@@ -192,13 +192,48 @@ class RP4WP_Related_Word_Manager {
192
  }
193
 
194
  foreach ( $words as $word ) {
195
- $word_multiplied_by_weight = array_fill( 0, $weight, iconv( "utf-8", "us-ascii//TRANSLIT", $word ) );
 
196
  $base_words = array_merge( $base_words, $word_multiplied_by_weight );
197
  }
198
 
199
  return $base_words;
200
  }
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  /**
203
  * Get the words of a post
204
  *
164
  // $content = preg_replace( '/[^a-z0-9]+/i', ' ', $content );
165
 
166
  // UTF8 fix content
167
+ $content = $this->convert_characters( $content );
168
 
169
  // Split string into words
170
  $words = explode( ' ', $content );
192
  }
193
 
194
  foreach ( $words as $word ) {
195
+ $word = $this->convert_characters( $word );
196
+ $word_multiplied_by_weight = array_fill( 0, $weight, $word );
197
  $base_words = array_merge( $base_words, $word_multiplied_by_weight );
198
  }
199
 
200
  return $base_words;
201
  }
202
 
203
+ /**
204
+ * Convert UTF-8 characters correctly
205
+ *
206
+ * @param string $string
207
+ *
208
+ * @return string
209
+ */
210
+ private function convert_characters( $string ) {
211
+
212
+ // Detect encoding, only encode if string isn't encoded already
213
+ if ( 'UTF-8' !== mb_detect_encoding( $string, 'UTF-8', true ) ) {
214
+ $string = utf8_encode( $string );
215
+ }
216
+
217
+ // Check if iconv exists
218
+ if ( function_exists( 'iconv' ) ) {
219
+
220
+ // Replace all 'special characters' with normal ones
221
+ $string = iconv( "UTF-8", "us-ascii//TRANSLIT", $string );
222
+
223
+ } else {
224
+
225
+ // iconv isn't installed, use a regex as alternative
226
+ if ( strpos( $string = htmlentities( $string, ENT_QUOTES, 'UTF-8' ), '&' ) !== false ) {
227
+ $string = html_entity_decode( preg_replace( '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|tilde|uml);~i', '$1', $string ), ENT_QUOTES, 'UTF-8' );
228
+ }
229
+
230
+ }
231
+
232
+
233
+ // Return string
234
+ return $string;
235
+ }
236
+
237
  /**
238
  * Get the words of a post
239
  *
classes/class-rp4wp.php CHANGED
@@ -8,7 +8,7 @@ class RP4WP {
8
 
9
  private static $instance = null;
10
 
11
- const VERSION = '1.8.0';
12
 
13
  /**
14
  * @var RP4WP_Settings
8
 
9
  private static $instance = null;
10
 
11
+ const VERSION = '1.8.1';
12
 
13
  /**
14
  * @var RP4WP_Settings
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Related Posts for WordPress ===
2
  Contributors: barrykooij
3
- Donate link: http://www.relatedpostsforwp.com/
4
  Tags: related posts for wordpress, related posts for wp, simple related posts, easy related posts, related posts, related, relations, internal links, seo, bounce rate
5
  Requires at least: 3.6
6
- Tested up to: 4.1
7
- Stable tag: 1.8.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -21,31 +21,31 @@ Our installation wizard will do all the hard work for you, simply activate the p
21
  > #### Related Posts for WordPress Premium
22
  > There's an even better version of this plugin that comes with the following extra features:<br />
23
  >
24
- > - Custom Post Type Support<br />
25
- > - Related Post Themes<br />
 
26
  > - Custom Taxonomy Support<br />
 
27
  > - WordPress Network / Multisite support<br />
 
28
  > - Priority Email Support<br />
29
  >
30
  > [More information](https://www.relatedpostsforwp.com/features/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=after-features-info-link) | [Upgrade >>](https://www.relatedpostsforwp.com/upgrade-premium/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=after-features-purchase-link)
31
 
32
  = Related Posts for WordPress won't lag your server! =
33
- We don't think having related posts should slow down your website. That's why Related Posts for WordPress creates its own cache and does all the heavy lifting in the admin panel, keeping your website fast as it should be!
34
 
35
  = Automatically link posts to each other =
36
  After installing the plugin you will be taking to a wizard that will analyze your posts and link them to each other based on what we think is related. This means you can install Related Posts for WordPress on your website that has thousands of posts and create related connections on the fly, without any manual work!
37
 
38
  = Manually add, edit or remove =
39
- Everyone makes mistakes, so do we. That's why you can easily modify all automatically created related posts. Simply navigate to the post that has incorrect related posts attached to it, edit it and you're done.
40
-
41
- = WPML compatible =
42
- Related Posts for WordPress is fully compatible with WPML. You can automatically add manually link related posts in their own language.
43
 
44
  = Shortcode =
45
- Related Posts for WordPress has a shortcode allowing you to display related posts on any position within your content.
46
 
47
  = Widget =
48
- Related Posts for Wordpress has a widget allowing you to display related posts in any sidebar you'd like.
49
 
50
  **More information**
51
 
@@ -67,10 +67,13 @@ Related Posts for Wordpress has a widget allowing you to display related posts i
67
  > #### Related Posts for WordPress Premium
68
  > There's an even better version of this plugin that comes with the following extra features:<br />
69
  >
70
- > - Custom Post Type Support<br />
71
- > - Related Post Themes<br />
 
72
  > - Custom Taxonomy Support<br />
 
73
  > - WordPress Network / Multisite support<br />
 
74
  > - Priority Email Support<br />
75
  >
76
  > [More information](https://www.relatedpostsforwp.com/features/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=faq-info-link) | [Upgrade >>](https://www.relatedpostsforwp.com/upgrade-premium/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=faq-purchase-link)
@@ -112,6 +115,10 @@ There is one custom table created for the post cache, this table will however no
112
 
113
  == Changelog ==
114
 
 
 
 
 
115
  = 1.8.0: December 30, 2014 =
116
  * Now preventing double form submitting in settings screen.
117
  * Added plugin version to enqueued scripts.
1
  === Related Posts for WordPress ===
2
  Contributors: barrykooij
3
+ Donate link: http://www.relatedpostsforwp.com/checkout/
4
  Tags: related posts for wordpress, related posts for wp, simple related posts, easy related posts, related posts, related, relations, internal links, seo, bounce rate
5
  Requires at least: 3.6
6
+ Tested up to: 4.1.1
7
+ Stable tag: 1.8.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
21
  > #### Related Posts for WordPress Premium
22
  > There's an even better version of this plugin that comes with the following extra features:<br />
23
  >
24
+ > - Cross Custom Post Type Support<br />
25
+ > - Multiple Related Post Styles<br />
26
+ > - Overwritable templates<br />
27
  > - Custom Taxonomy Support<br />
28
+ > - Adjustable Weights<br />
29
  > - WordPress Network / Multisite support<br />
30
+ > - Keep manually created links<br />
31
  > - Priority Email Support<br />
32
  >
33
  > [More information](https://www.relatedpostsforwp.com/features/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=after-features-info-link) | [Upgrade >>](https://www.relatedpostsforwp.com/upgrade-premium/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=after-features-purchase-link)
34
 
35
  = Related Posts for WordPress won't lag your server! =
36
+ We believe having related posts shouldn't slow down your website. That's why Related Posts for WordPress creates its own cache and does all the heavy lifting in the admin panel, offering you quality related posts while keeping your website fast!
37
 
38
  = Automatically link posts to each other =
39
  After installing the plugin you will be taking to a wizard that will analyze your posts and link them to each other based on what we think is related. This means you can install Related Posts for WordPress on your website that has thousands of posts and create related connections on the fly, without any manual work!
40
 
41
  = Manually add, edit or remove =
42
+ Everyone makes mistakes, so do we. That's why you can easily modify all automatically created related posts. Simply navigate to the post that has incorrect related posts attached to it, select the correct related post and you're done.
 
 
 
43
 
44
  = Shortcode =
45
+ Related Posts for WordPress has a related post shortcode allowing you to display related posts on any position within your content.
46
 
47
  = Widget =
48
+ Related Posts for Wordpress has a related post widget allowing you to display related posts in any sidebar you'd like.
49
 
50
  **More information**
51
 
67
  > #### Related Posts for WordPress Premium
68
  > There's an even better version of this plugin that comes with the following extra features:<br />
69
  >
70
+ > - Cross Custom Post Type Support<br />
71
+ > - Multiple Related Post Styles<br />
72
+ > - Overwritable templates<br />
73
  > - Custom Taxonomy Support<br />
74
+ > - Adjustable Weights<br />
75
  > - WordPress Network / Multisite support<br />
76
+ > - Keep manually created links<br />
77
  > - Priority Email Support<br />
78
  >
79
  > [More information](https://www.relatedpostsforwp.com/features/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=faq-info-link) | [Upgrade >>](https://www.relatedpostsforwp.com/upgrade-premium/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=faq-purchase-link)
115
 
116
  == Changelog ==
117
 
118
+ = 1.8.1: January 3, 2015 =
119
+ * Fixed a bug where UTF-8 encoded characters were not correctly parsed.
120
+ * Introduced icon alternative for when iconv isn't installed on server.
121
+
122
  = 1.8.0: December 30, 2014 =
123
  * Now preventing double form submitting in settings screen.
124
  * Added plugin version to enqueued scripts.
related-posts-for-wp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Related Posts for WordPress
4
  Plugin URI: http://www.relatedpostsforwp.com/
5
  Description: Related Posts for WordPress, the best way to display related posts in WordPress.
6
- Version: 1.8.0
7
  Author: Barry Kooij
8
  Author URI: http://www.barrykooij.com/
9
  License: GPL v3
3
  Plugin Name: Related Posts for WordPress
4
  Plugin URI: http://www.relatedpostsforwp.com/
5
  Description: Related Posts for WordPress, the best way to display related posts in WordPress.
6
+ Version: 1.8.1
7
  Author: Barry Kooij
8
  Author URI: http://www.barrykooij.com/
9
  License: GPL v3