Yet Another Related Posts Plugin (YARPP) - Version 3.4b8

Version Description

Download this release

Release Info

Developer mitchoyoshitaka
Plugin Icon 128x128 Yet Another Related Posts Plugin (YARPP)
Version 3.4b8
Comparing to
See all releases

Code changes from version 3.4b7 to 3.4b8

Files changed (12) hide show
  1. cache-postmeta.php +1 -1
  2. cache-tables.php +1 -1
  3. class-cache.php +110 -2
  4. class-core.php +223 -11
  5. includes.php +4 -82
  6. lang/yarpp-ja.mo +0 -0
  7. lang/yarpp-ja_JP.po +142 -187
  8. magic.php +0 -108
  9. options-meta-boxes.php +52 -85
  10. options.php +13 -16
  11. readme.txt +10 -12
  12. yarpp.php +2 -2
cache-postmeta.php CHANGED
@@ -175,7 +175,7 @@ class YARPP_Cache_Postmeta {
175
return YARPP_NOT_CACHED;
176
177
$original_related = $this->related($reference_ID);
178
- $related = $wpdb->get_results(yarpp_sql($reference_ID), ARRAY_A);
179
$new_related = array_map(create_function('$x','return $x["ID"];'), $related);
180
181
if ( count($new_related) ) {
175
return YARPP_NOT_CACHED;
176
177
$original_related = $this->related($reference_ID);
178
+ $related = $wpdb->get_results($this->sql($reference_ID), ARRAY_A);
179
$new_related = array_map(create_function('$x','return $x["ID"];'), $related);
180
181
if ( count($new_related) ) {
cache-tables.php CHANGED
@@ -203,7 +203,7 @@ class YARPP_Cache_Tables extends YARPP_Cache {
203
// clear out the cruft
204
$this->clear($reference_ID);
205
206
- $wpdb->query("insert into {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " (reference_ID,ID,score) ".yarpp_sql($reference_ID)." on duplicate key update date = now()");
207
208
// If there were related entries saved...
209
if ( $wpdb->rows_affected ) {
203
// clear out the cruft
204
$this->clear($reference_ID);
205
206
+ $wpdb->query("insert into {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " (reference_ID,ID,score) " . $this->sql($reference_ID) . " on duplicate key update date = now()");
207
208
// If there were related entries saved...
209
if ( $wpdb->rows_affected ) {
class-cache.php CHANGED
@@ -5,6 +5,7 @@ abstract class YARPP_Cache {
5
public $core;
6
public $score_override = false;
7
public $online_limit = false;
8
9
function __construct( &$core ) {
10
$this->core = &$core;
@@ -13,7 +14,7 @@ abstract class YARPP_Cache {
13
14
// Note: return value changed in 3.4
15
// return YARPP_NO_RELATED | YARPP_RELATED | YARPP_DONT_RUN | false if no good input
16
- function enforce($reference_ID, $force = false) {
17
if ( !$reference_ID = absint($reference_ID) )
18
return false;
19
@@ -101,6 +102,111 @@ abstract class YARPP_Cache {
101
}
102
}
103
104
/*
105
* KEYWORDS
106
*/
@@ -207,13 +313,15 @@ abstract class YARPP_Cache {
207
static $blacklist, $blackmethods;
208
209
if ( is_null($blacklist) || is_null($blackmethods) ) {
210
- $yarpp_blacklist = array('yarpp_default', 'diggZEt_AddBut', 'reddZEt_AddBut', 'dzoneZEt_AddBut', 'wp_syntax_before_filter', 'wp_syntax_after_filter', 'wp_codebox_before_filter', 'wp_codebox_after_filter', 'do_shortcode');//,'insert_tweet_this'
211
$yarpp_blackmethods = array('addinlinejs', 'replacebbcode', 'filter_content');
212
213
$blacklist = (array) apply_filters( 'yarpp_blacklist', $yarpp_blacklist );
214
$blackmethods = (array) apply_filters( 'yarpp_blackmethods', $yarpp_blackmethods );
215
}
216
217
if ( is_array($filter) && in_array( $filter[1], $blackmethods ) )
218
return false;
219
return !in_array( $filter, $blacklist );
5
public $core;
6
public $score_override = false;
7
public $online_limit = false;
8
+ public $last_sql;
9
10
function __construct( &$core ) {
11
$this->core = &$core;
14
15
// Note: return value changed in 3.4
16
// return YARPP_NO_RELATED | YARPP_RELATED | YARPP_DONT_RUN | false if no good input
17
+ function enforce( $reference_ID, $force = false ) {
18
if ( !$reference_ID = absint($reference_ID) )
19
return false;
20
102
}
103
}
104
105
+ /*
106
+ * SQL!
107
+ */
108
+
109
+ function sql( $reference_ID = false ) {
110
+ global $wpdb, $post;
111
+
112
+ if ( is_object($post) && !$reference_ID ) {
113
+ $reference_ID = $post->ID;
114
+ }
115
+
116
+ if ( !is_object($post) || $reference_ID != $post->ID ) {
117
+ $reference_post = get_post( $reference_ID );
118
+ } else {
119
+ $reference_post = $post;
120
+ }
121
+
122
+ $options = array( 'threshold', 'show_pass_post', 'past_only', 'weight', 'exclude', 'recent_only', 'recent_number', 'recent_units' );
123
+ // mask it so we only get the ones specified in $options
124
+ $optvals = array_intersect_key($this->core->get_option(), array_flip($options));
125
+ extract($optvals);
126
+
127
+ // Fetch keywords
128
+ $keywords = $this->get_keywords($reference_ID);
129
+
130
+ // SELECT
131
+ $newsql = "SELECT $reference_ID as reference_ID, ID, "; //post_title, post_date, post_content, post_excerpt,
132
+
133
+ $newsql .= 'ROUND(0';
134
+
135
+ if ($weight['body'] != 1)
136
+ $newsql .= " + (MATCH (post_content) AGAINST ('".$wpdb->escape($keywords['body'])."')) * ". ($weight['body'] == 3 ? 3 : 1);
137
+ if ($weight['title'] != 1)
138
+ $newsql .= " + (MATCH (post_title) AGAINST ('".$wpdb->escape($keywords['title'])."')) * ". ($weight['title'] == 3 ? 3 : 1);
139
+
140
+ // Build tax criteria query parts based on the weights
141
+ $tax_criteria = array();
142
+ foreach ( $weight['tax'] as $tax => $value ) {
143
+ // 1 means don't consider:
144
+ if ($value == 1)
145
+ continue;
146
+ $tax_criteria[$tax] = "count(distinct if( termtax.taxonomy = '$tax', termtax.term_taxonomy_id, null ))";
147
+ $newsql .= " + " . $tax_criteria[$tax];
148
+ }
149
+
150
+ $newsql .= ',1) as score';
151
+
152
+ $newsql .= "\n from $wpdb->posts \n";
153
+
154
+ // Get disallowed categories and tags
155
+ $disterms = wp_parse_id_list(join(',',$exclude));
156
+ $usedisterms = count($disterms);
157
+ if ( $usedisterms || count($tax_criteria) ) {
158
+ $newsql .= "left join $wpdb->term_relationships as terms on ( terms.object_id = wp_posts.ID ) \n"
159
+ . "left join $wpdb->term_taxonomy as termtax on ( terms.term_taxonomy_id = termtax.term_taxonomy_id ) \n"
160
+ . "left join $wpdb->term_relationships as refterms on ( terms.term_taxonomy_id = refterms.term_taxonomy_id and refterms.object_id = $reference_ID ) \n";
161
+ }
162
+
163
+ // WHERE
164
+
165
+ $newsql .= " where post_status in ( 'publish', 'static' ) and ID != '$reference_ID'";
166
+
167
+ if ($past_only) // 3.1.8: revised $past_only option
168
+ $newsql .= " and post_date <= '$reference_post->post_date' ";
169
+ if ( !$show_pass_post )
170
+ $newsql .= " and post_password ='' ";
171
+ if ( $recent_only )
172
+ $newsql .= " and post_date > date_sub(now(), interval $recent_number $recent_units) ";
173
+
174
+ $newsql .= " and post_type = 'post'";
175
+
176
+ // GROUP BY
177
+ $newsql .= "\n group by ID \n";
178
+
179
+ // HAVING
180
+ // number_format fix suggested by vkovalcik! :)
181
+ $safethreshold = number_format(max($threshold,0.1), 2, '.', '');
182
+ $newsql .= " having score >= $safethreshold";
183
+ if ( $usedisterms ) {
184
+ $disterms = implode(',', $disterms);
185
+ $newsql .= " and bit_and(termtax.term_id in ($disterms)) = 0";
186
+ }
187
+
188
+ foreach ( $weight['tax'] as $tax => $value ) {
189
+ if ( $value == 3 )
190
+ $newsql .= ' and '.$tax_criteria[$tax].' >= 1';
191
+ if ( $value == 4 )
192
+ $newsql .= ' and '.$tax_criteria[$tax].' >= 2';
193
+ }
194
+
195
+ // The maximum number of items we'll ever want to cache
196
+ $limit = max($this->core->get_option('limit'), $this->core->get_option('rss_limit'));
197
+ $newsql .= " order by score desc limit $limit";
198
+
199
+ // in caching, we cross-relate regardless of whether we're going to actually
200
+ // use it or not.
201
+ $newsql = "($newsql) union (".str_replace("post_type = 'post'","post_type = 'page'",$newsql).")";
202
+
203
+ if ($this->core->debug) echo "<!--$newsql-->";
204
+
205
+ $this->last_sql = $newsql;
206
+
207
+ return $newsql;
208
+ }
209
+
210
/*
211
* KEYWORDS
212
*/
313
static $blacklist, $blackmethods;
314
315
if ( is_null($blacklist) || is_null($blackmethods) ) {
316
+ $yarpp_blacklist = array('diggZEt_AddBut', 'reddZEt_AddBut', 'dzoneZEt_AddBut', 'wp_syntax_before_filter', 'wp_syntax_after_filter', 'wp_codebox_before_filter', 'wp_codebox_after_filter', 'do_shortcode');//,'insert_tweet_this'
317
$yarpp_blackmethods = array('addinlinejs', 'replacebbcode', 'filter_content');
318
319
$blacklist = (array) apply_filters( 'yarpp_blacklist', $yarpp_blacklist );
320
$blackmethods = (array) apply_filters( 'yarpp_blackmethods', $yarpp_blackmethods );
321
}
322
323
+ if ( is_array($filter) && is_a( $filter[0], 'YARPP' ) )
324
+ return false;
325
if ( is_array($filter) && in_array( $filter[1], $blackmethods ) )
326
return false;
327
return !in_array( $filter, $blacklist );
class-core.php CHANGED
@@ -8,8 +8,19 @@ class YARPP {
8
public $cache;
9
public $admin;
10
private $storage_class;
11
12
function __construct() {
13
// register text domain
14
load_plugin_textdomain( 'yarpp', false, dirname(plugin_basename(__FILE__)) . '/lang' );
15
@@ -51,6 +62,123 @@ class YARPP {
51
add_action( 'wp_ajax_yarpp_display_demo', array( $this, 'ajax_display_demo' ) );
52
}
53
}
54
55
/*
56
* INFRASTRUCTURE
@@ -116,6 +244,8 @@ class YARPP {
116
$this->upgrade_3_4b2();
117
if ( $last_version && version_compare('3.4b5', $last_version) > 0 )
118
$this->upgrade_3_4b5();
119
120
$this->cache->upgrade($last_version);
121
@@ -125,14 +255,65 @@ class YARPP {
125
}
126
127
function upgrade_3_4b2() {
128
- global $wpdb, $yarpp_value_options, $yarpp_binary_options;
129
130
$yarpp_options = array();
131
- foreach ( $yarpp_value_options as $key => $default ) {
132
$value = get_option( "yarpp_$key", null );
133
if ( is_null($value) )
134
continue;
135
-
136
// value options used to be stored with a bajillion slashes...
137
$value = stripslashes(stripslashes($value));
138
// value options used to be stored with a blank space at the end... don't ask.
@@ -143,12 +324,6 @@ class YARPP {
143
else
144
$yarpp_options[$key] = $value;
145
}
146
- foreach ( $yarpp_binary_options as $key => $default ) {
147
- $value = get_option( "yarpp_$key", null );
148
- if ( is_null($value) )
149
- continue;
150
- $yarpp_options[$key] = (boolean) $value;
151
- }
152
153
// add the options directly first, then call set_option which will ensure defaults,
154
// in case any new options have been added.
@@ -177,13 +352,50 @@ class YARPP {
177
update_option( 'yarpp', $options );
178
}
179
180
/*
181
* DEFAULT CONTENT FILTERS
182
*/
183
184
function the_content($content) {
185
global $post;
186
-
187
if (is_feed())
188
return $this->the_content_rss($content);
189
@@ -212,7 +424,7 @@ class YARPP {
212
213
function the_excerpt_rss($content) {
214
global $post;
215
-
216
$type = ($post->post_type == 'page' ? array('page') : array('post'));
217
if ( yarpp_get_option('cross_relate') )
218
$type = array('post','page');
8
public $cache;
9
public $admin;
10
private $storage_class;
11
+
12
+ public $myisam = true;
13
+
14
+ public $templates = array();
15
+
16
+ // here's a list of all the options YARPP uses (except version), as well as their default values, sans the yarpp_ prefix, split up into binary options and value options. These arrays are used in updating settings (options.php) and other tasks.
17
+ public $default_options = array();
18
+ // These are options which, when updated, will trigger a clearing of the cache
19
+ public $clear_cache_options = array( 'show_pass_post', 'recent_only', 'threshold', 'weight');
20
21
function __construct() {
22
+ $this->load_default_options();
23
+
24
// register text domain
25
load_plugin_textdomain( 'yarpp', false, dirname(plugin_basename(__FILE__)) . '/lang' );
26
62
add_action( 'wp_ajax_yarpp_display_demo', array( $this, 'ajax_display_demo' ) );
63
}
64
}
65
+
66
+ /*
67
+ * OPTIONS
68
+ */
69
+
70
+ private function load_default_options() {
71
+ $this->default_options = array(
72
+ 'threshold' => 5,
73
+ 'limit' => 5,
74
+ 'template_file' => '', // new in 2.2
75
+ 'excerpt_length' => 10,
76
+ 'recent_number' => 12,
77
+ 'recent_units' => 'month',
78
+ 'before_title' => '<li>',
79
+ 'after_title' => '</li>',
80
+ 'before_post' => ' <small>',
81
+ 'after_post' => '</small>',
82
+ 'before_related' => '<p>'.__('Related posts:','yarpp').'</p><ol>',
83
+ 'after_related' => '</ol>',
84
+ 'no_results' => '<p>'.__('No related posts.','yarpp').'</p>',
85
+ 'order' => 'score DESC',
86
+ 'rss_limit' => 3,
87
+ 'rss_template_file' => '', // new in 2.2
88
+ 'rss_excerpt_length' => 10,
89
+ 'rss_before_title' => '<li>',
90
+ 'rss_after_title' => '</li>',
91
+ 'rss_before_post' => ' <small>',
92
+ 'rss_after_post' => '</small>',
93
+ 'rss_before_related' => '<p>'.__('Related posts:','yarpp').'</p><ol>',
94
+ 'rss_after_related' => '</ol>',
95
+ 'rss_no_results' => '<p>'.__('No related posts.','yarpp').'</p>',
96
+ 'rss_order' => 'score DESC',
97
+ 'past_only' => true,
98
+ 'show_excerpt' => false,
99
+ 'recent_only' => false, // new in 3.0
100
+ 'use_template' => false, // new in 2.2
101
+ 'rss_show_excerpt' => false,
102
+ 'rss_use_template' => false, // new in 2.2
103
+ 'show_pass_post' => false,
104
+ 'cross_relate' => false,
105
+ 'auto_display' => true,
106
+ 'rss_display' => false, // changed default in 3.1.7
107
+ 'rss_excerpt_display' => true,
108
+ 'promote_yarpp' => false,
109
+ 'rss_promote_yarpp' => false,
110
+ 'myisam_override' => false,
111
+ 'exclude' => array(), // conslidated YARPP 3.4
112
+ 'weight' => array( // consolidated in YARPP 3.4
113
+ 'title' => 2,
114
+ 'body' => 2,
115
+ 'tax' => array(
116
+ 'category' => 2, // changed default in 3.4
117
+ 'post_tag' => 2
118
+ )
119
+ )
120
+ );
121
+ }
122
+
123
+ function set_option( $options, $value = null ) {
124
+ $current_options = $this->get_option();
125
+
126
+ // we can call yarpp_set_option(key,value) if we like:
127
+ if ( !is_array($options) && isset($value) )
128
+ $options = array( $options => $value );
129
+
130
+ $new_options = array_merge( $current_options, $options );
131
+
132
+ // new in 3.1: clear cache when updating certain settings.
133
+ $new_options_which_require_flush = array_intersect( array_keys( array_diff_assoc($options, $current_options) ), $this->clear_cache_options );
134
+ if ( count($new_options_which_require_flush) ||
135
+ ( isset($options['exclude']) && $options['exclude'] != $current_options['exclude'] ) ||
136
+ ( isset($options['weight']) && $options['weight'] != $current_options['weight'] ) )
137
+ $this->cache->flush();
138
+
139
+ update_option( 'yarpp', $new_options );
140
+ }
141
+
142
+ // 3.4b8: $option can be a path, of the query_str variety, i.e. "option[suboption][subsuboption]"
143
+ function get_option( $option = null ) {
144
+ $options = get_option( 'yarpp' );
145
+ // ensure defaults if not set:
146
+ $options = array_merge( $this->default_options, $options );
147
+ // some extra work is required for arrays:
148
+ foreach ( $this->default_options as $key => $default ) {
149
+ if ( !is_array($default) )
150
+ continue;
151
+ $options[$key] = array_merge( $this->default_options[$key], $options[$key] );
152
+ }
153
+ if ( !isset($options['weight']['tax']) )
154
+ $options['weight']['tax'] = $this->default_options['weight']['tax'];
155
+
156
+ if ( is_null( $option ) )
157
+ return $options;
158
+
159
+ $optionpath = array();
160
+ $parsed_option = array();
161
+ wp_parse_str($option, $parsed_option);
162
+ $optionpath = $this->array_flatten($parsed_option);
163
+
164
+ $current = $options;
165
+ foreach ( $optionpath as $optionpart ) {
166
+ if ( !is_array($current) || !isset($current[$optionpart]) )
167
+ return null;
168
+ $current = $current[$optionpart];
169
+ }
170
+ return $current;
171
+ }
172
+
173
+ private function array_flatten($array, $given = array()) {
174
+ foreach ($array as $key => $val) {
175
+ $given[] = $key;
176
+ if ( is_array($val) )
177
+ $given = $this->array_flatten($val, $given);
178
+ }
179
+ return $given;
180
+ }
181
+
182
183
/*
184
* INFRASTRUCTURE
244
$this->upgrade_3_4b2();
245
if ( $last_version && version_compare('3.4b5', $last_version) > 0 )
246
$this->upgrade_3_4b5();
247
+ if ( $last_version && version_compare('3.4b8', $last_version) > 0 )
248
+ $this->upgrade_3_4b8();
249
250
$this->cache->upgrade($last_version);
251
255
}
256
257
function upgrade_3_4b2() {
258
+ global $wpdb;
259
+
260
+ $yarpp_3_3_options = array(
261
+ 'threshold' => 5,
262
+ 'limit' => 5,
263
+ 'template_file' => '', // new in 2.2
264
+ 'excerpt_length' => 10,
265
+ 'recent_number' => 12,
266
+ 'recent_units' => 'month',
267
+ 'before_title' => '<li>',
268
+ 'after_title' => '</li>',
269
+ 'before_post' => ' <small>',
270
+ 'after_post' => '</small>',
271
+ 'before_related' => '<p>'.__('Related posts:','yarpp').'</p><ol>',
272
+ 'after_related' => '</ol>',
273
+ 'no_results' => '<p>'.__('No related posts.','yarpp').'</p>',
274
+ 'order' => 'score DESC',
275
+ 'rss_limit' => 3,
276
+ 'rss_template_file' => '', // new in 2.2
277
+ 'rss_excerpt_length' => 10,
278
+ 'rss_before_title' => '<li>',
279
+ 'rss_after_title' => '</li>',
280
+ 'rss_before_post' => ' <small>',
281
+ 'rss_after_post' => '</small>',
282
+ 'rss_before_related' => '<p>'.__('Related posts:','yarpp').'</p><ol>',
283
+ 'rss_after_related' => '</ol>',
284
+ 'rss_no_results' => '<p>'.__('No related posts.','yarpp').'</p>',
285
+ 'rss_order' => 'score DESC',
286
+ 'title' => '2',
287
+ 'body' => '2',
288
+ 'categories' => '1', // changed default in 3.3
289
+ 'tags' => '2',
290
+ 'distags' => '',
291
+ 'discats' => '',
292
+ 'past_only' => true,
293
+ 'show_excerpt' => false,
294
+ 'recent_only' => false, // new in 3.0
295
+ 'use_template' => false, // new in 2.2
296
+ 'rss_show_excerpt' => false,
297
+ 'rss_use_template' => false, // new in 2.2
298
+ 'show_pass_post' => false,
299
+ 'cross_relate' => false,
300
+ 'auto_display' => true,
301
+ 'rss_display' => false, // changed default in 3.1.7
302
+ 'rss_excerpt_display' => true,
303
+ 'promote_yarpp' => false,
304
+ 'rss_promote_yarpp' => false);
305
306
$yarpp_options = array();
307
+ foreach ( $yarpp_3_3_options as $key => $default ) {
308
$value = get_option( "yarpp_$key", null );
309
if ( is_null($value) )
310
continue;
311
+
312
+ if ( is_bool($default) ) {
313
+ $yarpp_options[$key] = (boolean) $value;
314
+ continue;
315
+ }
316
+
317
// value options used to be stored with a bajillion slashes...
318
$value = stripslashes(stripslashes($value));
319
// value options used to be stored with a blank space at the end... don't ask.
324
else
325
$yarpp_options[$key] = $value;
326
}
327
328
// add the options directly first, then call set_option which will ensure defaults,
329
// in case any new options have been added.
352
update_option( 'yarpp', $options );
353
}
354
355
+ function upgrade_3_4b8() {
356
+ $options = yarpp_get_option();
357
+ $options['weight'] = array(
358
+ 'title' => $options['title'],
359
+ 'body' => $options['body'],
360
+ 'tax' => array(
361
+ 'post_tag' => $options['tags'],
362
+ 'category' => $options['categories'],
363
+ )
364
+ );
365
+ unset( $options['title'] );
366
+ unset( $options['body'] );
367
+ unset( $options['tags'] );
368
+ unset( $options['categories'] );
369
+ update_option( 'yarpp', $options );
370
+ }
371
+
372
+ // @todo: custom post type support
373
+ function get_post_types() {
374
+ return array('post', 'page');
375
+ }
376
+
377
+ function get_taxonomies() {
378
+ $taxonomies = get_taxonomies(array(), 'objects');
379
+ return array_filter( $taxonomies, array($this, 'taxonomy_filter') );
380
+ }
381
+
382
+ private function taxonomy_filter( $taxonomy ) {
383
+ // if yarpp_support is set and false, or if show_ui is false, skip it
384
+ if ( (isset($taxonomy->yarpp_support) && !$taxonomy->yarpp_support) ||
385
+ !$taxonomy->show_ui )
386
+ return false;
387
+ if ( !count(array_intersect( $taxonomy->object_type, $this->get_post_types() )) )
388
+ return false;
389
+ return true;
390
+ }
391
+
392
/*
393
* DEFAULT CONTENT FILTERS
394
*/
395
396
function the_content($content) {
397
global $post;
398
+
399
if (is_feed())
400
return $this->the_content_rss($content);
401
424
425
function the_excerpt_rss($content) {
426
global $post;
427
+
428
$type = ($post->post_type == 'page' ? array('page') : array('post'));
429
if ( yarpp_get_option('cross_relate') )
430
$type = array('post','page');
includes.php CHANGED
@@ -5,96 +5,18 @@ if ( !defined('WP_CONTENT_URL') )
5
if ( !defined('WP_CONTENT_DIR') )
6
define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
7
8
- global $yarpp_value_options, $yarpp_binary_options, $yarpp_clear_cache_options;
9
- // here's a list of all the options YARPP uses (except version), as well as their default values, sans the yarpp_ prefix, split up into binary options and value options. These arrays are used in updating settings (options.php) and other tasks.
10
- $yarpp_value_options = array(
11
- 'threshold' => 5,
12
- 'limit' => 5,
13
- 'template_file' => '', // new in 2.2
14
- 'excerpt_length' => 10,
15
- 'recent_number' => 12,
16
- 'recent_units' => 'month',
17
- 'before_title' => '<li>',
18
- 'after_title' => '</li>',
19
- 'before_post' => ' <small>',
20
- 'after_post' => '</small>',
21
- 'before_related' => '<p>'.__('Related posts:','yarpp').'</p><ol>',
22
- 'after_related' => '</ol>',
23
- 'no_results' => '<p>'.__('No related posts.','yarpp').'</p>',
24
- 'order' => 'score DESC',
25
- 'rss_limit' => 3,
26
- 'rss_template_file' => '', // new in 2.2
27
- 'rss_excerpt_length' => 10,
28
- 'rss_before_title' => '<li>',
29
- 'rss_after_title' => '</li>',
30
- 'rss_before_post' => ' <small>',
31
- 'rss_after_post' => '</small>',
32
- 'rss_before_related' => '<p>'.__('Related posts:','yarpp').'</p><ol>',
33
- 'rss_after_related' => '</ol>',
34
- 'rss_no_results' => '<p>'.__('No related posts.','yarpp').'</p>',
35
- 'rss_order' => 'score DESC',
36
- 'title' => 2,
37
- 'body' => 2,
38
- 'categories' => 1, // changed default in 3.3
39
- 'tags' => 2);
40
- $yarpp_binary_options = array(
41
- 'past_only' => true,
42
- 'show_excerpt' => false,
43
- 'recent_only' => false, // new in 3.0
44
- 'use_template' => false, // new in 2.2
45
- 'rss_show_excerpt' => false,
46
- 'rss_use_template' => false, // new in 2.2
47
- 'show_pass_post' => false,
48
- 'cross_relate' => false,
49
- 'auto_display' => true,
50
- 'rss_display' => false, // changed default in 3.1.7
51
- 'rss_excerpt_display' => true,
52
- 'promote_yarpp' => false,
53
- 'rss_promote_yarpp' => false,
54
- 'myisam_override' => false);
55
- // These are options which, when updated, will trigger a clearing of the cache
56
- $yarpp_clear_cache_options = array(
57
- 'show_pass_post','recent_only','threshold','title','body','categories',
58
- 'tags');
59
-
60
// Used only in demo mode
61
if (!defined('LOREMIPSUM'))
62
define('LOREMIPSUM','Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras tincidunt justo a urna. Ut turpis. Phasellus convallis, odio sit amet cursus convallis, eros orci scelerisque velit, ut sodales neque nisl at ante. Suspendisse metus. Curabitur auctor pede quis mi. Pellentesque lorem justo, condimentum ac, dapibus sit amet, ornare et, erat. Quisque velit. Etiam sodales dui feugiat neque suscipit bibendum. Integer mattis. Nullam et ante non sem commodo malesuada. Pellentesque ultrices fermentum lectus. Maecenas hendrerit neque ac est. Fusce tortor mi, tristique sed, cursus at, pellentesque non, dui. Suspendisse potenti.');
63
64
function yarpp_set_option($options, $value = null) {
65
- global $yarpp_clear_cache_options, $yarpp;
66
-
67
- $current_options = yarpp_get_option();
68
-
69
- // we can call yarpp_set_option(key,value) if we like:
70
- if ( !is_array($options) && isset($value) )
71
- $options = array( $options => $value );
72
-
73
- $new_options = array_merge( $current_options, $options );
74
-
75
- // new in 3.1: clear cache when updating certain settings.
76
- $new_options_which_require_flush = array_intersect( array_keys( array_diff_assoc($options, $current_options) ), $yarpp_clear_cache_options );
77
- if ( count($new_options_which_require_flush) ||
78
- ( isset($options['exclude']) && $options['exclude'] != $current_options['exclude'] ) )
79
- $yarpp->cache->flush();
80
-
81
- update_option( 'yarpp', $new_options );
82
}
83
84
function yarpp_get_option($option = null) {
85
- global $yarpp_value_options, $yarpp_binary_options;
86
-
87
- $options = get_option( 'yarpp' );
88
- // ensure defaults if not set:
89
- $options = array_merge( $yarpp_value_options, $yarpp_binary_options, $options );
90
- if ( !isset($options['exclude']) )
91
- $options['exclude'] = array();
92
-
93
- if ( is_null( $option ) )
94
- return $options;
95
- if ( isset($options[$option]) )
96
- return $options[$option];
97
- return null;
98
}
99
100
// since 3.3.2: fix for WP 3.0.x
5
if ( !defined('WP_CONTENT_DIR') )
6
define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
7
8
// Used only in demo mode
9
if (!defined('LOREMIPSUM'))
10
define('LOREMIPSUM','Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras tincidunt justo a urna. Ut turpis. Phasellus convallis, odio sit amet cursus convallis, eros orci scelerisque velit, ut sodales neque nisl at ante. Suspendisse metus. Curabitur auctor pede quis mi. Pellentesque lorem justo, condimentum ac, dapibus sit amet, ornare et, erat. Quisque velit. Etiam sodales dui feugiat neque suscipit bibendum. Integer mattis. Nullam et ante non sem commodo malesuada. Pellentesque ultrices fermentum lectus. Maecenas hendrerit neque ac est. Fusce tortor mi, tristique sed, cursus at, pellentesque non, dui. Suspendisse potenti.');
11
12
function yarpp_set_option($options, $value = null) {
13
+ global $yarpp;
14
+ $yarpp->set_option($options, $value);
15
}
16
17
function yarpp_get_option($option = null) {
18
+ global $yarpp;
19
+ return $yarpp->get_option($option);
20
}
21
22
// since 3.3.2: fix for WP 3.0.x
lang/yarpp-ja.mo CHANGED
Binary file
lang/yarpp-ja_JP.po CHANGED
@@ -19,556 +19,511 @@ msgstr ""
19
"X-Poedit-SearchPath-0: .\n"
20
"X-Textdomain-Support: yes"
21
22
- #: includes.php:378
23
#@ yarpp
24
msgid "Related Posts"
25
msgstr "関連記事"
26
27
- #: options.php:63
28
#, php-format
29
#@ yarpp
30
msgid "YARPP's \"consider titles\" and \"consider bodies\" relatedness criteria require your <code>%s</code> table to use the <a href='http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html'>MyISAM storage engine</a>, but the table seems to be using the <code>%s</code> engine. These two options have been disabled."
31
msgstr "YARPPの関連スコア計算の「タイトルを検討する」、「内容を検討する」オプションはデータベースの<code>%s</code>テーブルが <a href='http://dev.mysql.com/doc/refman/4.1/ja/myisam.html'>MyISAM</a> でなければ使用できません。 <code>%s</code>テーブルは現在<code>%s</code>ストーレージエンジンを使用しているので、このふたつのオプションは使えません。"
32
33
- #: options.php:65
34
#, php-format
35
#@ yarpp
36
msgid "To restore these features, please update your <code>%s</code> table by executing the following SQL directive: <code>ALTER TABLE `%s` ENGINE = MyISAM;</code> . No data will be erased by altering the table's engine, although there are performance implications."
37
msgstr "このオプションを使用したければ、<code>%s</code>テーブルに対してこのようなクエリを実行してください:<code>ALTER TABLE `%s` ENGINE = MyISAM;</code>。このクエリはデータは一切消しません。"
38
39
- #: options.php:67
40
#, php-format
41
#@ yarpp
42
msgid "If, despite this check, you are sure that <code>%s</code> is using the MyISAM engine, press this magic button:"
43
msgstr "<code>%s</code>テーブルが絶対MyISAMを使用していると思う方はこちらの魔法のボタンをどうぞ:"
44
45
- #: options.php:70
46
#@ yarpp
47
msgid "Trust me. Let me use MyISAM features."
48
msgstr "MyISAM を使ってます。嘘じゃないから。"
49
50
- #: options.php:83
51
#@ yarpp
52
msgid "The YARPP database had an error but has been fixed."
53
msgstr "YARPPのデータベースは修正されました。"
54
55
- #: options.php:85
56
#@ yarpp
57
msgid "The YARPP database has an error which could not be fixed."
58
msgstr "YARPPのデータベースに修正できないエラーが発生しました。"
59
60
- #: options-meta-boxes.php:38
61
- #@ yarpp
62
- msgid "word"
63
- msgstr "言葉"
64
-
65
- #: options-meta-boxes.php:39
66
- #@ yarpp
67
- msgid "tag"
68
- msgstr "タグ"
69
-
70
- #: options-meta-boxes.php:40
71
- #@ yarpp
72
- msgid "category"
73
- msgstr "カテゴリー"
74
-
75
- #: options-meta-boxes.php:45
76
- #: options-meta-boxes.php:63
77
- #: options-meta-boxes.php:76
78
#@ yarpp
79
msgid "do not consider"
80
msgstr "検討しない"
81
82
- #: options-meta-boxes.php:46
83
- #: options-meta-boxes.php:64
84
- #: options-meta-boxes.php:78
85
#@ yarpp
86
msgid "consider"
87
msgstr "検討する"
88
89
- #: options-meta-boxes.php:48
90
- #: options-meta-boxes.php:80
91
#, php-format
92
#@ yarpp
93
msgid "require at least one %s in common"
94
msgstr "共有の%sをひとつ以上必要とする"
95
96
- #: options-meta-boxes.php:50
97
- #: options-meta-boxes.php:82
98
#, php-format
99
#@ yarpp
100
msgid "require more than one %s in common"
101
msgstr "共有の%sをふたつ以上必要とする"
102
103
- #: options-meta-boxes.php:65
104
#@ yarpp
105
msgid "consider with extra weight"
106
msgstr "検討する(重要視)"
107
108
- #: options-meta-boxes.php:287
109
#@ default
110
#@ yarpp
111
msgid "Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal"
112
msgstr "YARPPの作成者(ミッチョ)にPayPalで寄付をする"
113
114
- #: options.php:172
115
#@ yarpp
116
msgid "Yet Another Related Posts Plugin Options"
117
msgstr "関連記事 (YARPP) 設定"
118
119
- #: options-meta-boxes.php:118
120
#@ yarpp
121
msgid "\"The Pool\""
122
msgstr "フィルター設定"
123
124
- #: options-meta-boxes.php:91
125
#@ yarpp
126
msgid "\"The Pool\" refers to the pool of posts and pages that are candidates for display as related to the current entry."
127
msgstr "関連記事として表示したい記事を制限します。"
128
129
- #: options-meta-boxes.php:96
130
- #@ yarpp
131
- msgid "Disallow by category:"
132
- msgstr "このカテゴリーの記事を表示しない"
133
-
134
- #: options-meta-boxes.php:98
135
- #@ yarpp
136
- msgid "Disallow by tag:"
137
- msgstr "このタグの記事を表示しない"
138
-
139
- #: options-meta-boxes.php:101
140
#@ yarpp
141
msgid "Show password protected posts?"
142
msgstr "パスワードで保護されている記事も表示"
143
144
- #: options-meta-boxes.php:140
145
#@ yarpp
146
msgid "Show only previous posts?"
147
msgstr "過去の記事だけを表示"
148
149
- #: options-meta-boxes.php:148
150
#@ yarpp
151
msgid "\"Relatedness\" options"
152
msgstr "関連スコア設定"
153
154
- #: options-meta-boxes.php:130
155
#@ yarpp
156
msgid "Match threshold:"
157
msgstr "表示する最低関連スコア"
158
159
- #: options-meta-boxes.php:131
160
#@ yarpp
161
msgid "Titles: "
162
msgstr "タイトル:"
163
164
- #: options-meta-boxes.php:133
165
#@ yarpp
166
msgid "Bodies: "
167
msgstr "内容:"
168
169
- #: options-meta-boxes.php:135
170
- #@ yarpp
171
- msgid "Tags: "
172
- msgstr "タグ:"
173
-
174
- #: options-meta-boxes.php:137
175
- #@ yarpp
176
- msgid "Categories: "
177
- msgstr "カテゴリー:"
178
-
179
- #: options-meta-boxes.php:139
180
#@ yarpp
181
msgid "Cross-relate posts and pages?"
182
msgstr "記事とページを関連づける"
183
184
- #: options-meta-boxes.php:139
185
#@ yarpp
186
msgid "When the \"Cross-relate posts and pages\" option is selected, the <code>related_posts()</code>, <code>related_pages()</code>, and <code>related_entries()</code> all will give the same output, returning both related pages and posts."
187
msgstr "「記事とページを関連づける」が有効の場合は <code>related_posts()</code>、 <code>related_pages()</code> と <code>related_entries()</code> は全て記事とページを両方「関連記事/ページ」として表示します。"
188
189
- #: options-meta-boxes.php:212
190
#@ yarpp
191
msgid "Display options <small>for your website</small>"
192
msgstr "表示設定 <small>ウェブサイト用</small>"
193
194
- #: options-meta-boxes.php:157
195
#@ yarpp
196
msgid "Automatically display related posts?"
197
msgstr "自動的に関連記事を表示する"
198
199
- #: options-meta-boxes.php:157
200
#@ yarpp
201
msgid "This option automatically displays related posts right after the content on single entry pages. If this option is off, you will need to manually insert <code>related_posts()</code> or variants (<code>related_pages()</code> and <code>related_entries()</code>) into your theme files."
202
msgstr "単体記事表示時に自動的に関連記事を表示します。この自動表示を無効にすると、テーマファイルに<code>related_posts()</code>を入れる必要があります。"
203
204
- #: options-meta-boxes.php:158
205
#@ yarpp
206
msgid "Website display code example"
207
msgstr "ウェブサイト表示のソース例"
208
209
- #: options-meta-boxes.php:158
210
- #: options-meta-boxes.php:221
211
#@ yarpp
212
msgid "(Update options to reload.)"
213
msgstr "(設定保存時に更新されます)"
214
215
- #: options-meta-boxes.php:160
216
- #: options-meta-boxes.php:226
217
#@ yarpp
218
msgid "Maximum number of related posts:"
219
msgstr "一度に表示する関連記事数"
220
221
- #: options-meta-boxes.php:175
222
- #: options-meta-boxes.php:244
223
#@ yarpp
224
msgid "Before / after related entries:"
225
msgstr "関連記事表示を囲むタグ:"
226
227
- #: options-meta-boxes.php:175
228
- #: options-meta-boxes.php:176
229
- #: options-meta-boxes.php:184
230
- #: options-meta-boxes.php:244
231
- #: options-meta-boxes.php:245
232
- #: options-meta-boxes.php:250
233
#@ yarpp
234
msgid "For example:"
235
msgstr "例:"
236
237
- #: options-meta-boxes.php:176
238
- #: options-meta-boxes.php:245
239
#@ yarpp
240
msgid "Before / after each related entry:"
241
msgstr "各関連記事を囲むタグ:"
242
243
- #: options-meta-boxes.php:178
244
- #: options-meta-boxes.php:247
245
#@ yarpp
246
msgid "Show excerpt?"
247
msgstr "抜粋を表示?"
248
249
- #: options-meta-boxes.php:179
250
- #: options-meta-boxes.php:248
251
#@ yarpp
252
msgid "Excerpt length (No. of words):"
253
msgstr "抜粋の長さ(単語数):"
254
255
- #: options-meta-boxes.php:183
256
#@ yarpp
257
msgid "Before / after (Excerpt):"
258
msgstr "抜粋を囲むタグ:"
259
260
- #: options-meta-boxes.php:189
261
- #: options-meta-boxes.php:254
262
#@ yarpp
263
msgid "Order results:"
264
msgstr "表示順番:"
265
266
- #: options-meta-boxes.php:191
267
- #: options-meta-boxes.php:256
268
#@ yarpp
269
msgid "score (high relevance to low)"
270
msgstr "関連スコアの高い順"
271
272
- #: options-meta-boxes.php:192
273
- #: options-meta-boxes.php:257
274
#@ yarpp
275
msgid "score (low relevance to high)"
276
msgstr "関連スコアの低い順"
277
278
- #: options-meta-boxes.php:193
279
- #: options-meta-boxes.php:258
280
#@ yarpp
281
msgid "date (new to old)"
282
msgstr "新しい日付順(降順)"
283
284
- #: options-meta-boxes.php:194
285
- #: options-meta-boxes.php:259
286
#@ yarpp
287
msgid "date (old to new)"
288
msgstr "古い日付順(昇順)"
289
290
- #: options-meta-boxes.php:195
291
- #: options-meta-boxes.php:260
292
#@ yarpp
293
msgid "title (alphabetical)"
294
msgstr "タイトル順(昇順)"
295
296
- #: options-meta-boxes.php:196
297
- #: options-meta-boxes.php:261
298
#@ yarpp
299
msgid "title (reverse alphabetical)"
300
msgstr "タイトル順(降順)"
301
302
- #: options-meta-boxes.php:201
303
- #: options-meta-boxes.php:266
304
#@ yarpp
305
msgid "Default display if no results:"
306
msgstr "関連記事がない時のメッセージ"
307
308
- #: includes.php:259
309
- #: options-meta-boxes.php:203
310
- #: options-meta-boxes.php:268
311
#@ yarpp
312
msgid "Help promote Yet Another Related Posts Plugin?"
313
msgstr "この関連記事プラグイン(YARPP)を宣伝しますか?"
314
315
- #: options-meta-boxes.php:205
316
- #: options-meta-boxes.php:269
317
#, php-format
318
#@ yarpp
319
msgid "This option will add the code %s. Try turning it on, updating your options, and see the code in the code example to the right. These links and donations are greatly appreciated."
320
msgstr "関連記事表示の下に「%s」というコードを挿入します。"
321
322
- #: options-meta-boxes.php:276
323
#@ yarpp
324
msgid "Display options <small>for RSS</small>"
325
msgstr "表示設定 <small>RSS/Atom フィード用</small>"
326
327
- #: options-meta-boxes.php:221
328
#@ yarpp
329
msgid "Display related posts in feeds?"
330
msgstr "自動的にフィードで関連記事を表示する"
331
332
- #: options-meta-boxes.php:223
333
#@ yarpp
334
msgid "Display related posts in the descriptions?"
335
msgstr "フィード内の抜粋にも自動的に関連記事を表示する"
336
337
- #: options-meta-boxes.php:223
338
#@ yarpp
339
msgid "This option displays the related posts in the RSS description fields, not just the content. If your feeds are set up to only display excerpts, however, only the description field is used, so this option is required for any display at all."
340
msgstr "フィード内の全文表示に関連記事を表示するだけでなく、フィード内の抜粋でも関連記事が表示されます。WordPressの設定によりフィードに抜粋のみを表示している場合は、このオプションが無効の場合関連記事がフィード内で表示されません。"
341
342
- #: options-meta-boxes.php:221
343
#@ yarpp
344
msgid "RSS display code example"
345
msgstr "RSS表示のソース例"
346
347
- #: options-meta-boxes.php:250
348
#@ yarpp
349
msgid "Before / after (excerpt):"
350
msgstr "抜粋を囲むタグ:"
351
352
- #: template-builtin.php:35
353
#, php-format
354
#@ yarpp
355
msgid "%f is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors."
356
msgstr "%fは現在表示の記事とこの関連記事の関連スコアです。この関連スコアはログイン済みのサイト管理者のみに表示されます。"
357
358
- #: includes.php:149
359
- #: includes.php:194
360
- #: includes.php:215
361
#@ yarpp
362
msgid "Related Posts (YARPP)"
363
msgstr "関連記事 (YARPP)"
364
365
- #: options.php:54
366
#@ yarpp
367
msgid "The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria."
368
msgstr "MyISAM専用機能を強制的に有効にしました。「タイトルを検討」と「内容を検討」機能が使えるようになりました。"
369
370
- #: options-meta-boxes.php:124
371
- #: options-meta-boxes.php:139
372
- #: options-meta-boxes.php:157
373
- #: options-meta-boxes.php:161
374
- #: options-meta-boxes.php:204
375
- #: options-meta-boxes.php:221
376
- #: options-meta-boxes.php:223
377
- #: options-meta-boxes.php:228
378
- #: options-meta-boxes.php:268
379
#@ yarpp
380
msgid "more&gt;"
381
msgstr "(説明)"
382
383
- #: options.php:114
384
#@ yarpp
385
msgid "Options saved!"
386
msgstr "設定の変更は保存されました。"
387
388
- #: options.php:274
389
- #@ yarpp
390
- msgid "Do you really want to reset your configuration?"
391
- msgstr "本当に初期設定に戻りますか?"
392
-
393
- #: options.php:273
394
#@ yarpp
395
msgid "Update options"
396
msgstr "変更を保存"
397
398
- #: options-meta-boxes.php:124
399
#@ yarpp
400
msgid "The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshhold, take a look at some post's related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site."
401
msgstr "より関連性の高い記事だけを表示したい場合は、最低関連スコアを上げてください。初期設定は5です。"
402
403
- #: options.php:274
404
- #@ yarpp
405
- msgid "Reset options"
406
- msgstr "初期設定に戻る"
407
-
408
- #: cache-postmeta.php:105
409
- #: cache-tables.php:131
410
#@ yarpp
411
msgid "Example post "
412
msgstr "例:"
413
414
- #: template-metabox.php:12
415
#@ yarpp
416
msgid "These are the related entries for this entry. Updating this post may change these related posts."
417
msgstr "この投稿の関連記事。投稿を更新すると関連記事も変わる可能性があります。"
418
419
- #: template-metabox.php:25
420
#@ yarpp
421
msgid "Whether all of these related entries are actually displayed and how they are displayed depends on your YARPP display options."
422
msgstr "関連記事候補が全て表示されるかどうかは YARPP (関連記事) オプションの表示設定によって異なります。"
423
424
- #: includes.php:28
425
- #: includes.php:39
426
- #: template-metabox.php:27
427
#: template-widget.php:13
428
#@ yarpp
429
msgid "No related posts."
430
msgstr "関連記事はありません。"
431
432
- #: options-meta-boxes.php:105
433
#@ yarpp
434
msgid "day(s)"
435
msgstr "日間"
436
437
- #: options-meta-boxes.php:106
438
#@ yarpp
439
msgid "week(s)"
440
msgstr "週間"
441
442
- #: options-meta-boxes.php:107
443
#@ yarpp
444
msgid "month(s)"
445
msgstr "ヶ月間"
446
447
- #: options-meta-boxes.php:109
448
#@ yarpp
449
msgid "Show only posts from the past NUMBER UNITS"
450
msgstr "過去 NUMBER UNITS の記事だけを表示"
451
452
- #: includes.php:250
453
- #: options-meta-boxes.php:161
454
- #: options-meta-boxes.php:228
455
#@ yarpp
456
msgid "Display using a custom template file"
457
msgstr "テンプレートを使って表示"
458
459
- #: includes.php:251
460
- #: options-meta-boxes.php:165
461
- #: options-meta-boxes.php:233
462
#@ yarpp
463
msgid "Template file:"
464
msgstr "テンプレートファイル:"
465
466
- #: options-meta-boxes.php:221
467
#@ yarpp
468
msgid "This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed."
469
msgstr "RSSとAtomフィード内に関連記事を表示。テーマの変更は必要ありません。"
470
471
- #: options-meta-boxes.php:228
472
#@ yarpp
473
msgid "NEW!"
474
msgstr ""
475
476
- #: options-meta-boxes.php:161
477
- #: options-meta-boxes.php:228
478
#@ yarpp
479
msgid "This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP."
480
msgstr "この新機能で関連記事の表示を完全にカスタマイズする事が出来ます。テンプレートファイルは PHP でかき、使用テーマのフォルダにいれます。"
481
482
- #: includes.php:26
483
- #: includes.php:37
484
#@ yarpp
485
msgid "Related posts:"
486
msgstr "関連記事:"
487
488
- #: options-meta-boxes.php:175
489
- #: options-meta-boxes.php:176
490
- #: options-meta-boxes.php:184
491
- #: options-meta-boxes.php:244
492
- #: options-meta-boxes.php:245
493
- #: options-meta-boxes.php:250
494
#@ yarpp
495
msgid " or "
496
msgstr "、"
497
498
- #: includes.php:169
499
#@ yarpp
500
msgid "Settings"
501
msgstr "設定"
502
503
- #: includes.php:243
504
#@ default
505
msgid "Title:"
506
msgstr ""
507
508
- #: includes.php:387
509
#@ yarpp
510
msgid "Related entries may be displayed once you save your entry"
511
msgstr "関連記事は保存後更新されます。"
512
513
- #: magic.php:297
514
- #: options-meta-boxes.php:205
515
- #: options-meta-boxes.php:269
516
#, php-format
517
#@ yarpp
518
msgid "Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>."
519
msgstr "関連記事は<a href='%s'>YARPP関連記事プラグイン</a>によって表示されています。"
520
521
- #: options-meta-boxes.php:124
522
#@ yarpp
523
msgid "YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>."
524
msgstr "この関連記事プラグイン(YARPP)は各対象記事の関連スコアを計算し、ある関連スコア以上の記事だけを表示します。"
525
526
- #: options-meta-boxes.php:283
527
#@ yarpp
528
msgid "YARPP Forum"
529
msgstr "YARPP フォーラム"
530
531
- #: options-meta-boxes.php:284
532
#@ yarpp
533
msgid "YARPP on Twitter"
534
msgstr "YARPP Twitter"
535
536
- #: options-meta-boxes.php:285
537
#@ yarpp
538
msgid "YARPP on the Web"
539
msgstr "ウェブサイト"
540
541
- #: options-meta-boxes.php:293
542
#@ yarpp
543
msgid "Contact YARPP"
544
msgstr "YARPP 情報"
545
546
- #: options.php:42
547
#, php-format
548
#@ default
549
msgid "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox\" title=\"%3$s\">View version %4$s details</a> or <a href=\"%5$s\">update automatically</a>."
550
msgstr ""
551
552
- #: options.php:46
553
#, php-format
554
#@ yarpp
555
msgid "There is a new beta (%s) of Yet Another Related Posts Plugin. You can <a href=\"%s\">download it here</a> at your own risk."
556
msgstr "関連記事プラグイン(YARPP)の新しいベータ(%s)があります。是非<a href=\"%s\">ダウンロード</a>してみてください。"
557
558
- #: options.php:86
559
#, php-format
560
#@ yarpp
561
msgid "Please try <a href=\"%s\" target=\"_blank\">manual SQL setup</a>."
562
msgstr ""
563
564
- #: options.php:182
565
#, php-format
566
#@ yarpp
567
msgid "by <a href=\"%s\" target=\"_blank\">mitcho (Michael 芳貴 Erlewine)</a>"
568
msgstr "by <a href=\"%s\" target=\"_blank\">みっちょ (アーリーワイン・マイケル芳貴)</a>"
569
570
- #: options-meta-boxes.php:286
571
#@ yarpp
572
msgid "Rate YARPP on WordPress.org"
573
msgstr "WordPress.org で YARPP を評価する"
574
19
"X-Poedit-SearchPath-0: .\n"
20
"X-Textdomain-Support: yes"
21
22
+ #: class-admin.php:25
23
#@ yarpp
24
msgid "Related Posts"
25
msgstr "関連記事"
26
27
+ #: options.php:62
28
#, php-format
29
#@ yarpp
30
msgid "YARPP's \"consider titles\" and \"consider bodies\" relatedness criteria require your <code>%s</code> table to use the <a href='http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html'>MyISAM storage engine</a>, but the table seems to be using the <code>%s</code> engine. These two options have been disabled."
31
msgstr "YARPPの関連スコア計算の「タイトルを検討する」、「内容を検討する」オプションはデータベースの<code>%s</code>テーブルが <a href='http://dev.mysql.com/doc/refman/4.1/ja/myisam.html'>MyISAM</a> でなければ使用できません。 <code>%s</code>テーブルは現在<code>%s</code>ストーレージエンジンを使用しているので、このふたつのオプションは使えません。"
32
33
+ #: options.php:64
34
#, php-format
35
#@ yarpp
36
msgid "To restore these features, please update your <code>%s</code> table by executing the following SQL directive: <code>ALTER TABLE `%s` ENGINE = MyISAM;</code> . No data will be erased by altering the table's engine, although there are performance implications."
37
msgstr "このオプションを使用したければ、<code>%s</code>テーブルに対してこのようなクエリを実行してください:<code>ALTER TABLE `%s` ENGINE = MyISAM;</code>。このクエリはデータは一切消しません。"
38
39
+ #: options.php:66
40
#, php-format
41
#@ yarpp
42
msgid "If, despite this check, you are sure that <code>%s</code> is using the MyISAM engine, press this magic button:"
43
msgstr "<code>%s</code>テーブルが絶対MyISAMを使用していると思う方はこちらの魔法のボタンをどうぞ:"
44
45
+ #: options.php:69
46
#@ yarpp
47
msgid "Trust me. Let me use MyISAM features."
48
msgstr "MyISAM を使ってます。嘘じゃないから。"
49
50
+ #: options.php:81
51
#@ yarpp
52
msgid "The YARPP database had an error but has been fixed."
53
msgstr "YARPPのデータベースは修正されました。"
54
55
+ #: options.php:83
56
#@ yarpp
57
msgid "The YARPP database has an error which could not be fixed."
58
msgstr "YARPPのデータベースに修正できないエラーが発生しました。"
59
60
+ #: options-meta-boxes.php:36
61
+ #: options-meta-boxes.php:50
62
#@ yarpp
63
msgid "do not consider"
64
msgstr "検討しない"
65
66
+ #: options-meta-boxes.php:37
67
+ #: options-meta-boxes.php:51
68
#@ yarpp
69
msgid "consider"
70
msgstr "検討する"
71
72
+ #: options-meta-boxes.php:38
73
#, php-format
74
#@ yarpp
75
msgid "require at least one %s in common"
76
msgstr "共有の%sをひとつ以上必要とする"
77
78
+ #: options-meta-boxes.php:39
79
#, php-format
80
#@ yarpp
81
msgid "require more than one %s in common"
82
msgstr "共有の%sをふたつ以上必要とする"
83
84
+ #: options-meta-boxes.php:52
85
#@ yarpp
86
msgid "consider with extra weight"
87
msgstr "検討する(重要視)"
88
89
+ #: options-meta-boxes.php:286
90
#@ default
91
#@ yarpp
92
msgid "Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal"
93
msgstr "YARPPの作成者(ミッチョ)にPayPalで寄付をする"
94
95
+ #: options.php:123
96
#@ yarpp
97
msgid "Yet Another Related Posts Plugin Options"
98
msgstr "関連記事 (YARPP) 設定"
99
100
+ #: options-meta-boxes.php:131
101
#@ yarpp
102
msgid "\"The Pool\""
103
msgstr "フィルター設定"
104
105
+ #: options-meta-boxes.php:99
106
#@ yarpp
107
msgid "\"The Pool\" refers to the pool of posts and pages that are candidates for display as related to the current entry."
108
msgstr "関連記事として表示したい記事を制限します。"
109
110
+ #: options-meta-boxes.php:113
111
#@ yarpp
112
msgid "Show password protected posts?"
113
msgstr "パスワードで保護されている記事も表示"
114
115
+ #: options-meta-boxes.php:160
116
#@ yarpp
117
msgid "Show only previous posts?"
118
msgstr "過去の記事だけを表示"
119
120
+ #: options-meta-boxes.php:168
121
#@ yarpp
122
msgid "\"Relatedness\" options"
123
msgstr "関連スコア設定"
124
125
+ #: options-meta-boxes.php:143
126
#@ yarpp
127
msgid "Match threshold:"
128
msgstr "表示する最低関連スコア"
129
130
+ #: options-meta-boxes.php:144
131
#@ yarpp
132
msgid "Titles: "
133
msgstr "タイトル:"
134
135
+ #: options-meta-boxes.php:146
136
#@ yarpp
137
msgid "Bodies: "
138
msgstr "内容:"
139
140
+ #: options-meta-boxes.php:159
141
#@ yarpp
142
msgid "Cross-relate posts and pages?"
143
msgstr "記事とページを関連づける"
144
145
+ #: options-meta-boxes.php:159
146
#@ yarpp
147
msgid "When the \"Cross-relate posts and pages\" option is selected, the <code>related_posts()</code>, <code>related_pages()</code>, and <code>related_entries()</code> all will give the same output, returning both related pages and posts."
148
msgstr "「記事とページを関連づける」が有効の場合は <code>related_posts()</code>、 <code>related_pages()</code> と <code>related_entries()</code> は全て記事とページを両方「関連記事/ページ」として表示します。"
149
150
+ #: options-meta-boxes.php:223
151
#@ yarpp
152
msgid "Display options <small>for your website</small>"
153
msgstr "表示設定 <small>ウェブサイト用</small>"
154
155
+ #: options-meta-boxes.php:177
156
#@ yarpp
157
msgid "Automatically display related posts?"
158
msgstr "自動的に関連記事を表示する"
159
160
+ #: options-meta-boxes.php:177
161
#@ yarpp
162
msgid "This option automatically displays related posts right after the content on single entry pages. If this option is off, you will need to manually insert <code>related_posts()</code> or variants (<code>related_pages()</code> and <code>related_entries()</code>) into your theme files."
163
msgstr "単体記事表示時に自動的に関連記事を表示します。この自動表示を無効にすると、テーマファイルに<code>related_posts()</code>を入れる必要があります。"
164
165
+ #: options-meta-boxes.php:178
166
#@ yarpp
167
msgid "Website display code example"
168
msgstr "ウェブサイト表示のソース例"
169
170
+ #: options-meta-boxes.php:178
171
+ #: options-meta-boxes.php:232
172
#@ yarpp
173
msgid "(Update options to reload.)"
174
msgstr "(設定保存時に更新されます)"
175
176
+ #: options-meta-boxes.php:180
177
+ #: options-meta-boxes.php:237
178
#@ yarpp
179
msgid "Maximum number of related posts:"
180
msgstr "一度に表示する関連記事数"
181
182
+ #: options-meta-boxes.php:195
183
+ #: options-meta-boxes.php:255
184
#@ yarpp
185
msgid "Before / after related entries:"
186
msgstr "関連記事表示を囲むタグ:"
187
188
+ #: options-meta-boxes.php:195
189
+ #: options-meta-boxes.php:196
190
+ #: options-meta-boxes.php:204
191
+ #: options-meta-boxes.php:255
192
+ #: options-meta-boxes.php:256
193
+ #: options-meta-boxes.php:261
194
#@ yarpp
195
msgid "For example:"
196
msgstr "例:"
197
198
+ #: options-meta-boxes.php:196
199
+ #: options-meta-boxes.php:256
200
#@ yarpp
201
msgid "Before / after each related entry:"
202
msgstr "各関連記事を囲むタグ:"
203
204
+ #: options-meta-boxes.php:198
205
+ #: options-meta-boxes.php:258
206
#@ yarpp
207
msgid "Show excerpt?"
208
msgstr "抜粋を表示?"
209
210
+ #: options-meta-boxes.php:199
211
+ #: options-meta-boxes.php:259
212
#@ yarpp
213
msgid "Excerpt length (No. of words):"
214
msgstr "抜粋の長さ(単語数):"
215
216
+ #: options-meta-boxes.php:203
217
#@ yarpp
218
msgid "Before / after (Excerpt):"
219
msgstr "抜粋を囲むタグ:"
220
221
+ #: options-meta-boxes.php:61
222
#@ yarpp
223
msgid "Order results:"
224
msgstr "表示順番:"
225
226
+ #: options-meta-boxes.php:64
227
#@ yarpp
228
msgid "score (high relevance to low)"
229
msgstr "関連スコアの高い順"
230
231
+ #: options-meta-boxes.php:65
232
#@ yarpp
233
msgid "score (low relevance to high)"
234
msgstr "関連スコアの低い順"
235
236
+ #: options-meta-boxes.php:66
237
#@ yarpp
238
msgid "date (new to old)"
239
msgstr "新しい日付順(降順)"
240
241
+ #: options-meta-boxes.php:67
242
#@ yarpp
243
msgid "date (old to new)"
244
msgstr "古い日付順(昇順)"
245
246
+ #: options-meta-boxes.php:68
247
#@ yarpp
248
msgid "title (alphabetical)"
249
msgstr "タイトル順(昇順)"
250
251
+ #: options-meta-boxes.php:69
252
#@ yarpp
253
msgid "title (reverse alphabetical)"
254
msgstr "タイトル順(降順)"
255
256
+ #: options-meta-boxes.php:211
257
+ #: options-meta-boxes.php:265
258
#@ yarpp
259
msgid "Default display if no results:"
260
msgstr "関連記事がない時のメッセージ"
261
262
+ #: class-widget.php:72
263
+ #: options-meta-boxes.php:214
264
+ #: options-meta-boxes.php:267
265
#@ yarpp
266
msgid "Help promote Yet Another Related Posts Plugin?"
267
msgstr "この関連記事プラグイン(YARPP)を宣伝しますか?"
268
269
+ #: options-meta-boxes.php:216
270
+ #: options-meta-boxes.php:268
271
#, php-format
272
#@ yarpp
273
msgid "This option will add the code %s. Try turning it on, updating your options, and see the code in the code example to the right. These links and donations are greatly appreciated."
274
msgstr "関連記事表示の下に「%s」というコードを挿入します。"
275
276
+ #: options-meta-boxes.php:275
277
#@ yarpp
278
msgid "Display options <small>for RSS</small>"
279
msgstr "表示設定 <small>RSS/Atom フィード用</small>"
280
281
+ #: options-meta-boxes.php:232
282
#@ yarpp
283
msgid "Display related posts in feeds?"
284
msgstr "自動的にフィードで関連記事を表示する"
285
286
+ #: options-meta-boxes.php:234
287
#@ yarpp
288
msgid "Display related posts in the descriptions?"
289
msgstr "フィード内の抜粋にも自動的に関連記事を表示する"
290
291
+ #: options-meta-boxes.php:234
292
#@ yarpp
293
msgid "This option displays the related posts in the RSS description fields, not just the content. If your feeds are set up to only display excerpts, however, only the description field is used, so this option is required for any display at all."
294
msgstr "フィード内の全文表示に関連記事を表示するだけでなく、フィード内の抜粋でも関連記事が表示されます。WordPressの設定によりフィードに抜粋のみを表示している場合は、このオプションが無効の場合関連記事がフィード内で表示されません。"
295
296
+ #: options-meta-boxes.php:232
297
#@ yarpp
298
msgid "RSS display code example"
299
msgstr "RSS表示のソース例"
300
301
+ #: options-meta-boxes.php:261
302
#@ yarpp
303
msgid "Before / after (excerpt):"
304
msgstr "抜粋を囲むタグ:"
305
306
+ #: template-builtin.php:31
307
#, php-format
308
#@ yarpp
309
msgid "%f is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors."
310
msgstr "%fは現在表示の記事とこの関連記事の関連スコアです。この関連スコアはログイン済みのサイト管理者のみに表示されます。"
311
312
+ #: class-admin.php:17
313
+ #: class-widget.php:7
314
+ #: class-widget.php:28
315
#@ yarpp
316
msgid "Related Posts (YARPP)"
317
msgstr "関連記事 (YARPP)"
318
319
+ #: options.php:53
320
#@ yarpp
321
msgid "The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria."
322
msgstr "MyISAM専用機能を強制的に有効にしました。「タイトルを検討」と「内容を検討」機能が使えるようになりました。"
323
324
+ #: options-meta-boxes.php:137
325
+ #: options-meta-boxes.php:159
326
+ #: options-meta-boxes.php:177
327
+ #: options-meta-boxes.php:181
328
+ #: options-meta-boxes.php:215
329
+ #: options-meta-boxes.php:232
330
+ #: options-meta-boxes.php:234
331
+ #: options-meta-boxes.php:239
332
+ #: options-meta-boxes.php:267
333
#@ yarpp
334
msgid "more&gt;"
335
msgstr "(説明)"
336
337
+ #: options.php:117
338
#@ yarpp
339
msgid "Options saved!"
340
msgstr "設定の変更は保存されました。"
341
342
+ #: options.php:161
343
#@ yarpp
344
msgid "Update options"
345
msgstr "変更を保存"
346
347
+ #: options-meta-boxes.php:137
348
#@ yarpp
349
msgid "The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshhold, take a look at some post's related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site."
350
msgstr "より関連性の高い記事だけを表示したい場合は、最低関連スコアを上げてください。初期設定は5です。"
351
352
+ #: cache-postmeta.php:112
353
+ #: cache-tables.php:132
354
#@ yarpp
355
msgid "Example post "
356
msgstr "例:"
357
358
+ #: template-metabox.php:13
359
#@ yarpp
360
msgid "These are the related entries for this entry. Updating this post may change these related posts."
361
msgstr "この投稿の関連記事。投稿を更新すると関連記事も変わる可能性があります。"
362
363
+ #: template-metabox.php:29
364
#@ yarpp
365
msgid "Whether all of these related entries are actually displayed and how they are displayed depends on your YARPP display options."
366
msgstr "関連記事候補が全て表示されるかどうかは YARPP (関連記事) オプションの表示設定によって異なります。"
367
368
+ #: includes.php:23
369
+ #: includes.php:34
370
+ #: template-metabox.php:31
371
#: template-widget.php:13
372
#@ yarpp
373
msgid "No related posts."
374
msgstr "関連記事はありません。"
375
376
+ #: options-meta-boxes.php:118
377
#@ yarpp
378
msgid "day(s)"
379
msgstr "日間"
380
381
+ #: options-meta-boxes.php:119
382
#@ yarpp
383
msgid "week(s)"
384
msgstr "週間"
385
386
+ #: options-meta-boxes.php:120
387
#@ yarpp
388
msgid "month(s)"
389
msgstr "ヶ月間"
390
391
+ #: options-meta-boxes.php:122
392
#@ yarpp
393
msgid "Show only posts from the past NUMBER UNITS"
394
msgstr "過去 NUMBER UNITS の記事だけを表示"
395
396
+ #: class-widget.php:63
397
+ #: options-meta-boxes.php:181
398
+ #: options-meta-boxes.php:239
399
#@ yarpp
400
msgid "Display using a custom template file"
401
msgstr "テンプレートを使って表示"
402
403
+ #: class-widget.php:64
404
+ #: options-meta-boxes.php:185
405
+ #: options-meta-boxes.php:244
406
#@ yarpp
407
msgid "Template file:"
408
msgstr "テンプレートファイル:"
409
410
+ #: options-meta-boxes.php:232
411
#@ yarpp
412
msgid "This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed."
413
msgstr "RSSとAtomフィード内に関連記事を表示。テーマの変更は必要ありません。"
414
415
+ #: options-meta-boxes.php:239
416
#@ yarpp
417
msgid "NEW!"
418
msgstr ""
419
420
+ #: options-meta-boxes.php:181
421
+ #: options-meta-boxes.php:239
422
#@ yarpp
423
msgid "This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP."
424
msgstr "この新機能で関連記事の表示を完全にカスタマイズする事が出来ます。テンプレートファイルは PHP でかき、使用テーマのフォルダにいれます。"
425
426
+ #: includes.php:21
427
+ #: includes.php:32
428
#@ yarpp
429
msgid "Related posts:"
430
msgstr "関連記事:"
431
432
+ #: options-meta-boxes.php:195
433
+ #: options-meta-boxes.php:196
434
+ #: options-meta-boxes.php:204
435
+ #: options-meta-boxes.php:255
436
+ #: options-meta-boxes.php:256
437
+ #: options-meta-boxes.php:261
438
#@ yarpp
439
msgid " or "
440
msgstr "、"
441
442
+ #: class-admin.php:46
443
#@ yarpp
444
msgid "Settings"
445
msgstr "設定"
446
447
+ #: class-widget.php:56
448
#@ default
449
msgid "Title:"
450
msgstr ""
451
452
+ #: class-admin.php:61
453
#@ yarpp
454
msgid "Related entries may be displayed once you save your entry"
455
msgstr "関連記事は保存後更新されます。"
456
457
+ #: magic.php:236
458
+ #: options-meta-boxes.php:216
459
+ #: options-meta-boxes.php:268
460
#, php-format
461
#@ yarpp
462
msgid "Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>."
463
msgstr "関連記事は<a href='%s'>YARPP関連記事プラグイン</a>によって表示されています。"
464
465
+ #: options-meta-boxes.php:137
466
#@ yarpp
467
msgid "YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>."
468
msgstr "この関連記事プラグイン(YARPP)は各対象記事の関連スコアを計算し、ある関連スコア以上の記事だけを表示します。"
469
470
+ #: options-meta-boxes.php:282
471
#@ yarpp
472
msgid "YARPP Forum"
473
msgstr "YARPP フォーラム"
474
475
+ #: options-meta-boxes.php:283
476
#@ yarpp
477
msgid "YARPP on Twitter"
478
msgstr "YARPP Twitter"
479
480
+ #: options-meta-boxes.php:284
481
#@ yarpp
482
msgid "YARPP on the Web"
483
msgstr "ウェブサイト"
484
485
+ #: options-meta-boxes.php:321
486
#@ yarpp
487
msgid "Contact YARPP"
488
msgstr "YARPP 情報"
489
490
+ #: options.php:41
491
#, php-format
492
#@ default
493
msgid "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox\" title=\"%3$s\">View version %4$s details</a> or <a href=\"%5$s\">update automatically</a>."
494
msgstr ""
495
496
+ #: options.php:45
497
#, php-format
498
#@ yarpp
499
msgid "There is a new beta (%s) of Yet Another Related Posts Plugin. You can <a href=\"%s\">download it here</a> at your own risk."
500
msgstr "関連記事プラグイン(YARPP)の新しいベータ(%s)があります。是非<a href=\"%s\">ダウンロード</a>してみてください。"
501
502
+ #: options.php:84
503
#, php-format
504
#@ yarpp
505
msgid "Please try <a href=\"%s\" target=\"_blank\">manual SQL setup</a>."
506
msgstr ""
507
508
+ #: options.php:131
509
#, php-format
510
#@ yarpp
511
msgid "by <a href=\"%s\" target=\"_blank\">mitcho (Michael 芳貴 Erlewine)</a>"
512
msgstr "by <a href=\"%s\" target=\"_blank\">みっちょ (アーリーワイン・マイケル芳貴)</a>"
513
514
+ #: options-meta-boxes.php:285
515
#@ yarpp
516
msgid "Rate YARPP on WordPress.org"
517
msgstr "WordPress.org で YARPP を評価する"
518
519
+ #: class-admin.php:25
520
+ #@ default
521
+ msgid "Configure"
522
+ msgstr ""
523
+
524
+ #: options-meta-boxes.php:111
525
+ #, php-format
526
+ #@ yarpp
527
+ msgid "Disallow by %s:"
528
+ msgstr "この%sの記事を表示しない"
529
+
magic.php CHANGED
@@ -2,114 +2,6 @@
2
3
//=CACHING===========
4
5
- function yarpp_sql( $reference_ID = false ) {
6
- global $wpdb, $post, $yarpp;
7
-
8
- if ( is_object($post) && !$reference_ID ) {
9
- $reference_ID = $post->ID;
10
- }
11
-
12
- if ( !is_object($post) || $reference_ID != $post->ID ) {
13
- $reference_post = get_post( $reference_ID );
14
- } else {
15
- $reference_post = $post;
16
- }
17
-
18
- $options = array( 'threshold', 'show_pass_post', 'past_only', 'body', 'title', 'tags', 'categories', 'exclude', 'recent_only', 'recent_number', 'recent_units');
19
- $yarpp_options = yarpp_get_option();
20
- // mask it so we only get the ones specified in $options
21
- $optvals = array_intersect_key($yarpp_options, array_flip($options));
22
- extract($optvals);
23
-
24
- // Fetch keywords
25
- $keywords = $yarpp->cache->get_keywords($reference_ID);
26
-
27
- // Get weights
28
- $weights = array(
29
- 'body' => (($body == 3)?3:(($body == 2)?1:0)),
30
- 'title' => (($title == 3)?3:(($title == 2)?1:0)),
31
- 'post_tag' => (($tags != 1)?1:0),
32
- 'category' => (($categories != 1)?1:0)
33
- );
34
- //$totalweight = array_sum( array_values( $weights ) );
35
-
36
- // Build criteria query parts based on the weights
37
- $criteria = array();
38
- if ($weights['body'])
39
- $criteria['body'] = "(MATCH (post_content) AGAINST ('".$wpdb->escape($keywords['body'])."'))";
40
- if ($weights['title'])
41
- $criteria['title'] = "(MATCH (post_title) AGAINST ('".$wpdb->escape($keywords['title'])."'))";
42
- if ($weights['post_tag'])
43
- $criteria['post_tag'] = "count(distinct if( termtax.taxonomy = 'post_tag', termtax.term_taxonomy_id, null ))";
44
- if ($weights['category'])
45
- $criteria['category'] = "count(distinct if( termtax.taxonomy = 'category', termtax.term_taxonomy_id, null ))";
46
-
47
- // SELECT
48
- $newsql = "SELECT $reference_ID as reference_ID, ID, "; //post_title, post_date, post_content, post_excerpt,
49
-
50
- $newsql .= 'ROUND(0';
51
- foreach ($criteria as $key => $value) {
52
- $newsql .= "+ $value * " . $weights[$key];
53
- }
54
- $newsql .= ',1) as score';
55
-
56
- $newsql .= "\n from $wpdb->posts \n";
57
-
58
- // Get disallowed categories and tags
59
- $disterms = wp_parse_id_list($exclude['category'] . ',' . $exclude['post_tag']);
60
- $usedisterms = count($disterms);
61
- if ( $usedisterms || $weights['post_tag'] || $weights['category'] ) {
62
- $newsql .= "left join $wpdb->term_relationships as terms on ( terms.object_id = wp_posts.ID )
63
- left join $wpdb->term_taxonomy as termtax on ( terms.term_taxonomy_id = termtax.term_taxonomy_id )
64
- left join $wpdb->term_relationships as refterms on ( terms.term_taxonomy_id = refterms.term_taxonomy_id and refterms.object_id = $reference_ID )";
65
- }
66
-
67
- // WHERE
68
-
69
- $newsql .= " where post_status in ( 'publish', 'static' ) and ID != '$reference_ID'";
70
-
71
- if ($past_only) // 3.1.8: revised $past_only option
72
- $newsql .= " and post_date <= '$reference_post->post_date' ";
73
- if ( !$show_pass_post )
74
- $newsql .= " and post_password ='' ";
75
- if ( $recent_only )
76
- $newsql .= " and post_date > date_sub(now(), interval $recent_number $recent_units) ";
77
-
78
- $newsql .= " and post_type = 'post'";
79
-
80
- // GROUP BY
81
- $newsql .= "\n group by ID \n";
82
-
83
- // HAVING
84
- // number_format fix suggested by vkovalcik! :)
85
- $safethreshold = number_format(max($threshold,0.1), 2, '.', '');
86
- $newsql .= " having score >= $safethreshold";
87
- if ( $usedisterms ) {
88
- $disterms = implode(',', $disterms);
89
- $newsql .= " and bit_and(termtax.term_id in ($disterms)) = 0";
90
- }
91
-
92
- if ( $categories == 3 )
93
- $newsql .= ' and '.$criteria['category'].' >= 1';
94
- if ( $categories == 4 )
95
- $newsql .= ' and '.$criteria['category'].' >= 2';
96
- if ( $tags == 3 )
97
- $newsql .= ' and '.$criteria['post_tag'].' >= 1';
98
- if ( $tags == 4 )
99
- $newsql .= ' and '.$criteria['post_tag'].' >= 2';
100
-
101
- // The maximum number of items we'll ever want to cache
102
- $limit = max(yarpp_get_option('limit'), yarpp_get_option('rss_limit'));
103
- $newsql .= " order by score desc limit $limit";
104
-
105
- // in caching, we cross-relate regardless of whether we're going to actually
106
- // use it or not.
107
- $newsql = "($newsql) union (".str_replace("post_type = 'post'","post_type = 'page'",$newsql).")";
108
-
109
- if ($yarpp->debug) echo "<!--$newsql-->";
110
- return $newsql;
111
- }
112
-
113
/* new in 2.1! the domain argument refers to {website,widget,rss}, though widget is not used yet. */
114
115
/* new in 3.0! new query-based approach: EXTREMELY HACKY! */
2
3
//=CACHING===========
4
5
/* new in 2.1! the domain argument refers to {website,widget,rss}, though widget is not used yet. */
6
7
/* new in 3.0! new query-based approach: EXTREMELY HACKY! */
options-meta-boxes.php CHANGED
@@ -30,30 +30,17 @@ class YARPP_Meta_Box {
30
</tr>";
31
}
32
33
- function importance($option,$desc,$type='word',$tr="<tr valign='top'>
34
- <th scope='row'>",$inputplus = '') {
35
- $value = yarpp_get_option($option);
36
-
37
- // $type could be...
38
- __('word','yarpp');
39
- __('tag','yarpp');
40
- __('category','yarpp');
41
-
42
- echo " $tr$desc</th>
43
- <td>
44
- <select name='$option'>
45
- <option $inputplus value='1'". (($value == 1) ? ' selected="selected"': '' )." > ".__("do not consider",'yarpp')."</option>
46
- <option $inputplus value='2'". (($value == 2) ? ' selected="selected"': '' )." > ".__("consider",'yarpp')."</option>
47
- <option $inputplus value='3'". (($value == 3) ? ' selected="selected"': '' )." >
48
- ".sprintf(__("require at least one %s in common",'yarpp'),__($type,'yarpp'))."</option>
49
- <option $inputplus value='4'". (($value == 4) ? ' selected="selected"': '' )." >
50
- ".sprintf(__("require more than one %s in common",'yarpp'),__($type,'yarpp'))."</option>
51
- </select>
52
- </td>
53
- </tr>";
54
}
55
56
- function importance2($option,$desc,$type='word',$tr="<tr valign='top'>
57
<th scope='row'>",$inputplus = '') {
58
$value = yarpp_get_option($option);
59
@@ -68,22 +55,22 @@ class YARPP_Meta_Box {
68
</tr>";
69
}
70
71
- function select($option,$desc,$type='word',$tr="<tr valign='top'>
72
- <th scope='row'>",$inputplus = '') {
73
- $value = yarpp_get_option($option);
74
-
75
- echo " $tr$desc</th>
76
- <td>
77
- <input $inputplus type='radio' name='$option' value='1'". (($value == 1) ? ' checked="checked"': '' )." />
78
- ".__("do not consider",'yarpp')."
79
- <input $inputplus type='radio' name='$option' value='2'". (($value == 2) ? ' checked="checked"': '' )." />
80
- ".__("consider",'yarpp')."
81
- <input $inputplus type='radio' name='$option' value='3'". (($value == 3) ? ' checked="checked"': '' )." />
82
- ".sprintf(__("require at least one %s in common",'yarpp'),__($type,'yarpp'))."
83
- <input $inputplus type='radio' name='$option' value='4'". (($value == 4) ? ' checked="checked"': '' )." />
84
- ".sprintf(__("require more than one %s in common",'yarpp'),__($type,'yarpp'))."
85
</td>
86
- </tr>";
87
}
88
}
89
@@ -108,14 +95,16 @@ if ( !empty($exclude_terms[$taxonomy]) ) {
108
}
109
110
function display() {
111
?>
112
<p><?php _e('"The Pool" refers to the pool of posts and pages that are candidates for display as related to the current entry.','yarpp');?></p>
113
114
<table class="form-table" style="margin-top: 0; clear:none;">
115
<tbody>
116
<?php
117
- $this->exclude('category', __('Disallow by category:','yarpp'));
118
- $this->exclude('post_tag', __('Disallow by tag:','yarpp'));
119
$this->checkbox('show_pass_post',__("Show password protected posts?",'yarpp'));
120
121
$recent_number = "<input name=\"recent_number\" type=\"text\" id=\"recent_number\" value=\"".esc_attr(yarpp_get_option('recent_number'))."\" size=\"2\" />";
@@ -138,7 +127,7 @@ add_meta_box('yarpp_pool', __('"The Pool"','yarpp'), array(new YARPP_Meta_Box_Po
138
139
class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
140
function display() {
141
- global $yarpp_myisam;
142
?>
143
<p><?php _e('YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>.','yarpp');?> <a href="#" class='info'><?php _e('more&gt;','yarpp');?><span><?php _e('The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshhold, take a look at some post\'s related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site.','yarpp');?></span></a></p>
144
@@ -147,14 +136,15 @@ class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
147
148
<?php
149
$this->textbox('threshold',__('Match threshold:','yarpp'));
150
- $this->importance2('title',__("Titles: ",'yarpp'),'word',"<tr valign='top'>
151
- <th scope='row'>",(!$yarpp_myisam?' readonly="readonly" disabled="disabled"':''));
152
- $this->importance2('body',__("Bodies: ",'yarpp'),'word',"<tr valign='top'>
153
- <th scope='row'>",(!$yarpp_myisam?' readonly="readonly" disabled="disabled"':''));
154
- $this->importance('tags',__("Tags: ",'yarpp'),'tag',"<tr valign='top'>
155
- <th scope='row'>",'');
156
- $this->importance('categories',__("Categories: ",'yarpp'),'category',"<tr valign='top'>
157
- <th scope='row'>",'');
158
$this->checkbox('cross_relate',__("Cross-relate posts and pages?",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("When the \"Cross-relate posts and pages\" option is selected, the <code>related_posts()</code>, <code>related_pages()</code>, and <code>related_entries()</code> all will give the same output, returning both related pages and posts.",'yarpp')."</span></a>");
159
$this->checkbox('past_only',__("Show only previous posts?",'yarpp'));
160
?>
@@ -168,7 +158,7 @@ add_meta_box('yarpp_relatedness', __('"Relatedness" options','yarpp'), array(new
168
169
class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
170
function display() {
171
- global $yarpp_templates;
172
?>
173
<table class="form-table" style="margin-top: 0; clear:none;">
174
<tbody>
@@ -177,7 +167,7 @@ class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
177
<th class='th-full' colspan='2' scope='row' style='width:100%;'>",'','<td rowspan="3" style="border-left:8px transparent solid;"><b>'.__("Website display code example",'yarpp').'</b><br /><small>'.__("(Update options to reload.)",'yarpp').'</small><br/>'
178
."<div id='display_demo_web' style='overflow:auto;width:350px;max-height:500px;'></div></td>");
179
$this->textbox('limit',__('Maximum number of related posts:','yarpp'));
180
- $this->checkbox('use_template',__("Display using a custom template file",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="template"'.(!(is_array($yarpp_templates) && count($yarpp_templates))?' disabled="disabled"':'')); ?>
181
</tbody></table>
182
<table class="form-table" style="clear:none;"><tbody>
183
<tr valign='top' class='templated'>
@@ -204,23 +194,13 @@ class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
204
</td>
205
</tr>
206
207
- <tr valign='top'>
208
- <th><?php _e("Order results:",'yarpp');?></th>
209
- <td><select name="order" id="order">
210
- <?php $order = yarpp_get_option('order'); ?>
211
- <option value="score DESC" <?php echo ($order == 'score DESC'?' selected="selected"':'')?>><?php _e("score (high relevance to low)",'yarpp');?></option>
212
- <option value="score ASC" <?php echo ($order == 'score ASC'?' selected="selected"':'')?>><?php _e("score (low relevance to high)",'yarpp');?></option>
213
- <option value="post_date DESC" <?php echo ($order == 'post_date DESC'?' selected="selected"':'')?>><?php _e("date (new to old)",'yarpp');?></option>
214
- <option value="post_date ASC" <?php echo ($order == 'post_date ASC'?' selected="selected"':'')?>><?php _e("date (old to new)",'yarpp');?></option>
215
- <option value="post_title ASC" <?php echo ($order == 'post_title ASC'?' selected="selected"':'')?>><?php _e("title (alphabetical)",'yarpp');?></option>
216
- <option value="post_title DESC" <?php echo ($order == 'post_title DESC'?' selected="selected"':'')?>><?php _e("title (reverse alphabetical)",'yarpp');?></option>
217
- </select>
218
- </td>
219
- </tr>
220
-
221
- <?php $this->textbox('no_results',__('Default display if no results:','yarpp'),'40',"<tr class='not_templated' valign='top'>
222
- <th>")?>
223
- <?php $this->checkbox('promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')
224
." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>"
225
.sprintf(__("This option will add the code %s. Try turning it on, updating your options, and see the code in the code example to the right. These links and donations are greatly appreciated.", 'yarpp'),"<code>".htmlspecialchars(sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org'))."</code>") ."</span></a>"); ?>
226
</tbody>
@@ -233,7 +213,7 @@ add_meta_box('yarpp_display_web', __('Display options <small>for your website</s
233
234
class YARPP_Meta_Box_Display_Feed extends YARPP_Meta_Box {
235
function display() {
236
- global $yarpp_templates;
237
?>
238
<table class="form-table" style="margin-top: 0; clear:none;"><tbody>
239
<?php
@@ -245,7 +225,7 @@ $this->checkbox('rss_excerpt_display',__("Display related posts in the descripti
245
246
$this->textbox('rss_limit',__('Maximum number of related posts:','yarpp'),2, "<tr valign='top' class='rss_displayed'>
247
<th scope='row'>");
248
- $this->checkbox('rss_use_template',__("Display using a custom template file",'yarpp')." <!--<span style='color:red;'>".__('NEW!','yarpp')."</span>--> <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP.",'yarpp')."</span></a>","<tr valign='top' class='rss_displayed'><th colspan='2'>",' class="rss_template"'.(!(is_array($yarpp_templates) && count($yarpp_templates))?' disabled="disabled"':'')); ?>
249
</tbody></table>
250
<table class="form-table rss_displayed" style="clear:none;">
251
<tbody>
@@ -269,22 +249,9 @@ $this->checkbox('rss_excerpt_display',__("Display related posts in the descripti
269
270
$this->beforeafter(array('rss_before_post', 'rss_after_post'),__("Before / after (excerpt):",'yarpp'),10,"<tr class='rss_excerpted' valign='top'>\r\t\t\t\t<th>", __("For example:",'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ','yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
271
272
- ?>
273
- <tr class='rss_displayed' valign='top'>
274
- <th><?php _e("Order results:",'yarpp');?></th>
275
- <td><select name="rss_order" id="rss_order">
276
- <?php $order = yarpp_get_option('rss_order'); ?>
277
- <option value="score DESC" <?php echo ($order=='score DESC'?' selected="selected"':'')?>><?php _e("score (high relevance to low)",'yarpp');?></option>
278
- <option value="score ASC" <?php echo ($order == 'score ASC'?' selected="selected"':'')?>><?php _e("score (low relevance to high)",'yarpp');?></option>
279
- <option value="post_date DESC" <?php echo ($order == 'post_date DESC'?' selected="selected"':'')?>><?php _e("date (new to old)",'yarpp');?></option>
280
- <option value="post_date ASC" <?php echo ($order == 'post_date ASC'?' selected="selected"':'')?>><?php _e("date (old to new)",'yarpp');?></option>
281
- <option value="post_title ASC" <?php echo ($order == 'post_title ASC'?' selected="selected"':'')?>><?php _e("title (alphabetical)",'yarpp');?></option>
282
- <option value="post_title DESC" <?php echo ($order == 'post_title DESC'?' selected="selected"':'')?>><?php _e("title (reverse alphabetical)",'yarpp');?></option>
283
- </select>
284
- </td>
285
- </tr>
286
-
287
- <?php $this->textbox('rss_no_results',__('Default display if no results:','yarpp'),'40',"<tr valign='top' class='rss_not_templated'>
288
<th scope='row'>")?>
289
<?php $this->checkbox('rss_promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>"
290
.sprintf(__("This option will add the code %s. Try turning it on, updating your options, and see the code in the code example to the right. These links and donations are greatly appreciated.", 'yarpp'),"<code>".htmlspecialchars(sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org'))."</code>") ."</span></a>","<tr valign='top' class='rss_displayed'>
30
</tr>";
31
}
32
33
+ function tax_importance($taxonomy) {
34
+ $value = yarpp_get_option("weight[tax][{$taxonomy->name}]");
35
+ echo "<tr valign='top'><th scope='row'>{$taxonomy->labels->name}:</th><td><select name='weight[tax][{$taxonomy->name}]'>";
36
+ echo "<option $inputplus value='1'". (($value == 1) ? ' selected="selected"': '' )." > " . __("do not consider",'yarpp') . "</option>";
37
+ echo "<option $inputplus value='2'". (($value == 2) ? ' selected="selected"': '' )." >" . __("consider",'yarpp') . "</option>";
38
+ echo "<option $inputplus value='3'". (($value == 3) ? ' selected="selected"': '' )." >" . sprintf(__("require at least one %s in common",'yarpp'),$taxonomy->labels->singular_name) . "</option>";
39
+ echo "<option $inputplus value='4'". (($value == 4) ? ' selected="selected"': '' )." >" . sprintf(__("require more than one %s in common",'yarpp'),$taxonomy->labels->singular_name) . "</option>";
40
+ echo "</select></td></tr>";
41
}
42
43
+ function importance2($option,$desc,$tr="<tr valign='top'>
44
<th scope='row'>",$inputplus = '') {
45
$value = yarpp_get_option($option);
46
55
</tr>";
56
}
57
58
+ function displayorder( $option, $class = '' ) {
59
+ ?>
60
+ <tr<?php if (!empty($class)) echo " class='$class'"; ?> valign='top'>
61
+ <th><?php _e("Order results:",'yarpp');?></th>
62
+ <td><select name="<?php echo $option; ?>" id="<?php echo $option; ?>">
63
+ <?php $order = yarpp_get_option($option); ?>
64
+ <option value="score DESC" <?php echo ($order == 'score DESC'?' selected="selected"':'')?>><?php _e("score (high relevance to low)",'yarpp');?></option>
65
+ <option value="score ASC" <?php echo ($order == 'score ASC'?' selected="selected"':'')?>><?php _e("score (low relevance to high)",'yarpp');?></option>
66
+ <option value="post_date DESC" <?php echo ($order == 'post_date DESC'?' selected="selected"':'')?>><?php _e("date (new to old)",'yarpp');?></option>
67
+ <option value="post_date ASC" <?php echo ($order == 'post_date ASC'?' selected="selected"':'')?>><?php _e("date (old to new)",'yarpp');?></option>
68
+ <option value="post_title ASC" <?php echo ($order == 'post_title ASC'?' selected="selected"':'')?>><?php _e("title (alphabetical)",'yarpp');?></option>
69
+ <option value="post_title DESC" <?php echo ($order == 'post_title DESC'?' selected="selected"':'')?>><?php _e("title (reverse alphabetical)",'yarpp');?></option>
70
+ </select>
71
</td>
72
+ </tr>
73
+ <?php
74
}
75
}
76
95
}
96
97
function display() {
98
+ global $yarpp;
99
?>
100
<p><?php _e('"The Pool" refers to the pool of posts and pages that are candidates for display as related to the current entry.','yarpp');?></p>
101
102
<table class="form-table" style="margin-top: 0; clear:none;">
103
<tbody>
104
<?php
105
+ foreach ($yarpp->get_taxonomies() as $taxonomy) {
106
+ $this->exclude($taxonomy->name, sprintf(__('Disallow by %s:','yarpp'), $taxonomy->labels->singular_name));
107
+ }
108
$this->checkbox('show_pass_post',__("Show password protected posts?",'yarpp'));
109
110
$recent_number = "<input name=\"recent_number\" type=\"text\" id=\"recent_number\" value=\"".esc_attr(yarpp_get_option('recent_number'))."\" size=\"2\" />";
127
128
class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
129
function display() {
130
+ global $yarpp;
131
?>
132
<p><?php _e('YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>.','yarpp');?> <a href="#" class='info'><?php _e('more&gt;','yarpp');?><span><?php _e('The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshhold, take a look at some post\'s related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site.','yarpp');?></span></a></p>
133
136
137
<?php
138
$this->textbox('threshold',__('Match threshold:','yarpp'));
139
+ $this->importance2('weight[title]',__("Titles: ",'yarpp'),"<tr valign='top'>
140
+ <th scope='row'>",( !$yarpp->myisam ? ' readonly="readonly" disabled="disabled"':'' ));
141
+ $this->importance2('weight[body]',__("Bodies: ",'yarpp'),"<tr valign='top'>
142
+ <th scope='row'>",( !$yarpp->myisam ? ' readonly="readonly" disabled="disabled"':'' ));
143
+
144
+ foreach ($yarpp->get_taxonomies() as $taxonomy) {
145
+ $this->tax_importance($taxonomy);
146
+ }
147
+
148
$this->checkbox('cross_relate',__("Cross-relate posts and pages?",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("When the \"Cross-relate posts and pages\" option is selected, the <code>related_posts()</code>, <code>related_pages()</code>, and <code>related_entries()</code> all will give the same output, returning both related pages and posts.",'yarpp')."</span></a>");
149
$this->checkbox('past_only',__("Show only previous posts?",'yarpp'));
150
?>
158
159
class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
160
function display() {
161
+ global $yarpp;
162
?>
163
<table class="form-table" style="margin-top: 0; clear:none;">
164
<tbody>
167
<th class='th-full' colspan='2' scope='row' style='width:100%;'>",'','<td rowspan="3" style="border-left:8px transparent solid;"><b>'.__("Website display code example",'yarpp').'</b><br /><small>'.__("(Update options to reload.)",'yarpp').'</small><br/>'
168
."<div id='display_demo_web' style='overflow:auto;width:350px;max-height:500px;'></div></td>");
169
$this->textbox('limit',__('Maximum number of related posts:','yarpp'));
170
+ $this->checkbox('use_template',__("Display using a custom template file",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="template"'.(!(is_array($yarpp->templates) && count($yarpp->templates))?' disabled="disabled"':'')); ?>
171
</tbody></table>
172
<table class="form-table" style="clear:none;"><tbody>
173
<tr valign='top' class='templated'>
194
</td>
195
</tr>
196
197
+ <?php
198
+ $this->displayorder('order');
199
+
200
+ $this->textbox('no_results',__('Default display if no results:','yarpp'),'40',"<tr class='not_templated' valign='top'>
201
+ <th>");
202
+
203
+ $this->checkbox('promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')
204
." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>"
205
.sprintf(__("This option will add the code %s. Try turning it on, updating your options, and see the code in the code example to the right. These links and donations are greatly appreciated.", 'yarpp'),"<code>".htmlspecialchars(sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org'))."</code>") ."</span></a>"); ?>
206
</tbody>
213
214
class YARPP_Meta_Box_Display_Feed extends YARPP_Meta_Box {
215
function display() {
216
+ global $yarpp;
217
?>
218
<table class="form-table" style="margin-top: 0; clear:none;"><tbody>
219
<?php
225
226
$this->textbox('rss_limit',__('Maximum number of related posts:','yarpp'),2, "<tr valign='top' class='rss_displayed'>
227
<th scope='row'>");
228
+ $this->checkbox('rss_use_template',__("Display using a custom template file",'yarpp')." <!--<span style='color:red;'>".__('NEW!','yarpp')."</span>--> <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP.",'yarpp')."</span></a>","<tr valign='top' class='rss_displayed'><th colspan='2'>",' class="rss_template"'.(!(is_array($yarpp->templates) && count($yarpp->templates))?' disabled="disabled"':'')); ?>
229
</tbody></table>
230
<table class="form-table rss_displayed" style="clear:none;">
231
<tbody>
249
250
$this->beforeafter(array('rss_before_post', 'rss_after_post'),__("Before / after (excerpt):",'yarpp'),10,"<tr class='rss_excerpted' valign='top'>\r\t\t\t\t<th>", __("For example:",'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ','yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
251
252
+ $this->displayorder('rss_order', 'rss_displayed');
253
+
254
+ $this->textbox('rss_no_results',__('Default display if no results:','yarpp'),'40',"<tr valign='top' class='rss_not_templated'>
255
<th scope='row'>")?>
256
<?php $this->checkbox('rss_promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>"
257
.sprintf(__("This option will add the code %s. Try turning it on, updating your options, and see the code in the code example to the right. These links and donations are greatly appreciated.", 'yarpp'),"<code>".htmlspecialchars(sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org'))."</code>") ."</span></a>","<tr valign='top' class='rss_displayed'>
options.php CHANGED
@@ -1,6 +1,6 @@
1
<?php
2
3
- global $wpdb, $yarpp_value_options, $yarpp_binary_options, $wp_version, $yarpp, $yarpp_templates, $yarpp_myisam;
4
5
// Reenforce YARPP setup:
6
if ( !get_option('yarpp_version') )
@@ -14,8 +14,8 @@ if (isset($_GET['action']) && $_GET['action'] == 'flush') {
14
}
15
16
// check to see that templates are in the right place
17
- $yarpp_templates = glob(STYLESHEETPATH . '/yarpp-template-*.php');
18
- if ( !(is_array($yarpp_templates) && count($yarpp_templates)) ) {
19
yarpp_set_option(array('use_template' => false, 'rss_use_template' => false));
20
}
21
@@ -54,7 +54,6 @@ if (isset($_POST['myisam_override'])) {
54
."</div>";
55
}
56
57
- $yarpp_myisam = true;
58
if ( !yarpp_get_option('myisam_override') ) {
59
$yarpp_check_return = $yarpp->myisam_check();
60
if ($yarpp_check_return !== true) { // if it's not *exactly* true
@@ -71,11 +70,11 @@ if ( !yarpp_get_option('myisam_override') ) {
71
."</div>";
72
73
yarpp_set_option(array('title' => 1, 'body' => 1));
74
- $yarpp_myisam = false;
75
}
76
}
77
78
- if ( $yarpp_myisam && !$yarpp->enabled() ) {
79
echo '<div class="updated"><p>';
80
if ( $yarpp->activate() ) {
81
_e('The YARPP database had an error but has been fixed.','yarpp');
@@ -89,14 +88,16 @@ if ( $yarpp_myisam && !$yarpp->enabled() ) {
89
if (isset($_POST['update_yarpp'])) {
90
91
$new_options = array();
92
-
93
- foreach (array_keys($yarpp_value_options) as $option) {
94
- if ( isset($_POST[$option]) && is_string($_POST[$option]) )
95
$new_options[$option] = stripslashes($_POST[$option]);
96
}
97
- foreach (array('title','body','tags','categories') as $key) {
98
- if ( !isset($_POST[$key]) )
99
- $new_options[$key] = 1;
100
}
101
102
// excludes are different
@@ -107,10 +108,6 @@ if (isset($_POST['update_yarpp'])) {
107
$new_options['exclude']['post_tag'] = implode(',',array_keys($exclude['post_tag']));
108
}
109
110
- foreach (array_keys($yarpp_binary_options) as $option) {
111
- $new_options[$option] = isset($_POST[$option]);
112
- }
113
-
114
$new_options = apply_filters( 'yarpp_settings_save', $new_options );
115
yarpp_set_option($new_options);
116
1
<?php
2
3
+ global $wpdb, $wp_version, $yarpp;
4
5
// Reenforce YARPP setup:
6
if ( !get_option('yarpp_version') )
14
}
15
16
// check to see that templates are in the right place
17
+ $yarpp->templates = glob(STYLESHEETPATH . '/yarpp-template-*.php');
18
+ if ( !(is_array($yarpp->templates) && count($yarpp->templates)) ) {
19
yarpp_set_option(array('use_template' => false, 'rss_use_template' => false));
20
}
21
54
."</div>";
55
}
56
57
if ( !yarpp_get_option('myisam_override') ) {
58
$yarpp_check_return = $yarpp->myisam_check();
59
if ($yarpp_check_return !== true) { // if it's not *exactly* true
70
."</div>";
71
72
yarpp_set_option(array('title' => 1, 'body' => 1));
73
+ $yarpp->myisam = false;
74
}
75
}
76
77
+ if ( $yarpp->myisam && !$yarpp->enabled() ) {
78
echo '<div class="updated"><p>';
79
if ( $yarpp->activate() ) {
80
_e('The YARPP database had an error but has been fixed.','yarpp');
88
if (isset($_POST['update_yarpp'])) {
89
90
$new_options = array();
91
+ foreach ($yarpp->default_options as $option => $default) {
92
+ if ( is_bool($default) )
93
+ $new_options[$option] = isset($_POST[$option]);
94
+ if ( (is_string($default) || is_int($default)) &&
95
+ isset($_POST[$option]) && is_string($_POST[$option]) )
96
$new_options[$option] = stripslashes($_POST[$option]);
97
}
98
+
99
+ if ( isset($_POST['weight']) ) {
100
+ $new_options['weight'] = $_POST['weight'];
101
}
102
103
// excludes are different
108
$new_options['exclude']['post_tag'] = implode(',',array_keys($exclude['post_tag']));
109
}
110
111
$new_options = apply_filters( 'yarpp_settings_save', $new_options );
112
yarpp_set_option($new_options);
113
readme.txt CHANGED
@@ -15,16 +15,16 @@ Display a list of related entries on your site and feeds based on a unique algor
15
16
Yet Another Related Posts Plugin (YARPP) gives you a list of posts and/or pages related to the current entry, introducing the reader to other relevant content on your site. Key features include:
17
18
- 1. **An advanced and versatile algorithm**: Using a customizable algorithm considering post titles, content, tags, and categories, YARPP calculates a "match score" for each pair of posts on your blog. You choose the threshold limit for relevance and you get more related posts if there are more related posts and less if there are less. [Learn more](http://wordpress.tv/2011/01/29/michael-%E2%80%9Cmitcho%E2%80%9D-erlewine-the-yet-another-related-posts-plugin-algorithm-explained/)
19
2. **Templating**: The [YARPP templating system](http://mitcho.com/blog/projects/yarpp-3-templates/) puts you in charge of how your posts are displayed.
20
- 3. **Caching**: **Improved in 3.2!** YARPP organically caches the related posts data as your site is visited, greatly improving performance.
21
4. **Related posts in RSS feeds**: Display related posts in your RSS and Atom feeds with custom display options.
22
5. **Disallowing certain tags or categories**: You can choose certain tags or categories as disallowed, meaning any page or post with such tags or categories will not be served up by the plugin.
23
6. **Related posts and pages**: Puts you in control of pulling up related posts, pages, or both.
24
25
This plugin requires PHP 5 and MySQL 4.1 or greater.
26
27
- YARPP does not yet support custom post types or taxonomies; look for these in a future version.
28
29
**See [other plugins by mitcho](http://profiles.wordpress.org/users/mitchoyoshitaka/)**.
30
@@ -66,10 +66,6 @@ Related posts can also be displayed as a widget. Go to the Design > Widgets opti
66
67
New in version 3.0, YARPP allows the advanced user with knowledge of PHP to customize the display of related posts using a templating mechanism. More information is available [in this tutorial](http://mitcho.com/blog/projects/yarpp-3-templates/).
68
69
- = Manual installation =
70
-
71
- For advanced users with knowledge of PHP, there is also an [advanced manual installation option](http://mitcho.com/code/yarpp/manual-installation/).
72
-
73
== Frequently Asked Questions ==
74
75
If your question isn't here, ask your own question at [the Wordpress.org forums](http://wordpress.org/tags/yet-another-related-posts-plugin?forum_id=10#postform). *Please do not email or tweet with questions.*
@@ -86,17 +82,18 @@ This method can also be used to display YARPP on pages other than single-post di
86
87
= Does YARPP slow down my blog/server? =
88
89
- A little bit, yes. However, YARPP 3.0 introduced a new caching mechanism which greatly reduces the hit of the computationally intensive relatedness computation. In addition, *I highly recommend all YARPP users use a page-caching plugin, such as [WP-SuperCache](http://ocaoimh.ie/wp-super-cache/).*
90
91
If you find that the YARPP database calls are still too database-intensive, try the following:
92
93
* turning off "cross relate posts and pages";
94
* turning on "show only previous posts";
95
- * not considering tags and/or categories in the Relatedness formula;
96
- * not excluding any tags and/or categories in The Pool.
97
98
These options can be found in the "Relatedness" metabox which you can display from the "Screen Options" tab. All of these can improve database performance.
99
100
If you are in the process of looking for a hosting provider whose databases will not balk under YARPP, I personally have had great success with [MediaTemple](http://www.mediatemple.net/go/order/?refdom=mitcho.com).
101
102
= Every page just says "no related posts"! What's up with that? =
@@ -131,7 +128,7 @@ It is recommended that you tweak your match threshold whenever you make changes
131
132
Aside from the DISQUS plugin (see above), currently the only known incompatibility is [with the SEO_Pager plugin](http://wordpress.org/support/topic/267966) and the [Pagebar 2](http://www.elektroelch.de/hacks/wp/pagebar/) plugin. Users of SEO Pager are urged to turn off the automatic display option in SEO Pager and instead add the code manually. There are reports that the [WP Contact Form III plugin and Contact Form Plugin](http://wordpress.org/support/topic/392605) may also be incompatible with YARPP. Other related posts plugins, obviously, may also be incompatible.
133
134
- Please submit similar bugs by starting a new thread on [the Wordpress.org forums](http://wordpress.org/tags/yet-another-related-posts-plugin?forum_id=10#postform). I check the forums regularly and will try to release a quick bugfix.
135
136
= Does YARPP work with full-width characters or languages that don't use spaces between words? =
137
@@ -141,7 +138,7 @@ However, YARPP does have difficulty with languages that don't place spaces betwe
141
142
= Things are weird after I upgraded. =
143
144
- I highly recommend you disactivate YARPP, replace it with the new one, and then reactivate it.
145
146
= Can I clear my cache? =
147
@@ -201,6 +198,7 @@ If you are a bilingual speaker of English and another language and an avid user
201
202
= 3.4 =
203
* Major optimizations to the main related posts query, in particular with regard to taxonomy lookups
204
* [Bug fix](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-version-333-breaks-templates-in-widget): Custom templates could not be used in widget display
205
* Implement lazy/infinite scrolling for the "disallow tags" and "disallow categories," so the YARPP settings screen doesn't lock up the browser for sites which have a crazy number or tags or categories
206
* Significant code cleanup
15
16
Yet Another Related Posts Plugin (YARPP) gives you a list of posts and/or pages related to the current entry, introducing the reader to other relevant content on your site. Key features include:
17
18
+ 1. **An advanced and versatile algorithm**: Using a customizable algorithm considering post titles, content, tags, categories, and **now custom taxonomies**, YARPP finds related content from across your site. **Improved and optimized in 3.4!** [Learn more](http://wordpress.tv/2011/01/29/michael-%E2%80%9Cmitcho%E2%80%9D-erlewine-the-yet-another-related-posts-plugin-algorithm-explained/)
19
2. **Templating**: The [YARPP templating system](http://mitcho.com/blog/projects/yarpp-3-templates/) puts you in charge of how your posts are displayed.
20
+ 3. **Caching**: YARPP organically caches the related posts data as your site is visited, greatly improving performance.
21
4. **Related posts in RSS feeds**: Display related posts in your RSS and Atom feeds with custom display options.
22
5. **Disallowing certain tags or categories**: You can choose certain tags or categories as disallowed, meaning any page or post with such tags or categories will not be served up by the plugin.
23
6. **Related posts and pages**: Puts you in control of pulling up related posts, pages, or both.
24
25
This plugin requires PHP 5 and MySQL 4.1 or greater.
26
27
+ YARPP does not yet support custom post types; look for these in a future version.
28
29
**See [other plugins by mitcho](http://profiles.wordpress.org/users/mitchoyoshitaka/)**.
30
66
67
New in version 3.0, YARPP allows the advanced user with knowledge of PHP to customize the display of related posts using a templating mechanism. More information is available [in this tutorial](http://mitcho.com/blog/projects/yarpp-3-templates/).
68
69
== Frequently Asked Questions ==
70
71
If your question isn't here, ask your own question at [the Wordpress.org forums](http://wordpress.org/tags/yet-another-related-posts-plugin?forum_id=10#postform). *Please do not email or tweet with questions.*
82
83
= Does YARPP slow down my blog/server? =
84
85
+ The YARPP calculation of related content does make a little impact, yes. However, YARPP caches all of its results, so any post's results need only be calculated once. In addition, *I highly recommend all YARPP users use a page-caching plugin, such as [WP-SuperCache](http://ocaoimh.ie/wp-super-cache/).*
86
87
If you find that the YARPP database calls are still too database-intensive, try the following:
88
89
* turning off "cross relate posts and pages";
90
* turning on "show only previous posts";
91
+ * not considering any taxonomies (tags, categories, etc.) in the Relatedness formula and not excluding any content by taxonomy in The Pool.
92
93
These options can be found in the "Relatedness" metabox which you can display from the "Screen Options" tab. All of these can improve database performance.
94
95
+ If you are running a large site and need to throttle YARPP's computation, try the official [YARPP Experiments](http://wordpress.org/extend/plugins/yarpp-experiments/) plugin which adds this throttling functionality.
96
+
97
If you are in the process of looking for a hosting provider whose databases will not balk under YARPP, I personally have had great success with [MediaTemple](http://www.mediatemple.net/go/order/?refdom=mitcho.com).
98
99
= Every page just says "no related posts"! What's up with that? =
128
129
Aside from the DISQUS plugin (see above), currently the only known incompatibility is [with the SEO_Pager plugin](http://wordpress.org/support/topic/267966) and the [Pagebar 2](http://www.elektroelch.de/hacks/wp/pagebar/) plugin. Users of SEO Pager are urged to turn off the automatic display option in SEO Pager and instead add the code manually. There are reports that the [WP Contact Form III plugin and Contact Form Plugin](http://wordpress.org/support/topic/392605) may also be incompatible with YARPP. Other related posts plugins, obviously, may also be incompatible.
130
131
+ Please submit similar bugs by starting a new thread on [the WordPress.org forums](http://wordpress.org/tags/yet-another-related-posts-plugin?forum_id=10#postform). I check the forums regularly and will try to release a quick bugfix.
132
133
= Does YARPP work with full-width characters or languages that don't use spaces between words? =
134
138
139
= Things are weird after I upgraded. =
140
141
+ I highly recommend you disactivate YARPP, replace the YARPP files on the server with a fresh copy of the new version, and then reactivate it. Visit the YARPP settings page ("Related Posts") to verify your settings.
142
143
= Can I clear my cache? =
144
198
199
= 3.4 =
200
* Major optimizations to the main related posts query, in particular with regard to taxonomy lookups
201
+ * Now can consider custom taxonomies (of posts and pages), in addition to tags and cateogories! Custom taxonomies can also be used to exclude certain content.
202
* [Bug fix](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-version-333-breaks-templates-in-widget): Custom templates could not be used in widget display
203
* Implement lazy/infinite scrolling for the "disallow tags" and "disallow categories," so the YARPP settings screen doesn't lock up the browser for sites which have a crazy number or tags or categories
204
* Significant code cleanup
yarpp.php CHANGED
@@ -3,13 +3,13 @@
3
Plugin Name: Yet Another Related Posts Plugin
4
Plugin URI: http://yarpp.org/
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.4b7
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
10
*/
11
12
- define('YARPP_VERSION', '3.4b7');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');
3
Plugin Name: Yet Another Related Posts Plugin
4
Plugin URI: http://yarpp.org/
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.4b8
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
10
*/
11
12
+ define('YARPP_VERSION', '3.4b8');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');