WordPress Related Posts - Version 2.4

Version Description

  • Limit related post age
  • Bugfix for thumbnail extraction
Download this release

Release Info

Developer jureham
Plugin Icon wp plugin WordPress Related Posts
Version 2.4
Comparing to
See all releases

Code changes from version 2.3 to 2.4

config.php CHANGED
@@ -132,13 +132,23 @@ function wp_rp_upgrade() {
132
  }
133
  }
134
 
 
 
 
 
 
 
 
 
 
 
135
  function wp_rp_related_posts_db_table_install() {
136
  global $wpdb;
137
 
138
  $tags_table_name = $wpdb->prefix . "wp_rp_tags";
139
  $sql_tags = "CREATE TABLE $tags_table_name (
140
  post_id mediumint(9),
141
- time timestamp DEFAULT CURRENT_TIMESTAMP,
142
  label VARCHAR(32) NOT NULL,
143
  weight float,
144
  INDEX post_id (post_id),
@@ -197,7 +207,8 @@ function wp_rp_install() {
197
  'promoted_content_enabled' => false,
198
  'enable_themes' => false,
199
  'custom_theme_enabled' => false,
200
- 'traffic_exchange_enabled' => false
 
201
  );
202
 
203
  update_option('wp_rp_meta', $wp_rp_meta);
@@ -206,6 +217,21 @@ function wp_rp_install() {
206
  wp_rp_related_posts_db_table_install();
207
  }
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  function wp_rp_migrate_2_2() {
210
  $wp_rp_meta = get_option('wp_rp_meta');
211
  $wp_rp_options = get_option('wp_rp_options');
132
  }
133
  }
134
 
135
+ function wp_rp_related_posts_db_table_uninstall() {
136
+ global $wpdb;
137
+
138
+ $tags_table_name = $wpdb->prefix . "wp_rp_tags";
139
+
140
+ $sql = "DROP TABLE " . $tags_table_name;
141
+
142
+ $wpdb->query($sql);
143
+ }
144
+
145
  function wp_rp_related_posts_db_table_install() {
146
  global $wpdb;
147
 
148
  $tags_table_name = $wpdb->prefix . "wp_rp_tags";
149
  $sql_tags = "CREATE TABLE $tags_table_name (
150
  post_id mediumint(9),
151
+ post_date datetime NOT NULL,
152
  label VARCHAR(32) NOT NULL,
153
  weight float,
154
  INDEX post_id (post_id),
207
  'promoted_content_enabled' => false,
208
  'enable_themes' => false,
209
  'custom_theme_enabled' => false,
210
+ 'traffic_exchange_enabled' => false,
211
+ 'max_related_post_age_in_days' => 0
212
  );
213
 
214
  update_option('wp_rp_meta', $wp_rp_meta);
217
  wp_rp_related_posts_db_table_install();
218
  }
219
 
220
+ function wp_rp_migrate_2_3() {
221
+ $wp_rp_meta = get_option('wp_rp_meta');
222
+ $wp_rp_options = get_option('wp_rp_options');
223
+
224
+ $wp_rp_meta['version'] = '2.4';
225
+
226
+ $wp_rp_options['max_related_post_age_in_days'] = 0;
227
+
228
+ wp_rp_related_posts_db_table_uninstall();
229
+ wp_rp_related_posts_db_table_install();
230
+
231
+ update_option('wp_rp_meta', $wp_rp_meta);
232
+ update_option('wp_rp_options', $wp_rp_options);
233
+ }
234
+
235
  function wp_rp_migrate_2_2() {
236
  $wp_rp_meta = get_option('wp_rp_meta');
237
  $wp_rp_options = get_option('wp_rp_options');
readme.txt CHANGED
@@ -1,11 +1,10 @@
1
  === Plugin Name ===
2
- Contributors: jureham
3
  Tags: related,posts,post,related posts,plugin
4
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LB3MVPLUAWCY6
5
  License: GPLv2
6
  Requires at least: 3.3
7
  Tested up to: 3.5
8
- Stable tag: 2.3
9
 
10
  WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
11
 
@@ -39,6 +38,10 @@ It places a list of links with thumbnails at the bottom of your posts. It increa
39
 
40
  Yes, related posts are responsive so they adapt to the screen size to ensure maximum click-through rates.
41
 
 
 
 
 
42
  == Installation ==
43
 
44
  = Via admin: =
@@ -62,6 +65,10 @@ Yes, related posts are responsive so they adapt to the screen size to ensure max
62
 
63
  == Changelog ==
64
 
 
 
 
 
65
  = 2.3 =
66
  * Earn money by displaying promoted content
67
  * Bugfixes
1
  === Plugin Name ===
2
+ Contributors: zemanta
3
  Tags: related,posts,post,related posts,plugin
 
4
  License: GPLv2
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
+ Stable tag: 2.4
8
 
9
  WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
10
 
38
 
39
  Yes, related posts are responsive so they adapt to the screen size to ensure maximum click-through rates.
40
 
41
+ = Why does Zemanta have 3 similar plugins? What's the difference between them? =
42
+
43
+ We adopted the principle of having three "release channels". You can try the most experimental (still stable!) features in [Related Posts](http://wordpress.org/extend/plugins/related-posts/ "Related Posts"). The more advanced ones are in [WordPress Related Posts](http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/ "WordPress Related Posts"). If you're looking for the Professional version go for [Related Posts by Zemanta](http://wordpress.org/extend/plugins/related-posts-by-zemanta/ "Related Posts by Zemanta").
44
+
45
  == Installation ==
46
 
47
  = Via admin: =
65
 
66
  == Changelog ==
67
 
68
+ = 2.4 =
69
+ * Limit related post age
70
+ * Bugfix for thumbnail extraction
71
+
72
  = 2.3 =
73
  * Earn money by displaying promoted content
74
  * Bugfixes
recommendations.php CHANGED
@@ -132,14 +132,15 @@ function wp_rp_generate_tags($post) {
132
  array_push($all_tags, $label);
133
 
134
  array_push($sql_tag_values, $post->ID);
 
135
  array_push($sql_tag_values, $label);
136
  array_push($sql_tag_values, $weight);
137
  }
138
  }
139
 
140
  if (count($all_tags) > 0 && $post->post_status == 'publish') {
141
- $sql_tag_format_line = '(%d, %s, %f)';
142
- $tags_insert_query = $wpdb->prepare('INSERT INTO ' . $wpdb->prefix . 'wp_rp_tags (post_id, label, weight)
143
  VALUES ' . implode(', ', array_fill(0, count($all_tags), $sql_tag_format_line)) . ';',
144
  $sql_tag_values);
145
 
@@ -190,6 +191,7 @@ function wp_rp_fetch_related_posts_v2($limit = 10, $exclude_ids = array()) {
190
  ) as freqs
191
  WHERE
192
  target.post_id NOT IN (%s) AND
 
193
  target.label=freqs.label AND
194
  target.label IN (" . implode(', ', array_fill(0, count($tags), "%s")) . ")" .
195
  (empty($exclude_categories_labels) ? "" : " AND
@@ -204,6 +206,7 @@ function wp_rp_fetch_related_posts_v2($limit = 10, $exclude_ids = array()) {
204
  array($total_number_of_posts, $total_number_of_posts),
205
  $tags,
206
  array($exclude_ids_str),
 
207
  $tags,
208
  $exclude_categories_labels,
209
  array($limit * 2)
@@ -226,11 +229,11 @@ function wp_rp_fetch_related_posts_v2($limit = 10, $exclude_ids = array()) {
226
  $post_query = $wpdb->prepare("
227
  SELECT post.ID, post.post_title, post.post_excerpt, post.post_content, post.post_date, post.comment_count
228
  FROM $wpdb->posts as post
229
- WHERE post.ID IN (" . implode(', ', array_fill(0, count($related_post_ids), '%s')) . ")
230
- AND post_type = 'post'
231
- AND post_status = 'publish'
232
- AND post_date_gmt < %s",
233
- array_merge($related_post_ids, array($now, $limit)));
234
 
235
  $related_posts = $wpdb->get_results($post_query);
236
 
@@ -266,9 +269,26 @@ function wp_rp_fetch_related_posts($limit = 10, $exclude_ids = array()) {
266
 
267
  $related_posts = false;
268
  if ($taglist) {
269
- $q = "SELECT p.ID, p.post_title, p.post_content,p.post_excerpt, p.post_date, p.comment_count, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID AND (t_t.term_id IN ($taglist)) AND p.ID NOT IN ($exclude_ids_str) AND " .
270
- (!$options['exclude_categories'] ? "" : "p.ID NOT IN (SELECT tr.object_id FROM $wpdb->term_taxonomy tt, $wpdb->term_relationships tr WHERE tt.taxonomy = 'category' AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tt.term_id IN (" . $options['exclude_categories'] . ")) AND ") .
271
- "p.post_status = 'publish' AND p.post_type = 'post' AND p.post_date_gmt < '$now' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC LIMIT $limit;";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
  $related_posts = $wpdb->get_results($q);
274
  }
@@ -286,6 +306,9 @@ function wp_rp_fetch_random_posts($limit = 10, $exclude_ids = array()) {
286
  if($options['exclude_categories']) {
287
  $q1 .= " AND ID NOT IN (SELECT tr.object_id FROM $wpdb->term_taxonomy tt, $wpdb->term_relationships tr WHERE tt.taxonomy = 'category' AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tt.term_id IN (" . $options['exclude_categories'] . "))";
288
  }
 
 
 
289
  $ids = $wpdb->get_col($q1, 0);
290
  $count = count($ids);
291
  if($count <= 1) {
132
  array_push($all_tags, $label);
133
 
134
  array_push($sql_tag_values, $post->ID);
135
+ array_push($sql_tag_values, $post->post_date);
136
  array_push($sql_tag_values, $label);
137
  array_push($sql_tag_values, $weight);
138
  }
139
  }
140
 
141
  if (count($all_tags) > 0 && $post->post_status == 'publish') {
142
+ $sql_tag_format_line = '(%d, %s, %s, %f)';
143
+ $tags_insert_query = $wpdb->prepare('INSERT INTO ' . $wpdb->prefix . 'wp_rp_tags (post_id, post_date, label, weight)
144
  VALUES ' . implode(', ', array_fill(0, count($all_tags), $sql_tag_format_line)) . ';',
145
  $sql_tag_values);
146
 
191
  ) as freqs
192
  WHERE
193
  target.post_id NOT IN (%s) AND
194
+ " . ($options['max_related_post_age_in_days'] > 0 ? "target.post_date > DATE_SUB(CURDATE(), INTERVAL %s DAY) AND" : "") . "
195
  target.label=freqs.label AND
196
  target.label IN (" . implode(', ', array_fill(0, count($tags), "%s")) . ")" .
197
  (empty($exclude_categories_labels) ? "" : " AND
206
  array($total_number_of_posts, $total_number_of_posts),
207
  $tags,
208
  array($exclude_ids_str),
209
+ $options['max_related_post_age_in_days'] > 0 ? array($options['max_related_post_age_in_days']) : array(),
210
  $tags,
211
  $exclude_categories_labels,
212
  array($limit * 2)
229
  $post_query = $wpdb->prepare("
230
  SELECT post.ID, post.post_title, post.post_excerpt, post.post_content, post.post_date, post.comment_count
231
  FROM $wpdb->posts as post
232
+ WHERE post.ID IN (" . implode(', ', array_fill(0, count($related_post_ids), '%d')) . ")
233
+ AND post.post_type = 'post'
234
+ AND post.post_status = 'publish'
235
+ AND post.post_date_gmt < %s",
236
+ array_merge($related_post_ids, array($now)));
237
 
238
  $related_posts = $wpdb->get_results($post_query);
239
 
269
 
270
  $related_posts = false;
271
  if ($taglist) {
272
+ $q = "SELECT p.ID, p.post_title, p.post_content,p.post_excerpt, p.post_date, p.comment_count, count(t_r.object_id) as cnt
273
+ FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p
274
+ WHERE t_t.taxonomy ='post_tag'
275
+ AND t_t.term_taxonomy_id = t_r.term_taxonomy_id
276
+ AND t_r.object_id = p.ID
277
+ AND (t_t.term_id IN ($taglist))
278
+ AND p.ID NOT IN ($exclude_ids_str)
279
+ AND " . (!$options['exclude_categories'] ? "" : "p.ID NOT IN (
280
+ SELECT tr.object_id FROM $wpdb->term_taxonomy tt, $wpdb->term_relationships tr
281
+ WHERE tt.taxonomy = 'category'
282
+ AND tt.term_taxonomy_id = tr.term_taxonomy_id
283
+ AND tt.term_id IN (" . $options['exclude_categories'] . "))
284
+ AND "
285
+ ) .
286
+ "p.post_status = 'publish'
287
+ AND p.post_type = 'post'
288
+ AND " . ($options['max_related_post_age_in_days'] == 0 ? ""
289
+ : "p.post_date > DATE_SUB(CURDATE(), INTERVAL " . $options['max_related_post_age_in_days'] . " DAY) AND ") .
290
+ "p.post_date_gmt < '$now' GROUP BY t_r.object_id
291
+ ORDER BY cnt DESC, p.post_date_gmt DESC LIMIT $limit;";
292
 
293
  $related_posts = $wpdb->get_results($q);
294
  }
306
  if($options['exclude_categories']) {
307
  $q1 .= " AND ID NOT IN (SELECT tr.object_id FROM $wpdb->term_taxonomy tt, $wpdb->term_relationships tr WHERE tt.taxonomy = 'category' AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tt.term_id IN (" . $options['exclude_categories'] . "))";
308
  }
309
+ if($options['max_related_post_age_in_days'] > 0) {
310
+ $q1 .= " AND post_date > DATE_SUB(CURDATE(), INTERVAL " . $options['max_related_post_age_in_days'] . " DAY)";
311
+ }
312
  $ids = $wpdb->get_col($q1, 0);
313
  $count = count($ids);
314
  if($count <= 1) {
settings.php CHANGED
@@ -130,14 +130,14 @@ function wp_rp_settings_admin_menu() {
130
  }
131
 
132
  function wp_rp_settings_scripts() {
133
- wp_enqueue_script('wp_rp_themes_script', plugins_url('static/js/themes.js', __FILE__), array('jquery'));
134
- wp_enqueue_script("wp_rp_dashboard_script", plugins_url('static/js/dashboard.js', __FILE__), array('jquery') );
135
  }
136
  function wp_rp_settings_styles() {
137
  wp_enqueue_style("wp_rp_dashaboard_style", plugins_url("static/css/dashboard.css", __FILE__));
138
  }
139
 
140
- function wp_rp_register_blog() {
141
  $meta = wp_rp_get_meta();
142
 
143
  $req_options = array(
@@ -145,6 +145,7 @@ function wp_rp_register_blog() {
145
  );
146
 
147
  $response = wp_remote_get(WP_RP_CTR_DASHBOARD_URL . 'register/?blog_url=' . get_bloginfo('wpurl') .
 
148
  ($meta['new_user'] ? '&new' : '') .
149
  ($meta['turn_on_button_pressed'] ? ('&turn_on=' . $meta['turn_on_button_pressed']) : ''),
150
  $req_options);
@@ -256,7 +257,8 @@ function wp_rp_settings_page() {
256
  'promoted_content_enabled' => isset($postdata['wp_rp_promoted_content_enabled']),
257
  'enable_themes' => isset($postdata['wp_rp_enable_themes']),
258
  'custom_theme_enabled' => isset($postdata['wp_rp_custom_theme_enabled']),
259
- 'traffic_exchange_enabled' => isset($postdata['wp_rp_traffic_exchange_enabled'])
 
260
  );
261
 
262
  if(!isset($postdata['wp_rp_exclude_categories'])) {
@@ -328,7 +330,8 @@ function wp_rp_settings_page() {
328
  }
329
 
330
  if($options['ctr_dashboard_enabled'] && (!$meta['blog_id'] || !$meta['auth_key'])) {
331
- wp_rp_register_blog();
 
332
  }
333
 
334
  ?>
@@ -364,31 +367,55 @@ function wp_rp_settings_page() {
364
  <div class="support">
365
  <h4><?php _e("Awesome support", 'wp_related_posts'); ?></h4>
366
  <p>
367
- <?php _e("If you have any questions please contact us at",'wp_related_posts');?> <a target="_blank" href="mailto:relatedpostsplugin@gmail.com"><?php _e("support", 'wp_related_posts');?></a>.
368
  </p>
369
  </div>
370
- <h2 class="title"><?php _e("Related Posts",'wp_related_posts');?></h2>
371
  </div>
372
- <div id="wp-rp-survey" class="updated highlight" style="display:none;"><p><?php _e("Please fill out",'wp_related_posts');?> <a class="link" target="_blank" href="http://wprelatedposts.polldaddy.com/s/quick-survey"><?php _e("a quick survey", 'wp_related_posts');?></a>.<a href="#" class="close" style="float: right;">x</a></p></div>
373
 
374
  <?php wp_rp_print_notifications(); ?>
375
 
376
  <?php if($meta['show_turn_on_button']): ?>
377
  <div id="wp_rp_turn_on_statistics">
378
- <table cellspacing="0" cellpadding="0"><tbody><tr>
379
- <td>
380
- <h2>
381
- Turn on Advanced Features
382
- </h2>
383
- <ul>
384
- <li>Real-time Analytics*</li>
385
- <li>Thumbnail Support</li>
386
- <li>Promoted Content</li>
387
- </ul>
388
- </td><td>
389
- <a class="turn-on" href="#">Turn on</a>
390
- </td>
391
- </tr></tbody></table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  </div>
393
  <?php endif; ?>
394
 
@@ -456,7 +483,7 @@ jQuery(function($) {
456
  <iframe id="wp_rp_blogger_network_hidden_iframe" name="wp_rp_blogger_network_hidden_iframe" style="display: none"></iframe>
457
  <?php endif; ?>
458
 
459
- <form method="post" enctype="multipart/form-data" action="" id="wp_rp_settings_form">
460
  <?php if ($options['ctr_dashboard_enabled']): ?>
461
  <div id="wp_rp_earnings_holder" style="display:none;">
462
  <h2><?php _e('Earnings', 'wp_related_posts'); ?></h2>
@@ -504,6 +531,18 @@ jQuery(function($) {
504
  <input name="wp_rp_max_related_posts" type="number" step="1" id="wp_rp_max_related_posts" class="small-text" min="1" value="<?php esc_attr_e($options['max_related_posts']); ?>" />
505
  </td>
506
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
507
  </table>
508
 
509
  <h3>Theme Settings</h3>
@@ -685,11 +724,11 @@ jQuery(function($) {
685
  </table>
686
  <p class="submit"><input type="submit" value="<?php _e('Save changes', 'wp_related_posts'); ?>" class="button-primary" /></p>
687
 
688
- </form>
689
- <div>
690
- * Provided via <a target="_blank" href="http://related-posts.com/tos/">3rd party service</a>.
691
  </div>
692
  </div>
693
- </div>
 
 
 
694
  </div>
695
  <?php }
130
  }
131
 
132
  function wp_rp_settings_scripts() {
133
+ wp_enqueue_script('wp_rp_themes_script', plugins_url('static/js/themes.js', __FILE__), array('jquery'), WP_RP_VERSION);
134
+ wp_enqueue_script("wp_rp_dashboard_script", plugins_url('static/js/dashboard.js', __FILE__), array('jquery'), WP_RP_VERSION);
135
  }
136
  function wp_rp_settings_styles() {
137
  wp_enqueue_style("wp_rp_dashaboard_style", plugins_url("static/css/dashboard.css", __FILE__));
138
  }
139
 
140
+ function wp_rp_register_blog($account_type='other') {
141
  $meta = wp_rp_get_meta();
142
 
143
  $req_options = array(
145
  );
146
 
147
  $response = wp_remote_get(WP_RP_CTR_DASHBOARD_URL . 'register/?blog_url=' . get_bloginfo('wpurl') .
148
+ '&account_type=' . $account_type .
149
  ($meta['new_user'] ? '&new' : '') .
150
  ($meta['turn_on_button_pressed'] ? ('&turn_on=' . $meta['turn_on_button_pressed']) : ''),
151
  $req_options);
257
  'promoted_content_enabled' => isset($postdata['wp_rp_promoted_content_enabled']),
258
  'enable_themes' => isset($postdata['wp_rp_enable_themes']),
259
  'custom_theme_enabled' => isset($postdata['wp_rp_custom_theme_enabled']),
260
+ 'traffic_exchange_enabled' => isset($postdata['wp_rp_traffic_exchange_enabled']),
261
+ 'max_related_post_age_in_days' => (isset($postdata['wp_rp_max_related_post_age_in_days']) && is_numeric(trim($postdata['wp_rp_max_related_post_age_in_days']))) ? intval(trim($postdata['wp_rp_max_related_post_age_in_days'])) : 0
262
  );
263
 
264
  if(!isset($postdata['wp_rp_exclude_categories'])) {
330
  }
331
 
332
  if($options['ctr_dashboard_enabled'] && (!$meta['blog_id'] || !$meta['auth_key'])) {
333
+ $account_type = isset($postdata['wp_rp_account_type']) ? $postdata['wp_rp_account_type'] : 'other';
334
+ wp_rp_register_blog($account_type);
335
  }
336
 
337
  ?>
367
  <div class="support">
368
  <h4><?php _e("Awesome support", 'wp_related_posts'); ?></h4>
369
  <p>
370
+ <?php _e("If you have any questions please contact us at",'wp_related_posts');?> <a target="_blank" href="mailto:support+wprp@zemanta.com"><?php _e("support", 'wp_related_posts');?></a>.
371
  </p>
372
  </div>
373
+ <h2 class="title"><?php _e("Related Posts by ",'wp_related_posts');?><a href="http://www.zemanta.com">Zemanta</a></h2>
374
  </div>
 
375
 
376
  <?php wp_rp_print_notifications(); ?>
377
 
378
  <?php if($meta['show_turn_on_button']): ?>
379
  <div id="wp_rp_turn_on_statistics">
380
+ <ul>
381
+ <li>
382
+ <div>
383
+ <ul>
384
+ <li class="title"><h3>Basic</h3></li>
385
+ <li>Related Posts</li>
386
+ <li>Settings</li>
387
+ <li>Analytics</li>
388
+ <li class="turn-on-wrap"><a data-type="basic" href="#" class="zemanta-button turn-on">Turn on</a></li>
389
+ </ul>
390
+ </div>
391
+ </li>
392
+ <li>
393
+ <div>
394
+ <ul>
395
+ <li class="title"><h3>Advanced</h3></li>
396
+ <li>Related Posts</li>
397
+ <li>Settings</li>
398
+ <li>Analytics</li>
399
+ <li>Increase pageviews<br />(traffic exchange)</li>
400
+ <li class="turn-on-wrap"><a data-type="advanced" href="#" class="zemanta-button turn-on">Turn on</a></li>
401
+ </ul>
402
+ </div>
403
+ </li>
404
+ <li>
405
+ <div>
406
+ <ul>
407
+ <li class="title"><h3>Publisher</h3></li>
408
+ <li>Related Posts</li>
409
+ <li>Settings</li>
410
+ <li>Analytics</li>
411
+ <li>Increase pageviews<br />(traffic exchange)</li>
412
+ <li>Earn money<br />(promoted posts)</li>
413
+ <li class="turn-on-wrap"><a data-type="publisher" href="#" class="zemanta-button turn-on">Turn on</a></li>
414
+ </ul>
415
+ </div>
416
+ </li>
417
+ </ul>
418
+ <p>Analytics, traffic exchange and promoted posts are provided via <a target="_blank" href="http://related-posts.com/tos/">3rd party service</a>.</p>
419
  </div>
420
  <?php endif; ?>
421
 
483
  <iframe id="wp_rp_blogger_network_hidden_iframe" name="wp_rp_blogger_network_hidden_iframe" style="display: none"></iframe>
484
  <?php endif; ?>
485
 
486
+ <form method="post" enctype="multipart/form-data" action="" id="wp_rp_settings_form" style="display: <?php echo ($meta['show_turn_on_button'] && !$meta['turn_on_button_pressed'] && !$meta['blog_id'] ? 'none' : 'block'); ?>;">
487
  <?php if ($options['ctr_dashboard_enabled']): ?>
488
  <div id="wp_rp_earnings_holder" style="display:none;">
489
  <h2><?php _e('Earnings', 'wp_related_posts'); ?></h2>
531
  <input name="wp_rp_max_related_posts" type="number" step="1" id="wp_rp_max_related_posts" class="small-text" min="1" value="<?php esc_attr_e($options['max_related_posts']); ?>" />
532
  </td>
533
  </tr>
534
+ <tr valign="top">
535
+ <th scope="row"></th>
536
+ <td><label>
537
+ <?php _e('Only show posts from the last', 'wp_related_posts');?>&nbsp;
538
+ <select name="wp_rp_max_related_post_age_in_days" id="wp_rp_max_related_post_age_in_days">
539
+ <option value="0" <?php selected($options['max_related_post_age_in_days'], 0); ?>>Unlimited</option>
540
+ <option value="30" <?php selected($options['max_related_post_age_in_days'], 30); ?>>1</option>
541
+ <option value="91" <?php selected($options['max_related_post_age_in_days'], 91); ?>>3</option>
542
+ <option value="365" <?php selected($options['max_related_post_age_in_days'], 365); ?>>12</option>
543
+ </select> &nbsp;months.
544
+ </label></td>
545
+ </tr>
546
  </table>
547
 
548
  <h3>Theme Settings</h3>
724
  </table>
725
  <p class="submit"><input type="submit" value="<?php _e('Save changes', 'wp_related_posts'); ?>" class="button-primary" /></p>
726
 
 
 
 
727
  </div>
728
  </div>
729
+ <div id="wp_rp_tos">
730
+ * Provided via <a target="_blank" href="http://related-posts.com/tos/">3rd party service</a>.
731
+ </div>
732
+ </form>
733
  </div>
734
  <?php }
static/css/dashboard.css CHANGED
@@ -73,13 +73,21 @@
73
  #wp_rp_invite_friends_form img.down { display: none; }
74
  #wp_rp_invite_friends_form.up img.down { display: block; }
75
 
76
- #wp_rp_turn_on_statistics {max-width: 600px; margin: 20px 0px; padding: 20px; background: #f7f7f7; border: 1px solid #e1e1e1; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
77
- #wp_rp_turn_on_statistics table {}
78
- #wp_rp_turn_on_statistics h2 { font-weight: bold; }
79
- #wp_rp_turn_on_statistics p { margin: 0px; color: #777; }
80
- #wp_rp_turn_on_statistics a.turn-on { margin-left: 25px; background: #8bc7d1; border: 1px solid #57aab8; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; color: white; padding: 8px 30px; text-shadow: 0px 1px 1px #888; font-weight: bold; font-size: 20px; line-height: 20px; text-decoration: none; text-transform: uppercase; box-shadow: 0px 1px 4px -2px black, 0px 1px 0px #a8d9e0 inset; }
81
- #wp_rp_turn_on_statistics ul {padding-left: 20px; color: #666; margin: 5px 0 0 0; font-size: 13px;}
82
- #wp_rp_turn_on_statistics ul li {list-style-type: disc;}
 
 
 
 
 
 
 
 
83
 
84
  form.wp_rp_message_form { background: #f7f7f7; padding: 20px; margin: 30px 0px; border: 1px solid #e1e1e1; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
85
  form.wp_rp_message_form p {font-size: 14px;}
@@ -116,3 +124,5 @@ form.wp_rp_message_form a.dismiss {float: right;}
116
 
117
  #wp_rp_theme_custom_css_wrap td {margin: 0; padding-top: 0;}
118
  #wp_rp_theme_custom_css_wrap .notice {margin: 0; padding: 0 0 3px 0; color: #666;}
 
 
73
  #wp_rp_invite_friends_form img.down { display: none; }
74
  #wp_rp_invite_friends_form.up img.down { display: block; }
75
 
76
+ #wp_rp_turn_on_statistics {}
77
+ #wp_rp_turn_on_statistics > ul {margin: 0 0 10px 0;}
78
+ #wp_rp_turn_on_statistics > ul > li {display: inline-block; margin-right: 10px; vertical-align: top; text-align: center;}
79
+ #wp_rp_turn_on_statistics > ul > li {text-decoration: none; font-size: 12px;}
80
+ #wp_rp_turn_on_statistics > ul > li > div {width: 175px; height: 290px; padding: 8px 10px 10px 10px; margin: 0 0 10px 0; border-radius: 3px; box-shadow: 0px 0px 5px rgba(100, 100, 100, 0.5);}
81
+ #wp_rp_turn_on_statistics > ul > li > div:hover {box-shadow: 0px 0px 7px rgba(247,145,36,0.75);}
82
+ #wp_rp_turn_on_statistics > ul > li > div > ul {position: relative; border: 1px solid #eee; width: 100%; height: 100%; border-radius: 3px;}
83
+ #wp_rp_turn_on_statistics > ul > li > div > ul > li {text-align: left; color: #777; padding: 6px 15px; line-height: 1.2em;}
84
+ #wp_rp_turn_on_statistics > ul > li > div > ul > li h3 {text-align: center; text-transform: uppercase; font-size: 14px; font-weight: bold; color: #666; margin: 5px 0 0 0; line-height: 1em;}
85
+ #wp_rp_turn_on_statistics > ul > li > div > ul > li.title {border-bottom: 1px solid #eee; margin-bottom: 10px; padding: 10px 0 12px 0;}
86
+ #wp_rp_turn_on_statistics > ul > li > div > ul > li.turn-on-wrap {position: absolute; bottom: 10px; text-align: center; width: 100%; margin: 0; padding: 0;}
87
+
88
+ #wp_rp_turn_on_statistics > ul > li > div .zemanta-button {font-size: 16px;text-shadow: 1px 1px #555;padding: 7px 15px;background-color: #999;-moz-border-radius: 15px;-webkit-border-radius: 15px;border-radius: 15px;border: 1px solid #999;display: inline-block;color: #fff;text-decoration: none;cursor: pointer;}
89
+ #wp_rp_turn_on_statistics > ul > li > div:hover .zemanta-button {font-size: 16px;text-shadow: 1px 1px #a05515;padding: 7px 15px;-moz-box-shadow: inset 0 1px 0 0 #ffaf65;-webkit-box-shadow: inset 0 1px 0 0 #ffaf65;box-shadow: inset 0 1px 0 0 #ffaf65;background: -webkit-gradient(linear,left top,left bottom,color-stop(0.05,#f79124),color-stop(1,#f57b1e));background: -moz-linear-gradient(center top,#f79124 5%,#f57b1e 100%);filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f79124', endColorstr='#f57b1e');background-color: #f79124;-moz-border-radius: 15px;-webkit-border-radius: 15px;border-radius: 15px;border: 1px solid #e77001;display: inline-block;color: #fff;text-decoration: none;cursor: pointer;}
90
+
91
 
92
  form.wp_rp_message_form { background: #f7f7f7; padding: 20px; margin: 30px 0px; border: 1px solid #e1e1e1; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
93
  form.wp_rp_message_form p {font-size: 14px;}
124
 
125
  #wp_rp_theme_custom_css_wrap td {margin: 0; padding-top: 0;}
126
  #wp_rp_theme_custom_css_wrap .notice {margin: 0; padding: 0 0 3px 0; color: #666;}
127
+
128
+ #wp_rp_tos {margin-top: 30px;}
static/js/dashboard.js CHANGED
@@ -1,11 +1,11 @@
1
- (function(a){var d=function(b,d){a.each(d,function(a,d){b=b.replace(RegExp("{{ *"+a+" *}}"),d)});return b};a(function(){var b=a("#wp_rp_earnings_wrap"),i=a("#wp_rp_earnings_holder"),g=a("#wp_rp_statistics_wrap"),j=a("#wp_rp_dashboard_url").val(),h=a("#wp_rp_blog_id").val(),f=a("#wp_rp_auth_key").val();traffic_exchange_enabled=0<a("#wp_rp_show_traffic_exchange_statistics").length;promoted_content_enabled=0<a("#wp_rp_show_promoted_content_statistics").length;update_interval=req_timeout=null;update_interval_sec=
2
- 2E3;update_interval_error_sec=3E4;updating=!1;ul=null;stats={};set_update_interval=function(a){a||(a=update_interval_sec);clearInterval(update_interval);0<a&&(update_interval=setInterval(update_dashboard,a))};display_error=function(e){var k=a("#wp_rp_statistics_wrap");e||k.find(".unavailable").slideDown();set_update_interval(update_interval_error_sec);updating=!1};create_dashboard=function(){ul=a('<ul class="statistics" />');g.find(".unavailable").slideUp();ul.append('<li class="title"><div class="desktop">Desktop</div><div class="mobile">Mobile</div></li>');
3
- ul.append(d('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',{"class":"ctr",title:"click-through rate",range:"last 30 days"}));ul.append(d('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',{"class":"pageviews",title:"page views",range:"last 30 days"}));ul.append(d('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',
4
- {"class":"clicks",title:"clicks",range:"last 30 days"}));g.append(ul);traffic_exchange_enabled&&g.append('<div class="network"><div class="icon"></div><span class="num"></span><h4>Inbound Visitors</h4><div class="description"><p>Number of visitors that came to your site because this plugin promoted your content on other sites.<strong>Wow, a traffic exchange! :)</strong></p></div></div>')};update_dashboard=function(e){updating||(updating=!0,req_timeout=setTimeout(function(){display_error(!e)},2E3),
5
- a.getJSON(j+"pageviews/?callback=?",{blog_id:h,auth_key:f},function(a){var c=a.data;clearTimeout(req_timeout);if(!a||"ok"!==a.status||!a.data)display_error(!e);else{ul||create_dashboard();set_update_interval(a.data.update_interval);stats.mobile_pageviews=Math.max(c.mobile_pageviews,stats.mobile_pageviews||0);stats.mobile_clicks=Math.max(c.mobile_clicks,stats.mobile_clicks||0);a=0<stats.mobile_pageviews&&(100*(stats.mobile_clicks/stats.mobile_pageviews)).toFixed(1)||0;stats.desktop_pageviews=Math.max(c.pageviews-
6
- stats.mobile_pageviews,stats.desktop_pageviews||0);stats.desktop_clicks=Math.max(c.clicks-stats.mobile_clicks,stats.desktop_clicks||0);var d=0<stats.desktop_pageviews&&(100*(stats.desktop_clicks/stats.desktop_pageviews)).toFixed(1)||0;stats.network_in_pageviews=Math.max(c.network_in_pageviews,stats.network_in_pageviews||0);if(promoted_content_enabled&&c.promoted_content_money_earned){stats.promoted_content_money_earned=Math.max(c.promoted_content_money_earned,stats.promoted_content_money_earned||
7
- 0);var l=(stats.promoted_content_money_earned/100).toFixed(2),f=(c.meta.min_payout/100).toFixed(2);b.find(".num").html("$"+l);b.find(".payout").html("$"+f);stats.promoted_content_money_earned>=c.meta.min_payout&&b.find(".claim").hasClass("disabled")&&(b.find(".claim").removeClass("disabled"),b.find(".claim").attr("href","mailto:relatedpostsplugin@gmail.com?subject="+encodeURIComponent("I earned over $50!")+"&body="+encodeURIComponent("I would like to claim my money.\nMy reference code is: "+h+" \nMy PayPal account is:\n")));
8
- i.show()}ul.find(".ctr .num.all").html(d+"%");ul.find(".pageviews .num.all").html(stats.desktop_pageviews);ul.find(".clicks .num.all").html(stats.desktop_clicks);ul.find(".ctr .num.mobile").html(a+"%");ul.find(".pageviews .num.mobile").html(stats.mobile_pageviews);ul.find(".clicks .num.mobile").html(stats.mobile_clicks);g.find(".network .num").html(stats.network_in_pageviews);updating=!1}}))};h&&f&&(update_dashboard(!0),update_interval=setInterval(update_dashboard,2E3));a("#wp_rp_turn_on_statistics a.turn-on").click(function(e){e.preventDefault();
9
- var e=a("#wp_rp_static_base_url").val(),b=!1,c=function(){b||(a("#wp_rp_settings_form").submit(),b=!0)};a("#wp_rp_ctr_dashboard_enabled, #wp_rp_display_thumbnail, #wp_rp_enable_themes, #wp_rp_promoted_content_enabled").prop("checked",!0);a("#wp_rp_settings_form").append('<input type="hidden" value="statistics+thumbnails+promoted" name="wp_rp_turn_on_button_pressed" id="wp_rp_turn_on_button_pressed">');a("<img />").load(c).error(c).attr("src",e+"stats.gif?action=turn_on_button&ads=1&nc="+(new Date).getTime());
10
- setTimeout(c,1E3)});a(".wp_rp_notification .close").on("click",function(b){a.ajax({url:a(this).attr("href"),data:{noredirect:!0}});a(this).parent().slideUp(function(){a(this).remove()});b.preventDefault()});a("#wp_rp_wrap .collapsible .collapse-handle").on("click",function(b){var d=a(this).closest(".collapsible"),c=d.find(".container"),g=d.hasClass("collapsed"),f=d.attr("block");g?(c.slideDown(),a.post(ajaxurl,{action:"rp_show_hide_"+f,show:!0})):(c.slideUp(),a.post(ajaxurl,{action:"rp_show_hide_"+
11
- f,hide:!0}));d.toggleClass("collapsed");b.preventDefault()})})})(jQuery);
1
+ (function(a){var e=function(b,e){a.each(e,function(a,e){b=b.replace(RegExp("{{ *"+a+" *}}"),e)});return b};a(function(){var b=a("#wp_rp_earnings_wrap"),i=a("#wp_rp_earnings_holder"),f=a("#wp_rp_statistics_wrap"),j=a("#wp_rp_dashboard_url").val(),h=a("#wp_rp_blog_id").val(),g=a("#wp_rp_auth_key").val();traffic_exchange_enabled=0<a("#wp_rp_show_traffic_exchange_statistics").length;promoted_content_enabled=0<a("#wp_rp_show_promoted_content_statistics").length;update_interval=req_timeout=null;update_interval_sec=
2
+ 2E3;update_interval_error_sec=3E4;updating=!1;ul=null;stats={};set_update_interval=function(a){a||(a=update_interval_sec);clearInterval(update_interval);0<a&&(update_interval=setInterval(update_dashboard,a))};display_error=function(c){var k=a("#wp_rp_statistics_wrap");c||k.find(".unavailable").slideDown();set_update_interval(update_interval_error_sec);updating=!1};create_dashboard=function(){ul=a('<ul class="statistics" />');f.find(".unavailable").slideUp();ul.append('<li class="title"><div class="desktop">Desktop</div><div class="mobile">Mobile</div></li>');
3
+ ul.append(e('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',{"class":"ctr",title:"click-through rate",range:"last 30 days"}));ul.append(e('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',{"class":"pageviews",title:"page views",range:"last 30 days"}));ul.append(e('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',
4
+ {"class":"clicks",title:"clicks",range:"last 30 days"}));f.append(ul);traffic_exchange_enabled&&f.append('<div class="network"><div class="icon"></div><span class="num"></span><h4>Inbound Visitors</h4><div class="description"><p>Number of visitors that came to your site because this plugin promoted your content on other sites.<strong>Wow, a traffic exchange! :)</strong></p></div></div>')};update_dashboard=function(c){updating||(updating=!0,req_timeout=setTimeout(function(){display_error(!c)},2E3),
5
+ a.getJSON(j+"pageviews/?callback=?",{blog_id:h,auth_key:g},function(a){var d=a.data;clearTimeout(req_timeout);if(!a||"ok"!==a.status||!a.data)display_error(!c);else{ul||create_dashboard();set_update_interval(a.data.update_interval);stats.mobile_pageviews=Math.max(d.mobile_pageviews,stats.mobile_pageviews||0);stats.mobile_clicks=Math.max(d.mobile_clicks,stats.mobile_clicks||0);a=0<stats.mobile_pageviews&&(100*(stats.mobile_clicks/stats.mobile_pageviews)).toFixed(1)||0;stats.desktop_pageviews=Math.max(d.pageviews-
6
+ stats.mobile_pageviews,stats.desktop_pageviews||0);stats.desktop_clicks=Math.max(d.clicks-stats.mobile_clicks,stats.desktop_clicks||0);var e=0<stats.desktop_pageviews&&(100*(stats.desktop_clicks/stats.desktop_pageviews)).toFixed(1)||0;stats.network_in_pageviews=Math.max(d.network_in_pageviews,stats.network_in_pageviews||0);if(promoted_content_enabled&&d.promoted_content_money_earned){stats.promoted_content_money_earned=Math.max(d.promoted_content_money_earned,stats.promoted_content_money_earned||
7
+ 0);var l=(stats.promoted_content_money_earned/100).toFixed(2),g=(d.meta.min_payout/100).toFixed(2);b.find(".num").html("$"+l);b.find(".payout").html("$"+g);stats.promoted_content_money_earned>=d.meta.min_payout&&b.find(".claim").hasClass("disabled")&&(b.find(".claim").removeClass("disabled"),b.find(".claim").attr("href","mailto:support+claim@gmail.com?subject="+encodeURIComponent("I earned over $50!")+"&body="+encodeURIComponent("I would like to claim my money.\nMy reference code is: "+h+" \nMy PayPal account is:\n")));
8
+ i.show()}ul.find(".ctr .num.all").html(e+"%");ul.find(".pageviews .num.all").html(stats.desktop_pageviews);ul.find(".clicks .num.all").html(stats.desktop_clicks);ul.find(".ctr .num.mobile").html(a+"%");ul.find(".pageviews .num.mobile").html(stats.mobile_pageviews);ul.find(".clicks .num.mobile").html(stats.mobile_clicks);f.find(".network .num").html(stats.network_in_pageviews);updating=!1}}))};h&&g&&(update_dashboard(!0),update_interval=setInterval(update_dashboard,2E3));a("#wp_rp_turn_on_statistics a.turn-on").click(function(c){c.preventDefault();
9
+ a("#wp_rp_static_base_url").val();c=a(this).data("type");a("#wp_rp_ctr_dashboard_enabled, #wp_rp_display_thumbnail, #wp_rp_enable_themes, #wp_rp_promoted_content_enabled").prop("checked",!0);a("#wp_rp_settings_form").append('<input type="hidden" value="statistics+thumbnails+promoted" name="wp_rp_turn_on_button_pressed" id="wp_rp_turn_on_button_pressed">');a("#wp_rp_settings_form").append('<input type="hidden" value="'+c+'" name="wp_rp_account_type" id="wp_rp_account_type">');a("#wp_rp_settings_form").submit()});
10
+ a(".wp_rp_notification .close").on("click",function(c){a.ajax({url:a(this).attr("href"),data:{noredirect:!0}});a(this).parent().slideUp(function(){a(this).remove()});c.preventDefault()});a("#wp_rp_wrap .collapsible .collapse-handle").on("click",function(c){var b=a(this).closest(".collapsible"),d=b.find(".container"),e=b.hasClass("collapsed"),f=b.attr("block");e?(d.slideDown(),a.post(ajaxurl,{action:"rp_show_hide_"+f,show:!0})):(d.slideUp(),a.post(ajaxurl,{action:"rp_show_hide_"+f,hide:!0}));b.toggleClass("collapsed");
11
+ c.preventDefault()})})})(jQuery);
static/js/themes.js CHANGED
@@ -1,4 +1,4 @@
1
  (function(a){a(function(){var e=a("#wp_rp_theme_options_wrap"),h=e.find("#wp_rp_theme_area"),l=a("#wp_rp_static_base_url").val(),m=a("#wp_rp_json_url").val(),n=a("#wp_rp_version").val(),p=a("#wp_rp_theme_selected").val(),i=null,j=function(){var a=document.createElement("script"),b=document.getElementsByTagName("body").item(0);a.type="text/javascript";a.src=m+"themes.js?plv="+n;b.appendChild(a)},k=function(){var d=a("#wp_rp_custom_theme_enabled:checked"),b=a("#wp_rp_theme_custom_css_wrap");d.length?
2
  b.show():b.hide()};k();a("#wp_rp_custom_theme_enabled").on("change",function(){k()});window.wp_rp_themes_cb=function(d){if(d&&d.themes&&(i=d.themes)){var b=e.find("div.theme-list"),f=e.find("div.theme-screenshot"),g=function(b){if("plain.css"==b.val())f.html("");else{var b=l+"img/themes/"+b.val().replace(/\.css$/,".jpg"),c=f.find("img");if(c.length){if(c.attr("src")===b)return}else c=a("<img />"),f.html(c);c.attr("src",b)}};b.empty();a.each(i,function(a,c){"custom.css"!=c.location&&b.append('<label class="theme-label"><input '+
3
  (c.location===p?'checked="checked"':"")+' class="theme-option" type="radio" name="wp_rp_theme_name" value="'+c.location+'" /> '+c.name+"</label><br />")});b.on("hover","label.theme-label",function(){g(a("input",this))});b.on("mouseleave",function(){g(b.find("input:checked"))});g(b.find("input:checked"));h.show()}};a("#wp_rp_enable_themes:checked").length&&j();a("#wp_rp_enable_themes").change(function(){a("#wp_rp_enable_themes:checked").length?(j(),a("#wp_rp_theme_custom_css_wrap").css({display:a("#wp_rp_custom_theme_enabled:checked").length?
4
- "table-row":"none"})):(a("#wp_rp_theme_options_wrap div.theme-list").empty(),a("#wp_rp_theme_custom_css_wrap").hide(),h.hide())});(!window.localStorage||!window.localStorage.wp_wp_survey_1)&&a("#wp-rp-survey").show();a("#wp-rp-survey .close, #wp-rp-survey .link").click(function(){a("#wp-rp-survey").fadeOut();window.localStorage&&(window.localStorage.wp_wp_survey_1="close")})})})(jQuery);
1
  (function(a){a(function(){var e=a("#wp_rp_theme_options_wrap"),h=e.find("#wp_rp_theme_area"),l=a("#wp_rp_static_base_url").val(),m=a("#wp_rp_json_url").val(),n=a("#wp_rp_version").val(),p=a("#wp_rp_theme_selected").val(),i=null,j=function(){var a=document.createElement("script"),b=document.getElementsByTagName("body").item(0);a.type="text/javascript";a.src=m+"themes.js?plv="+n;b.appendChild(a)},k=function(){var d=a("#wp_rp_custom_theme_enabled:checked"),b=a("#wp_rp_theme_custom_css_wrap");d.length?
2
  b.show():b.hide()};k();a("#wp_rp_custom_theme_enabled").on("change",function(){k()});window.wp_rp_themes_cb=function(d){if(d&&d.themes&&(i=d.themes)){var b=e.find("div.theme-list"),f=e.find("div.theme-screenshot"),g=function(b){if("plain.css"==b.val())f.html("");else{var b=l+"img/themes/"+b.val().replace(/\.css$/,".jpg"),c=f.find("img");if(c.length){if(c.attr("src")===b)return}else c=a("<img />"),f.html(c);c.attr("src",b)}};b.empty();a.each(i,function(a,c){"custom.css"!=c.location&&b.append('<label class="theme-label"><input '+
3
  (c.location===p?'checked="checked"':"")+' class="theme-option" type="radio" name="wp_rp_theme_name" value="'+c.location+'" /> '+c.name+"</label><br />")});b.on("hover","label.theme-label",function(){g(a("input",this))});b.on("mouseleave",function(){g(b.find("input:checked"))});g(b.find("input:checked"));h.show()}};a("#wp_rp_enable_themes:checked").length&&j();a("#wp_rp_enable_themes").change(function(){a("#wp_rp_enable_themes:checked").length?(j(),a("#wp_rp_theme_custom_css_wrap").css({display:a("#wp_rp_custom_theme_enabled:checked").length?
4
+ "table-row":"none"})):(a("#wp_rp_theme_options_wrap div.theme-list").empty(),a("#wp_rp_theme_custom_css_wrap").hide(),h.hide())})})})(jQuery);
static/settings.js.php CHANGED
@@ -13,10 +13,6 @@
13
  var wp_rp_thumbnail_span = document.getElementById('wp_rp_thumbnail_span');
14
  if(wp_rp_display_thumbnail.checked){
15
  wp_rp_thumbnail_span.style.display = '';
16
- jQuery('#wp-rp-thumbnails-info').fadeOut();
17
- if (window.localStorage) {
18
- window.localStorage.wp_rp_thumbnails_info = "close";
19
- }
20
  } else {
21
  wp_rp_thumbnail_span.style.display = 'none';
22
  }
13
  var wp_rp_thumbnail_span = document.getElementById('wp_rp_thumbnail_span');
14
  if(wp_rp_display_thumbnail.checked){
15
  wp_rp_thumbnail_span.style.display = '';
 
 
 
 
16
  } else {
17
  wp_rp_thumbnail_span.style.display = 'none';
18
  }
thumbnailer.php CHANGED
@@ -13,8 +13,8 @@ function wp_rp_upload_default_thumbnail_file() {
13
  } else if(isset($upload['file'])) {
14
  $upload_dir = wp_upload_dir();
15
 
16
- if (class_exists('WP_Image_Editor')) { // WP 3.5+
17
- $image = WP_Image_Editor::get_instance($upload['file']);
18
 
19
  $suffix = WP_RP_THUMBNAILS_WIDTH . 'x' . WP_RP_THUMBNAILS_HEIGHT;
20
  $resized_img_path = $image->generate_filename($suffix, $upload_dir['path'], 'jpg');
@@ -123,8 +123,8 @@ function wp_rp_actually_extract_images_from_post_html($post) {
123
  continue;
124
  }
125
 
126
- if (class_exists('WP_Image_Editor')) { // WP 3.5+
127
- $image = WP_Image_Editor::get_instance($img_path);
128
 
129
  $suffix = WP_RP_THUMBNAILS_WIDTH . 'x' . WP_RP_THUMBNAILS_HEIGHT;
130
  $resized_img_path = $image->generate_filename($suffix, $upload_dir['path'], 'jpg');
13
  } else if(isset($upload['file'])) {
14
  $upload_dir = wp_upload_dir();
15
 
16
+ if (function_exists('wp_get_image_editor')) { // WP 3.5+
17
+ $image = wp_get_image_editor($upload['file']);
18
 
19
  $suffix = WP_RP_THUMBNAILS_WIDTH . 'x' . WP_RP_THUMBNAILS_HEIGHT;
20
  $resized_img_path = $image->generate_filename($suffix, $upload_dir['path'], 'jpg');
123
  continue;
124
  }
125
 
126
+ if (function_exists('wp_get_image_editor')) { // WP 3.5+
127
+ $image = wp_get_image_editor($img_path);
128
 
129
  $suffix = WP_RP_THUMBNAILS_WIDTH . 'x' . WP_RP_THUMBNAILS_HEIGHT;
130
  $resized_img_path = $image->generate_filename($suffix, $upload_dir['path'], 'jpg');
wp_related_posts.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
- Version: 2.3
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.
7
- Author: Jure Ham
8
- Author URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
9
  */
10
 
11
- define('WP_RP_VERSION', '2.3');
12
 
13
  include_once(dirname(__FILE__) . '/config.php');
14
  include_once(dirname(__FILE__) . '/lib/stemmer.php');
@@ -51,12 +51,13 @@ function wp_rp_add_related_posts_hook($content) {
51
  if (!isset($wp_rp_output[$post->ID])) {
52
  $wp_rp_output[$post->ID] = wp_rp_get_related_posts();
53
  }
 
54
  $content = $content . $wp_rp_output[$post->ID];
55
  }
56
 
57
  return $content;
58
  }
59
- add_filter('the_content', 'wp_rp_add_related_posts_hook', 99);
60
 
61
  function wp_rp_append_posts(&$related_posts, $fetch_function_name) {
62
  $options = wp_rp_get_options();
@@ -151,10 +152,6 @@ function wp_rp_should_exclude() {
151
  return true;
152
  }
153
 
154
- if ($post->post_type !== 'post') {
155
- return true;
156
- }
157
-
158
  $options = wp_rp_get_options();
159
 
160
  if(!$options['exclude_categories']) { return false; }
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
+ Version: 2.4
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.
7
+ Author: Zemanta Ltd.
8
+ Author URI: http://www.zemanta.com
9
  */
10
 
11
+ define('WP_RP_VERSION', '2.4');
12
 
13
  include_once(dirname(__FILE__) . '/config.php');
14
  include_once(dirname(__FILE__) . '/lib/stemmer.php');
51
  if (!isset($wp_rp_output[$post->ID])) {
52
  $wp_rp_output[$post->ID] = wp_rp_get_related_posts();
53
  }
54
+ $content = str_replace('%RELATEDPOSTS%', '', $content); // used for gp
55
  $content = $content . $wp_rp_output[$post->ID];
56
  }
57
 
58
  return $content;
59
  }
60
+ add_filter('the_content', 'wp_rp_add_related_posts_hook', 101);
61
 
62
  function wp_rp_append_posts(&$related_posts, $fetch_function_name) {
63
  $options = wp_rp_get_options();
152
  return true;
153
  }
154
 
 
 
 
 
155
  $options = wp_rp_get_options();
156
 
157
  if(!$options['exclude_categories']) { return false; }