Yet Another Related Posts Plugin (YARPP) - Version 3.6b1

Version Description

Download this release

Release Info

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

Code changes from version 3.5.6 to 3.6b1

Files changed (8) hide show
  1. cache-tables.php +18 -36
  2. class-admin.php +11 -0
  3. class-core.php +126 -4
  4. js/options.js +26 -7
  5. options-meta-boxes.php +175 -209
  6. options.css +70 -17
  7. readme.txt +9 -1
  8. yarpp.php +2 -14
cache-tables.php CHANGED
@@ -3,7 +3,6 @@
3
$yarpp_storage_class = 'YARPP_Cache_Tables';
4
5
define('YARPP_TABLES_RELATED_TABLE', 'yarpp_related_cache');
6
- define('YARPP_TABLES_KEYWORDS_TABLE', 'yarpp_keyword_cache');
7
8
class YARPP_Cache_Tables extends YARPP_Cache {
9
public $name = "custom tables";
@@ -19,8 +18,7 @@ class YARPP_Cache_Tables extends YARPP_Cache {
19
global $wpdb;
20
// now check for the cache tables
21
$tabledata = $wpdb->get_col("show tables");
22
- if (in_array($wpdb->prefix . YARPP_TABLES_RELATED_TABLE,$tabledata) !== false &&
23
- in_array($wpdb->prefix . YARPP_TABLES_KEYWORDS_TABLE,$tabledata) !== false)
24
return true;
25
else
26
return false;
@@ -35,13 +33,6 @@ class YARPP_Cache_Tables extends YARPP_Cache {
35
if ( ! empty( $wpdb->collate ) )
36
$charset_collate .= " COLLATE $wpdb->collate";
37
38
- $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . "` (
39
- `ID` bigint(20) unsigned NOT NULL default '0',
40
- `body` text NOT NULL,
41
- `title` text NOT NULL,
42
- `date` timestamp NOT NULL default CURRENT_TIMESTAMP,
43
- PRIMARY KEY (`ID`)
44
- ) $charset_collate;");
45
$wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "` (
46
`reference_ID` bigint(20) unsigned NOT NULL default '0',
47
`ID` bigint(20) unsigned NOT NULL default '0',
@@ -69,6 +60,15 @@ class YARPP_Cache_Tables extends YARPP_Cache {
69
// flush object cache, as bad is_cached_* values were stored before
70
wp_cache_flush();
71
}
72
}
73
74
public function cache_status() {
@@ -199,7 +199,6 @@ class YARPP_Cache_Tables extends YARPP_Cache {
199
return;
200
201
$wpdb->query("delete from {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " where reference_ID in (".implode(',',$reference_IDs).")");
202
- $wpdb->query("delete from {$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . " where ID in (".implode(',',$reference_IDs).")");
203
// @since 3.5.2: clear is_cached_* values as well
204
foreach ( $reference_IDs as $id )
205
wp_cache_delete( 'is_cached_' . $id, 'yarpp' );
@@ -246,7 +245,6 @@ class YARPP_Cache_Tables extends YARPP_Cache {
246
public function flush() {
247
global $wpdb;
248
$wpdb->query("truncate table `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "`");
249
- $wpdb->query("truncate table `{$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . "`");
250
// @since 3.5.2: clear object cache, used for is_cached_* values
251
wp_cache_flush();
252
}
@@ -277,27 +275,6 @@ class YARPP_Cache_Tables extends YARPP_Cache {
277
return false;
278
}
279
280
- /**
281
- * KEYWORDS CACHE CONTROL
282
- */
283
- // @return (array) with body and title keywords
284
- private function cache_keywords($ID) {
285
- global $wpdb;
286
- $body_terms = $this->body_keywords($ID);
287
- $title_terms = $this->title_keywords($ID);
288
-
289
- if ( !empty($wpdb->dbh) && defined('DB_CHARSET') ) {
290
- if ( method_exists( $wpdb, 'set_charset' ) )
291
- $wpdb->set_charset( $wpdb->dbh, DB_CHARSET );
292
- else
293
- mysql_set_charset( DB_CHARSET, $wpdb->dbh );
294
- }
295
-
296
- $wpdb->query("insert into {$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . " (ID,body,title) values ($ID,'$body_terms ','$title_terms ') on duplicate key update date = now(), body = '$body_terms ', title = '$title_terms '");
297
-
298
- return array( 'body' => $body_terms, 'title' => $title_terms );
299
- }
300
-
301
// @param $ID (int)
302
// @param $type (string) body | title | all
303
// @return (string|array) depending on whether "all" were requested or not
@@ -307,9 +284,14 @@ class YARPP_Cache_Tables extends YARPP_Cache {
307
if ( !is_int($ID) )
308
return false;
309
310
- $keywords = $wpdb->get_row("select body, title from {$wpdb->prefix}" . YARPP_TABLES_KEYWORDS_TABLE . " where ID = $ID", ARRAY_A);
311
- if ( empty($keywords) ) // if empty, try caching them first.
312
- $keywords = $this->cache_keywords($ID);
313
314
if ( empty($keywords) )
315
return false;
3
$yarpp_storage_class = 'YARPP_Cache_Tables';
4
5
define('YARPP_TABLES_RELATED_TABLE', 'yarpp_related_cache');
6
7
class YARPP_Cache_Tables extends YARPP_Cache {
8
public $name = "custom tables";
18
global $wpdb;
19
// now check for the cache tables
20
$tabledata = $wpdb->get_col("show tables");
21
+ if (in_array($wpdb->prefix . YARPP_TABLES_RELATED_TABLE,$tabledata) !== false)
22
return true;
23
else
24
return false;
33
if ( ! empty( $wpdb->collate ) )
34
$charset_collate .= " COLLATE $wpdb->collate";
35
36
$wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "` (
37
`reference_ID` bigint(20) unsigned NOT NULL default '0',
38
`ID` bigint(20) unsigned NOT NULL default '0',
60
// flush object cache, as bad is_cached_* values were stored before
61
wp_cache_flush();
62
}
63
+ if ( $last_version && version_compare('3.6b1', $last_version) > 0 ) {
64
+ // remove keywords table
65
+ if ( defined('YARPP_TABLES_KEYWORDS_TABLE') )
66
+ $old_keywords_table = $wpdb->prefix . YARPP_TABLES_KEYWORDS_TABLE;
67
+ else
68
+ $old_keywords_table = $wpdb->prefix . 'yarpp_keyword_cache';
69
+
70
+ $wpdb->query("drop table if exists `$old_keywords_table`");
71
+ }
72
}
73
74
public function cache_status() {
199
return;
200
201
$wpdb->query("delete from {$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . " where reference_ID in (".implode(',',$reference_IDs).")");
202
// @since 3.5.2: clear is_cached_* values as well
203
foreach ( $reference_IDs as $id )
204
wp_cache_delete( 'is_cached_' . $id, 'yarpp' );
245
public function flush() {
246
global $wpdb;
247
$wpdb->query("truncate table `{$wpdb->prefix}" . YARPP_TABLES_RELATED_TABLE . "`");
248
// @since 3.5.2: clear object cache, used for is_cached_* values
249
wp_cache_flush();
250
}
275
return false;
276
}
277
278
// @param $ID (int)
279
// @param $type (string) body | title | all
280
// @return (string|array) depending on whether "all" were requested or not
284
if ( !is_int($ID) )
285
return false;
286
287
+ // @since 3.6: compute fresh each time, instead of using cache table.
288
+ // the old keyword cache would basically have to be recomputed every time the
289
+ // relatedness cache was recomputed, but no more, so there's no point in keeping
290
+ // these around separately.
291
+ $keywords = array(
292
+ 'body' => $this->body_keywords($ID),
293
+ 'title' => $this->title_keywords($ID)
294
+ );
295
296
if ( empty($keywords) )
297
return false;
class-admin.php CHANGED
@@ -85,6 +85,11 @@ class YARPP_Admin {
85
'title' => __('Developing with YARPP', 'yarpp'),
86
'callback' => array( &$this, 'help_dev' )
87
));
88
}
89
90
return $current_screen;
@@ -115,6 +120,11 @@ class YARPP_Admin {
115
echo '<a href="https://wordpress.org/extend/plugins/yet-another-related-posts-plugin/other_notes/">' . __(
116
'Developing with YARPP', 'yarpp') . '</a>';
117
}
118
119
// faux-markdown, required for the help text rendering
120
protected function markdown( $text ) {
@@ -154,6 +164,7 @@ class YARPP_Admin {
154
$screen = get_current_screen();
155
if ( !is_null($screen) && $screen->id == 'settings_page_yarpp' ) {
156
wp_enqueue_script( 'postbox' );
157
wp_enqueue_style( 'yarpp_options', plugins_url( 'options.css', __FILE__ ), array(), $version );
158
wp_enqueue_script( 'yarpp_options', plugins_url( 'js/options.js', __FILE__ ), array('jquery'), $version );
159
}
85
'title' => __('Developing with YARPP', 'yarpp'),
86
'callback' => array( &$this, 'help_dev' )
87
));
88
+ $current_screen->add_help_tab(array(
89
+ 'id' => 'optin',
90
+ 'title' => __('Optional Data Collection', 'yarpp'),
91
+ 'callback' => array( &$this, 'help_optin' )
92
+ ));
93
}
94
95
return $current_screen;
120
echo '<a href="https://wordpress.org/extend/plugins/yet-another-related-posts-plugin/other_notes/">' . __(
121
'Developing with YARPP', 'yarpp') . '</a>';
122
}
123
+
124
+ public function help_optin() {
125
+ // TODO: add text
126
+ echo 'rar';
127
+ }
128
129
// faux-markdown, required for the help text rendering
130
protected function markdown( $text ) {
164
$screen = get_current_screen();
165
if ( !is_null($screen) && $screen->id == 'settings_page_yarpp' ) {
166
wp_enqueue_script( 'postbox' );
167
+ $this->pointer_enqueue();
168
wp_enqueue_style( 'yarpp_options', plugins_url( 'options.css', __FILE__ ), array(), $version );
169
wp_enqueue_script( 'yarpp_options', plugins_url( 'js/options.js', __FILE__ ), array('jquery'), $version );
170
}
class-core.php CHANGED
@@ -103,7 +103,8 @@ class YARPP {
103
'post_tag' => 1
104
)
105
),
106
- 'require_tax' => array() // new in 3.5
107
);
108
}
109
@@ -191,6 +192,9 @@ class YARPP {
191
$this->activate();
192
else
193
$this->upgrade();
194
}
195
196
function activate() {
@@ -262,6 +266,7 @@ class YARPP {
262
$this->version_info(true);
263
264
update_option('yarpp_version',YARPP_VERSION);
265
}
266
267
function upgrade_3_4b2() {
@@ -518,6 +523,105 @@ class YARPP {
518
return $taxonomy->show_ui;
519
}
520
521
/*
522
* CORE LOOKUP + DISPLAY FUNCTIONS
523
*/
@@ -547,7 +651,7 @@ class YARPP {
547
548
$this->setup_active_cache( $args );
549
550
- $options = array( 'domain', 'limit', 'template', 'order', 'promote_yarpp' );
551
extract( $this->parse_args( $args, $options ) );
552
553
$cache_status = $this->active_cache->enforce($reference_ID);
@@ -610,6 +714,9 @@ class YARPP {
610
611
if ($promote_yarpp && $domain != 'metabox')
612
$output .= "\n<p>".sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org')."</p>";
613
614
if ($echo)
615
echo $output;
@@ -842,11 +949,11 @@ class YARPP {
842
* UTILS
843
*/
844
845
- // new in 3.3: use PHP serialized format instead of JSON
846
function version_info( $enforce_cache = false ) {
847
if (false === ($result = get_transient('yarpp_version_info')) || $enforce_cache) {
848
$version = YARPP_VERSION;
849
- $remote = wp_remote_post("http://mitcho.com/code/yarpp/checkversion.php?format=php&version={$version}");
850
851
if (is_wp_error($remote))
852
return false;
@@ -856,6 +963,21 @@ class YARPP {
856
}
857
return $result;
858
}
859
860
// 3.5.2: clean_pre is deprecated in WP 3.4, so implement here.
861
function clean_pre( $text ) {
103
'post_tag' => 1
104
)
105
),
106
+ 'require_tax' => array(), // new in 3.5
107
+ 'optin' => false // new in 3.6
108
);
109
}
110
192
$this->activate();
193
else
194
$this->upgrade();
195
+
196
+ if ( $this->get_option('optin') )
197
+ $this->optin_ping();
198
}
199
200
function activate() {
266
$this->version_info(true);
267
268
update_option('yarpp_version',YARPP_VERSION);
269
+ delete_transient( 'yarpp_optin' );
270
}
271
272
function upgrade_3_4b2() {
523
return $taxonomy->show_ui;
524
}
525
526
+ public function optin_data() {
527
+ global $wpdb, $yarpp;
528
+
529
+ $comments = wp_count_comments();
530
+ $users = count_users();
531
+
532
+ $settings = get_option( 'yarpp' );
533
+ $collect = array_flip(array(
534
+ 'threshold', 'limit', 'excerpt_length', 'recent', 'rss_limit',
535
+ 'rss_excerpt_length', 'past_only', 'show_excerpt', 'rss_show_excerpt',
536
+ 'template', 'rss_template', 'show_pass_post', 'cross_relate',
537
+ 'auto_display', 'rss_display', 'rss_excerpt_display', 'promote_yarpp',
538
+ 'rss_promote_yarpp', 'myisam_override', 'weight', 'require_tax'
539
+ ));
540
+ $check_changed = array(
541
+ 'before_title', 'after_title', 'before_post', 'after_post',
542
+ 'before_related', 'after_related', 'no_results', 'order',
543
+ 'rss_before_title', 'rss_after_title', 'rss_before_post', 'rss_after_post', 'rss_before_related', 'rss_after_related', 'rss_no_results', 'rss_order',
544
+ 'exclude'
545
+ );
546
+
547
+ $data = array(
548
+ 'versions' => array(
549
+ 'yarpp' => YARPP_VERSION,
550
+ 'wp' => get_bloginfo( 'version' ),
551
+ 'php' => phpversion()
552
+ ),
553
+ 'yarpp' => array(
554
+ 'settings' => array_intersect_key( $settings, $collect ),
555
+ 'cache_engine' => YARPP_CACHE_TYPE
556
+ ),
557
+ 'stats' => array(
558
+ 'counts' => array(),
559
+ 'terms' => array(),
560
+ 'comments' => array(
561
+ 'moderated' => $comments->moderated,
562
+ 'approved' => $comments->approved,
563
+ 'total' => $comments->total_comments,
564
+ 'posts' => $wpdb->get_var( "select count(ID) from $wpdb->posts where post_type = 'post' and comment_count > 0" )
565
+ ),
566
+ 'users' => $wpdb->get_var("select count(ID) from $wpdb->users"),
567
+ ),
568
+ 'locale' => get_bloginfo( 'language' ),
569
+ 'url' => get_bloginfo('url'),
570
+ 'plugins' => array(
571
+ 'active' => implode( '|', get_option( 'active_plugins', array() ) ),
572
+ 'sitewide' => implode( '|', get_site_option( 'active_sitewide_plugins', array() ) )
573
+ )
574
+ );
575
+
576
+ $changed = array();
577
+ foreach ( $check_changed as $key ) {
578
+ if ( $yarpp->default_options[$key] != $settings[$key] )
579
+ $changed[] = $key;
580
+ }
581
+ $data['yarpp']['changed_settings'] = implode( '|', $changed );
582
+
583
+ if ( method_exists( $yarpp->cache, 'cache_status' ) )
584
+ $data['yarpp']['cache_status'] = $yarpp->cache->cache_status();
585
+ if ( method_exists( $yarpp->cache, 'stats' ) ) {
586
+ $stats = $yarpp->cache->stats();
587
+ $flattened = array();
588
+ foreach ( $stats as $key => $value )
589
+ $flattened[] = "$key:$value";
590
+ $data['yarpp']['stats'] = implode( '|', $flattened );
591
+ }
592
+
593
+ if ( method_exists( $wpdb, 'db_version' ) )
594
+ $data['versions']['mysql'] = preg_replace('/[^0-9.].*/', '', $wpdb->db_version());
595
+
596
+ $counts = array();
597
+ foreach (get_post_types( array('public' => true) ) as $post_type) {
598
+ $counts[$post_type] = wp_count_posts($post_type);
599
+ }
600
+ $data['stats']['counts'] = wp_list_pluck($counts, 'publish');
601
+
602
+ foreach (get_taxonomies( array('public' => true) ) as $taxonomy) {
603
+ $data['stats']['terms'][$taxonomy] = wp_count_terms($taxonomy);
604
+ }
605
+
606
+ if ( is_multisite() ) {
607
+ $data['multisite'] = array(
608
+ 'url' => network_site_url(),
609
+ 'users' => get_user_count(),
610
+ 'sites' => get_blog_count()
611
+ );
612
+ }
613
+
614
+ return $data;
615
+ }
616
+
617
+ function pretty_echo( $data ) {
618
+ echo "<pre>";
619
+ $formatted = print_r($data, true);
620
+ $formatted = str_replace(array('Array', '(', ')', "\n "), array('', '', '', "\n"), $formatted);
621
+ echo preg_replace("/\n\s*\n/u", "\n", $formatted);
622
+ echo "</pre>";
623
+ }
624
+
625
/*
626
* CORE LOOKUP + DISPLAY FUNCTIONS
627
*/
651
652
$this->setup_active_cache( $args );
653
654
+ $options = array( 'domain', 'limit', 'template', 'order', 'promote_yarpp', 'optin' );
655
extract( $this->parse_args( $args, $options ) );
656
657
$cache_status = $this->active_cache->enforce($reference_ID);
714
715
if ($promote_yarpp && $domain != 'metabox')
716
$output .= "\n<p>".sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org')."</p>";
717
+
718
+ if ( $optin )
719
+ $output .= "<img src='http://yarpp.org/pixel.png?" . md5(get_bloginfo('url')) . "'/>\n";
720
721
if ($echo)
722
echo $output;
949
* UTILS
950
*/
951
952
+ // @since 3.3: use PHP serialized format instead of JSON
953
function version_info( $enforce_cache = false ) {
954
if (false === ($result = get_transient('yarpp_version_info')) || $enforce_cache) {
955
$version = YARPP_VERSION;
956
+ $remote = wp_remote_post("http://yarpp.org/checkversion.php?format=php&version={$version}");
957
958
if (is_wp_error($remote))
959
return false;
963
}
964
return $result;
965
}
966
+
967
+ // @since 3.6: optional collection of (default off)
968
+ function optin_ping() {
969
+ if ( get_transient( 'yarpp_optin' ) )
970
+ return true;
971
+
972
+ $remote = wp_remote_post( 'http://yarpp.org/optin/1/', array( 'body' => $this->optin_data() ) );
973
+
974
+ if ( is_wp_error($remote) )
975
+ return false;
976
+
977
+ if ( $result = $remote['body'] )
978
+ set_transient( 'yarpp_optin', $result, 60 * 60 * 24 * 7 );
979
+ }
980
+
981
982
// 3.5.2: clean_pre is deprecated in WP 3.4, so implement here.
983
function clean_pre( $text ) {
js/options.js CHANGED
@@ -16,12 +16,12 @@ jQuery(function($) {
16
template();
17
18
function excerpt() {
19
- if (!$('.template').attr('checked') && $('.show_excerpt').attr('checked'))
20
$('.excerpted').show();
21
else
22
$('.excerpted').hide();
23
}
24
- $('.show_excerpt,.template').click(excerpt);
25
26
var loaded_demo_web = false;
27
function display() {
@@ -49,7 +49,7 @@ jQuery(function($) {
49
function rss_display() {
50
if ( !$('#yarpp_display_rss .inside').is(':visible') )
51
return;
52
- if ($('.rss_display').attr('checked')) {
53
$('.rss_displayed').show();
54
if ( !loaded_demo_rss ) {
55
loaded_demo_rss = true;
@@ -70,7 +70,7 @@ jQuery(function($) {
70
$('.rss_displayed').hide();
71
}
72
}
73
- $('.rss_display, #yarpp_display_rss .handlediv, #yarpp_display_rss-hide').click(rss_display);
74
rss_display();
75
76
function rss_template() {
@@ -86,12 +86,12 @@ jQuery(function($) {
86
$('.rss_template').click(rss_template);
87
88
function rss_excerpt() {
89
- if ($('.rss_display').attr('checked') && $('.rss_show_excerpt').attr('checked'))
90
$('.rss_excerpted').show();
91
else
92
$('.rss_excerpted').hide();
93
}
94
- $('.rss_display,.rss_show_excerpt').click(rss_excerpt);
95
96
var loaded_disallows = false;
97
function load_disallows() {
@@ -143,7 +143,7 @@ jQuery(function($) {
143
taxonomy = id.replace('exclude_','');
144
145
load_disallow(taxonomy);
146
- $('#exclude_' + taxonomy).parent('.scroll_wrapper').scroll(function() {
147
var parent = $(this),
148
content = parent.children('div');
149
if ( parent.scrollTop() + parent.height() > content.height() - 10 )
@@ -154,4 +154,23 @@ jQuery(function($) {
154
}
155
$('#yarpp_pool .handlediv, #yarpp_pool-hide').click(load_disallows);
156
load_disallows();
157
});
16
template();
17
18
function excerpt() {
19
+ if (!$('.template').attr('checked') && $('#yarpp-show_excerpt').attr('checked'))
20
$('.excerpted').show();
21
else
22
$('.excerpted').hide();
23
}
24
+ $('#yarpp-show_excerpt, .template').click(excerpt);
25
26
var loaded_demo_web = false;
27
function display() {
49
function rss_display() {
50
if ( !$('#yarpp_display_rss .inside').is(':visible') )
51
return;
52
+ if ($('#yarpp-rss_display').attr('checked')) {
53
$('.rss_displayed').show();
54
if ( !loaded_demo_rss ) {
55
loaded_demo_rss = true;
70
$('.rss_displayed').hide();
71
}
72
}
73
+ $('#yarpp-rss_display, #yarpp_display_rss .handlediv, #yarpp_display_rss-hide').click(rss_display);
74
rss_display();
75
76
function rss_template() {
86
$('.rss_template').click(rss_template);
87
88
function rss_excerpt() {
89
+ if ($('#yarpp-rss_display').attr('checked') && $('#yarpp-rss_show_excerpt').attr('checked'))
90
$('.rss_excerpted').show();
91
else
92
$('.rss_excerpted').hide();
93
}
94
+ $('#yarpp-rss_display, #yarpp-rss_show_excerpt').click(rss_excerpt);
95
96
var loaded_disallows = false;
97
function load_disallows() {
143
taxonomy = id.replace('exclude_','');
144
145
load_disallow(taxonomy);
146
+ $('#exclude_' + taxonomy).parent('.yarpp_scroll_wrapper').scroll(function() {
147
var parent = $(this),
148
content = parent.children('div');
149
if ( parent.scrollTop() + parent.height() > content.height() - 10 )
154
}
155
$('#yarpp_pool .handlediv, #yarpp_pool-hide').click(load_disallows);
156
load_disallows();
157
+
158
+ $('#yarpp-optin-learnmore').click(function() {
159
+ $('#tab-link-optin a').click();
160
+ $('#contextual-help-link').click();
161
+ });
162
+
163
+ $('.yarpp_help[data-help]').hover(function() {
164
+ var help = '<p>' + $(this).attr('data-help') + '</p>',
165
+ options = {
166
+ content: help,
167
+ position: {
168
+ edge: 'left',
169
+ align: 'center',
170
+ of: $(this)
171
+ }};
172
+
173
+ var pointer = $(this).pointer(options).pointer('open');
174
+ $(this).closest('.yarpp_form_row, p').mouseleave(function () { pointer.pointer('close'); });
175
+ });
176
});
options-meta-boxes.php CHANGED
@@ -1,146 +1,153 @@
1
<?php
2
3
class YARPP_Meta_Box {
4
- function checkbox($option,$desc,$tr="<tr valign='top'><th class='th-full' colspan='2' scope='row'>",$inputplus = '',$thplus='') {
5
- echo "$tr<input $inputplus type='checkbox' name='$option' value='true'";
6
checked(yarpp_get_option($option) == 1);
7
- echo " /> $desc</th>$thplus
8
- </tr>";
9
}
10
- function template_checkbox( $rss = false, $trextra = '' ) {
11
global $yarpp;
12
$pre = $rss ? 'rss_' : '';
13
$chosen_template = yarpp_get_option( "{$pre}template" );
14
- echo "<tr valign='top'{$trextra}><th colspan='2'><input type='checkbox' name='{$pre}use_template' class='{$pre}template' value='true'";
15
disabled(!count($yarpp->admin->get_templates()), true);
16
checked( !!$chosen_template );
17
- echo " /> " . __("Display using a custom template file",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("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.",'yarpp')."</span></a>" . "</th></tr>";
18
}
19
- function textbox($option,$desc,$size=2,$tr="<tr valign='top'>
20
- <th scope='row'>", $note = '') {
21
$value = esc_attr(yarpp_get_option($option));
22
- echo " $tr$desc</th>
23
- <td><input name='$option' type='text' id='$option' value='$value' size='$size' />";
24
if ( !empty($note) )
25
echo " <em><small>{$note}</small></em>";
26
- echo "</td>
27
- </tr>";
28
}
29
- function beforeafter($options,$desc,$size=10,$tr="<tr valign='top'>
30
- <th scope='row'>", $note = '') {
31
- echo " $tr$desc</th>
32
- <td>";
33
$value = esc_attr(yarpp_get_option($options[0]));
34
- echo "<input name='{$options[0]}' type='text' id='{$options[0]}' value='$value' size='$size' /> / ";
35
$value = esc_attr(yarpp_get_option($options[1]));
36
echo "<input name='{$options[1]}' type='text' id='{$options[1]}' value='$value' size='$size' />";
37
if ( !empty($note) )
38
echo " <em><small>{$note}</small></em>";
39
- echo "</td>
40
- </tr>";
41
}
42
43
function tax_weight($taxonomy) {
44
$weight = (int) yarpp_get_option("weight[tax][{$taxonomy->name}]");
45
$require = (int) yarpp_get_option("require_tax[{$taxonomy->name}]");
46
- echo "<tr valign='top'><th scope='row'>{$taxonomy->labels->name}:</th><td><select name='weight[tax][{$taxonomy->name}]'>";
47
echo "<option value='no'". ((!$weight && !$require) ? ' selected="selected"': '' )." > " . __("do not consider",'yarpp') . "</option>";
48
echo "<option value='consider'". (($weight == 1 && !$require) ? ' selected="selected"': '' )." >" . __("consider",'yarpp') . "</option>";
49
echo "<option value='consider_extra'". (($weight > 1 && !$require) ? ' selected="selected"': '' )." >" . __("consider with extra weight",'yarpp') . "</option>";
50
echo "<option value='require_one'". (($require == 1) ? ' selected="selected"': '' )." >" . sprintf(__("require at least one %s in common",'yarpp'),$taxonomy->labels->singular_name) . "</option>";
51
echo "<option value='require_more'". (($require == 2) ? ' selected="selected"': '' )." >" . sprintf(__("require more than one %s in common",'yarpp'),$taxonomy->labels->singular_name) . "</option>";
52
- echo "</select></td></tr>";
53
}
54
55
- function weight($option,$desc,$tr="<tr valign='top'><th scope='row'>",$inputplus = '') {
56
$weight = (int) yarpp_get_option("weight[$option]");
57
- echo "$tr$desc</th><td>";
58
echo "<select name='weight[$option]'>";
59
- echo "<option $inputplus value='no'". (!$weight ? ' selected="selected"': '' )." >".__("do not consider",'yarpp')."</option>";
60
- echo "<option $inputplus value='consider'". (($weight == 1) ? ' selected="selected"': '' )." > ".__("consider",'yarpp')."</option>";
61
- echo "<option $inputplus value='consider_extra'". (($weight > 1) ? ' selected="selected"': '' )." > ".__("consider with extra weight",'yarpp')."</option>";
62
- echo "</select></td></tr>";
63
}
64
65
function displayorder( $option, $class = '' ) {
66
- ?>
67
- <tr<?php if (!empty($class)) echo " class='$class'"; ?> valign='top'>
68
- <th><?php _e("Order results:",'yarpp');?></th>
69
- <td><select name="<?php echo $option; ?>" id="<?php echo $option; ?>">
70
- <?php $order = yarpp_get_option($option); ?>
71
- <option value="score DESC" <?php echo ($order == 'score DESC'?' selected="selected"':'')?>><?php _e("score (high relevance to low)",'yarpp');?></option>
72
- <option value="score ASC" <?php echo ($order == 'score ASC'?' selected="selected"':'')?>><?php _e("score (low relevance to high)",'yarpp');?></option>
73
- <option value="post_date DESC" <?php echo ($order == 'post_date DESC'?' selected="selected"':'')?>><?php _e("date (new to old)",'yarpp');?></option>
74
- <option value="post_date ASC" <?php echo ($order == 'post_date ASC'?' selected="selected"':'')?>><?php _e("date (old to new)",'yarpp');?></option>
75
- <option value="post_title ASC" <?php echo ($order == 'post_title ASC'?' selected="selected"':'')?>><?php _e("title (alphabetical)",'yarpp');?></option>
76
- <option value="post_title DESC" <?php echo ($order == 'post_title DESC'?' selected="selected"':'')?>><?php _e("title (reverse alphabetical)",'yarpp');?></option>
77
- </select>
78
- </td>
79
- </tr>
80
- <?php
81
}
82
}
83
84
class YARPP_Meta_Box_Pool extends YARPP_Meta_Box {
85
function exclude($taxonomy, $string) {
86
global $yarpp;
87
- ?>
88
- <tr valign='top'>
89
- <th scope='row'><?php echo $string; ?></th>
90
- <td><div class='scroll_wrapper' style="overflow:auto;max-height:100px;"><div class='exclude_terms' id='exclude_<?php echo $taxonomy; ?>'>
91
- <?php
92
- $exclude_tt_ids = wp_parse_id_list(yarpp_get_option('exclude'));
93
- $exclude_term_ids = $yarpp->admin->get_term_ids_from_tt_ids( $taxonomy, $exclude_tt_ids );
94
- if ( count($exclude_term_ids) ) {
95
- $terms = get_terms($taxonomy, array('include' => $exclude_term_ids));
96
- foreach ($terms as $term) {
97
- echo "<input type='checkbox' name='exclude[{$term->term_taxonomy_id}]' id='exclude_{$term->term_taxonomy_id}' value='true' checked='checked' /> <label for='exclude_{$term->term_taxonomy_id}'>" . esc_html($term->name) . "</label> ";
98
- }
99
- }
100
- ?>
101
- </div></div></td>
102
- </tr>
103
- <?php
104
}
105
106
function display() {
107
global $yarpp;
108
- ?>
109
- <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>
110
111
- <table class="form-table" style="margin-top: 0; clear:none;">
112
- <tbody>
113
- <tr><th><?php _e('Post types considered:', 'yarpp'); ?></th><td><?php echo implode(', ', $yarpp->get_post_types( 'label' )); ?> <a href='http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/other_notes'><?php _e('more&gt;','yarpp');?></a></td></tr>
114
- <?php
115
- foreach ($yarpp->get_taxonomies() as $taxonomy) {
116
- $this->exclude($taxonomy->name, sprintf(__('Disallow by %s:','yarpp'), $taxonomy->labels->singular_name));
117
- }
118
- $this->checkbox('show_pass_post',__("Show password protected posts?",'yarpp'));
119
-
120
- $recent = yarpp_get_option('recent');
121
- if ( !!$recent ) {
122
- list($recent_number, $recent_units) = explode(' ', $recent);
123
- } else {
124
- $recent_number = 12;
125
- $recent_units = 'month';
126
- }
127
- $recent_number = "<input name=\"recent_number\" type=\"text\" id=\"recent_number\" value=\"".esc_attr($recent_number)."\" size=\"2\" />";
128
- $recent_units = "<select name=\"recent_units\" id=\"recent_units\">
129
- <option value='day'". (('day'==$recent_units)?" selected='selected'":'').">".__('day(s)','yarpp')."</option>
130
- <option value='week'". (('week'==$recent_units)?" selected='selected'":'').">".__('week(s)','yarpp')."</option>
131
- <option value='month'". (('month'==$recent_units)?" selected='selected'":'').">".__('month(s)','yarpp')."</option>
132
- </select>";
133
-
134
- echo "<tr valign='top'><th class='th-full' colspan='2' scope='row'><input type='checkbox' name='recent_only' value='true'";
135
- checked(!!$recent);
136
- echo " /> ";
137
- echo str_replace('NUMBER',$recent_number,str_replace('UNITS',$recent_units,__("Show only posts from the past NUMBER UNITS",'yarpp')));
138
- echo "</th></tr>";
139
-
140
- ?>
141
- </tbody>
142
- </table>
143
- <?php
144
}
145
}
146
@@ -149,29 +156,20 @@ add_meta_box('yarpp_pool', __('"The Pool"','yarpp'), array(new YARPP_Meta_Box_Po
149
class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
150
function display() {
151
global $yarpp;
152
- ?>
153
- <p><?php _e('YARPP 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&gt;','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>
154
-
155
- <table class="form-table" style="margin-top: 0; clear:none;">
156
- <tbody>
157
-
158
- <?php
159
- $this->textbox('threshold',__('Match threshold:','yarpp'));
160
- $this->weight('title',__("Titles: ",'yarpp'),"<tr valign='top'>
161
- <th scope='row'>",( !$yarpp->myisam ? ' readonly="readonly" disabled="disabled"':'' ));
162
- $this->weight('body',__("Bodies: ",'yarpp'),"<tr valign='top'>
163
- <th scope='row'>",( !$yarpp->myisam ? ' readonly="readonly" disabled="disabled"':'' ));
164
-
165
- foreach ($yarpp->get_taxonomies() as $taxonomy) {
166
- $this->tax_weight($taxonomy);
167
- }
168
169
- $this->checkbox('cross_relate',__("Display results from all post types",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("When \"display results from all post types\" is off, only posts will be displayed as related to a post, only pages will be displayed as related to a page, etc.",'yarpp')."</span></a>");
170
- $this->checkbox('past_only',__("Show only previous posts?",'yarpp'));
171
- ?>
172
- </tbody>
173
- </table>
174
- <?php
175
}
176
}
177
@@ -180,56 +178,28 @@ add_meta_box('yarpp_relatedness', __('"Relatedness" options','yarpp'), array(new
180
class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
181
function display() {
182
global $yarpp;
183
- ?>
184
- <table class="form-table" style="margin-top: 0; clear:none;">
185
- <tbody>
186
- <?php
187
- $this->checkbox('auto_display',__("Automatically display related posts?",'yarpp')." <a href='#' class='info'>".__('more&gt;','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'>
188
- <th class='th-full' colspan='2' scope='row' style='width:100%;'>",'','<td rowspan="3" style="border-left:8px transparent solid;"><b>'.__("Website display code example",'yarpp').'</b><br /><small>'.__("(Update options to reload.)",'yarpp').'</small><br/>'
189
- ."<div id='display_demo_web' style='overflow:auto;width:350px;max-height:500px;'></div></td>");
190
$this->textbox('limit',__('Maximum number of related posts:','yarpp'));
191
$this->template_checkbox( false );
192
- ?>
193
- </tbody></table>
194
- <table class="form-table" style="clear:none;"><tbody>
195
- <tr valign='top' class='templated'>
196
- <th><?php _e("Template file:",'yarpp');?></th>
197
- <td>
198
- <select name="template_file" id="template_file">
199
- <?php
200
- $chosen_template = yarpp_get_option('template');
201
- foreach ($yarpp->admin->get_templates() as $template): ?>
202
- <option value='<?php echo esc_attr($template)?>'<?php selected($template, $chosen_template);?>><?php echo esc_html($template)?></option>
203
- <?php endforeach; ?>
204
- </select>
205
- </td>
206
- </tr>
207
- <?php
208
- $this->beforeafter(array('before_related', 'after_related'),__("Before / after related entries:",'yarpp'),15,"<tr class='not_templated' valign='top'>\r\t\t\t\t<th>", __("For example:",'yarpp') . ' &lt;ol&gt;&lt;/ol&gt;' . __(' or ','yarpp') . '&lt;div&gt;&lt;/div&gt;');
209
- $this->beforeafter(array('before_title', 'after_title'),__("Before / after each related entry:",'yarpp'),15,"<tr class='not_templated' valign='top'>\r\t\t\t\t<th>", __("For example:",'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ','yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
210
-
211
- $this->checkbox('show_excerpt',__("Show excerpt?",'yarpp'),"<tr class='not_templated' valign='top'><th colspan='2'>",' class="show_excerpt"');
212
- $this->textbox('excerpt_length',__('Excerpt length (No. of words):','yarpp'),10,"<tr class='excerpted' valign='top'>
213
- <th>")?>
214
-
215
- <tr class="excerpted" valign='top'>
216
- <th><?php _e("Before / after (Excerpt):",'yarpp');?></th>
217
- <td><input name="before_post" type="text" id="before_post" value="<?php echo esc_attr(yarpp_get_option('before_post')); ?>" size="10" /> / <input name="after_post" type="text" id="after_post" value="<?php echo esc_attr(yarpp_get_option('after_post')); ?>" size="10" /><em><small> <?php _e("For example:",'yarpp');?> &lt;li&gt;&lt;/li&gt;<?php _e(' or ','yarpp');?>&lt;dl&gt;&lt;/dl&gt;</small></em>
218
- </td>
219
- </tr>
220
-
221
- <?php
222
- $this->displayorder('order');
223
-
224
- $this->textbox('no_results',__('Default display if no results:','yarpp'),'40',"<tr class='not_templated' valign='top'>
225
- <th>");
226
-
227
- $this->checkbox('promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')
228
- ." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>"
229
- .sprintf(__("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.", 'yarpp'),"<code>".htmlspecialchars(sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org'))."</code>") ."</span></a>"); ?>
230
- </tbody>
231
- </table>
232
- <?php
233
}
234
}
235
@@ -238,53 +208,29 @@ add_meta_box('yarpp_display_web', __('Display options <small>for your website</s
238
class YARPP_Meta_Box_Display_Feed extends YARPP_Meta_Box {
239
function display() {
240
global $yarpp;
241
- ?>
242
- <table class="form-table" style="margin-top: 0; clear:none;"><tbody>
243
- <?php
244
245
- $this->checkbox('rss_display',__("Display related posts in feeds?",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2' style='width:100%'>",' class="rss_display"','<td class="rss_displayed" rowspan="4" style="border-left:8px transparent solid;"><b>'.__("RSS display code example",'yarpp').'</b><br /><small>'.__("(Update options to reload.)",'yarpp').'</small><br/>'
246
- ."<div id='display_demo_rss' style='overflow:auto;width:350px;max-height:500px;'></div></td>");
247
- $this->checkbox('rss_excerpt_display',__("Display related posts in the descriptions?",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("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.",'yarpp')."</span></a>","<tr class='rss_displayed' valign='top'>
248
- <th class='th-full' colspan='2' scope='row'>");
249
-
250
- $this->textbox('rss_limit',__('Maximum number of related posts:','yarpp'),2, "<tr valign='top' class='rss_displayed'>
251
- <th scope='row'>");
252
- $this->template_checkbox( true, " class='rss_displayed'" );
253
- ?>
254
- </tbody></table>
255
- <table class="form-table rss_displayed" style="clear:none;">
256
- <tbody>
257
- <tr valign='top' class='rss_templated'>
258
- <th><?php _e("Template file:",'yarpp');?></th>
259
- <td>
260
- <select name="rss_template_file" id="rss_template_file">
261
- <?php
262
- $chosen_template = yarpp_get_option('rss_template');
263
- foreach ($yarpp->admin->get_templates() as $template): ?>
264
- <option value='<?php echo esc_attr($template);?>'<?php selected($template, $chosen_template);?>><?php echo esc_html($template);?></option>
265
- <?php endforeach; ?>
266
- </select>
267
- </td>
268
- </tr>
269
-
270
- <?php
271
- $this->beforeafter(array('rss_before_related', 'rss_after_related'),__("Before / after related entries:",'yarpp'),15,"<tr class='rss_not_templated' valign='top'>\r\t\t\t\t<th>", __("For example:",'yarpp') . ' &lt;ol&gt;&lt;/ol&gt;' . __(' or ','yarpp') . '&lt;div&gt;&lt;/div&gt;');
272
- $this->beforeafter(array('rss_before_title', 'rss_after_title'),__("Before / after each related entry:",'yarpp'),15,"<tr class='rss_not_templated' valign='top'>\r\t\t\t\t<th>", __("For example:",'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ','yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
273
274
- $this->checkbox('rss_show_excerpt',__("Show excerpt?",'yarpp'),"<tr class='rss_not_templated' valign='top'><th colspan='2'>",' class="rss_show_excerpt"');
275
- $this->textbox('rss_excerpt_length',__('Excerpt length (No. of words):','yarpp'),10,"<tr class='rss_excerpted' valign='top'>\r\t\t\t\t<th>");
276
-
277
- $this->beforeafter(array('rss_before_post', 'rss_after_post'),__("Before / after (excerpt):",'yarpp'),10,"<tr class='rss_excerpted' valign='top'>\r\t\t\t\t<th>", __("For example:",'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ','yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
278
279
- $this->displayorder('rss_order', 'rss_displayed');
280
281
- $this->textbox('rss_no_results',__('Default display if no results:','yarpp'),'40',"<tr valign='top' class='rss_not_templated'>
282
- <th scope='row'>")?>
283
- <?php $this->checkbox('rss_promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')." <a href='#' class='info'>".__('more&gt;','yarpp')."<span>"
284
- .sprintf(__("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.", 'yarpp'),"<code>".htmlspecialchars(sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org'))."</code>") ."</span></a>","<tr valign='top' class='rss_displayed'>
285
- <th class='th-full' colspan='2' scope='row'>"); ?>
286
- </tbody></table>
287
- <?php
288
}
289
}
290
@@ -299,7 +245,7 @@ class YARPP_Meta_Box_Contact extends YARPP_Meta_Box {
299
<li><a href="http://wordpress.org/support/plugin/yet-another-related-posts-plugin" target="_blank"><span class='icon icon-wordpress'></span> <?php _e('YARPP Forum', 'yarpp'); ?></a></li>
300
<li><a href="http://twitter.com/yarpp" target="_blank"><span class='icon icon-twitter'></span> <?php _e('YARPP on Twitter', 'yarpp'); ?></a></li>
301
<li><a href="http://yarpp.org" target="_blank"><span class='icon icon-plugin'></span> <?php _e('YARPP on the Web', 'yarpp'); ?></a></li>
302
- <li><a href="http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/" target="_blank"><span class='icon icon-star <?php if ($yarpp->is_happy()) echo 'spin'; ?>'></span> <?php _e('Rate YARPP on WordPress.org', 'yarpp'); ?></a></li>
303
<li><a href='http://tinyurl.com/donatetomitcho' target='_new'><span class='icon icon-paypal'></span> <img src="https://www.paypal.com/<?php echo $this->paypal_lang(); ?>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');?>"/></a></li>
304
</ul>
305
<?php
@@ -334,6 +280,26 @@ class YARPP_Meta_Box_Contact extends YARPP_Meta_Box {
334
}
335
}
336
337
add_meta_box('yarpp_display_contact', __('Contact YARPP','yarpp'), array(new YARPP_Meta_Box_Contact, 'display'), 'settings_page_yarpp', 'side', 'core');
338
339
// since 3.3: hook for registering new YARPP meta boxes
1
<?php
2
3
class YARPP_Meta_Box {
4
+ function checkbox($option, $desc, $class = '') {
5
+ echo "<div class='yarpp_form_row yarpp_form_checkbox $class'><div scope='row'>";
6
+ echo "<input type='checkbox' name='$option' id='yarpp-$option' value='true'";
7
checked(yarpp_get_option($option) == 1);
8
+ echo " /> <label for='yarpp-$option'>$desc</label></div></div>";
9
}
10
+ function template_checkbox( $rss = false, $class = '' ) {
11
global $yarpp;
12
$pre = $rss ? 'rss_' : '';
13
$chosen_template = yarpp_get_option( "{$pre}template" );
14
+ echo "<div class='yarpp_form_row $class'><div><input type='checkbox' name='{$pre}use_template' class='{$pre}template' value='true'";
15
disabled(!count($yarpp->admin->get_templates()), true);
16
checked( !!$chosen_template );
17
+ echo " /> <label for='yarpp-{$pre}use_template'>" . __("Display using a custom template file",'yarpp')." <span class='yarpp_help' data-help='" . esc_attr(__("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.",'yarpp')) . "'>&nbsp;</span>" . "</label></div></div>";
18
}
19
+ function template_file( $rss = false, $class = '' ) {
20
+ global $yarpp;
21
+ $pre = $rss ? 'rss_' : '';
22
+ echo "<div class='yarpp_form_row $class'><div class='yarpp_form_label'>";
23
+ _e("Template file:",'yarpp');
24
+ echo "</div><div><select name='{$pre}template_file' id='{$pre}template_file'>";
25
+ $chosen_template = yarpp_get_option("{$pre}template");
26
+ foreach ($yarpp->admin->get_templates() as $template): ?>
27
+ <option value='<?php echo esc_attr($template)?>'<?php selected($template, $chosen_template);?>><?php echo esc_html($template)?></option>
28
+ <?php endforeach;
29
+ echo "</select></div></div>";
30
+ }
31
+ function textbox($option, $desc, $size=2, $class='', $note = '') {
32
$value = esc_attr(yarpp_get_option($option));
33
+ echo "<div class='yarpp_form_row yarpp_form_textbox $class'><div class='yarpp_form_label'>";
34
+ echo "$desc</div>
35
+ <div><input name='$option' type='text' id='$option' value='$value' size='$size' />";
36
if ( !empty($note) )
37
echo " <em><small>{$note}</small></em>";
38
+ echo "</div></div>";
39
}
40
+ function beforeafter($options, $desc, $size=10, $class='', $note = '') {
41
+ echo "<div class='yarpp_form_row yarpp_form_textbox $class'><div class='yarpp_form_label'>$desc</div><div>";
42
$value = esc_attr(yarpp_get_option($options[0]));
43
+ echo "<input name='{$options[0]}' type='text' id='{$options[0]}' value='$value' size='$size' /> <span class='yarpp_divider'>/</span> ";
44
$value = esc_attr(yarpp_get_option($options[1]));
45
echo "<input name='{$options[1]}' type='text' id='{$options[1]}' value='$value' size='$size' />";
46
if ( !empty($note) )
47
echo " <em><small>{$note}</small></em>";
48
+ echo "</div></div>";
49
}
50
51
function tax_weight($taxonomy) {
52
$weight = (int) yarpp_get_option("weight[tax][{$taxonomy->name}]");
53
$require = (int) yarpp_get_option("require_tax[{$taxonomy->name}]");
54
+ echo "<div class='yarpp_form_row yarpp_form_select'><div class='yarpp_form_label'>{$taxonomy->labels->name}:</div><div><select name='weight[tax][{$taxonomy->name}]'>";
55
echo "<option value='no'". ((!$weight && !$require) ? ' selected="selected"': '' )." > " . __("do not consider",'yarpp') . "</option>";
56
echo "<option value='consider'". (($weight == 1 && !$require) ? ' selected="selected"': '' )." >" . __("consider",'yarpp') . "</option>";
57
echo "<option value='consider_extra'". (($weight > 1 && !$require) ? ' selected="selected"': '' )." >" . __("consider with extra weight",'yarpp') . "</option>";
58
echo "<option value='require_one'". (($require == 1) ? ' selected="selected"': '' )." >" . sprintf(__("require at least one %s in common",'yarpp'),$taxonomy->labels->singular_name) . "</option>";
59
echo "<option value='require_more'". (($require == 2) ? ' selected="selected"': '' )." >" . sprintf(__("require more than one %s in common",'yarpp'),$taxonomy->labels->singular_name) . "</option>";
60
+ echo "</select></div></div>";
61
}
62
63
+ function weight($option, $desc) {
64
+ global $yarpp;
65
+
66
$weight = (int) yarpp_get_option("weight[$option]");
67
+
68
+ // both require MyISAM fulltext indexing:
69
+ $myisam = !$yarpp->myisam ? ' readonly="readonly" disabled="disabled"' : '';
70
+
71
+ echo "<div class='yarpp_form_row yarpp_form_select'><div class='yarpp_form_label'>$desc</div><div>";
72
echo "<select name='weight[$option]'>";
73
+ echo "<option $myisam value='no'". (!$weight ? ' selected="selected"': '' )." >".__("do not consider",'yarpp')."</option>";
74
+ echo "<option $myisam value='consider'". (($weight == 1) ? ' selected="selected"': '' )." > ".__("consider",'yarpp')."</option>";
75
+ echo "<option $myisam value='consider_extra'". (($weight > 1) ? ' selected="selected"': '' )." > ".__("consider with extra weight",'yarpp')."</option>";
76
+ echo "</select></div></div>";
77
}
78
79
function displayorder( $option, $class = '' ) {
80
+ echo "<div class='yarpp_form_row yarpp_form_select $class'><div class='yarpp_form_label'>";
81
+ _e("Order results:",'yarpp');
82
+ echo "</div><div><select name='$option' id='<?php echo $option; ?>'>";
83
+ $order = yarpp_get_option($option);
84
+ ?>
85
+ <option value="score DESC" <?php echo ($order == 'score DESC'?' selected="selected"':'')?>><?php _e("score (high relevance to low)",'yarpp');?></option>
86
+ <option value="score ASC" <?php echo ($order == 'score ASC'?' selected="selected"':'')?>><?php _e("score (low relevance to high)",'yarpp');?></option>
87
+ <option value="post_date DESC" <?php echo ($order == 'post_date DESC'?' selected="selected"':'')?>><?php _e("date (new to old)",'yarpp');?></option>
88
+ <option value="post_date ASC" <?php echo ($order == 'post_date ASC'?' selected="selected"':'')?>><?php _e("date (old to new)",'yarpp');?></option>
89
+ <option value="post_title ASC" <?php echo ($order == 'post_title ASC'?' selected="selected"':'')?>><?php _e("title (alphabetical)",'yarpp');?></option>
90
+ <option value="post_title DESC" <?php echo ($order == 'post_title DESC'?' selected="selected"':'')?>><?php _e("title (reverse alphabetical)",'yarpp');?></option>
91
+ <?php
92
+ echo "</select></div></div>";
93
}
94
}
95
96
class YARPP_Meta_Box_Pool extends YARPP_Meta_Box {
97
function exclude($taxonomy, $string) {
98
global $yarpp;
99
+
100
+ echo "<div class='yarpp_form_row yarpp_form_exclude'><div class='yarpp_form_label'>";
101
+ echo $string;
102
+ echo "</div><div class='yarpp_scroll_wrapper'><div class='exclude_terms' id='exclude_{$taxonomy}'>";
103
+
104
+ $exclude_tt_ids = wp_parse_id_list(yarpp_get_option('exclude'));
105
+ $exclude_term_ids = $yarpp->admin->get_term_ids_from_tt_ids( $taxonomy, $exclude_tt_ids );
106
+ if ( count($exclude_term_ids) ) {
107
+ $terms = get_terms($taxonomy, array('include' => $exclude_term_ids));
108
+ foreach ($terms as $term) {
109
+ echo "<input type='checkbox' name='exclude[{$term->term_taxonomy_id}]' id='exclude_{$term->term_taxonomy_id}' value='true' checked='checked' /> <label for='exclude_{$term->term_taxonomy_id}'>" . esc_html($term->name) . "</label> ";
110
+ }
111
+ }
112
+
113
+ echo "</div></div></div>";
114
}
115
116
function display() {
117
global $yarpp;
118
119
+ echo "<p>";
120
+ _e('"The Pool" refers to the pool of posts and pages that are candidates for display as related to the current entry.','yarpp');
121
+ echo "</p>\n";
122
+ ?>
123
+ <div class='yarpp_form_row'><div class='yarpp_form_label'><?php _e('Post types considered:', 'yarpp'); ?></div><div><?php echo implode(', ', $yarpp->get_post_types( 'label' )); ?> <a href='http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/other_notes' class='yarpp_help'>&nbsp;</a></div></div>
124
+
125
+ <?php
126
+ foreach ($yarpp->get_taxonomies() as $taxonomy) {
127
+ $this->exclude($taxonomy->name, sprintf(__('Disallow by %s:','yarpp'), $taxonomy->labels->singular_name));
128
+ }
129
+ $this->checkbox('show_pass_post',__("Show password protected posts?",'yarpp'));
130
+
131
+ $recent = yarpp_get_option('recent');
132
+ if ( !!$recent ) {
133
+ list($recent_number, $recent_units) = explode(' ', $recent);
134
+ } else {
135
+ $recent_number = 12;
136
+ $recent_units = 'month';
137
+ }
138
+ $recent_number = "<input name=\"recent_number\" type=\"text\" id=\"recent_number\" value=\"".esc_attr($recent_number)."\" size=\"2\" />";
139
+ $recent_units = "<select name=\"recent_units\" id=\"recent_units\">
140
+ <option value='day'". (('day'==$recent_units)?" selected='selected'":'').">".__('day(s)','yarpp')."</option>
141
+ <option value='week'". (('week'==$recent_units)?" selected='selected'":'').">".__('week(s)','yarpp')."</option>
142
+ <option value='month'". (('month'==$recent_units)?" selected='selected'":'').">".__('month(s)','yarpp')."</option>
143
+ </select>";
144
+
145
+ echo "<div class='yarpp_form_row yarpp_form_checkbox'><div><input type='checkbox' name='recent_only' value='true'";
146
+ checked(!!$recent);
147
+ echo " /> ";
148
+ echo str_replace('NUMBER',$recent_number,str_replace('UNITS',$recent_units,__("Show only posts from the past NUMBER UNITS",'yarpp')));
149
+ echo "</div></div>";
150
+
151
}
152
}
153
156
class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
157
function display() {
158
global $yarpp;
159
+ ?>
160
+ <p><?php _e('YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>.','yarpp');?> <span class='yarpp_help' data-help="<?php echo esc_attr(__('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'));?>">&nbsp;</span></p>
161
162
+ <?php
163
+ $this->textbox( 'threshold', __('Match threshold:','yarpp') );
164
+ $this->weight( 'title', __("Titles: ",'yarpp') );
165
+ $this->weight( 'body', __("Bodies: ",'yarpp') );
166
+
167
+ foreach ($yarpp->get_taxonomies() as $taxonomy) {
168
+ $this->tax_weight($taxonomy);
169
+ }
170
+
171
+ $this->checkbox('cross_relate',__("Display results from all post types",'yarpp')." <span class='yarpp_help' data-help='" . esc_attr(__("When \"display results from all post types\" is off, only posts will be displayed as related to a post, only pages will be displayed as related to a page, etc.", 'yarpp')) . "'>&nbsp;</span>");
172
+ $this->checkbox('past_only',__("Show only previous posts?",'yarpp'));
173
}
174
}
175
178
class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
179
function display() {
180
global $yarpp;
181
+
182
+ echo '<div class="yarpp_code_display"><strong>' . __("Website display code example",'yarpp') . '</strong><br /><small>' . __("(Update options to reload.)", 'yarpp') . "</small><br/><div id='display_demo_web'></div></div>";
183
+ $this->checkbox('auto_display',__("Automatically display related posts?",'yarpp')." <span class='yarpp_help' data-help='" . esc_attr(__("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')) . "'>&nbsp;</span>");
184
+
185
$this->textbox('limit',__('Maximum number of related posts:','yarpp'));
186
$this->template_checkbox( false );
187
+ $this->template_file( false, 'templated' );
188
+
189
+ $this->beforeafter(array('before_related', 'after_related'),__("Before / after related entries:",'yarpp'), 15, 'not_templated', __("For example:",'yarpp') . ' &lt;ol&gt;&lt;/ol&gt;' . __(' or ','yarpp') . '&lt;div&gt;&lt;/div&gt;');
190
+ $this->beforeafter(array('before_title', 'after_title'),__("Before / after each related entry:",'yarpp'),15, 'not_templated', __("For example:",'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ','yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
191
+
192
+ $this->checkbox('show_excerpt', __("Show excerpt?",'yarpp'), 'not_templated');
193
+ $this->textbox('excerpt_length', __('Excerpt length (No. of words):','yarpp'), 10, 'excerpted');
194
+
195
+ $this->beforeafter(array('before_post', 'after_post'), __("Before / after (excerpt):",'yarpp'), 10, 'excerpted', __("For example:",'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ','yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
196
+
197
+ $this->displayorder('order');
198
+
199
+ $this->textbox('no_results', __('Default display if no results:','yarpp'), 40, 'not_templated');
200
+
201
+ $this->checkbox('promote_yarpp',__("Help promote Yet Another Related Posts Plugin?",'yarpp')
202
+ ." <span class='yarpp_help' data-help='" . esc_attr(sprintf(__("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.", 'yarpp'),"<code>".htmlspecialchars(sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org'))."</code>")) ."'>&nbsp;</span>");
203
}
204
}
205
208
class YARPP_Meta_Box_Display_Feed extends YARPP_Meta_Box {
209
function display() {
210
global $yarpp;
211
212
+ echo '<div class="rss_displayed yarpp_code_display"><b>' . __("RSS display code example",'yarpp') . '</b><br /><small>' . __("(Update options to reload.)",'yarpp') . "</small><br/><div id='display_demo_rss'></div></div>";
213
214
+ $this->checkbox('rss_display',__("Display related posts in feeds?",'yarpp')." <span class='yarpp_help' data-help='" . esc_attr(__("This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed.",'yarpp')) . "'>&nbsp;</span>",'');
215
+ $this->checkbox('rss_excerpt_display',__("Display related posts in the descriptions?",'yarpp')." <span class='yarpp_help' data-help='" . esc_attr(__("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.",'yarpp')) . "'>&nbsp;</span>", 'rss_displayed');
216
+
217
+ $this->textbox('rss_limit',__('Maximum number of related posts:','yarpp'), 2, 'rss_displayed');
218
+ $this->template_checkbox( true, 'rss_displayed' );
219
+ $this->template_file( true, 'rss_templated' );
220
221
+ $this->beforeafter(array('rss_before_related', 'rss_after_related'),__("Before / after related entries:",'yarpp'), 15, 'rss_not_templated rss_displayed', __("For example:",'yarpp') . ' &lt;ol&gt;&lt;/ol&gt;' . __(' or ','yarpp') . '&lt;div&gt;&lt;/div&gt;');
222
+ $this->beforeafter(array('rss_before_title', 'rss_after_title'),__("Before / after each related entry:",'yarpp'), 15, 'rss_not_templated rss_displayed', __("For example:",'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ','yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
223
+
224
+ $this->checkbox('rss_show_excerpt', __("Show excerpt?",'yarpp'), 'rss_not_templated rss_displayed');
225
+ $this->textbox('rss_excerpt_length', __('Excerpt length (No. of words):','yarpp'), 10, 'rss_excerpted');
226
227
+ $this->beforeafter(array('rss_before_post', 'rss_after_post'),__("Before / after (excerpt):",'yarpp'), 10, 'rss_excerpted', __("For example:",'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ','yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
228
+
229
+ $this->displayorder('rss_order', 'rss_displayed');
230
+
231
+ $this->textbox('rss_no_results', __('Default display if no results:','yarpp'), 40, 'rss_not_templated rss_displayed');
232
+
233
+ $this->checkbox('rss_promote_yarpp', __("Help promote Yet Another Related Posts Plugin?",'yarpp') . " <span class='yarpp_help' data-help='" . esc_attr(sprintf(__("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.", 'yarpp'),"<code>" . htmlspecialchars(sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'), 'http://yarpp.org'))."</code>")) . "'>&nbsp;</span>", 'rss_displayed');
234
}
235
}
236
245
<li><a href="http://wordpress.org/support/plugin/yet-another-related-posts-plugin" target="_blank"><span class='icon icon-wordpress'></span> <?php _e('YARPP Forum', 'yarpp'); ?></a></li>
246
<li><a href="http://twitter.com/yarpp" target="_blank"><span class='icon icon-twitter'></span> <?php _e('YARPP on Twitter', 'yarpp'); ?></a></li>
247
<li><a href="http://yarpp.org" target="_blank"><span class='icon icon-plugin'></span> <?php _e('YARPP on the Web', 'yarpp'); ?></a></li>
248
+ <li><a href="http://wordpress.org/support/view/plugin-reviews/yet-another-related-posts-plugin" target="_blank"><span class='icon icon-star <?php if ($yarpp->is_happy()) echo 'spin'; ?>'></span> <?php _e('Review YARPP on WordPress.org', 'yarpp'); ?></a></li>
249
<li><a href='http://tinyurl.com/donatetomitcho' target='_new'><span class='icon icon-paypal'></span> <img src="https://www.paypal.com/<?php echo $this->paypal_lang(); ?>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');?>"/></a></li>
250
</ul>
251
<?php
280
}
281
}
282
283
+ add_meta_box('yarpp_display_optin', __('Help Improve YARPP','yarpp'), array(new YARPP_Meta_Box_Optin, 'display'), 'settings_page_yarpp', 'side', 'core');
284
+
285
+ class YARPP_Meta_Box_Optin extends YARPP_Meta_Box {
286
+ function display() {
287
+ global $yarpp;
288
+
289
+ if ( $yarpp->get_option('optin') )
290
+ $yarpp->optin_ping();
291
+
292
+ // TODO: fix this text and i18nize it
293
+ echo "<input type='checkbox' id='optin' name='optin' value='true'";
294
+ checked(yarpp_get_option('optin') == 1);
295
+ echo " /> ";
296
+
297
+ echo '<label for="optin">' . __('Send YARPP settings and usage data back to YARPP.', 'yarpp') . '</label>';
298
+
299
+ echo '<p>This is entirely optional, but will help improve future versions of YARPP. <input type="button" value="Learn more" id="yarpp-optin-learnmore" class="button button-small" style="float:right"/></p>';
300
+ }
301
+ }
302
+
303
add_meta_box('yarpp_display_contact', __('Contact YARPP','yarpp'), array(new YARPP_Meta_Box_Contact, 'display'), 'settings_page_yarpp', 'side', 'core');
304
305
// since 3.3: hook for registering new YARPP meta boxes
options.css CHANGED
@@ -78,27 +78,80 @@ a.info{
78
z-index:24;
79
}
80
81
- a.info:hover {
82
- z-index:25;
83
- text-decoration:none;
84
}
85
86
- a.info span {
87
- display: none;
88
}
89
90
- a.info:hover span {
91
- display:block;
92
- position:absolute;
93
- top:1em;
94
- left:0;
95
- width:350px;
96
- border:1px solid #000;
97
- background-color:#ccc;
98
- color:#000;
99
- padding:4px;
100
}
101
102
- .exclude_terms span {
103
display: inline-block;
104
- }
78
z-index:24;
79
}
80
81
+ .yarpp_help {
82
+ display: inline-block;
83
+ cursor: default;
84
+ background-image: url('../../../wp-includes/images/wpicons-2x.png?ver=20120720');
85
+ background-size: 560px 40px;
86
+ background-position: -520px -20px;
87
+ cursor: default;
88
+ vertical-align: baseline;
89
+ width: 20px;
90
+ height: 20px;
91
+ }
92
+ a.yarpp_help {
93
+ text-decoration: none;
94
+ cursor: pointer;
95
+ }
96
+ a.yarpp_help:hover {
97
+ text-decoration: none;
98
+ background-position: -520px -0px;
99
}
100
101
+ .branch-3-4 .yarpp_help, .branch-3-3 .yarpp-help {
102
+ background-image: url('../../../wp-includes/images/wpicons.png?ver=20120720');
103
}
104
105
+ .exclude_terms span {
106
+ display: inline-block;
107
}
108
109
+ .yarpp_form_row {
110
+ overflow: auto;
111
+ }
112
+ .yarpp_form_row > div {
113
+ padding: 8px;
114
display: inline-block;
115
+ vertical-align: top;
116
+ *display: inline;
117
+ }
118
+ .yarpp_form_checkbox > div {
119
+ vertical-align: baseline;
120
+ }
121
+ .yarpp_form_select > div {
122
+ padding-top: 5px;
123
+ padding-bottom: 5px;
124
+ }
125
+ .yarpp_form_label {
126
+ width: 200px;
127
+ }
128
+ .yarpp_form_textbox > .yarpp_form_label {
129
+ padding-top: 13px;
130
+ }
131
+ .yarpp_form_select > .yarpp_form_label {
132
+ padding-top: 8px;
133
+ }
134
+
135
+ .yarpp_code_display {
136
+ border-left: 8px transparent solid;
137
+ width: 50%;
138
+ float: right;
139
+ }
140
+ .yarpp_code_display div {
141
+ overflow: auto;
142
+ max-height: 500px;
143
+ }
144
+ .yarpp_scroll_wrapper {
145
+ overflow: auto;
146
+ max-height: 100px;
147
+ width: 60%;
148
+ }
149
+
150
+ @media all and (max-width:1200px) {
151
+ .yarpp_scroll_wrapper {
152
+ width: 50%;
153
+ }
154
+ .yarpp_code_display {
155
+ max-width: 60%;
156
+ }
157
+ }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Author URI: http://mitcho.com/
5
Plugin URI: http://yarpp.org/
6
Donate link: http://tinyurl.com/donatetomitcho
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
- Requires at least: 3.1
9
Tested up to: 3.5
10
Stable tag: 3.5.6
11
License: GPLv2 or later
@@ -234,6 +234,14 @@ If you are a bilingual speaker of English and another language and an avid user
234
235
== Changelog ==
236
237
= 3.5.6 =
238
* Typo fix for postmeta cache
239
* Added Traditional Chinese (Taiwan, `zh_TW`) localization by [Pseric](http://www.freegroup.org/)
5
Plugin URI: http://yarpp.org/
6
Donate link: http://tinyurl.com/donatetomitcho
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
+ Requires at least: 3.3
9
Tested up to: 3.5
10
Stable tag: 3.5.6
11
License: GPLv2 or later
234
235
== Changelog ==
236
237
+ = 3.6 =
238
+ * ...
239
+ * Code cleanup:
240
+ * Settings screen UI have been rewritten to use `div`s rather than `table`s!
241
+ * Inline help in settings screen now use WordPress pointers
242
+ * Removed keyword cache table, as it does not ctually improve performance much and the overhead of an additional table is not worth it.
243
+ * Added option to send YARPP setting and usage information back to YARPP (off by default). This information will be used to make more informed decisions about future YARPP development. More info available in the settings.
244
+
245
= 3.5.6 =
246
* Typo fix for postmeta cache
247
* Added Traditional Chinese (Taiwan, `zh_TW`) localization by [Pseric](http://www.freegroup.org/)
yarpp.php CHANGED
@@ -3,13 +3,13 @@
3
Plugin Name: Yet Another Related Posts Plugin
4
Plugin URI: http://yarpp.org/
5
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. Now with custom post type support!
6
- Version: 3.5.6
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
10
*/
11
12
- define('YARPP_VERSION', '3.5.6');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');
@@ -54,18 +54,6 @@ function yarpp_get_option($option = null) {
54
return $yarpp->get_option($option);
55
}
56
57
- // since 3.3.2: fix for WP 3.0.x
58
- if ( !function_exists( 'self_admin_url' ) ) {
59
- function self_admin_url($path = '', $scheme = 'admin') {
60
- if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN )
61
- return network_admin_url($path, $scheme);
62
- elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN )
63
- return user_admin_url($path, $scheme);
64
- else
65
- return admin_url($path, $scheme);
66
- }
67
- }
68
-
69
function yarpp_plugin_activate() {
70
update_option( 'yarpp_activated', true );
71
}
3
Plugin Name: Yet Another Related Posts Plugin
4
Plugin URI: http://yarpp.org/
5
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. Now with custom post type support!
6
+ Version: 3.6b1
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
10
*/
11
12
+ define('YARPP_VERSION', '3.6b1');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');
54
return $yarpp->get_option($option);
55
}
56
57
function yarpp_plugin_activate() {
58
update_option( 'yarpp_activated', true );
59
}