WordPress Related Posts - Version 0.7

Version Description

Download this release

Release Info

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

Code changes from version 0.51 to 0.7

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,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WordPress Related Posts
4
+ Version: 0.7
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,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('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
+ $output = wp_get_related_posts() ;
138
+ echo $output;
139
+ }
140
+
141
+ function wp23_related_posts() {
142
+ wp_related_posts();
143
+ }
144
+
145
+ function wp_related_posts_for_feed($content=""){
146
+ $wp_rp = get_option("wp_rp");
147
+ $wp_rp_rss = ($wp_rp["wp_rp_rss"] == 'yes') ? 1 : 0;
148
+ if ( (! is_feed()) || (! $wp_rp_rss)) return $content;
149
+
150
+ $output = wp_get_related_posts() ;
151
+ $content = $content . $output;
152
+
153
+ return $content;
154
+ }
155
+
156
+ add_filter('the_content', 'wp_related_posts_for_feed',1);
157
+
158
+ function wp_related_posts_auto($content=""){
159
+ $wp_rp = get_option("wp_rp");
160
+ $wp_rp_auto = ($wp_rp["wp_rp_auto"] == 'yes') ? 1 : 0;
161
+ if ( (! is_single()) || (! $wp_rp_auto)) return $content;
162
+
163
+ $output = wp_get_related_posts() ;
164
+ $content = $content . $output;
165
+
166
+ return $content;
167
+ }
168
+
169
+ add_filter('the_content', 'wp_related_posts_auto',99);
170
+
171
+ function wp_get_random_posts ($limitclause="") {
172
+ global $wpdb, $tableposts, $post;
173
+
174
+ $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";
175
+ return $wpdb->get_results($q);
176
+ }
177
+
178
+ function wp_random_posts ($number = 10){
179
+ $limitclause="LIMIT " . $number;
180
+ $random_posts = wp_get_random_posts ($limitclause);
181
+
182
+ foreach ($random_posts as $random_post ){
183
+ $output .= '<li>';
184
+
185
+ $output .= '<a href="'.get_permalink($random_post->ID).'" title="'.wptexturize($random_post->post_title).'">'.wptexturize($random_post->post_title).'</a></li>';
186
+ }
187
+
188
+ $output = '<ul class="randome_post">' . $output . '</ul>';
189
+
190
+ echo $output;
191
+ }
192
+
193
+ function wp_get_most_commented_posts($limitclause="") {
194
+ global $wpdb;
195
+ $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";
196
+ return $wpdb->get_results($q);
197
+ }
198
+
199
+ function wp_most_commented_posts ($number = 10){
200
+ $limitclause="LIMIT " . $number;
201
+ $most_commented_posts = wp_get_most_commented_posts ($limitclause);
202
+
203
+ foreach ($most_commented_posts as $most_commented_post ){
204
+ $output .= '<li>';
205
+
206
+ $output .= '<a href="'.get_permalink($most_commented_post->ID).'" title="'.wptexturize($most_commented_post->post_title).'">'.wptexturize($most_commented_post->post_title).'</a></li>';
207
+ }
208
+
209
+ $output = '<ul class="most_commented_post">' . $output . '</ul>';
210
+
211
+ echo $output;
212
+ }
213
+
214
+ function wp_get_most_popular_posts ($limitclause="") {
215
+ global $wpdb, $table_prefix;
216
+
217
+ $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";;
218
+ return $wpdb->get_results($q);
219
+ }
220
+
221
+ function wp_most_popular_posts ($number = 10){
222
+ $limitclause="LIMIT " . $number;
223
+ $most_popular_posts = wp_get_most_popular_posts ($limitclause);
224
+
225
+ foreach ($most_popular_posts as $most_popular_post ){
226
+ $output .= '<li>';
227
+
228
+ $output .= '<a href="'.get_permalink($most_popular_post->ID).'" title="'.wptexturize($most_popular_post->post_title).'">'.wptexturize($most_popular_post->post_title).'</a></li>';
229
+ }
230
+
231
+ $output = '<ul class="most_popular_post">' . $output . '</ul>';
232
+
233
+ echo $output;
234
+ }
235
+
236
+ add_action('admin_menu', 'wp_add_related_posts_options_page');
237
+
238
+ function wp_add_related_posts_options_page() {
239
+ if (function_exists('add_options_page')) {
240
+ add_options_page( __('WordPress Related Posts','wp_related_posts'), __('WordPress Related Posts','wp_related_posts'), 8, basename(__FILE__), 'wp_related_posts_options_subpanel');
241
+ }
242
+ }
243
+
244
+ function wp_related_posts_options_subpanel() {
245
+ if($_POST["wp_rp_Submit"]){
246
+ $message = "WordPress Related Posts Setting Updated";
247
+
248
+ $wp_rp_saved = get_option("wp_rp");
249
+
250
+ $wp_rp = array (
251
+ "wp_rp_title" => $_POST['wp_rp_title_option'],
252
+ "wp_no_rp" => $_POST['wp_no_rp_option'],
253
+ "wp_no_rp_text" => $_POST['wp_no_rp_text_option'],
254
+ "wp_rp_limit" => $_POST['wp_rp_limit_option'],
255
+ 'wp_rp_exclude' => $_POST['wp_rp_exclude_option'],
256
+ 'wp_rp_auto' => $_POST['wp_rp_auto_option'],
257
+ 'wp_rp_rss' => $_POST['wp_rp_rss_option'],
258
+ 'wp_rp_comments'=> $_POST['wp_rp_comments_option'],
259
+ 'wp_rp_date' => $_POST['wp_rp_date_option']
260
+ );
261
+
262
+ if ($wp_rp_saved != $wp_rp)
263
+ if(!update_option("wp_rp",$wp_rp))
264
+ $message = "Update Failed";
265
+
266
+ echo '<div id="message" class="updated fade"><p>'.$message.'.</p></div>';
267
+ }
268
+
269
+ $wp_rp = get_option("wp_rp");
270
+ ?>
271
+ <div class="wrap">
272
+ <h2 id="write-post"><?php _e("Related Posts Options&hellip;",'wp_related_posts');?></h2>
273
+ <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>
274
+ <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo basename(__FILE__); ?>">
275
+ <h3><?php _e("Related Posts Preference",'wp_related_posts');?></h3>
276
+ <table class="form-table">
277
+ <tr>
278
+ <th><?php _e("Related Posts Title:",'wp_related_posts'); ?></th>
279
+ <td>
280
+ <input type="text" name="wp_rp_title_option" value="<?php echo $wp_rp["wp_rp_title"]; ?>" />
281
+ </td>
282
+ </tr>
283
+ <tr>
284
+ <th><?php _e("When No Related Posts, Dispaly:",'wp_related_posts'); ?></th>
285
+ <td>
286
+ <?php $wp_no_rp = $wp_rp["wp_no_rp"]; ?>
287
+ <select name="wp_no_rp_option" >
288
+ <option value="text" <?php if($wp_no_rp == 'text') echo 'selected' ?> ><?php _e("Text: 'No Related Posts'",'wp_related_posts'); ?></option>
289
+ <option value="random" <?php if($wp_no_rp == 'random') echo 'selected' ?>><?php _e("Random Posts",'wp_related_posts'); ?></option>
290
+ <option value="commented" <?php if($wp_no_rp == 'commented') echo 'selected' ?>><?php _e("Most Commented Posts",'wp_related_posts'); ?></option>
291
+ <?php if (function_exists('akpc_most_popular')){ ?>
292
+ <option value="popularity" <?php if($wp_no_rp == 'popularity') echo 'selected' ?>><?php _e("Most Popular Posts",'wp_related_posts'); ?></option>
293
+ <?php } ?>
294
+ </select>
295
+ </td>
296
+ </tr>
297
+ <tr>
298
+ <th><?php _e("No Related Post's Title or Text:",'wp_related_posts'); ?></th>
299
+ <td>
300
+ <input type="text" name="wp_no_rp_text_option" value="<?php echo $wp_rp["wp_no_rp_text"]; ?>" />
301
+ </td>
302
+ </tr>
303
+ <tr>
304
+ <th><?php _e("Limit:",'wp_related_posts');?></th>
305
+ <td>
306
+ <input type="text" name="wp_rp_limit_option" value="<?php echo $wp_rp["wp_rp_limit"]; ?>" />
307
+ </td>
308
+ </tr>
309
+ <tr>
310
+ <th><?php _e("Exclude(category IDs):",'wp_related_posts');?></th>
311
+ <td>
312
+ <input type="text" name="wp_rp_exclude_option" value="<?php echo $wp_rp["wp_rp_exclude"]; ?>" />
313
+ </td>
314
+ </tr>
315
+ <tr>
316
+ <th><?php _e("Other Setting:",'wp_related_posts');?></th>
317
+ <td>
318
+ <label>
319
+ <?php
320
+ if ( $wp_rp["wp_rp_auto"] == 'yes' ) {
321
+ echo '<input name="wp_rp_auto_option" type="checkbox" value="yes" checked>';
322
+ } else {
323
+ echo '<input name="wp_rp_auto_option" type="checkbox" value="yes">';
324
+ }
325
+ ?>
326
+ <?php _e("Auto Insert Related Posts",'wp_related_posts');?>
327
+ </label>
328
+ <br />
329
+ <label>
330
+ <?php
331
+ if ( $wp_rp["wp_rp_rss"] == 'yes' ) {
332
+ echo '<input name="wp_rp_rss_option" type="checkbox" value="yes" checked>';
333
+ } else {
334
+ echo '<input name="wp_rp_rss_option" type="checkbox" value="yes">';
335
+ }
336
+ ?>
337
+ <?php _e("Related Posts for RSS",'wp_related_posts');?>
338
+ </label>
339
+ <br />
340
+ <label>
341
+ <?php
342
+ if ( $wp_rp["wp_rp_comments"] == 'yes' ) {
343
+ echo '<input name="wp_rp_comments_option" type="checkbox" value="yes" checked>';
344
+ } else {
345
+ echo '<input name="wp_rp_comments_option" type="checkbox" value="yes">';
346
+ }
347
+ ?>
348
+ <?php _e("Display Comments Count",'wp_related_posts');?>
349
+ </label>
350
+ <br />
351
+ <label>
352
+ <?php
353
+ if ( $wp_rp["wp_rp_date"] == 'yes' ) {
354
+ echo '<input name="wp_rp_date_option" type="checkbox" value="yes" checked>';
355
+ } else {
356
+ echo '<input name="wp_rp_date_option" type="checkbox" value="yes">';
357
+ }
358
+ ?>
359
+ <?php _e("Display Post Date",'wp_related_posts');?>
360
+ </label>
361
+ <br />
362
+ </td>
363
+ </tr>
364
+ </table>
365
+
366
+ <p class="submit"><input type="submit" value="<?php _e("Update Preferences &raquo;",'wp_related_posts');?>" name="wp_rp_Submit" /></p>
367
+ </form>
368
+ </div>
369
+ <?php }?>
readme.txt CHANGED
@@ -2,20 +2,29 @@
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.7
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
 
16
  == Installation ==
17
 
18
+ 1. Upload the folder WPRP to the `/wp-content/plugins/` directory
19
  1. Activate the plugin through the 'Plugins' menu in WordPress
20
+ 1. Place `<?php wp_related_posts(); ?>` in your templates
21
+ 1. Navigate to Manage > Option > WordPress Related Posts to configure plugin output.
22
+
23
 
24
+ == Upgrade ==
25
+
26
+ 1. Delete the old plugin folder `WP23RP`.
27
+ 1. Upload the folder WPRP to the `/wp-content/plugins/` directory
28
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
29
+ 1. Place `<?php wp_related_posts(); ?>` in your templates
30
+ 1. Navigate to Manage > Option > WordPress Related Posts to configure plugin output.
screenshot-1.png CHANGED
Binary file