Version Description
Download this release
Release Info
Developer | mitchoyoshitaka |
Plugin | Yet Another Related Posts Plugin (YARPP) |
Version | 3.1.4b3 |
Comparing to | |
See all releases |
Code changes from version 3.1.4b2 to 3.1.4b3
- includes.php +43 -17
- magic.php +2 -0
- readme.txt +1 -0
- template-widget.php +14 -0
- yarpp.php +3 -3
includes.php
CHANGED
@@ -218,26 +218,54 @@ function yarpp_options_page() {
|
|
218 |
require(YARPP_DIR.'/options.php');
|
219 |
}
|
220 |
|
221 |
-
// This function was written by @tyok
|
222 |
function widget_yarpp_init() {
|
|
|
|
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
|
|
|
241 |
function yarpp_default($content) {
|
242 |
global $wpdb, $post;
|
243 |
if (is_feed())
|
@@ -421,5 +449,3 @@ function yarpp_metabox() {
|
|
421 |
echo "<p>Related entries may be displayed once you save your entry.</p>";
|
422 |
echo '</div>';
|
423 |
}
|
424 |
-
|
425 |
-
?>
|
218 |
require(YARPP_DIR.'/options.php');
|
219 |
}
|
220 |
|
|
|
221 |
function widget_yarpp_init() {
|
222 |
+
register_widget('YARPP_Widget');
|
223 |
+
}
|
224 |
|
225 |
+
// vaguely based on code by MK Safi
|
226 |
+
// http://msafi.com/fix-yet-another-related-posts-plugin-yarpp-widget-and-add-it-to-the-sidebar/
|
227 |
+
class YARPP_Widget extends WP_Widget {
|
228 |
+
function YARPP_Widget() {
|
229 |
+
parent::WP_Widget(false, $name = __('Related Posts (YARPP)','yarpp'));
|
230 |
+
}
|
231 |
+
|
232 |
+
function widget($args, $instance) {
|
233 |
+
if (!is_single())
|
234 |
+
return;
|
235 |
+
|
236 |
+
extract($args);
|
237 |
+
$title = apply_filters('widget_title', $instance['title']);
|
238 |
+
echo $before_widget;
|
239 |
+
echo $before_title;
|
240 |
+
if ($title)
|
241 |
+
echo $title;
|
242 |
+
else
|
243 |
+
_e('Related Posts (YARPP)','yarpp');
|
244 |
+
echo $after_title;
|
245 |
+
echo yarpp_related(array('post'),$instance,false,false,'widget');
|
246 |
+
echo $after_widget;
|
247 |
+
}
|
248 |
+
|
249 |
+
function update($new_instance, $old_instance) {
|
250 |
+
$instance = array( 'promote_yarpp' => 0);
|
251 |
+
foreach ( $instance as $field => $val ) {
|
252 |
+
if ( isset($new_instance[$field]) )
|
253 |
+
$instance[$field] = 1;
|
254 |
}
|
255 |
+
$instance['title'] = $new_instance['title'];
|
256 |
+
return $instance;
|
257 |
+
}
|
258 |
+
|
259 |
+
function form($instance) {
|
260 |
+
$title = esc_attr($instance['title']);
|
261 |
+
?>
|
262 |
+
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
|
263 |
+
<p><input class="checkbox" id="<?php echo $this->get_field_id('promote_yarpp'); ?>" name="<?php echo $this->get_field_name('promote_yarpp'); ?>" type="checkbox" <?php checked($instance['images'], true) ?> /> <label for="<?php echo $this->get_field_id('promote_yarpp'); ?>"><?php _e("Help promote Yet Another Related Posts Plugin?",'yarpp'); ?></label></p>
|
264 |
+
<?php
|
265 |
+
}
|
266 |
}
|
267 |
|
268 |
+
|
269 |
function yarpp_default($content) {
|
270 |
global $wpdb, $post;
|
271 |
if (is_feed())
|
449 |
echo "<p>Related entries may be displayed once you save your entry.</p>";
|
450 |
echo '</div>';
|
451 |
}
|
|
|
|
magic.php
CHANGED
@@ -309,6 +309,8 @@ function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'w
|
|
309 |
|
310 |
if ($domain == 'metabox') {
|
311 |
include(YARPP_DIR.'/template-metabox.php');
|
|
|
|
|
312 |
} elseif ($use_template and file_exists(STYLESHEETPATH . '/' . $template_file) and $template_file != '') {
|
313 |
ob_start();
|
314 |
include(STYLESHEETPATH . '/' . $template_file);
|
309 |
|
310 |
if ($domain == 'metabox') {
|
311 |
include(YARPP_DIR.'/template-metabox.php');
|
312 |
+
} elseif ($domain == 'widget') {
|
313 |
+
include(YARPP_DIR.'/template-widget.php');
|
314 |
} elseif ($use_template and file_exists(STYLESHEETPATH . '/' . $template_file) and $template_file != '') {
|
315 |
ob_start();
|
316 |
include(STYLESHEETPATH . '/' . $template_file);
|
readme.txt
CHANGED
@@ -151,6 +151,7 @@ If you are a bilingual speaker of English and another language and an avid user
|
|
151 |
== Changelog ==
|
152 |
|
153 |
= 3.1.4 =
|
|
|
154 |
* Localization improvements - descriptions can now be localized
|
155 |
* [Compatibility with PageBar](http://wordpress.org/support/topic/346714) - thanks to Latz for the patch!
|
156 |
= 3.1.3 =
|
151 |
== Changelog ==
|
152 |
|
153 |
= 3.1.4 =
|
154 |
+
* Improved widget code
|
155 |
* Localization improvements - descriptions can now be localized
|
156 |
* [Compatibility with PageBar](http://wordpress.org/support/topic/346714) - thanks to Latz for the patch!
|
157 |
= 3.1.3 =
|
template-widget.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ($related_query->have_posts()) {
|
4 |
+
$output .= '<ol>';
|
5 |
+
while ($related_query->have_posts()) {
|
6 |
+
$related_query->the_post();
|
7 |
+
$output .= '<li><a href="'.get_permalink().'" rel="bookmark">"'.get_the_title().'</a>';
|
8 |
+
// $output .= ' ('.round(get_the_score(),3).')';
|
9 |
+
$output .= '</li>';
|
10 |
+
}
|
11 |
+
$output .= '</ol>';
|
12 |
+
} else {
|
13 |
+
$output .= '<p><em>'.__('No related posts.','yarpp').'</em></p>';
|
14 |
+
}
|
yarpp.php
CHANGED
@@ -3,13 +3,13 @@
|
|
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.1.
|
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
|
10 |
*/
|
11 |
|
12 |
-
define('YARPP_VERSION','3.1.
|
13 |
define('YARPP_DIR',dirname(__FILE__));
|
14 |
|
15 |
require_once(YARPP_DIR.'/includes.php');
|
@@ -38,7 +38,7 @@ add_action('update_option_yarpp_tags','yarpp_clear_cache');
|
|
38 |
load_plugin_textdomain('yarpp', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)).'/lang',dirname(plugin_basename(__FILE__)).'/lang');
|
39 |
|
40 |
// new in 2.0: add as a widget
|
41 |
-
add_action('
|
42 |
// new in 3.0: add meta box
|
43 |
add_action( 'admin_menu', 'yarpp_add_metabox');
|
44 |
|
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.1.4b3
|
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
|
10 |
*/
|
11 |
|
12 |
+
define('YARPP_VERSION','3.1.4b3');
|
13 |
define('YARPP_DIR',dirname(__FILE__));
|
14 |
|
15 |
require_once(YARPP_DIR.'/includes.php');
|
38 |
load_plugin_textdomain('yarpp', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)).'/lang',dirname(plugin_basename(__FILE__)).'/lang');
|
39 |
|
40 |
// new in 2.0: add as a widget
|
41 |
+
add_action('widgets_init', 'widget_yarpp_init');
|
42 |
// new in 3.0: add meta box
|
43 |
add_action( 'admin_menu', 'yarpp_add_metabox');
|
44 |
|