Version Description
Download this release
Release Info
Developer | mitchoyoshitaka |
Plugin | Yet Another Related Posts Plugin (YARPP) |
Version | 3.2b3 |
Comparing to | |
See all releases |
Code changes from version 3.2b2 to 3.2b3
- cache-postmeta.php +226 -0
- cache-tables.php +256 -0
- i/close.gif +0 -0
- i/spin.gif +0 -0
- includes.php +46 -36
- keywords.php +6 -24
- lang/yarpp-fa_IR.mo +0 -0
- lang/yarpp-fa_IR.po +609 -0
- lang/yarpp-pt_PT.mo +0 -0
- lang/yarpp-pt_PT.po +558 -0
- magic.php +67 -131
- options.php +61 -47
- readme.txt +20 -11
- services.php +7 -7
- template-builtin.php +3 -3
- template-functions.php +1 -1
- template-metabox.php +4 -3
- yarpp-templates/yarpp-template-example.php +1 -1
- yarpp-templates/yarpp-template-list.php +2 -2
- yarpp-templates/yarpp-template-random.php +1 -1
- yarpp-templates/yarpp-template-wpml.php +1 -1
- yarpp.php +18 -16
cache-postmeta.php
ADDED
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$yarpp_storage_class = 'YARPP_Cache_Postmeta';
|
4 |
+
|
5 |
+
define('YARPP_POSTMETA_TITLE_KEYWORDS_KEY','_yarpp_title_keywords');
|
6 |
+
define('YARPP_POSTMETA_BODY_KEYWORDS_KEY','_yarpp_body_keywords');
|
7 |
+
define('YARPP_POSTMETA_RELATED_KEY', '_yarpp_related');
|
8 |
+
define('YARPP_NO_RELATED', ':(');
|
9 |
+
|
10 |
+
class YARPP_Cache_Postmeta {
|
11 |
+
// variables used for lookup
|
12 |
+
var $related_postdata = array();
|
13 |
+
var $related_IDs = array();
|
14 |
+
var $name = "postmeta";
|
15 |
+
|
16 |
+
/**
|
17 |
+
* SETUP/STATUS
|
18 |
+
*/
|
19 |
+
function YARPP_Cache_Postmeta() {
|
20 |
+
$this->name = __($this->name, 'yarpp');
|
21 |
+
add_filter('posts_where',array(&$this,'where_filter'));
|
22 |
+
add_filter('posts_orderby',array(&$this,'orderby_filter'));
|
23 |
+
add_filter('posts_fields',array(&$this,'fields_filter'));
|
24 |
+
add_filter('posts_request',array(&$this,'demo_request_filter'));
|
25 |
+
add_filter('post_limits',array(&$this,'limit_filter'));
|
26 |
+
}
|
27 |
+
|
28 |
+
function is_enabled() {
|
29 |
+
return true; // always enabled.
|
30 |
+
}
|
31 |
+
|
32 |
+
function setup() {
|
33 |
+
}
|
34 |
+
|
35 |
+
function cache_status() {
|
36 |
+
global $wpdb;
|
37 |
+
return $wpdb->get_var("select (count(p.ID)-sum(m.meta_value IS NULL))/count(p.ID)
|
38 |
+
FROM `{$wpdb->posts}` as p
|
39 |
+
LEFT JOIN `{$wpdb->postmeta}` as m ON (p.ID = m.post_id and m.meta_key = '" . YARPP_POSTMETA_RELATED_KEY . "')
|
40 |
+
WHERE p.post_status = 'publish'");
|
41 |
+
}
|
42 |
+
|
43 |
+
function uncached($limit = 20, $offset = 0) {
|
44 |
+
global $wpdb;
|
45 |
+
return $wpdb->get_col("select SQL_CALC_FOUND_ROWS p.ID
|
46 |
+
FROM `{$wpdb->posts}` as p
|
47 |
+
LEFT JOIN `{$wpdb->postmeta}` as m ON (p.ID = m.post_id and m.meta_key = '" . YARPP_POSTMETA_RELATED_KEY . "')
|
48 |
+
WHERE p.post_status = 'publish' and m.meta_value IS NULL
|
49 |
+
LIMIT $limit OFFSET $offset");
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* MAGIC FILTERS
|
54 |
+
*/
|
55 |
+
function where_filter($arg) {
|
56 |
+
global $wpdb, $yarpp_time;
|
57 |
+
$threshold = yarpp_get_option('threshold');
|
58 |
+
if ($yarpp_time) {
|
59 |
+
// modify the where clause to use the related ID list.
|
60 |
+
if (!count($this->related_IDs))
|
61 |
+
$this->related_IDs = array(0);
|
62 |
+
$arg = preg_replace("!{$wpdb->posts}.ID = \d+!","{$wpdb->posts}.ID in (".join(',',$this->related_IDs).")",$arg);
|
63 |
+
|
64 |
+
// if we have "recent only" set, add an additional condition
|
65 |
+
if (yarpp_get_option("recent_only"))
|
66 |
+
$arg .= " and post_date > date_sub(now(), interval ".yarpp_get_option("recent_number")." ".yarpp_get_option("recent_units").") ";
|
67 |
+
}
|
68 |
+
return $arg;
|
69 |
+
}
|
70 |
+
|
71 |
+
function orderby_filter($arg) {
|
72 |
+
global $wpdb, $yarpp_time, $yarpp_score_override;
|
73 |
+
if ($yarpp_time and $yarpp_score_override)
|
74 |
+
return str_replace("$wpdb->posts.post_date","score",$arg);
|
75 |
+
return $arg;
|
76 |
+
}
|
77 |
+
|
78 |
+
function fields_filter($arg) {
|
79 |
+
global $wpdb, $yarpp_time, $wpdb;
|
80 |
+
if ($yarpp_time && is_array($this->related_postdata) && count($this->related_postdata)) {
|
81 |
+
$scores = array();
|
82 |
+
foreach ($this->related_postdata as $related_entry) {
|
83 |
+
$scores[] = " WHEN {$related_entry['ID']} THEN {$related_entry['score']}";
|
84 |
+
}
|
85 |
+
$arg .= ", CASE {$wpdb->posts}.ID" . join('',$scores) ." END as score";
|
86 |
+
}
|
87 |
+
return $arg;
|
88 |
+
}
|
89 |
+
|
90 |
+
function demo_request_filter($arg) {
|
91 |
+
global $wpdb, $yarpp_demo_time, $yarpp_limit;
|
92 |
+
if ($yarpp_demo_time) {
|
93 |
+
$wpdb->query("set @count = 0;");
|
94 |
+
return "SELECT SQL_CALC_FOUND_ROWS ID + $yarpp_limit as ID, post_author, post_date, post_date_gmt, '" . LOREMIPSUM . "' as post_content,
|
95 |
+
concat('".__('Example post ','yarpp')."',@count:=@count+1) as post_title, 0 as post_category, '' as post_excerpt, 'publish' as post_status, 'open' as comment_status, 'open' as ping_status, '' as post_password, concat('example-post-',@count) as post_name, '' as to_ping, '' as pinged, post_modified, post_modified_gmt, '' as post_content_filtered, 0 as post_parent, concat('PERMALINK',@count) as guid, 0 as menu_order, 'post' as post_type, '' as post_mime_type, 0 as comment_count, 'SCORE' as score
|
96 |
+
FROM $wpdb->posts
|
97 |
+
ORDER BY ID DESC LIMIT 0, $yarpp_limit";
|
98 |
+
}
|
99 |
+
return $arg;
|
100 |
+
}
|
101 |
+
|
102 |
+
function limit_filter($arg) {
|
103 |
+
global $wpdb, $yarpp_time, $yarpp_online_limit;
|
104 |
+
if ($yarpp_time and $yarpp_online_limit)
|
105 |
+
return " limit $yarpp_online_limit ";
|
106 |
+
return $arg;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* RELATEDNESS CACHE CONTROL
|
111 |
+
*/
|
112 |
+
function begin_yarpp_time($reference_ID) {
|
113 |
+
// get the related posts from postdata, and also construct the relate_IDs array
|
114 |
+
$this->related_postdata = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
|
115 |
+
if (is_array($this->related_postdata) && count($this->related_postdata))
|
116 |
+
$this->related_IDs = array_map(create_function('$x','return $x["ID"];'), $this->related_postdata);
|
117 |
+
}
|
118 |
+
|
119 |
+
function end_yarpp_time() {
|
120 |
+
$this->related_IDs = array();
|
121 |
+
$this->related_postdata = array();
|
122 |
+
}
|
123 |
+
|
124 |
+
function is_cached($reference_ID) {
|
125 |
+
// error_log('hit:' . print_r(debug_backtrace(), true));
|
126 |
+
return get_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, true) != false;
|
127 |
+
}
|
128 |
+
|
129 |
+
function clear($reference_ID) {
|
130 |
+
if (is_int($reference_ID))
|
131 |
+
$reference_ID = array($reference_ID);
|
132 |
+
// make sure that we have a non-trivial array
|
133 |
+
if (!is_array($reference_ID) || !count($reference_ID))
|
134 |
+
return;
|
135 |
+
// clear each cache
|
136 |
+
foreach($reference_ID as $id) {
|
137 |
+
delete_post_meta( $id, YARPP_POSTMETA_RELATED_KEY );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
function update($reference_ID, $types) {
|
142 |
+
global $wpdb, $yarpp_debug;
|
143 |
+
|
144 |
+
$original_related = $this->related($reference_ID);
|
145 |
+
// error_log('original:' . implode(':', $original_related));
|
146 |
+
|
147 |
+
$related = $wpdb->get_results(yarpp_sql($types,array(),true,$reference_ID), ARRAY_A);
|
148 |
+
// error_log('debug:' . print_r($related, true));
|
149 |
+
$new_related = array_map(create_function('$x','return $x["ID"];'), $related);
|
150 |
+
|
151 |
+
if (count($new_related)) {
|
152 |
+
// error_log('new:' . implode(':', $new_related));
|
153 |
+
update_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, $related);
|
154 |
+
if ($yarpp_debug) echo "<!--YARPP just set the cache for post $reference_ID-->";
|
155 |
+
|
156 |
+
// Clear the caches of any items which are no longer related or are newly related.
|
157 |
+
if (count($original_related)) {
|
158 |
+
$this->clear(array_diff($original_related, $new_related));
|
159 |
+
// error_log('clear:' . implode(':', array_diff($original_related, $new_related)));
|
160 |
+
$this->clear(array_diff($new_related, $original_related));
|
161 |
+
// error_log('clear:' . implode(':', array_diff($new_related, $original_related)));
|
162 |
+
}
|
163 |
+
} else {
|
164 |
+
update_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, YARPP_NO_RELATED);
|
165 |
+
// Clear the caches of those which are no longer related.
|
166 |
+
if (count($original_related)) {
|
167 |
+
$this->clear($original_related);
|
168 |
+
// error_log('clear:' . implode(':', $original_related));
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
function flush() {
|
174 |
+
global $wpdb;
|
175 |
+
return $wpdb->query("delete from `{$wpdb->postmeta}` where meta_key = '" . YARPP_POSTMETA_RELATED_KEY . "'");
|
176 |
+
}
|
177 |
+
|
178 |
+
function related($reference_ID = null, $related_ID = null) {
|
179 |
+
global $wpdb;
|
180 |
+
if (!is_null($reference_ID) && !is_null($related_ID)) {
|
181 |
+
$results = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
|
182 |
+
foreach($results as $result) {
|
183 |
+
if ($result['ID'] == $related_ID)
|
184 |
+
return true;
|
185 |
+
}
|
186 |
+
return false;
|
187 |
+
}
|
188 |
+
|
189 |
+
// return a list of ID's of "related" entries
|
190 |
+
if (!is_null($reference_ID)) {
|
191 |
+
$results = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
|
192 |
+
// error_log('debug:' . print_r($results, true));
|
193 |
+
if (!$results || $results == YARPP_NO_RELATED)
|
194 |
+
return array();
|
195 |
+
return array_map(create_function('$x','return $x["ID"];'), $results);
|
196 |
+
}
|
197 |
+
|
198 |
+
// return a list of entities which list this post as "related"
|
199 |
+
if (!is_null($related_ID)) {
|
200 |
+
return $wpdb->get_col("select post_id from `{$wpdb->postmeta}` where meta_key = '" . YARPP_POSTMETA_RELATED_KEY . "' and meta_value regexp 's:2:\"ID\";s:\d+:\"{$related_ID}\"'");
|
201 |
+
}
|
202 |
+
|
203 |
+
return false;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* KEYWORDS CACHE CONTROL
|
208 |
+
*/
|
209 |
+
function cache_keywords($ID) {
|
210 |
+
update_post_meta($ID, YARPP_POSTMETA_BODY_KEYWORDS_KEY, post_body_keywords($ID));
|
211 |
+
update_post_meta($ID, YARPP_POSTMETA_TITLE_KEYWORDS_KEY, post_title_keywords($ID));
|
212 |
+
}
|
213 |
+
|
214 |
+
function get_keywords($ID, $type='body') {
|
215 |
+
$key = $type == 'body' ? YARPP_POSTMETA_BODY_KEYWORDS_KEY : YARPP_POSTMETA_TITLE_KEYWORDS_KEY;
|
216 |
+
$out = get_post_meta($ID, $key, true);
|
217 |
+
|
218 |
+
// if empty, try caching them first
|
219 |
+
if ($out === false) {
|
220 |
+
yarpp_cache_keywords($ID);
|
221 |
+
$out = get_post_meta($ID, $key, true);
|
222 |
+
}
|
223 |
+
|
224 |
+
return $out;
|
225 |
+
}
|
226 |
+
}
|
cache-tables.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$yarpp_storage_class = 'YARPP_Cache_Tables';
|
4 |
+
|
5 |
+
class YARPP_Cache_Tables {
|
6 |
+
var $name = "custom tables";
|
7 |
+
|
8 |
+
/**
|
9 |
+
* SETUP/STATUS
|
10 |
+
*/
|
11 |
+
function YARPP_Cache_Tables() {
|
12 |
+
$this->name = __($this->name, 'yarpp');
|
13 |
+
add_filter('posts_join',array(&$this,'join_filter'));
|
14 |
+
add_filter('posts_where',array(&$this,'where_filter'));
|
15 |
+
add_filter('posts_orderby',array(&$this,'orderby_filter'));
|
16 |
+
add_filter('posts_fields',array(&$this,'fields_filter'));
|
17 |
+
add_filter('posts_request',array(&$this,'demo_request_filter'));
|
18 |
+
add_filter('post_limits',array(&$this,'limit_filter'));
|
19 |
+
}
|
20 |
+
|
21 |
+
function is_enabled() {
|
22 |
+
global $wpdb;
|
23 |
+
// now check for the cache tables
|
24 |
+
$tabledata = $wpdb->get_col("show tables");
|
25 |
+
if (array_search("{$wpdb->prefix}yarpp_related_cache",$tabledata) !== false &&
|
26 |
+
array_search("{$wpdb->prefix}yarpp_keyword_cache",$tabledata) !== false)
|
27 |
+
return true;
|
28 |
+
else
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
|
32 |
+
function setup() {
|
33 |
+
global $wpdb;
|
34 |
+
if (!$wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}yarpp_keyword_cache` (
|
35 |
+
`ID` bigint(20) unsigned NOT NULL default '0',
|
36 |
+
`body` text collate utf8_unicode_ci NOT NULL,
|
37 |
+
`title` text collate utf8_unicode_ci NOT NULL,
|
38 |
+
`date` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
39 |
+
PRIMARY KEY (`ID`)
|
40 |
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='YARPP''s keyword cache table';")) {
|
41 |
+
echo "<!--MySQL error on creating yarpp_keyword_cache table: ";
|
42 |
+
$wpdb->print_error();
|
43 |
+
echo "-->";
|
44 |
+
}
|
45 |
+
if (!$wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}yarpp_related_cache` (
|
46 |
+
`reference_ID` bigint(20) unsigned NOT NULL default '0',
|
47 |
+
`ID` bigint(20) unsigned NOT NULL default '0',
|
48 |
+
`score` float unsigned NOT NULL default '0',
|
49 |
+
`date` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
50 |
+
PRIMARY KEY ( `score` , `date` , `reference_ID` , `ID` )
|
51 |
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;")) {
|
52 |
+
echo "<!--MySQL error on creating yarpp_related_cache table: ";
|
53 |
+
$wpdb->print_error();
|
54 |
+
echo "-->";
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
function cache_status() {
|
59 |
+
global $wpdb;
|
60 |
+
return $wpdb->get_var("select (count(p.ID)-sum(c.ID IS NULL))/count(p.ID)
|
61 |
+
FROM `{$wpdb->posts}` as p
|
62 |
+
LEFT JOIN `{$wpdb->prefix}yarpp_related_cache` as c ON (p.ID = c.reference_ID)
|
63 |
+
WHERE p.post_status = 'publish' ");
|
64 |
+
}
|
65 |
+
|
66 |
+
function uncached($limit = 20, $offset = 0) {
|
67 |
+
global $wpdb;
|
68 |
+
return $wpdb->get_col("select SQL_CALC_FOUND_ROWS p.ID
|
69 |
+
FROM `{$wpdb->posts}` as p
|
70 |
+
LEFT JOIN `{$wpdb->prefix}yarpp_related_cache` as c ON (p.ID = c.reference_ID)
|
71 |
+
WHERE p.post_status = 'publish' and c.ID IS NULL
|
72 |
+
LIMIT $limit OFFSET $offset");
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* MAGIC FILTERS
|
77 |
+
*/
|
78 |
+
function join_filter($arg) {
|
79 |
+
global $wpdb, $yarpp_time;
|
80 |
+
if ($yarpp_time)
|
81 |
+
$arg .= " join {$wpdb->prefix}yarpp_related_cache as yarpp on {$wpdb->posts}.ID = yarpp.ID";
|
82 |
+
return $arg;
|
83 |
+
}
|
84 |
+
|
85 |
+
function where_filter($arg) {
|
86 |
+
global $wpdb, $yarpp_time;
|
87 |
+
$threshold = yarpp_get_option('threshold');
|
88 |
+
if ($yarpp_time) {
|
89 |
+
|
90 |
+
$arg = str_replace("$wpdb->posts.ID = ","yarpp.score >= $threshold and yarpp.reference_ID = ",$arg);
|
91 |
+
|
92 |
+
|
93 |
+
if (yarpp_get_option("recent_only"))
|
94 |
+
$arg .= " and post_date > date_sub(now(), interval ".yarpp_get_option("recent_number")." ".yarpp_get_option("recent_units").") ";
|
95 |
+
//echo "<!--YARPP TEST: $arg-->";
|
96 |
+
}
|
97 |
+
return $arg;
|
98 |
+
}
|
99 |
+
|
100 |
+
function orderby_filter($arg) {
|
101 |
+
global $wpdb, $yarpp_time, $yarpp_score_override;
|
102 |
+
if ($yarpp_time and $yarpp_score_override) {
|
103 |
+
$arg = str_replace("$wpdb->posts.post_date","yarpp.score",$arg);
|
104 |
+
}
|
105 |
+
return $arg;
|
106 |
+
}
|
107 |
+
|
108 |
+
function fields_filter($arg) {
|
109 |
+
global $wpdb, $yarpp_time;
|
110 |
+
if ($yarpp_time)
|
111 |
+
$arg .= ", yarpp.score";
|
112 |
+
return $arg;
|
113 |
+
}
|
114 |
+
|
115 |
+
function demo_request_filter($arg) {
|
116 |
+
global $wpdb, $yarpp_demo_time, $yarpp_limit;
|
117 |
+
if ($yarpp_demo_time) {
|
118 |
+
$wpdb->query("set @count = 0;");
|
119 |
+
$arg = "SELECT SQL_CALC_FOUND_ROWS ID + $yarpp_limit as ID, post_author, post_date, post_date_gmt, '" . LOREMIPSUM . "' as post_content,
|
120 |
+
concat('".__('Example post ','yarpp')."',@count:=@count+1) as post_title, 0 as post_category, '' as post_excerpt, 'publish' as post_status, 'open' as comment_status, 'open' as ping_status, '' as post_password, concat('example-post-',@count) as post_name, '' as to_ping, '' as pinged, post_modified, post_modified_gmt, '' as post_content_filtered, 0 as post_parent, concat('PERMALINK',@count) as guid, 0 as menu_order, 'post' as post_type, '' as post_mime_type, 0 as comment_count, 'SCORE' as score
|
121 |
+
FROM $wpdb->posts
|
122 |
+
ORDER BY ID DESC LIMIT 0, $yarpp_limit";
|
123 |
+
}
|
124 |
+
return $arg;
|
125 |
+
}
|
126 |
+
|
127 |
+
function limit_filter($arg) {
|
128 |
+
global $wpdb, $yarpp_time, $yarpp_online_limit;
|
129 |
+
if ($yarpp_time and $yarpp_online_limit) {
|
130 |
+
return " limit $yarpp_online_limit ";
|
131 |
+
}
|
132 |
+
return $arg;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* RELATEDNESS CACHE CONTROL
|
137 |
+
*/
|
138 |
+
function begin_yarpp_time() {
|
139 |
+
}
|
140 |
+
|
141 |
+
function end_yarpp_time() {
|
142 |
+
}
|
143 |
+
|
144 |
+
function is_cached($reference_ID) {
|
145 |
+
global $wpdb;
|
146 |
+
return $wpdb->get_var("select count(*) as count from {$wpdb->prefix}yarpp_related_cache where reference_ID = $reference_ID");
|
147 |
+
}
|
148 |
+
|
149 |
+
function clear($reference_ID) {
|
150 |
+
global $wpdb;
|
151 |
+
if (is_array($reference_ID) && count($reference_ID))
|
152 |
+
$wpdb->query("delete from {$wpdb->prefix}yarpp_related_cache where reference_ID in (".implode(',',$reference_ID).")");
|
153 |
+
else if (is_int($reference_ID))
|
154 |
+
$wpdb->query("delete from {$wpdb->prefix}yarpp_related_cache where reference_ID = {$reference_ID}");
|
155 |
+
}
|
156 |
+
|
157 |
+
function update($reference_ID, $types) {
|
158 |
+
global $wpdb, $yarpp_debug;
|
159 |
+
|
160 |
+
$original_related = $this->related($reference_ID);
|
161 |
+
//error_log('original:' . implode(':', $original_related));
|
162 |
+
|
163 |
+
// clear out the cruft
|
164 |
+
$this->clear($reference_ID);
|
165 |
+
|
166 |
+
$wpdb->query("insert into {$wpdb->prefix}yarpp_related_cache (reference_ID,ID,score) ".yarpp_sql($types,array(),true,$reference_ID)." on duplicate key update date = now()");
|
167 |
+
|
168 |
+
if ($wpdb->rows_affected) {
|
169 |
+
$new_related = $this->related($reference_ID);
|
170 |
+
//error_log('new:' . implode(':', $new_related));
|
171 |
+
if ($yarpp_debug) echo "<!--YARPP just set the cache for post $reference_ID-->";
|
172 |
+
|
173 |
+
// Clear the caches of any items which are no longer related or are newly related.
|
174 |
+
if (count($original_related)) {
|
175 |
+
$this->clear(array_diff($original_related, $new_related));
|
176 |
+
//error_log('clear:' . implode(':', array_diff($original_related, $new_related)));
|
177 |
+
$this->clear(array_diff($new_related, $original_related));
|
178 |
+
//error_log('clear:' . implode(':', array_diff($new_related, $original_related)));
|
179 |
+
}
|
180 |
+
} else {
|
181 |
+
$wpdb->query("insert into {$wpdb->prefix}yarpp_related_cache (reference_ID,ID,score) values ($reference_ID,0,0) on duplicate key update date = now()");
|
182 |
+
if (!$wpdb->rows_affected)
|
183 |
+
return false;
|
184 |
+
// Clear the caches of those which are no longer related.
|
185 |
+
if (count($original_related)) {
|
186 |
+
$this->clear($original_related);
|
187 |
+
//error_log('clear:' . implode(':', $original_related));
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
function flush() {
|
193 |
+
global $wpdb;
|
194 |
+
return $wpdb->query("truncate table `{$wpdb->prefix}yarpp_related_cache`");
|
195 |
+
}
|
196 |
+
|
197 |
+
function related($reference_ID = null, $related_ID = null) {
|
198 |
+
global $wpdb;
|
199 |
+
if (!is_null($reference_ID) && !is_null($related_ID)) {
|
200 |
+
$results = $wpdb->get_col("select ID from {$wpdb->prefix}yarpp_related_cache where reference_ID = $reference_ID and ID = $related_ID");
|
201 |
+
return count($results) > 0;
|
202 |
+
}
|
203 |
+
|
204 |
+
// return a list of ID's of "related" entries
|
205 |
+
if (!is_null($reference_ID)) {
|
206 |
+
return $wpdb->get_col("select distinct ID from {$wpdb->prefix}yarpp_related_cache where reference_ID = $reference_ID and ID != 0");
|
207 |
+
}
|
208 |
+
|
209 |
+
// return a list of entities which list this post as "related"
|
210 |
+
if (!is_null($related_ID)) {
|
211 |
+
return $wpdb->get_col("select distinct reference_ID from {$wpdb->prefix}yarpp_related_cache where ID = $related_ID");
|
212 |
+
}
|
213 |
+
|
214 |
+
return false;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* KEYWORDS CACHE CONTROL
|
219 |
+
*/
|
220 |
+
function cache_keywords($ID) {
|
221 |
+
global $wpdb;
|
222 |
+
$body_terms = post_body_keywords($ID);
|
223 |
+
$title_terms = post_title_keywords($ID);
|
224 |
+
/*
|
225 |
+
CREATE TABLE `wp_yarpp_keyword_cache` (
|
226 |
+
`ID` BIGINT( 20 ) UNSIGNED NOT NULL ,
|
227 |
+
`body` TEXT NOT NULL ,
|
228 |
+
`title` TEXT NOT NULL ,
|
229 |
+
`date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
|
230 |
+
PRIMARY KEY ( `ID` )
|
231 |
+
) ENGINE = MYISAM COMMENT = 'YARPP\'s keyword cache table'
|
232 |
+
*/
|
233 |
+
|
234 |
+
if (defined('DB_CHARSET') && DB_CHARSET) {
|
235 |
+
$wpdb->query('set names '.DB_CHARSET);
|
236 |
+
}
|
237 |
+
|
238 |
+
$wpdb->query("insert into {$wpdb->prefix}yarpp_keyword_cache (ID,body,title) values ($ID,'$body_terms ','$title_terms ') on duplicate key update date = now(), body = '$body_terms ', title = '$title_terms '");
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
function get_keywords($ID, $type='body') {
|
243 |
+
global $wpdb;
|
244 |
+
$out = $wpdb->get_var("select $type from {$wpdb->prefix}yarpp_keyword_cache where ID = $ID");
|
245 |
+
if ($out === false or $out == '') { // if empty, try caching them first.
|
246 |
+
$this->cache_keywords($ID);
|
247 |
+
$out = $wpdb->get_var("select $type from {$wpdb->prefix}yarpp_keyword_cache where ID = $ID");
|
248 |
+
}
|
249 |
+
if ($out === false or $out == '') { // if still empty... return false
|
250 |
+
//echo "<!--YARPP ERROR: couldn't select/create yarpp $type keywords for $ID-->";
|
251 |
+
return false;
|
252 |
+
} else {
|
253 |
+
return $out;
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
i/close.gif
DELETED
Binary file
|
i/spin.gif
DELETED
Binary file
|
includes.php
CHANGED
@@ -10,7 +10,7 @@ if ( !defined('WP_CONTENT_URL') )
|
|
10 |
if ( !defined('WP_CONTENT_DIR') )
|
11 |
define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
|
12 |
|
13 |
-
global $yarpp_value_options, $yarpp_binary_options;
|
14 |
// here's a list of all the options YARPP uses (except version), as well as their default values, sans the yarpp_ prefix, split up into binary options and value options. These arrays are used in updating settings (options.php) and other tasks.
|
15 |
$yarpp_value_options = array('threshold' => 5,
|
16 |
'limit' => 5,
|
@@ -56,10 +56,13 @@ $yarpp_binary_options = array('past_only' => true,
|
|
56 |
'rss_excerpt_display' => true,
|
57 |
'promote_yarpp' => false,
|
58 |
'rss_promote_yarpp' => false);
|
|
|
59 |
$yarpp_clear_cache_options = array('distags','discats','show_pass_post','recent_only','threshold','title','body','categories','tags');
|
60 |
|
61 |
function yarpp_enabled() {
|
62 |
-
global $wpdb;
|
|
|
|
|
63 |
$indexdata = $wpdb->get_results("show index from $wpdb->posts");
|
64 |
foreach ($indexdata as $index) {
|
65 |
if ($index->Key_name == 'yarpp_title')
|
@@ -75,7 +78,7 @@ function yarpp_reinforce() {
|
|
75 |
}
|
76 |
|
77 |
function yarpp_activate() {
|
78 |
-
global $yarpp_version, $wpdb, $yarpp_binary_options, $yarpp_value_options;
|
79 |
foreach (array_keys($yarpp_value_options) as $option) {
|
80 |
if (get_option("yarpp_$option") === false)
|
81 |
add_option("yarpp_$option",$yarpp_value_options[$option] . ' ');
|
@@ -84,17 +87,28 @@ function yarpp_activate() {
|
|
84 |
if (get_option("yarpp_$option") === false)
|
85 |
add_option("yarpp_$option",$yarpp_binary_options[$option]);
|
86 |
}
|
87 |
-
|
|
|
|
|
88 |
if (!$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)")) {
|
89 |
-
echo "<!--
|
90 |
$wpdb->print_error();
|
91 |
echo "-->";
|
92 |
}
|
|
|
|
|
|
|
|
|
93 |
if (!$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)")) {
|
94 |
echo "<!--".__('MySQL error on adding yarpp_content','yarpp').": ";
|
95 |
$wpdb->print_error();
|
96 |
echo "-->";
|
97 |
}
|
|
|
|
|
|
|
|
|
|
|
98 |
if (!yarpp_enabled())
|
99 |
return 0;
|
100 |
}
|
@@ -132,21 +146,22 @@ function yarpp_upgrade_check($inuse = false) {
|
|
132 |
yarpp_upgrade_one_five();
|
133 |
update_option('yarpp_version','1.5');
|
134 |
}
|
135 |
-
|
136 |
if (version_compare('3.2',get_option('yarpp_version')) > 0) {
|
137 |
// check for unnecessary cache tables
|
138 |
-
|
139 |
-
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . '
|
|
|
140 |
}
|
141 |
|
142 |
-
|
143 |
|
144 |
-
// just in case, try to add the index one more time.
|
145 |
if (!yarpp_enabled()) {
|
146 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
|
147 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)");
|
148 |
}
|
149 |
-
|
150 |
}
|
151 |
|
152 |
function yarpp_admin_menu() {
|
@@ -185,19 +200,19 @@ class YARPP_Widget extends WP_Widget {
|
|
185 |
function YARPP_Widget() {
|
186 |
parent::WP_Widget(false, $name = __('Related Posts (YARPP)','yarpp'));
|
187 |
}
|
188 |
-
|
189 |
function widget($args, $instance) {
|
190 |
global $post;
|
191 |
if (!is_single())
|
192 |
return;
|
193 |
-
|
194 |
extract($args);
|
195 |
-
|
196 |
$type = ($post->post_type == 'page' ? array('page') : array('post'));
|
197 |
if (yarpp_get_option('cross_relate'))
|
198 |
$type = array('post','page');
|
199 |
-
|
200 |
-
$title = apply_filters('widget_title', $instance['title']);
|
201 |
echo $before_widget;
|
202 |
if ( !$instance['use_template'] ) {
|
203 |
echo $before_title;
|
@@ -211,7 +226,7 @@ class YARPP_Widget extends WP_Widget {
|
|
211 |
echo yarpp_related($type,$instance,false,false,'widget');
|
212 |
echo $after_widget;
|
213 |
}
|
214 |
-
|
215 |
function update($new_instance, $old_instance) {
|
216 |
// this starts with default values.
|
217 |
$instance = array( 'promote_yarpp' => 0, 'use_template' => 0 );
|
@@ -228,8 +243,8 @@ class YARPP_Widget extends WP_Widget {
|
|
228 |
}
|
229 |
return $instance;
|
230 |
}
|
231 |
-
|
232 |
-
function form($instance) {
|
233 |
$title = esc_attr($instance['title']);
|
234 |
$template_file = $instance['template_file'];
|
235 |
?>
|
@@ -272,14 +287,14 @@ class YARPP_Widget extends WP_Widget {
|
|
272 |
|
273 |
function yarpp_default($content) {
|
274 |
global $wpdb, $post;
|
275 |
-
|
276 |
if (is_feed())
|
277 |
-
return yarpp_rss($content
|
278 |
-
|
279 |
$type = ($post->post_type == 'page' ? array('page') : array('post'));
|
280 |
if (yarpp_get_option('cross_relate'))
|
281 |
$type = array('post','page');
|
282 |
-
|
283 |
if (yarpp_get_option('auto_display') and is_single())
|
284 |
return $content.yarpp_related($type,array(),false,false,'website');
|
285 |
else
|
@@ -288,11 +303,11 @@ function yarpp_default($content) {
|
|
288 |
|
289 |
function yarpp_rss($content) {
|
290 |
global $wpdb, $post;
|
291 |
-
|
292 |
$type = ($post->post_type == 'page' ? array('page') : array('post'));
|
293 |
if (yarpp_get_option('cross_relate'))
|
294 |
$type = array('post','page');
|
295 |
-
|
296 |
if (yarpp_get_option('rss_display'))
|
297 |
return $content.yarpp_related($type,array(),false,false,'rss');
|
298 |
else
|
@@ -410,7 +425,8 @@ function yarpp_upgrade_one_five() {
|
|
410 |
unset($yarpp_version);
|
411 |
}
|
412 |
|
413 |
-
|
|
|
414 |
|
415 |
function yarpp_excerpt($content,$length) {
|
416 |
$content = strip_tags( (string) $content );
|
@@ -419,14 +435,14 @@ function yarpp_excerpt($content,$length) {
|
|
419 |
}
|
420 |
|
421 |
function yarpp_set_option($option,$value) {
|
422 |
-
global $yarpp_value_options, $yarpp_clear_cache_options;
|
423 |
if (array_search($option,array_keys($yarpp_value_options)) !== false)
|
424 |
update_option("yarpp_$option",$value.' ');
|
425 |
else
|
426 |
update_option("yarpp_$option",$value);
|
427 |
// new in 3.1: clear cache when updating certain settings.
|
428 |
-
if (array_search($option
|
429 |
-
|
430 |
}
|
431 |
|
432 |
function yarpp_get_option($option,$escapehtml = false) {
|
@@ -440,13 +456,7 @@ function yarpp_get_option($option,$escapehtml = false) {
|
|
440 |
return $return;
|
441 |
}
|
442 |
|
443 |
-
function
|
444 |
-
global $wpdb;
|
445 |
-
return $wpdb->query("delete from `{$wpdb->postmeta}` where meta_key = '" . YARPP_POSTMETA_RELATED_KEY . "'");
|
446 |
-
}
|
447 |
-
|
448 |
-
function yarpp_microtime_float()
|
449 |
-
{
|
450 |
list($usec, $sec) = explode(" ", microtime());
|
451 |
return ((float)$usec + (float)$sec);
|
452 |
}
|
10 |
if ( !defined('WP_CONTENT_DIR') )
|
11 |
define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
|
12 |
|
13 |
+
global $yarpp_value_options, $yarpp_binary_options, $yarpp_clear_cache_options;
|
14 |
// here's a list of all the options YARPP uses (except version), as well as their default values, sans the yarpp_ prefix, split up into binary options and value options. These arrays are used in updating settings (options.php) and other tasks.
|
15 |
$yarpp_value_options = array('threshold' => 5,
|
16 |
'limit' => 5,
|
56 |
'rss_excerpt_display' => true,
|
57 |
'promote_yarpp' => false,
|
58 |
'rss_promote_yarpp' => false);
|
59 |
+
// These are options which, when updated, will trigger a clearing of the cache
|
60 |
$yarpp_clear_cache_options = array('distags','discats','show_pass_post','recent_only','threshold','title','body','categories','tags');
|
61 |
|
62 |
function yarpp_enabled() {
|
63 |
+
global $wpdb, $yarpp_cache;
|
64 |
+
if ($yarpp_cache->is_enabled() === false)
|
65 |
+
return false;
|
66 |
$indexdata = $wpdb->get_results("show index from $wpdb->posts");
|
67 |
foreach ($indexdata as $index) {
|
68 |
if ($index->Key_name == 'yarpp_title')
|
78 |
}
|
79 |
|
80 |
function yarpp_activate() {
|
81 |
+
global $yarpp_version, $wpdb, $yarpp_binary_options, $yarpp_value_options, $yarpp_cache;
|
82 |
foreach (array_keys($yarpp_value_options) as $option) {
|
83 |
if (get_option("yarpp_$option") === false)
|
84 |
add_option("yarpp_$option",$yarpp_value_options[$option] . ' ');
|
87 |
if (get_option("yarpp_$option") === false)
|
88 |
add_option("yarpp_$option",$yarpp_binary_options[$option]);
|
89 |
}
|
90 |
+
|
91 |
+
$wpdb->get_results("show index from $wpdb->posts where Key_name='yarpp_title'");
|
92 |
+
if (!$wpdb->num_rows) {
|
93 |
if (!$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)")) {
|
94 |
+
echo "<!--MySQL error on adding yarpp_title: ";
|
95 |
$wpdb->print_error();
|
96 |
echo "-->";
|
97 |
}
|
98 |
+
}
|
99 |
+
|
100 |
+
$wpdb->get_results("show index from $wpdb->posts where Key_name='yarpp_content'");
|
101 |
+
if (!$wpdb->num_rows) {
|
102 |
if (!$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)")) {
|
103 |
echo "<!--".__('MySQL error on adding yarpp_content','yarpp').": ";
|
104 |
$wpdb->print_error();
|
105 |
echo "-->";
|
106 |
}
|
107 |
+
}
|
108 |
+
if (!yarpp_enabled()) {
|
109 |
+
// If we are still not enabled, run the cache abstraction's setup method.
|
110 |
+
$yarpp_cache->setup();
|
111 |
+
// If we're still not enabled, give up.
|
112 |
if (!yarpp_enabled())
|
113 |
return 0;
|
114 |
}
|
146 |
yarpp_upgrade_one_five();
|
147 |
update_option('yarpp_version','1.5');
|
148 |
}
|
149 |
+
|
150 |
if (version_compare('3.2',get_option('yarpp_version')) > 0) {
|
151 |
// check for unnecessary cache tables
|
152 |
+
// Currently commented out because this depends on the cache engine
|
153 |
+
// $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'yarpp_related_cache');
|
154 |
+
// $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'yarpp_keyword_cache');
|
155 |
}
|
156 |
|
157 |
+
update_option('yarpp_version',YARPP_VERSION);
|
158 |
|
159 |
+
// just in case, try to add the index one more time.
|
160 |
if (!yarpp_enabled()) {
|
161 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
|
162 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)");
|
163 |
}
|
164 |
+
|
165 |
}
|
166 |
|
167 |
function yarpp_admin_menu() {
|
200 |
function YARPP_Widget() {
|
201 |
parent::WP_Widget(false, $name = __('Related Posts (YARPP)','yarpp'));
|
202 |
}
|
203 |
+
|
204 |
function widget($args, $instance) {
|
205 |
global $post;
|
206 |
if (!is_single())
|
207 |
return;
|
208 |
+
|
209 |
extract($args);
|
210 |
+
|
211 |
$type = ($post->post_type == 'page' ? array('page') : array('post'));
|
212 |
if (yarpp_get_option('cross_relate'))
|
213 |
$type = array('post','page');
|
214 |
+
|
215 |
+
$title = apply_filters('widget_title', $instance['title']);
|
216 |
echo $before_widget;
|
217 |
if ( !$instance['use_template'] ) {
|
218 |
echo $before_title;
|
226 |
echo yarpp_related($type,$instance,false,false,'widget');
|
227 |
echo $after_widget;
|
228 |
}
|
229 |
+
|
230 |
function update($new_instance, $old_instance) {
|
231 |
// this starts with default values.
|
232 |
$instance = array( 'promote_yarpp' => 0, 'use_template' => 0 );
|
243 |
}
|
244 |
return $instance;
|
245 |
}
|
246 |
+
|
247 |
+
function form($instance) {
|
248 |
$title = esc_attr($instance['title']);
|
249 |
$template_file = $instance['template_file'];
|
250 |
?>
|
287 |
|
288 |
function yarpp_default($content) {
|
289 |
global $wpdb, $post;
|
290 |
+
|
291 |
if (is_feed())
|
292 |
+
return yarpp_rss($content);
|
293 |
+
|
294 |
$type = ($post->post_type == 'page' ? array('page') : array('post'));
|
295 |
if (yarpp_get_option('cross_relate'))
|
296 |
$type = array('post','page');
|
297 |
+
|
298 |
if (yarpp_get_option('auto_display') and is_single())
|
299 |
return $content.yarpp_related($type,array(),false,false,'website');
|
300 |
else
|
303 |
|
304 |
function yarpp_rss($content) {
|
305 |
global $wpdb, $post;
|
306 |
+
|
307 |
$type = ($post->post_type == 'page' ? array('page') : array('post'));
|
308 |
if (yarpp_get_option('cross_relate'))
|
309 |
$type = array('post','page');
|
310 |
+
|
311 |
if (yarpp_get_option('rss_display'))
|
312 |
return $content.yarpp_related($type,array(),false,false,'rss');
|
313 |
else
|
425 |
unset($yarpp_version);
|
426 |
}
|
427 |
|
428 |
+
if (!defined('LOREMIPSUM'))
|
429 |
+
define('LOREMIPSUM','Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras tincidunt justo a urna. Ut turpis. Phasellus convallis, odio sit amet cursus convallis, eros orci scelerisque velit, ut sodales neque nisl at ante. Suspendisse metus. Curabitur auctor pede quis mi. Pellentesque lorem justo, condimentum ac, dapibus sit amet, ornare et, erat. Quisque velit. Etiam sodales dui feugiat neque suscipit bibendum. Integer mattis. Nullam et ante non sem commodo malesuada. Pellentesque ultrices fermentum lectus. Maecenas hendrerit neque ac est. Fusce tortor mi, tristique sed, cursus at, pellentesque non, dui. Suspendisse potenti.');
|
430 |
|
431 |
function yarpp_excerpt($content,$length) {
|
432 |
$content = strip_tags( (string) $content );
|
435 |
}
|
436 |
|
437 |
function yarpp_set_option($option,$value) {
|
438 |
+
global $yarpp_value_options, $yarpp_clear_cache_options, $yarpp_cache;
|
439 |
if (array_search($option,array_keys($yarpp_value_options)) !== false)
|
440 |
update_option("yarpp_$option",$value.' ');
|
441 |
else
|
442 |
update_option("yarpp_$option",$value);
|
443 |
// new in 3.1: clear cache when updating certain settings.
|
444 |
+
if (array_search($option,$yarpp_clear_cache_options) !== false)
|
445 |
+
$yarpp_cache->flush();
|
446 |
}
|
447 |
|
448 |
function yarpp_get_option($option,$escapehtml = false) {
|
456 |
return $return;
|
457 |
}
|
458 |
|
459 |
+
function yarpp_microtime_float() {
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
list($usec, $sec) = explode(" ", microtime());
|
461 |
return ((float)$usec + (float)$sec);
|
462 |
}
|
keywords.php
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
|
3 |
function yarpp_extract_keywords($source,$max = 20) {
|
4 |
global $overusedwords;
|
5 |
-
|
6 |
if (function_exists('mb_split')) {
|
7 |
mb_regex_encoding(get_option('blog_charset'));
|
8 |
$wordlist = mb_split('\s*\W+\s*', mb_strtolower($source));
|
9 |
} else
|
10 |
-
$wordlist = preg_split('%\s*\W+\s*%', strtolower($source));
|
11 |
|
12 |
// Build an array of the unique words and number of times they occur.
|
13 |
$tokens = array_count_values($wordlist);
|
14 |
-
|
15 |
// Remove the stop words from the list.
|
16 |
foreach ($overusedwords as $word) {
|
17 |
unset($tokens[$word]);
|
@@ -23,11 +23,11 @@ function yarpp_extract_keywords($source,$max = 20) {
|
|
23 |
else
|
24 |
if (strlen($word) < 2) unset($tokens[$word]);
|
25 |
}
|
26 |
-
|
27 |
arsort($tokens, SORT_NUMERIC);
|
28 |
-
|
29 |
$types = array_keys($tokens);
|
30 |
-
|
31 |
if (count($types) > $max)
|
32 |
$types = array_slice($types, 0, $max);
|
33 |
return implode(' ', $types);
|
@@ -52,21 +52,3 @@ function post_body_keywords($ID,$max = 20) {
|
|
52 |
$content = html_entity_strip($content);
|
53 |
return yarpp_extract_keywords($content,$max);
|
54 |
}
|
55 |
-
|
56 |
-
function yarpp_cache_keywords($ID) {
|
57 |
-
update_post_meta($ID, YARPP_POSTMETA_BODY_KEYWORDS_KEY, post_body_keywords($ID));
|
58 |
-
update_post_meta($ID, YARPP_POSTMETA_TITLE_KEYWORDS_KEY, post_title_keywords($ID));
|
59 |
-
}
|
60 |
-
|
61 |
-
function yarpp_get_cached_keywords($ID, $type='body') {
|
62 |
-
$key = $type == 'body' ? YARPP_POSTMETA_BODY_KEYWORDS_KEY : YARPP_POSTMETA_TITLE_KEYWORDS_KEY;
|
63 |
-
$out = get_post_meta($ID, $key, true);
|
64 |
-
|
65 |
-
// if empty, try caching them first
|
66 |
-
if ($out === false) {
|
67 |
-
yarpp_cache_keywords($ID);
|
68 |
-
$out = get_post_meta($ID, $key, true);
|
69 |
-
}
|
70 |
-
|
71 |
-
return $out;
|
72 |
-
}
|
2 |
|
3 |
function yarpp_extract_keywords($source,$max = 20) {
|
4 |
global $overusedwords;
|
5 |
+
|
6 |
if (function_exists('mb_split')) {
|
7 |
mb_regex_encoding(get_option('blog_charset'));
|
8 |
$wordlist = mb_split('\s*\W+\s*', mb_strtolower($source));
|
9 |
} else
|
10 |
+
$wordlist = preg_split('%\s*\W+\s*%', strtolower($source));
|
11 |
|
12 |
// Build an array of the unique words and number of times they occur.
|
13 |
$tokens = array_count_values($wordlist);
|
14 |
+
|
15 |
// Remove the stop words from the list.
|
16 |
foreach ($overusedwords as $word) {
|
17 |
unset($tokens[$word]);
|
23 |
else
|
24 |
if (strlen($word) < 2) unset($tokens[$word]);
|
25 |
}
|
26 |
+
|
27 |
arsort($tokens, SORT_NUMERIC);
|
28 |
+
|
29 |
$types = array_keys($tokens);
|
30 |
+
|
31 |
if (count($types) > $max)
|
32 |
$types = array_slice($types, 0, $max);
|
33 |
return implode(' ', $types);
|
52 |
$content = html_entity_strip($content);
|
53 |
return yarpp_extract_keywords($content,$max);
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lang/yarpp-fa_IR.mo
ADDED
Binary file
|
lang/yarpp-fa_IR.po
ADDED
@@ -0,0 +1,609 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: YARPP in italiano\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: \n"
|
7 |
+
"Last-Translator: doctorbeta <doctorbeta@gmail.com>\n"
|
8 |
+
"Language-Team: Gianni Diurno | http://gidibao.net/ <gidibao@gmail.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-Language: Italian\n"
|
13 |
+
"X-Poedit-Country: ITALY\n"
|
14 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
+
"X-Poedit-KeywordsList: _e;__\n"
|
16 |
+
"X-Poedit-Basepath: .\n"
|
17 |
+
": \n"
|
18 |
+
"X-Poedit-SearchPath-0: .\n"
|
19 |
+
|
20 |
+
#: includes.php:94
|
21 |
+
msgid "MySQL error on adding yarpp_title"
|
22 |
+
msgstr "yarpp_title در افزودن MySQL مشکل "
|
23 |
+
|
24 |
+
#: includes.php:99
|
25 |
+
msgid "MySQL error on adding yarpp_content"
|
26 |
+
msgstr "yarpp_content در افزودن MySQL مشکل "
|
27 |
+
|
28 |
+
#: includes.php:185
|
29 |
+
msgid "<h3>An important message from YARPP:</h3><p>Thank you for upgrading to YARPP 2. YARPP 2.0 adds the much requested ability to limit related entry results by certain tags or categories. 2.0 also brings more fine tuned control of the magic algorithm, letting you specify how the algorithm should consider or not consider entry content, titles, tags, and categories. Make sure to adjust the new settings to your liking and perhaps readjust your threshold.</p><p>For more information, check out the <a href=\"http://mitcho.com/code/yarpp/\">YARPP documentation</a>. (This message will not be displayed again.)</p>"
|
30 |
+
msgstr "<h3>یک پیام مهم از YARPP:</h3><p>با تشکر از شما به خاطر به هنگام سازی به نسخه YARPP 2."
|
31 |
+
|
32 |
+
#: includes.php:224
|
33 |
+
#: yarpp.php:31
|
34 |
+
msgid "Related Posts"
|
35 |
+
msgstr "پست های مرتبط"
|
36 |
+
|
37 |
+
#: includes.php:229
|
38 |
+
msgid "YARPP"
|
39 |
+
msgstr "YARPP"
|
40 |
+
|
41 |
+
#: options.php:35
|
42 |
+
#, php-format
|
43 |
+
msgid "YARPP's \"consider titles\" and \"consider bodies\" relatedness criteria require your <code>%s</code> table to use the <a href='http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html'>MyISAM storage engine</a>, but the table seems to be using the <code>%s</code> engine. These two options have been disabled."
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: options.php:37
|
47 |
+
#, php-format
|
48 |
+
msgid "To restore these features, please update your <code>%s</code> table by executing the following SQL directive: <code>ALTER TABLE `%s` ENGINE = MyISAM;</code> . No data will be erased by altering the table's engine, although there are performance implications."
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#: options.php:39
|
52 |
+
#, php-format
|
53 |
+
msgid "If, despite this check, you are sure that <code>%s</code> is using the MyISAM engine, press this magic button:"
|
54 |
+
msgstr "اگر فکر می کنید که<code>%s</code> از MyISAM استفاده می کند، روی این تکمه کلیک کنید"
|
55 |
+
|
56 |
+
#: options.php:42
|
57 |
+
msgid "Trust me. Let me use MyISAM features."
|
58 |
+
msgstr " استفاده کنم MyISAM به من اطمینان کم. اجازه بده از ویژگیهای "
|
59 |
+
|
60 |
+
#: options.php:65
|
61 |
+
msgid "The YARPP database had an error but has been fixed."
|
62 |
+
msgstr " با یک اشکال مواجه شده که ترمیم شد YARPP پایگاه داده"
|
63 |
+
|
64 |
+
#: options.php:67
|
65 |
+
msgid "The YARPP database has an error which could not be fixed."
|
66 |
+
msgstr " با یک اشکال مواجه شده که قابل ترمیم نیست YARPP پایگاه داده "
|
67 |
+
|
68 |
+
#: options.php:150
|
69 |
+
msgid "word"
|
70 |
+
msgstr "واژه"
|
71 |
+
|
72 |
+
#: options.php:151
|
73 |
+
msgid "tag"
|
74 |
+
msgstr "برچسب"
|
75 |
+
|
76 |
+
#: options.php:152
|
77 |
+
msgid "category"
|
78 |
+
msgstr "دسته"
|
79 |
+
|
80 |
+
#: options.php:156
|
81 |
+
#: options.php:173
|
82 |
+
#: options.php:185
|
83 |
+
msgid "do not consider"
|
84 |
+
msgstr "درنظر گرفته نشود"
|
85 |
+
|
86 |
+
#: options.php:157
|
87 |
+
#: options.php:174
|
88 |
+
#: options.php:187
|
89 |
+
msgid "consider"
|
90 |
+
msgstr "درنظر بگیر"
|
91 |
+
|
92 |
+
#: options.php:159
|
93 |
+
#: options.php:189
|
94 |
+
#, php-format
|
95 |
+
msgid "require at least one %s in common"
|
96 |
+
msgstr "حداقل یک %s لازم است"
|
97 |
+
|
98 |
+
#: options.php:161
|
99 |
+
#: options.php:191
|
100 |
+
#, php-format
|
101 |
+
msgid "require more than one %s in common"
|
102 |
+
msgstr "بیش از یک %s لازم است"
|
103 |
+
|
104 |
+
#: options.php:175
|
105 |
+
msgid "consider with extra weight"
|
106 |
+
msgstr "بسیارمهم در نظر گرفته شود"
|
107 |
+
|
108 |
+
#: options.php:203
|
109 |
+
msgid "Yet Another Related Posts Plugin version history (RSS 2.0)"
|
110 |
+
msgstr " (RSS 2.0) تاریخچه تغییرات افزونه سایر پست های مرتبط"
|
111 |
+
|
112 |
+
#: options.php:273
|
113 |
+
msgid "Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal"
|
114 |
+
msgstr "کمک مالی به mitcho برای این افزونه از طریق PayPal"
|
115 |
+
|
116 |
+
#: options.php:257
|
117 |
+
msgid "Yet Another Related Posts Plugin Options"
|
118 |
+
msgstr "تـنظیمات افزونه YARPP"
|
119 |
+
|
120 |
+
#: options.php:280
|
121 |
+
msgid "\"The Pool\""
|
122 |
+
msgstr "\"مخزن\""
|
123 |
+
|
124 |
+
#: options.php:281
|
125 |
+
msgid "\"The Pool\" refers to the pool of posts and pages that are candidates for display as related to the current entry."
|
126 |
+
msgstr "مخزن شامل پست ها و صفحاتی است که برای موضوع فعلی میتوانند به عنوان پست مرتبط نشان داده شود"
|
127 |
+
|
128 |
+
#: options.php:286
|
129 |
+
msgid "Disallow by category:"
|
130 |
+
msgstr "از کدام دسته ها صرفنظر شود؟"
|
131 |
+
|
132 |
+
#: options.php:288
|
133 |
+
msgid "Disallow by tag:"
|
134 |
+
msgstr "از کدام برچسب ها صرفنظر شود؟"
|
135 |
+
|
136 |
+
#: options.php:290
|
137 |
+
msgid "Show password protected posts?"
|
138 |
+
msgstr "پست های رمزدار نمایش داده شوند؟"
|
139 |
+
|
140 |
+
#: options.php:291
|
141 |
+
msgid "Show only previous posts?"
|
142 |
+
msgstr "فقط پست های قبلی نمایش داده شود؟"
|
143 |
+
|
144 |
+
#: options.php:308
|
145 |
+
msgid "\"Relatedness\" options"
|
146 |
+
msgstr "\"میزان ارتباط\" تنظیمات"
|
147 |
+
|
148 |
+
#: options.php:310
|
149 |
+
#, php-format
|
150 |
+
msgid "YARPP is different than the <a href=\"http://wasabi.pbwiki.com/Related%20Entries\">previous plugins it is based on</a> as it limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>."
|
151 |
+
msgstr "YARPPبا افزونه زیر متفاوت است <a href=\"http://wasabi.pbwiki.com/Related%20Entries\">precedenti plugin</a>."
|
152 |
+
|
153 |
+
#: options.php:315
|
154 |
+
msgid "Match threshold:"
|
155 |
+
msgstr "حداقل تطبیق:"
|
156 |
+
|
157 |
+
#: options.php:316
|
158 |
+
msgid "Titles: "
|
159 |
+
msgstr "عنوان ها:"
|
160 |
+
|
161 |
+
#: options.php:318
|
162 |
+
msgid "Bodies: "
|
163 |
+
msgstr "محتواها:"
|
164 |
+
|
165 |
+
#: options.php:320
|
166 |
+
msgid "Tags: "
|
167 |
+
msgstr "برچسب ها:"
|
168 |
+
|
169 |
+
#: options.php:322
|
170 |
+
msgid "Categories: "
|
171 |
+
msgstr "دسته ها:"
|
172 |
+
|
173 |
+
#: options.php:324
|
174 |
+
msgid "Cross-relate posts and pages?"
|
175 |
+
msgstr "ارتباط متقابل پست و صفحات؟"
|
176 |
+
|
177 |
+
#: options.php:324
|
178 |
+
msgid "When the \"Cross-relate posts and pages\" option is selected, the <code>related_posts()</code>, <code>related_pages()</code>, and <code>related_entries()</code> all will give the same output, returning both related pages and posts."
|
179 |
+
msgstr "وقتی که گزینه \"ارتباط متقابل پست و صفحات\" انتخاب می شود, خروجی <code>related_posts()</code>, <code>related_pages()</code>, و <code>related_entries()</code> یکسان است و همصفحات مرتبط نمایش داده می شوند و هم پست های مرتبط."
|
180 |
+
|
181 |
+
#: options.php:403
|
182 |
+
msgid "Display options <small>for your website</small>"
|
183 |
+
msgstr "نمایش تنظیمات <small>برای وب سایت شما</small>"
|
184 |
+
|
185 |
+
#: magic.php:322
|
186 |
+
#: options.php:460
|
187 |
+
#: options.php:523
|
188 |
+
msgid "Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>."
|
189 |
+
msgstr "سازنده سایر پست های مرتبط <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts</a>."
|
190 |
+
|
191 |
+
#: options.php:407
|
192 |
+
msgid "Automatically display related posts?"
|
193 |
+
msgstr "نمایش خودکار پست های مرتبط؟"
|
194 |
+
|
195 |
+
#: options.php:407
|
196 |
+
msgid "This option automatically displays related posts right after the content on single entry pages. If this option is off, you will need to manually insert <code>related_posts()</code> or variants (<code>related_pages()</code> and <code>related_entries()</code>) into your theme files."
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
#: options.php:408
|
200 |
+
msgid "Website display code example"
|
201 |
+
msgstr "الگوی نمایش کد وب سایت به صورت زیر است:"
|
202 |
+
|
203 |
+
#: options.php:408
|
204 |
+
#: options.php:473
|
205 |
+
msgid "(Update options to reload.)"
|
206 |
+
msgstr "(تنظیمات را برای فعال سازی به هنگام کنید.)"
|
207 |
+
|
208 |
+
#: options.php:411
|
209 |
+
#: options.php:475
|
210 |
+
msgid "Maximum number of related posts:"
|
211 |
+
msgstr "حداکثر تعداد پست های مرتبط"
|
212 |
+
|
213 |
+
#: options.php:424
|
214 |
+
msgid "Before / after related entries:"
|
215 |
+
msgstr "قبل / بعد از موضوعات مرتبط:"
|
216 |
+
|
217 |
+
#: options.php:425
|
218 |
+
#: options.php:430
|
219 |
+
#: options.php:439
|
220 |
+
#: options.php:489
|
221 |
+
#: options.php:494
|
222 |
+
#: options.php:503
|
223 |
+
msgid "For example:"
|
224 |
+
msgstr "مثلا:"
|
225 |
+
|
226 |
+
#: options.php:429
|
227 |
+
#: options.php:493
|
228 |
+
msgid "Before / after each related entry:"
|
229 |
+
msgstr "قبل / بعد از هر موضوع مرتبط"
|
230 |
+
|
231 |
+
#: options.php:433
|
232 |
+
#: options.php:497
|
233 |
+
msgid "Show excerpt?"
|
234 |
+
msgstr "چکیده ها را نمایش بده؟"
|
235 |
+
|
236 |
+
#: options.php:434
|
237 |
+
#: options.php:498
|
238 |
+
msgid "Excerpt length (No. of words):"
|
239 |
+
msgstr "طول چکیده (تعداد واژه ها):"
|
240 |
+
|
241 |
+
#: options.php:438
|
242 |
+
msgid "Before / after (Excerpt):"
|
243 |
+
msgstr "قبل / بعد (چکیده):"
|
244 |
+
|
245 |
+
#: options.php:444
|
246 |
+
#: options.php:508
|
247 |
+
msgid "Order results:"
|
248 |
+
msgstr "ترتیب نتایج:"
|
249 |
+
|
250 |
+
#: options.php:446
|
251 |
+
#: options.php:510
|
252 |
+
msgid "score (high relevance to low)"
|
253 |
+
msgstr "امتیاز (از بیشترین ارتباط به کمتریت ارتباط)"
|
254 |
+
|
255 |
+
#: options.php:447
|
256 |
+
#: options.php:511
|
257 |
+
msgid "score (low relevance to high)"
|
258 |
+
msgstr "امتیاز (از کمترین ارتباط به بیشترین ارتباط)"
|
259 |
+
|
260 |
+
#: options.php:448
|
261 |
+
#: options.php:512
|
262 |
+
msgid "date (new to old)"
|
263 |
+
msgstr "تاریخ (جدید به قدیم)"
|
264 |
+
|
265 |
+
#: options.php:449
|
266 |
+
#: options.php:513
|
267 |
+
msgid "date (old to new)"
|
268 |
+
msgstr "تاریخ (قدیم به جدید)"
|
269 |
+
|
270 |
+
#: options.php:450
|
271 |
+
#: options.php:514
|
272 |
+
msgid "title (alphabetical)"
|
273 |
+
msgstr "عنوان (به ترتیب الفبا)"
|
274 |
+
|
275 |
+
#: options.php:451
|
276 |
+
#: options.php:515
|
277 |
+
msgid "title (reverse alphabetical)"
|
278 |
+
msgstr "عنوان (برعکس ترتیب الفبا)"
|
279 |
+
|
280 |
+
#: options.php:456
|
281 |
+
#: options.php:520
|
282 |
+
msgid "Default display if no results:"
|
283 |
+
msgstr "در صورت عدم وجود نتیجه این را نشان بده:"
|
284 |
+
|
285 |
+
#: options.php:458
|
286 |
+
#: options.php:522
|
287 |
+
msgid "Help promote Yet Another Related Posts Plugin?"
|
288 |
+
msgstr "کمک به ترقی این افزونه ؟"
|
289 |
+
|
290 |
+
#: options.php:460
|
291 |
+
#: options.php:523
|
292 |
+
#, php-format
|
293 |
+
msgid "This option will add the code %s. Try turning it on, updating your options, and see the code in the code example to the right. These links and donations are greatly appreciated."
|
294 |
+
msgstr "این گزینه کد %s را اضافه می کند. با روشن کردن آن می توانید کد را در سمت راست ملاحظه کنید."
|
295 |
+
|
296 |
+
#: options.php:466
|
297 |
+
msgid "Display options <small>for RSS</small>"
|
298 |
+
msgstr "نمایش تنظیمات برای <small>آر اس اس</small>"
|
299 |
+
|
300 |
+
#: options.php:471
|
301 |
+
msgid "Display related posts in feeds?"
|
302 |
+
msgstr "نمایش پست های مرتبط در خوراک سایت"
|
303 |
+
|
304 |
+
#: options.php:472
|
305 |
+
msgid "Display related posts in the descriptions?"
|
306 |
+
msgstr "نمایش پست های مرتبط در توضیحات؟"
|
307 |
+
|
308 |
+
#: options.php:472
|
309 |
+
msgid "This option displays the related posts in the RSS description fields, not just the content. If your feeds are set up to only display excerpts, however, only the description field is used, so this option is required for any display at all."
|
310 |
+
msgstr "این گزینه، پست های مرتبط را در محل توضیحات آر اس اس (نه تنها محتوا) به نمایش در می آورد. اگر خوراک را به صورتی تنظیم کنید که فقط چکیده را نشان دهد، تنها قسمت توضیحات مورد استفاده قرار می گیرد."
|
311 |
+
|
312 |
+
#: options.php:473
|
313 |
+
msgid "RSS display code example"
|
314 |
+
msgstr "نمونه کد آر اس اس نمایش داده شده"
|
315 |
+
|
316 |
+
#: options.php:488
|
317 |
+
msgid "Before / after related entries display:"
|
318 |
+
msgstr "نمایش قبل/ بعد از موضوعات مرتبط:"
|
319 |
+
|
320 |
+
#: options.php:502
|
321 |
+
msgid "Before / after (excerpt):"
|
322 |
+
msgstr "قبل/ بعد از (چکیده):"
|
323 |
+
|
324 |
+
#: template-builtin.php:35
|
325 |
+
#, php-format
|
326 |
+
msgid "%f is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors."
|
327 |
+
msgstr "%f امتیاز تطبیق بین پست فعلی و پست مرتبط به آن است. شما این پیغام را دریافت کردید زیرا به عنوان مدیر وارد وردپرس شده اید"
|
328 |
+
|
329 |
+
#: includes.php:197
|
330 |
+
msgid "Related Posts (YARPP)"
|
331 |
+
msgstr "Related Posts (YARPP)"
|
332 |
+
|
333 |
+
#: options.php:26
|
334 |
+
msgid "The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria."
|
335 |
+
msgstr ""
|
336 |
+
|
337 |
+
#: options.php:310
|
338 |
+
#: options.php:324
|
339 |
+
#: options.php:407
|
340 |
+
#: options.php:412
|
341 |
+
#: options.php:459
|
342 |
+
#: options.php:471
|
343 |
+
#: options.php:472
|
344 |
+
#: options.php:476
|
345 |
+
#: options.php:522
|
346 |
+
#: options.php:533
|
347 |
+
msgid "more>"
|
348 |
+
msgstr "بیشتر>"
|
349 |
+
|
350 |
+
#: options.php:128
|
351 |
+
msgid "Options saved!"
|
352 |
+
msgstr "تنظیمات ذخیره شد!"
|
353 |
+
|
354 |
+
#: options.php:609
|
355 |
+
msgid "Do you really want to reset your configuration?"
|
356 |
+
msgstr "آیا واقعا می خواهید تنظیمات را به پیش فرض برگردانید؟"
|
357 |
+
|
358 |
+
#: options.php:608
|
359 |
+
msgid "Update options"
|
360 |
+
msgstr "ذخیره تنظیمات"
|
361 |
+
|
362 |
+
#: options.php:310
|
363 |
+
msgid "The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshhold, take a look at some post's related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site."
|
364 |
+
msgstr "هر چه حداقل تطبیق کمتر شود، نتیجه حساس تر و تعداد پست های مرتبط کمتر می شود. مقدار پیش فرض آن 5 است. برای اینکه مقدار مطلوب آن را بیابید به امتیاز تطبیق برخی از پست ها نگاهی بیاندازید."
|
365 |
+
|
366 |
+
#: options.php:609
|
367 |
+
msgid "Reset options"
|
368 |
+
msgstr "تنظیمات از نو"
|
369 |
+
|
370 |
+
#: magic.php:71
|
371 |
+
msgid "Example post "
|
372 |
+
msgstr "پست نمونه:"
|
373 |
+
|
374 |
+
#: template-metabox.php:12
|
375 |
+
msgid "These are the related entries for this entry. Updating this post may change these related posts."
|
376 |
+
msgstr "مطالب مرتبط با این موضوع به شرح زیر است. در صورتی که این پست رابه روز کنید،ممکن است این مطالب مرتبط تغییر کنند."
|
377 |
+
|
378 |
+
#: template-metabox.php:25
|
379 |
+
msgid "Whether all of these related entries are actually displayed and how they are displayed depends on your YARPP display options."
|
380 |
+
msgstr "از طریق تنظیمات YARPP شما می توانیدمشخص کنید که نحوه نمایش پست های مرتبط چگونه باشد."
|
381 |
+
|
382 |
+
#: includes.php:26
|
383 |
+
#: includes.php:37
|
384 |
+
#: template-metabox.php:27
|
385 |
+
msgid "No related posts."
|
386 |
+
msgstr "بدون پست مرتبط."
|
387 |
+
|
388 |
+
#: options.php:83
|
389 |
+
#: options.php:86
|
390 |
+
#: options.php:129
|
391 |
+
#: options.php:532
|
392 |
+
msgid "Related posts cache status"
|
393 |
+
msgstr "وضعیت ذخیره سازی پست های مرتبط"
|
394 |
+
|
395 |
+
#: options.php:83
|
396 |
+
msgid "Your related posts cache is incomplete. Please build your cache from the <A>related posts status pane</a>."
|
397 |
+
msgstr "صفحه ذخیره (cache) پست های شما تکمیل نشده است. لطفا آن را <A>نوار وضعیت پست های مرتبط</a> از دوباره بسازید."
|
398 |
+
|
399 |
+
#: options.php:86
|
400 |
+
msgid "Your related posts cache is empty. Please build your cache from the <A>related posts status pane</a>."
|
401 |
+
msgstr "cache پست های مرتبط شما خالی است. لطفا آن را از <A>نوار وضعیت پست های مرتبط</a>دوباره بسازید."
|
402 |
+
|
403 |
+
#: options.php:130
|
404 |
+
msgid "If you updated the \"pool\" options or \"relatedness\" options displayed, please rebuild your cache now from the <A>related posts status pane</a>."
|
405 |
+
msgstr "اگر تنظیمات \"pool\" یا \"pool\" را تغییر داده اید، لطفا cache را از طریق <A>related posts status pane</a>.دوباره بسازید "
|
406 |
+
|
407 |
+
#: options.php:275
|
408 |
+
msgid "by <a href=\"http://mitcho.com/code/\">mitcho (Michael 芳貴 Erlewine)</a>"
|
409 |
+
msgstr "توسط <a href=\"http://mitcho.com/code/\">mitcho</a>"
|
410 |
+
|
411 |
+
#: options.php:275
|
412 |
+
msgid "Follow <a href=\"http://twitter.com/yarpp/\">Yet Another Related Posts Plugin on Twitter</a>"
|
413 |
+
msgstr "دنبال کردن <a href=\"http://twitter.com/yarpp/\">افزونه در توییتر</a>"
|
414 |
+
|
415 |
+
#: options.php:296
|
416 |
+
msgid "day(s)"
|
417 |
+
msgstr "روز"
|
418 |
+
|
419 |
+
#: options.php:297
|
420 |
+
msgid "week(s)"
|
421 |
+
msgstr "هفته"
|
422 |
+
|
423 |
+
#: options.php:298
|
424 |
+
msgid "month(s)"
|
425 |
+
msgstr "ماه"
|
426 |
+
|
427 |
+
#: options.php:300
|
428 |
+
msgid "Show only posts from the past NUMBER UNITS"
|
429 |
+
msgstr "نمایش پست ها از NUMBER UNITS پیش"
|
430 |
+
|
431 |
+
#: options.php:390
|
432 |
+
msgid "There is a new beta (VERSION) of Yet Another Related Posts Plugin. You can <A>download it here</a> at your own risk."
|
433 |
+
msgstr "نسخه بتای جدید این افزونه در دسترس است. در صورتی که مایلید می توانید آن را <A>از اینجا دریافت کنید</a> و با مسئولیت خود از آن استفاده کنید"
|
434 |
+
|
435 |
+
#: options.php:392
|
436 |
+
msgid "There is a new version (VERSION) of Yet Another Related Posts Plugin available! You can <A>download it here</a>."
|
437 |
+
msgstr "نسخه جدید افزونه در دسترس است! می توانید آن را <A>از اینجا دریافت کنید</a>"
|
438 |
+
|
439 |
+
#: options.php:412
|
440 |
+
#: options.php:476
|
441 |
+
msgid "Display using a custom template file"
|
442 |
+
msgstr "نمایش به صورت قالب دلخواه شما"
|
443 |
+
|
444 |
+
#: options.php:414
|
445 |
+
#: options.php:478
|
446 |
+
msgid "Template file:"
|
447 |
+
msgstr "پرونده قالب:"
|
448 |
+
|
449 |
+
#: options.php:471
|
450 |
+
msgid "This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed."
|
451 |
+
msgstr "این گزینه، پست های مرتبط رادر آخر خوراک های آر اس اس و اتم شما نمایش می دهد. هیچ نیازی به تغییر قالب نیست."
|
452 |
+
|
453 |
+
#: options.php:529
|
454 |
+
msgid "Advanced"
|
455 |
+
msgstr "پیشرفته"
|
456 |
+
|
457 |
+
#: options.php:532
|
458 |
+
msgid "Show cache status"
|
459 |
+
msgstr "نمایش وضعیت ذخیره سازی"
|
460 |
+
|
461 |
+
#: options.php:533
|
462 |
+
msgid "When the cache is incomplete, compute related posts on the fly?"
|
463 |
+
msgstr "تا وقتی ذخیره سازی تکمیل نشده، محاسبات پست های مرتبط به صورت مستقیم انجام شود"
|
464 |
+
|
465 |
+
#: options.php:564
|
466 |
+
msgid "'MIN minute(s) and SEC second(s) remaining'"
|
467 |
+
msgstr "'MINدقیقه و SEC ثانیه باقی مانده'"
|
468 |
+
|
469 |
+
#: options.php:566
|
470 |
+
msgid "'SEC second(s) remaining'"
|
471 |
+
msgstr "'SEC ثانیه باقیماندهi'"
|
472 |
+
|
473 |
+
#: options.php:570
|
474 |
+
msgid "Your related posts cache is now complete."
|
475 |
+
msgstr "ذخیره سازی پست های مرتبط شما به تکمیل شد. "
|
476 |
+
|
477 |
+
#: options.php:570
|
478 |
+
msgid "The SQL queries took SEC seconds."
|
479 |
+
msgstr "محاسبات SQL SEC ثانیه طول کشید"
|
480 |
+
|
481 |
+
#: options.php:577
|
482 |
+
msgid "There was an error while constructing the related posts for TITLE"
|
483 |
+
msgstr "هنگام ایجاد پست های مرتبط برای عنوان مشکلی به وجود آمد."
|
484 |
+
|
485 |
+
#: options.php:595
|
486 |
+
msgid "Your related posts cache is PERCENT% complete."
|
487 |
+
msgstr "ذخیره سازی پست های مرتبط شما PERCENT% تکمیل شده است."
|
488 |
+
|
489 |
+
#: options.php:601
|
490 |
+
msgid "starting..."
|
491 |
+
msgstr "در حال شروع..."
|
492 |
+
|
493 |
+
#: includes.php:110
|
494 |
+
msgid "MySQL error on creating yarpp_keyword_cache table"
|
495 |
+
msgstr "مشکل MySQL در ایجادجدول yarpp_keyword_cache رخ داد"
|
496 |
+
|
497 |
+
#: includes.php:121
|
498 |
+
msgid "MySQL error on creating yarpp_related_cache table"
|
499 |
+
msgstr "مشکل MySQL در ایجادجدول yarpp_related_cache رخ داد"
|
500 |
+
|
501 |
+
#: services.php:59
|
502 |
+
msgid "You cannot rebuild the YARPP cache."
|
503 |
+
msgstr "شما نمی توانید دوباره ذخیره سازی کنید."
|
504 |
+
|
505 |
+
#: options.php:10
|
506 |
+
msgid "Please move the YARPP template files into your theme to complete installation. Simply move the sample template files (currently in <code>wp-content/plugins/yet-another-related-posts-plugin/yarpp-templates/</code>) to the <code>TEMPLATEPATH</code> directory."
|
507 |
+
msgstr "لطفا پرونده های قالب افزونه را برای تکمیل نصب به پوشه قالب کنونی وبلاگتان منتقل کنید. پرونده های موجود در (<code>wp-content/plugins/yet-another-related-posts-plugin/yarpp-templates/</code>) رابه <code>TEMPLATEPATH</code> انتقال دهید.<code "
|
508 |
+
|
509 |
+
#: options.php:15
|
510 |
+
msgid "No YARPP template files were found in your theme (<code>TEMPLATEPATH</code>) so the templating feature has been turned off."
|
511 |
+
msgstr "چون هیچی قالبی برای افزونه در (<code>TEMPLATEPATH</code>) یافت نشد ویژگی ایجاد قالب غیرفعال شد."
|
512 |
+
|
513 |
+
#: options.php:412
|
514 |
+
#: options.php:476
|
515 |
+
#: options.php:529
|
516 |
+
msgid "NEW!"
|
517 |
+
msgstr "جدید!"
|
518 |
+
|
519 |
+
#: options.php:412
|
520 |
+
#: options.php:476
|
521 |
+
msgid "This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP."
|
522 |
+
msgstr "این امکان پیشرفته به شما اختیار کامل جهت شخصی سازی محل نمایش پست های مرتبط را می دهد."
|
523 |
+
|
524 |
+
#: includes.php:24
|
525 |
+
#: includes.php:35
|
526 |
+
msgid "Related posts:"
|
527 |
+
msgstr "پست های مرتبط:"
|
528 |
+
|
529 |
+
#: options.php:68
|
530 |
+
msgid "Please try <A>manual SQL setup</a>."
|
531 |
+
msgstr "لطفا سعی کنید <A>manual SQL setup</a>."
|
532 |
+
|
533 |
+
#: options.php:425
|
534 |
+
#: options.php:430
|
535 |
+
#: options.php:439
|
536 |
+
#: options.php:489
|
537 |
+
#: options.php:494
|
538 |
+
#: options.php:503
|
539 |
+
msgid " or "
|
540 |
+
msgstr "یا"
|
541 |
+
|
542 |
+
#: options.php:534
|
543 |
+
msgid "If a displayed post's related posts are not cached and this option is on, YARPP will compute them on the fly.<br />If this option is off and a post's related posts have not been cached, it will display as if it has no related posts."
|
544 |
+
msgstr "تا وقتی ذخیره سازی تکمیل نشده و این گزینه روشن باشد، محاسبات پست های مرتبط به صورت مستقیم انجام شود<br /> اگر این گزینه خاموش باشدو هنوز ذخیره سازی تکمیل نشده باشد، همان چیزی نمایش داده می شود که انگار هیچ پست مرتبطی وجود ندارد."
|
545 |
+
|
546 |
+
#: options.php:579
|
547 |
+
#: options.php:585
|
548 |
+
msgid "Constructing the related posts timed out."
|
549 |
+
msgstr "در حال ایجاد زمان انقضای پست ها"
|
550 |
+
|
551 |
+
#: options.php:582
|
552 |
+
#: options.php:587
|
553 |
+
msgid "Try to continue..."
|
554 |
+
msgstr "برای ادامه تلاش کنید..."
|
555 |
+
|
556 |
+
#~ msgid "Edit Catalog Entry"
|
557 |
+
#~ msgstr "modifica elenco articoli"
|
558 |
+
|
559 |
+
#~ msgid "close"
|
560 |
+
#~ msgstr "chiudi"
|
561 |
+
|
562 |
+
#~ msgid "You do not have the permission to write the file '%s'."
|
563 |
+
#~ msgstr "Non hai i permessi per la scrittura del file '%s'."
|
564 |
+
|
565 |
+
#~ msgid ""
|
566 |
+
#~ "by <a href=\"http://mitcho.com/code/\">mitcho (Michael 芳貴 Erlewine)</a> "
|
567 |
+
#~ "and based on the fabulous work of <a href=\"http://peter.mapledesign.co."
|
568 |
+
#~ "uk/weblog/archives/wordpress-related-posts-plugin\">Peter Bower</a>, <a "
|
569 |
+
#~ "href=\"http://wasabi.pbwiki.com/Related%20Entries\">Alexander Malov & "
|
570 |
+
#~ "Mike Lu</a>."
|
571 |
+
#~ msgstr ""
|
572 |
+
#~ "Il Team: <a href=\"http://mitcho.com/code/\">mitcho (Michael 芳貴 "
|
573 |
+
#~ "Erlewine)</a> ha sviluppato questo plugin grazie al favoloso lavoro di <a "
|
574 |
+
#~ "href=\"http://peter.mapledesign.co.uk/weblog/archives/wordpress-related-"
|
575 |
+
#~ "posts-plugin\">Peter Bower</a> e <a href=\"http://wasabi.pbwiki.com/"
|
576 |
+
#~ "Related%20Entries\">Alexander Malov & Mike Lu</a>. Traduzione "
|
577 |
+
#~ "italiana a cura di <a href=\"http://gidibao.net/\">Gianni Diurno</a>."
|
578 |
+
|
579 |
+
#~ msgid "PERMALINK"
|
580 |
+
#~ msgstr "PERMALINK"
|
581 |
+
|
582 |
+
#~ msgid "RELATED TITLE"
|
583 |
+
#~ msgstr "TITOLO CORRELATO"
|
584 |
+
|
585 |
+
#~ msgid ""
|
586 |
+
#~ "The higher the match threshold, the more restrictive, and you get less "
|
587 |
+
#~ "related posts overall. The default match threshold is 5. If you want to "
|
588 |
+
#~ "find an appropriate match threshhold, I recommend you turn on the \"show "
|
589 |
+
#~ "admins the match scores\" setting below. That way, you can see what kinds "
|
590 |
+
#~ "of related posts are being picked up and with what kind of match scores, "
|
591 |
+
#~ "and determine an appropriate threshold for your site."
|
592 |
+
#~ msgstr ""
|
593 |
+
#~ "Je höher Sie den Wert \"Relevanz\" setzen, desto restriktiver arbeitet "
|
594 |
+
#~ "YARPP. Der Standardwert liegt bei 5. Wenn gar keine oder zuwenige Artikel "
|
595 |
+
#~ "angezeigt werden, setzen Sie ihn auf 3.5 oder gar 1 herunter. Für die "
|
596 |
+
#~ "Feinabstimmung aktivieren Sie die Option \"Administratoren den Wert der "
|
597 |
+
#~ "Relevanz anzeigen\" und stimmen den Wert auf Ihre Anforderungen ab."
|
598 |
+
|
599 |
+
#~ msgid "Show admins (user level > 8) the match scores?"
|
600 |
+
#~ msgstr "Administratoren (User Level > 8) den Wert der Relevanz anzeigen?"
|
601 |
+
|
602 |
+
#~ msgid ""
|
603 |
+
#~ "With this option on, each related entry's total 'match score' (all above "
|
604 |
+
#~ "the threshold, set above) are displayed after each entry title, <em>if "
|
605 |
+
#~ "you are an administrator and logged in.</em> Even if you see these "
|
606 |
+
#~ "values, your visitors will not."
|
607 |
+
#~ msgstr ""
|
608 |
+
#~ "Wenn aktiviert, sehen nur eingeloggte Administratoren (nicht die "
|
609 |
+
#~ "Besucher!) neben jeder Beitragsüberschrift den Übereinstimmungswert."
|
lang/yarpp-pt_PT.mo
ADDED
Binary file
|
lang/yarpp-pt_PT.po
ADDED
@@ -0,0 +1,558 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: YARPP_PT\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date:\n"
|
6 |
+
"PO-Revision-Date: \n"
|
7 |
+
"Last-Translator: Stefan Mueller <stefan.mueller@gmail.com>\n"
|
8 |
+
"Language-Team: Stefan Mueller <stefan.mueller@gmail.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-Language: Portuguese\n"
|
13 |
+
"X-Poedit-Country: Portugal\n"
|
14 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
+
"X-Poedit-KeywordsList: _e;__\n"
|
16 |
+
"X-Poedit-Basepath: .\n"
|
17 |
+
": \n"
|
18 |
+
"X-Poedit-SearchPath-0: .\n"
|
19 |
+
|
20 |
+
#: includes.php:94
|
21 |
+
msgid "MySQL error on adding yarpp_title"
|
22 |
+
msgstr "MySQL-Erro ao adicionar \"yarpp_title\""
|
23 |
+
|
24 |
+
#: includes.php:99
|
25 |
+
msgid "MySQL error on adding yarpp_content"
|
26 |
+
msgstr "MySQL-Erro ao adicionar \"yarpp_content\""
|
27 |
+
|
28 |
+
#: includes.php:185
|
29 |
+
msgid "<h3>An important message from YARPP:</h3><p>Thank you for upgrading to YARPP 2. YARPP 2.0 adds the much requested ability to limit related entry results by certain tags or categories. 2.0 also brings more fine tuned control of the magic algorithm, letting you specify how the algorithm should consider or not consider entry content, titles, tags, and categories. Make sure to adjust the new settings to your liking and perhaps readjust your threshold.</p><p>For more information, check out the <a href=\"http://mitcho.com/code/yarpp/\">YARPP documentation</a>. (This message will not be displayed again.)</p>"
|
30 |
+
msgstr "<h3>Mensagem de YARPP</h3><p>Obrigado por actualizar para o YARPP 2. Esta vers�o inclui melhorias no algoritmo m�gico, permite-lhe configurar op��es na quantifica��o das v�rias palavras-chave ou categoria, tem em considera��o as op��es da utiliza��o de determinadas regras de exclus�o e permite-lhe determinar a for�a das vari�veis \"Conte�do\", \"Sobret�tulo\", \"Palavras-chave\" und \"Categorias\". Para mais informa��es, consulte <a href=\"http://mitcho.com/code/yarpp/\">Documenta��o YARPP </a>.</p><p>Esta mensagem nunca mais aparecer�!</p>"
|
31 |
+
|
32 |
+
#: includes.php:197
|
33 |
+
#: includes.php:197
|
34 |
+
msgid "Related Posts (YARPP)"
|
35 |
+
msgstr "Contribui��es parecidas (YARPP)"
|
36 |
+
|
37 |
+
#: includes.php:224
|
38 |
+
#: yarpp.php:31
|
39 |
+
#: yarpp.php:31
|
40 |
+
msgid "Related Posts"
|
41 |
+
msgstr "Contribui��es parecidas"
|
42 |
+
|
43 |
+
#: includes.php:229
|
44 |
+
msgid "YARPP"
|
45 |
+
msgstr "YARPP"
|
46 |
+
|
47 |
+
#: template-builtin.php:35
|
48 |
+
#, php-format
|
49 |
+
msgid "%f is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors."
|
50 |
+
msgstr "%f � a concord�ncia determinada pelo YARPP entre este artigo e o artigo parecido (Valor de relev�ncia). Consegue ver este artigo porque est� a utilizar uma conta de administrador da WordPress. Visitantes normais n�o o v�em."
|
51 |
+
|
52 |
+
#: magic.php:322
|
53 |
+
#: options.php:458
|
54 |
+
#: options.php:521
|
55 |
+
msgid "Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>."
|
56 |
+
msgstr "Artigos parecidos fornecidos por <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>."
|
57 |
+
|
58 |
+
#: options.php:26
|
59 |
+
msgid "The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria."
|
60 |
+
msgstr "O MyISAM-Check foi suspenso. Pode agora utilizar \"consider titles\" e \"consider bodies\" como crit�rio de relev�ncia."
|
61 |
+
|
62 |
+
#: options.php:35
|
63 |
+
#, php-format
|
64 |
+
msgid "YARPP's \"consider titles\" and \"consider bodies\" relatedness criteria require your <code>%s</code> table to use the <a href='http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html'>MyISAM storage engine</a>, but the table seems to be using the <code>%s</code> engine. These two options have been disabled."
|
65 |
+
msgstr "YARPPs \"consider titles\" und \"consider bodies\" Os crit�rios \"consider titles\" und \"consider bodies\" de relev�ncia da YARPP requerem que a sua tabela <code>%s</code> utilize a <a href='http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html'>MyISAM Storage Engine</a>, mas a tabela parece utilizar a <code>%s</code>-Engine. As duas op��es foram desactivadas."
|
66 |
+
|
67 |
+
#: options.php:37
|
68 |
+
#, php-format
|
69 |
+
msgid "To restore these features, please update your <code>%s</code> table by executing the following SQL directive: <code>ALTER TABLE `%s` ENGINE = MyISAM;</code> . No data will be erased by altering the table's engine, although there are performance implications."
|
70 |
+
msgstr "Para reactivar esta fun��o, execute o c�digo <code>%s</code> com o comando SQL: <code>ALTER TABLE `%s` ENGINE = MyISAM;</code>."
|
71 |
+
|
72 |
+
#: options.php:39
|
73 |
+
#, php-format
|
74 |
+
msgid "If, despite this check, you are sure that <code>%s</code> is using the MyISAM engine, press this magic button:"
|
75 |
+
msgstr "Se, mesmo depois desta verifica��o, tiver a certeza de que <code>%s</code> utiliza a MyISAM-Engine, clique no bot�o m�gico:"
|
76 |
+
|
77 |
+
#: options.php:42
|
78 |
+
msgid "Trust me. Let me use MyISAM features."
|
79 |
+
msgstr "Acredite em mim. Deixe-me usar as MyISAM-Features."
|
80 |
+
|
81 |
+
#: options.php:65
|
82 |
+
msgid "The YARPP database had an error but has been fixed."
|
83 |
+
msgstr "Ocorreu um erro na base de dados da YARPP que pode contudo ser corrigido."
|
84 |
+
|
85 |
+
#: options.php:67
|
86 |
+
msgid "The YARPP database has an error which could not be fixed."
|
87 |
+
msgstr "Ocorreu um erro na base de dados da YARPP que n�o pode ser corrigido."
|
88 |
+
|
89 |
+
#: options.php:154
|
90 |
+
#: options.php:171
|
91 |
+
#: options.php:183
|
92 |
+
msgid "do not consider"
|
93 |
+
msgstr ""n�o ter em conta""
|
94 |
+
|
95 |
+
#: options.php:155
|
96 |
+
#: options.php:172
|
97 |
+
#: options.php:185
|
98 |
+
msgid "consider"
|
99 |
+
msgstr "ter em conta"
|
100 |
+
|
101 |
+
#: options.php:173
|
102 |
+
msgid "consider with extra weight"
|
103 |
+
msgstr "ter especialmente em conta"
|
104 |
+
|
105 |
+
#: options.php:201
|
106 |
+
msgid "Yet Another Related Posts Plugin version history (RSS 2.0)"
|
107 |
+
msgstr "Hist�rico da vers�o YARPP (RSS 2.0)"
|
108 |
+
|
109 |
+
#: options.php:271
|
110 |
+
#: options.php:271
|
111 |
+
msgid "Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal"
|
112 |
+
msgstr "Fazer uma doa��o via PayPal a mitcho (Michael Yoshitaka Erlewine) pelo desenvolvimento do plugin"
|
113 |
+
|
114 |
+
#: options.php:255
|
115 |
+
msgid "Yet Another Related Posts Plugin Options"
|
116 |
+
msgstr "Op��es da YARPP"
|
117 |
+
|
118 |
+
#: options.php:278
|
119 |
+
msgid "\"The Pool\""
|
120 |
+
msgstr "\"Pool\""
|
121 |
+
|
122 |
+
#: options.php:279
|
123 |
+
msgid "\"The Pool\" refers to the pool of posts and pages that are candidates for display as related to the current entry."
|
124 |
+
msgstr "O plugin tem em conta todos os artigos e p�ginas que s�o mencionados (ou n�o exclu�dos) neste \"Pool\"."
|
125 |
+
|
126 |
+
#: options.php:284
|
127 |
+
msgid "Disallow by category:"
|
128 |
+
msgstr "Excluir categorias:"
|
129 |
+
|
130 |
+
#: options.php:286
|
131 |
+
msgid "Disallow by tag:"
|
132 |
+
msgstr "Excluir etiquetas:"
|
133 |
+
|
134 |
+
#: options.php:288
|
135 |
+
msgid "Show password protected posts?"
|
136 |
+
msgstr "Inserir palavra-chave para mostrar artigos protegidos?"
|
137 |
+
|
138 |
+
#: options.php:289
|
139 |
+
msgid "Show only previous posts?"
|
140 |
+
msgstr "Ter em conta apenas artigos passados?"
|
141 |
+
|
142 |
+
#: options.php:306
|
143 |
+
msgid "\"Relatedness\" options"
|
144 |
+
msgstr "Op��es de parecen�a"
|
145 |
+
|
146 |
+
#: options.php:308
|
147 |
+
#, php-format
|
148 |
+
msgid "YARPP is different than the <a href=\"http://wasabi.pbwiki.com/Related%20Entries\">previous plugins it is based on</a> as it limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>."
|
149 |
+
msgstr "YA YARPP funciona de um modo um pouco diferente do que [a href=\"http://wasabi.pbwiki.com/Related%20Entries\"]outros plugins de funcionalidade semelhante[/a]: A YARPP tem em conta n�o s� a quantidade de contribui��es por si inserida, como tamb�m o valor \"Relev�ncia\"."
|
150 |
+
|
151 |
+
#: options.php:308
|
152 |
+
#: options.php:322
|
153 |
+
#: options.php:405
|
154 |
+
#: options.php:410
|
155 |
+
#: options.php:457
|
156 |
+
#: options.php:469
|
157 |
+
#: options.php:470
|
158 |
+
#: options.php:474
|
159 |
+
#: options.php:520
|
160 |
+
#: options.php:531
|
161 |
+
msgid "more>"
|
162 |
+
msgstr "?"
|
163 |
+
|
164 |
+
#: options.php:313
|
165 |
+
msgid "Match threshold:"
|
166 |
+
msgstr "Relev�ncia:"
|
167 |
+
|
168 |
+
#: options.php:314
|
169 |
+
msgid "Titles: "
|
170 |
+
msgstr "Sobret�tulos:"
|
171 |
+
|
172 |
+
#: options.php:316
|
173 |
+
msgid "Bodies: "
|
174 |
+
msgstr "Corpo do texto:"
|
175 |
+
|
176 |
+
#: options.php:318
|
177 |
+
msgid "Tags: "
|
178 |
+
msgstr "Tags:"
|
179 |
+
|
180 |
+
#: options.php:320
|
181 |
+
msgid "Categories: "
|
182 |
+
msgstr "Categorias:"
|
183 |
+
|
184 |
+
#: options.php:322
|
185 |
+
msgid "Cross-relate posts and pages?"
|
186 |
+
msgstr "Emitir artigos e p�ginas em conjunto?"
|
187 |
+
|
188 |
+
#: options.php:322
|
189 |
+
msgid "When the \"Cross-relate posts and pages\" option is selected, the <code>related_posts()</code>, <code>related_pages()</code>, and <code>related_entries()</code> all will give the same output, returning both related pages and posts."
|
190 |
+
msgstr "Se a op��o \"Emitir artigos e p�ginas em conjunto \" estiver activa, as fun��es <code>related_posts()</code>, <code>related_pages()</code>, e <code>related_entries()</code> emitem o mesmo: Nas contribui��es parecidas n�o aparecem artigos nem p�ginas!"
|
191 |
+
|
192 |
+
#: options.php:401
|
193 |
+
msgid "Display options <small>for your website</small>"
|
194 |
+
msgstr "Apresenta��o <small>(Website)</small>"
|
195 |
+
|
196 |
+
#: options.php:405
|
197 |
+
msgid "Automatically display related posts?"
|
198 |
+
msgstr "Mostrar contribui��es parecidas automaticamente?"
|
199 |
+
|
200 |
+
#: options.php:405
|
201 |
+
msgid "This option automatically displays related posts right after the content on single entry pages. If this option is off, you will need to manually insert <code>related_posts()</code> or variants (<code>related_pages()</code> and <code>related_entries()</code>) into your theme files."
|
202 |
+
msgstr "Quando activada, a YARPP anexa apenas a emiss�o de contribui��es parecidas aos artigos actuais. Se estiver desactivada, ter� de tratar da apresenta��o no modelo com as fun��es <code>related_posts()</code> ou variantes (<code>related_pages()</code> ou <code>related_entries()</code>).
|
203 |
+
|
204 |
+
#: options.php:406
|
205 |
+
msgid "Website display code example"
|
206 |
+
msgstr "Exemplo de um c�digo-fonte para o an�ncio da p�gina"
|
207 |
+
|
208 |
+
#: options.php:406
|
209 |
+
#: options.php:471
|
210 |
+
msgid "(Update options to reload.)"
|
211 |
+
msgstr "Para ver as suas op��es aqui, ter� de guardar primeiro as op��es!"
|
212 |
+
|
213 |
+
#: options.php:409
|
214 |
+
#: options.php:473
|
215 |
+
msgid "Maximum number of related posts:"
|
216 |
+
msgstr "Quantidade m�xima de contribui��es:"
|
217 |
+
|
218 |
+
#: options.php:422
|
219 |
+
msgid "Before / after related entries:"
|
220 |
+
msgstr "C�digo-fonte antes / depois das contribui��es parecidas:"
|
221 |
+
|
222 |
+
#: options.php:423
|
223 |
+
#: options.php:428
|
224 |
+
#: options.php:437
|
225 |
+
#: options.php:487
|
226 |
+
#: options.php:492
|
227 |
+
#: options.php:501
|
228 |
+
msgid "For example:"
|
229 |
+
msgstr "Ex.:"
|
230 |
+
|
231 |
+
#: options.php:427
|
232 |
+
#: options.php:491
|
233 |
+
msgid "Before / after each related entry:"
|
234 |
+
msgstr "C�digo-fonte antes / depois das respectivas contribui��es:"
|
235 |
+
|
236 |
+
#: options.php:431
|
237 |
+
#: options.php:495
|
238 |
+
msgid "Show excerpt?"
|
239 |
+
msgstr "Mostrar excerto?"
|
240 |
+
|
241 |
+
#: options.php:432
|
242 |
+
#: options.php:496
|
243 |
+
msgid "Excerpt length (No. of words):"
|
244 |
+
msgstr "Comprimento do excerto (Quantidade de palavras):"
|
245 |
+
|
246 |
+
#: options.php:436
|
247 |
+
msgid "Before / after (Excerpt):"
|
248 |
+
msgstr "C�digo-fonte antes / depois dos respectivos excertos:"
|
249 |
+
|
250 |
+
#: options.php:442
|
251 |
+
#: options.php:506
|
252 |
+
msgid "Order results:"
|
253 |
+
msgstr "Sequ�ncia dos an�ncios:"
|
254 |
+
|
255 |
+
#: options.php:444
|
256 |
+
#: options.php:508
|
257 |
+
msgid "score (high relevance to low)"
|
258 |
+
msgstr "Relev�ncia (da maior � mais pequena)"
|
259 |
+
|
260 |
+
#: options.php:445
|
261 |
+
#: options.php:509
|
262 |
+
msgid "score (low relevance to high)"
|
263 |
+
msgstr "Relev�ncia (da mais pequena � maior)"
|
264 |
+
|
265 |
+
#: options.php:446
|
266 |
+
#: options.php:510
|
267 |
+
msgid "date (new to old)"
|
268 |
+
msgstr "Estampa da hora (da mais actual � mais velha)"
|
269 |
+
|
270 |
+
#: options.php:447
|
271 |
+
#: options.php:511
|
272 |
+
msgid "date (old to new)"
|
273 |
+
msgstr "Estampa da hora (da mais antiga � mais actual)"
|
274 |
+
|
275 |
+
#: options.php:448
|
276 |
+
#: options.php:512
|
277 |
+
msgid "title (alphabetical)"
|
278 |
+
msgstr "Sobret�tulo (A-Z)"
|
279 |
+
|
280 |
+
#: options.php:449
|
281 |
+
#: options.php:513
|
282 |
+
msgid "title (reverse alphabetical)"
|
283 |
+
msgstr "Sobret�tulo (Z-A)"
|
284 |
+
|
285 |
+
#: options.php:454
|
286 |
+
#: options.php:518
|
287 |
+
msgid "Default display if no results:"
|
288 |
+
msgstr "C�digo-fonte quando forem encontrados 0 artigos relevantes:"
|
289 |
+
|
290 |
+
#: options.php:456
|
291 |
+
#: options.php:520
|
292 |
+
msgid "Help promote Yet Another Related Posts Plugin?"
|
293 |
+
msgstr "Aplicar a YARPP discretamente?"
|
294 |
+
|
295 |
+
#: options.php:458
|
296 |
+
#: options.php:521
|
297 |
+
#, php-format
|
298 |
+
msgid "This option will add the code %s. Try turning it on, updating your options, and see the code in the code example to the right. These links and donations are greatly appreciated."
|
299 |
+
msgstr "Quando activado, aparece nos resultados uma pequena informa��o em rela��o ao autor e plugin das contribui��es parecidas. Adiciona o c�digo %s."
|
300 |
+
|
301 |
+
#: options.php:464
|
302 |
+
msgid "Display options <small>for RSS</small>"
|
303 |
+
msgstr "Apresenta��o <small>(RSS)</small>"
|
304 |
+
|
305 |
+
#: options.php:469
|
306 |
+
msgid "Display related posts in feeds?"
|
307 |
+
msgstr "Mostrar contribui��es parecidas nos feeds de not�cias?"
|
308 |
+
|
309 |
+
#: options.php:470
|
310 |
+
msgid "Display related posts in the descriptions?"
|
311 |
+
msgstr "Mostrar contribui��es em Descriptions?"
|
312 |
+
|
313 |
+
#: options.php:470
|
314 |
+
msgid "This option displays the related posts in the RSS description fields, not just the content. If your feeds are set up to only display excerpts, however, only the description field is used, so this option is required for any display at all."
|
315 |
+
msgstr "Mostra as contribui��es parecidas tamb�m em RSS-Descriptions, n�o s� em Content."
|
316 |
+
|
317 |
+
#: options.php:471
|
318 |
+
msgid "RSS display code example"
|
319 |
+
msgstr "Exemplos de an�ncios RSS"
|
320 |
+
|
321 |
+
#: options.php:486
|
322 |
+
msgid "Before / after related entries display:"
|
323 |
+
msgstr "C�digo-fonte antes / depois das contribui��es parecidas:"
|
324 |
+
|
325 |
+
#: options.php:500
|
326 |
+
msgid "Before / after (excerpt):"
|
327 |
+
msgstr "C�digo-fonte antes / depois do excerto:"
|
328 |
+
|
329 |
+
#: options.php:148
|
330 |
+
msgid "word"
|
331 |
+
msgstr "Palavra"
|
332 |
+
|
333 |
+
#: options.php:149
|
334 |
+
msgid "tag"
|
335 |
+
msgstr "Etiqueta"
|
336 |
+
|
337 |
+
#: options.php:150
|
338 |
+
msgid "category"
|
339 |
+
msgstr "Categoria"
|
340 |
+
|
341 |
+
#: options.php:157
|
342 |
+
#: options.php:187
|
343 |
+
#, php-format
|
344 |
+
msgid "require at least one %s in common"
|
345 |
+
msgstr "pelo menos igual a %s"
|
346 |
+
|
347 |
+
#: options.php:159
|
348 |
+
#: options.php:189
|
349 |
+
#, php-format
|
350 |
+
msgid "require more than one %s in common"
|
351 |
+
msgstr "mais do que igual a %s"
|
352 |
+
|
353 |
+
#: options.php:126
|
354 |
+
msgid "Options saved!"
|
355 |
+
msgstr "Op��es gravadas!"
|
356 |
+
|
357 |
+
#: options.php:308
|
358 |
+
msgid "The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshhold, take a look at some post's related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site."
|
359 |
+
msgstr ""
|
360 |
+
|
361 |
+
#: options.php:606
|
362 |
+
msgid "Update options"
|
363 |
+
msgstr "Actualizar op��es"
|
364 |
+
|
365 |
+
#: options.php:607
|
366 |
+
msgid "Do you really want to reset your configuration?"
|
367 |
+
msgstr "Deseja mesmo reverter as op��es?"
|
368 |
+
|
369 |
+
#: options.php:607
|
370 |
+
msgid "Reset options"
|
371 |
+
msgstr "Reverter op��es"
|
372 |
+
|
373 |
+
#: includes.php:24
|
374 |
+
#: includes.php:35
|
375 |
+
msgid "Related posts:"
|
376 |
+
msgstr ""
|
377 |
+
|
378 |
+
#: includes.php:26
|
379 |
+
#: includes.php:37
|
380 |
+
#: template-metabox.php:27
|
381 |
+
msgid "No related posts."
|
382 |
+
msgstr ""
|
383 |
+
|
384 |
+
#: includes.php:110
|
385 |
+
msgid "MySQL error on creating yarpp_keyword_cache table"
|
386 |
+
msgstr ""
|
387 |
+
|
388 |
+
#: includes.php:121
|
389 |
+
msgid "MySQL error on creating yarpp_related_cache table"
|
390 |
+
msgstr ""
|
391 |
+
|
392 |
+
#: magic.php:71
|
393 |
+
msgid "Example post "
|
394 |
+
msgstr ""
|
395 |
+
|
396 |
+
#: options.php:10
|
397 |
+
msgid "Please move the YARPP template files into your theme to complete installation. Simply move the sample template files (currently in <code>wp-content/plugins/yet-another-related-posts-plugin/yarpp-templates/</code>) to the <code>TEMPLATEPATH</code> directory."
|
398 |
+
msgstr ""
|
399 |
+
|
400 |
+
#: options.php:15
|
401 |
+
msgid "No YARPP template files were found in your theme (<code>TEMPLATEPATH</code>) so the templating feature has been turned off."
|
402 |
+
msgstr ""
|
403 |
+
|
404 |
+
#: options.php:68
|
405 |
+
msgid "Please try <A>manual SQL setup</a>."
|
406 |
+
msgstr "Bitte aktualisieren Sie die <A>SQL-Datenbank manuell</a>."
|
407 |
+
|
408 |
+
#: options.php:82
|
409 |
+
#: options.php:85
|
410 |
+
#: options.php:127
|
411 |
+
#: options.php:530
|
412 |
+
msgid "Related posts cache status"
|
413 |
+
msgstr ""
|
414 |
+
|
415 |
+
#: options.php:82
|
416 |
+
msgid "Your related posts cache is incomplete. Please build your cache from the <A>related posts status pane</a>."
|
417 |
+
msgstr ""
|
418 |
+
|
419 |
+
#: options.php:85
|
420 |
+
msgid "Your related posts cache is empty. Please build your cache from the <A>related posts status pane</a>."
|
421 |
+
msgstr ""
|
422 |
+
|
423 |
+
#: options.php:128
|
424 |
+
msgid "If you updated the \"pool\" options or \"relatedness\" options displayed, please rebuild your cache now from the <A>related posts status pane</a>."
|
425 |
+
msgstr ""
|
426 |
+
|
427 |
+
#: options.php:273
|
428 |
+
msgid "by <a href=\"http://mitcho.com/code/\">mitcho (Michael 芳貴 Erlewine)</a>"
|
429 |
+
msgstr ""
|
430 |
+
|
431 |
+
#: options.php:273
|
432 |
+
msgid "Follow <a href=\"http://twitter.com/yarpp/\">Yet Another Related Posts Plugin on Twitter</a>"
|
433 |
+
msgstr ""
|
434 |
+
|
435 |
+
#: options.php:294
|
436 |
+
msgid "day(s)"
|
437 |
+
msgstr ""
|
438 |
+
|
439 |
+
#: options.php:295
|
440 |
+
msgid "week(s)"
|
441 |
+
msgstr ""
|
442 |
+
|
443 |
+
#: options.php:296
|
444 |
+
msgid "month(s)"
|
445 |
+
msgstr ""
|
446 |
+
|
447 |
+
#: options.php:298
|
448 |
+
msgid "Show only posts from the past NUMBER UNITS"
|
449 |
+
msgstr ""
|
450 |
+
|
451 |
+
#: options.php:388
|
452 |
+
msgid "There is a new beta (VERSION) of Yet Another Related Posts Plugin. You can <A>download it here</a> at your own risk."
|
453 |
+
msgstr ""
|
454 |
+
|
455 |
+
#: options.php:390
|
456 |
+
msgid "There is a new version (VERSION) of Yet Another Related Posts Plugin available! You can <A>download it here</a>."
|
457 |
+
msgstr ""
|
458 |
+
|
459 |
+
#: options.php:410
|
460 |
+
#: options.php:474
|
461 |
+
msgid "Display using a custom template file"
|
462 |
+
msgstr ""
|
463 |
+
|
464 |
+
#: options.php:410
|
465 |
+
#: options.php:474
|
466 |
+
#: options.php:527
|
467 |
+
msgid "NEW!"
|
468 |
+
msgstr ""
|
469 |
+
|
470 |
+
#: options.php:410
|
471 |
+
#: options.php:474
|
472 |
+
msgid "This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP."
|
473 |
+
msgstr ""
|
474 |
+
|
475 |
+
#: options.php:412
|
476 |
+
#: options.php:476
|
477 |
+
msgid "Template file:"
|
478 |
+
msgstr ""
|
479 |
+
|
480 |
+
#: options.php:423
|
481 |
+
#: options.php:428
|
482 |
+
#: options.php:437
|
483 |
+
#: options.php:487
|
484 |
+
#: options.php:492
|
485 |
+
#: options.php:501
|
486 |
+
msgid " or "
|
487 |
+
msgstr ""
|
488 |
+
|
489 |
+
#: options.php:469
|
490 |
+
msgid "This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed."
|
491 |
+
msgstr ""
|
492 |
+
|
493 |
+
#: options.php:527
|
494 |
+
msgid "Advanced"
|
495 |
+
msgstr ""
|
496 |
+
|
497 |
+
#: options.php:530
|
498 |
+
msgid "Show cache status"
|
499 |
+
msgstr ""
|
500 |
+
|
501 |
+
#: options.php:531
|
502 |
+
msgid "When the cache is incomplete, compute related posts on the fly?"
|
503 |
+
msgstr ""
|
504 |
+
|
505 |
+
#: options.php:532
|
506 |
+
msgid "If a displayed post's related posts are not cached and this option is on, YARPP will compute them on the fly. Do not turn this option on if you have a high-traffic site.<br />If this option is off and a post's related posts have not been cached, it will display as if it has no related posts."
|
507 |
+
msgstr ""
|
508 |
+
|
509 |
+
#: options.php:562
|
510 |
+
msgid "'MIN minute(s) and SEC second(s) remaining'"
|
511 |
+
msgstr ""
|
512 |
+
|
513 |
+
#: options.php:564
|
514 |
+
msgid "'SEC second(s) remaining'"
|
515 |
+
msgstr ""
|
516 |
+
|
517 |
+
#: options.php:568
|
518 |
+
msgid "Your related posts cache is now complete."
|
519 |
+
msgstr ""
|
520 |
+
|
521 |
+
#: options.php:568
|
522 |
+
msgid "The SQL queries took SEC seconds."
|
523 |
+
msgstr ""
|
524 |
+
|
525 |
+
#: options.php:575
|
526 |
+
msgid "There was an error while constructing the related posts for TITLE"
|
527 |
+
msgstr ""
|
528 |
+
|
529 |
+
#: options.php:577
|
530 |
+
#: options.php:583
|
531 |
+
msgid "Constructing the related posts timed out."
|
532 |
+
msgstr ""
|
533 |
+
|
534 |
+
#: options.php:580
|
535 |
+
#: options.php:585
|
536 |
+
msgid "Try to continue..."
|
537 |
+
msgstr ""
|
538 |
+
|
539 |
+
#: options.php:593
|
540 |
+
msgid "Your related posts cache is PERCENT% complete."
|
541 |
+
msgstr ""
|
542 |
+
|
543 |
+
#: options.php:599
|
544 |
+
msgid "starting..."
|
545 |
+
msgstr ""
|
546 |
+
|
547 |
+
#: services.php:59
|
548 |
+
msgid "You cannot rebuild the YARPP cache."
|
549 |
+
msgstr ""
|
550 |
+
|
551 |
+
#: template-metabox.php:12
|
552 |
+
msgid "These are the related entries for this entry. Updating this post may change these related posts."
|
553 |
+
msgstr ""
|
554 |
+
|
555 |
+
#: template-metabox.php:25
|
556 |
+
msgid "Whether all of these related entries are actually displayed and how they are displayed depends on your YARPP display options."
|
557 |
+
msgstr ""
|
558 |
+
|
magic.php
CHANGED
@@ -19,67 +19,15 @@ function yarpp_set_score_override_flag($q) {
|
|
19 |
}
|
20 |
}
|
21 |
|
22 |
-
function yarpp_where_filter($arg) {
|
23 |
-
global $wpdb, $yarpp_time, $yarpp_related_postdata, $yarpp_related_IDs;
|
24 |
-
$threshold = yarpp_get_option('threshold');
|
25 |
-
if ($yarpp_time) {
|
26 |
-
// modify the where clause to use the related ID list.
|
27 |
-
$arg = preg_replace("!{$wpdb->posts}.ID = \d+!","{$wpdb->posts}.ID in (".join(',',$yarpp_related_IDs).")",$arg);
|
28 |
-
|
29 |
-
// if we have "recent only" set, add an additional condition
|
30 |
-
if (yarpp_get_option("recent_only"))
|
31 |
-
$arg .= " and post_date > date_sub(now(), interval ".yarpp_get_option("recent_number")." ".yarpp_get_option("recent_units").") ";
|
32 |
-
}
|
33 |
-
return $arg;
|
34 |
-
}
|
35 |
-
|
36 |
-
function yarpp_orderby_filter($arg) {
|
37 |
-
global $wpdb, $yarpp_time, $yarpp_score_override;
|
38 |
-
if ($yarpp_time and $yarpp_score_override)
|
39 |
-
return str_replace("$wpdb->posts.post_date","score",$arg);
|
40 |
-
return $arg;
|
41 |
-
}
|
42 |
-
|
43 |
-
function yarpp_limit_filter($arg) {
|
44 |
-
global $wpdb, $yarpp_time, $yarpp_online_limit;
|
45 |
-
if ($yarpp_time and $yarpp_online_limit)
|
46 |
-
return " limit $yarpp_online_limit ";
|
47 |
-
return $arg;
|
48 |
-
}
|
49 |
-
|
50 |
-
function yarpp_fields_filter($arg) {
|
51 |
-
global $wpdb, $yarpp_time, $wpdb, $yarpp_related_postdata;
|
52 |
-
if ($yarpp_time && is_array($yarpp_related_postdata)) {
|
53 |
-
$scores = array();
|
54 |
-
foreach ($yarpp_related_postdata as $related_entry) {
|
55 |
-
$scores[] = " WHEN {$related_entry['ID']} THEN {$related_entry['score']}";
|
56 |
-
}
|
57 |
-
$arg .= ", CASE {$wpdb->posts}.ID" . join('',$scores) ." END as score";
|
58 |
-
}
|
59 |
-
return $arg;
|
60 |
-
}
|
61 |
-
|
62 |
-
function yarpp_demo_request_filter($arg) {
|
63 |
-
global $wpdb, $yarpp_demo_time, $yarpp_limit;
|
64 |
-
if ($yarpp_demo_time) {
|
65 |
-
$wpdb->query("set @count = 0;");
|
66 |
-
return "SELECT SQL_CALC_FOUND_ROWS ID + $yarpp_limit as ID, post_author, post_date, post_date_gmt, 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' as post_content,
|
67 |
-
concat('".__('Example post ','yarpp')."',@count:=@count+1) as post_title, 0 as post_category, '' as post_excerpt, 'publish' as post_status, 'open' as comment_status, 'open' as ping_status, '' as post_password, concat('example-post-',@count) as post_name, '' as to_ping, '' as pinged, post_modified, post_modified_gmt, '' as post_content_filtered, 0 as post_parent, concat('PERMALINK',@count) as guid, 0 as menu_order, 'post' as post_type, '' as post_mime_type, 0 as comment_count, 'SCORE' as score
|
68 |
-
FROM $wpdb->posts
|
69 |
-
ORDER BY ID DESC LIMIT 0, $yarpp_limit";
|
70 |
-
}
|
71 |
-
return $arg;
|
72 |
-
}
|
73 |
-
|
74 |
//=CACHING===========
|
75 |
|
76 |
function yarpp_sql($type,$args,$giveresults = true,$reference_ID=false,$domain='website') {
|
77 |
-
global $wpdb, $post, $yarpp_debug;
|
78 |
|
79 |
if (is_object($post) and !$reference_ID) {
|
80 |
$reference_ID = $post->ID;
|
81 |
}
|
82 |
-
|
83 |
// set the "domain prefix", used for all the preferences.
|
84 |
if ($domain == 'rss')
|
85 |
$domainprefix = 'rss_';
|
@@ -112,14 +60,14 @@ function yarpp_sql($type,$args,$giveresults = true,$reference_ID=false,$domain='
|
|
112 |
extract($optvals);
|
113 |
|
114 |
// Fetch keywords
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
// get weights
|
122 |
-
|
123 |
$bodyweight = (($body == 3)?3:(($body == 2)?1:0));
|
124 |
$titleweight = (($title == 3)?3:(($title == 2)?1:0));
|
125 |
$tagweight = (($tags != 1)?1:0);
|
@@ -129,11 +77,11 @@ function yarpp_sql($type,$args,$giveresults = true,$reference_ID=false,$domain='
|
|
129 |
$weights['title'] = $titleweight;
|
130 |
$weights['cat'] = $catweight;
|
131 |
$weights['tag'] = $tagweight;
|
132 |
-
|
133 |
$totalweight = $bodyweight + $titleweight + $tagweight + $catweight;
|
134 |
-
|
135 |
// get disallowed categories and tags
|
136 |
-
|
137 |
$disterms = implode(',', array_filter(array_merge(explode(',',$discats),explode(',',$distags)),'is_numeric'));
|
138 |
|
139 |
$usedisterms = count(array_filter(array_merge(explode(',',$discats),explode(',',$distags)),'is_numeric'));
|
@@ -148,14 +96,14 @@ function yarpp_sql($type,$args,$giveresults = true,$reference_ID=false,$domain='
|
|
148 |
if ($catweight)
|
149 |
$criteria['cat'] = "COUNT( DISTINCT cattax.term_taxonomy_id )";
|
150 |
|
151 |
-
$newsql = "SELECT ID, "; //post_title, post_date, post_content, post_excerpt,
|
152 |
|
153 |
$newsql .= 'ROUND(0';
|
154 |
foreach ($criteria as $key => $value) {
|
155 |
$newsql .= "+ $value * ".$weights[$key];
|
156 |
}
|
157 |
$newsql .= ',1) as score';
|
158 |
-
|
159 |
$newsql .= "\n from $wpdb->posts \n";
|
160 |
|
161 |
if ($usedisterms)
|
@@ -164,21 +112,21 @@ function yarpp_sql($type,$args,$giveresults = true,$reference_ID=false,$domain='
|
|
164 |
left join $wpdb->terms as blockterm on (blocktax.term_id = blockterm.term_id and blockterm.term_id in ($disterms))\n";
|
165 |
|
166 |
if ($tagweight)
|
167 |
-
$newsql .= " left JOIN $wpdb->term_relationships AS thistag ON (thistag.object_id = $reference_ID )
|
168 |
left JOIN $wpdb->term_relationships AS tagrel on (tagrel.term_taxonomy_id = thistag.term_taxonomy_id
|
169 |
AND tagrel.object_id = $wpdb->posts.ID)
|
170 |
left JOIN $wpdb->term_taxonomy AS tagtax ON ( tagrel.term_taxonomy_id = tagtax.term_taxonomy_id
|
171 |
AND tagtax.taxonomy = 'post_tag')\n";
|
172 |
|
173 |
if ($catweight)
|
174 |
-
$newsql .= " left JOIN $wpdb->term_relationships AS thiscat ON (thiscat.object_id = $reference_ID )
|
175 |
left JOIN $wpdb->term_relationships AS catrel on (catrel.term_taxonomy_id = thiscat.term_taxonomy_id
|
176 |
AND catrel.object_id = $wpdb->posts.ID)
|
177 |
left JOIN $wpdb->term_taxonomy AS cattax ON ( catrel.term_taxonomy_id = cattax.term_taxonomy_id
|
178 |
AND cattax.taxonomy = 'category')\n";
|
179 |
|
180 |
// WHERE
|
181 |
-
|
182 |
$newsql .= " where (post_status IN ( 'publish', 'static' ) and ID != '$reference_ID')";
|
183 |
|
184 |
if ($past_only) { // 3.1.8: revised $past_only option
|
@@ -202,7 +150,7 @@ function yarpp_sql($type,$args,$giveresults = true,$reference_ID=false,$domain='
|
|
202 |
$newsql .= "\n group by id \n";
|
203 |
// HAVING
|
204 |
// safethreshold is so the new calibration system works.
|
205 |
-
// number_format fix suggested by vkovalcik! :)
|
206 |
$safethreshold = number_format(max($threshold,0.1), 2, '.', '');
|
207 |
$newsql .= " having score >= $safethreshold";
|
208 |
if ($usedisterms)
|
@@ -231,19 +179,19 @@ function yarpp_sql($type,$args,$giveresults = true,$reference_ID=false,$domain='
|
|
231 |
/* new in 3.0! new query-based approach: EXTREMELY HACKY! */
|
232 |
|
233 |
function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'website') {
|
234 |
-
global $
|
235 |
-
|
236 |
if ($domain != 'demo_web' and $domain != 'demo_rss') {
|
237 |
if ($yarpp_time) // if we're already in a YARPP loop, stop now.
|
238 |
return false;
|
239 |
-
|
240 |
if (is_object($post) and !$reference_ID)
|
241 |
$reference_ID = $post->ID;
|
242 |
} else {
|
243 |
if ($yarpp_demo_time) // if we're already in a YARPP loop, stop now.
|
244 |
return false;
|
245 |
}
|
246 |
-
|
247 |
get_currentuserinfo();
|
248 |
|
249 |
// set the "domain prefix", used for all the preferences.
|
@@ -269,18 +217,14 @@ function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'w
|
|
269 |
}
|
270 |
}
|
271 |
extract($optvals);
|
272 |
-
|
273 |
yarpp_cache_enforce($type,$reference_ID);
|
274 |
-
|
275 |
$output = '';
|
276 |
-
|
277 |
if ($domain != 'demo_web' and $domain != 'demo_rss') {
|
278 |
$yarpp_time = true; // get ready for YARPP TIME!
|
279 |
-
|
280 |
-
$yarpp_related_postdata = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
|
281 |
-
$yarpp_related_IDs = array();
|
282 |
-
if ($yarpp_related_postdata && is_array($yarpp_related_postdata))
|
283 |
-
$yarpp_related_IDs = array_map(create_function('$x','return $x["ID"];'), $yarpp_related_postdata);
|
284 |
} else
|
285 |
$yarpp_demo_time = true;
|
286 |
// just so we can return to normal later
|
@@ -310,7 +254,7 @@ function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'w
|
|
310 |
// make sure we get the right is_single value
|
311 |
// (see http://wordpress.org/support/topic/288230)
|
312 |
$wp_query->is_single = false;
|
313 |
-
|
314 |
if ($domain == 'metabox') {
|
315 |
include(YARPP_DIR.'/template-metabox.php');
|
316 |
} elseif ($use_template and file_exists(STYLESHEETPATH . '/' . $template_file) and $template_file != '') {
|
@@ -323,14 +267,14 @@ function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'w
|
|
323 |
} else {
|
324 |
include(YARPP_DIR.'/template-builtin.php');
|
325 |
}
|
326 |
-
|
327 |
unset($related_query);
|
328 |
if ($domain != 'demo_web' and $domain != 'demo_rss') {
|
329 |
$yarpp_time = false; // YARPP time is over... :(
|
330 |
-
|
331 |
} else
|
332 |
$yarpp_demo_time = false;
|
333 |
-
|
334 |
// restore the older wp_query.
|
335 |
$wp_query = null; $wp_query = $current_query; unset($current_query);
|
336 |
$post = null; $post = $current_post; unset($current_post);
|
@@ -347,33 +291,29 @@ function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'w
|
|
347 |
|
348 |
if ($promote_yarpp and $domain != 'metabox')
|
349 |
$output .= "\n<p>".__("Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.",'yarpp')."</p>";
|
350 |
-
|
351 |
if ($echo) echo $output; else return ((!empty($output))?"\n\n":'').$output;
|
352 |
}
|
353 |
|
354 |
function yarpp_related_exist($type,$args,$reference_ID=false) {
|
355 |
-
global $
|
356 |
|
357 |
if (is_object($post) and !$reference_ID)
|
358 |
$reference_ID = $post->ID;
|
359 |
-
|
360 |
if ($yarpp_time) // if we're already in a YARPP loop, stop now.
|
361 |
return false;
|
362 |
-
|
363 |
yarpp_cache_enforce($type,$reference_ID);
|
364 |
-
|
365 |
-
$yarpp_time = true; // get ready for YARPP TIME!
|
366 |
-
// get the related posts from postdata, and also construct the relate_IDs array
|
367 |
-
$yarpp_related_postdata = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
|
368 |
-
$yarpp_related_IDs = array();
|
369 |
-
if ($yarpp_related_postdata)
|
370 |
-
$yarpp_related_IDs = array_map(create_function('$x','return $x["ID"];'), $yarpp_related_postdata);
|
371 |
|
|
|
|
|
372 |
$related_query = new WP_Query();
|
373 |
$related_query->query(array('p'=>$reference_ID,'showposts'=>10000,'post_type'=>$type));
|
374 |
$return = $related_query->have_posts();
|
375 |
$yarpp_time = false; // YARPP time is over. :(
|
376 |
-
unset($related_query
|
|
|
377 |
|
378 |
return $return;
|
379 |
}
|
@@ -381,6 +321,10 @@ function yarpp_related_exist($type,$args,$reference_ID=false) {
|
|
381 |
function yarpp_save_cache($post_ID,$force=true) {
|
382 |
global $wpdb;
|
383 |
|
|
|
|
|
|
|
|
|
384 |
$sql = "select post_parent, post_type from $wpdb->posts where ID='$post_ID'";
|
385 |
$parent_ID = $wpdb->get_var($sql,0);
|
386 |
|
@@ -398,46 +342,38 @@ function yarpp_save_cache($post_ID,$force=true) {
|
|
398 |
// TODO: fix this bug... we should be getting the post type from the parent, if there is one.
|
399 |
|
400 |
yarpp_cache_enforce($type,$post_ID,$force);
|
401 |
-
|
402 |
}
|
403 |
|
404 |
-
|
405 |
-
|
406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
if ($reference_ID === '' || $reference_ID === false)
|
408 |
return false;
|
409 |
-
|
410 |
-
if (!$force &&
|
411 |
if ($yarpp_debug) echo "<!--YARPP is using the cache right now.-->";
|
412 |
return false;
|
413 |
}
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
//
|
418 |
-
|
419 |
-
|
420 |
-
// let's update the related posts
|
421 |
-
$related = $wpdb->get_results(yarpp_sql($type,array(),true,$reference_ID), ARRAY_A);
|
422 |
-
|
423 |
-
if (count($related)) {
|
424 |
-
update_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, $related);
|
425 |
-
if ($yarpp_debug) echo "<!--YARPP just set the cache for post $reference_ID-->";
|
426 |
-
|
427 |
-
// We'll want to clear their caches
|
428 |
-
// so that they will be rebuilt when they're hit next.
|
429 |
-
if (count($related) && !yarpp_get_option('past_only')) {
|
430 |
-
foreach ($related as $related_entry) {
|
431 |
-
delete_post_meta( $related_entry['ID'], YARPP_POSTMETA_RELATED_KEY );
|
432 |
-
}
|
433 |
-
}
|
434 |
-
}
|
435 |
-
|
436 |
-
// if no results...
|
437 |
-
if (!count($related))
|
438 |
-
update_post_meta($reference_ID, YARPP_POSTMETA_RELATED_KEY, YARPP_NO_RELATED);
|
439 |
-
|
440 |
return true;
|
441 |
-
|
442 |
}
|
443 |
|
19 |
}
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
//=CACHING===========
|
23 |
|
24 |
function yarpp_sql($type,$args,$giveresults = true,$reference_ID=false,$domain='website') {
|
25 |
+
global $wpdb, $post, $yarpp_debug, $yarpp_cache;
|
26 |
|
27 |
if (is_object($post) and !$reference_ID) {
|
28 |
$reference_ID = $post->ID;
|
29 |
}
|
30 |
+
|
31 |
// set the "domain prefix", used for all the preferences.
|
32 |
if ($domain == 'rss')
|
33 |
$domainprefix = 'rss_';
|
60 |
extract($optvals);
|
61 |
|
62 |
// Fetch keywords
|
63 |
+
$body_terms = $yarpp_cache->get_keywords($reference_ID,'body');
|
64 |
+
$title_terms = $yarpp_cache->get_keywords($reference_ID,'title');
|
65 |
+
|
66 |
+
if ($yarpp_debug) echo "<!--TITLE TERMS: $title_terms-->"; // debug
|
67 |
+
if ($yarpp_debug) echo "<!--BODY TERMS: $body_terms-->"; // debug
|
68 |
+
|
69 |
// get weights
|
70 |
+
|
71 |
$bodyweight = (($body == 3)?3:(($body == 2)?1:0));
|
72 |
$titleweight = (($title == 3)?3:(($title == 2)?1:0));
|
73 |
$tagweight = (($tags != 1)?1:0);
|
77 |
$weights['title'] = $titleweight;
|
78 |
$weights['cat'] = $catweight;
|
79 |
$weights['tag'] = $tagweight;
|
80 |
+
|
81 |
$totalweight = $bodyweight + $titleweight + $tagweight + $catweight;
|
82 |
+
|
83 |
// get disallowed categories and tags
|
84 |
+
|
85 |
$disterms = implode(',', array_filter(array_merge(explode(',',$discats),explode(',',$distags)),'is_numeric'));
|
86 |
|
87 |
$usedisterms = count(array_filter(array_merge(explode(',',$discats),explode(',',$distags)),'is_numeric'));
|
96 |
if ($catweight)
|
97 |
$criteria['cat'] = "COUNT( DISTINCT cattax.term_taxonomy_id )";
|
98 |
|
99 |
+
$newsql = "SELECT $reference_ID as reference_ID, ID, "; //post_title, post_date, post_content, post_excerpt,
|
100 |
|
101 |
$newsql .= 'ROUND(0';
|
102 |
foreach ($criteria as $key => $value) {
|
103 |
$newsql .= "+ $value * ".$weights[$key];
|
104 |
}
|
105 |
$newsql .= ',1) as score';
|
106 |
+
|
107 |
$newsql .= "\n from $wpdb->posts \n";
|
108 |
|
109 |
if ($usedisterms)
|
112 |
left join $wpdb->terms as blockterm on (blocktax.term_id = blockterm.term_id and blockterm.term_id in ($disterms))\n";
|
113 |
|
114 |
if ($tagweight)
|
115 |
+
$newsql .= " left JOIN $wpdb->term_relationships AS thistag ON (thistag.object_id = $reference_ID )
|
116 |
left JOIN $wpdb->term_relationships AS tagrel on (tagrel.term_taxonomy_id = thistag.term_taxonomy_id
|
117 |
AND tagrel.object_id = $wpdb->posts.ID)
|
118 |
left JOIN $wpdb->term_taxonomy AS tagtax ON ( tagrel.term_taxonomy_id = tagtax.term_taxonomy_id
|
119 |
AND tagtax.taxonomy = 'post_tag')\n";
|
120 |
|
121 |
if ($catweight)
|
122 |
+
$newsql .= " left JOIN $wpdb->term_relationships AS thiscat ON (thiscat.object_id = $reference_ID )
|
123 |
left JOIN $wpdb->term_relationships AS catrel on (catrel.term_taxonomy_id = thiscat.term_taxonomy_id
|
124 |
AND catrel.object_id = $wpdb->posts.ID)
|
125 |
left JOIN $wpdb->term_taxonomy AS cattax ON ( catrel.term_taxonomy_id = cattax.term_taxonomy_id
|
126 |
AND cattax.taxonomy = 'category')\n";
|
127 |
|
128 |
// WHERE
|
129 |
+
|
130 |
$newsql .= " where (post_status IN ( 'publish', 'static' ) and ID != '$reference_ID')";
|
131 |
|
132 |
if ($past_only) { // 3.1.8: revised $past_only option
|
150 |
$newsql .= "\n group by id \n";
|
151 |
// HAVING
|
152 |
// safethreshold is so the new calibration system works.
|
153 |
+
// number_format fix suggested by vkovalcik! :)
|
154 |
$safethreshold = number_format(max($threshold,0.1), 2, '.', '');
|
155 |
$newsql .= " having score >= $safethreshold";
|
156 |
if ($usedisterms)
|
179 |
/* new in 3.0! new query-based approach: EXTREMELY HACKY! */
|
180 |
|
181 |
function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'website') {
|
182 |
+
global $post, $yarpp_time, $yarpp_demo_time, $wp_query, $id, $page, $pages, $authordata, $day, $currentmonth, $multipage, $more, $pagenow, $numpages, $yarpp_cache;
|
183 |
+
|
184 |
if ($domain != 'demo_web' and $domain != 'demo_rss') {
|
185 |
if ($yarpp_time) // if we're already in a YARPP loop, stop now.
|
186 |
return false;
|
187 |
+
|
188 |
if (is_object($post) and !$reference_ID)
|
189 |
$reference_ID = $post->ID;
|
190 |
} else {
|
191 |
if ($yarpp_demo_time) // if we're already in a YARPP loop, stop now.
|
192 |
return false;
|
193 |
}
|
194 |
+
|
195 |
get_currentuserinfo();
|
196 |
|
197 |
// set the "domain prefix", used for all the preferences.
|
217 |
}
|
218 |
}
|
219 |
extract($optvals);
|
220 |
+
|
221 |
yarpp_cache_enforce($type,$reference_ID);
|
222 |
+
|
223 |
$output = '';
|
224 |
+
|
225 |
if ($domain != 'demo_web' and $domain != 'demo_rss') {
|
226 |
$yarpp_time = true; // get ready for YARPP TIME!
|
227 |
+
$yarpp_cache->begin_yarpp_time($reference_ID);
|
|
|
|
|
|
|
|
|
228 |
} else
|
229 |
$yarpp_demo_time = true;
|
230 |
// just so we can return to normal later
|
254 |
// make sure we get the right is_single value
|
255 |
// (see http://wordpress.org/support/topic/288230)
|
256 |
$wp_query->is_single = false;
|
257 |
+
|
258 |
if ($domain == 'metabox') {
|
259 |
include(YARPP_DIR.'/template-metabox.php');
|
260 |
} elseif ($use_template and file_exists(STYLESHEETPATH . '/' . $template_file) and $template_file != '') {
|
267 |
} else {
|
268 |
include(YARPP_DIR.'/template-builtin.php');
|
269 |
}
|
270 |
+
|
271 |
unset($related_query);
|
272 |
if ($domain != 'demo_web' and $domain != 'demo_rss') {
|
273 |
$yarpp_time = false; // YARPP time is over... :(
|
274 |
+
$yarpp_cache->end_yarpp_time();
|
275 |
} else
|
276 |
$yarpp_demo_time = false;
|
277 |
+
|
278 |
// restore the older wp_query.
|
279 |
$wp_query = null; $wp_query = $current_query; unset($current_query);
|
280 |
$post = null; $post = $current_post; unset($current_post);
|
291 |
|
292 |
if ($promote_yarpp and $domain != 'metabox')
|
293 |
$output .= "\n<p>".__("Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.",'yarpp')."</p>";
|
294 |
+
|
295 |
if ($echo) echo $output; else return ((!empty($output))?"\n\n":'').$output;
|
296 |
}
|
297 |
|
298 |
function yarpp_related_exist($type,$args,$reference_ID=false) {
|
299 |
+
global $post, $yarpp_time, $yarpp_cache;
|
300 |
|
301 |
if (is_object($post) and !$reference_ID)
|
302 |
$reference_ID = $post->ID;
|
303 |
+
|
304 |
if ($yarpp_time) // if we're already in a YARPP loop, stop now.
|
305 |
return false;
|
306 |
+
|
307 |
yarpp_cache_enforce($type,$reference_ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
309 |
+
$yarpp_time = true; // get ready for YARPP TIME!
|
310 |
+
$yarpp_cache->start_yarpp_time($reference_ID);
|
311 |
$related_query = new WP_Query();
|
312 |
$related_query->query(array('p'=>$reference_ID,'showposts'=>10000,'post_type'=>$type));
|
313 |
$return = $related_query->have_posts();
|
314 |
$yarpp_time = false; // YARPP time is over. :(
|
315 |
+
unset($related_query);
|
316 |
+
$yarpp_cache->end_yarpp_time();
|
317 |
|
318 |
return $return;
|
319 |
}
|
321 |
function yarpp_save_cache($post_ID,$force=true) {
|
322 |
global $wpdb;
|
323 |
|
324 |
+
// new in 3.2: don't compute cache during import
|
325 |
+
if ( defined( 'WP_IMPORTING' ) )
|
326 |
+
return;
|
327 |
+
|
328 |
$sql = "select post_parent, post_type from $wpdb->posts where ID='$post_ID'";
|
329 |
$parent_ID = $wpdb->get_var($sql,0);
|
330 |
|
342 |
// TODO: fix this bug... we should be getting the post type from the parent, if there is one.
|
343 |
|
344 |
yarpp_cache_enforce($type,$post_ID,$force);
|
|
|
345 |
}
|
346 |
|
347 |
+
// Clear the cache for this entry and for all posts which are "related" to it.
|
348 |
+
// New in 3.2: This is called when a post is deleted.
|
349 |
+
function yarpp_delete_cache($post_ID) {
|
350 |
+
global $yarpp_cache;
|
351 |
+
|
352 |
+
// Clear the cache for this post.
|
353 |
+
$yarpp_cache->clear($post_ID);
|
354 |
+
|
355 |
+
// Find all "peers" which list this post as a related post.
|
356 |
+
$peers = $yarpp_cache->related(null, $post_ID);
|
357 |
+
// Clear the peers' caches.
|
358 |
+
$yarpp_cache->clear($peers);
|
359 |
+
}
|
360 |
+
|
361 |
+
function yarpp_cache_enforce($types=array('post'),$reference_ID,$force=false) {
|
362 |
+
global $yarpp_debug, $yarpp_cache;
|
363 |
+
|
364 |
if ($reference_ID === '' || $reference_ID === false)
|
365 |
return false;
|
366 |
+
|
367 |
+
if (!$force && $yarpp_cache->is_cached($reference_ID)) {
|
368 |
if ($yarpp_debug) echo "<!--YARPP is using the cache right now.-->";
|
369 |
return false;
|
370 |
}
|
371 |
+
|
372 |
+
$yarpp_cache->cache_keywords($reference_ID);
|
373 |
+
|
374 |
+
// let's update the related post
|
375 |
+
$yarpp_cache->update($reference_ID, $types);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
return true;
|
377 |
+
|
378 |
}
|
379 |
|
options.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
global $wpdb, $yarpp_value_options, $yarpp_binary_options, $wp_version;
|
4 |
|
5 |
// check to see that templates are in the right place
|
6 |
$yarpp_templateable = (count(glob(STYLESHEETPATH . '/yarpp-template-*.php')) > 0);
|
@@ -10,17 +10,17 @@ if (!$yarpp_templateable) {
|
|
10 |
.str_replace("TEMPLATEPATH",STYLESHEETPATH,__("Please move the YARPP template files into your theme to complete installation. Simply move the sample template files (currently in <code>wp-content/plugins/yet-another-related-posts-plugin/yarpp-templates/</code>) to the <code>TEMPLATEPATH</code> directory.",'yarpp'))
|
11 |
."</div>";
|
12 |
|
13 |
-
else
|
14 |
echo "<div class='updated'>"
|
15 |
.str_replace('TEMPLATEPATH',STYLESHEETPATH,__("No YARPP template files were found in your theme (<code>TEMPLATEPATH</code>) so the templating feature has been turned off.",'yarpp'))
|
16 |
."</div>";
|
17 |
-
|
18 |
yarpp_set_option('use_template',false);
|
19 |
yarpp_set_option('rss_use_template',false);
|
20 |
-
|
21 |
}
|
22 |
|
23 |
-
if ($_POST['myisam_override']) {
|
24 |
yarpp_set_option('myisam_override',1);
|
25 |
echo "<div class='updated'>"
|
26 |
.__("The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria.",'yarpp')
|
@@ -42,7 +42,7 @@ if (!yarpp_get_option('myisam_override')) {
|
|
42 |
.__("Trust me. Let me use MyISAM features.",'yarpp')
|
43 |
."'></input></form>"
|
44 |
."</div>";
|
45 |
-
|
46 |
yarpp_set_option('title',1);
|
47 |
yarpp_set_option('body',1);
|
48 |
$yarpp_myisam = false;
|
@@ -63,7 +63,7 @@ if ($yarpp_myisam) {
|
|
63 |
echo '<div class="updated"><p>';
|
64 |
if (yarpp_activate())
|
65 |
_e('The YARPP database had an error but has been fixed.','yarpp');
|
66 |
-
else
|
67 |
__('The YARPP database has an error which could not be fixed.','yarpp')
|
68 |
.str_replace('<A>','<a href=\'http://mitcho.com/code/yarpp/sql.php?prefix='.urlencode($wpdb->prefix).'\'>',__('Please try <A>manual SQL setup</a>.','yarpp'));
|
69 |
echo '</div></p>';
|
@@ -80,25 +80,25 @@ if (isset($_POST['update_yarpp'])) {
|
|
80 |
foreach (array('title','body','tags','categories') as $key) {
|
81 |
if (!isset($_POST[$key])) yarpp_set_option($key,1);
|
82 |
}
|
83 |
-
if (isset($_POST['discats'])) {
|
84 |
yarpp_set_option('discats',implode(',',array_keys($_POST['discats']))); // discats is different
|
85 |
} else {
|
86 |
yarpp_set_option('discats','');
|
87 |
}
|
88 |
|
89 |
-
if (isset($_POST['distags'])) {
|
90 |
yarpp_set_option('distags',implode(',',array_keys($_POST['distags']))); // distags is also different
|
91 |
} else {
|
92 |
yarpp_set_option('distags','');
|
93 |
}
|
94 |
//update_option('yarpp_distags',implode(',',array_map('yarpp_unmapthetag',preg_split('!\s*[;,]\s*!',strtolower($_POST['distags']))))); // distags is even more different
|
95 |
-
|
96 |
foreach (array_keys($yarpp_binary_options) as $option) {
|
97 |
(isset($_POST[$option])) ? yarpp_set_option($option,1) : yarpp_set_option($option,0);
|
98 |
-
}
|
99 |
echo '<div class="updated fade"><p>'.__('Options saved!','yarpp').'</p></div>';
|
100 |
}
|
101 |
-
|
102 |
//compute $tagmap
|
103 |
$tagmap = array();
|
104 |
foreach ($wpdb->get_results("select $wpdb->terms.term_id, name from $wpdb->terms natural join $wpdb->term_taxonomy where $wpdb->term_taxonomy.taxonomy = 'category'") as $tag) {
|
@@ -130,19 +130,19 @@ function yarpp_options_textbox($option,$desc,$size=2,$tr="<tr valign='top'>
|
|
130 |
function yarpp_options_importance($option,$desc,$type='word',$tr="<tr valign='top'>
|
131 |
<th scope='row'>",$inputplus = '') {
|
132 |
$value = yarpp_get_option($option);
|
133 |
-
|
134 |
// $type could be...
|
135 |
__('word','yarpp');
|
136 |
__('tag','yarpp');
|
137 |
__('category','yarpp');
|
138 |
-
|
139 |
echo " $tr$desc</th>
|
140 |
<td>
|
141 |
<input $inputplus type='radio' name='$option' value='1'". (($value == 1) ? ' checked="checked"': '' )." /> ".__("do not consider",'yarpp')."
|
142 |
<input $inputplus type='radio' name='$option' value='2'". (($value == 2) ? ' checked="checked"': '' )." /> ".__("consider",'yarpp')."
|
143 |
-
<input $inputplus type='radio' name='$option' value='3'". (($value == 3) ? ' checked="checked"': '' )." />
|
144 |
".sprintf(__("require at least one %s in common",'yarpp'),__($type,'yarpp'))."
|
145 |
-
<input $inputplus type='radio' name='$option' value='4'". (($value == 4) ? ' checked="checked"': '' )." />
|
146 |
".sprintf(__("require more than one %s in common",'yarpp'),__($type,'yarpp'))."
|
147 |
</td>
|
148 |
</tr>";
|
@@ -166,7 +166,7 @@ function yarpp_options_select($option,$desc,$type='word',$tr="<tr valign='top'>
|
|
166 |
<th scope='row'>",$inputplus = '') {
|
167 |
echo " $tr$desc</th>
|
168 |
<td>
|
169 |
-
<input $inputplus type='radio' name='$option' value='1'". ((yarpp_get_option($option) == 1) ? ' checked="checked"': '' )." />
|
170 |
".__("do not consider",'yarpp')."
|
171 |
<input $inputplus type='radio' name='$option' value='2'". ((yarpp_get_option($option) == 2) ? ' checked="checked"': '' )." />
|
172 |
".__("consider",'yarpp')."
|
@@ -179,6 +179,11 @@ function yarpp_options_select($option,$desc,$type='word',$tr="<tr valign='top'>
|
|
179 |
}
|
180 |
|
181 |
?>
|
|
|
|
|
|
|
|
|
|
|
182 |
<script type="text/javascript">
|
183 |
//<!--
|
184 |
|
@@ -195,11 +200,13 @@ css.setAttribute("type", "text/css");
|
|
195 |
css.setAttribute("href", "../wp-content/plugins/yet-another-related-posts-plugin/options.css");
|
196 |
document.getElementsByTagName("head")[0].appendChild(css);
|
197 |
|
|
|
|
|
198 |
function load_display_demo_web() {
|
199 |
jQuery.ajax({type:'POST',
|
200 |
url:'admin-ajax.php',
|
201 |
data:'action=yarpp_display_demo_web',
|
202 |
-
beforeSend:function(){jQuery('#display_demo_web').eq(0).html('<img src="
|
203 |
success:function(html){jQuery('#display_demo_web').eq(0).html('<pre>'+html+'</pre>')},
|
204 |
dataType:'html'}
|
205 |
)
|
@@ -209,7 +216,7 @@ function load_display_demo_rss() {
|
|
209 |
jQuery.ajax({type:'POST',
|
210 |
url:'admin-ajax.php',
|
211 |
data:'action=yarpp_display_demo_rss',
|
212 |
-
beforeSend:function(){jQuery('#display_demo_rss').eq(0).html('<img src="
|
213 |
success:function(html){jQuery('#display_demo_rss').eq(0).html('<pre>'+html+'</pre>')},
|
214 |
dataType:'html'}
|
215 |
)
|
@@ -219,7 +226,7 @@ function load_display_distags() {
|
|
219 |
jQuery.ajax({type:'POST',
|
220 |
url:'admin-ajax.php',
|
221 |
data:'action=yarpp_display_distags',
|
222 |
-
beforeSend:function(){jQuery('#display_distags').eq(0).html('<img src="
|
223 |
success:function(html){jQuery('#display_distags').eq(0).html(html)},
|
224 |
dataType:'html'}
|
225 |
)
|
@@ -229,7 +236,7 @@ function load_display_discats() {
|
|
229 |
jQuery.ajax({type:'POST',
|
230 |
url:'admin-ajax.php',
|
231 |
data:'action=yarpp_display_discats',
|
232 |
-
beforeSend:function(){jQuery('#display_discats').eq(0).html('<img src="
|
233 |
success:function(html){jQuery('#display_discats').eq(0).html(html)},
|
234 |
dataType:'html'}
|
235 |
)
|
@@ -239,21 +246,28 @@ function load_display_discats() {
|
|
239 |
|
240 |
<div class="wrap">
|
241 |
<h2>
|
242 |
-
<?php _e('Yet Another Related Posts Plugin Options','yarpp');?> <small><?php
|
243 |
-
|
244 |
$display_version = yarpp_get_option('version');
|
245 |
echo $display_version;
|
246 |
?></small>
|
247 |
</h2>
|
248 |
|
249 |
<?php echo "<div id='yarpp-version' style='display:none;'>".yarpp_get_option('version')."</div>"; ?>
|
250 |
-
|
251 |
<form method="post">
|
252 |
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
-
<
|
256 |
|
|
|
257 |
|
258 |
<!-- <div style='border:1px solid #ddd;padding:8px;'>-->
|
259 |
<div id="poststuff" class="metabox-holder">
|
@@ -274,7 +288,7 @@ function load_display_discats() {
|
|
274 |
<h3 class='hndle'><span><?php _e('"The Pool"','yarpp');?></span></h3>
|
275 |
<div class='inside'>
|
276 |
<p><?php _e('"The Pool" refers to the pool of posts and pages that are candidates for display as related to the current entry.','yarpp');?></p>
|
277 |
-
|
278 |
<table class="form-table" style="margin-top: 0">
|
279 |
<tbody>
|
280 |
<tr valign='top'>
|
@@ -282,9 +296,9 @@ function load_display_discats() {
|
|
282 |
<tr valign='top'>
|
283 |
<th scope='row'><?php _e('Disallow by tag:','yarpp');?></th>
|
284 |
<td><div id='display_distags' style="overflow:auto;max-height:100px;"></div></td></tr>
|
285 |
-
<?php
|
286 |
yarpp_options_checkbox('show_pass_post',__("Show password protected posts?",'yarpp'));
|
287 |
-
|
288 |
$recent_number = "<input name=\"recent_number\" type=\"text\" id=\"recent_number\" value=\"".stripslashes(yarpp_get_option('recent_number',true))."\" size=\"2\" />";
|
289 |
$recent_units = "<select name=\"recent_units\" id=\"recent_units\">
|
290 |
<option value='day'". (('day'==yarpp_get_option('recent_units'))?" selected='selected'":'').">".__('day(s)','yarpp')."</option>
|
@@ -308,10 +322,10 @@ function load_display_discats() {
|
|
308 |
<div class='inside'>
|
309 |
|
310 |
<p><?php _e('YARPP is different than the <a href="http://wasabi.pbwiki.com/Related%20Entries">previous plugins it is based on</a> as it limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>.','yarpp');?> <a href="#" class='info'><?php _e('more>','yarpp');?><span><?php _e('The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshhold, take a look at some post\'s related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site.','yarpp');?></span></a></p>
|
311 |
-
|
312 |
<table class="form-table" style="margin-top: 0">
|
313 |
<tbody>
|
314 |
-
|
315 |
<?php
|
316 |
yarpp_options_textbox('threshold',__('Match threshold:','yarpp'));
|
317 |
yarpp_options_importance2('title',__("Titles: ",'yarpp'),'word',"<tr valign='top'>
|
@@ -348,7 +362,7 @@ function load_display_discats() {
|
|
348 |
else
|
349 |
jQuery('.excerpted').hide();
|
350 |
}
|
351 |
-
|
352 |
function rss_display() {
|
353 |
if (jQuery('.rss_display').eq(0).attr('checked'))
|
354 |
jQuery('.rss_displayed').show();
|
@@ -372,7 +386,7 @@ function load_display_discats() {
|
|
372 |
else
|
373 |
jQuery('.rss_excerpted').hide();
|
374 |
}
|
375 |
-
|
376 |
function yarpp_js_init() {
|
377 |
template();
|
378 |
rss_template();
|
@@ -380,8 +394,8 @@ function load_display_discats() {
|
|
380 |
load_display_distags();
|
381 |
load_display_demo_web();
|
382 |
load_display_demo_rss();
|
383 |
-
|
384 |
-
version = jQuery('#yarpp-version').html();
|
385 |
|
386 |
var json = <?php echo yarpp_check_version_json($display_version); ?>;
|
387 |
if (json.result == 'newbeta')
|
@@ -389,12 +403,10 @@ function load_display_discats() {
|
|
389 |
if (json.result == 'new')
|
390 |
jQuery('#yarpp-version').addClass('updated').html(<?php echo "'<p>".str_replace('VERSION',"'+json.current.version+'",str_replace('<A>',"<a href=\"'+json.current.url+'\">",addslashes(__("There is a new version (VERSION) of Yet Another Related Posts Plugin available! You can <A>download it here</a>.","yarpp"))))."</p>'"?>).show();
|
391 |
}
|
392 |
-
|
393 |
-
jQuery(document).ready(yarpp_js_init);
|
394 |
-
|
395 |
-
//-->
|
396 |
-
</script>
|
397 |
|
|
|
|
|
|
|
398 |
|
399 |
<!-- Display options -->
|
400 |
<div class='postbox'>
|
@@ -403,7 +415,7 @@ function load_display_discats() {
|
|
403 |
</div>
|
404 |
<h3 class='hndle'><span><?php _e("Display options <small>for your website</small>",'yarpp');?></span></h3>
|
405 |
<div class='inside'>
|
406 |
-
|
407 |
<table class="form-table" style="margin-top: 0;width:100%">
|
408 |
<?php
|
409 |
yarpp_options_checkbox('auto_display',__("Automatically display related posts?",'yarpp')." <a href='#' class='info'>".__('more>','yarpp')."<span>".__("This option automatically displays related posts right after the content on single entry pages. If this option is off, you will need to manually insert <code>related_posts()</code> or variants (<code>related_pages()</code> and <code>related_entries()</code>) into your theme files.",'yarpp')."</span></a>","<tr valign='top'>
|
@@ -435,7 +447,7 @@ yarpp_options_checkbox('auto_display',__("Automatically display related posts?",
|
|
435 |
<?php yarpp_options_checkbox('show_excerpt',__("Show excerpt?",'yarpp'),"<tr class='not_templated' valign='top'><th colspan='2'>",' class="show_excerpt" onclick="javascript:excerpt()"'); ?>
|
436 |
<?php yarpp_options_textbox('excerpt_length',__('Excerpt length (No. of words):','yarpp'),null,"<tr class='excerpted' valign='top'>
|
437 |
<th>")?>
|
438 |
-
|
439 |
<tr class="excerpted" valign='top'>
|
440 |
<th><?php _e("Before / after (Excerpt):",'yarpp');?></th>
|
441 |
<td><input name="before_post" type="text" id="before_post" value="<?php echo stripslashes(yarpp_get_option('before_post',true)); ?>" size="10" /> / <input name="after_post" type="text" id="after_post" value="<?php echo stripslashes(yarpp_get_option('after_post')); ?>" size="10" /><em><small> <?php _e("For example:",'yarpp');?> <li></li><?php _e(' or ','yarpp');?><dl></dl></small></em>
|
@@ -454,7 +466,7 @@ yarpp_options_checkbox('auto_display',__("Automatically display related posts?",
|
|
454 |
</select>
|
455 |
</td>
|
456 |
</tr>
|
457 |
-
|
458 |
<?php yarpp_options_textbox('no_results',__('Default display if no results:','yarpp'),'40',"<tr class='not_templated' valign='top'>
|
459 |
<th>")?>
|
460 |
<?php yarpp_options_checkbox('promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')
|
@@ -471,7 +483,7 @@ yarpp_options_checkbox('auto_display',__("Automatically display related posts?",
|
|
471 |
</div>
|
472 |
<h3 class='hndle'><span><?php _e("Display options <small>for RSS</small>",'yarpp');?></span></h3>
|
473 |
<div class='inside'>
|
474 |
-
|
475 |
<table class="form-table" style="margin-top: 0;width:100%">
|
476 |
<?php
|
477 |
|
@@ -504,7 +516,7 @@ yarpp_options_checkbox('rss_excerpt_display',__("Display related posts in the de
|
|
504 |
<?php yarpp_options_checkbox('rss_show_excerpt',__("Show excerpt?",'yarpp'),"<tr class='rss_not_templated' valign='top'><th colspan='2'>",' class="rss_show_excerpt" onclick="javascript:rss_excerpt()"'); ?>
|
505 |
<?php yarpp_options_textbox('rss_excerpt_length',__('Excerpt length (No. of words):','yarpp'),null,"<tr class='rss_excerpted' valign='top'>
|
506 |
<th>")?>
|
507 |
-
|
508 |
<tr class="rss_excerpted" valign='top'>
|
509 |
<th><?php _e("Before / after (excerpt):",'yarpp');?></th>
|
510 |
<td><input name="rss_before_post" type="text" id="rss_before_post" value="<?php echo stripslashes(yarpp_get_option('rss_before_post',true)); ?>" size="10" /> / <input name="rss_after_post" type="text" id="rss_after_post" value="<?php echo stripslashes(yarpp_get_option('rss_after_post')); ?>" size="10" /><em><small> <?php _e("For example:",'yarpp');?> <li></li><?php _e(' or ','yarpp');?><dl></dl></small></em>
|
@@ -523,7 +535,7 @@ yarpp_options_checkbox('rss_excerpt_display',__("Display related posts in the de
|
|
523 |
</select>
|
524 |
</td>
|
525 |
</tr>
|
526 |
-
|
527 |
<?php yarpp_options_textbox('rss_no_results',__('Default display if no results:','yarpp'),'40',"<tr valign='top' class='rss_not_templated'>
|
528 |
<th scope='row'>")?>
|
529 |
<?php yarpp_options_checkbox('rss_promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')." <a href='#' class='info'>".__('more>','yarpp')."<span>"
|
@@ -532,7 +544,9 @@ yarpp_options_checkbox('rss_excerpt_display',__("Display related posts in the de
|
|
532 |
</table>
|
533 |
</div>
|
534 |
</div>
|
535 |
-
|
|
|
|
|
536 |
<div>
|
537 |
<p class="submit">
|
538 |
<input type="submit" class='button-primary' name="update_yarpp" value="<?php _e("Update options",'yarpp')?>" />
|
1 |
<?php
|
2 |
|
3 |
+
global $wpdb, $yarpp_value_options, $yarpp_binary_options, $wp_version, $yarpp_cache;
|
4 |
|
5 |
// check to see that templates are in the right place
|
6 |
$yarpp_templateable = (count(glob(STYLESHEETPATH . '/yarpp-template-*.php')) > 0);
|
10 |
.str_replace("TEMPLATEPATH",STYLESHEETPATH,__("Please move the YARPP template files into your theme to complete installation. Simply move the sample template files (currently in <code>wp-content/plugins/yet-another-related-posts-plugin/yarpp-templates/</code>) to the <code>TEMPLATEPATH</code> directory.",'yarpp'))
|
11 |
."</div>";
|
12 |
|
13 |
+
else
|
14 |
echo "<div class='updated'>"
|
15 |
.str_replace('TEMPLATEPATH',STYLESHEETPATH,__("No YARPP template files were found in your theme (<code>TEMPLATEPATH</code>) so the templating feature has been turned off.",'yarpp'))
|
16 |
."</div>";
|
17 |
+
|
18 |
yarpp_set_option('use_template',false);
|
19 |
yarpp_set_option('rss_use_template',false);
|
20 |
+
|
21 |
}
|
22 |
|
23 |
+
if (isset($_POST['myisam_override'])) {
|
24 |
yarpp_set_option('myisam_override',1);
|
25 |
echo "<div class='updated'>"
|
26 |
.__("The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria.",'yarpp')
|
42 |
.__("Trust me. Let me use MyISAM features.",'yarpp')
|
43 |
."'></input></form>"
|
44 |
."</div>";
|
45 |
+
|
46 |
yarpp_set_option('title',1);
|
47 |
yarpp_set_option('body',1);
|
48 |
$yarpp_myisam = false;
|
63 |
echo '<div class="updated"><p>';
|
64 |
if (yarpp_activate())
|
65 |
_e('The YARPP database had an error but has been fixed.','yarpp');
|
66 |
+
else
|
67 |
__('The YARPP database has an error which could not be fixed.','yarpp')
|
68 |
.str_replace('<A>','<a href=\'http://mitcho.com/code/yarpp/sql.php?prefix='.urlencode($wpdb->prefix).'\'>',__('Please try <A>manual SQL setup</a>.','yarpp'));
|
69 |
echo '</div></p>';
|
80 |
foreach (array('title','body','tags','categories') as $key) {
|
81 |
if (!isset($_POST[$key])) yarpp_set_option($key,1);
|
82 |
}
|
83 |
+
if (isset($_POST['discats'])) {
|
84 |
yarpp_set_option('discats',implode(',',array_keys($_POST['discats']))); // discats is different
|
85 |
} else {
|
86 |
yarpp_set_option('discats','');
|
87 |
}
|
88 |
|
89 |
+
if (isset($_POST['distags'])) {
|
90 |
yarpp_set_option('distags',implode(',',array_keys($_POST['distags']))); // distags is also different
|
91 |
} else {
|
92 |
yarpp_set_option('distags','');
|
93 |
}
|
94 |
//update_option('yarpp_distags',implode(',',array_map('yarpp_unmapthetag',preg_split('!\s*[;,]\s*!',strtolower($_POST['distags']))))); // distags is even more different
|
95 |
+
|
96 |
foreach (array_keys($yarpp_binary_options) as $option) {
|
97 |
(isset($_POST[$option])) ? yarpp_set_option($option,1) : yarpp_set_option($option,0);
|
98 |
+
}
|
99 |
echo '<div class="updated fade"><p>'.__('Options saved!','yarpp').'</p></div>';
|
100 |
}
|
101 |
+
|
102 |
//compute $tagmap
|
103 |
$tagmap = array();
|
104 |
foreach ($wpdb->get_results("select $wpdb->terms.term_id, name from $wpdb->terms natural join $wpdb->term_taxonomy where $wpdb->term_taxonomy.taxonomy = 'category'") as $tag) {
|
130 |
function yarpp_options_importance($option,$desc,$type='word',$tr="<tr valign='top'>
|
131 |
<th scope='row'>",$inputplus = '') {
|
132 |
$value = yarpp_get_option($option);
|
133 |
+
|
134 |
// $type could be...
|
135 |
__('word','yarpp');
|
136 |
__('tag','yarpp');
|
137 |
__('category','yarpp');
|
138 |
+
|
139 |
echo " $tr$desc</th>
|
140 |
<td>
|
141 |
<input $inputplus type='radio' name='$option' value='1'". (($value == 1) ? ' checked="checked"': '' )." /> ".__("do not consider",'yarpp')."
|
142 |
<input $inputplus type='radio' name='$option' value='2'". (($value == 2) ? ' checked="checked"': '' )." /> ".__("consider",'yarpp')."
|
143 |
+
<input $inputplus type='radio' name='$option' value='3'". (($value == 3) ? ' checked="checked"': '' )." />
|
144 |
".sprintf(__("require at least one %s in common",'yarpp'),__($type,'yarpp'))."
|
145 |
+
<input $inputplus type='radio' name='$option' value='4'". (($value == 4) ? ' checked="checked"': '' )." />
|
146 |
".sprintf(__("require more than one %s in common",'yarpp'),__($type,'yarpp'))."
|
147 |
</td>
|
148 |
</tr>";
|
166 |
<th scope='row'>",$inputplus = '') {
|
167 |
echo " $tr$desc</th>
|
168 |
<td>
|
169 |
+
<input $inputplus type='radio' name='$option' value='1'". ((yarpp_get_option($option) == 1) ? ' checked="checked"': '' )." />
|
170 |
".__("do not consider",'yarpp')."
|
171 |
<input $inputplus type='radio' name='$option' value='2'". ((yarpp_get_option($option) == 2) ? ' checked="checked"': '' )." />
|
172 |
".__("consider",'yarpp')."
|
179 |
}
|
180 |
|
181 |
?>
|
182 |
+
<style type="text/css">
|
183 |
+
.form-table td {
|
184 |
+
line-height: 11px; /* to match the th's */
|
185 |
+
}
|
186 |
+
</style>
|
187 |
<script type="text/javascript">
|
188 |
//<!--
|
189 |
|
200 |
css.setAttribute("href", "../wp-content/plugins/yet-another-related-posts-plugin/options.css");
|
201 |
document.getElementsByTagName("head")[0].appendChild(css);
|
202 |
|
203 |
+
var spinner = '<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>';
|
204 |
+
|
205 |
function load_display_demo_web() {
|
206 |
jQuery.ajax({type:'POST',
|
207 |
url:'admin-ajax.php',
|
208 |
data:'action=yarpp_display_demo_web',
|
209 |
+
beforeSend:function(){jQuery('#display_demo_web').eq(0).html('<img src="' + spinner + '" alt="loading..."/>')},
|
210 |
success:function(html){jQuery('#display_demo_web').eq(0).html('<pre>'+html+'</pre>')},
|
211 |
dataType:'html'}
|
212 |
)
|
216 |
jQuery.ajax({type:'POST',
|
217 |
url:'admin-ajax.php',
|
218 |
data:'action=yarpp_display_demo_rss',
|
219 |
+
beforeSend:function(){jQuery('#display_demo_rss').eq(0).html('<img src="'+spinner+'" alt="loading..."/>')},
|
220 |
success:function(html){jQuery('#display_demo_rss').eq(0).html('<pre>'+html+'</pre>')},
|
221 |
dataType:'html'}
|
222 |
)
|
226 |
jQuery.ajax({type:'POST',
|
227 |
url:'admin-ajax.php',
|
228 |
data:'action=yarpp_display_distags',
|
229 |
+
beforeSend:function(){jQuery('#display_distags').eq(0).html('<img src="'+spinner+'" alt="loading..."/>')},
|
230 |
success:function(html){jQuery('#display_distags').eq(0).html(html)},
|
231 |
dataType:'html'}
|
232 |
)
|
236 |
jQuery.ajax({type:'POST',
|
237 |
url:'admin-ajax.php',
|
238 |
data:'action=yarpp_display_discats',
|
239 |
+
beforeSend:function(){jQuery('#display_discats').eq(0).html('<img src="'+spinner+'" alt="loading..."/>')},
|
240 |
success:function(html){jQuery('#display_discats').eq(0).html(html)},
|
241 |
dataType:'html'}
|
242 |
)
|
246 |
|
247 |
<div class="wrap">
|
248 |
<h2>
|
249 |
+
<?php _e('Yet Another Related Posts Plugin Options','yarpp');?> <small><?php
|
250 |
+
|
251 |
$display_version = yarpp_get_option('version');
|
252 |
echo $display_version;
|
253 |
?></small>
|
254 |
</h2>
|
255 |
|
256 |
<?php echo "<div id='yarpp-version' style='display:none;'>".yarpp_get_option('version')."</div>"; ?>
|
257 |
+
|
258 |
<form method="post">
|
259 |
|
260 |
+
<div>
|
261 |
+
<div id="badges" style="float:right">
|
262 |
+
<!--<small><a href="http://wordpress.org/tags/yet-another-related-posts-plugin" style="padding-right: 10px;">Support forums</a></small>-->
|
263 |
+
<script type="text/javascript">var WPHC_AFF_ID = "14336"; var WPHC_POSITION = "d1"; var WPHC_PRODUCT = "Yet Another Related Posts Plugin (<?php echo yarpp_get_option('version'); ?>)"; var WPHC_WP_VERSION = "<?php echo $wp_version; ?>";</script>
|
264 |
+
<script src="http://cloud.wphelpcenter.com/support-form/0001/deliver-a.js" type="text/javascript"></script>
|
265 |
+
<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=1&no_note=1&tax=0¤cy_code=USD&lc=US&charset=UTF%2d8' target='_new'><img src="https://www.paypal.com/<?php echo paypal_directory(); ?>i/btn/btn_donate_SM.gif" name="submit" alt="<?php _e('Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal');?>" title="<?php _e('Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal','yarpp');?>" style="padding-left: 10px;"/></a>
|
266 |
+
</div>
|
267 |
|
268 |
+
<small><?php _e('by <a href="http://mitcho.com/code/">mitcho (Michael 芳貴 Erlewine)</a>','yarpp');?>. <?php _e('Follow <a href="http://twitter.com/yarpp/">Yet Another Related Posts Plugin on Twitter</a>','yarpp');?>.</small>
|
269 |
|
270 |
+
</div>
|
271 |
|
272 |
<!-- <div style='border:1px solid #ddd;padding:8px;'>-->
|
273 |
<div id="poststuff" class="metabox-holder">
|
288 |
<h3 class='hndle'><span><?php _e('"The Pool"','yarpp');?></span></h3>
|
289 |
<div class='inside'>
|
290 |
<p><?php _e('"The Pool" refers to the pool of posts and pages that are candidates for display as related to the current entry.','yarpp');?></p>
|
291 |
+
|
292 |
<table class="form-table" style="margin-top: 0">
|
293 |
<tbody>
|
294 |
<tr valign='top'>
|
296 |
<tr valign='top'>
|
297 |
<th scope='row'><?php _e('Disallow by tag:','yarpp');?></th>
|
298 |
<td><div id='display_distags' style="overflow:auto;max-height:100px;"></div></td></tr>
|
299 |
+
<?php
|
300 |
yarpp_options_checkbox('show_pass_post',__("Show password protected posts?",'yarpp'));
|
301 |
+
|
302 |
$recent_number = "<input name=\"recent_number\" type=\"text\" id=\"recent_number\" value=\"".stripslashes(yarpp_get_option('recent_number',true))."\" size=\"2\" />";
|
303 |
$recent_units = "<select name=\"recent_units\" id=\"recent_units\">
|
304 |
<option value='day'". (('day'==yarpp_get_option('recent_units'))?" selected='selected'":'').">".__('day(s)','yarpp')."</option>
|
322 |
<div class='inside'>
|
323 |
|
324 |
<p><?php _e('YARPP is different than the <a href="http://wasabi.pbwiki.com/Related%20Entries">previous plugins it is based on</a> as it limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>.','yarpp');?> <a href="#" class='info'><?php _e('more>','yarpp');?><span><?php _e('The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshhold, take a look at some post\'s related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site.','yarpp');?></span></a></p>
|
325 |
+
|
326 |
<table class="form-table" style="margin-top: 0">
|
327 |
<tbody>
|
328 |
+
|
329 |
<?php
|
330 |
yarpp_options_textbox('threshold',__('Match threshold:','yarpp'));
|
331 |
yarpp_options_importance2('title',__("Titles: ",'yarpp'),'word',"<tr valign='top'>
|
362 |
else
|
363 |
jQuery('.excerpted').hide();
|
364 |
}
|
365 |
+
|
366 |
function rss_display() {
|
367 |
if (jQuery('.rss_display').eq(0).attr('checked'))
|
368 |
jQuery('.rss_displayed').show();
|
386 |
else
|
387 |
jQuery('.rss_excerpted').hide();
|
388 |
}
|
389 |
+
|
390 |
function yarpp_js_init() {
|
391 |
template();
|
392 |
rss_template();
|
394 |
load_display_distags();
|
395 |
load_display_demo_web();
|
396 |
load_display_demo_rss();
|
397 |
+
|
398 |
+
var version = jQuery('#yarpp-version').html();
|
399 |
|
400 |
var json = <?php echo yarpp_check_version_json($display_version); ?>;
|
401 |
if (json.result == 'newbeta')
|
403 |
if (json.result == 'new')
|
404 |
jQuery('#yarpp-version').addClass('updated').html(<?php echo "'<p>".str_replace('VERSION',"'+json.current.version+'",str_replace('<A>',"<a href=\"'+json.current.url+'\">",addslashes(__("There is a new version (VERSION) of Yet Another Related Posts Plugin available! You can <A>download it here</a>.","yarpp"))))."</p>'"?>).show();
|
405 |
}
|
|
|
|
|
|
|
|
|
|
|
406 |
|
407 |
+
jQuery(document).ready(yarpp_js_init);
|
408 |
+
//-->
|
409 |
+
</script>
|
410 |
|
411 |
<!-- Display options -->
|
412 |
<div class='postbox'>
|
415 |
</div>
|
416 |
<h3 class='hndle'><span><?php _e("Display options <small>for your website</small>",'yarpp');?></span></h3>
|
417 |
<div class='inside'>
|
418 |
+
|
419 |
<table class="form-table" style="margin-top: 0;width:100%">
|
420 |
<?php
|
421 |
yarpp_options_checkbox('auto_display',__("Automatically display related posts?",'yarpp')." <a href='#' class='info'>".__('more>','yarpp')."<span>".__("This option automatically displays related posts right after the content on single entry pages. If this option is off, you will need to manually insert <code>related_posts()</code> or variants (<code>related_pages()</code> and <code>related_entries()</code>) into your theme files.",'yarpp')."</span></a>","<tr valign='top'>
|
447 |
<?php yarpp_options_checkbox('show_excerpt',__("Show excerpt?",'yarpp'),"<tr class='not_templated' valign='top'><th colspan='2'>",' class="show_excerpt" onclick="javascript:excerpt()"'); ?>
|
448 |
<?php yarpp_options_textbox('excerpt_length',__('Excerpt length (No. of words):','yarpp'),null,"<tr class='excerpted' valign='top'>
|
449 |
<th>")?>
|
450 |
+
|
451 |
<tr class="excerpted" valign='top'>
|
452 |
<th><?php _e("Before / after (Excerpt):",'yarpp');?></th>
|
453 |
<td><input name="before_post" type="text" id="before_post" value="<?php echo stripslashes(yarpp_get_option('before_post',true)); ?>" size="10" /> / <input name="after_post" type="text" id="after_post" value="<?php echo stripslashes(yarpp_get_option('after_post')); ?>" size="10" /><em><small> <?php _e("For example:",'yarpp');?> <li></li><?php _e(' or ','yarpp');?><dl></dl></small></em>
|
466 |
</select>
|
467 |
</td>
|
468 |
</tr>
|
469 |
+
|
470 |
<?php yarpp_options_textbox('no_results',__('Default display if no results:','yarpp'),'40',"<tr class='not_templated' valign='top'>
|
471 |
<th>")?>
|
472 |
<?php yarpp_options_checkbox('promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')
|
483 |
</div>
|
484 |
<h3 class='hndle'><span><?php _e("Display options <small>for RSS</small>",'yarpp');?></span></h3>
|
485 |
<div class='inside'>
|
486 |
+
|
487 |
<table class="form-table" style="margin-top: 0;width:100%">
|
488 |
<?php
|
489 |
|
516 |
<?php yarpp_options_checkbox('rss_show_excerpt',__("Show excerpt?",'yarpp'),"<tr class='rss_not_templated' valign='top'><th colspan='2'>",' class="rss_show_excerpt" onclick="javascript:rss_excerpt()"'); ?>
|
517 |
<?php yarpp_options_textbox('rss_excerpt_length',__('Excerpt length (No. of words):','yarpp'),null,"<tr class='rss_excerpted' valign='top'>
|
518 |
<th>")?>
|
519 |
+
|
520 |
<tr class="rss_excerpted" valign='top'>
|
521 |
<th><?php _e("Before / after (excerpt):",'yarpp');?></th>
|
522 |
<td><input name="rss_before_post" type="text" id="rss_before_post" value="<?php echo stripslashes(yarpp_get_option('rss_before_post',true)); ?>" size="10" /> / <input name="rss_after_post" type="text" id="rss_after_post" value="<?php echo stripslashes(yarpp_get_option('rss_after_post')); ?>" size="10" /><em><small> <?php _e("For example:",'yarpp');?> <li></li><?php _e(' or ','yarpp');?><dl></dl></small></em>
|
535 |
</select>
|
536 |
</td>
|
537 |
</tr>
|
538 |
+
|
539 |
<?php yarpp_options_textbox('rss_no_results',__('Default display if no results:','yarpp'),'40',"<tr valign='top' class='rss_not_templated'>
|
540 |
<th scope='row'>")?>
|
541 |
<?php yarpp_options_checkbox('rss_promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')." <a href='#' class='info'>".__('more>','yarpp')."<span>"
|
544 |
</table>
|
545 |
</div>
|
546 |
</div>
|
547 |
+
|
548 |
+
<!--cache engine: <?php echo $yarpp_cache->name;?>; cache status: <?php echo $yarpp_cache->cache_status();?>-->
|
549 |
+
|
550 |
<div>
|
551 |
<p class="submit">
|
552 |
<input type="submit" class='button-primary' name="update_yarpp" value="<?php _e("Update options",'yarpp')?>" />
|
readme.txt
CHANGED
@@ -5,8 +5,8 @@ Author URI: http://mitcho.com/
|
|
5 |
Plugin URI: http://mitcho.com/code/yarpp/
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&charset=UTF%2d8
|
7 |
Tags: related, posts, post, pages, page, RSS, feed, feeds
|
8 |
-
Requires at least:
|
9 |
-
Tested up to: 3.0.
|
10 |
Stable tag: 3.1.9
|
11 |
|
12 |
Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
|
@@ -54,7 +54,7 @@ Make sure the "display related posts in feeds" option is turned on if you would
|
|
54 |
|
55 |
Related posts can also be displayed as a widget. Go to the Design > Widgets options page and add the Related Posts widget. The widget will only be displayed on single entry (permalink) pages. The widget can be used even if the "auto display" option is turned off.
|
56 |
|
57 |
-
= Custom display through templates =
|
58 |
|
59 |
New in version 3.0, YARPP allows the advanced user with knowledge of PHP to customize the display of related posts using a templating mechanism. More information is available [in this tutorial](http://mitcho.com/blog/projects/yarpp-3-templates/).
|
60 |
|
@@ -72,7 +72,7 @@ If you do not want to show the Related Posts display in its default position (ri
|
|
72 |
|
73 |
If you would like to add the Related Posts display elsewhere, follow these directions: (*Knowledge of PHP and familiarity with editing your WordPress theme files is required.*)
|
74 |
|
75 |
-
Edit your relevant theme file (most likely something like `single.php`) and add the PHP code `related_posts();` within [The Loop](http://codex.wordpress.org/The_Loop) where you want to display the related posts.
|
76 |
|
77 |
This method can also be used to display YARPP on pages other than single-post displays, such as on archive pages. There is a little more information on the [advanced manual installation page](http://mitcho.com/code/yarpp/manual-installation/).
|
78 |
|
@@ -139,13 +139,14 @@ I highly recommend you disactivate YARPP, replace it with the new one, and then
|
|
139 |
|
140 |
YARPP is currently localized in the following languages:
|
141 |
|
142 |
-
|
143 |
-
|
144 |
* Belarussian (`by_BY`) by [Fat Cow](http://www.fatcow.com)
|
145 |
* Bulgarian (`bg_BG`) by [Flash Gallery](www.flashgallery.org)
|
146 |
* Simplified Chinese (`zh_CN`) by Jor Wang (mail at jorwang dot com) of [jorwang.com](http://jorwang.com)
|
147 |
* Cypriot Greek (`el_CY`) by Aristidis Tonikidis (yarpp-el at mitcho dot com) of [akouseto.gr](http://www.akouseto.gr)
|
148 |
* Dutch (`nl_NL`) by Sybrand van der Werf (yarpp-nl at mitcho dot com)
|
|
|
149 |
* French (`fr_FR`) by Lionel Chollet (yarpp-fr at mitcho dot com)
|
150 |
* German (`de_DE`) by Michael Kalina (yarpp-de at mitcho dot com) of [3th.be](http://3th.be) - **we are now looking for a new German translator**
|
151 |
* Greek (`el_EL`) by Aristidis Tonikidis (yarpp-el at mitcho dot com) of [akouseto.gr](http://www.akouseto.gr)
|
@@ -157,14 +158,15 @@ YARPP is currently localized in the following languages:
|
|
157 |
* Latvian (`lv_LV`) by [Mike](http://antsar.info) (yarpp-lv at mitcho dot com)
|
158 |
* Lithuanian (`lt_LT`) by [Karolis Vyčius](http://vycius.co.cc) (yarpp-lt at mitcho dot com)
|
159 |
* Polish (`pl_PL`) by [Perfecta](http://perfecta.pro/wp-pl/)
|
|
|
160 |
* Brazilian Portuguese (`pt_BR`) by Rafael Fischmann (yarpp-ptBR at mitcho.com) of [macmagazine.br](http://macmagazine.com.br/)
|
161 |
* Russian (`ru_RU`) by Marat Latypov (yarpp-ru at mitcho.com) of [blogocms.ru](http://blogocms.ru)
|
162 |
* Swedish (`sv_SE`) by Max Elander (yarpp-sv at mitcho dot com)
|
163 |
-
* Turkish (`tr_TR`) by Nurullah (yarpp-tr at mitcho.com)
|
164 |
* Vietnamese (`vi_VN`) by Vu Nguyen (yarpp-vi at mitcho dot com) of [Rubik Integration](http://rubikintegration.com/)
|
165 |
* Ukrainian (`uk_UA`) by [Onore](http://Onore.kiev.ua) (Alexander Musevich) (yarpp-uk at mitcho dot com)
|
166 |
* Uzbek (`uz_UZ`) by Ali Safarov (yarpp-uz at mitcho dot com) of [comfi.com](http://www.comfi.com/)
|
167 |
-
|
168 |
We already have localizers lined up for the following languages:
|
169 |
|
170 |
* Danish
|
@@ -180,8 +182,15 @@ If you are a bilingual speaker of English and another language and an avid user
|
|
180 |
== Changelog ==
|
181 |
|
182 |
= 3.2 =
|
183 |
-
*
|
184 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
= 3.1.9 =
|
186 |
* Added Standard Arabic localization (`ar`) by [led](http://led24.de)
|
187 |
* The Related Posts Widget now can also use custom templates. ([#1143](http://plugins.trac.wordpress.org/ticket/1143))
|
@@ -333,7 +342,7 @@ If you are a bilingual speaker of English and another language and an avid user
|
|
333 |
* The "show excerpt" option now shows the first `n` words of the excerpt, rather than the content ([by request](http://wordpress.org/support/topic/212577))
|
334 |
* Added an `echo` parameter to the `related_*()` functions, with default value of `true`. If `false`, the function will simply return the output.
|
335 |
* Added support for the [AllWebMenus Pro](http://wordpress.org/extend/plugins/allwebmenus-wordpress-menu-plugin/) plugin
|
336 |
-
* Further internationalization:
|
337 |
* the donate button! ^^
|
338 |
* overused words lists ([by request](http://wordpress.org/support/topic/159359))), with a German word list.
|
339 |
= 2.1.3 =
|
5 |
Plugin URI: http://mitcho.com/code/yarpp/
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&charset=UTF%2d8
|
7 |
Tags: related, posts, post, pages, page, RSS, feed, feeds
|
8 |
+
Requires at least: 3.0
|
9 |
+
Tested up to: 3.0.4
|
10 |
Stable tag: 3.1.9
|
11 |
|
12 |
Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
|
54 |
|
55 |
Related posts can also be displayed as a widget. Go to the Design > Widgets options page and add the Related Posts widget. The widget will only be displayed on single entry (permalink) pages. The widget can be used even if the "auto display" option is turned off.
|
56 |
|
57 |
+
= Custom display through templates =
|
58 |
|
59 |
New in version 3.0, YARPP allows the advanced user with knowledge of PHP to customize the display of related posts using a templating mechanism. More information is available [in this tutorial](http://mitcho.com/blog/projects/yarpp-3-templates/).
|
60 |
|
72 |
|
73 |
If you would like to add the Related Posts display elsewhere, follow these directions: (*Knowledge of PHP and familiarity with editing your WordPress theme files is required.*)
|
74 |
|
75 |
+
Edit your relevant theme file (most likely something like `single.php`) and add the PHP code `related_posts();` within [The Loop](http://codex.wordpress.org/The_Loop) where you want to display the related posts.
|
76 |
|
77 |
This method can also be used to display YARPP on pages other than single-post displays, such as on archive pages. There is a little more information on the [advanced manual installation page](http://mitcho.com/code/yarpp/manual-installation/).
|
78 |
|
139 |
|
140 |
YARPP is currently localized in the following languages:
|
141 |
|
142 |
+
* Egyptian Arabic (`ar_EG`) by Bishoy Antoun (yarpp-ar at mitcho dot com) of [cdmazika.com](http://www.cdmazika.com).
|
143 |
+
* Standard Arabic (`ar`) by [led](http://led24.de) (yarpp-ar at mitcho dot com)
|
144 |
* Belarussian (`by_BY`) by [Fat Cow](http://www.fatcow.com)
|
145 |
* Bulgarian (`bg_BG`) by [Flash Gallery](www.flashgallery.org)
|
146 |
* Simplified Chinese (`zh_CN`) by Jor Wang (mail at jorwang dot com) of [jorwang.com](http://jorwang.com)
|
147 |
* Cypriot Greek (`el_CY`) by Aristidis Tonikidis (yarpp-el at mitcho dot com) of [akouseto.gr](http://www.akouseto.gr)
|
148 |
* Dutch (`nl_NL`) by Sybrand van der Werf (yarpp-nl at mitcho dot com)
|
149 |
+
* Farsi/Persian (`fa_IR`) by [Moshen Derakhshan](http://webdesigner.downloadkar.com/) (yarpp-fa at mitcho dot com)
|
150 |
* French (`fr_FR`) by Lionel Chollet (yarpp-fr at mitcho dot com)
|
151 |
* German (`de_DE`) by Michael Kalina (yarpp-de at mitcho dot com) of [3th.be](http://3th.be) - **we are now looking for a new German translator**
|
152 |
* Greek (`el_EL`) by Aristidis Tonikidis (yarpp-el at mitcho dot com) of [akouseto.gr](http://www.akouseto.gr)
|
158 |
* Latvian (`lv_LV`) by [Mike](http://antsar.info) (yarpp-lv at mitcho dot com)
|
159 |
* Lithuanian (`lt_LT`) by [Karolis Vyčius](http://vycius.co.cc) (yarpp-lt at mitcho dot com)
|
160 |
* Polish (`pl_PL`) by [Perfecta](http://perfecta.pro/wp-pl/)
|
161 |
+
* (European) Portuguese (`pt_PT`) by Stefan Mueller (yarpp-pt at mitcho.com) of [fernstadium-net](www.fernstudium-net.de)
|
162 |
* Brazilian Portuguese (`pt_BR`) by Rafael Fischmann (yarpp-ptBR at mitcho.com) of [macmagazine.br](http://macmagazine.com.br/)
|
163 |
* Russian (`ru_RU`) by Marat Latypov (yarpp-ru at mitcho.com) of [blogocms.ru](http://blogocms.ru)
|
164 |
* Swedish (`sv_SE`) by Max Elander (yarpp-sv at mitcho dot com)
|
165 |
+
* Turkish (`tr_TR`) by [Nurullah](http://www.ndemir.com) (yarpp-tr at mitcho.com)
|
166 |
* Vietnamese (`vi_VN`) by Vu Nguyen (yarpp-vi at mitcho dot com) of [Rubik Integration](http://rubikintegration.com/)
|
167 |
* Ukrainian (`uk_UA`) by [Onore](http://Onore.kiev.ua) (Alexander Musevich) (yarpp-uk at mitcho dot com)
|
168 |
* Uzbek (`uz_UZ`) by Ali Safarov (yarpp-uz at mitcho dot com) of [comfi.com](http://www.comfi.com/)
|
169 |
+
|
170 |
We already have localizers lined up for the following languages:
|
171 |
|
172 |
* Danish
|
182 |
== Changelog ==
|
183 |
|
184 |
= 3.2 =
|
185 |
+
* Better caching performance:
|
186 |
+
* Previously, the cache would never actually build up properly. This is now fixed. Thanks to Artefact for pointing this out.
|
187 |
+
* The appropriate caches are cleared after posts are deleted ([#1245](http://plugins.trac.wordpress.org/ticket/1245)).
|
188 |
+
* Caching is no longer performed while batch-importing posts.
|
189 |
+
* A new object-based abstraction for the caching system. YARPP by default uses custom database tables (same behavior as 3.1.x), but you now have an option to use the `postmeta` table instead. To use `postmeta` caching, add `define('YARPP_CACHE_TYPE', 'postmeta');` to your `wp-config.php` file.<!--YARPP no longer uses custom tables! Both custom tables (`yarpp_related_cache` and `yarpp_keywords_cache`) are automatically removed if you have them. WordPress Post Meta is used instead for caching.-->
|
190 |
+
* Added Bulgarian localization (`bg_BG`) by [Flash Gallery](www.flashgallery.org), Farsi/Persian localization (`fa_IR`) by [Moshen Derakhshan](http://webdesigner.downloadkar.com/), and Portuguese (`pt_PT`) by [Stefan Mueller](www.fernstudium-net.de).
|
191 |
+
* Added [WordPress HelpCenter](http://wphelpcenter.com/) widget for quick access to professional support.
|
192 |
+
* Some code cleanup (bug [#1246](http://plugins.trac.wordpress.org/ticket/1246))
|
193 |
+
* No longer supporting WordPress versions before 3.0, not because I suddenly started using something that requires 3.0, but in order to simplify testing.
|
194 |
= 3.1.9 =
|
195 |
* Added Standard Arabic localization (`ar`) by [led](http://led24.de)
|
196 |
* The Related Posts Widget now can also use custom templates. ([#1143](http://plugins.trac.wordpress.org/ticket/1143))
|
342 |
* The "show excerpt" option now shows the first `n` words of the excerpt, rather than the content ([by request](http://wordpress.org/support/topic/212577))
|
343 |
* Added an `echo` parameter to the `related_*()` functions, with default value of `true`. If `false`, the function will simply return the output.
|
344 |
* Added support for the [AllWebMenus Pro](http://wordpress.org/extend/plugins/allwebmenus-wordpress-menu-plugin/) plugin
|
345 |
+
* Further internationalization:
|
346 |
* the donate button! ^^
|
347 |
* overused words lists ([by request](http://wordpress.org/support/topic/159359))), with a German word list.
|
348 |
= 2.1.3 =
|
services.php
CHANGED
@@ -27,12 +27,12 @@ function yarpp_ajax_display_distags() {
|
|
27 |
}
|
28 |
exit;
|
29 |
}
|
30 |
-
|
31 |
function yarpp_ajax_display_demo_web() {
|
32 |
-
global $wpdb, $post, $
|
33 |
-
|
34 |
header("Content-Type: text/html; charset=UTF-8");
|
35 |
-
|
36 |
$yarpp_limit = yarpp_get_option('limit');
|
37 |
$return = yarpp_related(array('post'),array(),false,false,'demo_web');
|
38 |
unset($yarpp_limit);
|
@@ -41,10 +41,10 @@ function yarpp_ajax_display_demo_web() {
|
|
41 |
}
|
42 |
|
43 |
function yarpp_ajax_display_demo_rss() {
|
44 |
-
global $wpdb, $post, $
|
45 |
-
|
46 |
header("Content-Type: text/html; charset=utf-8");
|
47 |
-
|
48 |
$yarpp_limit = yarpp_get_option('rss_limit');
|
49 |
$return = yarpp_related(array('post'),array(),false,false,'demo_rss');
|
50 |
unset($yarpp_limit);
|
27 |
}
|
28 |
exit;
|
29 |
}
|
30 |
+
|
31 |
function yarpp_ajax_display_demo_web() {
|
32 |
+
global $wpdb, $post, $yarpp_demo_time, $wp_query, $id, $page, $pages, $yarpp_limit;
|
33 |
+
|
34 |
header("Content-Type: text/html; charset=UTF-8");
|
35 |
+
|
36 |
$yarpp_limit = yarpp_get_option('limit');
|
37 |
$return = yarpp_related(array('post'),array(),false,false,'demo_web');
|
38 |
unset($yarpp_limit);
|
41 |
}
|
42 |
|
43 |
function yarpp_ajax_display_demo_rss() {
|
44 |
+
global $wpdb, $post, $yarpp_demo_time, $wp_query, $id, $page, $pages, $yarpp_limit;
|
45 |
+
|
46 |
header("Content-Type: text/html; charset=utf-8");
|
47 |
+
|
48 |
$yarpp_limit = yarpp_get_option('rss_limit');
|
49 |
$return = yarpp_related(array('post'),array(),false,false,'demo_rss');
|
50 |
unset($yarpp_limit);
|
template-builtin.php
CHANGED
@@ -4,7 +4,7 @@ YARPP's built-in "template"
|
|
4 |
This "template" is used when you choose not to use a template.
|
5 |
|
6 |
If you want to create a new template, look at templates/template-example.php as an example.
|
7 |
-
*/
|
8 |
|
9 |
$options = array(
|
10 |
'before_title'=>"${domainprefix}before_title",
|
@@ -31,11 +31,11 @@ if ($related_query->have_posts()) {
|
|
31 |
$related_query->the_post();
|
32 |
|
33 |
$output .= "$before_title<a href='".get_permalink()."' rel='bookmark' title='Permanent Link: ".preg_replace('/\s*<br[ \/]*>\s*/i', ' ', get_the_title())."'>".get_the_title()."";
|
34 |
-
if (
|
35 |
$output .= ' <abbr title="'.sprintf(__('%f is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.','yarpp'),round(get_the_score(),3)).'">('.round(get_the_score(),3).')</abbr>';
|
36 |
$output .= '</a>';
|
37 |
if ($show_excerpt) {
|
38 |
-
$output .= $before_post .
|
39 |
yarpp_excerpt(get_the_excerpt(),$excerpt_length)
|
40 |
. $after_post;
|
41 |
}
|
4 |
This "template" is used when you choose not to use a template.
|
5 |
|
6 |
If you want to create a new template, look at templates/template-example.php as an example.
|
7 |
+
*/
|
8 |
|
9 |
$options = array(
|
10 |
'before_title'=>"${domainprefix}before_title",
|
31 |
$related_query->the_post();
|
32 |
|
33 |
$output .= "$before_title<a href='".get_permalink()."' rel='bookmark' title='Permanent Link: ".preg_replace('/\s*<br[ \/]*>\s*/i', ' ', get_the_title())."'>".get_the_title()."";
|
34 |
+
if (current_user_can('manage_options') && $domain != 'rss')
|
35 |
$output .= ' <abbr title="'.sprintf(__('%f is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.','yarpp'),round(get_the_score(),3)).'">('.round(get_the_score(),3).')</abbr>';
|
36 |
$output .= '</a>';
|
37 |
if ($show_excerpt) {
|
38 |
+
$output .= $before_post .
|
39 |
yarpp_excerpt(get_the_excerpt(),$excerpt_length)
|
40 |
. $after_post;
|
41 |
}
|
template-functions.php
CHANGED
@@ -9,5 +9,5 @@ function the_score() {
|
|
9 |
function get_the_score() { // returns the score
|
10 |
global $post;
|
11 |
$score = $post->score;
|
12 |
-
return apply_filters('get_the_score', $score
|
13 |
}
|
9 |
function get_the_score() { // returns the score
|
10 |
global $post;
|
11 |
$score = $post->score;
|
12 |
+
return apply_filters('get_the_score', $score);
|
13 |
}
|
template-metabox.php
CHANGED
@@ -2,10 +2,11 @@
|
|
2 |
|
3 |
yarpp_save_cache($reference_ID,false); // enforce the cache, but don't force it
|
4 |
|
5 |
-
$body_terms =
|
6 |
-
$title_terms =
|
7 |
|
8 |
-
|
|
|
9 |
if ($yarpp_debug) $output .= "<p>body keywords: $body_terms</p>";
|
10 |
if ($yarpp_debug) $output .= "<p>title keywords: $title_terms</p>";
|
11 |
|
2 |
|
3 |
yarpp_save_cache($reference_ID,false); // enforce the cache, but don't force it
|
4 |
|
5 |
+
$body_terms = $yarpp_cache->get_keywords($reference_ID,'body');
|
6 |
+
$title_terms = $yarpp_cache->get_keywords($reference_ID,'title');
|
7 |
|
8 |
+
// Disabled "last updated keywords" as it doesn't support postmeta storage
|
9 |
+
// if ($yarpp_debug) $output .= "<p>last updated keywords: ".$wpdb->get_var("select date from {$wpdb->prefix}yarpp_keyword_cache where ID = '$reference_ID'")."</p>";
|
10 |
if ($yarpp_debug) $output .= "<p>body keywords: $body_terms</p>";
|
11 |
if ($yarpp_debug) $output .= "<p>title keywords: $title_terms</p>";
|
12 |
|
yarpp-templates/yarpp-template-example.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php /*
|
2 |
Example template
|
3 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
4 |
-
*/
|
5 |
?><h3>Related Posts</h3>
|
6 |
<?php if ($related_query->have_posts()):?>
|
7 |
<ol>
|
1 |
<?php /*
|
2 |
Example template
|
3 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
4 |
+
*/
|
5 |
?><h3>Related Posts</h3>
|
6 |
<?php if ($related_query->have_posts()):?>
|
7 |
<ol>
|
yarpp-templates/yarpp-template-list.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
List template
|
3 |
This template returns the related posts as a comma-separated list.
|
4 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
5 |
-
*/
|
6 |
?><h3>Related Posts</h3>
|
7 |
|
8 |
<?php if ($related_query->have_posts()):
|
@@ -10,7 +10,7 @@ Author: mitcho (Michael Yoshitaka Erlewine)
|
|
10 |
while ($related_query->have_posts()) : $related_query->the_post();
|
11 |
$postsArray[] = '<a href="'.get_permalink().'" rel="bookmark">'.get_the_title().'</a><!-- ('.get_the_score().')-->';
|
12 |
endwhile;
|
13 |
-
|
14 |
echo implode(', '."\n",$postsArray); // print out a list of the related items, separated by commas
|
15 |
|
16 |
else:?>
|
2 |
List template
|
3 |
This template returns the related posts as a comma-separated list.
|
4 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
5 |
+
*/
|
6 |
?><h3>Related Posts</h3>
|
7 |
|
8 |
<?php if ($related_query->have_posts()):
|
10 |
while ($related_query->have_posts()) : $related_query->the_post();
|
11 |
$postsArray[] = '<a href="'.get_permalink().'" rel="bookmark">'.get_the_title().'</a><!-- ('.get_the_score().')-->';
|
12 |
endwhile;
|
13 |
+
|
14 |
echo implode(', '."\n",$postsArray); // print out a list of the related items, separated by commas
|
15 |
|
16 |
else:?>
|
yarpp-templates/yarpp-template-random.php
CHANGED
@@ -11,7 +11,7 @@ Author: mitcho (Michael Yoshitaka Erlewine)
|
|
11 |
<?php endwhile; ?>
|
12 |
</ol>
|
13 |
|
14 |
-
<?php else:
|
15 |
$related_query->query("orderby=rand&order=asc&limit=1");
|
16 |
$related_query->the_post();?>
|
17 |
<p>No related posts were found, so here's a consolation prize: <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>.</p>
|
11 |
<?php endwhile; ?>
|
12 |
</ol>
|
13 |
|
14 |
+
<?php else:
|
15 |
$related_query->query("orderby=rand&order=asc&limit=1");
|
16 |
$related_query->the_post();?>
|
17 |
<p>No related posts were found, so here's a consolation prize: <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>.</p>
|
yarpp-templates/yarpp-template-wpml.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php /*
|
2 |
Example template for use with WPML (WP Multilingual, http://wpml.org)
|
3 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
4 |
-
*/
|
5 |
|
6 |
if (function_exists("icl_register_string")) {
|
7 |
icl_register_string("Yet Another Related Posts Plugin","related posts header","Related Posts");
|
1 |
<?php /*
|
2 |
Example template for use with WPML (WP Multilingual, http://wpml.org)
|
3 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
4 |
+
*/
|
5 |
|
6 |
if (function_exists("icl_register_string")) {
|
7 |
icl_register_string("Yet Another Related Posts Plugin","related posts header","Related Posts");
|
yarpp.php
CHANGED
@@ -3,26 +3,33 @@
|
|
3 |
Plugin Name: Yet Another Related Posts Plugin
|
4 |
Plugin URI: http://mitcho.com/code/yarpp/
|
5 |
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
|
6 |
-
Version: 3.
|
7 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
8 |
Author URI: http://mitcho.com/
|
9 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&charset=UTF%2d8
|
10 |
*/
|
|
|
|
|
11 |
if (isset($_REQUEST['yarpp_debug']))
|
12 |
$yarpp_debug = true;
|
13 |
|
14 |
-
define('YARPP_VERSION','3.
|
15 |
define('YARPP_DIR',dirname(__FILE__));
|
16 |
|
17 |
-
define('YARPP_POSTMETA_TITLE_KEYWORDS_KEY','_yarpp_title_keywords');
|
18 |
-
define('YARPP_POSTMETA_BODY_KEYWORDS_KEY','_yarpp_body_keywords');
|
19 |
-
define('YARPP_POSTMETA_RELATED_KEY', '_yarpp_related');
|
20 |
-
define('YARPP_NO_RELATED', ':(');
|
21 |
-
|
22 |
require_once(YARPP_DIR.'/includes.php');
|
23 |
require_once(YARPP_DIR.'/related-functions.php');
|
24 |
require_once(YARPP_DIR.'/template-functions.php');
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
add_action('admin_menu','yarpp_admin_menu');
|
27 |
add_action('admin_print_scripts','yarpp_upgrade_check');
|
28 |
add_filter('the_content','yarpp_default',1200);
|
@@ -40,13 +47,8 @@ add_action( 'admin_menu', 'yarpp_add_metabox');
|
|
40 |
// update cache on save
|
41 |
add_action('save_post','yarpp_save_cache');
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
add_filter('posts_fields','yarpp_fields_filter');
|
46 |
-
add_filter('posts_request','yarpp_demo_request_filter');
|
47 |
-
add_filter('post_limits','yarpp_limit_filter');
|
48 |
-
add_action('parse_query','yarpp_set_score_override_flag'); // sets the score override flag.
|
49 |
|
50 |
-
//
|
51 |
-
|
52 |
-
$yarpp_debug = true;
|
3 |
Plugin Name: Yet Another Related Posts Plugin
|
4 |
Plugin URI: http://mitcho.com/code/yarpp/
|
5 |
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
|
6 |
+
Version: 3.2b3
|
7 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
8 |
Author URI: http://mitcho.com/
|
9 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&charset=UTF%2d8
|
10 |
*/
|
11 |
+
|
12 |
+
// set $yarpp_debug
|
13 |
if (isset($_REQUEST['yarpp_debug']))
|
14 |
$yarpp_debug = true;
|
15 |
|
16 |
+
define('YARPP_VERSION','3.2b3');
|
17 |
define('YARPP_DIR',dirname(__FILE__));
|
18 |
|
|
|
|
|
|
|
|
|
|
|
19 |
require_once(YARPP_DIR.'/includes.php');
|
20 |
require_once(YARPP_DIR.'/related-functions.php');
|
21 |
require_once(YARPP_DIR.'/template-functions.php');
|
22 |
|
23 |
+
// New in 3.2: load YARPP cache engine
|
24 |
+
// By default, this is tables, which uses custom db tables.
|
25 |
+
// Use postmeta instead and avoid custom tables by adding the following to wp-config:
|
26 |
+
// define('YARPP_CACHE_TYPE', 'postmeta');
|
27 |
+
if (!defined('YARPP_CACHE_TYPE'))
|
28 |
+
define('YARPP_CACHE_TYPE', 'tables');
|
29 |
+
require_once(YARPP_DIR . '/cache-' . YARPP_CACHE_TYPE . '.php');
|
30 |
+
$yarpp_cache = new $yarpp_storage_class;
|
31 |
+
|
32 |
+
// Setup admin
|
33 |
add_action('admin_menu','yarpp_admin_menu');
|
34 |
add_action('admin_print_scripts','yarpp_upgrade_check');
|
35 |
add_filter('the_content','yarpp_default',1200);
|
47 |
// update cache on save
|
48 |
add_action('save_post','yarpp_save_cache');
|
49 |
|
50 |
+
// new in 3.2: update cache on delete
|
51 |
+
add_action('delete_post','yarpp_delete_cache');
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
// sets the score override flag.
|
54 |
+
add_action('parse_query','yarpp_set_score_override_flag');
|
|