WordPress Related Posts - Version 0.6

Version Description

Download this release

Release Info

Developer denishua
Plugin Icon wp plugin WordPress Related Posts
Version 0.6
Comparing to
See all releases

Code changes from version 1.0 to 0.6

Thumbs.db ADDED
Binary file
WPRP/lang/default.po ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: wp_related_post\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2009-09-29 17:09+0800\n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: Denis <honghua.deng@gmail.com>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-SearchPath-0: ..\n"
15
+
16
+ #: ../wp_related_posts.php:70
17
+ msgid "No Related Post"
18
+ msgstr ""
19
+
20
+ #: ../wp_related_posts.php:74
21
+ #: ../wp_related_posts.php:306
22
+ #: ../wp_related_posts.php:432
23
+ msgid "Random Posts"
24
+ msgstr ""
25
+
26
+ #: ../wp_related_posts.php:77
27
+ #: ../wp_related_posts.php:310
28
+ #: ../wp_related_posts.php:433
29
+ msgid "Most Commented Posts"
30
+ msgstr ""
31
+
32
+ #: ../wp_related_posts.php:80
33
+ #: ../wp_related_posts.php:314
34
+ #: ../wp_related_posts.php:435
35
+ msgid "Most Popular Posts"
36
+ msgstr ""
37
+
38
+ #: ../wp_related_posts.php:252
39
+ msgid "Related Posts"
40
+ msgstr ""
41
+
42
+ #: ../wp_related_posts.php:258
43
+ msgid "WordPress Related Posts Setting Updated"
44
+ msgstr ""
45
+
46
+ #: ../wp_related_posts.php:301
47
+ #: ../wp_related_posts.php:445
48
+ msgid "No Related Posts Text:"
49
+ msgstr ""
50
+
51
+ #: ../wp_related_posts.php:302
52
+ msgid "No Related Posts"
53
+ msgstr ""
54
+
55
+ #: ../wp_related_posts.php:305
56
+ #: ../wp_related_posts.php:448
57
+ msgid "Random Posts Title:"
58
+ msgstr ""
59
+
60
+ #: ../wp_related_posts.php:309
61
+ #: ../wp_related_posts.php:451
62
+ msgid "Most Commented Posts Title:"
63
+ msgstr ""
64
+
65
+ #: ../wp_related_posts.php:313
66
+ #: ../wp_related_posts.php:454
67
+ msgid "Most Popular Posts Title:"
68
+ msgstr ""
69
+
70
+ #: ../wp_related_posts.php:343
71
+ msgid "Related Posts Settings"
72
+ msgstr ""
73
+
74
+ #: ../wp_related_posts.php:344
75
+ msgid "<a href=\"http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/\">WordPress Related Posts </a>Plugin can generate a related posts list via WordPress tags, and add the related posts to feed."
76
+ msgstr ""
77
+
78
+ #: ../wp_related_posts.php:345
79
+ msgid "Any problem or need help, please contact "
80
+ msgstr ""
81
+
82
+ #: ../wp_related_posts.php:348
83
+ msgid "Do you like this Plugin? Consider to donate!"
84
+ msgstr ""
85
+
86
+ #: ../wp_related_posts.php:352
87
+ msgid "Basic Setting"
88
+ msgstr ""
89
+
90
+ #: ../wp_related_posts.php:355
91
+ msgid "Related Posts Title:"
92
+ msgstr ""
93
+
94
+ #: ../wp_related_posts.php:361
95
+ msgid "Related Posts Title Tag:"
96
+ msgstr ""
97
+
98
+ #: ../wp_related_posts.php:376
99
+ msgid "Maximum Number:"
100
+ msgstr ""
101
+
102
+ #: ../wp_related_posts.php:382
103
+ msgid "Exclude(category IDs):"
104
+ msgstr ""
105
+
106
+ #: ../wp_related_posts.php:384
107
+ msgid "Enter category IDs of the posts which you don't want to display related posts for them. "
108
+ msgstr ""
109
+
110
+ #: ../wp_related_posts.php:388
111
+ msgid "Other Setting:"
112
+ msgstr ""
113
+
114
+ #: ../wp_related_posts.php:392
115
+ msgid "Display Comments Count?"
116
+ msgstr ""
117
+
118
+ #: ../wp_related_posts.php:397
119
+ msgid "Display Pubilsh Date?"
120
+ msgstr ""
121
+
122
+ #: ../wp_related_posts.php:402
123
+ msgid "Auto Insert Related Posts?"
124
+ msgstr ""
125
+
126
+ #: ../wp_related_posts.php:407
127
+ msgid "Display Related Posts on Feed?"
128
+ msgstr ""
129
+
130
+ #: ../wp_related_posts.php:412
131
+ msgid "Except Setting:"
132
+ msgstr ""
133
+
134
+ #: ../wp_related_posts.php:416
135
+ msgid "Display Post Except?"
136
+ msgstr ""
137
+
138
+ #: ../wp_related_posts.php:420
139
+ msgid "Maximum Charaters of Except."
140
+ msgstr ""
141
+
142
+ #: ../wp_related_posts.php:425
143
+ msgid "No Related Post Setting"
144
+ msgstr ""
145
+
146
+ #: ../wp_related_posts.php:428
147
+ msgid "Display:"
148
+ msgstr ""
149
+
150
+ #: ../wp_related_posts.php:431
151
+ msgid "Text: 'No Related Posts'"
152
+ msgstr ""
153
+
154
+ #: ../wp_related_posts.php:464
155
+ msgid "Related Posts with Thumbnail"
156
+ msgstr ""
157
+
158
+ #: ../wp_related_posts.php:468
159
+ msgid "Befor usting Related Posts with Thumbnail, you must set thumbnail image for your every post."
160
+ msgstr ""
161
+
162
+ #: ../wp_related_posts.php:472
163
+ msgid "Thumbnail Setting:"
164
+ msgstr ""
165
+
166
+ #: ../wp_related_posts.php:475
167
+ msgid "Display Thumbnails For Related Posts?"
168
+ msgstr ""
169
+
170
+ #: ../wp_related_posts.php:479
171
+ msgid "Do you still want to display text when display thumbnails for related posts?"
172
+ msgstr ""
173
+
174
+ #: ../wp_related_posts.php:481
175
+ msgid "Which custom field is used for thumbnail?"
176
+ msgstr ""
177
+
178
+ #: ../wp_related_posts.php:499
179
+ msgid "Save changes"
180
+ msgstr ""
181
+
WPRP/lang/wp_related_posts-zh_CN.mo ADDED
Binary file
WPRP/lang/wp_related_posts-zh_CN.po ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WordPress 2.3 Related Posts Plugin v0.2\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2009-09-29 17:04+0800\n"
6
+ "PO-Revision-Date: 2009-09-29 17:08+0800\n"
7
+ "Last-Translator: Denis <honghua.deng@gmail.com>\n"
8
+ "Language-Team: WordPress 中文团队 <team@wp-cn.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: _e;__\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-SearchPath-0: ..\n"
15
+
16
+ #: ../wp_related_posts.php:70
17
+ msgid "No Related Post"
18
+ msgstr "暂无相关日志"
19
+
20
+ #: ../wp_related_posts.php:74
21
+ #: ../wp_related_posts.php:306
22
+ #: ../wp_related_posts.php:432
23
+ msgid "Random Posts"
24
+ msgstr "随机日志"
25
+
26
+ #: ../wp_related_posts.php:77
27
+ #: ../wp_related_posts.php:310
28
+ #: ../wp_related_posts.php:433
29
+ msgid "Most Commented Posts"
30
+ msgstr "最多留言日志"
31
+
32
+ #: ../wp_related_posts.php:80
33
+ #: ../wp_related_posts.php:314
34
+ #: ../wp_related_posts.php:435
35
+ msgid "Most Popular Posts"
36
+ msgstr "最流行日志"
37
+
38
+ #: ../wp_related_posts.php:252
39
+ msgid "Related Posts"
40
+ msgstr "相关日志"
41
+
42
+ #: ../wp_related_posts.php:258
43
+ msgid "WordPress Related Posts Setting Updated"
44
+ msgstr "WordPress 相关日志设置已被更新"
45
+
46
+ #: ../wp_related_posts.php:301
47
+ #: ../wp_related_posts.php:445
48
+ msgid "No Related Posts Text:"
49
+ msgstr "无相关日志时的文本:"
50
+
51
+ #: ../wp_related_posts.php:302
52
+ msgid "No Related Posts"
53
+ msgstr "暂无相关日志"
54
+
55
+ #: ../wp_related_posts.php:305
56
+ #: ../wp_related_posts.php:448
57
+ msgid "Random Posts Title:"
58
+ msgstr "随机日志列表标题:"
59
+
60
+ #: ../wp_related_posts.php:309
61
+ #: ../wp_related_posts.php:451
62
+ msgid "Most Commented Posts Title:"
63
+ msgstr "最多留言日志标题:"
64
+
65
+ #: ../wp_related_posts.php:313
66
+ #: ../wp_related_posts.php:454
67
+ msgid "Most Popular Posts Title:"
68
+ msgstr "最流行日志标题:"
69
+
70
+ #: ../wp_related_posts.php:343
71
+ msgid "Related Posts Settings"
72
+ msgstr "相关日志设置"
73
+
74
+ #: ../wp_related_posts.php:344
75
+ msgid "<a href=\"http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/\">WordPress Related Posts </a>Plugin can generate a related posts list via WordPress tags, and add the related posts to feed."
76
+ msgstr "<a href=\"http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/\">WordPress 相关日志插件</a>可以通过 WordPress 的标签系统产生一个相关日志列表,并可以添加相关日志至 RSS 中。"
77
+
78
+ #: ../wp_related_posts.php:345
79
+ msgid "Any problem or need help, please contact "
80
+ msgstr "你在使用这个插件的时候如果有任何问题或者需要帮助,请联系 "
81
+
82
+ #: ../wp_related_posts.php:348
83
+ msgid "Do you like this Plugin? Consider to donate!"
84
+ msgstr "喜欢这个插件吗?你可以考虑捐赠支持我继续开发。"
85
+
86
+ #: ../wp_related_posts.php:352
87
+ msgid "Basic Setting"
88
+ msgstr "基本设置"
89
+
90
+ #: ../wp_related_posts.php:355
91
+ msgid "Related Posts Title:"
92
+ msgstr "相关日志列表标题:"
93
+
94
+ #: ../wp_related_posts.php:361
95
+ msgid "Related Posts Title Tag:"
96
+ msgstr "相关日志标题标签:"
97
+
98
+ #: ../wp_related_posts.php:376
99
+ msgid "Maximum Number:"
100
+ msgstr "最多显示:"
101
+
102
+ #: ../wp_related_posts.php:382
103
+ msgid "Exclude(category IDs):"
104
+ msgstr "不包括(分类ID):"
105
+
106
+ #: ../wp_related_posts.php:384
107
+ msgid "Enter category IDs of the posts which you don't want to display related posts for them. "
108
+ msgstr "输入你不想显示相关日志的这类日志的分类 ID"
109
+
110
+ #: ../wp_related_posts.php:388
111
+ msgid "Other Setting:"
112
+ msgstr "其他设置:"
113
+
114
+ #: ../wp_related_posts.php:392
115
+ msgid "Display Comments Count?"
116
+ msgstr "显示留言数?"
117
+
118
+ #: ../wp_related_posts.php:397
119
+ msgid "Display Pubilsh Date?"
120
+ msgstr "显示日志发布日期?"
121
+
122
+ #: ../wp_related_posts.php:402
123
+ msgid "Auto Insert Related Posts?"
124
+ msgstr "自动插入相关日志?"
125
+
126
+ #: ../wp_related_posts.php:407
127
+ msgid "Display Related Posts on Feed?"
128
+ msgstr "在RSS中添加相关日志?"
129
+
130
+ #: ../wp_related_posts.php:412
131
+ msgid "Except Setting:"
132
+ msgstr "摘要设置:"
133
+
134
+ #: ../wp_related_posts.php:416
135
+ msgid "Display Post Except?"
136
+ msgstr "显示日志摘要?"
137
+
138
+ #: ../wp_related_posts.php:420
139
+ msgid "Maximum Charaters of Except."
140
+ msgstr "摘要的最大文本。"
141
+
142
+ #: ../wp_related_posts.php:425
143
+ msgid "No Related Post Setting"
144
+ msgstr "无相关日志时的设置"
145
+
146
+ #: ../wp_related_posts.php:428
147
+ msgid "Display:"
148
+ msgstr "显示:"
149
+
150
+ #: ../wp_related_posts.php:431
151
+ msgid "Text: 'No Related Posts'"
152
+ msgstr "文本:“无相关日志”"
153
+
154
+ #: ../wp_related_posts.php:464
155
+ msgid "Related Posts with Thumbnail"
156
+ msgstr "给相关日志显示缩略图"
157
+
158
+ #: ../wp_related_posts.php:468
159
+ msgid "Befor usting Related Posts with Thumbnail, you must set thumbnail image for your every post."
160
+ msgstr "在使用给相关日志显示缩略图这个功能之前,你要确保你每篇日志都有缩略图。"
161
+
162
+ #: ../wp_related_posts.php:472
163
+ msgid "Thumbnail Setting:"
164
+ msgstr "缩略图设置:"
165
+
166
+ #: ../wp_related_posts.php:475
167
+ msgid "Display Thumbnails For Related Posts?"
168
+ msgstr "给相关日志显示缩略图?"
169
+
170
+ #: ../wp_related_posts.php:479
171
+ msgid "Do you still want to display text when display thumbnails for related posts?"
172
+ msgstr "在使用给相关日志显示缩略图的同时还显示相关日志的标题等文本?"
173
+
174
+ #: ../wp_related_posts.php:481
175
+ msgid "Which custom field is used for thumbnail?"
176
+ msgstr "那个自定义字段是用于缩略图的?"
177
+
178
+ #: ../wp_related_posts.php:499
179
+ msgid "Save changes"
180
+ msgstr "保存修改"
181
+
182
+ #~ msgid ""
183
+ #~ "Any problem, please contact <a href=\"http://twitter.com/denishua/"
184
+ #~ "\">denishua</a>."
185
+ #~ msgstr ""
186
+ #~ "有任何问题,请联系 <a href=\"http://twitter.com/denishua/\">denishua</a>。"
187
+ #~ msgid "Something wrong"
188
+ #~ msgstr "发生错误了"
189
+ #~ msgid "Related Posts Options&hellip;"
190
+ #~ msgstr "相关日志选项 &hellip;"
191
+ #~ msgid "Related Posts Preference"
192
+ #~ msgstr "相关日志设置"
193
+ #~ msgid "When No Related Posts, Dispaly:"
194
+ #~ msgstr "当没有相关日志时,显示:"
195
+ #~ msgid "Limit:"
196
+ #~ msgstr "显示的项数:"
197
+ #~ msgid "Update Preferences &raquo;"
198
+ #~ msgstr "更新选项 &raquo;"
199
+
wp_related_posts.php → WPRP/wp_related_posts.php RENAMED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
- Version: 1.0
5
  Plugin URI: http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/
6
  Description: Generate a related posts list via tags of WordPress
7
  Author: Denis
@@ -30,10 +30,7 @@ http://www.gnu.org/licenses/gpl.txt
30
  Just install the plugin in your blog and activate
31
  */
32
 
33
- add_action('init', 'init_textdomain');
34
- function init_textdomain(){
35
- load_plugin_textdomain('wp_related_posts',PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . '/lang');
36
- }
37
 
38
  function wp_get_related_posts() {
39
  global $wpdb, $post,$table_prefix;
@@ -80,7 +77,7 @@ function wp_get_related_posts() {
80
  $limitclause = "LIMIT 10";
81
  }
82
 
83
- $q = "SELECT p.ID, p.post_title, p.post_date, p.comment_count, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID AND (t_t.term_id IN ($taglist)) AND p.ID != $post->ID AND p.post_status = 'publish' AND p.post_date_gmt < '$now' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;";
84
 
85
  //echo $q;
86
 
@@ -136,8 +133,29 @@ function wp_get_related_posts() {
136
  }
137
 
138
  function wp_related_posts(){
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
  $output = wp_get_related_posts() ;
 
 
 
 
 
 
 
 
 
141
 
142
  echo $output;
143
  }
@@ -275,114 +293,99 @@ function wp_related_posts_options_subpanel() {
275
  <div class="wrap">
276
  <h2 id="write-post"><?php _e("Related Posts Options&hellip;",'wp_related_posts');?></h2>
277
  <p><?php _e("WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.",'wp_related_posts');?></p>
278
- <div style="float:right;">
279
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
280
- <input type="hidden" name="cmd" value="_donations">
281
- <input type="hidden" name="business" value="honghua.deng@gmail.com">
282
- <input type="hidden" name="item_name" value="Donate to fairyfish.net">
283
- <input type="hidden" name="no_shipping" value="0">
284
- <input type="hidden" name="no_note" value="1">
285
- <input type="hidden" name="currency_code" value="USD">
286
- <input type="hidden" name="tax" value="0">
287
- <input type="hidden" name="lc" value="US">
288
- <input type="hidden" name="bn" value="PP-DonationsBF">
289
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
290
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"><br />
291
- </form>
292
- </div>
293
- <h3><?php _e("Related Posts Preference",'wp_related_posts');?></h3>
294
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo basename(__FILE__); ?>">
295
-
296
- <table class="form-table">
297
- <tr>
298
- <th><?php _e("Related Posts Title:",'wp_related_posts'); ?></th>
299
- <td>
300
- <input type="text" name="wp_rp_title_option" value="<?php echo $wp_rp["wp_rp_title"]; ?>" />
301
- </td>
302
- </tr>
303
- <tr>
304
- <th><?php _e("When No Related Posts, Dispaly:",'wp_related_posts'); ?></th>
305
- <td>
306
- <?php $wp_no_rp = $wp_rp["wp_no_rp"]; ?>
307
- <select name="wp_no_rp_option" >
308
- <option value="text" <?php if($wp_no_rp == 'text') echo 'selected' ?> ><?php _e("Text: 'No Related Posts'",'wp_related_posts'); ?></option>
309
- <option value="random" <?php if($wp_no_rp == 'random') echo 'selected' ?>><?php _e("Random Posts",'wp_related_posts'); ?></option>
310
- <option value="commented" <?php if($wp_no_rp == 'commented') echo 'selected' ?>><?php _e("Most Commented Posts",'wp_related_posts'); ?></option>
311
- <?php if (function_exists('akpc_most_popular')){ ?>
312
- <option value="popularity" <?php if($wp_no_rp == 'popularity') echo 'selected' ?>><?php _e("Most Popular Posts",'wp_related_posts'); ?></option>
313
- <?php } ?>
314
- </select>
315
- </td>
316
- </tr>
317
- <tr>
318
- <th><?php _e("No Related Post's Title or Text:",'wp_related_posts'); ?></th>
319
- <td>
320
- <input type="text" name="wp_no_rp_text_option" value="<?php echo $wp_rp["wp_no_rp_text"]; ?>" />
321
- </td>
322
- </tr>
323
- <tr>
324
- <th><?php _e("Limit:",'wp_related_posts');?></th>
325
- <td>
326
- <input type="text" name="wp_rp_limit_option" value="<?php echo $wp_rp["wp_rp_limit"]; ?>" />
327
- </td>
328
- </tr>
329
- <tr>
330
- <th><?php _e("Exclude(category IDs):",'wp_related_posts');?></th>
331
- <td>
332
- <input type="text" name="wp_rp_exclude_option" value="<?php echo $wp_rp["wp_rp_exclude"]; ?>" />
333
- </td>
334
- </tr>
335
- <tr>
336
- <th><?php _e("Other Setting:",'wp_related_posts');?></th>
337
- <td>
338
- <label>
339
- <?php
340
- if ( $wp_rp["wp_rp_auto"] == 'yes' ) {
341
- echo '<input name="wp_rp_auto_option" type="checkbox" value="yes" checked>';
342
- } else {
343
- echo '<input name="wp_rp_auto_option" type="checkbox" value="yes">';
344
- }
345
- ?>
346
- <?php _e("Auto Insert Related Posts",'wp_related_posts');?>
347
- </label>
348
- <br />
349
- <label>
350
- <?php
351
- if ( $wp_rp["wp_rp_rss"] == 'yes' ) {
352
- echo '<input name="wp_rp_rss_option" type="checkbox" value="yes" checked>';
353
- } else {
354
- echo '<input name="wp_rp_rss_option" type="checkbox" value="yes">';
355
- }
356
- ?>
357
- <?php _e("Related Posts for RSS",'wp_related_posts');?>
358
- </label>
359
- <br />
360
- <label>
361
- <?php
362
- if ( $wp_rp["wp_rp_comments"] == 'yes' ) {
363
- echo '<input name="wp_rp_comments_option" type="checkbox" value="yes" checked>';
364
- } else {
365
- echo '<input name="wp_rp_comments_option" type="checkbox" value="yes">';
366
- }
367
- ?>
368
- <?php _e("Display Comments Count",'wp_related_posts');?>
369
- </label>
370
- <br />
371
- <label>
372
- <?php
373
- if ( $wp_rp["wp_rp_date"] == 'yes' ) {
374
- echo '<input name="wp_rp_date_option" type="checkbox" value="yes" checked>';
375
- } else {
376
- echo '<input name="wp_rp_date_option" type="checkbox" value="yes">';
377
- }
378
- ?>
379
- <?php _e("Display Post Date",'wp_related_posts');?>
380
- </label>
381
- <br />
382
- </td>
383
- </tr>
384
- </table>
385
- <p class="submit"><input type="submit" value="<?php _e("Update Preferences &raquo;",'wp_related_posts');?>" name="wp_rp_Submit" /></p>
386
  </form>
387
- </div>
388
  <?php }?>
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
+ Version: 0.8
5
  Plugin URI: http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/
6
  Description: Generate a related posts list via tags of WordPress
7
  Author: Denis
30
  Just install the plugin in your blog and activate
31
  */
32
 
33
+ load_plugin_textdomain('wp_related_posts',PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . '/lang');
 
 
 
34
 
35
  function wp_get_related_posts() {
36
  global $wpdb, $post,$table_prefix;
77
  $limitclause = "LIMIT 10";
78
  }
79
 
80
+ $q = "SELECT DISTINCT p.ID, p.post_title, p.post_date, p.comment_count, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID AND (t_t.term_id IN ($taglist)) AND p.ID != $post->ID AND p.post_status = 'publish' AND p.post_date_gmt < '$now' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;";
81
 
82
  //echo $q;
83
 
133
  }
134
 
135
  function wp_related_posts(){
136
+
137
+ global $id;
138
+
139
+ $output_old = get_post_meta($id, "related_posts", $single = true);
140
+
141
+ if($output_old){
142
+ $time = time();
143
+ if(($time - $output_old["time"])<600){
144
+ echo $output_old["related_posts"];
145
+ return;
146
+ }
147
+ }
148
 
149
  $output = wp_get_related_posts() ;
150
+
151
+ $output_new = array("time"=>time(),"related_posts"=>$output);
152
+ if($output_old){
153
+ update_post_meta($id, 'related_posts', $output_new);
154
+ }else{
155
+ if(!add_post_meta($id, 'related_posts', $output_new, true)){
156
+ update_post_meta($id, 'related_posts', $output_new);
157
+ }
158
+ }
159
 
160
  echo $output;
161
  }
293
  <div class="wrap">
294
  <h2 id="write-post"><?php _e("Related Posts Options&hellip;",'wp_related_posts');?></h2>
295
  <p><?php _e("WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.",'wp_related_posts');?></p>
296
+ <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo basename(__FILE__); ?>">
297
+ <h3><?php _e("Related Posts Preference",'wp_related_posts');?></h3>
298
+ <table class="form-table">
299
+ <tr>
300
+ <th><?php _e("Related Posts Title:",'wp_related_posts'); ?></th>
301
+ <td>
302
+ <input type="text" name="wp_rp_title_option" value="<?php echo $wp_rp["wp_rp_title"]; ?>" />
303
+ </td>
304
+ </tr>
305
+ <tr>
306
+ <th><?php _e("When No Related Posts, Dispaly:",'wp_related_posts'); ?></th>
307
+ <td>
308
+ <?php $wp_no_rp = $wp_rp["wp_no_rp"]; ?>
309
+ <select name="wp_no_rp_option" >
310
+ <option value="text" <?php if($wp_no_rp == 'text') echo 'selected' ?> ><?php _e("Text: 'No Related Posts'",'wp_related_posts'); ?></option>
311
+ <option value="random" <?php if($wp_no_rp == 'random') echo 'selected' ?>><?php _e("Random Posts",'wp_related_posts'); ?></option>
312
+ <option value="commented" <?php if($wp_no_rp == 'commented') echo 'selected' ?>><?php _e("Most Commented Posts",'wp_related_posts'); ?></option>
313
+ <?php if (function_exists('akpc_most_popular')){ ?>
314
+ <option value="popularity" <?php if($wp_no_rp == 'popularity') echo 'selected' ?>><?php _e("Most Popular Posts",'wp_related_posts'); ?></option>
315
+ <?php } ?>
316
+ </select>
317
+ </td>
318
+ </tr>
319
+ <tr>
320
+ <th><?php _e("No Related Post's Title or Text:",'wp_related_posts'); ?></th>
321
+ <td>
322
+ <input type="text" name="wp_no_rp_text_option" value="<?php echo $wp_rp["wp_no_rp_text"]; ?>" />
323
+ </td>
324
+ </tr>
325
+ <tr>
326
+ <th><?php _e("Limit:",'wp_related_posts');?></th>
327
+ <td>
328
+ <input type="text" name="wp_rp_limit_option" value="<?php echo $wp_rp["wp_rp_limit"]; ?>" />
329
+ </td>
330
+ </tr>
331
+ <tr>
332
+ <th><?php _e("Exclude(category IDs):",'wp_related_posts');?></th>
333
+ <td>
334
+ <input type="text" name="wp_rp_exclude_option" value="<?php echo $wp_rp["wp_rp_exclude"]; ?>" />
335
+ </td>
336
+ </tr>
337
+ <tr>
338
+ <th><?php _e("Other Setting:",'wp_related_posts');?></th>
339
+ <td>
340
+ <label>
341
+ <?php
342
+ if ( $wp_rp["wp_rp_auto"] == 'yes' ) {
343
+ echo '<input name="wp_rp_auto_option" type="checkbox" value="yes" checked>';
344
+ } else {
345
+ echo '<input name="wp_rp_auto_option" type="checkbox" value="yes">';
346
+ }
347
+ ?>
348
+ <?php _e("Auto Insert Related Posts",'wp_related_posts');?>
349
+ </label>
350
+ <br />
351
+ <label>
352
+ <?php
353
+ if ( $wp_rp["wp_rp_rss"] == 'yes' ) {
354
+ echo '<input name="wp_rp_rss_option" type="checkbox" value="yes" checked>';
355
+ } else {
356
+ echo '<input name="wp_rp_rss_option" type="checkbox" value="yes">';
357
+ }
358
+ ?>
359
+ <?php _e("Related Posts for RSS",'wp_related_posts');?>
360
+ </label>
361
+ <br />
362
+ <label>
363
+ <?php
364
+ if ( $wp_rp["wp_rp_comments"] == 'yes' ) {
365
+ echo '<input name="wp_rp_comments_option" type="checkbox" value="yes" checked>';
366
+ } else {
367
+ echo '<input name="wp_rp_comments_option" type="checkbox" value="yes">';
368
+ }
369
+ ?>
370
+ <?php _e("Display Comments Count",'wp_related_posts');?>
371
+ </label>
372
+ <br />
373
+ <label>
374
+ <?php
375
+ if ( $wp_rp["wp_rp_date"] == 'yes' ) {
376
+ echo '<input name="wp_rp_date_option" type="checkbox" value="yes" checked>';
377
+ } else {
378
+ echo '<input name="wp_rp_date_option" type="checkbox" value="yes">';
379
+ }
380
+ ?>
381
+ <?php _e("Display Post Date",'wp_related_posts');?>
382
+ </label>
383
+ <br />
384
+ </td>
385
+ </tr>
386
+ </table>
387
+
388
+ <p class="submit"><input type="submit" value="<?php _e("Update Preferences &raquo;",'wp_related_posts');?>" name="wp_rp_Submit" /></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  </form>
390
+ </div>
391
  <?php }?>
readme.txt CHANGED
@@ -3,16 +3,16 @@ Contributors: denishua
3
  Tags: Related,Posts
4
  Donate link: http://fairyfish.net/donate/
5
  Requires at least: 2.3
6
- Tested up to: 2.6.2
7
- Stable tag: 1.0
8
 
9
  WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
10
 
11
  == Description ==
12
 
13
  WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
 
14
 
15
- Please search and submit your transaltion here: <a href="http://fairyfish.net/2008/06/06/wordpress-related-posts-plugin-translation/">http://fairyfish.net/2008/06/06/wordpress-related-posts-plugin-translation/</a>
16
 
17
  == Installation ==
18
 
@@ -21,6 +21,10 @@ Please search and submit your transaltion here: <a href="http://fairyfish.net/20
21
  1. Place `<?php wp_related_posts(); ?>` in your templates
22
  1. Navigate to Manage > Option > WordPress Related Posts to configure plugin output.
23
 
 
 
 
 
24
 
25
  == Upgrade ==
26
 
3
  Tags: Related,Posts
4
  Donate link: http://fairyfish.net/donate/
5
  Requires at least: 2.3
6
+ Tested up to: 2.5 RC1
7
+ Stable tag: 0.6
8
 
9
  WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
10
 
11
  == Description ==
12
 
13
  WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
14
+ What would you like to be displayed when there is no related posts, "no related post" or "n" random posts, or anything else, please leave a comment in the plugin page. Thanks in advance!
15
 
 
16
 
17
  == Installation ==
18
 
21
  1. Place `<?php wp_related_posts(); ?>` in your templates
22
  1. Navigate to Manage > Option > WordPress Related Posts to configure plugin output.
23
 
24
+ == Screenshots ==
25
+
26
+ 1. WordPress Related Posts Plugin Option Setting.
27
+
28
 
29
  == Upgrade ==
30