Yet Another Related Posts Plugin (YARPP) - Version 3.4.4b2

Version Description

Download this release

Release Info

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

Code changes from version 3.4.4b1 to 3.4.4b2

cache-postmeta.php CHANGED
@@ -28,11 +28,11 @@ class YARPP_Cache_Postmeta extends YARPP_Cache {
28
}
29
30
public function upgrade( $last_version ) {
31
- global $wpdb;
32
if ( $last_version && version_compare('3.4b1', $last_version) > 0 ) {
33
// 3.4 moved _yarpp_body_keywords and _yarpp_title_keywords into the single
34
// postmeta _yarpp_keywords, so clear out the old data now.
35
- $wpdb->query("delete from {$wpdb->postmeta} where (meta_key = '_yarpp_title_keywords' or meta_key = '_yarpp_body_keywords')");
36
}
37
}
38
@@ -58,7 +58,6 @@ class YARPP_Cache_Postmeta extends YARPP_Cache {
58
*/
59
public function where_filter($arg) {
60
global $wpdb;
61
- $threshold = yarpp_get_option('threshold');
62
// modify the where clause to use the related ID list.
63
if (!count($this->related_IDs))
64
$this->related_IDs = array(0);
@@ -93,7 +92,6 @@ class YARPP_Cache_Postmeta extends YARPP_Cache {
93
}
94
95
public function limit_filter($arg) {
96
- global $wpdb;
97
if ($this->online_limit)
98
return " limit {$this->online_limit} ";
99
return $arg;
@@ -107,7 +105,7 @@ class YARPP_Cache_Postmeta extends YARPP_Cache {
107
// get the related posts from postmeta, and also construct the relate_IDs array
108
$this->related_postdata = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
109
if (is_array($this->related_postdata) && count($this->related_postdata))
110
- $this->related_IDs = array_map(create_function('$x','return $x["ID"];'), $this->related_postdata);
111
add_filter('posts_where',array(&$this,'where_filter'));
112
add_filter('posts_orderby',array(&$this,'orderby_filter'));
113
add_filter('posts_fields',array(&$this,'fields_filter'));
@@ -163,7 +161,7 @@ class YARPP_Cache_Postmeta extends YARPP_Cache {
163
164
$original_related = $this->related($reference_ID);
165
$related = $wpdb->get_results($this->sql($reference_ID), ARRAY_A);
166
- $new_related = array_map(create_function('$x','return $x["ID"];'), $related);
167
168
if ( count($new_related) ) {
169
update_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, $related);
@@ -188,8 +186,8 @@ class YARPP_Cache_Postmeta extends YARPP_Cache {
188
}
189
190
public function flush() {
191
- global $wpdb;
192
- return $wpdb->query("delete from `{$wpdb->postmeta}` where meta_key = '" . YARPP_POSTMETA_RELATED_KEY . "' or meta_key = '" . YARPP_POSTMETA_KEYWORDS_KEY . "'");
193
}
194
195
public function related($reference_ID = null, $related_ID = null) {
@@ -214,7 +212,7 @@ class YARPP_Cache_Postmeta extends YARPP_Cache {
214
$results = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
215
if (!$results || $results == YARPP_NO_RELATED)
216
return array();
217
- return array_map(create_function('$x','return $x["ID"];'), $results);
218
}
219
220
// return a list of entities which list this post as "related"
28
}
29
30
public function upgrade( $last_version ) {
31
if ( $last_version && version_compare('3.4b1', $last_version) > 0 ) {
32
// 3.4 moved _yarpp_body_keywords and _yarpp_title_keywords into the single
33
// postmeta _yarpp_keywords, so clear out the old data now.
34
+ delete_post_meta_by_key('_yarpp_title_keywords');
35
+ delete_post_meta_by_key('_yarpp_body_keywords');
36
}
37
}
38
58
*/
59
public function where_filter($arg) {
60
global $wpdb;
61
// modify the where clause to use the related ID list.
62
if (!count($this->related_IDs))
63
$this->related_IDs = array(0);
92
}
93
94
public function limit_filter($arg) {
95
if ($this->online_limit)
96
return " limit {$this->online_limit} ";
97
return $arg;
105
// get the related posts from postmeta, and also construct the relate_IDs array
106
$this->related_postdata = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
107
if (is_array($this->related_postdata) && count($this->related_postdata))
108
+ $this->related_IDs = wp_list_pluck( $this->related_postdata, 'ID' );
109
add_filter('posts_where',array(&$this,'where_filter'));
110
add_filter('posts_orderby',array(&$this,'orderby_filter'));
111
add_filter('posts_fields',array(&$this,'fields_filter'));
161
162
$original_related = $this->related($reference_ID);
163
$related = $wpdb->get_results($this->sql($reference_ID), ARRAY_A);
164
+ $new_related = wp_list_pluck( $related, 'ID' );
165
166
if ( count($new_related) ) {
167
update_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, $related);
186
}
187
188
public function flush() {
189
+ delete_post_meta_by_key( YARPP_POSTMETA_RELATED_KEY );
190
+ delete_post_meta_by_key( YARPP_POSTMETA_KEYWORDS_KEY );
191
}
192
193
public function related($reference_ID = null, $related_ID = null) {
212
$results = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
213
if (!$results || $results == YARPP_NO_RELATED)
214
return array();
215
+ return wp_list_pluck( $results, 'ID' );
216
}
217
218
// return a list of entities which list this post as "related"
cache-tables.php CHANGED
@@ -19,8 +19,8 @@ class YARPP_Cache_Tables extends YARPP_Cache {
19
global $wpdb;
20
// now check for the cache tables
21
$tabledata = $wpdb->get_col("show tables");
22
- if (array_search($wpdb->prefix . YARPP_TABLES_RELATED_TABLE,$tabledata) !== false &&
23
- array_search($wpdb->prefix . YARPP_TABLES_KEYWORDS_TABLE,$tabledata) !== false)
24
return true;
25
else
26
return false;
19
global $wpdb;
20
// now check for the cache tables
21
$tabledata = $wpdb->get_col("show tables");
22
+ if (in_array($wpdb->prefix . YARPP_TABLES_RELATED_TABLE,$tabledata) !== false &&
23
+ in_array($wpdb->prefix . YARPP_TABLES_KEYWORDS_TABLE,$tabledata) !== false)
24
return true;
25
else
26
return false;
class-admin.php CHANGED
@@ -175,16 +175,13 @@ jQuery(function () {
175
header("HTTP/1.1 200");
176
header("Content-Type: text/html; charset=UTF-8");
177
178
- $exclude = yarpp_get_option('exclude');
179
- if ( isset($exclude[$taxonomy]) )
180
- $exclude = $exclude[$taxonomy];
181
- else
182
- $exclude = array();
183
- if ( 'category' == $taxonomy )
184
- $exclude .= ',' . get_option( 'default_category' );
185
186
$terms = get_terms($taxonomy, array(
187
- 'exclude' => $exclude,
188
'hide_empty' => false,
189
'hierarchical' => false,
190
'number' => 100,
@@ -197,11 +194,19 @@ jQuery(function () {
197
}
198
199
foreach ($terms as $term) {
200
- echo "<span><input type='checkbox' name='exclude[{$taxonomy}][{$term->term_id}]' id='exclude_{$taxonomy}_{$term->term_id}' value='true' /> <label for='exclude_{$taxonomy}_{$term->term_id}'>" . esc_html($term->name) . "</label></span> ";
201
}
202
exit;
203
}
204
205
function ajax_display() {
206
check_ajax_referer( 'yarpp_display' );
207
175
header("HTTP/1.1 200");
176
header("Content-Type: text/html; charset=UTF-8");
177
178
+ $exclude_tt_ids = wp_parse_id_list(yarpp_get_option('exclude'));
179
+ $exclude_term_ids = $this->get_term_ids_from_tt_ids( $taxonomy, $exclude_tt_ids );
180
+ // if ( 'category' == $taxonomy )
181
+ // $exclude .= ',' . get_option( 'default_category' );
182
183
$terms = get_terms($taxonomy, array(
184
+ 'exclude' => $exclude_term_ids,
185
'hide_empty' => false,
186
'hierarchical' => false,
187
'number' => 100,
194
}
195
196
foreach ($terms as $term) {
197
+ echo "<span><input type='checkbox' name='exclude[{$term->term_taxonomy_id}]' id='exclude_{$term->term_taxonomy_id}' value='true' /> <label for='exclude_{$term->term_taxonomy_id}'>" . esc_html($term->name) . "</label></span> ";
198
}
199
exit;
200
}
201
202
+ function get_term_ids_from_tt_ids( $taxonomy, $tt_ids ) {
203
+ global $wpdb;
204
+ $tt_ids = wp_parse_id_list($tt_ids);
205
+ if ( empty($tt_ids) )
206
+ return array();
207
+ return $wpdb->get_col("select term_id from $wpdb->term_taxonomy where taxonomy = '{$taxonomy}' and term_taxonomy_id in (" . join(',', $tt_ids) . ")");
208
+ }
209
+
210
function ajax_display() {
211
check_ajax_referer( 'yarpp_display' );
212
class-cache.php CHANGED
@@ -147,7 +147,7 @@ abstract class YARPP_Cache {
147
$reference_post = $post;
148
}
149
150
- $options = array( 'threshold', 'show_pass_post', 'past_only', 'weight', 'exclude', 'recent_only', 'recent_number', 'recent_units', 'limit' );
151
extract( $this->core->parse_args($args, $options) );
152
// The maximum number of items we'll ever want to cache
153
$limit = max($limit, $this->core->get_option('rss_limit'));
@@ -160,42 +160,22 @@ abstract class YARPP_Cache {
160
161
$newsql .= 'ROUND(0';
162
163
- if ($weight['body'] != 1)
164
- $newsql .= " + (MATCH (post_content) AGAINST ('".$wpdb->escape($keywords['body'])."')) * ". ($weight['body'] == 3 ? 3 : 1);
165
- if ($weight['title'] != 1)
166
- $newsql .= " + (MATCH (post_title) AGAINST ('".$wpdb->escape($keywords['title'])."')) * ". ($weight['title'] == 3 ? 3 : 1);
167
168
// Build tax criteria query parts based on the weights
169
- $tax_criteria = array();
170
- foreach ( $weight['tax'] as $tax => $value ) {
171
- // 1 means don't consider:
172
- if ($value == 1)
173
- continue;
174
-
175
- // @todo maybe reinforce the object term cache?
176
- $terms = get_the_terms($reference_ID, $tax);
177
- // if there are no terms of that tax, it's not worth adding it here.
178
- if ( false === $terms )
179
- continue;
180
-
181
- $tt_ids = wp_list_pluck($terms, 'term_taxonomy_id');
182
- $tax_criteria[$tax] = "count(distinct if( terms.term_taxonomy_id in (" . join(',',$tt_ids) . "), terms.term_taxonomy_id, null ))";
183
- $newsql .= " + " . $tax_criteria[$tax];
184
}
185
186
$newsql .= ',1) as score';
187
188
$newsql .= "\n from $wpdb->posts \n";
189
190
- // @todo do this just once in a schema migration
191
- // Get term_taxonomy_ids of disallowed terms
192
- $exclude_tt_ids = array();
193
- foreach ($exclude as $tax => $term_ids) {
194
- if ( !empty($term_ids) )
195
- $exclude_tt_ids = array_merge( wp_list_pluck(get_terms( $tax, array('include' => $term_ids) ), 'term_taxonomy_id'), $exclude_tt_ids );
196
- }
197
-
198
- if ( count($exclude_tt_ids) || count($tax_criteria) ) {
199
$newsql .= "left join $wpdb->term_relationships as terms on ( terms.object_id = $wpdb->posts.ID ) \n";
200
}
201
@@ -223,11 +203,8 @@ abstract class YARPP_Cache {
223
$newsql .= " and bit_or(terms.term_taxonomy_id in (" . join(',', $exclude_tt_ids) . ")) = 0";
224
}
225
226
- foreach ( $weight['tax'] as $tax => $value ) {
227
- if ( $value == 3 )
228
- $newsql .= ' and '.$tax_criteria[$tax].' >= 1';
229
- if ( $value == 4 )
230
- $newsql .= ' and '.$tax_criteria[$tax].' >= 2';
231
}
232
233
$newsql .= " order by score desc limit $limit";
@@ -249,6 +226,17 @@ abstract class YARPP_Cache {
249
250
return $sql;
251
}
252
253
/**
254
* KEYWORDS
@@ -358,9 +346,8 @@ abstract class YARPP_Cache {
358
}
359
}
360
// Remove words which are only a letter
361
- $mb_strlen_exists = function_exists('mb_strlen');
362
foreach (array_keys($tokens) as $word) {
363
- if ($mb_strlen_exists)
364
if (mb_strlen($word) < 2) unset($tokens[$word]);
365
else
366
if (strlen($word) < 2) unset($tokens[$word]);
@@ -553,7 +540,7 @@ class YARPP_Cache_Bypass extends YARPP_Cache {
553
$this->yarpp_time = true;
554
555
$this->related_postdata = $wpdb->get_results($this->sql($reference_ID, $args), ARRAY_A);
556
- $this->related_IDs = array_map(create_function('$x','return $x["ID"];'), $this->related_postdata);
557
558
add_filter('posts_where',array(&$this,'where_filter'));
559
add_filter('posts_orderby',array(&$this,'orderby_filter'));
@@ -615,16 +602,12 @@ class YARPP_Cache_Bypass extends YARPP_Cache {
615
$results = $wpdb->get_results($this->sql($reference_ID), ARRAY_A);
616
if ( !$results || !count($results) )
617
return false;
618
-
619
if ( is_null($related_ID) ) {
620
- return array_map(create_function('$x','return $x["ID"];'), $results);
621
} else {
622
- foreach($results as $result) {
623
- if ($result['ID'] == $related_ID)
624
- return true;
625
- }
626
}
627
-
628
- return false;
629
}
630
}
147
$reference_post = $post;
148
}
149
150
+ $options = array( 'threshold', 'show_pass_post', 'past_only', 'weight', 'require_tax', 'exclude', 'recent_only', 'recent_number', 'recent_units', 'limit' );
151
extract( $this->core->parse_args($args, $options) );
152
// The maximum number of items we'll ever want to cache
153
$limit = max($limit, $this->core->get_option('rss_limit'));
160
161
$newsql .= 'ROUND(0';
162
163
+ if ((int) @$weight['body'])
164
+ $newsql .= " + (MATCH (post_content) AGAINST ('".$wpdb->escape($keywords['body'])."')) * ". absint($weight['body']);
165
+ if ((int) @$weight['title'])
166
+ $newsql .= " + (MATCH (post_title) AGAINST ('".$wpdb->escape($keywords['title'])."')) * ". absint($weight['title']);
167
168
// Build tax criteria query parts based on the weights
169
+ foreach ( $weight['tax'] as $tax => $weight ) {
170
+ $newsql .= " + " . $this->tax_criteria($reference_ID, $tax) . " * " . intval($weight);
171
}
172
173
$newsql .= ',1) as score';
174
175
$newsql .= "\n from $wpdb->posts \n";
176
177
+ $exclude_tt_ids = wp_parse_id_list( $exclude );
178
+ if ( count($exclude_tt_ids) || count($weight['tax']) || count($require_tax) ) {
179
$newsql .= "left join $wpdb->term_relationships as terms on ( terms.object_id = $wpdb->posts.ID ) \n";
180
}
181
203
$newsql .= " and bit_or(terms.term_taxonomy_id in (" . join(',', $exclude_tt_ids) . ")) = 0";
204
}
205
206
+ foreach ( $require_tax as $tax => $number ) {
207
+ $newsql .= ' and ' . $this->tax_criteria($reference_ID, $tax) . ' >= ' . intval($number);
208
}
209
210
$newsql .= " order by score desc limit $limit";
226
227
return $sql;
228
}
229
+
230
+ private function tax_criteria( $reference_ID, $taxonomy ) {
231
+ // @todo maybe reinforce the object term cache?
232
+ $terms = get_the_terms( $reference_ID, $taxonomy );
233
+ // if there are no terms of that tax
234
+ if ( false === $terms )
235
+ return '(1 = 0)';
236
+
237
+ $tt_ids = wp_list_pluck($terms, 'term_taxonomy_id');
238
+ return "count(distinct if( terms.term_taxonomy_id in (" . join(',',$tt_ids) . "), terms.term_taxonomy_id, null ))";
239
+ }
240
241
/**
242
* KEYWORDS
346
}
347
}
348
// Remove words which are only a letter
349
foreach (array_keys($tokens) as $word) {
350
+ if ( function_exists('mb_strlen') )
351
if (mb_strlen($word) < 2) unset($tokens[$word]);
352
else
353
if (strlen($word) < 2) unset($tokens[$word]);
540
$this->yarpp_time = true;
541
542
$this->related_postdata = $wpdb->get_results($this->sql($reference_ID, $args), ARRAY_A);
543
+ $this->related_IDs = wp_list_pluck( $this->related_postdata, 'ID' );
544
545
add_filter('posts_where',array(&$this,'where_filter'));
546
add_filter('posts_orderby',array(&$this,'orderby_filter'));
602
$results = $wpdb->get_results($this->sql($reference_ID), ARRAY_A);
603
if ( !$results || !count($results) )
604
return false;
605
+
606
+ $results_ids = wp_list_pluck( $results, 'ID' );
607
if ( is_null($related_ID) ) {
608
+ return $results_ids;
609
} else {
610
+ return in_array( $related_ID, $results_ids );
611
}
612
}
613
}
class-core.php CHANGED
@@ -18,8 +18,6 @@ class YARPP {
18
19
// 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.
20
public $default_options = array();
21
- // These are options which, when updated, will trigger a clearing of the cache
22
- public $clear_cache_options = array( 'show_pass_post', 'recent_only', 'threshold', 'weight');
23
24
function __construct() {
25
$this->load_default_options();
@@ -103,15 +101,16 @@ class YARPP {
103
'promote_yarpp' => false,
104
'rss_promote_yarpp' => false,
105
'myisam_override' => false,
106
- 'exclude' => array(), // conslidated YARPP 3.4
107
- 'weight' => array( // consolidated in YARPP 3.4
108
- 'title' => 2,
109
- 'body' => 2,
110
'tax' => array(
111
- 'category' => 2, // changed default in 3.4
112
- 'post_tag' => 2
113
)
114
- )
115
);
116
}
117
@@ -119,17 +118,24 @@ class YARPP {
119
$current_options = $this->get_option();
120
121
// we can call yarpp_set_option(key,value) if we like:
122
- if ( !is_array($options) && isset($value) )
123
- $options = array( $options => $value );
124
125
$new_options = array_merge( $current_options, $options );
126
127
// new in 3.1: clear cache when updating certain settings.
128
- $new_options_which_require_flush = array_intersect( array_keys( array_diff_assoc($options, $current_options) ), $this->clear_cache_options );
129
if ( count($new_options_which_require_flush) ||
130
- ( isset($options['exclude']) && $options['exclude'] != $current_options['exclude'] ) ||
131
- ( isset($options['weight']) && $options['weight'] != $current_options['weight'] ) )
132
- $this->cache->flush();
133
134
update_option( 'yarpp', $new_options );
135
}
@@ -139,18 +145,7 @@ class YARPP {
139
$options = (array) get_option( 'yarpp', array() );
140
// ensure defaults if not set:
141
$options = array_merge( $this->default_options, $options );
142
- // some extra work is required for arrays:
143
- foreach ( $this->default_options as $key => $default ) {
144
- if ( !is_array($default) )
145
- continue;
146
- if ( isset($options[$key]) && is_array($options[$key]) )
147
- $options[$key] = array_merge( $this->default_options[$key], (array) $options[$key] );
148
- else
149
- $options[$key] = $this->default_options[$key];
150
- }
151
- if ( !isset($options['weight']['tax']) )
152
- $options['weight']['tax'] = $this->default_options['weight']['tax'];
153
-
154
if ( is_null( $option ) )
155
return $options;
156
@@ -244,6 +239,8 @@ class YARPP {
244
$this->upgrade_3_4b5();
245
if ( $last_version && version_compare('3.4b8', $last_version) > 0 )
246
$this->upgrade_3_4b8();
247
248
$this->cache->upgrade($last_version);
249
// flush cache in 3.4.1b5 as 3.4 messed up calculations.
@@ -356,11 +353,11 @@ class YARPP {
356
function upgrade_3_4b8() {
357
$options = $this->get_option();
358
$options['weight'] = array(
359
- 'title' => (int) $options['title'],
360
- 'body' => (int) $options['body'],
361
'tax' => array(
362
- 'post_tag' => (int) $options['tags'],
363
- 'category' => (int) $options['categories'],
364
)
365
);
366
@@ -378,6 +375,45 @@ class YARPP {
378
update_option( 'yarpp', $options );
379
}
380
381
private $post_types = null;
382
function get_post_types( $field = false ) {
383
if ( is_null($this->post_types) ) {
@@ -653,7 +689,7 @@ class YARPP {
653
654
private function setup_active_cache( $args ) {
655
// the options which the main sql query cares about:
656
- $magic_options = array( 'limit', 'threshold', 'show_pass_post', 'past_only', 'weight', 'exclude', 'recent_only', 'recent_number', 'recent_units' );
657
658
$defaults = $this->get_option();
659
foreach ( $magic_options as $option ) {
18
19
// 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.
20
public $default_options = array();
21
22
function __construct() {
23
$this->load_default_options();
101
'promote_yarpp' => false,
102
'rss_promote_yarpp' => false,
103
'myisam_override' => false,
104
+ 'exclude' => '', // conslidated YARPP 3.4 and further in 3.4.4
105
+ 'weight' => array( // consolidated in YARPP 3.4, format changed in 3.4.4
106
+ 'title' => 1,
107
+ 'body' => 1,
108
'tax' => array(
109
+ 'category' => 1, // changed default in 3.4
110
+ 'post_tag' => 1
111
)
112
+ ),
113
+ 'require_tax' => array() // new in 3.4.4
114
);
115
}
116
118
$current_options = $this->get_option();
119
120
// we can call yarpp_set_option(key,value) if we like:
121
+ if ( !is_array($options) ) {
122
+ if ( isset($value) )
123
+ $options = array( $options => $value );
124
+ else
125
+ return false;
126
+ }
127
128
$new_options = array_merge( $current_options, $options );
129
130
// new in 3.1: clear cache when updating certain settings.
131
+ $clear_cache_options = array( 'show_pass_post', 'recent_only', 'threshold' );
132
+ $new_options_which_require_flush = array_intersect( array_keys( array_diff_assoc($options, $current_options) ), $clear_cache_options );
133
if ( count($new_options_which_require_flush) ||
134
+ ( $new_options['limit'] > $current_options['limit'] ) ||
135
+ ( $new_options['weight'] != $current_options['weight'] ) ||
136
+ ( $new_options['exclude'] != $current_options['exclude'] ) ||
137
+ ( $new_options['require_tax'] != $current_options['require_tax'] ) )
138
+ $this->cache->flush();
139
140
update_option( 'yarpp', $new_options );
141
}
145
$options = (array) get_option( 'yarpp', array() );
146
// ensure defaults if not set:
147
$options = array_merge( $this->default_options, $options );
148
+
149
if ( is_null( $option ) )
150
return $options;
151
239
$this->upgrade_3_4b5();
240
if ( $last_version && version_compare('3.4b8', $last_version) > 0 )
241
$this->upgrade_3_4b8();
242
+ if ( $last_version && version_compare('3.4.4b2', $last_version) > 0 )
243
+ $this->upgrade_3_4_4b2();
244
245
$this->cache->upgrade($last_version);
246
// flush cache in 3.4.1b5 as 3.4 messed up calculations.
353
function upgrade_3_4b8() {
354
$options = $this->get_option();
355
$options['weight'] = array(
356
+ 'title' => (int) @$options['title'],
357
+ 'body' => (int) @$options['body'],
358
'tax' => array(
359
+ 'post_tag' => (int) @$options['tags'],
360
+ 'category' => (int) @$options['categories'],
361
)
362
);
363
375
update_option( 'yarpp', $options );
376
}
377
378
+ function upgrade_3_4_4b2() {
379
+ $options = $this->get_option();
380
+
381
+ // update weight values; split out tax weights into weight[tax] and require_tax
382
+ $weight_map = array( 2 => 1, 3 => YARPP_EXTRA_WEIGHT );
383
+ if ((int) $options['weight']['title'] == 1)
384
+ unset( $options['weight']['title'] );
385
+ else
386
+ $options['weight']['title'] = $weight_map[(int) $options['weight']['title']];
387
+
388
+ if ((int) $options['weight']['body'] == 1)
389
+ unset( $options['weight']['body'] );
390
+ else
391
+ $options['weight']['body'] = $weight_map[(int) $options['weight']['body']];
392
+
393
+ $options['require_tax'] = array();
394
+ foreach ( $options['weight']['tax'] as $tax => $value ) {
395
+ if ( $value == 3 )
396
+ $options['require_tax'][$tax] = 1;
397
+ if ( $value == 4 )
398
+ $options['require_tax'][$tax] = 2;
399
+
400
+ if ( $value > 1 )
401
+ $options['weight']['tax'][$tax] = 1;
402
+ else
403
+ unset( $options['weight']['tax'][$tax] );
404
+ }
405
+
406
+ // consolidate excludes, using tt_ids.
407
+ $exclude_tt_ids = array();
408
+ foreach ($options['exclude'] as $tax => $term_ids) {
409
+ if ( !empty($term_ids) )
410
+ $exclude_tt_ids = array_merge( wp_list_pluck(get_terms( $tax, array('include' => $term_ids) ), 'term_taxonomy_id'), $exclude_tt_ids );
411
+ }
412
+ $options['exclude'] = join(',', $exclude_tt_ids);
413
+
414
+ update_option( 'yarpp', $options );
415
+ }
416
+
417
private $post_types = null;
418
function get_post_types( $field = false ) {
419
if ( is_null($this->post_types) ) {
689
690
private function setup_active_cache( $args ) {
691
// the options which the main sql query cares about:
692
+ $magic_options = array( 'limit', 'threshold', 'show_pass_post', 'past_only', 'weight', 'exclude', 'require_tax', 'recent_only', 'recent_number', 'recent_units' );
693
694
$defaults = $this->get_option();
695
foreach ( $magic_options as $option ) {
lang/yarpp-sk_SK.mo ADDED
Binary file
lang/yarpp-sk_SK.po ADDED
@@ -0,0 +1,543 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Yet Another Related Posts Plugin v3.4.3\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2011-12-30 10:47+0000\n"
7
+ "Last-Translator: brozman <v.brozman@gmail.com>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Poedit-Language: Slovak\n"
14
+ "X-Poedit-Country: SLOVAKIA\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
17
+ "X-Poedit-Basepath: ../\n"
18
+ "X-Poedit-Bookmarks: \n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Textdomain-Support: yes"
21
+
22
+ #: class-admin.php:42
23
+ #: class-widget.php:7
24
+ #: class-widget.php:28
25
+ #@ yarpp
26
+ msgid "Related Posts (YARPP)"
27
+ msgstr "Súvisiace články (YARPP)"
28
+
29
+ #: class-admin.php:50
30
+ #@ yarpp
31
+ msgid "Related Posts"
32
+ msgstr "Súvisiace články"
33
+
34
+ #: class-admin.php:50
35
+ #@ default
36
+ msgid "Configure"
37
+ msgstr "Konfigurovať"
38
+
39
+ #: class-admin.php:76
40
+ #@ yarpp
41
+ msgid "Thank you for installing <span>Yet Another Related Posts Plugin</span>!"
42
+ msgstr "Ďakujeme Vám za inštaláciu <span>Yet Another Related Posts Plugin</span>!"
43
+
44
+ #: class-admin.php:77
45
+ #@ yarpp
46
+ msgid "Make sure to visit the <a>Related Posts settings page</a> to customize YARPP."
47
+ msgstr "Navštívte <a>stránku s nastaveniami</a> pre úpravu pluginu YARPP."
48
+
49
+ #: class-admin.php:123
50
+ #@ default
51
+ msgid "Settings"
52
+ msgstr "Nastavenia"
53
+
54
+ #: class-admin.php:149
55
+ #@ yarpp
56
+ msgid "Related entries may be displayed once you save your entry"
57
+ msgstr "Súvisiace články budú zobrazené po tom, ako uložíte vykonané zmeny"
58
+
59
+ #: class-cache.php:525
60
+ #@ yarpp
61
+ msgid "Example post "
62
+ msgstr "Vzorový článok"
63
+
64
+ #: class-core.php:77
65
+ #: class-core.php:88
66
+ #: class-core.php:272
67
+ #: class-core.php:283
68
+ #@ yarpp
69
+ msgid "Related posts:"
70
+ msgstr "Súvisiace články:"
71
+
72
+ #: class-core.php:79
73
+ #: class-core.php:90
74
+ #: class-core.php:274
75
+ #: class-core.php:285
76
+ #: template-metabox.php:30
77
+ #: template-widget.php:13
78
+ #@ yarpp
79
+ msgid "No related posts."
80
+ msgstr "Žiadne súvisiace články."
81
+
82
+ #: class-core.php:510
83
+ #: class-core.php:627
84
+ #: options-meta-boxes.php:205
85
+ #: options-meta-boxes.php:257
86
+ #, php-format
87
+ #@ yarpp
88
+ msgid "Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>."
89
+ msgstr "Tento plugin Vám prináša <a href='%s'>Yet Another Related Posts Plugin</a>."
90
+
91
+ #: class-widget.php:58
92
+ #@ default
93
+ msgid "Title:"
94
+ msgstr "Nadpis:"
95
+
96
+ #: class-widget.php:65
97
+ #: options-meta-boxes.php:170
98
+ #: options-meta-boxes.php:228
99
+ #@ yarpp
100
+ msgid "Display using a custom template file"
101
+ msgstr "Zobraziť pomocou vlastnej šablóny"
102
+
103
+ #: class-widget.php:66
104
+ #: options-meta-boxes.php:174
105
+ #: options-meta-boxes.php:233
106
+ #@ yarpp
107
+ msgid "Template file:"
108
+ msgstr "Súbor šablóny:"
109
+
110
+ #: class-widget.php:74
111
+ #: options-meta-boxes.php:203
112
+ #: options-meta-boxes.php:256
113
+ #@ yarpp
114
+ msgid "Help promote Yet Another Related Posts Plugin?"
115
+ msgstr "Chcete pomôcť s propagáciou Yet Another Related Posts Pluginu?"
116
+
117
+ #: options-meta-boxes.php:36
118
+ #: options-meta-boxes.php:50
119
+ #@ yarpp
120
+ msgid "do not consider"
121
+ msgstr "nebrať do úvahy"
122
+
123
+ #: options-meta-boxes.php:37
124
+ #: options-meta-boxes.php:51
125
+ #@ yarpp
126
+ msgid "consider"
127
+ msgstr "brať do úvahy"
128
+
129
+ #: options-meta-boxes.php:38
130
+ #, php-format
131
+ #@ yarpp
132
+ msgid "require at least one %s in common"
133
+ msgstr "požaduje sa najmenej jedna spoločná %s"
134
+
135
+ #: options-meta-boxes.php:39
136
+ #, php-format
137
+ #@ yarpp
138
+ msgid "require more than one %s in common"
139
+ msgstr "požaduje sa viac ako jedna spoločná %s"
140
+
141
+ #: options-meta-boxes.php:52
142
+ #@ yarpp
143
+ msgid "consider with extra weight"
144
+ msgstr "priradiť extra význam"
145
+
146
+ #: options-meta-boxes.php:61
147
+ #@ yarpp
148
+ msgid "Order results:"
149
+ msgstr "Zoradiť výsledky:"
150
+
151
+ #: options-meta-boxes.php:64
152
+ #@ yarpp
153
+ msgid "score (high relevance to low)"
154
+ msgstr "podľa zhody (od najväčšej po najmenšiu)"
155
+
156
+ #: options-meta-boxes.php:65
157
+ #@ yarpp
158
+ msgid "score (low relevance to high)"
159
+ msgstr "podľa zhody (od najmenšej po najväčšiu)"
160
+
161
+ #: options-meta-boxes.php:66
162
+ #@ yarpp
163
+ msgid "date (new to old)"
164
+ msgstr "podľa dátumu (od najnovšších po najstaršie)"
165
+
166
+ #: options-meta-boxes.php:67
167
+ #@ yarpp
168
+ msgid "date (old to new)"
169
+ msgstr "podľa dátumu (od najstaršších po najnovšie)"
170
+
171
+ #: options-meta-boxes.php:68
172
+ #@ yarpp
173
+ msgid "title (alphabetical)"
174
+ msgstr "podľa nadpisu (abecedne A-Z)"
175
+
176
+ #: options-meta-boxes.php:69
177
+ #@ yarpp
178
+ msgid "title (reverse alphabetical)"
179
+ msgstr "podľa nadpisu (obrátene abecedne Z-A)"
180
+
181
+ #: options-meta-boxes.php:100
182
+ #@ yarpp
183
+ msgid "\"The Pool\" refers to the pool of posts and pages that are candidates for display as related to the current entry."
184
+ msgstr "V \"pokročilých nastaveniach\" môžete nastaviť, ktoré príspevky sa budú zobrazovať ako súvisiace k aktuálnemu záznamu."
185
+
186
+ #: options-meta-boxes.php:106
187
+ #, php-format
188
+ #@ yarpp
189
+ msgid "Disallow by %s:"
190
+ msgstr "Zakázať"
191
+
192
+ #: options-meta-boxes.php:108
193
+ #@ yarpp
194
+ msgid "Show password protected posts?"
195
+ msgstr "Zobraziť články chránené heslom?"
196
+
197
+ #: options-meta-boxes.php:113
198
+ #@ yarpp
199
+ msgid "day(s)"
200
+ msgstr "dni"
201
+
202
+ #: options-meta-boxes.php:114
203
+ #@ yarpp
204
+ msgid "week(s)"
205
+ msgstr "týždne"
206
+
207
+ #: options-meta-boxes.php:115
208
+ #@ yarpp
209
+ msgid "month(s)"
210
+ msgstr "mesiac(e)"
211
+
212
+ #: options-meta-boxes.php:117
213
+ #@ yarpp
214
+ msgid "Show only posts from the past NUMBER UNITS"
215
+ msgstr "Zobraziť len články za posledných NUMBER UNITS"
216
+
217
+ #: options-meta-boxes.php:126
218
+ #@ yarpp
219
+ msgid "\"The Pool\""
220
+ msgstr "\"Pokročilé nastavenia\""
221
+
222
+ #: options-meta-boxes.php:132
223
+ #@ yarpp
224
+ msgid "YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>."
225
+ msgstr "YARPP zoraďuje súvisiace články podľa (1) čísla zobrazovaných článkov (2) <em>podľa zhody</em>."
226
+
227
+ #: options-meta-boxes.php:132
228
+ #: options-meta-boxes.php:148
229
+ #: options-meta-boxes.php:166
230
+ #: options-meta-boxes.php:170
231
+ #: options-meta-boxes.php:204
232
+ #: options-meta-boxes.php:221
233
+ #: options-meta-boxes.php:223
234
+ #: options-meta-boxes.php:228
235
+ #: options-meta-boxes.php:256
236
+ #@ yarpp
237
+ msgid "more&gt;"
238
+ msgstr "viac&gt;"
239
+
240
+ #: options-meta-boxes.php:132
241
+ #@ yarpp
242
+ 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."
243
+ msgstr "Čím vyššie je nastavená presnosť zhody, tým menej súvisiacich príspevkov dostanete. Štandardne je zhoda nastavená na číslo 5. Pri hľadaní toho správneho nastavenia zhody Vám odporúčame pozrieť aké čísla sa zobrazujú pri navrhnutých súvisiacich článkoch a vyladiť si nastavenie podľa seba."
244
+
245
+ #: options-meta-boxes.php:138
246
+ #@ yarpp
247
+ msgid "Match threshold:"
248
+ msgstr "Presnosť zhody:"
249
+
250
+ #: options-meta-boxes.php:139
251
+ #@ yarpp
252
+ msgid "Titles: "
253
+ msgstr "Nadpisy:"
254
+
255
+ #: options-meta-boxes.php:141
256
+ #@ yarpp
257
+ msgid "Bodies: "
258
+ msgstr "Telo:"
259
+
260
+ #: options-meta-boxes.php:148
261
+ #@ yarpp
262
+ msgid "Cross-relate posts and pages?"
263
+ msgstr "Nerozlišovať medzi stránkami a článkami?"
264
+
265
+ #: options-meta-boxes.php:148
266
+ #@ yarpp
267
+ 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."
268
+ msgstr "Ak je možnosť \"Nerozlišovať medzi stránkami a článkami?\" zapnutá, <code>related_posts()</code>, <code>related_pages()</code>, and <code>related_entries()</code> všetky tieto kódy vrátia rovnaké výsledky a zobrazia súvisiace články aj stránky."
269
+
270
+ #: options-meta-boxes.php:149
271
+ #@ yarpp
272
+ msgid "Show only previous posts?"
273
+ msgstr "Zobraziť len miunulé príspevky?"
274
+
275
+ #: options-meta-boxes.php:157
276
+ #@ yarpp
277
+ msgid "\"Relatedness\" options"
278
+ msgstr "nastavenie \"Podobnosti\""
279
+
280
+ #: options-meta-boxes.php:166
281
+ #@ yarpp
282
+ msgid "Automatically display related posts?"
283
+ msgstr "Zobraziť súvisiace články automaticky?"
284
+
285
+ #: options-meta-boxes.php:166
286
+ #@ yarpp
287
+ 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."
288
+ msgstr "Táto možnosť automaticky zobrazí súvisiace články hneď pod obsahom danej stránky. Ak je táto funkcia vypnutá, budete musieť ručne vložiť <code>related_posts()</code> alebo (<code>related_pages()</code> a <code>related_entries()</code>) do súborov Vašej témy."
289
+
290
+ #: options-meta-boxes.php:167
291
+ #@ yarpp
292
+ msgid "Website display code example"
293
+ msgstr "Takto bude vyzerať kód na stránke"
294
+
295
+ #: options-meta-boxes.php:167
296
+ #: options-meta-boxes.php:221
297
+ #@ yarpp
298
+ msgid "(Update options to reload.)"
299
+ msgstr "(Aktualizujte možnosti pre obnovenie.)"
300
+
301
+ #: options-meta-boxes.php:169
302
+ #: options-meta-boxes.php:226
303
+ #@ yarpp
304
+ msgid "Maximum number of related posts:"
305
+ msgstr "Maximálny počet súvisiacich článkov:"
306
+
307
+ #: options-meta-boxes.php:170
308
+ #: options-meta-boxes.php:228
309
+ #@ yarpp
310
+ 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."
311
+ msgstr "Toto pokročilé nastavenie Vám dáva plnú moc pri upravovaní toho, ako budú súvisiace články zobrazené. Šablóny (nachádzajúce sa v priečinku Vašej témy) sú písané v PHP."
312
+
313
+ #: options-meta-boxes.php:184
314
+ #: options-meta-boxes.php:244
315
+ #@ yarpp
316
+ msgid "Before / after related entries:"
317
+ msgstr "Pred / za súvisiacimi článkami:"
318
+
319
+ #: options-meta-boxes.php:184
320
+ #: options-meta-boxes.php:185
321
+ #: options-meta-boxes.php:193
322
+ #: options-meta-boxes.php:244
323
+ #: options-meta-boxes.php:245
324
+ #: options-meta-boxes.php:250
325
+ #@ yarpp
326
+ msgid "For example:"
327
+ msgstr "Napríklad:"
328
+
329
+ #: options-meta-boxes.php:184
330
+ #: options-meta-boxes.php:185
331
+ #: options-meta-boxes.php:193
332
+ #: options-meta-boxes.php:244
333
+ #: options-meta-boxes.php:245
334
+ #: options-meta-boxes.php:250
335
+ #@ yarpp
336
+ msgid " or "
337
+ msgstr "alebo"
338
+
339
+ #: options-meta-boxes.php:185
340
+ #: options-meta-boxes.php:245
341
+ #@ yarpp
342
+ msgid "Before / after each related entry:"
343
+ msgstr "Pred / za každým súvisiacim článkom:"
344
+
345
+ #: options-meta-boxes.php:187
346
+ #: options-meta-boxes.php:247
347
+ #@ yarpp
348
+ msgid "Show excerpt?"
349
+ msgstr "Zobraziť výňatok?"
350
+
351
+ #: options-meta-boxes.php:188
352
+ #: options-meta-boxes.php:248
353
+ #@ yarpp
354
+ msgid "Excerpt length (No. of words):"
355
+ msgstr "Dĺžka výňatku (počet slov)"
356
+
357
+ #: options-meta-boxes.php:192
358
+ #@ yarpp
359
+ msgid "Before / after (Excerpt):"
360
+ msgstr "Pred / za (výňatkom)"
361
+
362
+ #: options-meta-boxes.php:200
363
+ #: options-meta-boxes.php:254
364
+ #@ yarpp
365
+ msgid "Default display if no results:"
366
+ msgstr "Ak sa nenájdu žiadne výsledky, zobrazí sa:"
367
+
368
+ #: options-meta-boxes.php:205
369
+ #: options-meta-boxes.php:257
370
+ #, php-format
371
+ #@ yarpp
372
+ 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."
373
+ msgstr "Zapnutie tejto možnosti pridá kód %s. Skúste to zapnút, uložiť nastavenia, a výsledok uvidíte vpravo hore. Zapnutie tohto nastavenia a finančné dary si veľmi vážime."
374
+
375
+ #: options-meta-boxes.php:212
376
+ #@ yarpp
377
+ msgid "Display options <small>for your website</small>"
378
+ msgstr "Zobraziť možnosti <small>pre Vašu stránku</small>"
379
+
380
+ #: options-meta-boxes.php:221
381
+ #@ yarpp
382
+ msgid "Display related posts in feeds?"
383
+ msgstr "Zobraziť súvisiace články v kanáloch?"
384
+
385
+ #: options-meta-boxes.php:221
386
+ #@ yarpp
387
+ msgid "This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed."
388
+ msgstr "Táto možnosť zobrazí súvisiace články na konci každého príspevku v RSS a Atom kanáloch. Žiadne zmeny v šablóne nie sú nutné."
389
+
390
+ #: options-meta-boxes.php:221
391
+ #@ yarpp
392
+ msgid "RSS display code example"
393
+ msgstr "Príklad zobrazenia RSS kódu"
394
+
395
+ #: options-meta-boxes.php:223
396
+ #@ yarpp
397
+ msgid "Display related posts in the descriptions?"
398
+ msgstr "Zobraziť súvisiace články v popisoch?"
399
+
400
+ #: options-meta-boxes.php:223
401
+ #@ yarpp
402
+ 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."
403
+ msgstr "Táto možnosť zobrazí súvisiace články v popise RSS. Ak je zapnutá, zobrazí len výňatky z článkov. Ak je necháte vypnutú, zobrazia sa Vám celé RSS kanály."
404
+
405
+ #: options-meta-boxes.php:228
406
+ #@ yarpp
407
+ msgid "NEW!"
408
+ msgstr "NOVÉ!"
409
+
410
+ #: options-meta-boxes.php:250
411
+ #@ yarpp
412
+ msgid "Before / after (excerpt):"
413
+ msgstr "Pred / za (výňatkom)"
414
+
415
+ #: options-meta-boxes.php:264
416
+ #@ yarpp
417
+ msgid "Display options <small>for RSS</small>"
418
+ msgstr "Nastavenie zobrazenie <small>pre RSS</small>"
419
+
420
+ #: options-meta-boxes.php:271
421
+ #@ yarpp
422
+ msgid "YARPP Forum"
423
+ msgstr "YARPP Fórum"
424
+
425
+ #: options-meta-boxes.php:272
426
+ #@ yarpp
427
+ msgid "YARPP on Twitter"
428
+ msgstr "YARPP na Twittri"
429
+
430
+ #: options-meta-boxes.php:273
431
+ #@ yarpp
432
+ msgid "YARPP on the Web"
433
+ msgstr "YARPP na Webe"
434
+
435
+ #: options-meta-boxes.php:274
436
+ #@ yarpp
437
+ msgid "Rate YARPP on WordPress.org"
438
+ msgstr "Ohodnoťte plugin YARPP na stránke WordPress.org"
439
+
440
+ #: options-meta-boxes.php:275
441
+ #@ default
442
+ #@ yarpp
443
+ msgid "Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal"
444
+ msgstr "Poslať finančný prispevok autorovi pluginu - mitchovi (Michael Yoshitaka Erlewine) cez PayPal."
445
+
446
+ #: options-meta-boxes.php:310
447
+ #@ yarpp
448
+ msgid "Contact YARPP"
449
+ msgstr "Kontaktovať YARPP"
450
+
451
+ #: options.php:36
452
+ #, php-format
453
+ #@ default
454
+ 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>."
455
+ msgstr "Bola vydaná nová verzia %1$s. <a href=\"%2$s\" class=\"thickbox\" title=\"%3$s\">Pozrieť %4$s detaily verzie</a> alebo <a href=\"%5$s\">aktualizovať automaticky</a>."
456
+
457
+ #: options.php:40
458
+ #, php-format
459
+ #@ yarpp
460
+ 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."
461
+ msgstr "Bola vydaná nová beta verzia (%s) Yet Another Related Posts Pluginu. Môžete si ju <a href=\"%s\">stiahnuť</a> na vlastné riziko."
462
+
463
+ #: options.php:48
464
+ #@ yarpp
465
+ msgid "The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria."
466
+ msgstr "MyISAM kontrola bola prepísaná. Teraz môžte použiť \"consider titles\" and \"consider bodies\" kritériá podobnosti."
467
+
468
+ #: options.php:56
469
+ #, php-format
470
+ #@ yarpp
471
+ 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."
472
+ msgstr "YARPP \"consider titles\" and \"consider bodies\" kritériá podobnosti vyžadujú Vašu <code>%s</code> tabuľku <a href='http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html'>MyISAM storage engine</a>, no zdá sa, že tabuľka používa <code>%s</code>. Tieto dve možnosti boli vypnuté."
473
+
474
+ #: options.php:58
475
+ #, php-format
476
+ #@ yarpp
477
+ 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."
478
+ msgstr "Pre obnovenie týchto funkcií, prosím aktualizujte svoju <code>%s</code> tabuľku, spustením nasledovného SQL príkazu: <code>ALTER TABLE `%s` ENGINE = MyISAM;</code> . Žiadne dáta nebudú vymazané po vykonaní toho príkazu."
479
+
480
+ #: options.php:60
481
+ #, php-format
482
+ #@ yarpp
483
+ msgid "If, despite this check, you are sure that <code>%s</code> is using the MyISAM engine, press this magic button:"
484
+ msgstr "Ak ste si aj napriek tejto kontrole istý, že <code>%s</code> používa MyISAM, stlačte toto čarovné tlačidlo:"
485
+
486
+ #: options.php:63
487
+ #@ yarpp
488
+ msgid "Trust me. Let me use MyISAM features."
489
+ msgstr "Verte mi, je lepšie, keď používate funkcie MyISAM."
490
+
491
+ #: options.php:75
492
+ #@ yarpp
493
+ msgid "The YARPP database had an error but has been fixed."
494
+ msgstr "YARPP databáza obsahovala chybu, ktorú sme už stihli opraviť."
495
+
496
+ #: options.php:77
497
+ #@ yarpp
498
+ msgid "The YARPP database has an error which could not be fixed."
499
+ msgstr "V databáze YARPP je závažná chyba, ktorá sa nedá opraviť."
500
+
501
+ #: options.php:78
502
+ #, php-format
503
+ #@ yarpp
504
+ msgid "Please try <a href=\"%s\" target=\"_blank\">manual SQL setup</a>."
505
+ msgstr "Vyskúšajte prosím <a href=\"%s\" target=\"_blank\">manuálne nastaveniť databázu</a>."
506
+
507
+ #: options.php:109
508
+ #@ yarpp
509
+ msgid "Options saved!"
510
+ msgstr "Nastavenia uložené!"
511
+
512
+ #: options.php:115
513
+ #@ yarpp
514
+ msgid "Yet Another Related Posts Plugin Options"
515
+ msgstr "Možnost Yet Another Related Posts Pluginu"
516
+
517
+ #: options.php:123
518
+ #, php-format
519
+ #@ yarpp
520
+ msgid "by <a href=\"%s\" target=\"_blank\">mitcho (Michael 芳貴 Erlewine)</a>"
521
+ msgstr "plugin od <a href=\"%s\" target=\"_blank\">mitcho (Michael 芳貴 Erlewine)</a>"
522
+
523
+ #: options.php:152
524
+ #@ default
525
+ msgid "Save Changes"
526
+ msgstr "Uložiť zmeny"
527
+
528
+ #: template-builtin.php:20
529
+ #, php-format
530
+ #@ yarpp
531
+ 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."
532
+ msgstr "%f je zhoda medzi aktuálnym príspevkom a súvisiacim článkom. Túto možnosť môžete vidieť len ako administrátor. Návštevníci túto hodnotu neuvidia."
533
+
534
+ #: template-metabox.php:12
535
+ #@ yarpp
536
+ msgid "These are the related entries for this entry. Updating this post may change these related posts."
537
+ msgstr "Toto sú súvisiace články pre tento príspevok. Aktualizácia tohoto príspevku môže súvisiace články zmeniť."
538
+
539
+ #: template-metabox.php:28
540
+ #@ yarpp
541
+ msgid "Whether all of these related entries are actually displayed and how they are displayed depends on your YARPP display options."
542
+ msgstr "To, či sú všetky aktuálne príspevky zobrazené a ako sú zobrazené, závisí na nastavení Vášho YARPP."
543
+
options-meta-boxes.php CHANGED
@@ -30,29 +30,26 @@ class YARPP_Meta_Box {
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 value='1'". (($value == 1) ? ' selected="selected"': '' )." > " . __("do not consider",'yarpp') . "</option>";
37
- echo "<option value='2'". (($value == 2) ? ' selected="selected"': '' )." >" . __("consider",'yarpp') . "</option>";
38
- echo "<option value='3'". (($value == 3) ? ' selected="selected"': '' )." >" . sprintf(__("require at least one %s in common",'yarpp'),$taxonomy->labels->singular_name) . "</option>";
39
- echo "<option 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
-
47
- echo " $tr$desc</th>
48
- <td>
49
- <select name='$option'>
50
- <option $inputplus value='1'". (($value == 1) ? ' selected="selected"': '' )." >".__("do not consider",'yarpp')."</option>
51
- <option $inputplus value='2'". (($value == 2) ? ' selected="selected"': '' )." > ".__("consider",'yarpp')."</option>
52
- <option $inputplus value='3'". (($value == 3) ? ' selected="selected"': '' )." > ".__("consider with extra weight",'yarpp')."</option>
53
- </select>
54
- </td>
55
- </tr>";
56
}
57
58
function displayorder( $option, $class = '' ) {
@@ -76,16 +73,18 @@ class YARPP_Meta_Box {
76
77
class YARPP_Meta_Box_Pool extends YARPP_Meta_Box {
78
function exclude($taxonomy, $string) {
79
?>
80
<tr valign='top'>
81
<th scope='row'><?php echo $string; ?></th>
82
<td><div class='scroll_wrapper' style="overflow:auto;max-height:100px;"><div class='exclude_terms' id='exclude_<?php echo $taxonomy; ?>'>
83
<?php
84
- $exclude_terms = yarpp_get_option('exclude');
85
- if ( !empty($exclude_terms[$taxonomy]) ) {
86
- $terms = get_terms($taxonomy, array('include' => $exclude_terms[$taxonomy]));
87
foreach ($terms as $term) {
88
- echo "<input type='checkbox' name='exclude[{$taxonomy}][{$term->term_id}]' value='true' checked='checked' /> <label>" . esc_html($term->name) . "</label> ";
89
}
90
}
91
?>
@@ -136,13 +135,13 @@ class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
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>");
30
</tr>";
31
}
32
33
+ function tax_weight($taxonomy) {
34
+ $weight = (int) yarpp_get_option("weight[tax][{$taxonomy->name}]");
35
+ $require = (int) yarpp_get_option("require_tax[{$taxonomy->name}]");
36
echo "<tr valign='top'><th scope='row'>{$taxonomy->labels->name}:</th><td><select name='weight[tax][{$taxonomy->name}]'>";
37
+ echo "<option value='no'". ((!$weight && !$require) ? ' selected="selected"': '' )." > " . __("do not consider",'yarpp') . "</option>";
38
+ echo "<option value='consider'". (($weight == 1 && !$require) ? ' selected="selected"': '' )." >" . __("consider",'yarpp') . "</option>";
39
+ echo "<option value='consider_extra'". (($weight > 1 && !$require) ? ' selected="selected"': '' )." >" . __("consider with extra weight",'yarpp') . "</option>";
40
+ echo "<option value='require_one'". (($require == 1) ? ' selected="selected"': '' )." >" . sprintf(__("require at least one %s in common",'yarpp'),$taxonomy->labels->singular_name) . "</option>";
41
+ echo "<option value='require_more'". (($require == 2) ? ' selected="selected"': '' )." >" . sprintf(__("require more than one %s in common",'yarpp'),$taxonomy->labels->singular_name) . "</option>";
42
echo "</select></td></tr>";
43
}
44
45
+ function weight($option,$desc,$tr="<tr valign='top'><th scope='row'>",$inputplus = '') {
46
+ $weight = (int) yarpp_get_option("weight[$option]");
47
+ echo "$tr$desc</th><td>";
48
+ echo "<select name='weight[$option]'>";
49
+ echo "<option $inputplus value='no'". (!$weight ? ' selected="selected"': '' )." >".__("do not consider",'yarpp')."</option>";
50
+ echo "<option $inputplus value='consider'". (($weight == 1) ? ' selected="selected"': '' )." > ".__("consider",'yarpp')."</option>";
51
+ echo "<option $inputplus value='consider_extra'". (($weight > 1) ? ' selected="selected"': '' )." > ".__("consider with extra weight",'yarpp')."</option>";
52
+ echo "</select></td></tr>";
53
}
54
55
function displayorder( $option, $class = '' ) {
73
74
class YARPP_Meta_Box_Pool extends YARPP_Meta_Box {
75
function exclude($taxonomy, $string) {
76
+ global $yarpp;
77
?>
78
<tr valign='top'>
79
<th scope='row'><?php echo $string; ?></th>
80
<td><div class='scroll_wrapper' style="overflow:auto;max-height:100px;"><div class='exclude_terms' id='exclude_<?php echo $taxonomy; ?>'>
81
<?php
82
+ $exclude_tt_ids = wp_parse_id_list(yarpp_get_option('exclude'));
83
+ $exclude_term_ids = $yarpp->admin->get_term_ids_from_tt_ids( $taxonomy, $exclude_tt_ids );
84
+ if ( count($exclude_term_ids) ) {
85
+ $terms = get_terms($taxonomy, array('include' => $exclude_term_ids));
86
foreach ($terms as $term) {
87
+ echo "<input type='checkbox' name='exclude[{$term->term_taxonomy_id}]' id='exclude_{$term->term_taxonomy_id}' value='true' checked='checked' /> <label for='exclude_{$term->term_taxonomy_id}'>" . esc_html($term->name) . "</label> ";
88
}
89
}
90
?>
135
136
<?php
137
$this->textbox('threshold',__('Match threshold:','yarpp'));
138
+ $this->weight('title',__("Titles: ",'yarpp'),"<tr valign='top'>
139
<th scope='row'>",( !$yarpp->myisam ? ' readonly="readonly" disabled="disabled"':'' ));
140
+ $this->weight('body',__("Bodies: ",'yarpp'),"<tr valign='top'>
141
<th scope='row'>",( !$yarpp->myisam ? ' readonly="readonly" disabled="disabled"':'' ));
142
143
foreach ($yarpp->get_taxonomies() as $taxonomy) {
144
+ $this->tax_weight($taxonomy);
145
}
146
147
$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>");
options.php CHANGED
@@ -1,5 +1,4 @@
1
<?php
2
-
3
global $wpdb, $wp_version, $yarpp;
4
5
// Reenforce YARPP setup:
@@ -64,7 +63,10 @@ if ( !yarpp_get_option('myisam_override') ) {
64
."'></input></form>"
65
."</div>";
66
67
- yarpp_set_option(array('title' => 1, 'body' => 1));
68
$yarpp->myisam = false;
69
}
70
}
@@ -86,21 +88,38 @@ if (isset($_POST['update_yarpp'])) {
86
foreach ($yarpp->default_options as $option => $default) {
87
if ( is_bool($default) )
88
$new_options[$option] = isset($_POST[$option]);
89
- if ( (is_string($default) || is_int($default)) &&
90
- isset($_POST[$option]) && is_string($_POST[$option]) )
91
$new_options[$option] = stripslashes($_POST[$option]);
92
}
93
94
if ( isset($_POST['weight']) ) {
95
- $new_options['weight'] = $_POST['weight'];
96
}
97
98
- // excludes are different
99
- $new_options['exclude'] = array();
100
if ( isset($_POST['exclude']) ) {
101
- $exclude = array_merge( array('category' => array(), 'post_tag' => array()), $_POST['exclude'] );
102
- $new_options['exclude']['category'] = implode(',',array_keys($exclude['category']));
103
- $new_options['exclude']['post_tag'] = implode(',',array_keys($exclude['post_tag']));
104
}
105
106
$new_options = apply_filters( 'yarpp_settings_save', $new_options );
1
<?php
2
global $wpdb, $wp_version, $yarpp;
3
4
// Reenforce YARPP setup:
63
."'></input></form>"
64
."</div>";
65
66
+ $weight = yarpp_set_option('weight');
67
+ unset($weight['title']);
68
+ unset($weight['body']);
69
+ yarpp_set_option(array('weight' => $weight));
70
$yarpp->myisam = false;
71
}
72
}
88
foreach ($yarpp->default_options as $option => $default) {
89
if ( is_bool($default) )
90
$new_options[$option] = isset($_POST[$option]);
91
+ // @todo: do we really want to stripslashes here anymore?
92
+ if ( (is_string($default) || is_int($default)) && is_string(@$_POST[$option]) )
93
$new_options[$option] = stripslashes($_POST[$option]);
94
}
95
96
if ( isset($_POST['weight']) ) {
97
+ $new_options['weight'] = array();
98
+ $new_options['require_tax'] = array();
99
+ foreach ( (array) $_POST['weight'] as $key => $value) {
100
+ if ( $value == 'consider' )
101
+ $new_options['weight'][$key] = 1;
102
+ if ( $value == 'consider_extra' )
103
+ $new_options['weight'][$key] = YARPP_EXTRA_WEIGHT;
104
+ }
105
+ foreach ( (array) $_POST['weight']['tax'] as $tax => $value) {
106
+ if ( $value == 'consider' )
107
+ $new_options['weight']['tax'][$tax] = 1;
108
+ if ( $value == 'consider_extra' )
109
+ $new_options['weight']['tax'][$tax] = YARPP_EXTRA_WEIGHT;
110
+ if ( $value == 'require_one' ) {
111
+ $new_options['weight']['tax'][$tax] = 1;
112
+ $new_options['require_tax'][$tax] = 1;
113
+ }
114
+ if ( $value == 'require_more' ) {
115
+ $new_options['weight']['tax'][$tax] = 1;
116
+ $new_options['require_tax'][$tax] = 2;
117
+ }
118
+ }
119
}
120
121
if ( isset($_POST['exclude']) ) {
122
+ $new_options['exclude'] = implode(',',array_keys($_POST['exclude']));
123
}
124
125
$new_options = apply_filters( 'yarpp_settings_save', $new_options );
readme.txt CHANGED
@@ -152,6 +152,7 @@ YARPP is currently localized in the following languages:
152
* (European) Portuguese (`pt_PT`) by Stefan Mueller of [fernstadium-net](http://www.fernstudium-net.de)
153
* Brazilian Portuguese (`pt_BR`) by Rafael Fischmann of [macmagazine.br](http://macmagazine.com.br/)
154
* Russian (`ru_RU`) by Marat Latypov of [blogocms.ru](http://blogocms.ru)
155
* Spanish (`es_ES`) by Rene of [WordPress Webshop](http://wpwebshop.com)
156
* Swedish (`sv_SE`) by Max Elander
157
* Turkish (`tr_TR`) by [Nurullah](http://www.ndemir.com) and [Barış Ünver](http://beyn.org/)
@@ -166,7 +167,6 @@ YARPP is currently localized in the following languages:
166
* Romanian
167
* Thai
168
* Bhasa Indonesian
169
- * Spanish
170
-->
171
172
If you are a bilingual speaker of English and another language and an avid user of YARPP, I would love to talk to you about localizing YARPP! Localizing YARPP can be pretty easy using [the Codestyling Localization plugin](http://www.code-styling.de/english/development/wordpress-plugin-codestyling-localization-en). Please [contact me](mailto:yarpp@mitcho.com) *first* before translating to make sure noone else is working on your language. Thanks!
@@ -177,8 +177,14 @@ If you are a bilingual speaker of English and another language and an avid user
177
* Further main query optimization:
178
* What's cooler than joining four tables? Joining two.
179
* Exclude now simply uses `term_taxonomy_id`s instead of `term_id`s
180
- * Don't clear the cache when it's already empty
181
- * `protect` the `sql` method as it shouldn't be `public`
182
183
= 3.4.3 =
184
* Bugfix: keywords were not getting cleared on post update, meaning new posts (which start blank) were not getting useful title + body keyword matches. This often resulted in "no related posts" for new posts.
152
* (European) Portuguese (`pt_PT`) by Stefan Mueller of [fernstadium-net](http://www.fernstudium-net.de)
153
* Brazilian Portuguese (`pt_BR`) by Rafael Fischmann of [macmagazine.br](http://macmagazine.com.br/)
154
* Russian (`ru_RU`) by Marat Latypov of [blogocms.ru](http://blogocms.ru)
155
+ * Slovak (`sk_SK`) by [Forex](http://www.eforex.sk/)
156
* Spanish (`es_ES`) by Rene of [WordPress Webshop](http://wpwebshop.com)
157
* Swedish (`sv_SE`) by Max Elander
158
* Turkish (`tr_TR`) by [Nurullah](http://www.ndemir.com) and [Barış Ünver](http://beyn.org/)
167
* Romanian
168
* Thai
169
* Bhasa Indonesian
170
-->
171
172
If you are a bilingual speaker of English and another language and an avid user of YARPP, I would love to talk to you about localizing YARPP! Localizing YARPP can be pretty easy using [the Codestyling Localization plugin](http://www.code-styling.de/english/development/wordpress-plugin-codestyling-localization-en). Please [contact me](mailto:yarpp@mitcho.com) *first* before translating to make sure noone else is working on your language. Thanks!
177
* Further main query optimization:
178
* What's cooler than joining four tables? Joining two.
179
* Exclude now simply uses `term_taxonomy_id`s instead of `term_id`s
180
+ * Change format of `weight` paramters in options and in optional args
181
+ * Added "consider with extra weight" to taxonomy criteria as well
182
+ * Code cleanup:
183
+ * Don't clear the cache when it's already empty
184
+ * `protect` the `sql` method as it shouldn't be `public`
185
+ * Further use of utility functions from 3.1 like `wp_list_pluck()`
186
+ * New constant, `YARPP_EXTRA_WEIGHT` to define the "extra weight." By default, it's 3.
187
+ * Added Slovak (`sk_SK`) localization by [Forex](http://www.eforex.sk/)
188
189
= 3.4.3 =
190
* Bugfix: keywords were not getting cleared on post update, meaning new posts (which start blank) were not getting useful title + body keyword matches. This often resulted in "no related posts" for new posts.
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.4.4b1
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.4.4b1');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');
@@ -32,6 +32,10 @@ if ( !defined('WP_CONTENT_DIR') )
32
// define('YARPP_CACHE_TYPE', 'postmeta');
33
if (!defined('YARPP_CACHE_TYPE'))
34
define('YARPP_CACHE_TYPE', 'tables');
35
36
// new in 3.3.3: init yarpp on init
37
add_action( 'init', 'yarpp_init' );
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.4.4b2
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.4.4b2');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');
32
// define('YARPP_CACHE_TYPE', 'postmeta');
33
if (!defined('YARPP_CACHE_TYPE'))
34
define('YARPP_CACHE_TYPE', 'tables');
35
+
36
+ // New in 3.4.4: YARPP extra weight multiplier
37
+ if ( !defined('YARPP_EXTRA_WEIGHT') )
38
+ define( 'YARPP_EXTRA_WEIGHT', 3 );
39
40
// new in 3.3.3: init yarpp on init
41
add_action( 'init', 'yarpp_init' );