Version Description
Download this release
Release Info
Developer | mitchoyoshitaka |
Plugin | Yet Another Related Posts Plugin (YARPP) |
Version | 3.2.1b1 |
Comparing to | |
See all releases |
Code changes from version 3.2 to 3.2.1b1
- includes.php +10 -6
- magic.php +10 -1
- options.php +10 -5
- readme.txt +5 -0
- yarpp.php +6 -2
includes.php
CHANGED
@@ -203,7 +203,7 @@ class YARPP_Widget extends WP_Widget {
|
|
203 |
|
204 |
function widget($args, $instance) {
|
205 |
global $post;
|
206 |
-
if (!
|
207 |
return;
|
208 |
|
209 |
extract($args);
|
@@ -222,7 +222,6 @@ class YARPP_Widget extends WP_Widget {
|
|
222 |
_e('Related Posts (YARPP)','yarpp');
|
223 |
echo $after_title;
|
224 |
}
|
225 |
-
// var_dump($instance);
|
226 |
echo yarpp_related($type,$instance,false,false,'widget');
|
227 |
echo $after_widget;
|
228 |
}
|
@@ -461,11 +460,16 @@ function yarpp_microtime_float() {
|
|
461 |
return ((float)$usec + (float)$sec);
|
462 |
}
|
463 |
|
464 |
-
function
|
|
|
|
|
465 |
$remote = wp_remote_post("http://mitcho.com/code/yarpp/checkversion.php?version=$version");
|
466 |
-
if (is_wp_error($remote))
|
467 |
-
|
468 |
-
|
|
|
|
|
|
|
469 |
}
|
470 |
|
471 |
function yarpp_add_metabox() {
|
203 |
|
204 |
function widget($args, $instance) {
|
205 |
global $post;
|
206 |
+
if (!is_singular())
|
207 |
return;
|
208 |
|
209 |
extract($args);
|
222 |
_e('Related Posts (YARPP)','yarpp');
|
223 |
echo $after_title;
|
224 |
}
|
|
|
225 |
echo yarpp_related($type,$instance,false,false,'widget');
|
226 |
echo $after_widget;
|
227 |
}
|
460 |
return ((float)$usec + (float)$sec);
|
461 |
}
|
462 |
|
463 |
+
function yarpp_version_json() {
|
464 |
+
check_ajax_referer('yarpp_version_json');
|
465 |
+
$version = YARPP_VERSION;
|
466 |
$remote = wp_remote_post("http://mitcho.com/code/yarpp/checkversion.php?version=$version");
|
467 |
+
if (is_wp_error($remote)) {
|
468 |
+
echo '{}';
|
469 |
+
exit;
|
470 |
+
}
|
471 |
+
echo $remote['body'];
|
472 |
+
exit;
|
473 |
}
|
474 |
|
475 |
function yarpp_add_metabox() {
|
magic.php
CHANGED
@@ -301,7 +301,7 @@ function yarpp_related_exist($type,$args,$reference_ID=false) {
|
|
301 |
|
302 |
yarpp_cache_enforce($type,$reference_ID);
|
303 |
|
304 |
-
$yarpp_cache->
|
305 |
$related_query = new WP_Query();
|
306 |
$related_query->query(array('p'=>$reference_ID,'showposts'=>10000,'post_type'=>$type));
|
307 |
$return = $related_query->have_posts();
|
@@ -351,6 +351,15 @@ function yarpp_delete_cache($post_ID) {
|
|
351 |
$yarpp_cache->clear($peers);
|
352 |
}
|
353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
function yarpp_cache_enforce($types=array('post'),$reference_ID,$force=false) {
|
355 |
global $yarpp_debug, $yarpp_cache;
|
356 |
|
301 |
|
302 |
yarpp_cache_enforce($type,$reference_ID);
|
303 |
|
304 |
+
$yarpp_cache->begin_yarpp_time($reference_ID); // get ready for YARPP TIME!
|
305 |
$related_query = new WP_Query();
|
306 |
$related_query->query(array('p'=>$reference_ID,'showposts'=>10000,'post_type'=>$type));
|
307 |
$return = $related_query->have_posts();
|
351 |
$yarpp_cache->clear($peers);
|
352 |
}
|
353 |
|
354 |
+
// New in 3.2.1: handle various post_status transitions
|
355 |
+
function yarpp_status_transition($new_status, $old_status, $post) {
|
356 |
+
switch ($new_status) {
|
357 |
+
case "draft":
|
358 |
+
yarpp_delete_cache($post->ID);
|
359 |
+
break;
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
function yarpp_cache_enforce($types=array('post'),$reference_ID,$force=false) {
|
364 |
global $yarpp_debug, $yarpp_cache;
|
365 |
|
options.php
CHANGED
@@ -402,11 +402,16 @@ function load_display_discats() {
|
|
402 |
|
403 |
var version = jQuery('#yarpp-version').html();
|
404 |
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
|
|
|
|
|
|
|
|
|
|
410 |
}
|
411 |
|
412 |
jQuery(document).ready(yarpp_js_init);
|
402 |
|
403 |
var version = jQuery('#yarpp-version').html();
|
404 |
|
405 |
+
<?php $ajax_nonce= wp_create_nonce('yarpp_version_json');?>
|
406 |
+
jQuery.getJSON(ajaxurl,
|
407 |
+
'action=yarpp_version_json&_ajax_nonce=<?php echo $ajax_nonce; ?>',
|
408 |
+
function(json) {
|
409 |
+
if (json.result == 'newbeta')
|
410 |
+
jQuery('#yarpp-version').addClass('updated').html(<?php echo "'<p>".str_replace('VERSION',"'+json.beta.version+'",str_replace('<A>',"<a href=\"'+json.beta.url+'\">",addslashes(__("There is a new beta (VERSION) of Yet Another Related Posts Plugin. You can <A>download it here</a> at your own risk.","yarpp"))))."</p>'"?>).show();
|
411 |
+
if (json.result == 'new')
|
412 |
+
jQuery('#yarpp-version').addClass('updated').html(<?php echo "'<p>".str_replace('VERSION',"'+json.current.version+'",str_replace('<A>',"<a href=\"'+json.current.url+'\">",addslashes(__("There is a new version (VERSION) of Yet Another Related Posts Plugin available! You can <A>download it here</a>.","yarpp"))))."</p>'"?>).show();
|
413 |
+
}
|
414 |
+
);
|
415 |
}
|
416 |
|
417 |
jQuery(document).ready(yarpp_js_init);
|
readme.txt
CHANGED
@@ -185,6 +185,11 @@ If you are a bilingual speaker of English and another language and an avid user
|
|
185 |
|
186 |
== Changelog ==
|
187 |
|
|
|
|
|
|
|
|
|
|
|
188 |
= 3.2 =
|
189 |
* Better caching performance:
|
190 |
* Previously, the cache would never actually build up properly. This is now fixed. Thanks to Artefact for pointing this out.
|
185 |
|
186 |
== Changelog ==
|
187 |
|
188 |
+
= 3.2.1 =
|
189 |
+
* Fixed [a bug in `yarpp_related_exists()`](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-fatal-error-call-to-undefined-method-yarpp_cache_tablesstart_yarpp_time)
|
190 |
+
* Better handling of [`post_status` transitions](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-changed-post-to-draft-still-showing-up-as-related-to-other-posts).
|
191 |
+
* Bugfix: [the widget was not working on pages](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-showing-yarp-widget-in-pages-and-subpages)
|
192 |
+
* Minor security fix in version-checking code
|
193 |
= 3.2 =
|
194 |
* Better caching performance:
|
195 |
* Previously, the cache would never actually build up properly. This is now fixed. Thanks to Artefact for pointing this out.
|
yarpp.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Yet Another Related Posts Plugin
|
4 |
Plugin URI: http://mitcho.com/code/yarpp/
|
5 |
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
|
6 |
-
Version: 3.2
|
7 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
8 |
Author URI: http://mitcho.com/
|
9 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&charset=UTF%2d8
|
@@ -13,8 +13,10 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4D
|
|
13 |
if (isset($_REQUEST['yarpp_debug']))
|
14 |
$yarpp_debug = true;
|
15 |
|
16 |
-
define('YARPP_VERSION','3.2');
|
17 |
define('YARPP_DIR',dirname(__FILE__));
|
|
|
|
|
18 |
|
19 |
require_once(YARPP_DIR.'/includes.php');
|
20 |
require_once(YARPP_DIR.'/related-functions.php');
|
@@ -50,6 +52,8 @@ add_action('save_post','yarpp_save_cache');
|
|
50 |
|
51 |
// new in 3.2: update cache on delete
|
52 |
add_action('delete_post','yarpp_delete_cache');
|
|
|
|
|
53 |
|
54 |
// sets the score override flag.
|
55 |
add_action('parse_query','yarpp_set_score_override_flag');
|
3 |
Plugin Name: Yet Another Related Posts Plugin
|
4 |
Plugin URI: http://mitcho.com/code/yarpp/
|
5 |
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
|
6 |
+
Version: 3.2.1b1
|
7 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
8 |
Author URI: http://mitcho.com/
|
9 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&charset=UTF%2d8
|
13 |
if (isset($_REQUEST['yarpp_debug']))
|
14 |
$yarpp_debug = true;
|
15 |
|
16 |
+
define('YARPP_VERSION','3.2.1b1');
|
17 |
define('YARPP_DIR',dirname(__FILE__));
|
18 |
+
// 3.2.1: safer new version checking
|
19 |
+
add_action('wp_ajax_yarpp_version_json', 'yarpp_version_json');
|
20 |
|
21 |
require_once(YARPP_DIR.'/includes.php');
|
22 |
require_once(YARPP_DIR.'/related-functions.php');
|
52 |
|
53 |
// new in 3.2: update cache on delete
|
54 |
add_action('delete_post','yarpp_delete_cache');
|
55 |
+
// new in 3.2.1: handle post_status transitions
|
56 |
+
add_action('transition_post_status','yarpp_status_transition', 3);
|
57 |
|
58 |
// sets the score override flag.
|
59 |
add_action('parse_query','yarpp_set_score_override_flag');
|