WordPress Related Posts - Version 3.4.2

Version Description

  • Responsive themes bug fix
  • Better related post summary shortening
  • Custom CSS bugfix
  • Custom default thumbnail bugfix
Download this release

Release Info

Developer ddksr
Plugin Icon wp plugin WordPress Related Posts
Version 3.4.2
Comparing to
See all releases

Code changes from version 3.4.1 to 3.4.2

config.php CHANGED
@@ -27,7 +27,7 @@ define('WP_RP_THUMBNAILS_DEFAULTS_COUNT', 31);
27
 
28
  define("WP_RP_MAX_LABEL_LENGTH", 32);
29
 
30
- define("WP_RP_CTR_DASHBOARD_URL", "http://d.zemanta.com/");
31
  define("WP_RP_STATIC_LOADER_FILE", "js/loader.js");
32
 
33
  define("WP_RP_STATIC_INFINITE_RECS_JS_FILE", "js/infiniterecs.js");
@@ -44,6 +44,8 @@ define("WP_RP_RECOMMENDATIONS_NUM_PREGENERATED_POSTS", 50);
44
 
45
  define("WP_RP_THUMBNAILS_NUM_PREGENERATED_POSTS", 50);
46
 
 
 
47
  global $wp_rp_options, $wp_rp_meta, $wp_rp_global_notice_pages;
48
  $wp_rp_options = false;
49
  $wp_rp_meta = false;
@@ -252,6 +254,14 @@ function wp_rp_is_classic() {
252
  return false;
253
  }
254
 
 
 
 
 
 
 
 
 
255
  function wp_rp_migrate_3_4() {
256
  $wp_rp_meta = get_option('wp_rp_meta');
257
  $wp_rp_meta['version'] = '3.4.1';
27
 
28
  define("WP_RP_MAX_LABEL_LENGTH", 32);
29
 
30
+ define("WP_RP_CTR_DASHBOARD_URL", "https://d.zemanta.com/");
31
  define("WP_RP_STATIC_LOADER_FILE", "js/loader.js");
32
 
33
  define("WP_RP_STATIC_INFINITE_RECS_JS_FILE", "js/infiniterecs.js");
44
 
45
  define("WP_RP_THUMBNAILS_NUM_PREGENERATED_POSTS", 50);
46
 
47
+ define("WP_RP_EXCERPT_SHORTENED_SYMBOL", " […]");
48
+
49
  global $wp_rp_options, $wp_rp_meta, $wp_rp_global_notice_pages;
50
  $wp_rp_options = false;
51
  $wp_rp_meta = false;
254
  return false;
255
  }
256
 
257
+ function wp_rp_migrate_3_4_1() {
258
+ $wp_rp_meta = get_option('wp_rp_meta');
259
+ $wp_rp_meta['version'] = '3.4.2';
260
+ $wp_rp_meta['new_user'] = false;
261
+ update_option('wp_rp_meta', $wp_rp_meta);
262
+ }
263
+
264
+
265
  function wp_rp_migrate_3_4() {
266
  $wp_rp_meta = get_option('wp_rp_meta');
267
  $wp_rp_meta['version'] = '3.4.1';
init.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- define('WP_RP_VERSION', '3.4.1');
3
 
4
  define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
5
 
@@ -255,6 +255,17 @@ function wp_rp_get_next_post(&$related_posts, &$selected_related_posts, &$insert
255
  return $post;
256
  }
257
 
 
 
 
 
 
 
 
 
 
 
 
258
  function wp_rp_generate_related_posts_list_items($related_posts, $selected_related_posts) {
259
  $options = wp_rp_get_options();
260
  $platform_options = wp_rp_get_platform_options();
@@ -335,7 +346,7 @@ function wp_rp_generate_related_posts_list_items($related_posts, $selected_relat
335
 
336
  if ($excerpt) {
337
  if (strlen($excerpt) > $excerpt_max_length) {
338
- $excerpt = mb_substr($excerpt, 0, $excerpt_max_length - 3) . '...';
339
  }
340
  $output .= ' <small class="wp_rp_excerpt">' . $excerpt . '</small>';
341
  }
@@ -459,10 +470,6 @@ function wp_rp_head_resources() {
459
 
460
  $static_url = plugins_url('static/', __FILE__);
461
  $theme_url = plugins_url(WP_RP_STATIC_THEMES_PATH, __FILE__);
462
-
463
- if ($platform_options['custom_theme_enabled']) {
464
- $output .= '<style type="text/css">' . "\n" . $platform_options['theme_custom_css'] . "</style>\n";
465
- }
466
 
467
  if ($options['enable_themes']) {
468
  if ($platform_options['theme_name'] !== 'plain.css' && $platform_options['theme_name'] !== 'm-plain.css') {
@@ -478,6 +485,10 @@ function wp_rp_head_resources() {
478
  }
479
  }
480
 
 
 
 
 
481
  if (current_user_can('edit_posts') && $statistics_enabled) {
482
  wp_enqueue_style('wp_rp_edit_related_posts_css', $theme_url . 'edit_related_posts.css', array(), WP_RP_VERSION);
483
  wp_enqueue_script('wp_rp_edit_related_posts_js', $static_url . 'js/edit_related_posts.js', array('jquery'), WP_RP_VERSION);
1
  <?php
2
+ define('WP_RP_VERSION', '3.4.2');
3
 
4
  define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
5
 
255
  return $post;
256
  }
257
 
258
+ function wp_rp_text_shorten($text, $max_chars) {
259
+ $shortened_text = mb_substr($text, 0, $max_chars - strlen(WP_RP_EXCERPT_SHORTENED_SYMBOL));
260
+ $shortened_words = explode(" ", $shortened_text);
261
+ $shortened_size = count($shortened_words);
262
+ if ($shortened_size > 1) {
263
+ $shortened_words = array_slice($shortened_words, 0, $shortened_size - 1);
264
+ $shortened_text = implode(" ", $shortened_words);
265
+ }
266
+ return $shortened_text . WP_RP_EXCERPT_SHORTENED_SYMBOL; //'...';
267
+ }
268
+
269
  function wp_rp_generate_related_posts_list_items($related_posts, $selected_related_posts) {
270
  $options = wp_rp_get_options();
271
  $platform_options = wp_rp_get_platform_options();
346
 
347
  if ($excerpt) {
348
  if (strlen($excerpt) > $excerpt_max_length) {
349
+ $excerpt = wp_rp_text_shorten($excerpt, $excerpt_max_length);
350
  }
351
  $output .= ' <small class="wp_rp_excerpt">' . $excerpt . '</small>';
352
  }
470
 
471
  $static_url = plugins_url('static/', __FILE__);
472
  $theme_url = plugins_url(WP_RP_STATIC_THEMES_PATH, __FILE__);
 
 
 
 
473
 
474
  if ($options['enable_themes']) {
475
  if ($platform_options['theme_name'] !== 'plain.css' && $platform_options['theme_name'] !== 'm-plain.css') {
485
  }
486
  }
487
 
488
+ if ($platform_options['custom_theme_enabled']) {
489
+ $output .= '<style type="text/css">' . "\n" . $platform_options['theme_custom_css'] . "</style>\n";
490
+ }
491
+
492
  if (current_user_can('edit_posts') && $statistics_enabled) {
493
  wp_enqueue_style('wp_rp_edit_related_posts_css', $theme_url . 'edit_related_posts.css', array(), WP_RP_VERSION);
494
  wp_enqueue_script('wp_rp_edit_related_posts_js', $static_url . 'js/edit_related_posts.js', array('jquery'), WP_RP_VERSION);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: related,posts,post,related posts,plugin,seo
4
  License: GPLv2
5
  Requires at least: 3.3
6
  Tested up to: 3.9
7
- Stable tag: 3.4.1
8
 
9
  WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
10
 
@@ -90,6 +90,12 @@ Fix for security vulnerability. Upgrade immediately.
90
 
91
  == Changelog ==
92
 
 
 
 
 
 
 
93
  = 3.4.1 =
94
  * Fixed theme bug
95
  * Fixed link to Terms of Service
@@ -258,4 +264,3 @@ Fix for security vulnerability. Upgrade immediately.
258
 
259
  = 1.0 =
260
  * first version
261
-
4
  License: GPLv2
5
  Requires at least: 3.3
6
  Tested up to: 3.9
7
+ Stable tag: 3.4.2
8
 
9
  WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
10
 
90
 
91
  == Changelog ==
92
 
93
+ = 3.4.2 =
94
+ * Responsive themes bug fix
95
+ * Better related post summary shortening
96
+ * Custom CSS bugfix
97
+ * Custom default thumbnail bugfix
98
+
99
  = 3.4.1 =
100
  * Fixed theme bug
101
  * Fixed link to Terms of Service
264
 
265
  = 1.0 =
266
  * first version
 
static/css/dashboard.css CHANGED
@@ -16,8 +16,7 @@
16
 
17
 
18
  .settings_block {width: 700px; clear:both; }
19
- .settings_block.collapsed {border-bottom: 1px solid #ddd;}
20
- .settings_block.collapsed {border-bottom: 1px solid #ddd;}
21
 
22
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics {margin: 0; float: left; width: 600px;}
23
  #wp_rp_wrap.wp_rp_dashboard div#wp_rp_statistics_wrap ul.statistics {float: none; width: auto;}
16
 
17
 
18
  .settings_block {width: 700px; clear:both; }
19
+ .settings_block.collapsed {border-bottom: 1px solid #cecece;}
 
20
 
21
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics {margin: 0; float: left; width: 600px;}
22
  #wp_rp_wrap.wp_rp_dashboard div#wp_rp_statistics_wrap ul.statistics {float: none; width: auto;}
static/img/down.png CHANGED
Binary file
static/img/up.png CHANGED
Binary file
static/themes/momma.css CHANGED
@@ -116,12 +116,11 @@ ul.related_post li small {
116
 
117
  @media screen and (max-width: 480px) {
118
  ul.related_post li {
119
- display: block !important;
120
  width: auto !important;
121
  min-height: auto !important;
122
  clear: both !important;
123
-
124
- border: 0 !important;
125
  }
126
  ul.related_post li a {
127
  width: auto !important;
@@ -131,12 +130,5 @@ ul.related_post li small {
131
  }
132
  ul.related_post li a:nth-child(2) {
133
  font-size: 14px !important;
134
- padding: 10px 0 10px 110px !important;
135
- display: block !important;
136
- height: 80px !important;
137
- }
138
- ul.related_post li img {
139
- width: 100px !important;
140
- height: 100px !important;
141
  }
142
  }
116
 
117
  @media screen and (max-width: 480px) {
118
  ul.related_post li {
119
+ display: inline-block !important;
120
  width: auto !important;
121
  min-height: auto !important;
122
  clear: both !important;
123
+ border:none !important;
 
124
  }
125
  ul.related_post li a {
126
  width: auto !important;
130
  }
131
  ul.related_post li a:nth-child(2) {
132
  font-size: 14px !important;
 
 
 
 
 
 
 
133
  }
134
  }
static/themes/twocolumns.css CHANGED
@@ -66,13 +66,13 @@ div.wp_rp_footer a.wp_rp_edit {
66
  }
67
  @media screen and (max-width: 480px) {
68
  ul.related_post {
69
- -moz-column-count: auto !important;
70
  -moz-column-gap: normal !important;
71
  -moz-column-rule: none !important;
72
- -webkit-column-count: auto !important;
73
  -webkit-column-gap: normal !important;
74
  -webkit-column-rule: none !important;
75
- column-count: auto !important;
76
  column-gap: normal !important;
77
  column-rule: none !important;
78
  }
66
  }
67
  @media screen and (max-width: 480px) {
68
  ul.related_post {
69
+ -moz-column-count: 2 !important;
70
  -moz-column-gap: normal !important;
71
  -moz-column-rule: none !important;
72
+ -webkit-column-count: 2 !important;
73
  -webkit-column-gap: normal !important;
74
  -webkit-column-rule: none !important;
75
+ column-count: 2 !important;
76
  column-gap: normal !important;
77
  column-rule: none !important;
78
  }
static/themes/vertical-m.css CHANGED
@@ -76,7 +76,7 @@ ul.related_post li small {
76
 
77
  @media screen and (max-width: 480px) {
78
  ul.related_post li {
79
- display: block !important;
80
  width: auto !important;
81
  clear: both !important;
82
  }
@@ -85,9 +85,6 @@ ul.related_post li small {
85
  }
86
  ul.related_post li a:nth-child(2) {
87
  font-size: 14px !important;
88
- padding: 10px 0 10px 110px !important;
89
- display: block !important;
90
- height: 80px !important;
91
  }
92
  ul.related_post li img {
93
  width: 100px !important;
76
 
77
  @media screen and (max-width: 480px) {
78
  ul.related_post li {
79
+ display: inline-block !important;
80
  width: auto !important;
81
  clear: both !important;
82
  }
85
  }
86
  ul.related_post li a:nth-child(2) {
87
  font-size: 14px !important;
 
 
 
88
  }
89
  ul.related_post li img {
90
  width: 100px !important;
static/themes/vertical-s.css CHANGED
@@ -76,7 +76,7 @@ ul.related_post li small {
76
 
77
  @media screen and (max-width: 480px) {
78
  ul.related_post li {
79
- display: block !important;
80
  width: auto !important;
81
  clear: both !important;
82
  }
@@ -85,12 +85,5 @@ ul.related_post li small {
85
  }
86
  ul.related_post li a:nth-child(2) {
87
  font-size: 14px !important;
88
- padding: 10px 0 10px 110px !important;
89
- display: block !important;
90
- height: 80px !important;
91
- }
92
- ul.related_post li img {
93
- width: 100px !important;
94
- height: 100px !important;
95
  }
96
  }
76
 
77
  @media screen and (max-width: 480px) {
78
  ul.related_post li {
79
+ display: inline-block !important;
80
  width: auto !important;
81
  clear: both !important;
82
  }
85
  }
86
  ul.related_post li a:nth-child(2) {
87
  font-size: 14px !important;
 
 
 
 
 
 
 
88
  }
89
  }
static/themes/vertical.css CHANGED
@@ -76,7 +76,7 @@ ul.related_post li small {
76
 
77
  @media screen and (max-width: 480px) {
78
  ul.related_post li {
79
- display: block !important;
80
  width: auto !important;
81
  clear: both !important;
82
  }
@@ -85,12 +85,5 @@ ul.related_post li small {
85
  }
86
  ul.related_post li a:nth-child(2) {
87
  font-size: 14px !important;
88
- padding: 10px 0 10px 110px !important;
89
- display: block !important;
90
- height: 80px !important;
91
- }
92
- ul.related_post li img {
93
- width: 100px !important;
94
- height: 100px !important;
95
  }
96
  }
76
 
77
  @media screen and (max-width: 480px) {
78
  ul.related_post li {
79
+ display: inline-block !important;
80
  width: auto !important;
81
  clear: both !important;
82
  }
85
  }
86
  ul.related_post li a:nth-child(2) {
87
  font-size: 14px !important;
 
 
 
 
 
 
 
88
  }
89
  }
thumbnailer.php CHANGED
@@ -245,26 +245,24 @@ function wp_rp_get_image_with_exact_size($image_data, $size) {
245
  if (!$size[0]) { $size[0] = (int) ($image_data['data']['width'] / $image_data['data']['height'] * $size[1]); }
246
  if (!$size[1]) { $size[1] = (int) ($image_data['data']['height'] / $image_data['data']['width'] * $size[0]); }
247
 
248
- if (!$image_data['data']['sizes']) {
249
- $w = $image_data['data']['width'];
250
- $h = $image_data['data']['height'];
251
-
252
- $thumb_width = $platform_options['custom_size_thumbnail_enabled'] ? $platform_options['custom_thumbnail_width'] : WP_RP_THUMBNAILS_WIDTH;
253
- $thumb_height = $platform_options['custom_size_thumbnail_enabled'] ? $platform_options['custom_thumbnail_height'] : WP_RP_THUMBNAILS_HEIGHT;
254
-
255
- if ($w == $thumb_width && $h == $thumb_height) {
256
- $file = explode("/", $image_data['data']['file']);
257
- $file = $file[count($file) - 1];
258
- $img_url = str_replace($img_url_basename, wp_basename($file), $img_url);
259
- return array(
260
- 'url' => $img_url,
261
- 'file' => $file,
262
- 'width' => $w,
263
- 'height' => $h
264
- );
265
- }
266
  }
267
-
268
  foreach ($image_data['data']['sizes'] as $_size => $data) {
269
  // width and height can be both string and integers. WordPress..
270
  if (($size[0] == $data['width']) && ($size[1] == $data['height'])) {
245
  if (!$size[0]) { $size[0] = (int) ($image_data['data']['width'] / $image_data['data']['height'] * $size[1]); }
246
  if (!$size[1]) { $size[1] = (int) ($image_data['data']['height'] / $image_data['data']['width'] * $size[0]); }
247
 
248
+ $w = $image_data['data']['width'];
249
+ $h = $image_data['data']['height'];
250
+ $thumb_width = $platform_options['custom_size_thumbnail_enabled'] ? $platform_options['custom_thumbnail_width'] : WP_RP_THUMBNAILS_WIDTH;
251
+ $thumb_height = $platform_options['custom_size_thumbnail_enabled'] ? $platform_options['custom_thumbnail_height'] : WP_RP_THUMBNAILS_HEIGHT;
252
+ $default_sizes = $w == $thumb_width && $h == $thumb_height;
253
+ $matches_sizes = $w == $size[0] && $h == $size[1];
254
+ if (!$image_data['data']['sizes'] && $default_sizes || $matches_sizes) {
255
+ $file = explode("/", $image_data['data']['file']);
256
+ $file = $file[count($file) - 1];
257
+ $img_url = str_replace($img_url_basename, wp_basename($file), $img_url);
258
+ return array(
259
+ 'url' => $img_url,
260
+ 'file' => $file,
261
+ 'width' => $w,
262
+ 'height' => $h
263
+ );
 
 
264
  }
265
+
266
  foreach ($image_data['data']['sizes'] as $_size => $data) {
267
  // width and height can be both string and integers. WordPress..
268
  if (($size[0] == $data['width']) && ($size[1] == $data['height'])) {
wp_related_posts.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
- Version: 3.4.1
5
  Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
6
  Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Click on <a href="admin.php?page=wordpress-related-posts">Related Posts tab</a> to configure your settings.
7
  Author: Zemanta Ltd.
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
+ Version: 3.4.2
5
  Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
6
  Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Click on <a href="admin.php?page=wordpress-related-posts">Related Posts tab</a> to configure your settings.
7
  Author: Zemanta Ltd.