Yet Another Related Posts Plugin (YARPP) - Version 3.5.3b4

Version Description

Download this release

Release Info

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

Code changes from version 3.5.2b3 to 3.5.3b4

Files changed (126) hide show
  1. blogglue.php +0 -61
  2. cache-postmeta.php +9 -12
  3. cache-tables.php +23 -23
  4. class-cache.php +42 -42
  5. class-core.php +60 -32
  6. lang/yarpp-nl_NL.mo +0 -0
  7. lang/yarpp-nl_NL.po +180 -207
  8. options.php +2 -5
  9. readme.txt +20 -3
  10. template-metabox.php +1 -1
  11. trunk/cache-postmeta.php +0 -257
  12. trunk/cache-tables.php +0 -314
  13. trunk/class-admin.php +0 -259
  14. trunk/class-cache.php +0 -614
  15. trunk/class-core.php +0 -855
  16. trunk/class-widget.php +0 -106
  17. trunk/js/metabox.js +0 -28
  18. trunk/js/options.js +0 -157
  19. trunk/lang/words-bg_BG.php +0 -3
  20. trunk/lang/words-cs_CZ.php +0 -3
  21. trunk/lang/words-de_DE.php +0 -3
  22. trunk/lang/words-en_US.php +0 -3
  23. trunk/lang/words-fr_FR.php +0 -3
  24. trunk/lang/words-it_IT.php +0 -3
  25. trunk/lang/words-nl_NL.php +0 -3
  26. trunk/lang/words-pl_PL.php +0 -3
  27. trunk/lang/words-pt_BR.php +0 -3
  28. trunk/lang/yarpp-ar.mo +0 -0
  29. trunk/lang/yarpp-ar_AR.mo +0 -0
  30. trunk/lang/yarpp-ar_AR.po +0 -588
  31. trunk/lang/yarpp-ar_EG.mo +0 -0
  32. trunk/lang/yarpp-ar_EG.po +0 -582
  33. trunk/lang/yarpp-bg_BG.mo +0 -0
  34. trunk/lang/yarpp-bg_BG.po +0 -588
  35. trunk/lang/yarpp-by_BY.mo +0 -0
  36. trunk/lang/yarpp-by_BY.po +0 -569
  37. trunk/lang/yarpp-cs_CZ.mo +0 -0
  38. trunk/lang/yarpp-cs_CZ.po +0 -542
  39. trunk/lang/yarpp-de_DE.mo +0 -0
  40. trunk/lang/yarpp-de_DE.po +0 -572
  41. trunk/lang/yarpp-el_CY.mo +0 -0
  42. trunk/lang/yarpp-el_CY.po +0 -665
  43. trunk/lang/yarpp-el_EL.mo +0 -0
  44. trunk/lang/yarpp-el_EL.po +0 -665
  45. trunk/lang/yarpp-es_ES.mo +0 -0
  46. trunk/lang/yarpp-es_ES.po +0 -571
  47. trunk/lang/yarpp-fa_IR.mo +0 -0
  48. trunk/lang/yarpp-fa_IR.po +0 -569
  49. trunk/lang/yarpp-fr_FR.mo +0 -0
  50. trunk/lang/yarpp-fr_FR.po +0 -542
  51. trunk/lang/yarpp-gb_IR.mo +0 -0
  52. trunk/lang/yarpp-gb_IR.po +0 -573
  53. trunk/lang/yarpp-ge_KA.mo +0 -0
  54. trunk/lang/yarpp-ge_KA.po +0 -569
  55. trunk/lang/yarpp-he_IL.mo +0 -0
  56. trunk/lang/yarpp-he_IL.po +0 -665
  57. trunk/lang/yarpp-hi_IN.mo +0 -0
  58. trunk/lang/yarpp-hi_IN.po +0 -569
  59. trunk/lang/yarpp-hu_HU.mo +0 -0
  60. trunk/lang/yarpp-hu_HU.po +0 -569
  61. trunk/lang/yarpp-id_ID.mo +0 -0
  62. trunk/lang/yarpp-id_ID.po +0 -569
  63. trunk/lang/yarpp-it_IT.mo +0 -0
  64. trunk/lang/yarpp-it_IT.po +0 -542
  65. trunk/lang/yarpp-ja.mo +0 -0
  66. trunk/lang/yarpp-ja_JP.po +0 -542
  67. trunk/lang/yarpp-kk_KZ.mo +0 -0
  68. trunk/lang/yarpp-kk_KZ.po +0 -569
  69. trunk/lang/yarpp-ko_KR.mo +0 -0
  70. trunk/lang/yarpp-ko_KR.po +0 -542
  71. trunk/lang/yarpp-lt_LT.mo +0 -0
  72. trunk/lang/yarpp-lt_LT.po +0 -569
  73. trunk/lang/yarpp-lv_LV.mo +0 -0
  74. trunk/lang/yarpp-lv_LV.po +0 -569
  75. trunk/lang/yarpp-nb_NO.mo +0 -0
  76. trunk/lang/yarpp-nb_NO.po +0 -569
  77. trunk/lang/yarpp-nl_NL.mo +0 -0
  78. trunk/lang/yarpp-nl_NL.po +0 -542
  79. trunk/lang/yarpp-pl_PL.mo +0 -0
  80. trunk/lang/yarpp-pl_PL.po +0 -568
  81. trunk/lang/yarpp-pt_BR.mo +0 -0
  82. trunk/lang/yarpp-pt_BR.po +0 -569
  83. trunk/lang/yarpp-pt_PT.mo +0 -0
  84. trunk/lang/yarpp-pt_PT.po +0 -569
  85. trunk/lang/yarpp-ro_RO.mo +0 -0
  86. trunk/lang/yarpp-ro_RO.po +0 -568
  87. trunk/lang/yarpp-ru_RU.mo +0 -0
  88. trunk/lang/yarpp-ru_RU.po +0 -569
  89. trunk/lang/yarpp-sk_SK.mo +0 -0
  90. trunk/lang/yarpp-sk_SK.po +0 -543
  91. trunk/lang/yarpp-sr_RS.mo +0 -0
  92. trunk/lang/yarpp-sr_RS.po +0 -542
  93. trunk/lang/yarpp-sv_SE.mo +0 -0
  94. trunk/lang/yarpp-sv_SE.po +0 -536
  95. trunk/lang/yarpp-tr_TR.mo +0 -0
  96. trunk/lang/yarpp-tr_TR.po +0 -568
  97. trunk/lang/yarpp-uk_UA.mo +0 -0
  98. trunk/lang/yarpp-uk_UA.po +0 -569
  99. trunk/lang/yarpp-uz_UZ.mo +0 -0
  100. trunk/lang/yarpp-uz_UZ.po +0 -569
  101. trunk/lang/yarpp-vi_VN.mo +0 -0
  102. trunk/lang/yarpp-vi_VN.po +0 -569
  103. trunk/lang/yarpp-zh_CN.mo +0 -0
  104. trunk/lang/yarpp-zh_CN.po +0 -569
  105. trunk/options-meta-boxes.php +0 -341
  106. trunk/options.css +0 -46
  107. trunk/options.php +0 -182
  108. trunk/paypal-icon.png +0 -0
  109. trunk/plugin.png +0 -0
  110. trunk/readme.txt +0 -631
  111. trunk/related-functions.php +0 -100
  112. trunk/star.png +0 -0
  113. trunk/template-builtin.php +0 -35
  114. trunk/template-functions.php +0 -13
  115. trunk/template-metabox.php +0 -31
  116. trunk/template-widget.php +0 -14
  117. trunk/twitter.png +0 -0
  118. trunk/wordpress.png +0 -0
  119. trunk/yarpp-templates/yarpp-template-example.php +0 -14
  120. trunk/yarpp-templates/yarpp-template-list.php +0 -19
  121. trunk/yarpp-templates/yarpp-template-photoblog.php +0 -17
  122. trunk/yarpp-templates/yarpp-template-random.php +0 -18
  123. trunk/yarpp-templates/yarpp-template-thumbnail.php +0 -18
  124. trunk/yarpp-templates/yarpp-template-wpml.php +0 -20
  125. trunk/yarpp.php +0 -72
  126. yarpp.php +2 -6
blogglue.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
- function yarpp_blogglue_enqueue() {
3
- wp_enqueue_script( 'thickbox' );
4
- wp_enqueue_style( 'thickbox' );
5
- }
6
- add_action( 'admin_enqueue_scripts', 'yarpp_blogglue_enqueue' );
7
-
8
- function add_yarpp_blogglue_meta_box() {
9
- class YARPP_Meta_Box_BlogGlue extends YARPP_Meta_Box {
10
- function display() {
11
- $pluginurl = plugin_dir_url(__FILE__);
12
- ?>
13
- <style type="text/css">
14
- #blogglue_upsell .center {
15
- text-align: center;
16
- }
17
- #blogglue_upsell ul {
18
- text-align: left;
19
- margin: 10px 0 10px 15px;
20
- }
21
- #blogglue_upsell ul li {
22
- list-style: disc outside !important;
23
- }
24
- #TB_ajaxContent {
25
- height: 480px !important;
26
- padding: 10px;
27
- overflow: hidden;
28
- }
29
- ul.install_help {
30
- list-style-type: disc;
31
- list-style-position: inside;
32
- text-align: left;
33
- margin: 20px 0px;
34
- }
35
- </style>
36
- <div id="blogglue_upsell">
37
- <p class="center"><img src="http://s3.amazonaws.com/arkayne-media/img/logo-md.png" alt="BlogGlue Logo"/></p>
38
- <p>In addition to related links on your own site, YARPP and BlogGlue have partnered to increase your blog’s audience by:</p>
39
- <ul>
40
- <li>delivering a new audience from trusted partners with relevant, crosslinked content</li>
41
- <li>improving search engine placement</li>
42
- <li>pulling traffic from Facebook, Twitter and LinkedIn</li>
43
- </ul>
44
- <p class="center"><a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=arkayne-site-to-site-related-content'), 'install-plugin_arkayne-site-to-site-related-content'); ?>"><img src="http://s3.amazonaws.com/arkayne-media/img/installnow.png" alt="Install Now!"/></a><img src="http://www.blogglue.com/cohorts/track/yarpp_sidebar.gif"/></p>
45
-
46
- <p class="center">Want to learn more? <a href="#TB_inline?title=rar&height=450&width=610&inlineId=blogglue_video" title="Free Upgrade To BlogGlue: More Information" class="thickbox">Watch A Video</a></p>
47
- </div>
48
- <div id="blogglue_video" style="display: none;">
49
- <img src="http://s3.amazonaws.com/arkayne-media/img/logo.png" alt="BlogGlue Logo"/>
50
-
51
- <iframe src="http://player.vimeo.com/video/33007489?title=0&amp;byline=0&amp;portrait=0&amp;color=ff6300" width="601" height="338" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
52
-
53
- <p style="text-align:center;"><a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=arkayne-site-to-site-related-content'), 'install-plugin_arkayne-site-to-site-related-content'); ?>"><img src="http://s3.amazonaws.com/arkayne-media/img/installnow.png" alt="Install Now!"/></a></p>
54
- </div>
55
- <?php
56
- }
57
- }
58
-
59
- add_meta_box('yarpp_display_blogglue', 'Free Upgrade To BlogGlue', array(new YARPP_Meta_Box_BlogGlue, 'display'), 'settings_page_yarpp', 'side', 'core');
60
- }
61
- add_action( 'add_meta_boxes_settings_page_yarpp', 'add_yarpp_blogglue_meta_box' );
cache-postmeta.php CHANGED
@@ -139,27 +139,24 @@ class YARPP_Cache_Postmeta extends YARPP_Cache {
139
return YARPP_RELATED;
140
}
141
142
- public function clear($reference_ID) {
143
- if (is_int($reference_ID))
144
- $reference_ID = array($reference_ID);
145
- // make sure that we have a non-trivial array
146
- if (!is_array($reference_ID) || !count($reference_ID))
147
return;
148
// clear each cache
149
- foreach($reference_ID as $id) {
150
delete_post_meta( $id, YARPP_POSTMETA_RELATED_KEY );
151
delete_post_meta( $id, YARPP_POSTMETA_KEYWORDS_KEY );
152
}
153
}
154
155
- // @return YARPP_NO_RELATED | YARPP_RELATED | YARPP_NOT_CACHED
156
- public function update($reference_ID) {
157
global $wpdb;
158
159
- // $reference_ID must be numeric
160
- if ( !$reference_ID = absint($reference_ID) )
161
- return YARPP_NOT_CACHED;
162
-
163
$original_related = $this->related($reference_ID);
164
$related = $wpdb->get_results($this->sql($reference_ID), ARRAY_A);
165
$new_related = wp_list_pluck( $related, 'ID' );
139
return YARPP_RELATED;
140
}
141
142
+ public function clear( $reference_IDs ) {
143
+ $reference_IDs = wp_parse_id_list( $reference_IDs );
144
+
145
+ if ( !count($reference_ID) )
146
return;
147
+
148
// clear each cache
149
+ foreach( $reference_IDs as $id ) {
150
delete_post_meta( $id, YARPP_POSTMETA_RELATED_KEY );
151
delete_post_meta( $id, YARPP_POSTMETA_KEYWORDS_KEY );
152
}
153
}
154
155
+ // @return YARPP_NO_RELATED | YARPP_RELATED
156
+ // @used by enforce
157
+ protected function update($reference_ID) {
158
global $wpdb;
159
160
$original_related = $this->related($reference_ID);
161
$related = $wpdb->get_results($this->sql($reference_ID), ARRAY_A);
162
$new_related = wp_list_pluck( $related, 'ID' );
cache-tables.php CHANGED
@@ -28,13 +28,20 @@ class YARPP_Cache_Tables extends YARPP_Cache {
28
29
public function setup() {
30
global $wpdb;
31
$wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . "` (
32
`ID` bigint(20) unsigned NOT NULL default '0',
33
`body` text NOT NULL,
34
`title` text NOT NULL,
35
`date` timestamp NOT NULL default CURRENT_TIMESTAMP,
36
PRIMARY KEY (`ID`)
37
- ) ENGINE=MyISAM COMMENT='YARPP''s keyword cache table';");
38
$wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "` (
39
`reference_ID` bigint(20) unsigned NOT NULL default '0',
40
`ID` bigint(20) unsigned NOT NULL default '0',
@@ -42,7 +49,7 @@ class YARPP_Cache_Tables extends YARPP_Cache {
42
`date` timestamp NOT NULL default CURRENT_TIMESTAMP,
43
PRIMARY KEY ( `reference_ID` , `ID` ),
44
INDEX (`score`), INDEX (`ID`)
45
- ) ENGINE=MyISAM;");
46
}
47
48
public function upgrade($last_version) {
@@ -161,12 +168,14 @@ class YARPP_Cache_Tables extends YARPP_Cache {
161
if ( false !== $result )
162
return $result;
163
164
- $min_id = $wpdb->get_var("select min(ID) as min_id from {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " where reference_ID = $reference_ID");
165
166
- if ( is_null( $min_id ) )
167
return YARPP_NOT_CACHED;
168
169
- if ( 0 == $min_id )
170
$result = YARPP_NO_RELATED;
171
else
172
$result = YARPP_RELATED;
@@ -176,32 +185,26 @@ class YARPP_Cache_Tables extends YARPP_Cache {
176
return $result;
177
}
178
179
- public function clear($reference_ID) {
180
global $wpdb;
181
182
- // everything is an array now:
183
- if ( !is_array($reference_ID) )
184
- $reference_ID = array( $reference_ID );
185
186
- if ( !count($reference_ID) )
187
return;
188
189
- $wpdb->query("delete from {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " where reference_ID in (".implode(',',$reference_ID).")");
190
- $wpdb->query("delete from {$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . " where ID in (".implode(',',$reference_ID).")");
191
// @since 3.5.2: clear is_cached_* values as well
192
- foreach ( $reference_ID as $id ) {
193
wp_cache_delete( 'is_cached_' . $id, 'yarpp' );
194
- }
195
}
196
197
- // @return YARPP_RELATED | YARPP_NO_RELATED | YARPP_NOT_CACHED
198
- public function update($reference_ID) {
199
global $wpdb;
200
201
- // $reference_ID must be numeric
202
- if ( !$reference_ID = absint($reference_ID) )
203
- return YARPP_NOT_CACHED;
204
-
205
$original_related = (array) @$this->related($reference_ID);
206
207
if ( count($original_related) ) {
@@ -227,9 +230,6 @@ class YARPP_Cache_Tables extends YARPP_Cache {
227
} else {
228
$wpdb->query("insert into {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " (reference_ID,ID,score) values ($reference_ID,0,0) on duplicate key update date = now()");
229
230
- //if (!$wpdb->rows_affected)
231
- // return YARPP_NOT_CACHED;
232
-
233
// Clear the caches of those which are no longer related.
234
if ( count($original_related) )
235
$this->clear($original_related);
28
29
public function setup() {
30
global $wpdb;
31
+
32
+ $charset_collate = '';
33
+ if ( ! empty( $wpdb->charset ) )
34
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
35
+ if ( ! empty( $wpdb->collate ) )
36
+ $charset_collate .= " COLLATE $wpdb->collate";
37
+
38
$wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . "` (
39
`ID` bigint(20) unsigned NOT NULL default '0',
40
`body` text NOT NULL,
41
`title` text NOT NULL,
42
`date` timestamp NOT NULL default CURRENT_TIMESTAMP,
43
PRIMARY KEY (`ID`)
44
+ ) $charset_collate;");
45
$wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "` (
46
`reference_ID` bigint(20) unsigned NOT NULL default '0',
47
`ID` bigint(20) unsigned NOT NULL default '0',
49
`date` timestamp NOT NULL default CURRENT_TIMESTAMP,
50
PRIMARY KEY ( `reference_ID` , `ID` ),
51
INDEX (`score`), INDEX (`ID`)
52
+ ) $charset_collate;");
53
}
54
55
public function upgrade($last_version) {
168
if ( false !== $result )
169
return $result;
170
171
+ // @since 3.5.3b3: check for max instead of min, so that if ID=0 and ID=X
172
+ // are both saved, we act like there *are* related posts, because there are.
173
+ $max_id = $wpdb->get_var("select max(ID) as max_id from {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " where reference_ID = $reference_ID");
174
175
+ if ( is_null( $max_id ) )
176
return YARPP_NOT_CACHED;
177
178
+ if ( 0 == $max_id )
179
$result = YARPP_NO_RELATED;
180
else
181
$result = YARPP_RELATED;
185
return $result;
186
}
187
188
+ public function clear( $reference_IDs ) {
189
global $wpdb;
190
191
+ $reference_IDs = wp_parse_id_list( $reference_IDs );
192
193
+ if ( !count($reference_IDs) )
194
return;
195
196
+ $wpdb->query("delete from {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " where reference_ID in (".implode(',',$reference_IDs).")");
197
+ $wpdb->query("delete from {$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . " where ID in (".implode(',',$reference_IDs).")");
198
// @since 3.5.2: clear is_cached_* values as well
199
+ foreach ( $reference_IDs as $id )
200
wp_cache_delete( 'is_cached_' . $id, 'yarpp' );
201
}
202
203
+ // @return YARPP_RELATED | YARPP_NO_RELATED
204
+ // @used by enforce
205
+ protected function update($reference_ID) {
206
global $wpdb;
207
208
$original_related = (array) @$this->related($reference_ID);
209
210
if ( count($original_related) ) {
230
} else {
231
$wpdb->query("insert into {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " (reference_ID,ID,score) values ($reference_ID,0,0) on duplicate key update date = now()");
232
233
// Clear the caches of those which are no longer related.
234
if ( count($original_related) )
235
$this->clear($original_related);
class-cache.php CHANGED
@@ -39,7 +39,11 @@ abstract class YARPP_Cache {
39
// Note: return value changed in 3.4
40
// return YARPP_NO_RELATED | YARPP_RELATED | YARPP_DONT_RUN | false if no good input
41
function enforce( $reference_ID, $force = false ) {
42
- if ( !$reference_ID = absint($reference_ID) )
43
return false;
44
45
$status = $this->is_cached($reference_ID);
@@ -50,12 +54,9 @@ abstract class YARPP_Cache {
50
return YARPP_DONT_RUN;
51
52
// If not cached, process now:
53
- if ( YARPP_NOT_CACHED == $status || $force ) {
54
- $status = $this->update($reference_ID);
55
- // if still not cached, there's a problem, but for the time being return NO RELATED
56
- if ( YARPP_NOT_CACHED === $status )
57
- return YARPP_NO_RELATED;
58
- }
59
60
// There are no related posts
61
if ( YARPP_NO_RELATED === $status )
@@ -77,45 +78,46 @@ abstract class YARPP_Cache {
77
* POST STATUS INTERACTIONS
78
*/
79
80
- function save_post($post_ID) {
81
- global $wpdb;
82
-
83
- // @since 3.2: don't compute cache during import
84
- // @since 3.4: don't compute on revisions
85
- if (defined('WP_IMPORTING') || wp_is_post_revision($post_ID))
86
- return;
87
-
88
- // @since 3.4: simply clear the cache on save; don't recompute.
89
- $this->clear((int) $post_ID);
90
- }
91
-
92
// Clear the cache for this entry and for all posts which are "related" to it.
93
// New in 3.2: This is called when a post is deleted.
94
- function delete_post($post_ID) {
95
// Clear the cache for this post.
96
- $this->clear($post_ID);
97
98
- // Find all "peers" which list this post as a related post.
99
- $peers = $this->related(null, $post_ID);
100
- // Clear the peers' caches.
101
- $this->clear($peers);
102
}
103
104
// New in 3.2.1: handle various post_status transitions
105
- function transition_post_status($new_status, $old_status, $post) {
106
- switch ($new_status) {
107
- case "draft":
108
- $this->delete_post($post->ID);
109
- break;
110
- case "publish":
111
- // find everything which is related to this post, and clear them, so that this
112
- // post might show up as related to them.
113
- $related = $this->related($post->ID, null);
114
$this->clear($related);
115
}
116
}
117
118
- function set_score_override_flag($q) {
119
if ( $this->is_yarpp_time() ) {
120
$this->score_override = ($q->query_vars['orderby'] == 'score');
121
@@ -198,7 +200,8 @@ abstract class YARPP_Cache {
198
// HAVING
199
// number_format fix suggested by vkovalcik! :)
200
$safethreshold = number_format(max($threshold,0.1), 2, '.', '');
201
- $newsql .= " having score >= $safethreshold";
202
if ( count($exclude_tt_ids) ) {
203
$newsql .= " and bit_or(terms.term_taxonomy_id in (" . join(',', $exclude_tt_ids) . ")) = 0";
204
}
@@ -576,14 +579,11 @@ class YARPP_Cache_Bypass extends YARPP_Cache {
576
remove_filter('posts_request',array(&$this,'demo_request_filter'));
577
}
578
579
- // @return YARPP_NO_RELATED | YARPP_RELATED | YARPP_NOT_CACHED
580
- public function update($reference_ID) {
581
global $wpdb;
582
583
- // $reference_ID must be numeric
584
- if ( !$reference_ID = absint($reference_ID) )
585
- return YARPP_NOT_CACHED;
586
-
587
return YARPP_RELATED;
588
}
589
39
// Note: return value changed in 3.4
40
// return YARPP_NO_RELATED | YARPP_RELATED | YARPP_DONT_RUN | false if no good input
41
function enforce( $reference_ID, $force = false ) {
42
+ // @since 3.5.3: don't compute on revisions
43
+ if ( $the_post = wp_is_post_revision($reference_ID) )
44
+ $reference_ID = $the_post;
45
+
46
+ if ( !is_int( $reference_ID ) )
47
return false;
48
49
$status = $this->is_cached($reference_ID);
54
return YARPP_DONT_RUN;
55
56
// If not cached, process now:
57
+ if ( YARPP_NOT_CACHED == $status || $force )
58
+ $status = $this->update((int) $reference_ID);
59
+ // status now will be YARPP_NO_RELATED | YARPP_RELATED
60
61
// There are no related posts
62
if ( YARPP_NO_RELATED === $status )
78
* POST STATUS INTERACTIONS
79
*/
80
81
// Clear the cache for this entry and for all posts which are "related" to it.
82
// New in 3.2: This is called when a post is deleted.
83
+ function delete_post( $post_ID ) {
84
// Clear the cache for this post.
85
+ $this->clear((int) $post_ID);
86
87
+ // Find all "peers" which list this post as a related post and clear their caches
88
+ if ( $peers = $this->related(null, (int) $post_ID) )
89
+ $this->clear($peers);
90
}
91
92
// New in 3.2.1: handle various post_status transitions
93
+ function transition_post_status( $new_status, $old_status, $post ) {
94
+ $post_ID = $post->ID;
95
+
96
+ // @since 3.4: don't compute on revisions
97
+ // @since 3.5: compute on the parent instead
98
+ if ( $the_post = wp_is_post_revision($post_ID) )
99
+ $post_ID = $the_post;
100
+
101
+ // unpublish
102
+ if ( $old_status == 'publish' && $new_status != 'publish' ) {
103
+ // Find all "peers" which list this post as a related post and clear their caches
104
+ if ( $peers = $this->related(null, (int) $post_ID) )
105
+ $this->clear($peers);
106
+ }
107
+
108
+ // publish
109
+ if ( $old_status != 'publish' && $new_status == 'publish' ) {
110
+ // find everything which is related to this post, and clear them, so that this
111
+ // post might show up as related to them.
112
+ if ( $related = $this->related($post_ID, null) )
113
$this->clear($related);
114
}
115
+
116
+ // @since 3.4: simply clear the cache on save; don't recompute.
117
+ $this->clear((int) $post_ID);
118
}
119
120
+ function set_score_override_flag( $q ) {
121
if ( $this->is_yarpp_time() ) {
122
$this->score_override = ($q->query_vars['orderby'] == 'score');
123
200
// HAVING
201
// number_format fix suggested by vkovalcik! :)
202
$safethreshold = number_format(max($threshold,0.1), 2, '.', '');
203
+ // @since 3.5.3: ID=0 is a special value; never save such a result.
204
+ $newsql .= " having score >= $safethreshold and ID != 0";
205
if ( count($exclude_tt_ids) ) {
206
$newsql .= " and bit_or(terms.term_taxonomy_id in (" . join(',', $exclude_tt_ids) . ")) = 0";
207
}
579
remove_filter('posts_request',array(&$this,'demo_request_filter'));
580
}
581
582
+ // @return YARPP_NO_RELATED | YARPP_RELATED
583
+ // @used by enforce
584
+ protected function update($reference_ID) {
585
global $wpdb;
586
587
return YARPP_RELATED;
588
}
589
class-core.php CHANGED
@@ -32,16 +32,15 @@ class YARPP {
32
33
register_activation_hook( __FILE__, array($this, 'activate') );
34
35
- // update cache on save
36
- add_action( 'save_post', array($this->cache, 'save_post') );
37
// new in 3.2: update cache on delete
38
- add_action( 'delete_post', array($this->cache, 'delete_post') );
39
// new in 3.2.1: handle post_status transitions
40
add_action( 'transition_post_status', array($this->cache, 'transition_post_status'), 10, 3);
41
42
// automatic display hooks:
43
add_filter( 'the_content', array( $this, 'the_content' ), 1200 );
44
- add_filter( 'the_content_rss', array( $this, 'the_content_rss' ), 600 );
45
add_filter( 'the_excerpt_rss', array( $this, 'the_excerpt_rss' ), 600 );
46
47
if ( isset($_REQUEST['yarpp_debug']) )
@@ -185,6 +184,15 @@ class YARPP {
185
return false;
186
}
187
188
function activate() {
189
global $wpdb;
190
@@ -205,10 +213,12 @@ class YARPP {
205
}
206
207
if ( !get_option('yarpp_version') ) {
208
add_option( 'yarpp_version', YARPP_VERSION );
209
$this->version_info(true);
210
} else {
211
- $this->upgrade_check();
212
}
213
214
return 1;
@@ -224,7 +234,7 @@ class YARPP {
224
return 'UNKNOWN';
225
}
226
227
- function upgrade_check() {
228
$last_version = get_option( 'yarpp_version' );
229
if (version_compare(YARPP_VERSION, $last_version) === 0)
230
return;
@@ -510,14 +520,18 @@ class YARPP {
510
function display_related($reference_ID = null, $args = array(), $echo = true) {
511
global $wp_query, $pagenow;
512
513
- $this->upgrade_check();
514
-
515
- $reference_ID = ( null === $reference_ID || false === $reference_ID ) ?
516
- get_the_ID() : absint($reference_ID);
517
518
// if we're already in a YARPP loop, stop now.
519
if ( $this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time() )
520
return false;
521
522
$this->setup_active_cache( $args );
523
@@ -595,9 +609,12 @@ class YARPP {
595
* @param (array) $args
596
*/
597
function get_related($reference_ID = null, $args = array()) {
598
- $this->upgrade_check();
599
600
$reference_ID = ( null === $reference_ID ) ? get_the_ID() : absint($reference_ID);
601
602
// if we're already in a YARPP loop, stop now.
603
if ( $this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time() )
@@ -634,14 +651,17 @@ class YARPP {
634
* @param (array) $args
635
*/
636
function related_exist($reference_ID = null, $args = array()) {
637
- $this->upgrade_check();
638
639
- $reference_ID = ( null === $reference_ID ) ? get_the_ID() : absint($reference_ID);
640
-
641
// if we're already in a YARPP loop, stop now.
642
if ( $this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time() )
643
return false;
644
645
$this->setup_active_cache( $args );
646
647
$cache_status = $this->active_cache->enforce($reference_ID);
@@ -706,7 +726,7 @@ class YARPP {
706
}
707
708
public function parse_args( $args, $options ) {
709
- $options_with_rss_variants = array( 'limit', 'template', 'excerpt_length', 'before_title', 'after_title', 'before_post', 'after_post', 'before_related', 'after_related', 'no_results', 'order' );
710
711
$r = array();
712
foreach ( $options as $option ) {
@@ -762,8 +782,10 @@ class YARPP {
762
*/
763
764
function the_content($content) {
765
- if (is_feed())
766
- return $this->the_content_rss($content);
767
768
if ( $this->get_option('cross_relate') )
769
$type = $this->get_post_types();
@@ -772,13 +794,13 @@ class YARPP {
772
else
773
$type = array( 'post' );
774
775
- if ( $this->get_option('auto_display') && is_single() )
776
- return $content . $this->display_related(null, array('post_type' => $type, 'domain' => 'website'), false);
777
- else
778
- return $content;
779
}
780
781
- function the_content_rss($content) {
782
if ( $this->get_option('cross_relate') )
783
$type = $this->get_post_types();
784
else if ( 'page' == get_post_type() )
@@ -786,13 +808,14 @@ class YARPP {
786
else
787
$type = array( 'post' );
788
789
- if ( $this->get_option('rss_display') )
790
- return $content . $this->display_related(null, array('post_type' => $type, 'domain' => 'rss'), false);
791
- else
792
- return $content;
793
}
794
795
function the_excerpt_rss($content) {
796
if ( $this->get_option('cross_relate') )
797
$type = $this->get_post_types();
798
else if ( 'page' == get_post_type() )
@@ -800,10 +823,7 @@ class YARPP {
800
else
801
$type = array( 'post' );
802
803
- if ( $this->get_option('rss_excerpt_display') && $this->get_option('rss_display') )
804
- return $content . clean_pre($this->display_related(null, array('post_type' => $type, 'domain' => 'rss'), false));
805
- else
806
- return $content;
807
}
808
809
/*
@@ -819,9 +839,17 @@ class YARPP {
819
if (is_wp_error($remote))
820
return false;
821
822
- $result = unserialize($remote['body']);
823
- set_transient('yarpp_version_info', $result, 60*60*12);
824
}
825
return $result;
826
}
827
}
32
33
register_activation_hook( __FILE__, array($this, 'activate') );
34
35
// new in 3.2: update cache on delete
36
+ add_action( 'delete_post', array($this->cache, 'delete_post'), 10, 1 );
37
// new in 3.2.1: handle post_status transitions
38
+ // new in 3.5.3: use transition_post_status instead of save_post hook
39
add_action( 'transition_post_status', array($this->cache, 'transition_post_status'), 10, 3);
40
41
// automatic display hooks:
42
add_filter( 'the_content', array( $this, 'the_content' ), 1200 );
43
+ add_filter( 'the_content_feed', array( $this, 'the_content_feed' ), 600 );
44
add_filter( 'the_excerpt_rss', array( $this, 'the_excerpt_rss' ), 600 );
45
46
if ( isset($_REQUEST['yarpp_debug']) )
184
return false;
185
}
186
187
+ // @since 3.5.2: function to enforce YARPP setup
188
+ // if new install, activate; else upgrade
189
+ function enforce() {
190
+ if ( !get_option('yarpp_version') )
191
+ $this->activate();
192
+ else
193
+ $this->upgrade();
194
+ }
195
+
196
function activate() {
197
global $wpdb;
198
213
}
214
215
if ( !get_option('yarpp_version') ) {
216
+ // new install
217
add_option( 'yarpp_version', YARPP_VERSION );
218
$this->version_info(true);
219
} else {
220
+ // upgrade
221
+ $this->upgrade();
222
}
223
224
return 1;
234
return 'UNKNOWN';
235
}
236
237
+ function upgrade() {
238
$last_version = get_option( 'yarpp_version' );
239
if (version_compare(YARPP_VERSION, $last_version) === 0)
240
return;
520
function display_related($reference_ID = null, $args = array(), $echo = true) {
521
global $wp_query, $pagenow;
522
523
+ $this->enforce();
524
525
// if we're already in a YARPP loop, stop now.
526
if ( $this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time() )
527
return false;
528
+
529
+ $reference_ID = ( null === $reference_ID || false === $reference_ID ) ?
530
+ get_the_ID() : absint($reference_ID);
531
+
532
+ // @since 3.5.3: don't compute on revisions
533
+ if ( $the_post = wp_is_post_revision($reference_ID) )
534
+ $reference_ID = $the_post;
535
536
$this->setup_active_cache( $args );
537
609
* @param (array) $args
610
*/
611
function get_related($reference_ID = null, $args = array()) {
612
+ $this->enforce();
613
614
$reference_ID = ( null === $reference_ID ) ? get_the_ID() : absint($reference_ID);
615
+ // @since 3.5.3: don't compute on revisions
616
+ if ( $the_post = wp_is_post_revision($reference_ID) )
617
+ $reference_ID = $the_post;
618
619
// if we're already in a YARPP loop, stop now.
620
if ( $this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time() )
651
* @param (array) $args
652
*/
653
function related_exist($reference_ID = null, $args = array()) {
654
+ $this->enforce();
655
656
// if we're already in a YARPP loop, stop now.
657
if ( $this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time() )
658
return false;
659
660
+ $reference_ID = ( null === $reference_ID ) ? get_the_ID() : absint($reference_ID);
661
+ // @since 3.5.3: don't compute on revisions
662
+ if ( $the_post = wp_is_post_revision($reference_ID) )
663
+ $reference_ID = $the_post;
664
+
665
$this->setup_active_cache( $args );
666
667
$cache_status = $this->active_cache->enforce($reference_ID);
726
}
727
728
public function parse_args( $args, $options ) {
729
+ $options_with_rss_variants = array( 'limit', 'template', 'excerpt_length', 'before_title', 'after_title', 'before_post', 'after_post', 'before_related', 'after_related', 'no_results', 'order', 'promote_yarpp' );
730
731
$r = array();
732
foreach ( $options as $option ) {
782
*/
783
784
function the_content($content) {
785
+ if ( is_feed() ||
786
+ !$this->get_option('auto_display') ||
787
+ !is_singular(array('post')) )
788
+ return $content;
789
790
if ( $this->get_option('cross_relate') )
791
$type = $this->get_post_types();
794
else
795
$type = array( 'post' );
796
797
+ return $content . $this->display_related(null, array('post_type' => $type, 'domain' => 'website'), false);
798
}
799
800
+ function the_content_feed($content) {
801
+ if ( !$this->get_option('rss_display') )
802
+ return $content;
803
+
804
if ( $this->get_option('cross_relate') )
805
$type = $this->get_post_types();
806
else if ( 'page' == get_post_type() )
808
else
809
$type = array( 'post' );
810
811
+ return $content . $this->display_related(null, array('post_type' => $type, 'domain' => 'rss'), false);
812
}
813
814
function the_excerpt_rss($content) {
815
+ if ( !$this->get_option('rss_excerpt_display') ||
816
+ !$this->get_option('rss_display') )
817
+ return $content;
818
+
819
if ( $this->get_option('cross_relate') )
820
$type = $this->get_post_types();
821
else if ( 'page' == get_post_type() )
823
else
824
$type = array( 'post' );
825
826
+ return $content . $this->clean_pre($this->display_related(null, array('post_type' => $type, 'domain' => 'rss'), false));
827
}
828
829
/*
839
if (is_wp_error($remote))
840
return false;
841
842
+ if ( $result = @unserialize($remote['body']) )
843
+ set_transient('yarpp_version_info', $result, 60*60*12);
844
}
845
return $result;
846
}
847
+
848
+ // 3.5.2: clean_pre is deprecated in WP 3.4, so implement here.
849
+ function clean_pre( $text ) {
850
+ $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text);
851
+ $text = str_replace('<p>', "\n", $text);
852
+ $text = str_replace('</p>', '', $text);
853
+ return $text;
854
+ }
855
}
lang/yarpp-nl_NL.mo CHANGED
Binary file
lang/yarpp-nl_NL.po CHANGED
@@ -1,9 +1,9 @@
1
msgid ""
2
msgstr ""
3
- "Project-Id-Version: Yet Another Related Posts Plugin v3.0.2\n"
4
"Report-Msgid-Bugs-To: \n"
5
"POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2009-04-27 21:12+0200\n"
7
"Last-Translator: admin <werf75@gmail.com>\n"
8
"Language-Team: \n"
9
"MIME-Version: 1.0\n"
@@ -19,457 +19,380 @@ msgstr ""
19
"X-Poedit-SearchPath-0: .\n"
20
"X-Textdomain-Support: yes"
21
22
- #: includes.php:149
23
- #: includes.php:194
24
- #: includes.php:215
25
#@ yarpp
26
msgid "Related Posts (YARPP)"
27
msgstr "Gerelateerde bijdragen (YARPP)"
28
29
- #: includes.php:376
30
#@ yarpp
31
msgid "Related Posts"
32
msgstr "Gerelateerde bijdragen"
33
34
- #: cache-postmeta.php:105
35
- #: cache-tables.php:131
36
#@ yarpp
37
msgid "Example post "
38
msgstr "Voorbeeld bijdrage"
39
40
- #: magic.php:297
41
- #: options-meta-boxes.php:205
42
- #: options-meta-boxes.php:269
43
#, php-format
44
#@ yarpp
45
msgid "Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>."
46
msgstr "Gerelateerde bijdragen mogelijk gemaakt door <a href='%s'>Yet Another Related Posts Plugin</a>."
47
48
- #: options.php:54
49
#@ yarpp
50
msgid "The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria."
51
msgstr "De MyISAM controle is overgeslagen. Je kunt nu de \"overweeg titels\" en \"overweeg bijdrage\" criteria relateren."
52
53
- #: options.php:63
54
#, php-format
55
#@ yarpp
56
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."
57
msgstr "YARPP's \"Overweeg titels\" en \"overweeg bijdragen\" gerelateerdheidscriteria vereisen je <code>%s</code> tabel om de <a href='http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html'>MyISAM engine</a> te gebruiken, maar de tabel lijkt de <code>%s</code> engine te gebruiken. Deze twee opties zijn uitgeschakeld."
58
59
- #: options.php:65
60
#, php-format
61
#@ yarpp
62
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."
63
msgstr "Om de mogelijkheden te herstellen, werk je <code>%s</code> tabel bij door het volgende SQL uit te voeren:<code>ALTER TABLE `%s` ENGINE = MyISAM;</code> .Er zullen geen gegevens gewist worden door de tabel-engine te wijzigen, maar er kunnen snelheidsproblemen optreden. "
64
65
- #: options.php:67
66
#, php-format
67
#@ yarpp
68
msgid "If, despite this check, you are sure that <code>%s</code> is using the MyISAM engine, press this magic button:"
69
msgstr "Als, ondanks deze controle, je zeker bent dat <code>%s</code> gebruikt maakt van de MyISAM engine, klik op de magische knop:"
70
71
- #: options.php:70
72
#@ yarpp
73
msgid "Trust me. Let me use MyISAM features."
74
msgstr "Vertrouw me. Laat mij MyISAM mogelijkheden gebruiken."
75
76
- #: options.php:83
77
#@ yarpp
78
msgid "The YARPP database had an error but has been fixed."
79
msgstr "De YARPP database had een foutje maar is hersteld."
80
81
- #: options.php:85
82
#@ yarpp
83
msgid "The YARPP database has an error which could not be fixed."
84
msgstr "De YARPP database heeft en fout die niet opgelost kon worden."
85
86
- #: options.php:114
87
#@ yarpp
88
msgid "Options saved!"
89
msgstr "Instellingen opgeslagen!"
90
91
- #: options-meta-boxes.php:38
92
- #@ yarpp
93
- msgid "word"
94
- msgstr "woord"
95
-
96
- #: options-meta-boxes.php:39
97
- #@ yarpp
98
- msgid "tag"
99
- msgstr "label"
100
-
101
- #: options-meta-boxes.php:40
102
- #@ yarpp
103
- msgid "category"
104
- msgstr "categorie"
105
-
106
- #: options-meta-boxes.php:45
107
- #: options-meta-boxes.php:63
108
- #: options-meta-boxes.php:76
109
#@ yarpp
110
msgid "do not consider"
111
msgstr "overweeg niet"
112
113
- #: options-meta-boxes.php:46
114
- #: options-meta-boxes.php:64
115
- #: options-meta-boxes.php:78
116
#@ yarpp
117
msgid "consider"
118
msgstr "overweeg"
119
120
- #: options-meta-boxes.php:48
121
- #: options-meta-boxes.php:80
122
#, php-format
123
#@ yarpp
124
msgid "require at least one %s in common"
125
msgstr "ten minste een % s overeenkomstig"
126
127
- #: options-meta-boxes.php:50
128
- #: options-meta-boxes.php:82
129
#, php-format
130
#@ yarpp
131
msgid "require more than one %s in common"
132
msgstr "vereist meer dan een % s overeenkomstig"
133
134
- #: options-meta-boxes.php:65
135
#@ yarpp
136
msgid "consider with extra weight"
137
msgstr "overweeg met extra gewicht"
138
139
- #: options.php:178
140
#@ yarpp
141
msgid "Yet Another Related Posts Plugin Options"
142
msgstr "Yet Another Related Posts Plugin opties"
143
144
- #: options-meta-boxes.php:286
145
#@ default
146
#@ yarpp
147
msgid "Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal"
148
msgstr "Doneer mitcho (Michael Yoshitaka Erlewine) voor deze plugin via PayPal"
149
150
- #: options-meta-boxes.php:118
151
#@ yarpp
152
msgid "\"The Pool\""
153
msgstr "\"Het zwembad\""
154
155
- #: options-meta-boxes.php:91
156
#@ yarpp
157
msgid "\"The Pool\" refers to the pool of posts and pages that are candidates for display as related to the current entry."
158
msgstr "\"Het zwembad\" verwijst naar het bad met bijdragen en pagina's die kandidaat zijn voor het vertonen als gerelateerd."
159
160
- #: options-meta-boxes.php:96
161
- #@ yarpp
162
- msgid "Disallow by category:"
163
- msgstr "Uitschakelen per categorie:"
164
-
165
- #: options-meta-boxes.php:98
166
- #@ yarpp
167
- msgid "Disallow by tag:"
168
- msgstr "Uitschakelen bij label:"
169
-
170
- #: options-meta-boxes.php:101
171
#@ yarpp
172
msgid "Show password protected posts?"
173
msgstr "Toon paswoordbeveiligde bijdragen?"
174
175
- #: options-meta-boxes.php:140
176
#@ yarpp
177
msgid "Show only previous posts?"
178
msgstr "Toon alleen vorige bijdragen?"
179
180
- #: options-meta-boxes.php:105
181
#@ yarpp
182
msgid "day(s)"
183
msgstr "dag (en)"
184
185
- #: options-meta-boxes.php:106
186
#@ yarpp
187
msgid "week(s)"
188
msgstr "we(e)k(en)"
189
190
- #: options-meta-boxes.php:107
191
#@ yarpp
192
msgid "month(s)"
193
msgstr "maand (en)"
194
195
- #: options-meta-boxes.php:109
196
#@ yarpp
197
msgid "Show only posts from the past NUMBER UNITS"
198
- msgstr "Toon alleen bijdragen van de afgelopen AANTAL EENHEDEN"
199
200
- #: options-meta-boxes.php:148
201
#@ yarpp
202
msgid "\"Relatedness\" options"
203
msgstr "\"Gerelateerdheid\" opties"
204
205
- #: options-meta-boxes.php:124
206
- #: options-meta-boxes.php:139
207
- #: options-meta-boxes.php:157
208
- #: options-meta-boxes.php:161
209
- #: options-meta-boxes.php:204
210
- #: options-meta-boxes.php:221
211
- #: options-meta-boxes.php:223
212
#: options-meta-boxes.php:228
213
- #: options-meta-boxes.php:268
214
#@ yarpp
215
msgid "more&gt;"
216
msgstr "meer&gt;"
217
218
- #: options-meta-boxes.php:124
219
#@ yarpp
220
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."
221
msgstr "Hoe hoger de overeenkomstdrempel hoe meer restricties en hoe minder gerelateerde bijdragen. De standaard overeenkomstdrempel is 5. Als je zoekt naar een goede drempel bekijk dan enkele gerelateerde bijdragen van de bijdragen en de scores. Je kunt zien wat voor soort gerelateerde er zijn opgepikt, wat de soort overeenkomst is en zo een juiste drempel instellen voor je website."
222
223
- #: options-meta-boxes.php:130
224
#@ yarpp
225
msgid "Match threshold:"
226
msgstr "Overeenkomst-drempel:"
227
228
- #: options-meta-boxes.php:131
229
#@ yarpp
230
msgid "Titles: "
231
- msgstr "Titels:"
232
233
- #: options-meta-boxes.php:133
234
#@ yarpp
235
msgid "Bodies: "
236
- msgstr "Bijdragen:"
237
-
238
- #: options-meta-boxes.php:135
239
- #@ yarpp
240
- msgid "Tags: "
241
- msgstr "Labels:"
242
-
243
- #: options-meta-boxes.php:137
244
- #@ yarpp
245
- msgid "Categories: "
246
- msgstr "Categorieën:"
247
-
248
- #: options-meta-boxes.php:139
249
- #@ yarpp
250
- msgid "Cross-relate posts and pages?"
251
- msgstr "Kruislinken van bijdragen en pagina&#39;s?"
252
-
253
- #: options-meta-boxes.php:139
254
- #@ yarpp
255
- 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."
256
- msgstr "Wanneer de \"Kruislinken van bijdragen en pagina&#39;s\" optie is ingeschakeld <code>related_posts()</code>, <code>related_pages()</code> en <code>related_entries()</code> zullen allemaal dezelfde uitkomst geven en zowel gerelateerde pagina&#39;s a;s bijdragen tonen."
257
258
- #: options.php:46
259
#, php-format
260
#@ yarpp
261
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."
262
msgstr "Er is een nieuwe beta (%s) van Yet Another Related Posts Plugin. Je kunt het <a href=\"%s\">Hier downloaden</a> op eigen risico."
263
264
- #: options-meta-boxes.php:212
265
#@ yarpp
266
msgid "Display options <small>for your website</small>"
267
msgstr "Toon opties <small> voor je website </small>"
268
269
- #: options-meta-boxes.php:157
270
#@ yarpp
271
msgid "Automatically display related posts?"
272
msgstr "Automatisch gerelateerde bijdragen tonen?"
273
274
- #: options-meta-boxes.php:157
275
#@ yarpp
276
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."
277
msgstr "Deze optie toont automatisch gerelateerde bijdragen meteen na de inhoud van een bijdrage op een enkele pagina. Als deze optie is uitgeschakeld zul je de voglende code handmatig in moeten voegen: <code>related_posts()</code> of variaties (<code>related_pages()</code> en <code>related_entries()</code>) in je themabestanden."
278
279
- #: options-meta-boxes.php:158
280
#@ yarpp
281
msgid "Website display code example"
282
msgstr "Websitevertoning code voorbeeld"
283
284
- #: options-meta-boxes.php:158
285
- #: options-meta-boxes.php:221
286
#@ yarpp
287
msgid "(Update options to reload.)"
288
msgstr "(Bewaar opties om te herladen.)"
289
290
- #: options-meta-boxes.php:160
291
- #: options-meta-boxes.php:226
292
#@ yarpp
293
msgid "Maximum number of related posts:"
294
msgstr "Maximum aantal gerelateerde bijdragen:"
295
296
- #: includes.php:248
297
- #: options-meta-boxes.php:161
298
- #: options-meta-boxes.php:228
299
#@ yarpp
300
msgid "Display using a custom template file"
301
msgstr "Toon met een eigen sjabloonbestand"
302
303
- #: options-meta-boxes.php:228
304
- #@ yarpp
305
- msgid "NEW!"
306
- msgstr "NIEUW!"
307
-
308
- #: options-meta-boxes.php:161
309
- #: options-meta-boxes.php:228
310
#@ yarpp
311
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."
312
msgstr "Deze uitgebreide opties geeft je volledige kracht om te kiezen hoe de gerelateerde bijdragen getoond worden. Sjablonen (opgeslagen in de map van je thema) zijn geschreven in PHP."
313
314
- #: includes.php:249
315
- #: options-meta-boxes.php:165
316
- #: options-meta-boxes.php:233
317
#@ yarpp
318
msgid "Template file:"
319
msgstr "Sjabloonbestand:"
320
321
- #: options-meta-boxes.php:175
322
- #: options-meta-boxes.php:244
323
#@ yarpp
324
msgid "Before / after related entries:"
325
msgstr "Voor / na gerelateerde bijdrages:"
326
327
- #: options-meta-boxes.php:175
328
- #: options-meta-boxes.php:176
329
- #: options-meta-boxes.php:184
330
- #: options-meta-boxes.php:244
331
- #: options-meta-boxes.php:245
332
- #: options-meta-boxes.php:250
333
#@ yarpp
334
msgid "For example:"
335
msgstr "Bijvoorbeeld:"
336
337
- #: options-meta-boxes.php:176
338
- #: options-meta-boxes.php:245
339
#@ yarpp
340
msgid "Before / after each related entry:"
341
msgstr "Voor / na elke gerelateerde bijdrage:"
342
343
- #: options-meta-boxes.php:178
344
- #: options-meta-boxes.php:247
345
#@ yarpp
346
msgid "Show excerpt?"
347
msgstr "Toon uittreksel?"
348
349
- #: options-meta-boxes.php:179
350
- #: options-meta-boxes.php:248
351
#@ yarpp
352
msgid "Excerpt length (No. of words):"
353
msgstr "Lengte uittreksel (aantal woorden):"
354
355
- #: options-meta-boxes.php:183
356
#@ yarpp
357
msgid "Before / after (Excerpt):"
358
msgstr "Voor / na (uittreksel):"
359
360
- #: options-meta-boxes.php:189
361
- #: options-meta-boxes.php:254
362
#@ yarpp
363
msgid "Order results:"
364
msgstr "Sorteer resultaten:"
365
366
- #: options-meta-boxes.php:191
367
- #: options-meta-boxes.php:256
368
#@ yarpp
369
msgid "score (high relevance to low)"
370
msgstr "Waardering (hoge naar lage relevantie)"
371
372
- #: options-meta-boxes.php:192
373
- #: options-meta-boxes.php:257
374
#@ yarpp
375
msgid "score (low relevance to high)"
376
msgstr "Waardering (lage naar hoge relevantie)"
377
378
- #: options-meta-boxes.php:193
379
- #: options-meta-boxes.php:258
380
#@ yarpp
381
msgid "date (new to old)"
382
msgstr "datum (nieuw naar oud)"
383
384
- #: options-meta-boxes.php:194
385
- #: options-meta-boxes.php:259
386
#@ yarpp
387
msgid "date (old to new)"
388
msgstr "datum (oud naar nieuw)"
389
390
- #: options-meta-boxes.php:195
391
- #: options-meta-boxes.php:260
392
#@ yarpp
393
msgid "title (alphabetical)"
394
msgstr "titel (alfabetisch)"
395
396
- #: options-meta-boxes.php:196
397
- #: options-meta-boxes.php:261
398
#@ yarpp
399
msgid "title (reverse alphabetical)"
400
msgstr "titel (omgekeerd alfabetisch)"
401
402
- #: options-meta-boxes.php:201
403
- #: options-meta-boxes.php:266
404
#@ yarpp
405
msgid "Default display if no results:"
406
msgstr "Standaard tonen indien geen resultaten:"
407
408
- #: includes.php:257
409
- #: options-meta-boxes.php:203
410
- #: options-meta-boxes.php:268
411
#@ yarpp
412
msgid "Help promote Yet Another Related Posts Plugin?"
413
msgstr "Help Yet Another Related Posts Plugin promoten?"
414
415
- #: options-meta-boxes.php:205
416
- #: options-meta-boxes.php:269
417
#, php-format
418
#@ yarpp
419
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."
420
msgstr "Deze optie voegt de code %s toe. Probeer het aan te zetten, je opties bij te werken en zie de code in het codevoorbeeld rechts. Deze links en donaties worden gewaardeerd."
421
422
- #: options-meta-boxes.php:276
423
#@ yarpp
424
msgid "Display options <small>for RSS</small>"
425
msgstr "Vertoningsopties <small>voor RSS</small>"
426
427
- #: options-meta-boxes.php:221
428
#@ yarpp
429
msgid "Display related posts in feeds?"
430
msgstr "Toon gerelateerde bijdragen in feeds?"
431
432
- #: options-meta-boxes.php:221
433
#@ yarpp
434
msgid "This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed."
435
msgstr "Deze optie toont gerelateerde bijdragen aan het einde van ieder item in je RSS en ATOM feeds. Sjabloonwijzigingen niet nodig."
436
437
- #: options-meta-boxes.php:223
438
#@ yarpp
439
msgid "Display related posts in the descriptions?"
440
msgstr "Toon gerelateerde bijdragen in de omschrijving?"
441
442
- #: options-meta-boxes.php:223
443
#@ yarpp
444
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."
445
msgstr "Deze optie toont de gerelateerde bijdragen in de RSS beschrijving, niet alleen de inhoud. Als je feed is ingesteld om alleen uittreksels te tonen, hoe dan ook, alleen het omschrijvingsveld wordt gebruikt, dus deze optie is vereist voor iedere vertoning."
446
447
- #: options-meta-boxes.php:221
448
#@ yarpp
449
msgid "RSS display code example"
450
msgstr "Voorbeeld RSS-vertoningscode "
451
452
- #: options-meta-boxes.php:250
453
#@ yarpp
454
msgid "Before / after (excerpt):"
455
msgstr "Voor / na (uittreksel):"
456
457
- #: options.php:279
458
- #@ yarpp
459
- msgid "Update options"
460
- msgstr "Opties bijwerken"
461
-
462
- #: options.php:280
463
- #@ yarpp
464
- msgid "Do you really want to reset your configuration?"
465
- msgstr "Wil je echt de instellingen herstellen?"
466
-
467
- #: options.php:280
468
- #@ yarpp
469
- msgid "Reset options"
470
- msgstr "Opties herstellen"
471
-
472
- #: template-builtin.php:35
473
#, php-format
474
#@ yarpp
475
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."
@@ -480,90 +403,140 @@ msgstr "%f is de YARPP overeenkomst tussen de huidige bijdrage en de gerelateerd
480
msgid "These are the related entries for this entry. Updating this post may change these related posts."
481
msgstr "Er zijn gerelateerde bijdragen voor deze bijdrage. Het bijwerken van deze bijdrage kan de gerelateerde bijdragen veranderen."
482
483
- #: template-metabox.php:25
484
#@ yarpp
485
msgid "Whether all of these related entries are actually displayed and how they are displayed depends on your YARPP display options."
486
msgstr "Of al deze gelateerde bijdragen getoond worden op de manier zoals je ze getoond wilt hebben hangt af van je YARPP instellingen."
487
488
- #: includes.php:28
489
- #: includes.php:39
490
- #: template-metabox.php:27
491
#: template-widget.php:13
492
#@ yarpp
493
msgid "No related posts."
494
msgstr "Geen gerelateerde bijdragen."
495
496
- #: includes.php:26
497
- #: includes.php:37
498
#@ yarpp
499
msgid "Related posts:"
500
msgstr "Gerelateerde bijdragen"
501
502
- #: options-meta-boxes.php:175
503
- #: options-meta-boxes.php:176
504
- #: options-meta-boxes.php:184
505
- #: options-meta-boxes.php:244
506
- #: options-meta-boxes.php:245
507
- #: options-meta-boxes.php:250
508
#@ yarpp
509
msgid " or "
510
- msgstr "of"
511
512
- #: includes.php:169
513
- #@ yarpp
514
msgid "Settings"
515
msgstr ""
516
517
- #: includes.php:243
518
#@ default
519
msgid "Title:"
520
msgstr ""
521
522
- #: includes.php:385
523
#@ yarpp
524
msgid "Related entries may be displayed once you save your entry"
525
msgstr ""
526
527
- #: options-meta-boxes.php:124
528
#@ yarpp
529
msgid "YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>."
530
msgstr ""
531
532
- #: options-meta-boxes.php:283
533
#@ yarpp
534
msgid "YARPP Forum"
535
msgstr ""
536
537
- #: options-meta-boxes.php:284
538
#@ yarpp
539
msgid "YARPP on Twitter"
540
msgstr ""
541
542
- #: options-meta-boxes.php:285
543
#@ yarpp
544
msgid "YARPP on the Web"
545
msgstr ""
546
547
- #: options-meta-boxes.php:292
548
#@ yarpp
549
msgid "Contact YARPP"
550
msgstr ""
551
552
- #: options.php:42
553
#, php-format
554
#@ default
555
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>."
556
msgstr ""
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:188
565
#, php-format
566
#@ yarpp
567
msgid "by <a href=\"%s\" target=\"_blank\">mitcho (Michael 芳貴 Erlewine)</a>"
568
msgstr ""
569
1
msgid ""
2
msgstr ""
3
+ "Project-Id-Version: Yet Another Related Posts Plugin v3.5.2b3\n"
4
"Report-Msgid-Bugs-To: \n"
5
"POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2012-08-24 10:22:57+0000\n"
7
"Last-Translator: admin <werf75@gmail.com>\n"
8
"Language-Team: \n"
9
"MIME-Version: 1.0\n"
19
"X-Poedit-SearchPath-0: .\n"
20
"X-Textdomain-Support: yes"
21
22
+ #: class-admin.php:55
23
+ #: class-widget.php:7
24
+ #: class-widget.php:59
25
#@ yarpp
26
msgid "Related Posts (YARPP)"
27
msgstr "Gerelateerde bijdragen (YARPP)"
28
29
+ #: class-admin.php:63
30
#@ yarpp
31
msgid "Related Posts"
32
msgstr "Gerelateerde bijdragen"
33
34
+ #: class-cache.php:522
35
#@ yarpp
36
msgid "Example post "
37
msgstr "Voorbeeld bijdrage"
38
39
+ #: class-core.php:586
40
+ #: class-core.php:701
41
+ #: options-meta-boxes.php:229
42
+ #: options-meta-boxes.php:284
43
#, php-format
44
#@ yarpp
45
msgid "Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>."
46
msgstr "Gerelateerde bijdragen mogelijk gemaakt door <a href='%s'>Yet Another Related Posts Plugin</a>."
47
48
+ #: options.php:46
49
#@ yarpp
50
msgid "The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria."
51
msgstr "De MyISAM controle is overgeslagen. Je kunt nu de \"overweeg titels\" en \"overweeg bijdrage\" criteria relateren."
52
53
+ #: options.php:54
54
#, php-format
55
#@ yarpp
56
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."
57
msgstr "YARPP's \"Overweeg titels\" en \"overweeg bijdragen\" gerelateerdheidscriteria vereisen je <code>%s</code> tabel om de <a href='http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html'>MyISAM engine</a> te gebruiken, maar de tabel lijkt de <code>%s</code> engine te gebruiken. Deze twee opties zijn uitgeschakeld."
58
59
+ #: options.php:56
60
#, php-format
61
#@ yarpp
62
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."
63
msgstr "Om de mogelijkheden te herstellen, werk je <code>%s</code> tabel bij door het volgende SQL uit te voeren:<code>ALTER TABLE `%s` ENGINE = MyISAM;</code> .Er zullen geen gegevens gewist worden door de tabel-engine te wijzigen, maar er kunnen snelheidsproblemen optreden. "
64
65
+ #: options.php:58
66
#, php-format
67
#@ yarpp
68
msgid "If, despite this check, you are sure that <code>%s</code> is using the MyISAM engine, press this magic button:"
69
msgstr "Als, ondanks deze controle, je zeker bent dat <code>%s</code> gebruikt maakt van de MyISAM engine, klik op de magische knop:"
70
71
+ #: options.php:61
72
#@ yarpp
73
msgid "Trust me. Let me use MyISAM features."
74
msgstr "Vertrouw me. Laat mij MyISAM mogelijkheden gebruiken."
75
76
+ #: options.php:76
77
#@ yarpp
78
msgid "The YARPP database had an error but has been fixed."
79
msgstr "De YARPP database had een foutje maar is hersteld."
80
81
+ #: options.php:78
82
#@ yarpp
83
msgid "The YARPP database has an error which could not be fixed."
84
msgstr "De YARPP database heeft en fout die niet opgelost kon worden."
85
86
+ #: options.php:135
87
#@ yarpp
88
msgid "Options saved!"
89
msgstr "Instellingen opgeslagen!"
90
91
+ #: options-meta-boxes.php:47
92
+ #: options-meta-boxes.php:59
93
#@ yarpp
94
msgid "do not consider"
95
msgstr "overweeg niet"
96
97
+ #: options-meta-boxes.php:48
98
+ #: options-meta-boxes.php:60
99
#@ yarpp
100
msgid "consider"
101
msgstr "overweeg"
102
103
+ #: options-meta-boxes.php:50
104
#, php-format
105
#@ yarpp
106
msgid "require at least one %s in common"
107
msgstr "ten minste een % s overeenkomstig"
108
109
+ #: options-meta-boxes.php:51
110
#, php-format
111
#@ yarpp
112
msgid "require more than one %s in common"
113
msgstr "vereist meer dan een % s overeenkomstig"
114
115
+ #: options-meta-boxes.php:49
116
+ #: options-meta-boxes.php:61
117
#@ yarpp
118
msgid "consider with extra weight"
119
msgstr "overweeg met extra gewicht"
120
121
+ #: options.php:141
122
#@ yarpp
123
msgid "Yet Another Related Posts Plugin Options"
124
msgstr "Yet Another Related Posts Plugin opties"
125
126
+ #: options-meta-boxes.php:302
127
#@ default
128
#@ yarpp
129
msgid "Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal"
130
msgstr "Doneer mitcho (Michael Yoshitaka Erlewine) voor deze plugin via PayPal"
131
132
+ #: options-meta-boxes.php:147
133
#@ yarpp
134
msgid "\"The Pool\""
135
msgstr "\"Het zwembad\""
136
137
+ #: options-meta-boxes.php:109
138
#@ yarpp
139
msgid "\"The Pool\" refers to the pool of posts and pages that are candidates for display as related to the current entry."
140
msgstr "\"Het zwembad\" verwijst naar het bad met bijdragen en pagina's die kandidaat zijn voor het vertonen als gerelateerd."
141
142
+ #: options-meta-boxes.php:118
143
#@ yarpp
144
msgid "Show password protected posts?"
145
msgstr "Toon paswoordbeveiligde bijdragen?"
146
147
+ #: options-meta-boxes.php:170
148
#@ yarpp
149
msgid "Show only previous posts?"
150
msgstr "Toon alleen vorige bijdragen?"
151
152
+ #: options-meta-boxes.php:129
153
#@ yarpp
154
msgid "day(s)"
155
msgstr "dag (en)"
156
157
+ #: options-meta-boxes.php:130
158
#@ yarpp
159
msgid "week(s)"
160
msgstr "we(e)k(en)"
161
162
+ #: options-meta-boxes.php:131
163
#@ yarpp
164
msgid "month(s)"
165
msgstr "maand (en)"
166
167
+ #: options-meta-boxes.php:137
168
#@ yarpp
169
msgid "Show only posts from the past NUMBER UNITS"
170
+ msgstr "Toon alleen bijdragen van de afgelopen NUMBER UNITS"
171
172
+ #: options-meta-boxes.php:178
173
#@ yarpp
174
msgid "\"Relatedness\" options"
175
msgstr "\"Gerelateerdheid\" opties"
176
177
+ #: options-meta-boxes.php:17
178
+ #: options-meta-boxes.php:113
179
+ #: options-meta-boxes.php:153
180
+ #: options-meta-boxes.php:169
181
+ #: options-meta-boxes.php:187
182
#: options-meta-boxes.php:228
183
+ #: options-meta-boxes.php:245
184
+ #: options-meta-boxes.php:247
185
+ #: options-meta-boxes.php:283
186
#@ yarpp
187
msgid "more&gt;"
188
msgstr "meer&gt;"
189
190
+ #: options-meta-boxes.php:153
191
#@ yarpp
192
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."
193
msgstr "Hoe hoger de overeenkomstdrempel hoe meer restricties en hoe minder gerelateerde bijdragen. De standaard overeenkomstdrempel is 5. Als je zoekt naar een goede drempel bekijk dan enkele gerelateerde bijdragen van de bijdragen en de scores. Je kunt zien wat voor soort gerelateerde er zijn opgepikt, wat de soort overeenkomst is en zo een juiste drempel instellen voor je website."
194
195
+ #: options-meta-boxes.php:159
196
#@ yarpp
197
msgid "Match threshold:"
198
msgstr "Overeenkomst-drempel:"
199
200
+ #: options-meta-boxes.php:160
201
#@ yarpp
202
msgid "Titles: "
203
+ msgstr "Titels: "
204
205
+ #: options-meta-boxes.php:162
206
#@ yarpp
207
msgid "Bodies: "
208
+ msgstr "Bijdragen: "
209
210
+ #: options.php:38
211
#, php-format
212
#@ yarpp
213
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."
214
msgstr "Er is een nieuwe beta (%s) van Yet Another Related Posts Plugin. Je kunt het <a href=\"%s\">Hier downloaden</a> op eigen risico."
215
216
+ #: options-meta-boxes.php:236
217
#@ yarpp
218
msgid "Display options <small>for your website</small>"
219
msgstr "Toon opties <small> voor je website </small>"
220
221
+ #: options-meta-boxes.php:187
222
#@ yarpp
223
msgid "Automatically display related posts?"
224
msgstr "Automatisch gerelateerde bijdragen tonen?"
225
226
+ #: options-meta-boxes.php:187
227
#@ yarpp
228
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."
229
msgstr "Deze optie toont automatisch gerelateerde bijdragen meteen na de inhoud van een bijdrage op een enkele pagina. Als deze optie is uitgeschakeld zul je de voglende code handmatig in moeten voegen: <code>related_posts()</code> of variaties (<code>related_pages()</code> en <code>related_entries()</code>) in je themabestanden."
230
231
+ #: options-meta-boxes.php:188
232
#@ yarpp
233
msgid "Website display code example"
234
msgstr "Websitevertoning code voorbeeld"
235
236
+ #: options-meta-boxes.php:188
237
+ #: options-meta-boxes.php:245
238
#@ yarpp
239
msgid "(Update options to reload.)"
240
msgstr "(Bewaar opties om te herladen.)"
241
242
+ #: options-meta-boxes.php:190
243
+ #: options-meta-boxes.php:250
244
#@ yarpp
245
msgid "Maximum number of related posts:"
246
msgstr "Maximum aantal gerelateerde bijdragen:"
247
248
+ #: class-widget.php:75
249
+ #: options-meta-boxes.php:17
250
#@ yarpp
251
msgid "Display using a custom template file"
252
msgstr "Toon met een eigen sjabloonbestand"
253
254
+ #: options-meta-boxes.php:17
255
#@ yarpp
256
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."
257
msgstr "Deze uitgebreide opties geeft je volledige kracht om te kiezen hoe de gerelateerde bijdragen getoond worden. Sjablonen (opgeslagen in de map van je thema) zijn geschreven in PHP."
258
259
+ #: class-widget.php:76
260
+ #: options-meta-boxes.php:196
261
+ #: options-meta-boxes.php:258
262
#@ yarpp
263
msgid "Template file:"
264
msgstr "Sjabloonbestand:"
265
266
+ #: options-meta-boxes.php:208
267
+ #: options-meta-boxes.php:271
268
#@ yarpp
269
msgid "Before / after related entries:"
270
msgstr "Voor / na gerelateerde bijdrages:"
271
272
+ #: options-meta-boxes.php:208
273
+ #: options-meta-boxes.php:209
274
+ #: options-meta-boxes.php:217
275
+ #: options-meta-boxes.php:271
276
+ #: options-meta-boxes.php:272
277
+ #: options-meta-boxes.php:277
278
#@ yarpp
279
msgid "For example:"
280
msgstr "Bijvoorbeeld:"
281
282
+ #: options-meta-boxes.php:209
283
+ #: options-meta-boxes.php:272
284
#@ yarpp
285
msgid "Before / after each related entry:"
286
msgstr "Voor / na elke gerelateerde bijdrage:"
287
288
+ #: options-meta-boxes.php:211
289
+ #: options-meta-boxes.php:274
290
#@ yarpp
291
msgid "Show excerpt?"
292
msgstr "Toon uittreksel?"
293
294
+ #: options-meta-boxes.php:212
295
+ #: options-meta-boxes.php:275
296
#@ yarpp
297
msgid "Excerpt length (No. of words):"
298
msgstr "Lengte uittreksel (aantal woorden):"
299
300
+ #: options-meta-boxes.php:216
301
#@ yarpp
302
msgid "Before / after (Excerpt):"
303
msgstr "Voor / na (uittreksel):"
304
305
+ #: options-meta-boxes.php:68
306
#@ yarpp
307
msgid "Order results:"
308
msgstr "Sorteer resultaten:"
309
310
+ #: options-meta-boxes.php:71
311
#@ yarpp
312
msgid "score (high relevance to low)"
313
msgstr "Waardering (hoge naar lage relevantie)"
314
315
+ #: options-meta-boxes.php:72
316
#@ yarpp
317
msgid "score (low relevance to high)"
318
msgstr "Waardering (lage naar hoge relevantie)"
319
320
+ #: options-meta-boxes.php:73
321
#@ yarpp
322
msgid "date (new to old)"
323
msgstr "datum (nieuw naar oud)"
324
325
+ #: options-meta-boxes.php:74
326
#@ yarpp
327
msgid "date (old to new)"
328
msgstr "datum (oud naar nieuw)"
329
330
+ #: options-meta-boxes.php:75
331
#@ yarpp
332
msgid "title (alphabetical)"
333
msgstr "titel (alfabetisch)"
334
335
+ #: options-meta-boxes.php:76
336
#@ yarpp
337
msgid "title (reverse alphabetical)"
338
msgstr "titel (omgekeerd alfabetisch)"
339
340
+ #: options-meta-boxes.php:224
341
+ #: options-meta-boxes.php:281
342
#@ yarpp
343
msgid "Default display if no results:"
344
msgstr "Standaard tonen indien geen resultaten:"
345
346
+ #: class-widget.php:98
347
+ #: options-meta-boxes.php:227
348
+ #: options-meta-boxes.php:283
349
#@ yarpp
350
msgid "Help promote Yet Another Related Posts Plugin?"
351
msgstr "Help Yet Another Related Posts Plugin promoten?"
352
353
+ #: options-meta-boxes.php:229
354
+ #: options-meta-boxes.php:284
355
#, php-format
356
#@ yarpp
357
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."
358
msgstr "Deze optie voegt de code %s toe. Probeer het aan te zetten, je opties bij te werken en zie de code in het codevoorbeeld rechts. Deze links en donaties worden gewaardeerd."
359
360
+ #: options-meta-boxes.php:291
361
#@ yarpp
362
msgid "Display options <small>for RSS</small>"
363
msgstr "Vertoningsopties <small>voor RSS</small>"
364
365
+ #: options-meta-boxes.php:245
366
#@ yarpp
367
msgid "Display related posts in feeds?"
368
msgstr "Toon gerelateerde bijdragen in feeds?"
369
370
+ #: options-meta-boxes.php:245
371
#@ yarpp
372
msgid "This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed."
373
msgstr "Deze optie toont gerelateerde bijdragen aan het einde van ieder item in je RSS en ATOM feeds. Sjabloonwijzigingen niet nodig."
374
375
+ #: options-meta-boxes.php:247
376
#@ yarpp
377
msgid "Display related posts in the descriptions?"
378
msgstr "Toon gerelateerde bijdragen in de omschrijving?"
379
380
+ #: options-meta-boxes.php:247
381
#@ yarpp
382
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."
383
msgstr "Deze optie toont de gerelateerde bijdragen in de RSS beschrijving, niet alleen de inhoud. Als je feed is ingesteld om alleen uittreksels te tonen, hoe dan ook, alleen het omschrijvingsveld wordt gebruikt, dus deze optie is vereist voor iedere vertoning."
384
385
+ #: options-meta-boxes.php:245
386
#@ yarpp
387
msgid "RSS display code example"
388
msgstr "Voorbeeld RSS-vertoningscode "
389
390
+ #: options-meta-boxes.php:277
391
#@ yarpp
392
msgid "Before / after (excerpt):"
393
msgstr "Voor / na (uittreksel):"
394
395
+ #: template-builtin.php:21
396
#, php-format
397
#@ yarpp
398
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."
403
msgid "These are the related entries for this entry. Updating this post may change these related posts."
404
msgstr "Er zijn gerelateerde bijdragen voor deze bijdrage. Het bijwerken van deze bijdrage kan de gerelateerde bijdragen veranderen."
405
406
+ #: template-metabox.php:28
407
#@ yarpp
408
msgid "Whether all of these related entries are actually displayed and how they are displayed depends on your YARPP display options."
409
msgstr "Of al deze gelateerde bijdragen getoond worden op de manier zoals je ze getoond wilt hebben hangt af van je YARPP instellingen."
410
411
+ #: class-core.php:73
412
+ #: class-core.php:83
413
+ #: class-core.php:273
414
+ #: class-core.php:284
415
+ #: template-metabox.php:30
416
#: template-widget.php:13
417
#@ yarpp
418
msgid "No related posts."
419
msgstr "Geen gerelateerde bijdragen."
420
421
+ #: class-core.php:71
422
+ #: class-core.php:81
423
+ #: class-core.php:271
424
+ #: class-core.php:282
425
#@ yarpp
426
msgid "Related posts:"
427
msgstr "Gerelateerde bijdragen"
428
429
+ #: options-meta-boxes.php:208
430
+ #: options-meta-boxes.php:209
431
+ #: options-meta-boxes.php:217
432
+ #: options-meta-boxes.php:271
433
+ #: options-meta-boxes.php:272
434
+ #: options-meta-boxes.php:277
435
#@ yarpp
436
msgid " or "
437
+ msgstr "of "
438
439
+ #: class-admin.php:136
440
+ #@ default
441
msgid "Settings"
442
msgstr ""
443
444
+ #: class-widget.php:69
445
#@ default
446
msgid "Title:"
447
msgstr ""
448
449
+ #: class-admin.php:162
450
#@ yarpp
451
msgid "Related entries may be displayed once you save your entry"
452
msgstr ""
453
454
+ #: options-meta-boxes.php:153
455
#@ yarpp
456
msgid "YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>."
457
msgstr ""
458
459
+ #: options-meta-boxes.php:298
460
#@ yarpp
461
msgid "YARPP Forum"
462
msgstr ""
463
464
+ #: options-meta-boxes.php:299
465
#@ yarpp
466
msgid "YARPP on Twitter"
467
msgstr ""
468
469
+ #: options-meta-boxes.php:300
470
#@ yarpp
471
msgid "YARPP on the Web"
472
msgstr ""
473
474
+ #: options-meta-boxes.php:337
475
#@ yarpp
476
msgid "Contact YARPP"
477
msgstr ""
478
479
+ #: options.php:34
480
#, php-format
481
#@ default
482
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>."
483
msgstr ""
484
485
+ #: options.php:79
486
#, php-format
487
#@ yarpp
488
msgid "Please try <a href=\"%s\" target=\"_blank\">manual SQL setup</a>."
489
msgstr ""
490
491
+ #: options.php:149
492
#, php-format
493
#@ yarpp
494
msgid "by <a href=\"%s\" target=\"_blank\">mitcho (Michael 芳貴 Erlewine)</a>"
495
msgstr ""
496
497
+ #: class-admin.php:63
498
+ #@ default
499
+ msgid "Configure"
500
+ msgstr ""
501
+
502
+ #: class-admin.php:89
503
+ #@ yarpp
504
+ msgid "Thank you for installing <span>Yet Another Related Posts Plugin</span>!"
505
+ msgstr ""
506
+
507
+ #: class-admin.php:90
508
+ #@ yarpp
509
+ msgid "Make sure to visit the <a>Related Posts settings page</a> to customize YARPP."
510
+ msgstr ""
511
+
512
+ #: options-meta-boxes.php:113
513
+ #@ yarpp
514
+ msgid "Post types considered:"
515
+ msgstr ""
516
+
517
+ #: options-meta-boxes.php:116
518
+ #, php-format
519
+ #@ yarpp
520
+ msgid "Disallow by %s:"
521
+ msgstr ""
522
+
523
+ #: options-meta-boxes.php:169
524
+ #@ yarpp
525
+ msgid "Display results from all post types"
526
+ msgstr ""
527
+
528
+ #: options-meta-boxes.php:169
529
+ #@ yarpp
530
+ msgid "When \"display results from all post types\" is off, only posts will be displayed as related to a post, only pages will be displayed as related to a page, etc."
531
+ msgstr ""
532
+
533
+ #: options-meta-boxes.php:301
534
+ #@ yarpp
535
+ msgid "Rate YARPP on WordPress.org"
536
+ msgstr ""
537
+
538
+ #: options.php:178
539
+ #@ default
540
+ msgid "Save Changes"
541
+ msgstr ""
542
+
options.php CHANGED
@@ -1,11 +1,8 @@
1
<?php
2
global $wpdb, $wp_version, $yarpp;
3
4
- // Reenforce YARPP setup:
5
- if ( !get_option('yarpp_version') )
6
- $yarpp->activate();
7
- else
8
- $yarpp->upgrade_check();
9
10
// check to see that templates are in the right place
11
if ( !count($yarpp->admin->get_templates()) ) {
1
<?php
2
global $wpdb, $wp_version, $yarpp;
3
4
+ // Enforce YARPP setup:
5
+ $yarpp->enforce();
6
7
// check to see that templates are in the right place
8
if ( !count($yarpp->admin->get_templates()) ) {
readme.txt CHANGED
@@ -6,8 +6,8 @@ Plugin URI: http://yarpp.org/
6
Donate link: http://tinyurl.com/donatetomitcho
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
Requires at least: 3.1
9
- Tested up to: 3.4.1
10
- Stable tag: 3.5.1
11
12
Display a list of related entries on your site and feeds based on a unique algorithm. Now with custom post type support!
13
@@ -231,19 +231,36 @@ If you are a bilingual speaker of English and another language and an avid user
231
232
== Changelog ==
233
234
= 3.5.2 =
235
* [Bugfix](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-bug-found-with-solution): fix an unfortunate typo which caused "no related posts" on many environments with non-MyISAM tables
236
- * Bugfix for a bug where related posts would not be recomputed on post update, on environments using the `table` YARPP cache method and a persistent object caching system, like W3 Total Cache or memcached
237
* [Bugfix](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-351-error-call-to-a-member-function): reference to `get_post_types()` failed in ajax display
238
* Localizations:
239
* Added Czech (`cs_CZ`) localization by [Zdenek Hejl](http://www.zdenek-hejl.com)
240
* Added Serbian (`sr_RS`) by [Zarko Zivkovic](http://www.zarkozivkovic.com/)
241
* Clarified readme to require WordPress 3.1
242
* Code cleanup:
243
* PHP 5.3+: replaced an instance of `ereg_replace`
244
* Removed warning on settings save
245
* Sometimes [a warning]((http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-warning-invalid-argument-supplied-for-foreach)) was printed on upgrade from YARPP < 3.4.4
246
* Fixed [PHP warning](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-php-warning) when no taxonomies are considered
247
248
= 3.5.1 =
249
* [Bugfix](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-catchable-fatal-error-object-of-class-stdclass-could-not-be-converted-to-string): change `$yarpp->get_post_types()` to return array of names by default
6
Donate link: http://tinyurl.com/donatetomitcho
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
Requires at least: 3.1
9
+ Tested up to: 3.5
10
+ Stable tag: 3.5.2
11
12
Display a list of related entries on your site and feeds based on a unique algorithm. Now with custom post type support!
13
231
232
== Changelog ==
233
234
+ = 3.5.3 =
235
+
236
+ * [Potential bugfix to some "no related posts"](https://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-no-related-posts-7)
237
+ * Ensure YARPP functions do not operate on post revisions
238
+ * Removed one way in which it would incorrectly return "no related posts"
239
+ * [Bugfix](https://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-database-errors-upon-activation): setup wasn't automatic for network activations.
240
+ * Code cleanup:
241
+ * [Bugfix](https://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-latin1-instead-of-utf-8?replies=3): tables should be created using WordPress charset settings
242
+ * YARPP_Cache_*::update methods are now protected
243
+ * Simplified some post status transition handling
244
+ * Ensure that `delete_post` hook receives relevant post ID information
245
+ * Various functions now refer to the `enforce` method which will activate if it's a new install, or else upgrade if necessary. (Part of the fix for the network activation above.)
246
+
247
= 3.5.2 =
248
* [Bugfix](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-bug-found-with-solution): fix an unfortunate typo which caused "no related posts" on many environments with non-MyISAM tables
249
+ * Fixed a bug where related posts would not be recomputed on post update, on environments using the `table` YARPP cache method and a persistent object caching system, like W3 Total Cache or memcached
250
* [Bugfix](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-351-error-call-to-a-member-function): reference to `get_post_types()` failed in ajax display
251
+ * Fixed a bug where some RSS display options were not being obeyed
252
+ * Fixed a bug where the "automatic display" was being displayed on some custom post types without any control.
253
* Localizations:
254
* Added Czech (`cs_CZ`) localization by [Zdenek Hejl](http://www.zdenek-hejl.com)
255
* Added Serbian (`sr_RS`) by [Zarko Zivkovic](http://www.zarkozivkovic.com/)
256
+ * Fixed bug in Dutch localization
257
* Clarified readme to require WordPress 3.1
258
* Code cleanup:
259
* PHP 5.3+: replaced an instance of `ereg_replace`
260
* Removed warning on settings save
261
* Sometimes [a warning]((http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-warning-invalid-argument-supplied-for-foreach)) was printed on upgrade from YARPP < 3.4.4
262
* Fixed [PHP warning](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-php-warning) when no taxonomies are considered
263
+ * No longer using `clear_pre` function which has been deprecated since WordPress 3.4.
264
265
= 3.5.1 =
266
* [Bugfix](http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-catchable-fatal-error-object-of-class-stdclass-could-not-be-converted-to-string): change `$yarpp->get_post_types()` to return array of names by default
template-metabox.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
global $yarpp;
3
4
- $yarpp->cache->enforce($reference_ID, false); // enforce the cache, but don't force it
5
6
if ($yarpp->debug) {
7
$keywords = $yarpp->cache->get_keywords($reference_ID);
1
<?php
2
global $yarpp;
3
4
+ $yarpp->cache->enforce((int) $reference_ID, false); // enforce the cache, but don't force it
5
6
if ($yarpp->debug) {
7
$keywords = $yarpp->cache->get_keywords($reference_ID);
trunk/cache-postmeta.php DELETED
@@ -1,257 +0,0 @@
1
- <?php
2
-
3
- $yarpp_storage_class = 'YARPP_Cache_Postmeta';
4
-
5
- define('YARPP_POSTMETA_KEYWORDS_KEY','_yarpp_keywords');
6
- define('YARPP_POSTMETA_RELATED_KEY', '_yarpp_related');
7
-
8
- class YARPP_Cache_Postmeta extends YARPP_Cache {
9
-
10
- public $name = "postmeta";
11
-
12
- // variables used for lookup
13
- private $related_postdata = array();
14
- private $related_IDs = array();
15
-
16
- /**
17
- * SETUP/STATUS
18
- */
19
- function __construct( &$core ) {
20
- parent::__construct( $core );
21
- }
22
-
23
- public function is_enabled() {
24
- return true; // always enabled.
25
- }
26
-
27
- public function setup() {
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
-
39
- public function cache_status() {
40
- global $wpdb;
41
- return $wpdb->get_var("select (count(p.ID)-sum(m.meta_value IS NULL))/count(p.ID)
42
- FROM `{$wpdb->posts}` as p
43
- LEFT JOIN `{$wpdb->postmeta}` as m ON (p.ID = m.post_id and m.meta_key = '" . YARPP_POSTMETA_RELATED_KEY . "')
44
- WHERE p.post_status = 'publish'");
45
- }
46
-
47
- public function uncached($limit = 20, $offset = 0) {
48
- global $wpdb;
49
- return $wpdb->get_col("select SQL_CALC_FOUND_ROWS p.ID
50
- FROM `{$wpdb->posts}` as p
51
- LEFT JOIN `{$wpdb->postmeta}` as m ON (p.ID = m.post_id and m.meta_key = '" . YARPP_POSTMETA_RELATED_KEY . "')
52
- WHERE p.post_status = 'publish' and m.meta_value IS NULL
53
- LIMIT $limit OFFSET $offset");
54
- }
55
-
56
- /**
57
- * MAGIC FILTERS
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);
64
- $arg = preg_replace("!{$wpdb->posts}.ID = \d+!","{$wpdb->posts}.ID in (".join(',',$this->related_IDs).")",$arg);
65
-
66
- // if recent is set, add an additional condition
67
- $recent = yarpp_get_option('recent');
68
- if ( !!$recent )
69
- $arg .= " and post_date > date_sub(now(), interval {$recent}) ";
70
- return $arg;
71
- }
72
-
73
- public function orderby_filter($arg) {
74
- global $wpdb;
75
- // only order by score if the score function is added in fields_filter, which only happens
76
- // if there are related posts in the postdata
77
- if ($this->score_override &&
78
- is_array($this->related_postdata) && count($this->related_postdata))
79
- return str_replace("$wpdb->posts.post_date","score",$arg);
80
- return $arg;
81
- }
82
-
83
- public function fields_filter($arg) {
84
- global $wpdb;
85
- if (is_array($this->related_postdata) && count($this->related_postdata)) {
86
- $scores = array();
87
- foreach ($this->related_postdata as $related_entry) {
88
- $scores[] = " WHEN {$related_entry['ID']} THEN {$related_entry['score']}";
89
- }
90
- $arg .= ", CASE {$wpdb->posts}.ID" . join('',$scores) ." END as score";
91
- }
92
- return $arg;
93
- }
94
-
95
- public function limit_filter($arg) {
96
- if ($this->online_limit)
97
- return " limit {$this->online_limit} ";
98
- return $arg;
99
- }
100
-
101
- /**
102
- * RELATEDNESS CACHE CONTROL
103
- */
104
- public function begin_yarpp_time($reference_ID) {
105
- $this->yarpp_time = true;
106
- // get the related posts from postmeta, and also construct the relate_IDs array
107
- $this->related_postdata = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
108
- if (is_array($this->related_postdata) && count($this->related_postdata))
109
- $this->related_IDs = wp_list_pluck( $this->related_postdata, 'ID' );
110
- add_filter('posts_where',array(&$this,'where_filter'));
111
- add_filter('posts_orderby',array(&$this,'orderby_filter'));
112
- add_filter('posts_fields',array(&$this,'fields_filter'));
113
- add_filter('post_limits',array(&$this,'limit_filter'));
114
- add_action('pre_get_posts',array(&$this,'add_signature'));
115
- // sets the score override flag.
116
- add_action('parse_query',array(&$this,'set_score_override_flag'));
117
- }
118
-
119
- public function end_yarpp_time() {
120
- $this->yarpp_time = false;
121
- $this->related_IDs = array();
122
- $this->related_postdata = array();
123
- remove_filter('posts_where',array(&$this,'where_filter'));
124
- remove_filter('posts_orderby',array(&$this,'orderby_filter'));
125
- remove_filter('posts_fields',array(&$this,'fields_filter'));
126
- remove_filter('post_limits',array(&$this,'limit_filter'));
127
- remove_action('pre_get_posts',array(&$this,'add_signature'));
128
- // sets the score override flag.
129
- remove_action('parse_query',array(&$this,'set_score_override_flag'));
130
- }
131
-
132
- // @return YARPP_NO_RELATED | YARPP_RELATED | YARPP_NOT_CACHED
133
- public function is_cached($reference_ID) {
134
- $related = get_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, true);
135
- if ( YARPP_NO_RELATED === $related )
136
- return YARPP_NO_RELATED;
137
- if ( '' == $related )
138
- return YARPP_NOT_CACHED;
139
- return YARPP_RELATED;
140
- }
141
-
142
- public function clear( $reference_IDs ) {
143
- $reference_IDs = wp_parse_id_list( $reference_IDs );
144
-
145
- if ( !count($reference_ID) )
146
- return;
147
-
148
- // clear each cache
149
- foreach( $reference_IDs as $id ) {
150
- delete_post_meta( $id, YARPP_POSTMETA_RELATED_KEY );
151
- delete_post_meta( $id, YARPP_POSTMETA_KEYWORDS_KEY );
152
- }
153
- }
154
-
155
- // @return YARPP_NO_RELATED | YARPP_RELATED
156
- // @used by enforce
157
- protected function update($reference_ID) {
158
- global $wpdb;
159
-
160
- $original_related = $this->related($reference_ID);
161
- $related = $wpdb->get_results($this->sql($reference_ID), ARRAY_A);
162
- $new_related = wp_list_pluck( $related, 'ID' );
163
-
164
- if ( count($new_related) ) {
165
- update_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, $related);
166
- if ($this->core->debug) echo "<!--YARPP just set the cache for post $reference_ID-->";
167
-
168
- // Clear the caches of any items which are no longer related or are newly related.
169
- if (count($original_related)) {
170
- $this->clear(array_diff($original_related, $new_related));
171
- $this->clear(array_diff($new_related, $original_related));
172
- }
173
-
174
- return YARPP_RELATED;
175
- } else {
176
- update_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, YARPP_NO_RELATED);
177
-
178
- // Clear the caches of those which are no longer related.
179
- if (count($original_related))
180
- $this->clear($original_related);
181
-
182
- return YARPP_NO_RELATED;
183
- }
184
- }
185
-
186
- public function flush() {
187
- delete_post_meta_by_key( YARPP_POSTMETA_RELATED_KEY );
188
- delete_post_meta_by_key( YARPP_POSTMETA_KEYWORDS_KEY );
189
- }
190
-
191
- public function related($reference_ID = null, $related_ID = null) {
192
- global $wpdb;
193
-
194
- if ( !is_int( $reference_ID ) && !is_int( $related_ID ) ) {
195
- _doing_it_wrong( __METHOD__, 'reference ID and/or related ID must be set', '3.4' );
196
- return;
197
- }
198
-
199
- if (!is_null($reference_ID) && !is_null($related_ID)) {
200
- $results = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
201
- foreach($results as $result) {
202
- if ($result['ID'] == $related_ID)
203
- return true;
204
- }
205
- return false;
206
- }
207
-
208
- // return a list of ID's of "related" entries
209
- if (!is_null($reference_ID)) {
210
- $results = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
211
- if (!$results || $results == YARPP_NO_RELATED)
212
- return array();
213
- return wp_list_pluck( $results, 'ID' );
214
- }
215
-
216
- // return a list of entities which list this post as "related"
217
- if (!is_null($related_ID)) {
218
- return $wpdb->get_col("select post_id from `{$wpdb->postmeta}` where meta_key = '" . YARPP_POSTMETA_RELATED_KEY . "' and meta_value regexp 's:2:\"ID\";s:\d+:\"{$related_ID}\"'");
219
- }
220
-
221
- return false;
222
- }
223
-
224
- /**
225
- * KEYWORDS CACHE CONTROL
226
- */
227
-
228
- // @return (array) with body and title keywords
229
- private function cache_keywords($ID) {
230
- $keywords = array(
231
- 'body' => $this->body_keywords($ID),
232
- 'title' => $this->title_keywords($ID)
233
- );
234
- update_post_meta($ID, YARPP_POSTMETA_KEYWORDS_KEY, $keywords);
235
- return $keywords;
236
- }
237
-
238
- // @param $ID (int)
239
- // @param $type (string) body | title | all
240
- // @return (string|array) depending on whether "all" were requested or not
241
- public function get_keywords( $ID, $type = 'all' ) {
242
- if ( !$ID = absint($ID) )
243
- return false;
244
-
245
- $keywords = get_post_meta($ID, YARPP_POSTMETA_KEYWORDS_KEY, true);
246
-
247
- if ( empty($keywords) ) // if empty, try caching them first.
248
- $keywords = $this->cache_keywords($ID);
249
-
250
- if ( empty($keywords) )
251
- return false;
252
-
253
- if ( 'all' == $type )
254
- return $keywords;
255
- return $keywords[$type];
256
- }
257
- }
trunk/cache-tables.php DELETED
@@ -1,314 +0,0 @@
1
- <?php
2
-
3
- $yarpp_storage_class = 'YARPP_Cache_Tables';
4
-
5
- define('YARPP_TABLES_RELATED_TABLE', 'yarpp_related_cache');
6
- define('YARPP_TABLES_KEYWORDS_TABLE', 'yarpp_keyword_cache');
7
-
8
- class YARPP_Cache_Tables extends YARPP_Cache {
9
- public $name = "custom tables";
10
-
11
- /**
12
- * SETUP/STATUS
13
- */
14
- function __construct( &$core ) {
15
- parent::__construct( $core );
16
- }
17
-
18
- public function is_enabled() {
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;
27
- }
28
-
29
- public function setup() {
30
- global $wpdb;
31
-
32
- $charset_collate = '';
33
- if ( ! empty( $wpdb->charset ) )
34
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
35
- if ( ! empty( $wpdb->collate ) )
36
- $charset_collate .= " COLLATE $wpdb->collate";
37
-
38
- $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . "` (
39
- `ID` bigint(20) unsigned NOT NULL default '0',
40
- `body` text NOT NULL,
41
- `title` text NOT NULL,
42
- `date` timestamp NOT NULL default CURRENT_TIMESTAMP,
43
- PRIMARY KEY (`ID`)
44
- ) $charset_collate;");
45
- $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "` (
46
- `reference_ID` bigint(20) unsigned NOT NULL default '0',
47
- `ID` bigint(20) unsigned NOT NULL default '0',
48
- `score` float unsigned NOT NULL default '0',
49
- `date` timestamp NOT NULL default CURRENT_TIMESTAMP,
50
- PRIMARY KEY ( `reference_ID` , `ID` ),
51
- INDEX (`score`), INDEX (`ID`)
52
- ) $charset_collate;");
53
- }
54
-
55
- public function upgrade($last_version) {
56
- global $wpdb;
57
- if ( $last_version && version_compare('3.2.1b4', $last_version) > 0 ) {
58
- // Change primary key to be (reference_ID, ID) to ensure that we don't
59
- // get duplicates.
60
- // We unfortunately have to clear the cache first here, to ensure that there
61
- // are no duplicates.
62
- $this->flush();
63
- $wpdb->query('ALTER TABLE ' . $wpdb->prefix . YARPP_TABLES_RELATED_TABLE .
64
- ' DROP PRIMARY KEY ,' .
65
- ' ADD PRIMARY KEY ( `reference_ID` , `ID` ),' .
66
- ' ADD INDEX (`score`), ADD INDEX (`ID`)');
67
- }
68
- if ( $last_version && version_compare('3.5.2b3', $last_version) > 0 ) {
69
- // flush object cache, as bad is_cached_* values were stored before
70
- wp_cache_flush();
71
- }
72
- }
73
-
74
- public function cache_status() {
75
- global $wpdb;
76
- return $wpdb->get_var("select (count(p.ID)-sum(c.ID IS NULL))/count(p.ID)
77
- FROM `{$wpdb->posts}` as p
78
- LEFT JOIN `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "` as c ON (p.ID = c.reference_ID)
79
- WHERE p.post_status = 'publish' ");
80
- }
81
-
82
- public function uncached($limit = 20, $offset = 0) {
83
- global $wpdb;
84
- return $wpdb->get_col("select SQL_CALC_FOUND_ROWS p.ID
85
- FROM `{$wpdb->posts}` as p
86
- LEFT JOIN `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "` as c ON (p.ID = c.reference_ID)
87
- WHERE p.post_status = 'publish' and c.ID IS NULL
88
- LIMIT $limit OFFSET $offset");
89
- }
90
-
91
- /**
92
- * MAGIC FILTERS
93
- */
94
- public function join_filter($arg) {
95
- global $wpdb;
96
- if ($this->yarpp_time)
97
- $arg .= " join {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " as yarpp on {$wpdb->posts}.ID = yarpp.ID";
98
- return $arg;
99
- }
100
-
101
- public function where_filter($arg) {
102
- global $wpdb;
103
- $threshold = yarpp_get_option('threshold');
104
- if ($this->yarpp_time) {
105
-
106
- $arg = str_replace("$wpdb->posts.ID = ","yarpp.score >= $threshold and yarpp.reference_ID = ",$arg);
107
-
108
- $recent = yarpp_get_option('recent');
109
- if ( !!$recent )
110
- $arg .= " and post_date > date_sub(now(), interval {$recent}) ";
111
- }
112
- return $arg;
113
- }
114
-
115
- public function orderby_filter($arg) {
116
- global $wpdb;
117
- if ($this->yarpp_time and $this->score_override)
118
- $arg = str_replace("$wpdb->posts.post_date","yarpp.score",$arg);
119
- return $arg;
120
- }
121
-
122
- public function fields_filter($arg) {
123
- global $wpdb;
124
- if ($this->yarpp_time)
125
- $arg .= ", yarpp.score";
126
- return $arg;
127
- }
128
-
129
- public function limit_filter($arg) {
130
- global $wpdb;
131
- if ($this->yarpp_time and $this->online_limit) {
132
- return " limit {$this->online_limit} ";
133
- }
134
- return $arg;
135
- }
136
-
137
- /**
138
- * RELATEDNESS CACHE CONTROL
139
- */
140
- public function begin_yarpp_time() {
141
- $this->yarpp_time = true;
142
- add_filter('posts_join',array(&$this,'join_filter'));
143
- add_filter('posts_where',array(&$this,'where_filter'));
144
- add_filter('posts_orderby',array(&$this,'orderby_filter'));
145
- add_filter('posts_fields',array(&$this,'fields_filter'));
146
- add_filter('post_limits',array(&$this,'limit_filter'));
147
- add_action('pre_get_posts',array(&$this,'add_signature'));
148
- // sets the score override flag.
149
- add_action('parse_query',array(&$this,'set_score_override_flag'));
150
- }
151
-
152
- public function end_yarpp_time() {
153
- $this->yarpp_time = false;
154
- remove_filter('posts_join',array(&$this,'join_filter'));
155
- remove_filter('posts_where',array(&$this,'where_filter'));
156
- remove_filter('posts_orderby',array(&$this,'orderby_filter'));
157
- remove_filter('posts_fields',array(&$this,'fields_filter'));
158
- remove_filter('post_limits',array(&$this,'limit_filter'));
159
- remove_action('pre_get_posts',array(&$this,'add_signature'));
160
- remove_action('parse_query',array(&$this,'set_score_override_flag'));
161
- }
162
-
163
- // @return YARPP_NO_RELATED | YARPP_RELATED | YARPP_NOT_CACHED
164
- public function is_cached($reference_ID) {
165
- global $wpdb;
166
-
167
- $result = wp_cache_get( 'is_cached_' . $reference_ID, 'yarpp' );
168
- if ( false !== $result )
169
- return $result;
170
-
171
- $min_id = $wpdb->get_var("select min(ID) as min_id from {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " where reference_ID = $reference_ID");
172
-
173
- if ( is_null( $min_id ) )
174
- return YARPP_NOT_CACHED;
175
-
176
- if ( 0 == $min_id )
177
- $result = YARPP_NO_RELATED;
178
- else
179
- $result = YARPP_RELATED;
180
-
181
- wp_cache_set( 'is_cached_' . $reference_ID, $result, 'yarpp' );
182
-
183
- return $result;
184
- }
185
-
186
- public function clear( $reference_IDs ) {
187
- global $wpdb;
188
-
189
- $reference_IDs = wp_parse_id_list( $reference_IDs );
190
-
191
- if ( !count($reference_IDs) )
192
- return;
193
-
194
- $wpdb->query("delete from {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " where reference_ID in (".implode(',',$reference_IDs).")");
195
- $wpdb->query("delete from {$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . " where ID in (".implode(',',$reference_IDs).")");
196
- // @since 3.5.2: clear is_cached_* values as well
197
- foreach ( $reference_IDs as $id )
198
- wp_cache_delete( 'is_cached_' . $id, 'yarpp' );
199
- }
200
-
201
- // @return YARPP_RELATED | YARPP_NO_RELATED
202
- // @used by enforce
203
- protected function update($reference_ID) {
204
- global $wpdb;
205
-
206
- $original_related = (array) @$this->related($reference_ID);
207
-
208
- if ( count($original_related) ) {
209
- // clear out the cruft
210
- $this->clear($reference_ID);
211
- }
212
-
213
- $wpdb->query("insert into {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " (reference_ID,ID,score) " . $this->sql($reference_ID) . " on duplicate key update date = now()");
214
-
215
- // If there were related entries saved...
216
- if ( $wpdb->rows_affected ) {
217
- $new_related = $this->related($reference_ID);
218
-
219
- if ($this->core->debug) echo "<!--YARPP just set the cache for post $reference_ID-->";
220
-
221
- // Clear the caches of any items which are no longer related or are newly related.
222
- if ( count($original_related) ) {
223
- $this->clear(array_diff($original_related, $new_related));
224
- $this->clear(array_diff($new_related, $original_related));
225
- }
226
-
227
- return YARPP_RELATED;
228
- } else {
229
- $wpdb->query("insert into {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " (reference_ID,ID,score) values ($reference_ID,0,0) on duplicate key update date = now()");
230
-
231
- // Clear the caches of those which are no longer related.
232
- if ( count($original_related) )
233
- $this->clear($original_related);
234
-
235
- return YARPP_NO_RELATED;
236
- }
237
- }
238
-
239
- public function flush() {
240
- global $wpdb;
241
- $wpdb->query("truncate table `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "`");
242
- $wpdb->query("truncate table `{$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . "`");
243
- // @since 3.5.2: clear object cache, used for is_cached_* values
244
- wp_cache_flush();
245
- }
246
-
247
- public function related($reference_ID = null, $related_ID = null) {
248
- global $wpdb;