WordPress Related Posts - Version 0.8

Version Description

Download this release

Release Info

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

Code changes from version 0.51 to 0.8

Thumbs.db CHANGED
Binary file
WP23RP/wp23_related_posts-bg_BG.mo DELETED
Binary file
WP23RP/wp23_related_posts-bg_BG.po DELETED
@@ -1,61 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WordPress 2.3 Related Posts Plugin v0.31\n"
4
- "POT-Creation-Date: \n"
5
- "PO-Revision-Date: 2007-09-28 21:26+0200\n"
6
- "Last-Translator: Iliyan Darganov <iliyan@darganov.com>\n"
7
- "Language-Team: Iliyan Darganov <iliyan@darganov.com>\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=utf-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Poedit-KeywordsList: _e;__\n"
12
- "X-Poedit-Basepath: .\n"
13
- "X-Poedit-Language: Bulgarian\n"
14
- "X-Poedit-Country: BULGARIA\n"
15
- "X-Poedit-SearchPath-0: .\n"
16
-
17
- #: wp23_related_posts.php:85
18
- #: wp23_related_posts.php:110
19
- msgid "Related Post"
20
- msgstr "Подобни публикации"
21
-
22
- #: wp23_related_posts.php:97
23
- msgid "No Related Post"
24
- msgstr "Няма подобни публикации"
25
-
26
- #: wp23_related_posts.php:126
27
- msgid "WP23 Related Posts"
28
- msgstr "WP23 Related Posts"
29
-
30
- #: wp23_related_posts.php:140
31
- msgid "Related Posts Options&hellip;"
32
- msgstr "Настройки на Related Posts&hellip;"
33
-
34
- #: wp23_related_posts.php:141
35
- msgid "WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed."
36
- msgstr "WordPress 2.3 Related Posts плъгин ще генерира подобни публикации чрез етикетите на WordPress 2.3 и ще ги покаже."
37
-
38
- #: wp23_related_posts.php:145
39
- msgid "Related Posts Preference"
40
- msgstr "Предпочитания"
41
-
42
- #: wp23_related_posts.php:148
43
- msgid "Related Posts Title:"
44
- msgstr "Заглавие, ако има подобни публикации:"
45
-
46
- #: wp23_related_posts.php:154
47
- msgid "No Related Posts Text:"
48
- msgstr "Текст, ако няма подобни публикации:"
49
-
50
- #: wp23_related_posts.php:160
51
- msgid "Limit:"
52
- msgstr "Ограничение:"
53
-
54
- #: wp23_related_posts.php:166
55
- msgid "Exclude(category IDs):"
56
- msgstr "Изключване (ID на категорията):"
57
-
58
- #: wp23_related_posts.php:182
59
- msgid "Related Posts for RSS"
60
- msgstr "Показване на подобни публикации и в RSS"
61
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WP23RP/wp23_related_posts-de_DE.mo DELETED
Binary file
WP23RP/wp23_related_posts-de_DE.po DELETED
@@ -1,61 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WordPress 2.3 Related Posts Plugin v0.2\n"
4
- "POT-Creation-Date: \n"
5
- "PO-Revision-Date: 2007-09-27 17:40+0100\n"
6
- "Last-Translator: Joern Kretzschmar <joern@diekretzschmars.de>\n"
7
- "Language-Team: J. Kretzschmar <joern@diekretzschmars.de>\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=utf-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Poedit-KeywordsList: _e;__\n"
12
- "X-Poedit-Basepath: .\n"
13
- "X-Poedit-Language: German\n"
14
- "X-Poedit-Country: GERMANY\n"
15
- "X-Poedit-SearchPath-0: .\n"
16
-
17
- #: wp23_related_posts.php:160
18
- #: wp23_related_posts.php:210
19
- msgid "Related Post"
20
- msgstr "&Auml;hnliche Beitr&auml;ge"
21
-
22
- #: wp23_related_posts.php:184
23
- msgid "No Related Post"
24
- msgstr "Keine &auml;hnlichen Beitr&auml;ge"
25
-
26
- #: wp23_related_posts.php:242
27
- msgid "WP23 Related Posts"
28
- msgstr "WP23 Related Posts"
29
-
30
- #: wp23_related_posts.php:269
31
- msgid "Related Posts Options&hellip;"
32
- msgstr "Related Posts Optionen&hellip;"
33
-
34
- #: wp23_related_posts.php:271
35
- msgid "WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed."
36
- msgstr "Das WordPress 2.3 Related Posts Plugin stellt &auml;hnliche Beitr&auml;ge anhand der WordPress 2.3 Tags dar und f&uuml;gt sie dem RSS-Feed hinzu."
37
-
38
- #: wp23_related_posts.php:279
39
- msgid "Related Posts Preference"
40
- msgstr "Related Posts Einstellungen"
41
-
42
- #: wp23_related_posts.php:285
43
- msgid "Related Posts Title:"
44
- msgstr "Related Post Titel:"
45
-
46
- #: wp23_related_posts.php:297
47
- msgid "No Related Posts Text:"
48
- msgstr "Text, falls es keine &auml;hnlichen Beitr&auml;ge gibt:"
49
-
50
- #: wp23_related_posts.php:309
51
- msgid "Limit:"
52
- msgstr "Anzahl:"
53
-
54
- #: wp23_related_posts.php:320
55
- msgid "Exclude(category IDs):"
56
- msgstr "Ausschluss (Kategorie IDs):"
57
-
58
- #: wp23_related_posts.php:352
59
- msgid "Related Posts for RSS"
60
- msgstr "Related Posts in den RSS-Feed einbeziehen."
61
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WP23RP/wp23_related_posts-el_GR.mo DELETED
Binary file
WP23RP/wp23_related_posts-el_GR.po DELETED
@@ -1,59 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WordPress 2.3 Related Posts Plugin v0.2\n"
4
- "POT-Creation-Date: \n"
5
- "PO-Revision-Date: 2007-09-29 00:14+0200\n"
6
- "Last-Translator: Alexander Kanakaris <lexios@hotmail.com>\n"
7
- "Language-Team: WordPress 中文团队 <team@wp-cn.com>\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=utf-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Poedit-KeywordsList: _e;__\n"
12
- "X-Poedit-Basepath: .\n"
13
- "X-Poedit-SearchPath-0: .\n"
14
-
15
- #: wp23_related_posts.php:85
16
- #: wp23_related_posts.php:110
17
- msgid "Related Post"
18
- msgstr "Σχετικό Άρθρο"
19
-
20
- #: wp23_related_posts.php:97
21
- msgid "No Related Post"
22
- msgstr "Κανένα Σχετικό Άρθρο"
23
-
24
- #: wp23_related_posts.php:126
25
- msgid "WP23 Related Posts"
26
- msgstr "WP32 Σχετικά Άρθρα"
27
-
28
- #: wp23_related_posts.php:140
29
- msgid "Related Posts Options&hellip;"
30
- msgstr "Επιλογές Σχετικών Άρθρων&hellip;"
31
-
32
- #: wp23_related_posts.php:141
33
- msgid "WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed."
34
- msgstr "Το Πρόσθετο Σχετικά Άρθρα (Wordpress 2.3) θα δημιουργεί λίστα σχετικών άρθρων βασισμένο στα tags του Wordpress 2.3. Επίσης θα προσθέτει τα σχετικά άρθρα και στη ροή RSS."
35
-
36
- #: wp23_related_posts.php:145
37
- msgid "Related Posts Preference"
38
- msgstr "Προτιμήσεις Σχετικών Άρθρων"
39
-
40
- #: wp23_related_posts.php:148
41
- msgid "Related Posts Title:"
42
- msgstr "Ο τίλτος των Σχετικών Άρθρων:"
43
-
44
- #: wp23_related_posts.php:154
45
- msgid "No Related Posts Text:"
46
- msgstr "Κείμενο όταν δεν υπάρχουν σχετικά άρθρα:"
47
-
48
- #: wp23_related_posts.php:160
49
- msgid "Limit:"
50
- msgstr "Όριο:"
51
-
52
- #: wp23_related_posts.php:166
53
- msgid "Exclude(category IDs):"
54
- msgstr "Εξαιρέσεις (ID κατηγορίας):"
55
-
56
- #: wp23_related_posts.php:182
57
- msgid "Related Posts for RSS"
58
- msgstr "Σχετικά Άρθρα για ροή RSS:"
59
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WP23RP/wp23_related_posts-tr_TR.mo DELETED
Binary file
WP23RP/wp23_related_posts-tr_TR.po DELETED
@@ -1,62 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WordPress 2.3 Related Posts Plugin v0.2\n"
4
- "POT-Creation-Date: \n"
5
- "PO-Revision-Date: 2007-09-28 21:37+0200\n"
6
- "Last-Translator: \n"
7
- "Language-Team: Baris Unver <baris.unver@beyn.org>\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=utf-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Poedit-KeywordsList: _e;__\n"
12
- "X-Poedit-Basepath: .\n"
13
- "X-Poedit-Language: Turkish\n"
14
- "X-Poedit-Country: TURKEY\n"
15
- "X-Poedit-SourceCharset: utf-8\n"
16
- "X-Poedit-SearchPath-0: .\n"
17
-
18
- #: wp23_related_posts.php:160
19
- #: wp23_related_posts.php:210
20
- msgid "Related Post"
21
- msgstr "Benzer Yazı"
22
-
23
- #: wp23_related_posts.php:184
24
- msgid "No Related Post"
25
- msgstr "Benzer Yazı Yok"
26
-
27
- #: wp23_related_posts.php:242
28
- msgid "WP23 Related Posts"
29
- msgstr "WP23 Benzer Yazılar"
30
-
31
- #: wp23_related_posts.php:269
32
- msgid "Related Posts Options&hellip;"
33
- msgstr "Benzer Yazılar Seçenekleri&hellip;"
34
-
35
- #: wp23_related_posts.php:271
36
- msgid "WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed."
37
- msgstr "Wordpress 2.3 Benzer Yazılar Eeklentisi, Wordpress 2.3 etiketlerini kullanarak yazdığınız yazıya benzeyen yazıları bulup sizin için listeler. Bunu isterseniz beslemenize de koyabilir."
38
-
39
- #: wp23_related_posts.php:279
40
- msgid "Related Posts Preference"
41
- msgstr "Benzer Yazılar Tercihleri"
42
-
43
- #: wp23_related_posts.php:285
44
- msgid "Related Posts Title:"
45
- msgstr "Benzer Yazılar başlığı:"
46
-
47
- #: wp23_related_posts.php:297
48
- msgid "No Related Posts Text:"
49
- msgstr "Benzer yazı olmadığı zaman çıkacak yazı:"
50
-
51
- #: wp23_related_posts.php:309
52
- msgid "Limit:"
53
- msgstr "Sınır:"
54
-
55
- #: wp23_related_posts.php:320
56
- msgid "Exclude(category IDs):"
57
- msgstr "Hariç tutulacak kategoriler (ID'lerle):"
58
-
59
- #: wp23_related_posts.php:352
60
- msgid "Related Posts for RSS"
61
- msgstr "Benzer yazıları RSS beslemesinde göster"
62
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WP23RP/wp23_related_posts-zh_CN.mo DELETED
Binary file
WP23RP/wp23_related_posts-zh_TW.mo DELETED
Binary file
WP23RP/wp23_related_posts-zh_TW.po DELETED
@@ -1,59 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WordPress 2.3 Related Posts Plugin v0.2\n"
4
- "POT-Creation-Date: \n"
5
- "PO-Revision-Date: 2007-10-05 13:09+0800\n"
6
- "Last-Translator: Neil Lin <neil.lch@gmail.com>\n"
7
- "Language-Team: WordPress 中文团队 <team@wp-cn.com>\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=utf-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Poedit-KeywordsList: _e;__\n"
12
- "X-Poedit-Basepath: .\n"
13
- "X-Poedit-SearchPath-0: .\n"
14
-
15
- #: wp23_related_posts.php:85
16
- #: wp23_related_posts.php:110
17
- msgid "Related Post"
18
- msgstr "相關文章"
19
-
20
- #: wp23_related_posts.php:97
21
- msgid "No Related Post"
22
- msgstr "無相關文章"
23
-
24
- #: wp23_related_posts.php:126
25
- msgid "WP23 Related Posts"
26
- msgstr "WP23 Related Posts"
27
-
28
- #: wp23_related_posts.php:140
29
- msgid "Related Posts Options&hellip;"
30
- msgstr "相關文章設定&hellip;"
31
-
32
- #: wp23_related_posts.php:141
33
- msgid "WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed."
34
- msgstr "WordPress 2.3 Related Posts 會從 WordPress 2.3 標籤中找出相關文章,並且將其加入feed中。"
35
-
36
- #: wp23_related_posts.php:145
37
- msgid "Related Posts Preference"
38
- msgstr "相關文章設定值"
39
-
40
- #: wp23_related_posts.php:148
41
- msgid "Related Posts Title:"
42
- msgstr "相關文章的標題:"
43
-
44
- #: wp23_related_posts.php:154
45
- msgid "No Related Posts Text:"
46
- msgstr "無相關文章時所顯示的文字:"
47
-
48
- #: wp23_related_posts.php:160
49
- msgid "Limit:"
50
- msgstr "文章顯示數量限制:"
51
-
52
- #: wp23_related_posts.php:166
53
- msgid "Exclude(category IDs):"
54
- msgstr "排除項目(分類的ID):"
55
-
56
- #: wp23_related_posts.php:182
57
- msgid "Related Posts for RSS"
58
- msgstr "在RSS中顯示相關文章"
59
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WP23RP/wp23_related_posts.mo DELETED
Binary file
WP23RP/wp23_related_posts.php DELETED
@@ -1,271 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: WP 2.3 Related Posts
4
- Version: 0.51
5
- Plugin URI: http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/
6
- Description: Generate a related posts list via tags of WorPdress 2.3
7
- Author: Denis,PaoPao
8
- Author URI: http://fairyfish.net/
9
-
10
- Copyright (c) 2007
11
- Released under the GPL license
12
- http://www.gnu.org/licenses/gpl.txt
13
-
14
- This file is part of WordPress.
15
- WordPress is free software; you can redistribute it and/or modify
16
- it under the terms of the GNU General Public License as published by
17
- the Free Software Foundation; either version 2 of the License, or
18
- (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
-
29
- INSTALL:
30
- Just install the plugin in your blog and activate
31
- */
32
-
33
- load_plugin_textdomain('wp23_related_posts',PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) );
34
-
35
- function wp23_get_related_posts() {
36
- global $wpdb, $post;
37
- if(!$post->ID){return;}
38
- $now = current_time('mysql', 1);
39
- $tags = wp_get_post_tags($post->ID);
40
-
41
- //print_r($tags);
42
-
43
- $taglist = "'" . str_replace("'",'',str_replace('"','',urldecode($tags[0]->term_id))). "'";
44
- $tagcount = count($tags);
45
- if ($tagcount > 1) {
46
- for ($i = 1; $i <= $tagcount; $i++) {
47
- $taglist = $taglist . ", '" . str_replace("'",'',str_replace('"','',urldecode($tags[$i]->term_id))) . "'";
48
- }
49
- }
50
-
51
- $limit = get_option("wp23_RP_limit");
52
-
53
- if ($limit) $limitclause = "LIMIT $limit";
54
- $exclude = get_option("wp23_RP_exclude");
55
- if ( $exclude != '' ) {
56
- $excludeclause = "AND p.ID NOT IN (SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id REGEXP '[$exclude]')";
57
- }
58
-
59
- $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' $excludeclause GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;";
60
-
61
- //echo $q;
62
-
63
- $related_posts = $wpdb->get_results($q);
64
- $output = "";
65
- $wp23_RP_title = get_option("wp23_RP_title");
66
- if(!$wp23_RP_title) $wp23_RP_title= __("Related Post",'wp23_related_posts');
67
-
68
- if (!$related_posts){
69
-
70
- $wp23_no_RP = get_option("wp23_no_RP");
71
-
72
- if(!$wp23_no_RP || ($wp23_no_RP == "popularity" && !function_exists('akpc_most_popular'))) $wp23_no_RP = "text";
73
-
74
- $wp23_no_RP_text = get_option("wp23_no_RP_text");
75
-
76
- if($wp23_no_RP == "text"){
77
- if(!$wp23_no_RP_text) $wp23_no_RP_text= __("No Related Post",'wp23_related_posts');
78
- $output .= '<li>'.$wp23_no_RP_text .'</li>';
79
- } else{
80
- if($wp23_no_RP == "random"){
81
- if(!$wp23_no_RP_text) $wp23_no_RP_text= __("Random Posts",'wp23_related_posts');
82
- $related_posts = wp23_random_posts($limitclause);
83
- } elseif($wp23_no_RP == "commented"){
84
- if(!$wp23_no_RP_text) $wp23_no_RP_text= __("Most Commented Posts",'wp23_related_posts');
85
- $related_posts = wp23_most_commented_posts($limitclause);
86
- } elseif($wp23_no_RP == "popularity"){
87
- if(!$wp23_no_RP_text) $wp23_no_RP_text= __("Most Popular Posts",'wp23_related_posts');
88
- $related_posts = wp23_most_popular_posts($limitclause);
89
- }else{
90
- return __("Something wrong",'wp23_related_posts');;
91
- }
92
- $wp23_RP_title = $wp23_no_RP_text;
93
- }
94
- }
95
-
96
- foreach ($related_posts as $related_post ){
97
- $output .= '<li>';
98
-
99
- $show_date = get_option("wp23_RP_Date");
100
- if ($show_date){
101
- $dateformat = get_option('date_format');
102
- $output .= mysql2date($dateformat, $related_post->post_date) . " -- ";
103
- }
104
-
105
- $output .= '<a href="'.get_permalink($related_post->ID).'" title="'.wptexturize($related_post->post_title).'">'.wptexturize($related_post->post_title).'';
106
-
107
- $show_comments_count = get_option("wp23_RP_Comments");
108
- if ($show_comments_count){
109
- $output .= " (" . $related_post->comment_count . ")";
110
- }
111
-
112
- $output .= '</a></li>';
113
- }
114
-
115
- $output = '<h3>'.$wp23_RP_title .'</h3>'.'<ul class="related_post">' . $output . '</ul>';
116
- return $output;
117
- }
118
-
119
- function wp23_related_posts(){
120
-
121
- $output = wp23_get_related_posts() ;
122
- echo $output;
123
- }
124
-
125
- function wp23_related_posts_for_feed($content=""){
126
- $wp23_RP_RSS = (get_option("wp23_RP_RSS") == 'yes') ? 1 : 0;
127
- if ( (! is_feed()) || (! $wp23_RP_RSS)) return $content;
128
-
129
- $output = wp23_get_related_posts() ;
130
- $content = $content . $output;
131
-
132
- return $content;
133
- }
134
-
135
- add_filter('the_content', 'wp23_related_posts_for_feed',99);
136
-
137
- function wp23_random_posts ($limitclause="") {
138
- global $wpdb, $tableposts, $post;
139
-
140
- $q = "SELECT ID, post_title, post_date, comment_count FROM $tableposts WHERE post_status = 'publish' AND post_type = 'post' AND ID != $post->ID ORDER BY RAND() $limitclause";
141
- return $wpdb->get_results($q);
142
- }
143
-
144
-
145
- function wp23_most_commented_posts($limitclause="") {
146
- global $wpdb;
147
- $q = "SELECT ID, post_title, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC $limitclause";
148
- return $wpdb->get_results($q);
149
- }
150
-
151
- function wp23_most_popular_posts ($limitclause="") {
152
- global $wpdb, $table_prefix;
153
-
154
- $q = $sql = "SELECT p.ID, p.post_title, p.post_date, p.comment_count FROM ". $table_prefix ."ak_popularity as akpc,".$table_prefix ."posts as p WHERE p.ID = akpc.post_id ORDER BY akpc.total DESC $limitclause";;
155
- return $wpdb->get_results($q);
156
- }
157
-
158
- add_action('admin_menu', 'wp23_add_related_posts_options_page');
159
-
160
- function wp23_add_related_posts_options_page() {
161
- if (function_exists('add_options_page')) {
162
- add_options_page( __('WP23 Related Posts','wp23_related_posts'), __('WP23 Related Posts','wp23_related_posts'), 8, basename(__FILE__), 'wp23_related_posts_options_subpanel');
163
- }
164
- }
165
-
166
- function wp23_related_posts_options_subpanel() {
167
- if ($_POST['wp23_RP_stage'] == 'process') {
168
- update_option('wp23_RP_title', $_POST['wp23_RP_title_option']);
169
- update_option('wp23_no_RP', $_POST['wp23_no_RP_option']);
170
- update_option('wp23_no_RP_text', $_POST['wp23_no_RP_text_option']);
171
- update_option('wp23_RP_limit', $_POST['wp23_RP_limit_option']);
172
- update_option('wp23_RP_exclude', $_POST['wp23_RP_exclude_option']);
173
- update_option('wp23_RP_RSS', $_POST['wp23_RP_RSS_option']);
174
- update_option('wp23_RP_Comments', $_POST['wp23_RP_Comments_option']);
175
- update_option('wp23_RP_Date', $_POST['wp23_RP_Date_option']);
176
- }
177
- ?>
178
- <div class="wrap">
179
- <h2 id="write-post"><?php _e("Related Posts Options&hellip;",'wp23_related_posts');?></h2>
180
- <p><?php _e("WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed.",'wp23_related_posts');?></p>
181
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo basename(__FILE__); ?>">
182
- <input type="hidden" name="wp23_RP_stage" value="process" />
183
- <fieldset class="options">
184
- <legend><?php _e("Related Posts Preference",'wp23_related_posts');?></legend>
185
- <table>
186
- <tr>
187
- <td valign="top" align="right"><?php _e("Related Posts Title:",'wp23_related_posts'); ?></td>
188
- <td>
189
- <input type="text" name="wp23_RP_title_option" value="<?php echo get_option("wp23_RP_title"); ?>" />
190
- </td>
191
- </tr>
192
- <tr>
193
- <td valign="middle" align="right"><?php _e("When No Related Posts, Dispaly:",'wp23_related_posts'); ?></td>
194
- <td>
195
- <?php $wp23_no_RP = get_option("wp23_no_RP"); ?>
196
- <select name="wp23_no_RP_option">
197
- <option value="text" <?php if($wp23_no_RP == 'text') echo 'selected' ?>><?php _e("Text: 'No Related Posts'",'wp23_related_posts'); ?></option>
198
- <option value="random" <?php if($wp23_no_RP == 'random') echo 'selected' ?>><?php _e("Random Posts",'wp23_related_posts'); ?></option>
199
- <option value="commented" <?php if($wp23_no_RP == 'commented') echo 'selected' ?>><?php _e("Most Commented Posts",'wp23_related_posts'); ?></option>
200
- <?php if (function_exists('akpc_most_popular')){ ?>
201
- <option value="popularity" <?php if($wp23_no_RP == 'popularity') echo 'selected' ?>><?php _e("Most Popular Posts",'wp23_related_posts'); ?></option>
202
- <?php } ?>
203
- </select>
204
- </td>
205
- </tr>
206
- <tr>
207
- <td valign="top" align="right"><?php _e("No Related Post's Title or Text:",'wp23_related_posts'); ?></td>
208
- <td>
209
- <input type="text" name="wp23_no_RP_text_option" value="<?php echo get_option("wp23_no_RP_text"); ?>" />
210
- </td>
211
- </tr>
212
- <tr>
213
- <td valign="top" align="right"><?php _e("Limit:",'wp23_related_posts');?></td>
214
- <td>
215
- <input type="text" name="wp23_RP_limit_option" value="<?php echo get_option("wp23_RP_limit"); ?>" />
216
- </td>
217
- </tr>
218
- <tr>
219
- <td valign="top" align="right"><?php _e("Exclude(category IDs):",'wp23_related_posts');?></td>
220
- <td>
221
- <input type="text" name="wp23_RP_exclude_option" value="<?php echo get_option("wp23_RP_exclude"); ?>" />
222
- </td>
223
- </tr>
224
- <tr>
225
- <td valign="top" align="right">
226
- <?php
227
- if ( get_option("wp23_RP_RSS") == 'yes' ) {
228
- echo '<input name="wp23_RP_RSS_option" type="checkbox" value="yes" checked>';
229
- } else {
230
- echo '<input name="wp23_RP_RSS_option" type="checkbox" value="yes">';
231
- }
232
- ?>
233
- </td>
234
- <td>
235
- <?php _e("Related Posts for RSS",'wp23_related_posts');?>
236
- </td>
237
- </tr>
238
- <tr>
239
- <td valign="top" align="right">
240
- <?php
241
- if ( get_option("wp23_RP_Comments") == 'yes' ) {
242
- echo '<input name="wp23_RP_Comments_option" type="checkbox" value="yes" checked>';
243
- } else {
244
- echo '<input name="wp23_RP_Comments_option" type="checkbox" value="yes">';
245
- }
246
- ?>
247
- </td>
248
- <td>
249
- <?php _e("Display Comments Count",'wp23_related_posts');?>
250
- </td>
251
- </tr>
252
- <tr>
253
- <td valign="top" align="right">
254
- <?php
255
- if ( get_option("wp23_RP_Date") == 'yes' ) {
256
- echo '<input name="wp23_RP_Date_option" type="checkbox" value="yes" checked>';
257
- } else {
258
- echo '<input name="wp23_RP_Date_option" type="checkbox" value="yes">';
259
- }
260
- ?>
261
- </td>
262
- <td>
263
- <?php _e("Display Post Date",'wp23_related_posts');?>
264
- </td>
265
- </tr>
266
- </table>
267
- </fieldset>
268
- <p class="submit"><input type="submit" value="<?php _e("Update Preferences &raquo;");?>" name="Submit" /></p>
269
- </form>
270
- </div>
271
- <?php }?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WP23RP/wp23_related_posts.po DELETED
@@ -1,106 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: wp23_related_posts\n"
4
- "POT-Creation-Date: \n"
5
- "PO-Revision-Date: 2007-11-03 23:34+0800\n"
6
- "Last-Translator: Denis <honghua.deng@gmail.com>\n"
7
- "Language-Team: \n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=utf-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Poedit-KeywordsList: _e;__\n"
12
- "X-Poedit-Basepath: .\n"
13
- "X-Poedit-SearchPath-0: .\n"
14
-
15
- #: wp23_related_posts.php:66
16
- msgid "Related Post"
17
- msgstr ""
18
-
19
- #: wp23_related_posts.php:77
20
- msgid "No Related Post"
21
- msgstr ""
22
-
23
- #: wp23_related_posts.php:81
24
- msgid "Random Posts"
25
- msgstr ""
26
-
27
- #: wp23_related_posts.php:84
28
- msgid "Most Commented Posts"
29
- msgstr ""
30
-
31
- #: wp23_related_posts.php:87
32
- msgid "Most Popular Posts"
33
- msgstr ""
34
-
35
- #: wp23_related_posts.php:90
36
- msgid "Something wrong"
37
- msgstr ""
38
-
39
- #: wp23_related_posts.php:165
40
- msgid "WP23 Related Posts"
41
- msgstr ""
42
-
43
- #: wp23_related_posts.php:182
44
- msgid "Related Posts Options&hellip;"
45
- msgstr ""
46
-
47
- #: wp23_related_posts.php:183
48
- msgid "WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed."
49
- msgstr ""
50
-
51
- #: wp23_related_posts.php:187
52
- msgid "Related Posts Preference"
53
- msgstr ""
54
-
55
- #: wp23_related_posts.php:190
56
- msgid "Related Posts Title:"
57
- msgstr ""
58
-
59
- #: wp23_related_posts.php:196
60
- msgid "Shown When No Related Posts:"
61
- msgstr ""
62
-
63
- #: wp23_related_posts.php:200
64
- msgid "Display Text: 'No Related Posts'"
65
- msgstr ""
66
-
67
- #: wp23_related_posts.php:201
68
- msgid "Display Random Posts"
69
- msgstr ""
70
-
71
- #: wp23_related_posts.php:202
72
- msgid "Display Most Commented Posts"
73
- msgstr ""
74
-
75
- #: wp23_related_posts.php:204
76
- msgid "Display Most Popular Posts"
77
- msgstr ""
78
-
79
- #: wp23_related_posts.php:210
80
- msgid "No Related Posts Text or Title:"
81
- msgstr ""
82
-
83
- #: wp23_related_posts.php:216
84
- msgid "Limit:"
85
- msgstr ""
86
-
87
- #: wp23_related_posts.php:222
88
- msgid "Exclude(category IDs):"
89
- msgstr ""
90
-
91
- #: wp23_related_posts.php:238
92
- msgid "Related Posts for RSS"
93
- msgstr ""
94
-
95
- #: wp23_related_posts.php:252
96
- msgid "Display Comments Count"
97
- msgstr ""
98
-
99
- #: wp23_related_posts.php:266
100
- msgid "Display Post Date"
101
- msgstr ""
102
-
103
- #: wp23_related_posts.php:271
104
- msgid "Update Preferences &raquo;"
105
- msgstr ""
106
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WPRP/lang/default.mo ADDED
Binary file
WPRP/lang/default.po ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: wp_related_post\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2008-03-20 21:45+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:129
17
+ msgid "No Related Post"
18
+ msgstr ""
19
+
20
+ #: wp_related_posts.php:133
21
+ #: wp_related_posts.php:326
22
+ msgid "Random Posts"
23
+ msgstr ""
24
+
25
+ #: wp_related_posts.php:136
26
+ #: wp_related_posts.php:327
27
+ msgid "Most Commented Posts"
28
+ msgstr ""
29
+
30
+ #: wp_related_posts.php:139
31
+ #: wp_related_posts.php:329
32
+ msgid "Most Popular Posts"
33
+ msgstr ""
34
+
35
+ #: wp_related_posts.php:142
36
+ msgid "Something wrong"
37
+ msgstr ""
38
+
39
+ #: wp_related_posts.php:277
40
+ msgid "WordPress Related Posts"
41
+ msgstr ""
42
+
43
+ #: wp_related_posts.php:309
44
+ msgid "Related Posts Options&hellip;"
45
+ msgstr ""
46
+
47
+ #: wp_related_posts.php:310
48
+ msgid "WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed."
49
+ msgstr ""
50
+
51
+ #: wp_related_posts.php:312
52
+ msgid "Related Posts Preference"
53
+ msgstr ""
54
+
55
+ #: wp_related_posts.php:315
56
+ msgid "Related Posts Title:"
57
+ msgstr ""
58
+
59
+ #: wp_related_posts.php:321
60
+ msgid "When No Related Posts, Dispaly:"
61
+ msgstr ""
62
+
63
+ #: wp_related_posts.php:325
64
+ msgid "Text: 'No Related Posts'"
65
+ msgstr ""
66
+
67
+ #: wp_related_posts.php:335
68
+ msgid "No Related Post's Title or Text:"
69
+ msgstr ""
70
+
71
+ #: wp_related_posts.php:341
72
+ msgid "Limit:"
73
+ msgstr ""
74
+
75
+ #: wp_related_posts.php:347
76
+ msgid "Exclude(category IDs):"
77
+ msgstr ""
78
+
79
+ #: wp_related_posts.php:353
80
+ msgid "Other Setting:"
81
+ msgstr ""
82
+
83
+ #: wp_related_posts.php:363
84
+ msgid "Auto Insert Related Posts"
85
+ msgstr ""
86
+
87
+ #: wp_related_posts.php:374
88
+ msgid "Related Posts for RSS"
89
+ msgstr ""
90
+
91
+ #: wp_related_posts.php:385
92
+ msgid "Display Comments Count"
93
+ msgstr ""
94
+
95
+ #: wp_related_posts.php:396
96
+ msgid "Display Post Date"
97
+ msgstr ""
98
+
99
+ #: wp_related_posts.php:403
100
+ msgid "Update Preferences &raquo;"
101
+ msgstr ""
102
+
WPRP/lang/wp_related_posts-zh_CN.mo ADDED
Binary file
WP23RP/wp23_related_posts-zh_CN.po → WPRP/lang/wp_related_posts-zh_CN.po RENAMED
@@ -1,97 +1,105 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WordPress 2.3 Related Posts Plugin v0.2\n"
4
- "POT-Creation-Date: \n"
5
- "PO-Revision-Date: 2007-11-03 23:56+0800\n"
 
6
  "Last-Translator: Denis <honghua.deng@gmail.com>\n"
7
  "Language-Team: WordPress 中文团队 <team@wp-cn.com>\n"
8
  "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
  "X-Poedit-KeywordsList: _e;__\n"
12
  "X-Poedit-Basepath: .\n"
13
  "X-Poedit-SearchPath-0: .\n"
14
 
15
- #: wp23_related_posts.php:66
16
- msgid "Related Post"
17
- msgstr "相关日志"
18
-
19
- #: wp23_related_posts.php:77
20
  msgid "No Related Post"
21
  msgstr "暂无相关日志"
22
 
23
- #: wp23_related_posts.php:81
24
- #: wp23_related_posts.php:201
25
  msgid "Random Posts"
26
  msgstr "随机日志"
27
 
28
- #: wp23_related_posts.php:84
29
- #: wp23_related_posts.php:202
30
  msgid "Most Commented Posts"
31
  msgstr "最多留言日志"
32
 
33
- #: wp23_related_posts.php:87
34
- #: wp23_related_posts.php:204
35
  msgid "Most Popular Posts"
36
  msgstr "最流行日志"
37
 
38
- #: wp23_related_posts.php:90
39
  msgid "Something wrong"
40
  msgstr "发生错误了"
41
 
42
- #: wp23_related_posts.php:165
43
- msgid "WP23 Related Posts"
44
- msgstr "WP23 相关日志"
45
 
46
- #: wp23_related_posts.php:182
47
  msgid "Related Posts Options&hellip;"
48
  msgstr "相关日志选项 &hellip;"
49
 
50
- #: wp23_related_posts.php:183
51
- msgid "WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed."
52
- msgstr "WordPress 2.3 相关日志插件可以通过 WordPress 2.3 的标签系统产生一个相关日志列表,并可以添加相关日志至 RSS 中。"
53
 
54
- #: wp23_related_posts.php:187
55
  msgid "Related Posts Preference"
56
  msgstr "相关日志设置"
57
 
58
- #: wp23_related_posts.php:190
59
  msgid "Related Posts Title:"
60
  msgstr "相关日志列表的标题:"
61
 
62
- #: wp23_related_posts.php:196
63
  msgid "When No Related Posts, Dispaly:"
64
  msgstr "当没有相关日志时,显示:"
65
 
66
- #: wp23_related_posts.php:200
67
  msgid "Text: 'No Related Posts'"
68
  msgstr "文本:“无相关日志”"
69
 
70
- #: wp23_related_posts.php:210
71
  msgid "No Related Post's Title or Text:"
72
  msgstr "无相关日志时的标题或文本:"
73
 
74
- #: wp23_related_posts.php:216
75
  msgid "Limit:"
76
  msgstr "显示的项数:"
77
 
78
- #: wp23_related_posts.php:222
79
  msgid "Exclude(category IDs):"
80
  msgstr "不包括(分类ID):"
81
 
82
- #: wp23_related_posts.php:238
 
 
 
 
 
 
 
 
83
  msgid "Related Posts for RSS"
84
  msgstr "在RSS中添加相关日志"
85
 
86
- #: wp23_related_posts.php:252
87
  msgid "Display Comments Count"
88
  msgstr "显示留言数"
89
 
90
- #: wp23_related_posts.php:266
91
  msgid "Display Post Date"
92
  msgstr "显示日期"
93
 
94
- #: wp23_related_posts.php:271
95
  msgid "Update Preferences &raquo;"
96
  msgstr "更新选项 &raquo;"
97
 
 
 
 
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: 2008-03-20 21:43+0800\n"
6
+ "PO-Revision-Date: 2008-03-20 21:44+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:129
 
 
 
 
17
  msgid "No Related Post"
18
  msgstr "暂无相关日志"
19
 
20
+ #: wp_related_posts.php:133
21
+ #: wp_related_posts.php:326
22
  msgid "Random Posts"
23
  msgstr "随机日志"
24
 
25
+ #: wp_related_posts.php:136
26
+ #: wp_related_posts.php:327
27
  msgid "Most Commented Posts"
28
  msgstr "最多留言日志"
29
 
30
+ #: wp_related_posts.php:139
31
+ #: wp_related_posts.php:329
32
  msgid "Most Popular Posts"
33
  msgstr "最流行日志"
34
 
35
+ #: wp_related_posts.php:142
36
  msgid "Something wrong"
37
  msgstr "发生错误了"
38
 
39
+ #: wp_related_posts.php:277
40
+ msgid "WordPress Related Posts"
41
+ msgstr "WordPress 相关日志"
42
 
43
+ #: wp_related_posts.php:309
44
  msgid "Related Posts Options&hellip;"
45
  msgstr "相关日志选项 &hellip;"
46
 
47
+ #: wp_related_posts.php:310
48
+ msgid "WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed."
49
+ msgstr "WordPress 相关日志插件可以通过 WordPress 的标签系统产生一个相关日志列表,并可以添加相关日志至 RSS 中。"
50
 
51
+ #: wp_related_posts.php:312
52
  msgid "Related Posts Preference"
53
  msgstr "相关日志设置"
54
 
55
+ #: wp_related_posts.php:315
56
  msgid "Related Posts Title:"
57
  msgstr "相关日志列表的标题:"
58
 
59
+ #: wp_related_posts.php:321
60
  msgid "When No Related Posts, Dispaly:"
61
  msgstr "当没有相关日志时,显示:"
62
 
63
+ #: wp_related_posts.php:325
64
  msgid "Text: 'No Related Posts'"
65
  msgstr "文本:“无相关日志”"
66
 
67
+ #: wp_related_posts.php:335
68
  msgid "No Related Post's Title or Text:"
69
  msgstr "无相关日志时的标题或文本:"
70
 
71
+ #: wp_related_posts.php:341
72
  msgid "Limit:"
73
  msgstr "显示的项数:"
74
 
75
+ #: wp_related_posts.php:347
76
  msgid "Exclude(category IDs):"
77
  msgstr "不包括(分类ID):"
78
 
79
+ #: wp_related_posts.php:353
80
+ msgid "Other Setting:"
81
+ msgstr "其他设置"
82
+
83
+ #: wp_related_posts.php:363
84
+ msgid "Auto Insert Related Posts"
85
+ msgstr "自动插入相关日志"
86
+
87
+ #: wp_related_posts.php:374
88
  msgid "Related Posts for RSS"
89
  msgstr "在RSS中添加相关日志"
90
 
91
+ #: wp_related_posts.php:385
92
  msgid "Display Comments Count"
93
  msgstr "显示留言数"
94
 
95
+ #: wp_related_posts.php:396
96
  msgid "Display Post Date"
97
  msgstr "显示日期"
98
 
99
+ #: wp_related_posts.php:403
100
  msgid "Update Preferences &raquo;"
101
  msgstr "更新选项 &raquo;"
102
 
103
+ #~ msgid "Related Post"
104
+ #~ msgstr "相关日志"
105
+
WPRP/wp_related_posts.php ADDED
@@ -0,0 +1,391 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 WorPdress
7
+ Author: Denis
8
+ Author URI: http://fairyfish.net/
9
+
10
+ Copyright (c) 2007
11
+ Released under the GPL license
12
+ http://www.gnu.org/licenses/gpl.txt
13
+
14
+ This file is part of WordPress.
15
+ WordPress is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 2 of the License, or
18
+ (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
+
29
+ INSTALL:
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;
37
+ $wp_rp = get_option("wp_rp");
38
+
39
+ $exclude = explode(",",$wp_rp["wp_rp_exclude"]);
40
+ $limit = $wp_rp["wp_rp_limit"];
41
+ $wp_rp_title = $wp_rp["wp_rp_title"];
42
+ $wp_no_rp = $wp_rp["wp_no_rp"];
43
+ $wp_no_rp_text = $wp_rp["wp_no_rp_text"];
44
+ $show_date = $wp_rp["wp_rp_date"];
45
+ $show_comments_count = $wp_rp["wp_rp_comments"];
46
+
47
+ if ( $exclude != '' ) {
48
+ $q = "SELECT tt.term_id FROM ". $table_prefix ."term_taxonomy tt, " . $table_prefix . "term_relationships tr WHERE tt.taxonomy = 'category' AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tr.object_id = $post->ID";
49
+
50
+ $cats = $wpdb->get_results($q);
51
+
52
+ foreach(($cats) as $cat) {
53
+ if (in_array($cat->term_id, $exclude) != false){
54
+ return;
55
+ }
56
+ }
57
+ }
58
+
59
+ if(!$post->ID){return;}
60
+ $now = current_time('mysql', 1);
61
+ $tags = wp_get_post_tags($post->ID);
62
+
63
+ //print_r($tags);
64
+
65
+ $taglist = "'" . $tags[0]->term_id. "'";
66
+
67
+ $tagcount = count($tags);
68
+ if ($tagcount > 1) {
69
+ for ($i = 1; $i <= $tagcount; $i++) {
70
+ $taglist = $taglist . ", '" . $tags[$i]->term_id . "'";
71
+ }
72
+ }
73
+
74
+ if ($limit) {
75
+ $limitclause = "LIMIT $limit";
76
+ } else {
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
+
84
+ $related_posts = $wpdb->get_results($q);
85
+ $output = "";
86
+
87
+ if (!$related_posts){
88
+
89
+ if(!$wp_no_rp || ($wp_no_rp == "popularity" && !function_exists('akpc_most_popular'))) $wp_no_rp = "text";
90
+
91
+ if($wp_no_rp == "text"){
92
+ if(!$wp_no_rp_text) $wp_no_rp_text= __("No Related Post",'wp_related_posts');
93
+ $output .= '<li>'.$wp_no_rp_text .'</li>';
94
+ } else{
95
+ if($wp_no_rp == "random"){
96
+ if(!$wp_no_rp_text) $wp_no_rp_text= __("Random Posts",'wp_related_posts');
97
+ $related_posts = wp_get_random_posts($limitclause);
98
+ } elseif($wp_no_rp == "commented"){
99
+ if(!$wp_no_rp_text) $wp_no_rp_text= __("Most Commented Posts",'wp_related_posts');
100
+ $related_posts = wp_get_most_commented_posts($limitclause);
101
+ } elseif($wp_no_rp == "popularity"){
102
+ if(!$wp_no_rp_text) $wp_no_rp_text= __("Most Popular Posts",'wp_related_posts');
103
+ $related_posts = wp_get_most_popular_posts($limitclause);
104
+ }else{
105
+ return __("Something wrong",'wp_related_posts');;
106
+ }
107
+ $wp_rp_title = $wp_no_rp_text;
108
+ }
109
+ }
110
+
111
+ foreach ($related_posts as $related_post ){
112
+ $output .= '<li>';
113
+
114
+ if ($show_date){
115
+ $dateformat = get_option('date_format');
116
+ $output .= mysql2date($dateformat, $related_post->post_date) . " -- ";
117
+ }
118
+
119
+ $output .= '<a href="'.get_permalink($related_post->ID).'" title="'.wptexturize($related_post->post_title).'">'.wptexturize($related_post->post_title).'';
120
+
121
+ if ($show_comments_count){
122
+ $output .= " (" . $related_post->comment_count . ")";
123
+ }
124
+
125
+ $output .= '</a></li>';
126
+ }
127
+
128
+ $output = '<ul class="related_post">' . $output . '</ul>';
129
+
130
+ if($wp_rp_title != '') $output = '<h3>'.$wp_rp_title .'</h3>'. $output;
131
+
132
+ return $output;
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
+ }
162
+
163
+ function wp23_related_posts() {
164
+ wp_related_posts();
165
+ }
166
+
167
+ function wp_related_posts_for_feed($content=""){
168
+ $wp_rp = get_option("wp_rp");
169
+ $wp_rp_rss = ($wp_rp["wp_rp_rss"] == 'yes') ? 1 : 0;
170
+ if ( (! is_feed()) || (! $wp_rp_rss)) return $content;
171
+
172
+ $output = wp_get_related_posts() ;
173
+ $content = $content . $output;
174
+
175
+ return $content;
176
+ }
177
+
178
+ add_filter('the_content', 'wp_related_posts_for_feed',1);
179
+
180
+ function wp_related_posts_auto($content=""){
181
+ $wp_rp = get_option("wp_rp");
182
+ $wp_rp_auto = ($wp_rp["wp_rp_auto"] == 'yes') ? 1 : 0;
183
+ if ( (! is_single()) || (! $wp_rp_auto)) return $content;
184
+
185
+ $output = wp_get_related_posts() ;
186
+ $content = $content . $output;
187
+
188
+ return $content;
189
+ }
190
+
191
+ add_filter('the_content', 'wp_related_posts_auto',99);
192
+
193
+ function wp_get_random_posts ($limitclause="") {
194
+ global $wpdb, $tableposts, $post;
195
+
196
+ $q = "SELECT ID, post_title, post_date, comment_count FROM $tableposts WHERE post_status = 'publish' AND post_type = 'post' AND ID != $post->ID ORDER BY RAND() $limitclause";
197
+ return $wpdb->get_results($q);
198
+ }
199
+
200
+ function wp_random_posts ($number = 10){
201
+ $limitclause="LIMIT " . $number;
202
+ $random_posts = wp_get_random_posts ($limitclause);
203
+
204
+ foreach ($random_posts as $random_post ){
205
+ $output .= '<li>';
206
+
207
+ $output .= '<a href="'.get_permalink($random_post->ID).'" title="'.wptexturize($random_post->post_title).'">'.wptexturize($random_post->post_title).'</a></li>';
208
+ }
209
+
210
+ $output = '<ul class="randome_post">' . $output . '</ul>';
211
+
212
+ echo $output;
213
+ }
214
+
215
+ function wp_get_most_commented_posts($limitclause="") {
216
+ global $wpdb;
217
+ $q = "SELECT ID, post_title, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC $limitclause";
218
+ return $wpdb->get_results($q);
219
+ }
220
+
221
+ function wp_most_commented_posts ($number = 10){
222
+ $limitclause="LIMIT " . $number;
223
+ $most_commented_posts = wp_get_most_commented_posts ($limitclause);
224
+
225
+ foreach ($most_commented_posts as $most_commented_post ){
226
+ $output .= '<li>';
227
+
228
+ $output .= '<a href="'.get_permalink($most_commented_post->ID).'" title="'.wptexturize($most_commented_post->post_title).'">'.wptexturize($most_commented_post->post_title).'</a></li>';
229
+ }
230
+
231
+ $output = '<ul class="most_commented_post">' . $output . '</ul>';
232
+
233
+ echo $output;
234
+ }
235
+
236
+ function wp_get_most_popular_posts ($limitclause="") {
237
+ global $wpdb, $table_prefix;
238
+
239
+ $q = $sql = "SELECT p.ID, p.post_title, p.post_date, p.comment_count FROM ". $table_prefix ."ak_popularity as akpc,".$table_prefix ."posts as p WHERE p.ID = akpc.post_id ORDER BY akpc.total DESC $limitclause";;
240
+ return $wpdb->get_results($q);
241
+ }
242
+
243
+ function wp_most_popular_posts ($number = 10){
244
+ $limitclause="LIMIT " . $number;
245
+ $most_popular_posts = wp_get_most_popular_posts ($limitclause);
246
+
247
+ foreach ($most_popular_posts as $most_popular_post ){
248
+ $output .= '<li>';
249
+
250
+ $output .= '<a href="'.get_permalink($most_popular_post->ID).'" title="'.wptexturize($most_popular_post->post_title).'">'.wptexturize($most_popular_post->post_title).'</a></li>';
251
+ }
252
+
253
+ $output = '<ul class="most_popular_post">' . $output . '</ul>';
254
+
255
+ echo $output;
256
+ }
257
+
258
+ add_action('admin_menu', 'wp_add_related_posts_options_page');
259
+
260
+ function wp_add_related_posts_options_page() {
261
+ if (function_exists('add_options_page')) {
262
+ add_options_page( __('WordPress Related Posts','wp_related_posts'), __('WordPress Related Posts','wp_related_posts'), 8, basename(__FILE__), 'wp_related_posts_options_subpanel');
263
+ }
264
+ }
265
+
266
+ function wp_related_posts_options_subpanel() {
267
+ if($_POST["wp_rp_Submit"]){
268
+ $message = "WordPress Related Posts Setting Updated";
269
+
270
+ $wp_rp_saved = get_option("wp_rp");
271
+
272
+ $wp_rp = array (
273
+ "wp_rp_title" => $_POST['wp_rp_title_option'],
274
+ "wp_no_rp" => $_POST['wp_no_rp_option'],
275
+ "wp_no_rp_text" => $_POST['wp_no_rp_text_option'],
276
+ "wp_rp_limit" => $_POST['wp_rp_limit_option'],
277
+ 'wp_rp_exclude' => $_POST['wp_rp_exclude_option'],
278
+ 'wp_rp_auto' => $_POST['wp_rp_auto_option'],
279
+ 'wp_rp_rss' => $_POST['wp_rp_rss_option'],
280
+ 'wp_rp_comments'=> $_POST['wp_rp_comments_option'],
281
+ 'wp_rp_date' => $_POST['wp_rp_date_option']
282
+ );
283
+
284
+ if ($wp_rp_saved != $wp_rp)
285
+ if(!update_option("wp_rp",$wp_rp))
286
+ $message = "Update Failed";
287
+
288
+ echo '<div id="message" class="updated fade"><p>'.$message.'.</p></div>';
289
+ }
290
+
291
+ $wp_rp = get_option("wp_rp");
292
+ ?>
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
@@ -2,20 +2,30 @@
2
  Contributors: denishua
3
  Tags: Related,Posts
4
  Donate link: http://fairyfish.net/donate/
5
- Requires at least: 2.3 beta 1
6
- Tested up to: 2.3
7
- Stable tag: trunk
8
 
9
- WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed.
10
 
11
  == Description ==
12
 
13
- <p>WordPress 2.3 Related Posts Plugin will generate a related posts via WordPress 2.3 tags, and add the related posts to feed.</p>
 
 
14
 
15
  == Installation ==
16
 
17
- 1. Upload the folder WP23RP to the `/wp-content/plugins/` directory
18
  1. Activate the plugin through the 'Plugins' menu in WordPress
19
- 1. Place `<?php wp23_related_posts(); ?>` in your templates
20
- 1. Navigate to Manage > Option > WP23 Related Posts to configure plugin output.
 
21
 
 
 
 
 
 
 
 
2
  Contributors: denishua
3
  Tags: Related,Posts
4
  Donate link: http://fairyfish.net/donate/
5
+ Requires at least: 2.3
6
+ Tested up to: 2.5
7
+ Stable tag: 0.8
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
 
19
+ 1. Upload the folder WPRP to the `/wp-content/plugins/` directory
20
  1. Activate the plugin through the 'Plugins' menu in WordPress
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
+
27
+ 1. Delete the old plugin folder `WP23RP`.
28
+ 1. Upload the folder WPRP to the `/wp-content/plugins/` directory
29
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
30
+ 1. Place `<?php wp_related_posts(); ?>` in your templates
31
+ 1. Navigate to Manage > Option > WordPress Related Posts to configure plugin output.
screenshot-1.png CHANGED
Binary file