Version Description
- Tested on WordPress 3.9.
- YARPP Basic and YARPP Pro can now be used simultaneously, rather than being mutually exclusive.
- Added a YARPP Pro option to the YARPP sidebar widget.
- Enlarged "Display Options" panel textbox for increased usability.
- Updated YARPP Pro script to allow for future enhancements.
- Updated MyISAM check notice message to explain its impact on "Pages."
- Added descriptive text to explain new enhancements.
Download this release
Release Info
Developer | jeffparker |
Plugin | Yet Another Related Posts Plugin (YARPP) |
Version | 4.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.2 to 4.2
- classes/YARPP_Admin.php +40 -42
- classes/YARPP_Core.php +162 -174
- classes/YARPP_Meta_Box.php +98 -0
- classes/YARPP_Meta_Box_Contact.php +40 -0
- classes/YARPP_Meta_Box_Display_Feed.php +60 -0
- classes/YARPP_Meta_Box_Display_Web.php +72 -0
- classes/YARPP_Meta_Box_Optin.php +30 -0
- classes/YARPP_Meta_Box_Pool.php +33 -0
- classes/YARPP_Meta_Box_Relatedness.php +21 -0
- classes/YARPP_Meta_Boxes.php +0 -484
- classes/YARPP_Widget.php +59 -133
- includes/phtmls/yarpp_meta_box_beforeafter.phtml +27 -0
- includes/phtmls/yarpp_meta_box_checkbox.phtml +12 -0
- includes/phtmls/yarpp_meta_box_pool.phtml +39 -0
- includes/phtmls/yarpp_meta_box_tax_weight.phtml +24 -0
- includes/phtmls/yarpp_meta_box_template_checkbox.phtml +49 -0
- includes/phtmls/yarpp_meta_box_template_file.phtml +34 -0
- includes/phtmls/yarpp_meta_box_textbox.phtml +19 -0
- includes/phtmls/yarpp_options.phtml +73 -0
- includes/phtmls/yarpp_pro_options.phtml +106 -0
- includes/phtmls/yarpp_pro_tag.phtml +7 -0
- includes/phtmls/yarpp_pro_tag_ssp.phtml +6 -0
- includes/phtmls/yarpp_settings_header.phtml +14 -0
- includes/phtmls/yarpp_widget_form.phtml +152 -0
- includes/{styles-thumbnails.css.php → styles_thumbnails.css.php} +0 -0
- includes/template_builtin.php +41 -13
- includes/{template-metabox.php → template_metabox.php} +0 -0
- includes/{template-widget.php → template_widget.php} +0 -0
- includes/yarpp_meta_boxes_hooks.php +93 -0
- includes/yarpp_myisam_notice.php +2 -1
- includes/yarpp_options.php +84 -150
- includes/yarpp_pro_options.php +15 -133
- includes/yarpp_pro_set_display_types.php +11 -0
- includes/yarpp_switch.php +3 -3
- js/options_switch.js +59 -23
- readme.txt +20 -7
- style/options_basic.css +51 -11
- style/options_switch.css +51 -0
- style/related.css +28 -0
- style/widget.css +34 -0
- uninstall.php +2 -1
- yarpp.php +3 -2
classes/YARPP_Admin.php
CHANGED
@@ -15,7 +15,9 @@ class YARPP_Admin {
|
|
15 |
'aid' => null,
|
16 |
'st' => null,
|
17 |
'v' => null,
|
18 |
-
'
|
|
|
|
|
19 |
)
|
20 |
);
|
21 |
|
@@ -54,13 +56,13 @@ class YARPP_Admin {
|
|
54 |
*/
|
55 |
function ajax_register() {
|
56 |
if (defined('DOING_AJAX') && DOING_AJAX) {
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
}
|
65 |
}
|
66 |
|
@@ -125,7 +127,7 @@ class YARPP_Admin {
|
|
125 |
/**
|
126 |
* @since 3.3: Load options page sections as meta-boxes.
|
127 |
*/
|
128 |
-
include_once(YARPP_DIR.'/
|
129 |
|
130 |
/**
|
131 |
* @since 3.5.5 Check that add_help_tab method callable (WP >= 3.3).
|
@@ -271,18 +273,16 @@ class YARPP_Admin {
|
|
271 |
}
|
272 |
|
273 |
function upgrade_notice() {
|
274 |
-
$proAction = ($this->core->yarppPro['active']) ? 'disable' : 'enable';
|
275 |
$optinAction = ($this->core->get_option('optin')) ? 'disable' : 'enable';
|
276 |
-
$this->optin_notice('upgrade', $
|
277 |
}
|
278 |
|
279 |
public function install_notice(){
|
280 |
-
$proAction = ($this->core->yarppPro['active']) ? 'disable' : 'enable';
|
281 |
$optinAction = ($this->core->get_option('optin')) ? 'disable' : 'enable';
|
282 |
-
$this->optin_notice('install', $
|
283 |
}
|
284 |
|
285 |
-
function optin_notice($type=false, $
|
286 |
$screen = get_current_screen();
|
287 |
if(is_null($screen) || $screen->id == 'settings_page_yarpp') return;
|
288 |
|
@@ -311,7 +311,7 @@ class YARPP_Admin {
|
|
311 |
|
312 |
$out .=
|
313 |
'<p>'.
|
314 |
-
'You
|
315 |
'<a href="options-general.php?page=yarpp" class="button">Take me to the settings page</a>'.
|
316 |
'</p>';
|
317 |
|
@@ -370,7 +370,7 @@ class YARPP_Admin {
|
|
370 |
return $text;
|
371 |
}
|
372 |
|
373 |
-
function render_screen_settings(
|
374 |
if ( $current_screen->id != 'settings_page_yarpp' )
|
375 |
return $output;
|
376 |
|
@@ -407,7 +407,7 @@ class YARPP_Admin {
|
|
407 |
}
|
408 |
}
|
409 |
|
410 |
-
function settings_link($links, $file) {
|
411 |
$this_plugin = dirname(plugin_basename(dirname(__FILE__))).'/yarpp.php';
|
412 |
if($file == $this_plugin) {
|
413 |
$links[] = '<a href="options-general.php?page=yarpp">'.__('Settings').'</a>';
|
@@ -415,9 +415,9 @@ class YARPP_Admin {
|
|
415 |
return $links;
|
416 |
}
|
417 |
|
418 |
-
function options_page() {
|
419 |
-
|
420 |
-
if($this->core->yarppPro['active']){
|
421 |
include_once(YARPP_DIR.'/includes/yarpp_pro_options.php');
|
422 |
} else {
|
423 |
include_once(YARPP_DIR . '/includes/yarpp_options.php');
|
@@ -425,7 +425,7 @@ class YARPP_Admin {
|
|
425 |
}
|
426 |
|
427 |
// @since 3.4: don't actually compute results here, but use ajax instead
|
428 |
-
function metabox() {
|
429 |
?>
|
430 |
<style>
|
431 |
#yarpp_relatedposts h3 .postbox-title-action {
|
@@ -448,7 +448,7 @@ class YARPP_Admin {
|
|
448 |
}
|
449 |
|
450 |
// @since 3.3: default metaboxes to show:
|
451 |
-
function default_hidden_meta_boxes($hidden, $screen) {
|
452 |
if ($screen->id === 'settings_page_yarpp') {
|
453 |
$hidden = $this->core->default_hidden_metaboxes;
|
454 |
}
|
@@ -456,36 +456,34 @@ class YARPP_Admin {
|
|
456 |
}
|
457 |
|
458 |
// @since 4: UI to copy templates
|
459 |
-
function can_copy_templates() {
|
460 |
$theme_dir = get_stylesheet_directory();
|
461 |
// If we can't write to the theme, return false
|
462 |
-
if (
|
463 |
-
return false;
|
464 |
|
465 |
-
require_once(ABSPATH
|
466 |
-
WP_Filesystem(
|
467 |
global $wp_filesystem;
|
468 |
// direct method is the only method that I've tested so far
|
469 |
-
return $wp_filesystem->method
|
470 |
}
|
471 |
|
472 |
-
function copy_templates() {
|
473 |
-
$templates_dir = trailingslashit(trailingslashit(YARPP_DIR)
|
474 |
|
475 |
-
require_once(ABSPATH
|
476 |
-
WP_Filesystem(
|
477 |
global $wp_filesystem;
|
478 |
-
if ( $wp_filesystem->method
|
479 |
-
return false;
|
480 |
|
481 |
-
return copy_dir(
|
482 |
}
|
483 |
|
484 |
/*
|
485 |
* AJAX SERVICES
|
486 |
*/
|
487 |
|
488 |
-
function ajax_display_exclude_terms() {
|
489 |
check_ajax_referer('yarpp_display_exclude_terms');
|
490 |
|
491 |
if (!isset($_REQUEST['taxonomy'])) return;
|
@@ -497,7 +495,7 @@ class YARPP_Admin {
|
|
497 |
|
498 |
$exclude_tt_ids = wp_parse_id_list($this->core->get_option('exclude'));
|
499 |
$exclude_term_ids = $this->get_term_ids_from_tt_ids( $taxonomy, $exclude_tt_ids );
|
500 |
-
// if ('category'
|
501 |
|
502 |
$terms = get_terms($taxonomy, array(
|
503 |
'exclude' => $exclude_term_ids,
|
@@ -518,7 +516,7 @@ class YARPP_Admin {
|
|
518 |
exit;
|
519 |
}
|
520 |
|
521 |
-
function get_term_ids_from_tt_ids( $taxonomy, $tt_ids ) {
|
522 |
global $wpdb;
|
523 |
$tt_ids = wp_parse_id_list($tt_ids);
|
524 |
if ( empty($tt_ids) )
|
@@ -526,7 +524,7 @@ class YARPP_Admin {
|
|
526 |
return $wpdb->get_col("select term_id from $wpdb->term_taxonomy where taxonomy = '{$taxonomy}' and term_taxonomy_id in (" . join(',', $tt_ids) . ")");
|
527 |
}
|
528 |
|
529 |
-
function ajax_display() {
|
530 |
check_ajax_referer('yarpp_display');
|
531 |
|
532 |
if (!isset($_REQUEST['ID'])) return;
|
@@ -547,7 +545,7 @@ class YARPP_Admin {
|
|
547 |
die();
|
548 |
}
|
549 |
|
550 |
-
function ajax_display_demo() {
|
551 |
check_ajax_referer('yarpp_display_demo');
|
552 |
|
553 |
header("HTTP/1.1 200");
|
@@ -566,7 +564,7 @@ class YARPP_Admin {
|
|
566 |
/**
|
567 |
* Display optin data in a human readable format on the help tab.
|
568 |
*/
|
569 |
-
function ajax_optin_data() {
|
570 |
check_ajax_referer('yarpp_optin_data');
|
571 |
|
572 |
header("HTTP/1.1 200");
|
@@ -602,7 +600,7 @@ class YARPP_Admin {
|
|
602 |
die();
|
603 |
}
|
604 |
|
605 |
-
function ajax_set_display_code() {
|
606 |
check_ajax_referer( 'yarpp_set_display_code' );
|
607 |
|
608 |
header("HTTP/1.1 200");
|
15 |
'aid' => null,
|
16 |
'st' => null,
|
17 |
'v' => null,
|
18 |
+
'dpid' => null,
|
19 |
+
'optin' => false,
|
20 |
+
'auto_display_post_types' => array('post')
|
21 |
)
|
22 |
);
|
23 |
|
56 |
*/
|
57 |
function ajax_register() {
|
58 |
if (defined('DOING_AJAX') && DOING_AJAX) {
|
59 |
+
add_action('wp_ajax_yarpp_display_exclude_terms', array($this, 'ajax_display_exclude_terms'));
|
60 |
+
add_action('wp_ajax_yarpp_display_demo', array($this, 'ajax_display_demo'));
|
61 |
+
add_action('wp_ajax_yarpp_display', array($this, 'ajax_display'));
|
62 |
+
add_action('wp_ajax_yarpp_optin_data', array($this, 'ajax_optin_data'));
|
63 |
+
add_action('wp_ajax_yarpp_optin_enable', array($this, 'ajax_optin_enable'));
|
64 |
+
add_action('wp_ajax_yarpp_optin_disable', array($this, 'ajax_optin_disable'));
|
65 |
+
add_action('wp_ajax_yarpp_set_display_code', array($this, 'ajax_set_display_code'));
|
66 |
}
|
67 |
}
|
68 |
|
127 |
/**
|
128 |
* @since 3.3: Load options page sections as meta-boxes.
|
129 |
*/
|
130 |
+
include_once(YARPP_DIR.'/includes/yarpp_meta_boxes_hooks.php');
|
131 |
|
132 |
/**
|
133 |
* @since 3.5.5 Check that add_help_tab method callable (WP >= 3.3).
|
273 |
}
|
274 |
|
275 |
function upgrade_notice() {
|
|
|
276 |
$optinAction = ($this->core->get_option('optin')) ? 'disable' : 'enable';
|
277 |
+
$this->optin_notice('upgrade', $optinAction);
|
278 |
}
|
279 |
|
280 |
public function install_notice(){
|
|
|
281 |
$optinAction = ($this->core->get_option('optin')) ? 'disable' : 'enable';
|
282 |
+
$this->optin_notice('install', $optinAction);
|
283 |
}
|
284 |
|
285 |
+
public function optin_notice($type=false, $optinAction) {
|
286 |
$screen = get_current_screen();
|
287 |
if(is_null($screen) || $screen->id == 'settings_page_yarpp') return;
|
288 |
|
311 |
|
312 |
$out .=
|
313 |
'<p>'.
|
314 |
+
'You currently have <strong>YARPP Basic</strong> and <strong>YARPP Pro</strong> enabled.<br/><br/>'.
|
315 |
'<a href="options-general.php?page=yarpp" class="button">Take me to the settings page</a>'.
|
316 |
'</p>';
|
317 |
|
370 |
return $text;
|
371 |
}
|
372 |
|
373 |
+
public function render_screen_settings ($output, $current_screen) {
|
374 |
if ( $current_screen->id != 'settings_page_yarpp' )
|
375 |
return $output;
|
376 |
|
407 |
}
|
408 |
}
|
409 |
|
410 |
+
public function settings_link($links, $file) {
|
411 |
$this_plugin = dirname(plugin_basename(dirname(__FILE__))).'/yarpp.php';
|
412 |
if($file == $this_plugin) {
|
413 |
$links[] = '<a href="options-general.php?page=yarpp">'.__('Settings').'</a>';
|
415 |
return $links;
|
416 |
}
|
417 |
|
418 |
+
public function options_page() {
|
419 |
+
$mode = (isset($_GET['mode'])) ? htmlentities(strtolower($_GET['mode'])) : null;
|
420 |
+
if ($mode !== 'basic' && ($mode === 'pro' || $this->core->yarppPro['active'])){
|
421 |
include_once(YARPP_DIR.'/includes/yarpp_pro_options.php');
|
422 |
} else {
|
423 |
include_once(YARPP_DIR . '/includes/yarpp_options.php');
|
425 |
}
|
426 |
|
427 |
// @since 3.4: don't actually compute results here, but use ajax instead
|
428 |
+
public function metabox() {
|
429 |
?>
|
430 |
<style>
|
431 |
#yarpp_relatedposts h3 .postbox-title-action {
|
448 |
}
|
449 |
|
450 |
// @since 3.3: default metaboxes to show:
|
451 |
+
public function default_hidden_meta_boxes($hidden, $screen) {
|
452 |
if ($screen->id === 'settings_page_yarpp') {
|
453 |
$hidden = $this->core->default_hidden_metaboxes;
|
454 |
}
|
456 |
}
|
457 |
|
458 |
// @since 4: UI to copy templates
|
459 |
+
public function can_copy_templates() {
|
460 |
$theme_dir = get_stylesheet_directory();
|
461 |
// If we can't write to the theme, return false
|
462 |
+
if (!is_dir($theme_dir) || !is_writable($theme_dir)) return false;
|
|
|
463 |
|
464 |
+
require_once(ABSPATH.'wp-admin/includes/file.php');
|
465 |
+
WP_Filesystem(false, get_stylesheet_directory());
|
466 |
global $wp_filesystem;
|
467 |
// direct method is the only method that I've tested so far
|
468 |
+
return $wp_filesystem->method === 'direct';
|
469 |
}
|
470 |
|
471 |
+
public function copy_templates() {
|
472 |
+
$templates_dir = trailingslashit(trailingslashit(YARPP_DIR).'yarpp-templates');
|
473 |
|
474 |
+
require_once(ABSPATH.'wp-admin/includes/file.php');
|
475 |
+
WP_Filesystem(false, get_stylesheet_directory());
|
476 |
global $wp_filesystem;
|
477 |
+
if ( $wp_filesystem->method !== 'direct') return false;
|
|
|
478 |
|
479 |
+
return copy_dir($templates_dir, get_stylesheet_directory(), array('.svn'));
|
480 |
}
|
481 |
|
482 |
/*
|
483 |
* AJAX SERVICES
|
484 |
*/
|
485 |
|
486 |
+
public function ajax_display_exclude_terms() {
|
487 |
check_ajax_referer('yarpp_display_exclude_terms');
|
488 |
|
489 |
if (!isset($_REQUEST['taxonomy'])) return;
|
495 |
|
496 |
$exclude_tt_ids = wp_parse_id_list($this->core->get_option('exclude'));
|
497 |
$exclude_term_ids = $this->get_term_ids_from_tt_ids( $taxonomy, $exclude_tt_ids );
|
498 |
+
// if ('category' === $taxonomy) $exclude .= ','.get_option('default_category');
|
499 |
|
500 |
$terms = get_terms($taxonomy, array(
|
501 |
'exclude' => $exclude_term_ids,
|
516 |
exit;
|
517 |
}
|
518 |
|
519 |
+
public function get_term_ids_from_tt_ids( $taxonomy, $tt_ids ) {
|
520 |
global $wpdb;
|
521 |
$tt_ids = wp_parse_id_list($tt_ids);
|
522 |
if ( empty($tt_ids) )
|
524 |
return $wpdb->get_col("select term_id from $wpdb->term_taxonomy where taxonomy = '{$taxonomy}' and term_taxonomy_id in (" . join(',', $tt_ids) . ")");
|
525 |
}
|
526 |
|
527 |
+
public function ajax_display() {
|
528 |
check_ajax_referer('yarpp_display');
|
529 |
|
530 |
if (!isset($_REQUEST['ID'])) return;
|
545 |
die();
|
546 |
}
|
547 |
|
548 |
+
public function ajax_display_demo() {
|
549 |
check_ajax_referer('yarpp_display_demo');
|
550 |
|
551 |
header("HTTP/1.1 200");
|
564 |
/**
|
565 |
* Display optin data in a human readable format on the help tab.
|
566 |
*/
|
567 |
+
public function ajax_optin_data() {
|
568 |
check_ajax_referer('yarpp_optin_data');
|
569 |
|
570 |
header("HTTP/1.1 200");
|
600 |
die();
|
601 |
}
|
602 |
|
603 |
+
public function ajax_set_display_code() {
|
604 |
check_ajax_referer( 'yarpp_set_display_code' );
|
605 |
|
606 |
header("HTTP/1.1 200");
|
classes/YARPP_Core.php
CHANGED
@@ -12,14 +12,21 @@ class YARPP {
|
|
12 |
*/
|
13 |
public $default_options = array();
|
14 |
public $default_hidden_metaboxes = array();
|
15 |
-
|
16 |
public $yarppPro = null;
|
17 |
public $cache_bypass;
|
18 |
-
|
19 |
public $admin;
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
public function __construct() {
|
25 |
|
@@ -81,7 +88,6 @@ class YARPP {
|
|
81 |
/*
|
82 |
* OPTIONS
|
83 |
*/
|
84 |
-
|
85 |
private function load_default_options() {
|
86 |
$this->default_options = array(
|
87 |
'threshold' => 4,
|
@@ -182,7 +188,7 @@ class YARPP {
|
|
182 |
// ensure defaults if not set:
|
183 |
$options = array_merge($this->default_options, $options);
|
184 |
|
185 |
-
if (is_null(
|
186 |
|
187 |
$optionpath = array();
|
188 |
$parsed_option = array();
|
@@ -215,7 +221,6 @@ class YARPP {
|
|
215 |
* @since 3.5.2 Function to enforce YARPP setup if not ready, activate; else upgrade.
|
216 |
*/
|
217 |
public function enforce() {
|
218 |
-
|
219 |
if (!$this->enabled()) {
|
220 |
$this->activate(); // activate calls upgrade later, so it's covered.
|
221 |
} else {
|
@@ -339,7 +344,7 @@ class YARPP {
|
|
339 |
$wpdb->get_results("SHOW INDEX FROM {$wpdb->posts} WHERE Key_name = 'yarpp_title' OR Key_name = 'yarpp_content'");
|
340 |
return ($wpdb->num_rows >= 2);
|
341 |
}
|
342 |
-
|
343 |
public function diagnostic_hidden_metaboxes() {
|
344 |
global $wpdb;
|
345 |
$raw = $wpdb->get_var(
|
@@ -347,9 +352,9 @@ class YARPP {
|
|
347 |
"WHERE meta_key = 'metaboxhidden_settings_page_yarpp' ".
|
348 |
"ORDER BY length(meta_value) ASC LIMIT 1"
|
349 |
);
|
350 |
-
|
351 |
if (!$raw) return $this->default_hidden_metaboxes;
|
352 |
-
|
353 |
$list = maybe_unserialize($raw);
|
354 |
if (!is_array($list)) return $this->default_hidden_metaboxes;
|
355 |
|
@@ -378,14 +383,6 @@ class YARPP {
|
|
378 |
public function diagnostic_generate_thumbnails() {
|
379 |
return (defined('YARPP_GENERATE_THUMBNAILS') && YARPP_GENERATE_THUMBNAILS);
|
380 |
}
|
381 |
-
|
382 |
-
private $default_dimensions = array(
|
383 |
-
'width' => 120,
|
384 |
-
'height' => 120,
|
385 |
-
'crop' => false,
|
386 |
-
'size' => '120x120',
|
387 |
-
'_default' => true
|
388 |
-
);
|
389 |
|
390 |
public function diagnostic_using_thumbnails() {
|
391 |
if ($this->get_option('manually_using_thumbnails')) return true;
|
@@ -430,7 +427,7 @@ class YARPP {
|
|
430 |
)
|
431 |
);
|
432 |
|
433 |
-
$url = plugins_url('includes/
|
434 |
wp_enqueue_style("yarpp-thumbnails-".$dimensions['size'], $url, array(), YARPP_VERSION, 'all');
|
435 |
}
|
436 |
|
@@ -618,7 +615,7 @@ class YARPP {
|
|
618 |
update_option('yarpp', $options);
|
619 |
}
|
620 |
|
621 |
-
function upgrade_3_4b8() {
|
622 |
$options = $this->get_option();
|
623 |
$options['weight'] = array(
|
624 |
'title' => (int) @$options['title'],
|
@@ -719,15 +716,11 @@ class YARPP {
|
|
719 |
|
720 |
public function upgrade_3_5_2b2() {
|
721 |
// fixing the effects of a previous bug affecting non-MyISAM users
|
722 |
-
if (is_null( $this->get_option('weight'))
|
723 |
-
|| !is_array( $this->get_option('weight'))
|
724 |
-
) {
|
725 |
$weight = $this->default_options['weight'];
|
726 |
|
727 |
// if we're still not using MyISAM
|
728 |
-
if (!$this->get_option('myisam_override')
|
729 |
-
&& $this->diagnostic_myisam_posts() !== true
|
730 |
-
) {
|
731 |
unset($weight['title']);
|
732 |
unset($weight['body']);
|
733 |
}
|
@@ -754,7 +747,6 @@ class YARPP {
|
|
754 |
/*
|
755 |
* UTILITIES
|
756 |
*/
|
757 |
-
|
758 |
private $current_post;
|
759 |
private $current_query;
|
760 |
private $current_pagenow;
|
@@ -954,6 +946,53 @@ class YARPP {
|
|
954 |
/*
|
955 |
* CORE LOOKUP + DISPLAY FUNCTIONS
|
956 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
957 |
|
958 |
/**
|
959 |
* Display related posts
|
@@ -966,147 +1005,119 @@ class YARPP {
|
|
966 |
* @return string
|
967 |
*/
|
968 |
public function display_related($reference_ID = null, $args = array(), $echo = true) {
|
|
|
|
|
|
|
|
|
|
|
969 |
$output = null;
|
970 |
-
/*
|
971 |
-
* YARPP Pro Script Tag
|
972 |
-
*/
|
973 |
-
if((isset($this->yarppPro['active']) && $this->yarppPro['active']) && $args['domain'] === 'website'){
|
974 |
-
|
975 |
-
if(
|
976 |
-
(isset($this->yarppPro['aid']) && isset($this->yarppPro['v']))
|
977 |
-
&& ($this->yarppPro['aid'] && $this->yarppPro['v'])
|
978 |
-
){
|
979 |
-
$ru = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
980 |
-
$output =
|
981 |
-
"\n".
|
982 |
-
'<script>'.
|
983 |
-
'var aid='.$this->yarppPro['aid'].',v="'.$this->yarppPro['v'].'",credomain="adkengage.com",ru="'.$ru.'";'.
|
984 |
-
"document.write('<sc'+'ript type=\"text/javascript\" src=\"http://'+ credomain +'/Scripts/CREReqScript.js\"></sc'+'ript>');".
|
985 |
-
'</script>'.
|
986 |
-
"\n";
|
987 |
-
}
|
988 |
-
} else {
|
989 |
-
|
990 |
-
/* If we're already in a YARPP loop, stop now. */
|
991 |
-
if ($this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time()) return false;
|
992 |
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
$reference_ID = get_the_ID();
|
999 |
-
}
|
1000 |
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
|
1006 |
-
|
1007 |
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
|
1017 |
-
|
1018 |
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
|
1023 |
-
|
1024 |
|
1025 |
-
|
1026 |
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
|
1040 |
-
|
1041 |
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
|
1048 |
-
|
1049 |
-
|
1050 |
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
|
|
1080 |
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
if ($related_count > 0 && $promote_yarpp && $domain != 'metabox') {
|
1091 |
-
$output .=
|
1092 |
-
"<p>".
|
1093 |
-
sprintf(
|
1094 |
-
__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.",'yarpp'),
|
1095 |
-
'http://www.yarpp.com'
|
1096 |
-
).
|
1097 |
-
"</p>\n";
|
1098 |
-
}
|
1099 |
|
1100 |
-
|
1101 |
-
|
1102 |
-
}
|
1103 |
-
$output .= "</div>\n";
|
1104 |
}
|
1105 |
|
|
|
|
|
|
|
1106 |
if ($echo) echo $output;
|
1107 |
return $output;
|
1108 |
-
|
1109 |
-
}/*end display_related*/
|
1110 |
|
1111 |
/*
|
1112 |
* @param (int) $reference_ID
|
@@ -1115,7 +1126,6 @@ class YARPP {
|
|
1115 |
public function get_related($reference_ID = null, $args = array()) {
|
1116 |
/* If we're already in a YARPP loop, stop now. */
|
1117 |
if ($this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time()) return false;
|
1118 |
-
|
1119 |
$this->enforce();
|
1120 |
|
1121 |
if (is_numeric($reference_ID)) {
|
@@ -1377,38 +1387,16 @@ class YARPP {
|
|
1377 |
/* this filter doesn't handle feeds */
|
1378 |
if (is_feed()) return $content;
|
1379 |
|
1380 |
-
$auto_display_post_types = $this->get_option('auto_display_post_types');
|
1381 |
-
|
1382 |
-
/* if it's not an auto-display post type, return */
|
1383 |
-
if (!in_array(get_post_type(), $auto_display_post_types)) return $content;
|
1384 |
-
|
1385 |
-
if (!is_singular()
|
1386 |
-
&& !($this->get_option('auto_display_archive') && (is_archive() || is_home()))
|
1387 |
-
) {
|
1388 |
-
return $content;
|
1389 |
-
}
|
1390 |
-
|
1391 |
/* If the content includes <!--noyarpp-->, don't display */
|
1392 |
-
if (stristr($content, '<!--noyarpp-->')
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
} else {
|
1397 |
-
$post_types = array(get_post_type());
|
1398 |
}
|
1399 |
-
|
1400 |
-
$post_types = apply_filters('yarpp_map_post_types', $post_types, 'website');
|
1401 |
|
1402 |
-
return $content
|
1403 |
-
null,
|
1404 |
-
array(
|
1405 |
-
'post_type' => $post_types,
|
1406 |
-
'domain' => 'website'
|
1407 |
-
),
|
1408 |
-
false
|
1409 |
-
);
|
1410 |
}
|
1411 |
-
|
1412 |
public function the_content_feed($content) {
|
1413 |
if (!$this->get_option('rss_display')) return $content;
|
1414 |
|
12 |
*/
|
13 |
public $default_options = array();
|
14 |
public $default_hidden_metaboxes = array();
|
15 |
+
public $debug = false;
|
16 |
public $yarppPro = null;
|
17 |
public $cache_bypass;
|
18 |
+
public $cache;
|
19 |
public $admin;
|
20 |
|
21 |
+
private $active_cache;
|
22 |
+
private $storage_class;
|
23 |
+
private $default_dimensions = array(
|
24 |
+
'width' => 120,
|
25 |
+
'height' => 120,
|
26 |
+
'crop' => false,
|
27 |
+
'size' => '120x120',
|
28 |
+
'_default' => true
|
29 |
+
);
|
30 |
|
31 |
public function __construct() {
|
32 |
|
88 |
/*
|
89 |
* OPTIONS
|
90 |
*/
|
|
|
91 |
private function load_default_options() {
|
92 |
$this->default_options = array(
|
93 |
'threshold' => 4,
|
188 |
// ensure defaults if not set:
|
189 |
$options = array_merge($this->default_options, $options);
|
190 |
|
191 |
+
if (is_null($option)) return $options;
|
192 |
|
193 |
$optionpath = array();
|
194 |
$parsed_option = array();
|
221 |
* @since 3.5.2 Function to enforce YARPP setup if not ready, activate; else upgrade.
|
222 |
*/
|
223 |
public function enforce() {
|
|
|
224 |
if (!$this->enabled()) {
|
225 |
$this->activate(); // activate calls upgrade later, so it's covered.
|
226 |
} else {
|
344 |
$wpdb->get_results("SHOW INDEX FROM {$wpdb->posts} WHERE Key_name = 'yarpp_title' OR Key_name = 'yarpp_content'");
|
345 |
return ($wpdb->num_rows >= 2);
|
346 |
}
|
347 |
+
|
348 |
public function diagnostic_hidden_metaboxes() {
|
349 |
global $wpdb;
|
350 |
$raw = $wpdb->get_var(
|
352 |
"WHERE meta_key = 'metaboxhidden_settings_page_yarpp' ".
|
353 |
"ORDER BY length(meta_value) ASC LIMIT 1"
|
354 |
);
|
355 |
+
|
356 |
if (!$raw) return $this->default_hidden_metaboxes;
|
357 |
+
|
358 |
$list = maybe_unserialize($raw);
|
359 |
if (!is_array($list)) return $this->default_hidden_metaboxes;
|
360 |
|
383 |
public function diagnostic_generate_thumbnails() {
|
384 |
return (defined('YARPP_GENERATE_THUMBNAILS') && YARPP_GENERATE_THUMBNAILS);
|
385 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
|
387 |
public function diagnostic_using_thumbnails() {
|
388 |
if ($this->get_option('manually_using_thumbnails')) return true;
|
427 |
)
|
428 |
);
|
429 |
|
430 |
+
$url = plugins_url('includes/styles_thumbnails.css.php?'.$queryStr, dirname(__FILE__));
|
431 |
wp_enqueue_style("yarpp-thumbnails-".$dimensions['size'], $url, array(), YARPP_VERSION, 'all');
|
432 |
}
|
433 |
|
615 |
update_option('yarpp', $options);
|
616 |
}
|
617 |
|
618 |
+
public function upgrade_3_4b8() {
|
619 |
$options = $this->get_option();
|
620 |
$options['weight'] = array(
|
621 |
'title' => (int) @$options['title'],
|
716 |
|
717 |
public function upgrade_3_5_2b2() {
|
718 |
// fixing the effects of a previous bug affecting non-MyISAM users
|
719 |
+
if (is_null($this->get_option('weight')) || !is_array( $this->get_option('weight'))) {
|
|
|
|
|
720 |
$weight = $this->default_options['weight'];
|
721 |
|
722 |
// if we're still not using MyISAM
|
723 |
+
if (!$this->get_option('myisam_override') && $this->diagnostic_myisam_posts() !== true) {
|
|
|
|
|
724 |
unset($weight['title']);
|
725 |
unset($weight['body']);
|
726 |
}
|
747 |
/*
|
748 |
* UTILITIES
|
749 |
*/
|
|
|
750 |
private $current_post;
|
751 |
private $current_query;
|
752 |
private $current_pagenow;
|
946 |
/*
|
947 |
* CORE LOOKUP + DISPLAY FUNCTIONS
|
948 |
*/
|
949 |
+
protected function display_basic(){
|
950 |
+
/* if it's not an auto-display post type, return */
|
951 |
+
if (!in_array(get_post_type(), $this->get_option('auto_display_post_types'))) return null;
|
952 |
+
|
953 |
+
if (!is_singular() && !($this->get_option('auto_display_archive') && (is_archive() || is_home()))) {
|
954 |
+
return null;
|
955 |
+
}
|
956 |
+
|
957 |
+
if ($this->get_option('cross_relate')) {
|
958 |
+
$post_types = $this->get_post_types();
|
959 |
+
} else {
|
960 |
+
$post_types = array(get_post_type());
|
961 |
+
}
|
962 |
+
|
963 |
+
$post_types = apply_filters('yarpp_map_post_types', $post_types, 'website');
|
964 |
+
|
965 |
+
return $this->display_related(
|
966 |
+
null,
|
967 |
+
array(
|
968 |
+
'post_type' => $post_types,
|
969 |
+
'domain' => 'website'
|
970 |
+
),
|
971 |
+
false
|
972 |
+
);
|
973 |
+
}
|
974 |
+
|
975 |
+
public function display_pro($domain) {
|
976 |
+
if ((is_archive() || is_home() || $domain !== 'website')) return null;
|
977 |
+
if (!in_array(get_post_type(), $this->yarppPro['auto_display_post_types'])) return null;
|
978 |
+
if (!(isset($this->yarppPro['active']) && $this->yarppPro['active'])) return null;
|
979 |
+
if (!(isset($this->yarppPro['aid']) && isset($this->yarppPro['v'])) ||
|
980 |
+
!($this->yarppPro['aid'] && $this->yarppPro['v'])) return null;
|
981 |
+
|
982 |
+
$output = null;
|
983 |
+
$aid = $this->yarppPro['aid'];
|
984 |
+
$v = $this->yarppPro['v'];
|
985 |
+
$dpid = (isset($this->yarppPro['dpid'])) ? $this->yarppPro['dpid'] : null;
|
986 |
+
$ru = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
987 |
+
$ssp = ($dpid) ? '_ssp' : null;
|
988 |
+
|
989 |
+
ob_start();
|
990 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_pro_tag'.$ssp.'.phtml');
|
991 |
+
$output .= ob_get_contents();
|
992 |
+
ob_end_clean();
|
993 |
+
|
994 |
+
return $output;
|
995 |
+
}
|
996 |
|
997 |
/**
|
998 |
* Display related posts
|
1005 |
* @return string
|
1006 |
*/
|
1007 |
public function display_related($reference_ID = null, $args = array(), $echo = true) {
|
1008 |
+
|
1009 |
+
/* If we're already in a YARPP loop, stop now. */
|
1010 |
+
if ($this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time()) return false;
|
1011 |
+
$this->enforce();
|
1012 |
+
wp_enqueue_style('yarppRelatedCss', YARPP_URL.'/style/related.css');
|
1013 |
$output = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1014 |
|
1015 |
+
if (is_numeric($reference_ID)) {
|
1016 |
+
$reference_ID = (int) $reference_ID;
|
1017 |
+
} else {
|
1018 |
+
$reference_ID = get_the_ID();
|
1019 |
+
}
|
|
|
|
|
1020 |
|
1021 |
+
/**
|
1022 |
+
* @since 3.5.3 don't compute on revisions.
|
1023 |
+
*/
|
1024 |
+
if ($the_post = wp_is_post_revision($reference_ID)) $reference_ID = $the_post;
|
1025 |
|
1026 |
+
$this->setup_active_cache($args);
|
1027 |
|
1028 |
+
$options = array(
|
1029 |
+
'domain',
|
1030 |
+
'limit',
|
1031 |
+
'template',
|
1032 |
+
'order',
|
1033 |
+
'promote_yarpp',
|
1034 |
+
'optin'
|
1035 |
+
);
|
1036 |
|
1037 |
+
extract($this->parse_args($args, $options));
|
1038 |
|
1039 |
+
$cache_status = $this->active_cache->enforce($reference_ID);
|
1040 |
+
if ($cache_status === YARPP_DONT_RUN) return;
|
1041 |
+
if ($cache_status !== YARPP_NO_RELATED) $this->active_cache->begin_yarpp_time($reference_ID, $args);
|
1042 |
|
1043 |
+
$this->save_post_context();
|
1044 |
|
1045 |
+
global $wp_query; $wp_query = new WP_Query();
|
1046 |
|
1047 |
+
if ($cache_status !== YARPP_NO_RELATED) {
|
1048 |
+
$orders = explode(' ', $order);
|
1049 |
+
$wp_query->query(
|
1050 |
+
array(
|
1051 |
+
'p' => $reference_ID,
|
1052 |
+
'orderby' => $orders[0],
|
1053 |
+
'order' => $orders[1],
|
1054 |
+
'showposts' => $limit,
|
1055 |
+
'post_type' => (isset($args['post_type']) ? $args['post_type'] : $this->get_post_types())
|
1056 |
+
)
|
1057 |
+
);
|
1058 |
+
}
|
1059 |
|
1060 |
+
$this->prep_query($this->current_query->is_feed);
|
1061 |
|
1062 |
+
$wp_query->posts = apply_filters('yarpp_results', $wp_query->posts, array(
|
1063 |
+
'function' => 'display_related',
|
1064 |
+
'args' => $args,
|
1065 |
+
'related_ID' => $reference_ID)
|
1066 |
+
);
|
1067 |
|
1068 |
+
$related_query = $wp_query; // backwards compatibility
|
1069 |
+
$related_count = $related_query->post_count;
|
1070 |
|
1071 |
+
$output .= "<div class='";
|
1072 |
+
if ($domain === 'website') {
|
1073 |
+
$output .= "yarpp-related";
|
1074 |
+
} else {
|
1075 |
+
$output .= "yarpp-related-{$domain}";
|
1076 |
+
}
|
1077 |
|
1078 |
+
if ($related_count < 1) {
|
1079 |
+
$output .= " yarpp-related-none";
|
1080 |
+
}
|
1081 |
|
1082 |
+
$output .= "'>\n";
|
1083 |
+
|
1084 |
+
if ($domain === 'metabox') {
|
1085 |
+
include(YARPP_DIR.'/includes/template_metabox.php');
|
1086 |
+
} else if ((bool) $template && $template === 'thumbnails') {
|
1087 |
+
include(YARPP_DIR.'/includes/template_thumbnails.php');
|
1088 |
+
} else if ((bool) $template && file_exists(STYLESHEETPATH.'/'.$template)) {
|
1089 |
+
global $post;
|
1090 |
+
ob_start();
|
1091 |
+
include(STYLESHEETPATH.'/'.$template);
|
1092 |
+
$output .= ob_get_contents();
|
1093 |
+
ob_end_clean();
|
1094 |
+
} else if ($domain === 'widget') {
|
1095 |
+
include(YARPP_DIR.'/includes/template_widget.php');
|
1096 |
+
} else {
|
1097 |
+
include(YARPP_DIR.'/includes/template_builtin.php');
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
$output = trim($output)."\n";
|
1101 |
|
1102 |
+
if ($cache_status === YARPP_NO_RELATED) {
|
1103 |
+
// Uh, do nothing. Stay very still.
|
1104 |
+
} else {
|
1105 |
+
$this->active_cache->end_yarpp_time();
|
1106 |
+
}
|
1107 |
|
1108 |
+
unset($related_query);
|
1109 |
+
$this->restore_post_context();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1110 |
|
1111 |
+
if ($related_count > 0 && $promote_yarpp && $domain != 'metabox') {
|
1112 |
+
$output .= '<p><a href="http://www.yarpp.com" class="yarpp-promote" target="_blank">Powered by</a></p>';
|
|
|
|
|
1113 |
}
|
1114 |
|
1115 |
+
$output .= ($optin) ? '<img src="http://yarpp.org/pixels/'.md5(get_bloginfo('url')).'" alt="YARPP"/>'."\n" : null;
|
1116 |
+
$output .= "</div>\n";
|
1117 |
+
|
1118 |
if ($echo) echo $output;
|
1119 |
return $output;
|
1120 |
+
}
|
|
|
1121 |
|
1122 |
/*
|
1123 |
* @param (int) $reference_ID
|
1126 |
public function get_related($reference_ID = null, $args = array()) {
|
1127 |
/* If we're already in a YARPP loop, stop now. */
|
1128 |
if ($this->cache->is_yarpp_time() || $this->cache_bypass->is_yarpp_time()) return false;
|
|
|
1129 |
$this->enforce();
|
1130 |
|
1131 |
if (is_numeric($reference_ID)) {
|
1387 |
/* this filter doesn't handle feeds */
|
1388 |
if (is_feed()) return $content;
|
1389 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1390 |
/* If the content includes <!--noyarpp-->, don't display */
|
1391 |
+
if (!stristr($content, '<!--noyarpp-->')) {
|
1392 |
+
$content .= $this->display_basic();
|
1393 |
+
$content .= '<br/>';
|
1394 |
+
$content .= $this->display_pro('website');
|
|
|
|
|
1395 |
}
|
|
|
|
|
1396 |
|
1397 |
+
return $content;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1398 |
}
|
1399 |
+
|
1400 |
public function the_content_feed($content) {
|
1401 |
if (!$this->get_option('rss_display')) return $content;
|
1402 |
|
classes/YARPP_Meta_Box.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class YARPP_Meta_Box {
|
4 |
+
protected $template_text = null;
|
5 |
+
protected $yarpp = null;
|
6 |
+
|
7 |
+
public function __construct() {
|
8 |
+
global $yarpp;
|
9 |
+
$this->yarpp = $yarpp;
|
10 |
+
$this->template_text =
|
11 |
+
__(
|
12 |
+
"This advanced option gives you full power to customize how your related posts are displayed. ".
|
13 |
+
"Templates (stored in your theme folder) are written in PHP.",
|
14 |
+
'yarpp'
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
private function offer_copy_templates() {
|
19 |
+
return (!$this->yarpp->diagnostic_custom_templates() && $this->yarpp->admin->can_copy_templates());
|
20 |
+
}
|
21 |
+
|
22 |
+
public function checkbox($option, $desc, $class = null) {
|
23 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_meta_box_checkbox.phtml');
|
24 |
+
}
|
25 |
+
|
26 |
+
public function template_checkbox($rss=false, $class = null) {
|
27 |
+
$pre = ($rss) ? 'rss_' : '';
|
28 |
+
$chosen_template = yarpp_get_option($pre."template");
|
29 |
+
$choice = ($chosen_template === false)
|
30 |
+
? 'builtin' : (($chosen_template === 'thumbnails') ? 'thumbnails' : 'custom');
|
31 |
+
|
32 |
+
$builtIn = ($choice === 'builtin') ? 'active' : null;
|
33 |
+
|
34 |
+
$thumbnails = ($choice === 'thumbnails') ? 'active' : null;
|
35 |
+
$diagPostThumbs = (!$this->yarpp->diagnostic_post_thumbnails()) ? 'disabled' : null;
|
36 |
+
|
37 |
+
$custom = ($choice === 'custom') ? 'active' : null;
|
38 |
+
$diagCustTemplt = (!$this->yarpp->diagnostic_custom_templates()) ? 'disabled' : null;
|
39 |
+
|
40 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_meta_box_template_checkbox.phtml');
|
41 |
+
}
|
42 |
+
|
43 |
+
public function template_file($rss=false, $class=null) {
|
44 |
+
$pre = ($rss) ? 'rss_' : '';
|
45 |
+
$chosen_template = yarpp_get_option($pre.'template');
|
46 |
+
|
47 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_meta_box_template_file.phtml');
|
48 |
+
}
|
49 |
+
|
50 |
+
public function textbox($option, $desc, $size = 2, $class = null, $note = null) {
|
51 |
+
$value = esc_attr(yarpp_get_option($option));
|
52 |
+
|
53 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_meta_box_textbox.phtml');
|
54 |
+
}
|
55 |
+
|
56 |
+
public function beforeafter($options, $desc, $size = 10, $class = null, $note = null) {
|
57 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_meta_box_beforeafter.phtml');
|
58 |
+
}
|
59 |
+
|
60 |
+
/* MARK: Last cleaning spot */
|
61 |
+
public function tax_weight($taxonomy) {
|
62 |
+
$weight = (int) yarpp_get_option("weight[tax][{$taxonomy->name}]");
|
63 |
+
$require = (int) yarpp_get_option("require_tax[{$taxonomy->name}]");
|
64 |
+
|
65 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_meta_box_tax_weight.phtml');
|
66 |
+
}
|
67 |
+
|
68 |
+
/* MARK: Last cleaning spot */
|
69 |
+
public function weight($option, $desc) {
|
70 |
+
$weight = (int) yarpp_get_option("weight[$option]");
|
71 |
+
|
72 |
+
/* Both require MyISAM fulltext indexing: */
|
73 |
+
$fulltext = $this->yarpp->diagnostic_fulltext_disabled() ? ' readonly="readonly" disabled="disabled"' : '';
|
74 |
+
|
75 |
+
echo "<div class='yarpp_form_row yarpp_form_select'><div class='yarpp_form_label'>{$desc}</div><div>";
|
76 |
+
echo "<select name='weight[{$option}]'>";
|
77 |
+
echo "<option {$fulltext} value='no'".((!$weight) ? ' selected="selected"': '')." >".__("do not consider", 'yarpp')."</option>";
|
78 |
+
echo "<option {$fulltext} value='consider'".(($weight == 1) ? ' selected="selected"': '')." > ".__("consider", 'yarpp')."</option>";
|
79 |
+
echo "<option {$fulltext} value='consider_extra'".(($weight > 1) ? ' selected="selected"': '')." > ".__("consider with extra weight", 'yarpp')."</option>";
|
80 |
+
echo "</select></div></div>";
|
81 |
+
}
|
82 |
+
|
83 |
+
public function displayorder($option, $class=null) {
|
84 |
+
echo "<div class='yarpp_form_row yarpp_form_select $class'><div class='yarpp_form_label'>";
|
85 |
+
_e( "Order results:", 'yarpp' );
|
86 |
+
echo "</div><div><select name='$option' id='<?php echo $option; ?>'>";
|
87 |
+
$order = yarpp_get_option( $option );
|
88 |
+
?>
|
89 |
+
<option value="score DESC" <?php echo ( $order == 'score DESC'?' selected="selected"':'' )?>><?php _e( "score (high relevance to low)", 'yarpp' ); ?></option>
|
90 |
+
<option value="score ASC" <?php echo ( $order == 'score ASC'?' selected="selected"':'' )?>><?php _e( "score (low relevance to high)", 'yarpp' ); ?></option>
|
91 |
+
<option value="post_date DESC" <?php echo ( $order == 'post_date DESC'?' selected="selected"':'' )?>><?php _e( "date (new to old)", 'yarpp' ); ?></option>
|
92 |
+
<option value="post_date ASC" <?php echo ( $order == 'post_date ASC'?' selected="selected"':'' )?>><?php _e( "date (old to new)", 'yarpp' ); ?></option>
|
93 |
+
<option value="post_title ASC" <?php echo ( $order == 'post_title ASC'?' selected="selected"':'' )?>><?php _e( "title (alphabetical)", 'yarpp' ); ?></option>
|
94 |
+
<option value="post_title DESC" <?php echo ( $order == 'post_title DESC'?' selected="selected"':'' )?>><?php _e( "title (reverse alphabetical)", 'yarpp' ); ?></option>
|
95 |
+
<?php
|
96 |
+
echo "</select></div></div>";
|
97 |
+
}
|
98 |
+
}
|
classes/YARPP_Meta_Box_Contact.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class YARPP_Meta_Box_Contact extends YARPP_Meta_Box {
|
4 |
+
public function display() {
|
5 |
+
global $yarpp;
|
6 |
+
|
7 |
+
$happy = ($yarpp->diagnostic_happy()) ? 'spin' : null;
|
8 |
+
|
9 |
+
$out =
|
10 |
+
'<ul class="yarpp_contacts">'.
|
11 |
+
'<li>'.
|
12 |
+
'<a href="http://wordpress.org/support/plugin/yet-another-related-posts-plugin" target="_blank">'.
|
13 |
+
'<span class="icon icon-wordpress"></span> '.__('YARPP Forum', 'yarpp').
|
14 |
+
'</a>'.
|
15 |
+
'</li>'.
|
16 |
+
'<li>'.
|
17 |
+
'<a href="http://twitter.com/yarpp" target="_blank">'.
|
18 |
+
'<span class="icon icon-twitter"></span> '.__('YARPP on Twitter', 'yarpp').
|
19 |
+
'</a>'.
|
20 |
+
'</li>'.
|
21 |
+
'<li>'.
|
22 |
+
'<a href="https://www.facebook.com/YARPPRecommendationEngine" target="_blank">'.
|
23 |
+
'<span class="icon icon-facebook"></span> YARPP on Facebook'.
|
24 |
+
'</a>'.
|
25 |
+
'</li>'.
|
26 |
+
'<li>'.
|
27 |
+
'<a href="http://www.yarpp.com" target="_blank">'.
|
28 |
+
'<span class="icon icon-pro"></span> Learn more about YARPP'.
|
29 |
+
'</a>'.
|
30 |
+
'</li>'.
|
31 |
+
'<li>'.
|
32 |
+
'<a href="http://wordpress.org/support/view/plugin-reviews/yet-another-related-posts-plugin" target="_blank">'.
|
33 |
+
'<span class="icon icon-star '.$happy.'"></span> '.__('Review YARPP on WordPress.org', 'yarpp').
|
34 |
+
'</a>'.
|
35 |
+
'</li>'.
|
36 |
+
'</ul>';
|
37 |
+
|
38 |
+
echo $out;
|
39 |
+
}
|
40 |
+
}
|
classes/YARPP_Meta_Box_Display_Feed.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class YARPP_Meta_Box_Display_Feed extends YARPP_Meta_Box {
|
4 |
+
public function display() {
|
5 |
+
global $yarpp;
|
6 |
+
|
7 |
+
echo "<div style='overflow:auto'>";
|
8 |
+
echo '<div class="rss_displayed yarpp_code_display"';
|
9 |
+
if ( !$yarpp->get_option('code_display') )
|
10 |
+
echo ' style="display: none;"';
|
11 |
+
echo '><b>' . __( "RSS display code example", 'yarpp' ) . '</b><br /><small>' . __( "(Update options to reload.)", 'yarpp' ) . "</small><br/><div id='display_demo_rss'></div></div>";
|
12 |
+
|
13 |
+
$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' ) ) . "'> </span>", '' );
|
14 |
+
$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' ) ) . "'> </span>", 'rss_displayed' );
|
15 |
+
|
16 |
+
$this->textbox( 'rss_limit', __( 'Maximum number of related posts:', 'yarpp' ), 2, 'rss_displayed' );
|
17 |
+
$this->template_checkbox( true, 'rss_displayed' );
|
18 |
+
echo "</div>";
|
19 |
+
|
20 |
+
$chosen_template = yarpp_get_option( "rss_template" );
|
21 |
+
$choice = false === $chosen_template ? 'builtin' :
|
22 |
+
( $chosen_template == 'thumbnails' ? 'thumbnails' : 'custom' );
|
23 |
+
|
24 |
+
echo "<div class='postbox yarpp_subbox template_options_custom rss_displayed'";
|
25 |
+
if ( $choice != 'custom' )
|
26 |
+
echo ' style="display: none;"';
|
27 |
+
echo ">";
|
28 |
+
echo '<div class="yarpp_form_row"><div>' . $this->template_text . '</div></div>';
|
29 |
+
$this->template_file( true );
|
30 |
+
echo "</div>";
|
31 |
+
|
32 |
+
echo "<div class='postbox yarpp_subbox template_options_thumbnails'";
|
33 |
+
if ( $choice != 'thumbnails' )
|
34 |
+
echo ' style="display: none;"';
|
35 |
+
echo ">";
|
36 |
+
$this->textbox( 'rss_thumbnails_heading', __( 'Heading:', 'yarpp' ), 40 );
|
37 |
+
$this->textbox( 'rss_thumbnails_default', __( 'Default image (URL):', 'yarpp' ), 40 );
|
38 |
+
$this->textbox( 'rss_no_results', __( 'Default display if no results:', 'yarpp' ), 40, 'sync_rss_no_results' );
|
39 |
+
echo "</div>";
|
40 |
+
|
41 |
+
echo "<div class='postbox yarpp_subbox template_options_builtin rss_displayed'";
|
42 |
+
if ( $choice != 'builtin' )
|
43 |
+
echo ' style="display: none;"';
|
44 |
+
echo ">";
|
45 |
+
$this->beforeafter( array( 'rss_before_related', 'rss_after_related' ), __( "Before / after related entries:", 'yarpp' ), 15, '', __( "For example:", 'yarpp' ) . ' <ol></ol>' . __( ' or ', 'yarpp' ) . '<div></div>' );
|
46 |
+
$this->beforeafter( array( 'rss_before_title', 'rss_after_title' ), __( "Before / after each related entry:", 'yarpp' ), 15, '', __( "For example:", 'yarpp' ) . ' <li></li>' . __( ' or ', 'yarpp' ) . '<dl></dl>' );
|
47 |
+
|
48 |
+
$this->checkbox( 'rss_show_excerpt', __( "Show excerpt?", 'yarpp' ), 'show_excerpt' );
|
49 |
+
$this->textbox( 'rss_excerpt_length', __( 'Excerpt length (No. of words):', 'yarpp' ), 10, 'excerpted' );
|
50 |
+
|
51 |
+
$this->beforeafter( array( 'rss_before_post', 'rss_after_post' ), __( "Before / after (excerpt):", 'yarpp' ), 10, 'excerpted', __( "For example:", 'yarpp' ) . ' <li></li>' . __( ' or ', 'yarpp' ) . '<dl></dl>' );
|
52 |
+
|
53 |
+
$this->textbox( 'rss_no_results', __( 'Default display if no results:', 'yarpp' ), 40, 'sync_rss_no_results' );
|
54 |
+
echo "</div>";
|
55 |
+
|
56 |
+
$this->displayorder( 'rss_order', 'rss_displayed' );
|
57 |
+
|
58 |
+
$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://www.yarpp.com' ) )."</code>" ) ) . "'> </span>", 'rss_displayed' );
|
59 |
+
}
|
60 |
+
}
|
classes/YARPP_Meta_Box_Display_Web.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
|
4 |
+
public function display() {
|
5 |
+
global $yarpp;
|
6 |
+
|
7 |
+
echo "<div style='overflow:auto'>";
|
8 |
+
echo '<div class="yarpp_code_display"';
|
9 |
+
if ( !$yarpp->get_option('code_display') )
|
10 |
+
echo ' style="display: none;"';
|
11 |
+
echo '><strong>' . __( "Website display code example", 'yarpp' ) . '</strong><br /><small>' . __( "(Update options to reload.)", 'yarpp' ) . "</small><br/><div id='display_demo_web'></div></div>";
|
12 |
+
|
13 |
+
echo "<div class='yarpp_form_row yarpp_form_post_types'><div>";
|
14 |
+
echo 'Automatically display related content from YARPP Basic on: ';
|
15 |
+
echo " <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' ) ) . "'> </span> ";
|
16 |
+
echo "</div><div>";
|
17 |
+
$post_types = yarpp_get_option( 'auto_display_post_types' );
|
18 |
+
foreach ($yarpp->get_post_types('objects') as $post_type) {
|
19 |
+
echo "<label for='yarpp_post_type_{$post_type->name}'><input id='yarpp_post_type_{$post_type->name}' name='auto_display_post_types[{$post_type->name}]' type='checkbox' ";
|
20 |
+
checked( in_array( $post_type->name, $post_types ) );
|
21 |
+
echo "/> {$post_type->labels->name}</label> ";
|
22 |
+
}
|
23 |
+
echo "</div></div>";
|
24 |
+
|
25 |
+
$this->checkbox( 'auto_display_archive', __( "Also display in archives", 'yarpp' ) );
|
26 |
+
|
27 |
+
$this->textbox( 'limit', __( 'Maximum number of related posts:', 'yarpp' ) );
|
28 |
+
$this->template_checkbox( false );
|
29 |
+
echo "</div>";
|
30 |
+
|
31 |
+
$chosen_template = yarpp_get_option( "template" );
|
32 |
+
$choice = false === $chosen_template ? 'builtin' :
|
33 |
+
( $chosen_template == 'thumbnails' ? 'thumbnails' : 'custom' );
|
34 |
+
|
35 |
+
echo "<div class='postbox yarpp_subbox template_options_custom'";
|
36 |
+
if ( $choice != 'custom' )
|
37 |
+
echo ' style="display: none;"';
|
38 |
+
echo ">";
|
39 |
+
echo '<div class="yarpp_form_row"><div>' . $this->template_text . '</div></div>';
|
40 |
+
$this->template_file( false );
|
41 |
+
echo "</div>";
|
42 |
+
|
43 |
+
echo "<div class='postbox yarpp_subbox template_options_thumbnails'";
|
44 |
+
if ( $choice != 'thumbnails' )
|
45 |
+
echo ' style="display: none;"';
|
46 |
+
echo ">";
|
47 |
+
$this->textbox( 'thumbnails_heading', __( 'Heading:', 'yarpp' ), 40 );
|
48 |
+
$this->textbox( 'thumbnails_default', __( 'Default image (URL):', 'yarpp' ), 40 );
|
49 |
+
$this->textbox( 'no_results', __( 'Default display if no results:', 'yarpp' ), 40, 'sync_no_results' );
|
50 |
+
echo "</div>";
|
51 |
+
|
52 |
+
echo "<div class='postbox yarpp_subbox template_options_builtin'";
|
53 |
+
if ( $choice != 'builtin' )
|
54 |
+
echo ' style="display: none;"';
|
55 |
+
echo ">";
|
56 |
+
$this->beforeafter( array( 'before_related', 'after_related' ), __( "Before / after related entries:", 'yarpp' ), 15, '', __( "For example:", 'yarpp' ) . ' <ol></ol>' . __( ' or ', 'yarpp' ) . '<div></div>' );
|
57 |
+
$this->beforeafter( array( 'before_title', 'after_title' ), __( "Before / after each related entry:", 'yarpp' ), 15, '', __( "For example:", 'yarpp' ) . ' <li></li>' . __( ' or ', 'yarpp' ) . '<dl></dl>' );
|
58 |
+
|
59 |
+
$this->checkbox( 'show_excerpt', __( "Show excerpt?", 'yarpp' ), 'show_excerpt' );
|
60 |
+
$this->textbox( 'excerpt_length', __( 'Excerpt length (No. of words):', 'yarpp' ), 10, 'excerpted' );
|
61 |
+
|
62 |
+
$this->beforeafter( array( 'before_post', 'after_post' ), __( "Before / after (excerpt):", 'yarpp' ), 10, 'excerpted', __( "For example:", 'yarpp' ) . ' <li></li>' . __( ' or ', 'yarpp' ) . '<dl></dl>' );
|
63 |
+
|
64 |
+
$this->textbox( 'no_results', __( 'Default display if no results:', 'yarpp' ), 40, 'sync_no_results' );
|
65 |
+
echo "</div>";
|
66 |
+
|
67 |
+
$this->displayorder( 'order' );
|
68 |
+
|
69 |
+
$this->checkbox( 'promote_yarpp', __( "Help promote Yet Another Related Posts Plugin?", 'yarpp' )
|
70 |
+
." <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://www.yarpp.com' ) ) . "</code>" ) ) ."'> </span>" );
|
71 |
+
}
|
72 |
+
}
|
classes/YARPP_Meta_Box_Optin.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class YARPP_Meta_Box_Optin extends YARPP_Meta_Box {
|
4 |
+
public function display() {
|
5 |
+
$output =
|
6 |
+
'<p>'.
|
7 |
+
'Enable the free <a href="http://www.yarpp.com" target="_blank">YARPP Pro enhancements</a> to add even '.
|
8 |
+
'more power to your blog or website!'.
|
9 |
+
'<br/><br/>'.
|
10 |
+
'<a href="'.plugins_url('/', dirname(__FILE__)).'includes/yarpp_switch.php" class="yarpp_switch_button button" data-go="pro">Turn them on now</a> '.
|
11 |
+
'<a href="http://www.yarpp.com" target="_blank" style="float:right;text-decoration:underline">Learn more</a>'.
|
12 |
+
'</p>'.
|
13 |
+
'<p>'.
|
14 |
+
'We can continue to improve the YARPP product for you if we know how it's used. Please help us by '.
|
15 |
+
'allowing usage data to be sent back.'.
|
16 |
+
'<br/>'.
|
17 |
+
'</p>'.
|
18 |
+
'<input
|
19 |
+
type="checkbox"
|
20 |
+
id="yarpp-optin"
|
21 |
+
name="optin"
|
22 |
+
value="true" '.
|
23 |
+
checked(yarpp_get_option('optin') == 1 ,true, false).' '.
|
24 |
+
'/>'.
|
25 |
+
'<label for="yarpp-optin">Send usage data back.</label>'.
|
26 |
+
'<a href="#" id="yarpp-optin-learnmore" style="float:right;text-decoration:underline">Learn More</a>'
|
27 |
+
;
|
28 |
+
echo $output;
|
29 |
+
}
|
30 |
+
}
|
classes/YARPP_Meta_Box_Pool.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class YARPP_Meta_Box_Pool extends YARPP_Meta_Box {
|
4 |
+
public function exclude($taxonomy, $string) {
|
5 |
+
global $yarpp;
|
6 |
+
|
7 |
+
echo "<div class='yarpp_form_row yarpp_form_exclude'><div class='yarpp_form_label'>";
|
8 |
+
echo $string;
|
9 |
+
echo "</div><div class='yarpp_scroll_wrapper'><div class='exclude_terms' id='exclude_{$taxonomy}'>";
|
10 |
+
|
11 |
+
$exclude_tt_ids = wp_parse_id_list( yarpp_get_option( 'exclude' ) );
|
12 |
+
$exclude_term_ids = $yarpp->admin->get_term_ids_from_tt_ids($taxonomy, $exclude_tt_ids);
|
13 |
+
if ( count( $exclude_term_ids ) ) {
|
14 |
+
$terms = get_terms( $taxonomy, array( 'include' => $exclude_term_ids ) );
|
15 |
+
foreach ( $terms as $term ) {
|
16 |
+
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> ";
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
echo "</div></div></div>";
|
21 |
+
}
|
22 |
+
|
23 |
+
public function display() {
|
24 |
+
global $yarpp;
|
25 |
+
$postTypeHelpMsg =
|
26 |
+
'If you don't want one of these post types to display as related content, '.
|
27 |
+
'uncheck the appropriate box in the “Display Options” panel below. Make sure you '.
|
28 |
+
'click the “Save Changes button” at the bottom of this page.';
|
29 |
+
|
30 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_meta_box_pool.phtml');
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
classes/YARPP_Meta_Box_Relatedness.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
|
4 |
+
public function display() {
|
5 |
+
global $yarpp;
|
6 |
+
?>
|
7 |
+
<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' ) ); ?>"> </span></p>
|
8 |
+
|
9 |
+
<?php
|
10 |
+
$this->textbox( 'threshold', __( 'Match threshold:', 'yarpp' ) );
|
11 |
+
$this->weight( 'title', __( "Titles: ", 'yarpp' ) );
|
12 |
+
$this->weight( 'body', __( "Bodies: ", 'yarpp' ) );
|
13 |
+
|
14 |
+
foreach ( $yarpp->get_taxonomies() as $taxonomy ) {
|
15 |
+
$this->tax_weight( $taxonomy );
|
16 |
+
}
|
17 |
+
|
18 |
+
$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' ) ) . "'> </span>" );
|
19 |
+
$this->checkbox( 'past_only', __( "Show only previous posts?", 'yarpp' ) );
|
20 |
+
}
|
21 |
+
}
|
classes/YARPP_Meta_Boxes.php
DELETED
@@ -1,484 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class YARPP_Meta_Box {
|
4 |
-
protected $template_text = null;
|
5 |
-
|
6 |
-
function __construct() {
|
7 |
-
$this->template_text =
|
8 |
-
__(
|
9 |
-
"This advanced option gives you full power to customize how your related posts are displayed. ".
|
10 |
-
"Templates (stored in your theme folder) are written in PHP.",
|
11 |
-
'yarpp'
|
12 |
-
);
|
13 |
-
}
|
14 |
-
|
15 |
-
function checkbox($option, $desc, $class=null) {
|
16 |
-
$out =
|
17 |
-
"<div class='yarpp_form_row yarpp_form_checkbox $class'><div scope='row'>".
|
18 |
-
"<input type='checkbox' name='$option' id='yarpp-$option' value='true'".
|
19 |
-
checked(yarpp_get_option($option), true, false).
|
20 |
-
" /> <label for='yarpp-$option'>$desc</label></div></div>";
|
21 |
-
|
22 |
-
echo $out;
|
23 |
-
}
|
24 |
-
|
25 |
-
private function offer_copy_templates() {
|
26 |
-
global $yarpp;
|
27 |
-
return (!$yarpp->diagnostic_custom_templates() && $yarpp->admin->can_copy_templates());
|
28 |
-
}
|
29 |
-
|
30 |
-
public function template_checkbox($rss=false, $class=null) {
|
31 |
-
global $yarpp;
|
32 |
-
|
33 |
-
$pre = ($rss) ? 'rss_' : '';
|
34 |
-
$chosen_template = yarpp_get_option($pre."template");
|
35 |
-
$choice = ($chosen_template === false)
|
36 |
-
? 'builtin'
|
37 |
-
: (($chosen_template === 'thumbnails') ? 'thumbnails' : 'custom');
|
38 |
-
|
39 |
-
echo '<div class="yarpp_form_row yarpp_form_template_buttons '.$class.'">';
|
40 |
-
|
41 |
-
echo "<div data-value='builtin' class='yarpp_template_button";
|
42 |
-
if ($choice === 'builtin') echo ' active';
|
43 |
-
echo "'><div class='image'></div><div class='label'>" . __( 'List', 'yarpp' ) . "</div></div>";
|
44 |
-
|
45 |
-
echo "<div data-value='thumbnails' class='yarpp_template_button";
|
46 |
-
if ($choice === 'thumbnails') echo ' active';
|
47 |
-
if (!$yarpp->diagnostic_post_thumbnails()) echo ' disabled';
|
48 |
-
echo "'";
|
49 |
-
if (!$yarpp->diagnostic_post_thumbnails()) {
|
50 |
-
echo ' data-help="'.esc_attr(__('This option is disabled because your theme does not support post thumbnails.', 'yarpp')).'"';
|
51 |
-
}
|
52 |
-
echo "><div class='image'></div><div class='label'>".__('Thumbnails', 'yarpp')."</div></div>";
|
53 |
-
|
54 |
-
echo "<div data-value='custom' class='yarpp_template_button";
|
55 |
-
if ($choice === 'custom') echo ' active';
|
56 |
-
if (!$yarpp->diagnostic_custom_templates()) echo ' disabled';
|
57 |
-
echo "'";
|
58 |
-
if (!$yarpp->diagnostic_custom_templates()) {
|
59 |
-
$help = __('This option is disabled because no YARPP templates were found in your theme.', 'yarpp');
|
60 |
-
if ($this->offer_copy_templates()) {
|
61 |
-
$help .= ' '.__("Would you like to copy some sample templates bundled with YARPP into your theme?", 'yarpp')."<input type='button' class='button button-small yarpp_copy_templates_button' value='".esc_attr(__('Copy Templates', 'yarpp'))."'/>";
|
62 |
-
}
|
63 |
-
echo " data-help='".esc_attr($help)."'";
|
64 |
-
}
|
65 |
-
echo "><div class='image'></div><div class='label'>".__('Custom', 'yarpp')."</div></div>";
|
66 |
-
|
67 |
-
echo "<input type='hidden' name='{$pre}use_template' id='yarpp-{$pre}use_template' class='use_template' value='{$choice}' />";
|
68 |
-
|
69 |
-
echo "</div>";
|
70 |
-
|
71 |
-
}
|
72 |
-
|
73 |
-
public function template_file($rss=false, $class=null) {
|
74 |
-
global $yarpp;
|
75 |
-
$pre = ($rss) ? 'rss_' : '';
|
76 |
-
|
77 |
-
echo "<div class='yarpp_form_row yarpp_form_template_file $class'><div class='yarpp_form_label'>";
|
78 |
-
_e("Template file:", 'yarpp');
|
79 |
-
echo "</div><div><select name='{$pre}template_file' id='{$pre}template_file'>";
|
80 |
-
|
81 |
-
$chosen_template = yarpp_get_option("{$pre}template");
|
82 |
-
foreach ($yarpp->get_templates() as $template) {
|
83 |
-
echo "<option value='".esc_attr($template['basename'])."'".selected($template['basename'], $chosen_template, false);
|
84 |
-
foreach ($template as $key => $value) {
|
85 |
-
echo " data-{$key}='".esc_attr($value)."'";
|
86 |
-
}
|
87 |
-
echo '>'.esc_html($template['name']).'</option>';
|
88 |
-
}
|
89 |
-
echo "</select><p class='template_file_wrap'><span id='{$pre}template_file'></span></p><p class='template_author_wrap'>".__( 'Author:' )." <span id='{$pre}template_author'></span></p><p class='template_description_wrap'><span id='{$pre}template_description'></span></p></div></div>";
|
90 |
-
}
|
91 |
-
|
92 |
-
public function textbox($option, $desc, $size=2, $class=null, $note=null) {
|
93 |
-
$value = esc_attr(yarpp_get_option($option));
|
94 |
-
echo "<div class='yarpp_form_row yarpp_form_textbox $class'><div class='yarpp_form_label'>";
|
95 |
-
echo "{$desc}</div><div><input name='{$option}' type='text' id='{$option}' value='{$value}' size='{$size}' />";
|
96 |
-
if ($note) {
|
97 |
-
echo " <em><small>{$note}</small></em>";
|
98 |
-
}
|
99 |
-
echo "</div></div>";
|
100 |
-
}
|
101 |
-
|
102 |
-
public function beforeafter($options, $desc, $size=10, $class=null, $note=null) {
|
103 |
-
echo "<div class='yarpp_form_row yarpp_form_textbox {$class}'><div class='yarpp_form_label'>{$desc}</div><div>";
|
104 |
-
$value = esc_attr( yarpp_get_option( $options[0] ) );
|
105 |
-
echo "<input name='{$options[0]}' type='text' id='{$options[0]}' value='{$value}' size='{$size}' /> <span class='yarpp_divider'>/</span> ";
|
106 |
-
$value = esc_attr( yarpp_get_option( $options[1] ) );
|
107 |
-
echo "<input name='{$options[1]}' type='text' id='{$options[1]}' value='{$value}' size='{$size}' />";
|
108 |
-
if ($note){
|
109 |
-
echo " <em><small>{$note}</small></em>";
|
110 |
-
}
|
111 |
-
echo "</div></div>";
|
112 |
-
}
|
113 |
-
|
114 |
-
public function tax_weight($taxonomy) {
|
115 |
-
$weight = (int) yarpp_get_option("weight[tax][{$taxonomy->name}]");
|
116 |
-
$require = (int) yarpp_get_option("require_tax[{$taxonomy->name}]");
|
117 |
-
|
118 |
-
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}]'>";
|
119 |
-
echo "<option value='no'".((!$weight && !$require) ? ' selected="selected"': '' )." > ".__("do not consider", 'yarpp')."</option>";
|
120 |
-
echo "<option value='consider'".(($weight == 1 && !$require) ? ' selected="selected"': '' )." >".__("consider", 'yarpp')."</option>";
|
121 |
-
echo "<option value='consider_extra'".(($weight > 1 && !$require) ? ' selected="selected"': '' )." >".__("consider with extra weight", 'yarpp')."</option>";
|
122 |
-
echo "<option value='require_one'".(($require == 1) ? ' selected="selected"': '' )." >".sprintf(__("require at least one %s in common", 'yarpp'), $taxonomy->labels->singular_name)."</option>";
|
123 |
-
echo "<option value='require_more'".(($require == 2) ? ' selected="selected"': '' )." >".sprintf(__("require more than one %s in common", 'yarpp'), $taxonomy->labels->singular_name)."</option>";
|
124 |
-
echo "</select></div></div>";
|
125 |
-
}
|
126 |
-
|
127 |
-
public function weight($option, $desc) {
|
128 |
-
global $yarpp;
|
129 |
-
|
130 |
-
$weight = (int) yarpp_get_option("weight[$option]");
|
131 |
-
|
132 |
-
/* Both require MyISAM fulltext indexing: */
|
133 |
-
$fulltext = $yarpp->diagnostic_fulltext_disabled() ? ' readonly="readonly" disabled="disabled"' : '';
|
134 |
-
|
135 |
-
echo "<div class='yarpp_form_row yarpp_form_select'><div class='yarpp_form_label'>{$desc}</div><div>";
|
136 |
-
echo "<select name='weight[{$option}]'>";
|
137 |
-
echo "<option {$fulltext} value='no'".((!$weight) ? ' selected="selected"': '')." >".__("do not consider", 'yarpp')."</option>";
|
138 |
-
echo "<option {$fulltext} value='consider'".(($weight == 1) ? ' selected="selected"': '')." > ".__("consider", 'yarpp')."</option>";
|
139 |
-
echo "<option {$fulltext} value='consider_extra'".(($weight > 1) ? ' selected="selected"': '')." > ".__("consider with extra weight", 'yarpp')."</option>";
|
140 |
-
echo "</select></div></div>";
|
141 |
-
}
|
142 |
-
|
143 |
-
public function displayorder($option, $class=null) {
|
144 |
-
echo "<div class='yarpp_form_row yarpp_form_select $class'><div class='yarpp_form_label'>";
|
145 |
-
_e( "Order results:", 'yarpp' );
|
146 |
-
echo "</div><div><select name='$option' id='<?php echo $option; ?>'>";
|
147 |
-
$order = yarpp_get_option( $option );
|
148 |
-
?>
|
149 |
-
<option value="score DESC" <?php echo ( $order == 'score DESC'?' selected="selected"':'' )?>><?php _e( "score (high relevance to low)", 'yarpp' ); ?></option>
|
150 |
-
<option value="score ASC" <?php echo ( $order == 'score ASC'?' selected="selected"':'' )?>><?php _e( "score (low relevance to high)", 'yarpp' ); ?></option>
|
151 |
-
<option value="post_date DESC" <?php echo ( $order == 'post_date DESC'?' selected="selected"':'' )?>><?php _e( "date (new to old)", 'yarpp' ); ?></option>
|
152 |
-
<option value="post_date ASC" <?php echo ( $order == 'post_date ASC'?' selected="selected"':'' )?>><?php _e( "date (old to new)", 'yarpp' ); ?></option>
|
153 |
-
<option value="post_title ASC" <?php echo ( $order == 'post_title ASC'?' selected="selected"':'' )?>><?php _e( "title (alphabetical)", 'yarpp' ); ?></option>
|
154 |
-
<option value="post_title DESC" <?php echo ( $order == 'post_title DESC'?' selected="selected"':'' )?>><?php _e( "title (reverse alphabetical)", 'yarpp' ); ?></option>
|
155 |
-
<?php
|
156 |
-
echo "</select></div></div>";
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
class YARPP_Meta_Box_Pool extends YARPP_Meta_Box {
|
161 |
-
public function exclude($taxonomy, $string) {
|
162 |
-
global $yarpp;
|
163 |
-
|
164 |
-
echo "<div class='yarpp_form_row yarpp_form_exclude'><div class='yarpp_form_label'>";
|
165 |
-
echo $string;
|
166 |
-
echo "</div><div class='yarpp_scroll_wrapper'><div class='exclude_terms' id='exclude_{$taxonomy}'>";
|
167 |
-
|
168 |
-
$exclude_tt_ids = wp_parse_id_list( yarpp_get_option( 'exclude' ) );
|
169 |
-
$exclude_term_ids = $yarpp->admin->get_term_ids_from_tt_ids($taxonomy, $exclude_tt_ids);
|
170 |
-
if ( count( $exclude_term_ids ) ) {
|
171 |
-
$terms = get_terms( $taxonomy, array( 'include' => $exclude_term_ids ) );
|
172 |
-
foreach ( $terms as $term ) {
|
173 |
-
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> ";
|
174 |
-
}
|
175 |
-
}
|
176 |
-
|
177 |
-
echo "</div></div></div>";
|
178 |
-
}
|
179 |
-
|
180 |
-
public function display() {
|
181 |
-
global $yarpp;
|
182 |
-
|
183 |
-
echo "<p>";
|
184 |
-
_e( '"The Pool" refers to the pool of posts and pages that are candidates for display as related to the current entry.', 'yarpp' );
|
185 |
-
echo "</p>\n";
|
186 |
-
?>
|
187 |
-
<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='#help-dev' id='yarpp-help-cpt' class='yarpp_help'> </a></div></div>
|
188 |
-
|
189 |
-
<?php
|
190 |
-
foreach ($yarpp->get_taxonomies() as $taxonomy) {
|
191 |
-
$this->exclude( $taxonomy->name, sprintf( __( 'Disallow by %s:', 'yarpp' ), $taxonomy->labels->singular_name ) );
|
192 |
-
}
|
193 |
-
$this->checkbox( 'show_pass_post', __( "Show password protected posts?", 'yarpp' ) );
|
194 |
-
|
195 |
-
$recent = yarpp_get_option( 'recent' );
|
196 |
-
if ((bool) $recent) {
|
197 |
-
list( $recent_number, $recent_units ) = explode( ' ', $recent );
|
198 |
-
} else {
|
199 |
-
$recent_number = 12;
|
200 |
-
$recent_units = 'month';
|
201 |
-
}
|
202 |
-
$recent_number = "<input name=\"recent_number\" type=\"text\" id=\"recent_number\" value=\"".esc_attr( $recent_number )."\" size=\"2\" />";
|
203 |
-
$recent_units = "<select name=\"recent_units\" id=\"recent_units\">
|
204 |
-
<option value='day'" . ( ( 'day'==$recent_units) ? " selected='selected'" : '' ) . ">" . __( 'day(s)', 'yarpp' )."</option>
|
205 |
-
<option value='week'" . ( ( 'week'==$recent_units ) ? " selected='selected'" : '' ) . ">" . __( 'week(s)', 'yarpp' )."</option>
|
206 |
-
<option value='month'" . ( ( 'month'==$recent_units ) ? " selected='selected'" : '' ) . ">" . __( 'month(s)', 'yarpp' ) . "</option>
|
207 |
-
</select>";
|
208 |
-
|
209 |
-
echo "<div class='yarpp_form_row yarpp_form_checkbox'><div><input type='checkbox' name='recent_only' value='true'";
|
210 |
-
checked((bool) $recent);
|
211 |
-
echo " /> ";
|
212 |
-
echo str_replace( 'NUMBER', $recent_number, str_replace( 'UNITS', $recent_units, __( "Show only posts from the past NUMBER UNITS", 'yarpp' ) ) );
|
213 |
-
echo "</div></div>";
|
214 |
-
|
215 |
-
}
|
216 |
-
|
217 |
-
}/*end class*/
|
218 |
-
|
219 |
-
add_meta_box(
|
220 |
-
'yarpp_pool',
|
221 |
-
__( '"The Pool"', 'yarpp' ),
|
222 |
-
array(new YARPP_Meta_Box_Pool, 'display'),
|
223 |
-
'settings_page_yarpp',
|
224 |
-
'normal',
|
225 |
-
'core'
|
226 |
-
);
|
227 |
-
|
228 |
-
class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
|
229 |
-
function display() {
|
230 |
-
global $yarpp;
|
231 |
-
?>
|
232 |
-
<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' ) ); ?>"> </span></p>
|
233 |
-
|
234 |
-
<?php
|
235 |
-
$this->textbox( 'threshold', __( 'Match threshold:', 'yarpp' ) );
|
236 |
-
$this->weight( 'title', __( "Titles: ", 'yarpp' ) );
|
237 |
-
$this->weight( 'body', __( "Bodies: ", 'yarpp' ) );
|
238 |
-
|
239 |
-
foreach ( $yarpp->get_taxonomies() as $taxonomy ) {
|
240 |
-
$this->tax_weight( $taxonomy );
|
241 |
-
}
|
242 |
-
|
243 |
-
$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' ) ) . "'> </span>" );
|
244 |
-
$this->checkbox( 'past_only', __( "Show only previous posts?", 'yarpp' ) );
|
245 |
-
}
|
246 |
-
}
|
247 |
-
|
248 |
-
add_meta_box( 'yarpp_relatedness', __( '"Relatedness" options', 'yarpp' ), array( new YARPP_Meta_Box_Relatedness, 'display' ), 'settings_page_yarpp', 'normal', 'core' );
|
249 |
-
|
250 |
-
class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
|
251 |
-
function display() {
|
252 |
-
global $yarpp;
|
253 |
-
|
254 |
-
echo "<div style='overflow:auto'>";
|
255 |
-
echo '<div class="yarpp_code_display"';
|
256 |
-
if ( !$yarpp->get_option('code_display') )
|
257 |
-
echo ' style="display: none;"';
|
258 |
-
echo '><strong>' . __( "Website display code example", 'yarpp' ) . '</strong><br /><small>' . __( "(Update options to reload.)", 'yarpp' ) . "</small><br/><div id='display_demo_web'></div></div>";
|
259 |
-
|
260 |
-
echo "<div class='yarpp_form_row yarpp_form_post_types'><div class='yarpp_form_label'>";
|
261 |
-
_e( "Automatically display:", 'yarpp' );
|
262 |
-
echo " <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' ) ) . "'> </span>";
|
263 |
-
echo "</div><div>";
|
264 |
-
$post_types = yarpp_get_option( 'auto_display_post_types' );
|
265 |
-
foreach ( $yarpp->get_post_types( 'objects' ) as $post_type ) {
|
266 |
-
echo "<label for='yarpp_post_type_{$post_type->name}'><input id='yarpp_post_type_{$post_type->name}' name='auto_display_post_types[{$post_type->name}]' type='checkbox' ";
|
267 |
-
checked( in_array( $post_type->name, $post_types ) );
|
268 |
-
echo "/> {$post_type->labels->name}</label> ";
|
269 |
-
}
|
270 |
-
echo "</div></div>";
|
271 |
-
|
272 |
-
$this->checkbox( 'auto_display_archive', __( "Also display in archives", 'yarpp' ) );
|
273 |
-
|
274 |
-
$this->textbox( 'limit', __( 'Maximum number of related posts:', 'yarpp' ) );
|
275 |
-
$this->template_checkbox( false );
|
276 |
-
echo "</div>";
|
277 |
-
|
278 |
-
$chosen_template = yarpp_get_option( "template" );
|
279 |
-
$choice = false === $chosen_template ? 'builtin' :
|
280 |
-
( $chosen_template == 'thumbnails' ? 'thumbnails' : 'custom' );
|
281 |
-
|
282 |
-
echo "<div class='postbox yarpp_subbox template_options_custom'";
|
283 |
-
if ( $choice != 'custom' )
|
284 |
-
echo ' style="display: none;"';
|
285 |
-
echo ">";
|
286 |
-
echo '<div class="yarpp_form_row"><div>' . $this->template_text . '</div></div>';
|
287 |
-
$this->template_file( false );
|
288 |
-
echo "</div>";
|
289 |
-
|
290 |
-
echo "<div class='postbox yarpp_subbox template_options_thumbnails'";
|
291 |
-
if ( $choice != 'thumbnails' )
|
292 |
-
echo ' style="display: none;"';
|
293 |
-
echo ">";
|
294 |
-
$this->textbox( 'thumbnails_heading', __( 'Heading:', 'yarpp' ), 40 );
|
295 |
-
$this->textbox( 'thumbnails_default', __( 'Default image (URL):', 'yarpp' ), 40 );
|
296 |
-
$this->textbox( 'no_results', __( 'Default display if no results:', 'yarpp' ), 40, 'sync_no_results' );
|
297 |
-
echo "</div>";
|
298 |
-
|
299 |
-
echo "<div class='postbox yarpp_subbox template_options_builtin'";
|
300 |
-
if ( $choice != 'builtin' )
|
301 |
-
echo ' style="display: none;"';
|
302 |
-
echo ">";
|
303 |
-
$this->beforeafter( array( 'before_related', 'after_related' ), __( "Before / after related entries:", 'yarpp' ), 15, '', __( "For example:", 'yarpp' ) . ' <ol></ol>' . __( ' or ', 'yarpp' ) . '<div></div>' );
|
304 |
-
$this->beforeafter( array( 'before_title', 'after_title' ), __( "Before / after each related entry:", 'yarpp' ), 15, '', __( "For example:", 'yarpp' ) . ' <li></li>' . __( ' or ', 'yarpp' ) . '<dl></dl>' );
|
305 |
-
|
306 |
-
$this->checkbox( 'show_excerpt', __( "Show excerpt?", 'yarpp' ), 'show_excerpt' );
|
307 |
-
$this->textbox( 'excerpt_length', __( 'Excerpt length (No. of words):', 'yarpp' ), 10, 'excerpted' );
|
308 |
-
|
309 |
-
$this->beforeafter( array( 'before_post', 'after_post' ), __( "Before / after (excerpt):", 'yarpp' ), 10, 'excerpted', __( "For example:", 'yarpp' ) . ' <li></li>' . __( ' or ', 'yarpp' ) . '<dl></dl>' );
|
310 |
-
|
311 |
-
$this->textbox( 'no_results', __( 'Default display if no results:', 'yarpp' ), 40, 'sync_no_results' );
|
312 |
-
echo "</div>";
|
313 |
-
|
314 |
-
$this->displayorder( 'order' );
|
315 |
-
|
316 |
-
$this->checkbox( 'promote_yarpp', __( "Help promote Yet Another Related Posts Plugin?", 'yarpp' )
|
317 |
-
." <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://www.yarpp.com' ) ) . "</code>" ) ) ."'> </span>" );
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
321 |
-
add_meta_box( 'yarpp_display_web', __( 'Display options <small>for your website</small>', 'yarpp' ), array( new YARPP_Meta_Box_Display_Web, 'display' ), 'settings_page_yarpp', 'normal', 'core' );
|
322 |
-
|
323 |
-
class YARPP_Meta_Box_Display_Feed extends YARPP_Meta_Box {
|
324 |
-
function display() {
|
325 |
-
global $yarpp;
|
326 |
-
|
327 |
-
echo "<div style='overflow:auto'>";
|
328 |
-
echo '<div class="rss_displayed yarpp_code_display"';
|
329 |
-
if ( !$yarpp->get_option('code_display') )
|
330 |
-
echo ' style="display: none;"';
|
331 |
-
echo '><b>' . __( "RSS display code example", 'yarpp' ) . '</b><br /><small>' . __( "(Update options to reload.)", 'yarpp' ) . "</small><br/><div id='display_demo_rss'></div></div>";
|
332 |
-
|
333 |
-
$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' ) ) . "'> </span>", '' );
|
334 |
-
$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' ) ) . "'> </span>", 'rss_displayed' );
|
335 |
-
|
336 |
-
$this->textbox( 'rss_limit', __( 'Maximum number of related posts:', 'yarpp' ), 2, 'rss_displayed' );
|
337 |
-
$this->template_checkbox( true, 'rss_displayed' );
|
338 |
-
echo "</div>";
|
339 |
-
|
340 |
-
$chosen_template = yarpp_get_option( "rss_template" );
|
341 |
-
$choice = false === $chosen_template ? 'builtin' :
|
342 |
-
( $chosen_template == 'thumbnails' ? 'thumbnails' : 'custom' );
|
343 |
-
|
344 |
-
echo "<div class='postbox yarpp_subbox template_options_custom rss_displayed'";
|
345 |
-
if ( $choice != 'custom' )
|
346 |
-
echo ' style="display: none;"';
|
347 |
-
echo ">";
|
348 |
-
echo '<div class="yarpp_form_row"><div>' . $this->template_text . '</div></div>';
|
349 |
-
$this->template_file( true );
|
350 |
-
echo "</div>";
|
351 |
-
|
352 |
-
echo "<div class='postbox yarpp_subbox template_options_thumbnails'";
|
353 |
-
if ( $choice != 'thumbnails' )
|
354 |
-
echo ' style="display: none;"';
|
355 |
-
echo ">";
|
356 |
-
$this->textbox( 'rss_thumbnails_heading', __( 'Heading:', 'yarpp' ), 40 );
|
357 |
-
$this->textbox( 'rss_thumbnails_default', __( 'Default image (URL):', 'yarpp' ), 40 );
|
358 |
-
$this->textbox( 'rss_no_results', __( 'Default display if no results:', 'yarpp' ), 40, 'sync_rss_no_results' );
|
359 |
-
echo "</div>";
|
360 |
-
|
361 |
-
echo "<div class='postbox yarpp_subbox template_options_builtin rss_displayed'";
|
362 |
-
if ( $choice != 'builtin' )
|
363 |
-
echo ' style="display: none;"';
|
364 |
-
echo ">";
|
365 |
-
$this->beforeafter( array( 'rss_before_related', 'rss_after_related' ), __( "Before / after related entries:", 'yarpp' ), 15, '', __( "For example:", 'yarpp' ) . ' <ol></ol>' . __( ' or ', 'yarpp' ) . '<div></div>' );
|
366 |
-
$this->beforeafter( array( 'rss_before_title', 'rss_after_title' ), __( "Before / after each related entry:", 'yarpp' ), 15, '', __( "For example:", 'yarpp' ) . ' <li></li>' . __( ' or ', 'yarpp' ) . '<dl></dl>' );
|
367 |
-
|
368 |
-
$this->checkbox( 'rss_show_excerpt', __( "Show excerpt?", 'yarpp' ), 'show_excerpt' );
|
369 |
-
$this->textbox( 'rss_excerpt_length', __( 'Excerpt length (No. of words):', 'yarpp' ), 10, 'excerpted' );
|
370 |
-
|
371 |
-
$this->beforeafter( array( 'rss_before_post', 'rss_after_post' ), __( "Before / after (excerpt):", 'yarpp' ), 10, 'excerpted', __( "For example:", 'yarpp' ) . ' <li></li>' . __( ' or ', 'yarpp' ) . '<dl></dl>' );
|
372 |
-
|
373 |
-
$this->textbox( 'rss_no_results', __( 'Default display if no results:', 'yarpp' ), 40, 'sync_rss_no_results' );
|
374 |
-
echo "</div>";
|
375 |
-
|
376 |
-
$this->displayorder( 'rss_order', 'rss_displayed' );
|
377 |
-
|
378 |
-
$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://www.yarpp.com' ) )."</code>" ) ) . "'> </span>", 'rss_displayed' );
|
379 |
-
}
|
380 |
-
}
|
381 |
-
|
382 |
-
add_meta_box('yarpp_display_rss', __('Display options <small>for RSS</small>', 'yarpp'), array( new YARPP_Meta_Box_Display_Feed, 'display'), 'settings_page_yarpp', 'normal', 'core');
|
383 |
-
|
384 |
-
class YARPP_Meta_Box_Contact extends YARPP_Meta_Box {
|
385 |
-
function display() {
|
386 |
-
global $yarpp;
|
387 |
-
|
388 |
-
$happy = ($yarpp->diagnostic_happy()) ? 'spin' : null;
|
389 |
-
|
390 |
-
$out =
|
391 |
-
'<ul class="yarpp_contacts">'.
|
392 |
-
'<li>'.
|
393 |
-
'<a href="http://wordpress.org/support/plugin/yet-another-related-posts-plugin" target="_blank">'.
|
394 |
-
'<span class="icon icon-wordpress"></span> '.__('YARPP Forum', 'yarpp').
|
395 |
-
'</a>'.
|
396 |
-
'</li>'.
|
397 |
-
'<li>'.
|
398 |
-
'<a href="http://twitter.com/yarpp" target="_blank">'.
|
399 |
-
'<span class="icon icon-twitter"></span> '.__('YARPP on Twitter', 'yarpp').
|
400 |
-
'</a>'.
|
401 |
-
'</li>'.
|
402 |
-
'<li>'.
|
403 |
-
'<a href="https://www.facebook.com/YARPPRecommendationEngine" target="_blank">'.
|
404 |
-
'<span class="icon icon-facebook"></span> YARPP on Facebook'.
|
405 |
-
'</a>'.
|
406 |
-
'</li>'.
|
407 |
-
'<li>'.
|
408 |
-
'<a href="http://www.yarpp.com" target="_blank">'.
|
409 |
-
'<span class="icon icon-pro"></span> Learn more about YARPP'.
|
410 |
-
'</a>'.
|
411 |
-
'</li>'.
|
412 |
-
'<li>'.
|
413 |
-
'<a href="http://wordpress.org/support/view/plugin-reviews/yet-another-related-posts-plugin" target="_blank">'.
|
414 |
-
'<span class="icon icon-star '.$happy.'"></span> '.__('Review YARPP on WordPress.org', 'yarpp').
|
415 |
-
'</a>'.
|
416 |
-
'</li>'.
|
417 |
-
'</ul>';
|
418 |
-
|
419 |
-
echo $out;
|
420 |
-
}/*end display*/
|
421 |
-
|
422 |
-
}/*end class yarpp_matabox_contact*/
|
423 |
-
|
424 |
-
add_meta_box(
|
425 |
-
'yarpp_display_optin',
|
426 |
-
'Get the Most Out of YARPP',
|
427 |
-
array(
|
428 |
-
new YARPP_Meta_Box_Optin,
|
429 |
-
'display'
|
430 |
-
),
|
431 |
-
'settings_page_yarpp',
|
432 |
-
'side',
|
433 |
-
'core'
|
434 |
-
);
|
435 |
-
|
436 |
-
// longest filter name ever
|
437 |
-
add_filter( "postbox_classes_settings_page_yarpp_yarpp_display_optin", 'yarpp_make_optin_classy' );
|
438 |
-
function yarpp_make_optin_classy( $classes ) {
|
439 |
-
if ( !yarpp_get_option( 'optin' ) )
|
440 |
-
$classes[] = 'yarpp_attention';
|
441 |
-
return $classes;
|
442 |
-
}
|
443 |
-
|
444 |
-
class YARPP_Meta_Box_Optin extends YARPP_Meta_Box {
|
445 |
-
function display() {
|
446 |
-
global $yarpp;
|
447 |
-
|
448 |
-
echo (
|
449 |
-
'<p>'.
|
450 |
-
'Enable the free <a href="http://www.yarpp.com" target="_blank">YARPP Pro enhancements</a> to add even '.
|
451 |
-
'more power to your blog or website!'.
|
452 |
-
'<br/><br/>'.
|
453 |
-
'<a href="'.plugins_url('/', dirname(__FILE__)).'includes/yarpp_switch.php" style="text-decoration:underline" class="yarpp_switch_button" data-go="pro">Turn them on now</a> '.
|
454 |
-
'<a href="http://www.yarpp.com" target="_blank" style="float:right;text-decoration:underline">Learn more</a>'.
|
455 |
-
'</p>'.
|
456 |
-
'<p>'.
|
457 |
-
'We can continue to improve the YARPP product for you if we know how it's used. Please help us by '.
|
458 |
-
'allowing usage data to be sent back.'.
|
459 |
-
'<br/>'.
|
460 |
-
'</p>'
|
461 |
-
);
|
462 |
-
|
463 |
-
echo (
|
464 |
-
'<input type="checkbox" id="yarpp-optin" name="optin" value="true" '.checked(yarpp_get_option('optin') == 1 ,true, false).'/>'.
|
465 |
-
'<label for="yarpp-optin">Send usage data back.</label>'.
|
466 |
-
'<a href="#" id="yarpp-optin-learnmore" style="float:right;text-decoration:underline">Learn More</a>'
|
467 |
-
);
|
468 |
-
|
469 |
-
}/*end display*/
|
470 |
-
|
471 |
-
}/*YARPP_Meta_Box_Optin*/
|
472 |
-
|
473 |
-
add_meta_box(
|
474 |
-
'yarpp_display_contact',
|
475 |
-
__('Contact YARPP', 'yarpp'),
|
476 |
-
array(new YARPP_Meta_Box_Contact, 'display'),
|
477 |
-
'settings_page_yarpp',
|
478 |
-
'side',
|
479 |
-
'core'
|
480 |
-
);
|
481 |
-
|
482 |
-
// since 3.3: hook for registering new YARPP meta boxes
|
483 |
-
do_action('add_meta_boxes_settings_page_yarpp');
|
484 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/YARPP_Widget.php
CHANGED
@@ -6,14 +6,14 @@
|
|
6 |
class YARPP_Widget extends WP_Widget {
|
7 |
|
8 |
public function __construct() {
|
9 |
-
parent::WP_Widget(false,
|
|
|
10 |
}
|
11 |
|
12 |
public function widget($args, $instance) {
|
13 |
-
|
14 |
-
|
15 |
-
if (!is_singular()) return;
|
16 |
|
|
|
17 |
extract($args);
|
18 |
|
19 |
/* Compatibility with pre-3.5 settings: */
|
@@ -30,158 +30,84 @@ class YARPP_Widget extends WP_Widget {
|
|
30 |
}
|
31 |
|
32 |
$title = apply_filters('widget_title', $instance['title']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
echo $before_title;
|
37 |
-
echo $title;
|
38 |
-
echo $after_title;
|
39 |
-
}
|
40 |
-
|
41 |
-
$instance['domain'] = 'widget';
|
42 |
-
$yarpp->display_related(null, $instance, true);
|
43 |
-
echo $after_widget;
|
44 |
}
|
45 |
|
46 |
public function update($new_instance, $old_instance) {
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
$choice = false === $instance['template'] ? 'builtin' :
|
60 |
-
( $instance['template'] == 'thumbnails' ? 'thumbnails' : 'custom' );
|
61 |
-
|
62 |
-
if ((bool) $instance['template'] ) // don't save the title change.
|
63 |
-
$instance['title'] = $old_instance['title'];
|
64 |
-
else // save the title change:
|
65 |
-
$instance['title'] = $new_instance['title'];
|
66 |
-
|
67 |
-
if ((bool) $instance['thumbnails_heading'] ) // don't save the title change.
|
68 |
-
$instance['thumbnails_heading'] = $old_instance['thumbnails_heading'];
|
69 |
-
else // save the title change:
|
70 |
-
$instance['thumbnails_heading'] = $new_instance['thumbnails_heading'];
|
71 |
|
72 |
return $instance;
|
73 |
}
|
74 |
|
75 |
public function form($instance) {
|
76 |
global $yarpp;
|
77 |
-
|
78 |
$instance = wp_parse_args(
|
79 |
$instance,
|
80 |
array(
|
81 |
-
'title' =>
|
82 |
'thumbnails_heading' => $yarpp->get_option('thumbnails_heading'),
|
83 |
'template' => false,
|
84 |
-
'
|
|
|
|
|
85 |
)
|
86 |
);
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
$choice = ($instance['template'] ===
|
94 |
-
? 'builtin'
|
95 |
-
: (($instance['template'] === 'thumbnails') ? 'thumbnails' : 'custom');
|
96 |
|
97 |
-
|
98 |
$templates = $yarpp->get_templates();
|
99 |
|
100 |
if (!$yarpp->diagnostic_custom_templates() && $choice === 'custom') $choice = 'builtin';
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
<p class='yarpp-widget-type-control'>
|
105 |
-
<label style="padding-right: 10px; display: inline-block;" for="<?php echo $this->get_field_id('use_template_builtin'); ?>">
|
106 |
-
<input id="<?php echo $this->get_field_id('use_template_builtin'); ?>" name="<?php echo $this->get_field_name('use_template'); ?>" type="radio" value="builtin" <?php checked($choice === 'builtin' ) ?>/>
|
107 |
-
<?php _e("List",'yarpp'); ?>
|
108 |
-
</label>
|
109 |
-
<br/>
|
110 |
-
<label style="padding-right: 10px; display: inline-block;" for="<?php echo $this->get_field_id('use_template_thumbnails'); ?>">
|
111 |
-
<input id="<?php echo $this->get_field_id('use_template_thumbnails'); ?>" name="<?php echo $this->get_field_name('use_template'); ?>" type="radio" value="thumbnails" <?php checked($choice === 'thumbnails') ?>/>
|
112 |
-
<?php _e("Thumbnails", 'yarpp'); ?>
|
113 |
-
</label>
|
114 |
-
<br/>
|
115 |
-
<label style="padding-right: 10px; display: inline-block;" for="<?php echo $this->get_field_id('use_template_custom'); ?>">
|
116 |
-
<input id="<?php echo $this->get_field_id('use_template_custom'); ?>" name="<?php echo $this->get_field_name('use_template'); ?>" type="radio" value="custom" <?php checked($choice === 'custom'); disabled(!count($templates)); ?>/>
|
117 |
-
<?php _e("Custom", 'yarpp'); ?>
|
118 |
-
</label>
|
119 |
-
</p>
|
120 |
-
|
121 |
-
<p>
|
122 |
-
<label for="<?php echo $this->get_field_id('title'); ?>">
|
123 |
-
<?php _e('Title:'); ?>
|
124 |
-
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>"/>
|
125 |
-
</label>
|
126 |
-
</p>
|
127 |
-
|
128 |
-
<p>
|
129 |
-
<label for="<?php echo $this->get_field_id('thumbnails_heading'); ?>">
|
130 |
-
<?php _e('Heading:', 'yarpp'); ?>
|
131 |
-
<input class="widefat" id="<?php echo $this->get_field_id('thumbnails_heading'); ?>" name="<?php echo $this->get_field_name('thumbnails_heading'); ?>" type="text" value="<?php echo esc_attr($instance['thumbnails_heading']); ?>"/>
|
132 |
-
</label>
|
133 |
-
</p>
|
134 |
-
|
135 |
-
<p>
|
136 |
-
<label for="<?php echo $this->get_field_id('template_file'); ?>">
|
137 |
-
<?php _e("Template file:",'yarpp');?>
|
138 |
-
</label>
|
139 |
-
<select name="<?php echo $this->get_field_name('template_file'); ?>" id="<?php echo $this->get_field_id('template_file'); ?>">
|
140 |
-
<?php foreach ($templates as $template): ?>
|
141 |
-
<option value='<?php echo esc_attr($template['basename']); ?>' <?php selected($template['basename'], $instance['template']);?>>
|
142 |
-
<?php echo esc_html($template['name']); ?>
|
143 |
-
</option>
|
144 |
-
<?php endforeach; ?>
|
145 |
-
</select>
|
146 |
-
<p>
|
147 |
-
|
148 |
-
<script type="text/javascript">
|
149 |
-
jQuery(function($) {
|
150 |
-
function ensureTemplateChoice(e) {
|
151 |
-
if (typeof e === 'object' && 'type' in e) {
|
152 |
-
e.stopImmediatePropagation();
|
153 |
-
}
|
154 |
-
|
155 |
-
var this_form = $(this).closest('form'),
|
156 |
-
widget_id = this_form.find('.widget-id').val();
|
157 |
-
|
158 |
-
// if this widget is just in staging:
|
159 |
-
if (/__i__$/.test(widget_id)) return;
|
160 |
-
|
161 |
-
var builtin = !! $('#widget-'+widget_id+'-use_template_builtin').prop('checked'),
|
162 |
-
thumbnails = !! $('#widget-'+widget_id+'-use_template_thumbnails').prop('checked'),
|
163 |
-
custom = !! $('#widget-'+widget_id+'-use_template_custom').prop('checked');
|
164 |
-
|
165 |
-
$('#widget-' + widget_id + '-title').closest('p').toggle(builtin);
|
166 |
-
$('#widget-' + widget_id + '-thumbnails_heading').closest('p').toggle(thumbnails);
|
167 |
-
$('#widget-' + widget_id + '-template_file').closest('p').toggle(custom);
|
168 |
-
|
169 |
-
//console.log(widget_id, custom, builtin);
|
170 |
-
}
|
171 |
-
|
172 |
-
$('#wpbody').on('change', '.yarpp-widget-type-control input', ensureTemplateChoice);
|
173 |
-
$('.yarpp-widget-type-control').each(ensureTemplateChoice);
|
174 |
-
|
175 |
-
});
|
176 |
-
</script>
|
177 |
-
|
178 |
-
<p>
|
179 |
-
<input class="checkbox" id="<?php echo $this->get_field_id('promote_yarpp'); ?>" name="<?php echo $this->get_field_name('promote_yarpp'); ?>" type="checkbox" <?php checked($instance['promote_yarpp']) ?> />
|
180 |
-
<label for="<?php echo $this->get_field_id('promote_yarpp'); ?>">
|
181 |
-
<?php _e("Help promote Yet Another Related Posts Plugin?",'yarpp'); ?>
|
182 |
-
</label>
|
183 |
-
</p>
|
184 |
-
<?php
|
185 |
}
|
186 |
}
|
187 |
|
6 |
class YARPP_Widget extends WP_Widget {
|
7 |
|
8 |
public function __construct() {
|
9 |
+
parent::WP_Widget(false, 'Related Posts (YARPP)', array('description' => 'Related Posts and/or Sponsored Content'));
|
10 |
+
wp_enqueue_style('yarppWidgetCss', YARPP_URL.'/style/widget.css');
|
11 |
}
|
12 |
|
13 |
public function widget($args, $instance) {
|
14 |
+
if (!is_singular()) return;
|
|
|
|
|
15 |
|
16 |
+
global $yarpp;
|
17 |
extract($args);
|
18 |
|
19 |
/* Compatibility with pre-3.5 settings: */
|
30 |
}
|
31 |
|
32 |
$title = apply_filters('widget_title', $instance['title']);
|
33 |
+
$output = $before_widget;
|
34 |
+
if ($instance['use_pro']) {
|
35 |
+
if((isset($yarpp->yarppPro['active']) && $yarpp->yarppPro['active']) &&
|
36 |
+
(isset($yarpp->yarppPro['aid']) && isset($yarpp->yarppPro['v'])) &&
|
37 |
+
($yarpp->yarppPro['aid'] && $yarpp->yarppPro['v'])) {
|
38 |
+
|
39 |
+
$aid = $yarpp->yarppPro['aid'];
|
40 |
+
$v = $yarpp->yarppPro['v'];
|
41 |
+
$dpid = $instance['pro_dpid'];
|
42 |
+
$ru = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
43 |
+
|
44 |
+
/* TODO: Put this on a template */
|
45 |
+
$output .=
|
46 |
+
"\n".
|
47 |
+
'<div id="adkengage_ssp_div"></div>'.
|
48 |
+
'<script type="text/javascript" '.
|
49 |
+
'src="http://adkengage.com/pshandler.js?aid='.$aid.'&v='.$v.'&dpid='.$dpid.'&ru='.$ru.'">'.
|
50 |
+
'</script>'.
|
51 |
+
"\n";
|
52 |
+
}
|
53 |
+
} else {
|
54 |
+
if (!$instance['template']) {
|
55 |
+
$output .= $before_title;
|
56 |
+
$output .= $title;
|
57 |
+
$output .= $after_title;
|
58 |
+
}
|
59 |
+
$instance['domain'] = 'widget';
|
60 |
+
$output .= $yarpp->display_related(null, $instance, false);
|
61 |
+
}
|
62 |
|
63 |
+
$output .= $after_widget;
|
64 |
+
echo $output;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
|
67 |
public function update($new_instance, $old_instance) {
|
68 |
+
$instance = array(
|
69 |
+
'template' => false,
|
70 |
+
'title' => $new_instance['title'],
|
71 |
+
'thumbnails_heading' => $new_instance['thumbnails_heading'],
|
72 |
+
'use_pro' => (isset($new_instance['use_pro'])) ? $new_instance['use_pro'] : false,
|
73 |
+
'pro_dpid' => (isset($new_instance['pro_dpid'])) ? $new_instance['pro_dpid'] : null,
|
74 |
+
'promote_yarpp' => false,
|
75 |
+
);
|
76 |
+
|
77 |
+
if ($new_instance['use_template'] === 'thumbnails') $instance['template'] = 'thumbnails';
|
78 |
+
else if ($new_instance['use_template'] === 'custom' ) $instance['template'] = $new_instance['template_file'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
return $instance;
|
81 |
}
|
82 |
|
83 |
public function form($instance) {
|
84 |
global $yarpp;
|
85 |
+
$id = rtrim($this->get_field_id(null), '-');
|
86 |
$instance = wp_parse_args(
|
87 |
$instance,
|
88 |
array(
|
89 |
+
'title' => 'Related Posts (YARPP)',
|
90 |
'thumbnails_heading' => $yarpp->get_option('thumbnails_heading'),
|
91 |
'template' => false,
|
92 |
+
'use_pro' => false,
|
93 |
+
'pro_dpid' => null,
|
94 |
+
'promote_yarpp' => false,
|
95 |
)
|
96 |
);
|
97 |
|
98 |
+
/* TODO: Deprecate
|
99 |
+
* Compatibility with pre-3.5 settings
|
100 |
+
*/
|
101 |
+
if (isset($instance['use_template'])) $instance['template'] = $instance['template_file'];
|
102 |
|
103 |
+
$choice = ($instance['template']) ? (($instance['template'] === 'thumbnails') ? 'thumbnails' : 'custom') : 'builtin';
|
|
|
|
|
104 |
|
105 |
+
/* Check if YARPP templates are installed */
|
106 |
$templates = $yarpp->get_templates();
|
107 |
|
108 |
if (!$yarpp->diagnostic_custom_templates() && $choice === 'custom') $choice = 'builtin';
|
109 |
+
|
110 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_widget_form.phtml');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
}
|
113 |
|
includes/phtmls/yarpp_meta_box_beforeafter.phtml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="yarpp_form_row yarpp_form_textbox <?php echo $class ?>">
|
2 |
+
<div class="yarpp_form_label">
|
3 |
+
<?php echo $desc ?>
|
4 |
+
</div>
|
5 |
+
<div>
|
6 |
+
<?php $value = esc_attr(yarpp_get_option($options[0])) ?>
|
7 |
+
<input
|
8 |
+
name="<?php echo $options[0] ?>"
|
9 |
+
type="text"
|
10 |
+
id="<?php echo $options[0] ?>"
|
11 |
+
value="<?php echo $value ?>"
|
12 |
+
size="<?php echo $size ?>"
|
13 |
+
/>
|
14 |
+
<span class="yarpp_divider">/</span>
|
15 |
+
<?php $value = esc_attr(yarpp_get_option($options[1])) ?>
|
16 |
+
<input
|
17 |
+
name="<?php echo $options[1] ?>"
|
18 |
+
type="text"
|
19 |
+
id="<?php echo $options[1] ?>"
|
20 |
+
value="<?php echo $value ?>"
|
21 |
+
size="<?php echo $size ?>"
|
22 |
+
/>
|
23 |
+
<?php if($note): ?>
|
24 |
+
<em><small><?php echo $note ?></small></em>
|
25 |
+
<?php endif ?>
|
26 |
+
</div>
|
27 |
+
</div>
|
includes/phtmls/yarpp_meta_box_checkbox.phtml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="yarpp_form_row yarpp_form_checkbox <?php echo $class ?>">
|
2 |
+
<div scope="row">
|
3 |
+
<input
|
4 |
+
type="checkbox"
|
5 |
+
name="<?php echo $option ?>"
|
6 |
+
id="yarpp-<?php echo $option ?>"
|
7 |
+
value="true"
|
8 |
+
<?php checked(yarpp_get_option($option)) ?>
|
9 |
+
/>
|
10 |
+
<label for="yarpp-<?php echo $option ?>"><?php echo $desc ?></label>
|
11 |
+
</div>
|
12 |
+
</div>
|
includes/phtmls/yarpp_meta_box_pool.phtml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
<?php
|
3 |
+
_e(
|
4 |
+
'"The Pool" refers to the pool of posts and pages that are candidates for display as related to the current entry.',
|
5 |
+
'yarpp'
|
6 |
+
)
|
7 |
+
?>
|
8 |
+
</p>
|
9 |
+
|
10 |
+
<?php
|
11 |
+
foreach ($yarpp->get_taxonomies() as $taxonomy) {
|
12 |
+
$this->exclude($taxonomy->name, sprintf(__('Disallow by %s:', 'yarpp'), $taxonomy->labels->singular_name));
|
13 |
+
}
|
14 |
+
$this->checkbox('show_pass_post', __('Show password protected posts?', 'yarpp'));
|
15 |
+
|
16 |
+
$recent = yarpp_get_option('recent');
|
17 |
+
if ((bool) $recent) {
|
18 |
+
list($recent_number, $recent_units) = explode(' ', $recent);
|
19 |
+
} else {
|
20 |
+
$recent_number = 12;
|
21 |
+
$recent_units = 'month';
|
22 |
+
}
|
23 |
+
|
24 |
+
$recent_number = '<input name="recent_number" type="text" id="recent_number" value="'.esc_attr($recent_number).'" size="2" />';
|
25 |
+
|
26 |
+
$recent_units =
|
27 |
+
'<select name="recent_units" id="recent_units" style="vertical-align:inherit">'.
|
28 |
+
'<option value="day" ' .(($recent_units === 'day') ? 'selected' : null).'>'.__('day(s)', 'yarpp').'</option>'.
|
29 |
+
'<option value="week" ' .(($recent_units === 'week') ? 'selected' : null).'>'.__('week(s)', 'yarpp').'</option>'.
|
30 |
+
'<option value="month" '.(($recent_units === 'month') ? 'selected' : null).'>'.__('month(s)', 'yarpp').'</option>'.
|
31 |
+
'</select>';
|
32 |
+
?>
|
33 |
+
|
34 |
+
<div class='yarpp_form_row yarpp_form_checkbox'>
|
35 |
+
<div>
|
36 |
+
<input type='checkbox' name='recent_only' value='true' <?php checked((bool) $recent) ?> />
|
37 |
+
<?php echo str_replace('NUMBER', $recent_number, str_replace('UNITS', $recent_units, __("Show only posts from the past NUMBER UNITS", 'yarpp'))); ?>
|
38 |
+
</div>
|
39 |
+
</div>
|
includes/phtmls/yarpp_meta_box_tax_weight.phtml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="yarpp_form_row yarpp_form_select">
|
2 |
+
<div class="yarpp_form_label">
|
3 |
+
<?php echo $taxonomy->labels->name ?>:
|
4 |
+
</div>
|
5 |
+
<div>
|
6 |
+
<select name=weight[tax][<?php echo $taxonomy->name ?>]">
|
7 |
+
<option value="no" <?php echo ((!$weight && !$require) ? 'selected' : null) ?> >
|
8 |
+
<?php _e("do not consider", "yarpp") ?>
|
9 |
+
</option>
|
10 |
+
<option value="consider" <?php echo (($weight == 1 && !$require) ? 'selected' : null) ?> >
|
11 |
+
<?php _e("consider", "yarpp") ?>
|
12 |
+
</option>
|
13 |
+
<option value="consider_extra" <?php echo (($weight > 1 && !$require) ? 'selected' : null) ?> >
|
14 |
+
<?php _e("consider with extra weight", "yarpp") ?>
|
15 |
+
</option>
|
16 |
+
<option value="require_one" <?php echo (($require == 1) ? 'selected' : null) ?>>
|
17 |
+
<?php echo sprintf(__("require at least one %s in common", "yarpp"), $taxonomy->labels->singular_name) ?>
|
18 |
+
</option>
|
19 |
+
<option value="require_more" <?php echo (($require == 2) ? 'selected' : null) ?>>
|
20 |
+
<?php echo sprintf(__("require more than one %s in common", "yarpp"), $taxonomy->labels->singular_name) ?>
|
21 |
+
</option>
|
22 |
+
</select>
|
23 |
+
</div>
|
24 |
+
</div>
|
includes/phtmls/yarpp_meta_box_template_checkbox.phtml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$customHelp = null;
|
3 |
+
if (!$this->yarpp->diagnostic_custom_templates()) {
|
4 |
+
$customHelp = __('This option is disabled because no YARPP templates were found in your theme.', 'yarpp');
|
5 |
+
}
|
6 |
+
if ($this->offer_copy_templates()) {
|
7 |
+
$customHelp .=
|
8 |
+
' '.__('Would you like to copy some sample templates bundled with YARPP into your theme?', 'yarpp').
|
9 |
+
'<input type="button" class="button button-small yarpp_copy_templates_button" value="'.esc_attr(__('Copy Templates', 'yarpp')).'"/>';
|
10 |
+
}
|
11 |
+
?>
|
12 |
+
|
13 |
+
<div class="yarpp_form_row yarpp_form_template_buttons <?php echo $class ?>">
|
14 |
+
|
15 |
+
<div data-value="builtin" class="yarpp_template_button <?php echo $builtIn ?>">
|
16 |
+
<div class="image"></div>
|
17 |
+
<div class="label"><?php _e('List', 'yarpp') ?></div>
|
18 |
+
</div>
|
19 |
+
|
20 |
+
<div
|
21 |
+
data-value="thumbnails"
|
22 |
+
class="yarpp_template_button <?php echo $thumbnails ?> <?php echo $diagPostThumbs ?>"
|
23 |
+
<?php if (!$this->yarpp->diagnostic_post_thumbnails()): ?>
|
24 |
+
data-help="<?php echo esc_attr(__('This option is disabled because your theme does not support post thumbnails.', 'yarpp'))?>"
|
25 |
+
<?php endif ?>
|
26 |
+
>
|
27 |
+
<div class="image"></div>
|
28 |
+
<div class="label"><?php _e('Thumbnails', 'yarpp') ?></div>
|
29 |
+
</div>
|
30 |
+
|
31 |
+
<div
|
32 |
+
data-value="custom"
|
33 |
+
class="yarpp_template_button <?php echo $custom ?> <?php echo $diagCustTemplt ?>"
|
34 |
+
<?php if($customHelp): ?>
|
35 |
+
data-help="<?php echo esc_attr($customHelp) ?>"
|
36 |
+
<?php endif ?>
|
37 |
+
>
|
38 |
+
<div class="image"></div>
|
39 |
+
<div class="label"><?php _e('Custom', 'yarpp') ?></div>
|
40 |
+
</div>
|
41 |
+
|
42 |
+
<input
|
43 |
+
type="hidden"
|
44 |
+
name="<?php echo $pre ?>use_template"
|
45 |
+
id="yarpp-<?php echo $pre ?>use_template"
|
46 |
+
class="use_template" value="<?php echo $choice ?>"
|
47 |
+
/>
|
48 |
+
|
49 |
+
</div>
|
includes/phtmls/yarpp_meta_box_template_file.phtml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$options = null;
|
3 |
+
foreach ($this->yarpp->get_templates() as $template) {
|
4 |
+
$options .= '<option value="'.esc_attr($template['basename']).'"'.selected($template['basename'], $chosen_template, false);
|
5 |
+
foreach ($template as $key => $value) {
|
6 |
+
$options .= ' data-'.$key.'="'.esc_attr($value).'"';
|
7 |
+
}
|
8 |
+
$options .= '>'.esc_html($template['name']).'</option>';
|
9 |
+
}
|
10 |
+
?>
|
11 |
+
|
12 |
+
<div class="yarpp_form_row yarpp_form_template_file <?php echo $class ?>">
|
13 |
+
<div class="yarpp_form_label">
|
14 |
+
<?php _e('Template file:', 'yarpp') ?>
|
15 |
+
</div>
|
16 |
+
<div>
|
17 |
+
|
18 |
+
<select name="<?php echo $pre ?>template_file" id="<?php echo $pre ?>template_file">
|
19 |
+
<?php echo $options ?>
|
20 |
+
</select>
|
21 |
+
|
22 |
+
<p class="template_file_wrap">
|
23 |
+
<span id="<?php echo $pre ?>template_file"></span>
|
24 |
+
</p>
|
25 |
+
|
26 |
+
<p class="template_author_wrap">
|
27 |
+
<?php _e( 'Author:' ) ?> <span id="<?php echo $pre ?>template_author"></span>
|
28 |
+
</p>
|
29 |
+
|
30 |
+
<p class="template_description_wrap">
|
31 |
+
<span id="<?php echo $pre ?>template_description"></span>
|
32 |
+
</p>
|
33 |
+
</div>
|
34 |
+
</div>
|
includes/phtmls/yarpp_meta_box_textbox.phtml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="yarpp_form_row yarpp_form_textbox <?php echo $class ?>">
|
2 |
+
<div class="yarpp_form_label">
|
3 |
+
<?php echo $desc ?>
|
4 |
+
</div>
|
5 |
+
<div>
|
6 |
+
|
7 |
+
<input
|
8 |
+
name="<?php echo $option ?>"
|
9 |
+
type="text" id="<?php echo $option ?>"
|
10 |
+
value="<?php echo $value ?>"
|
11 |
+
size="<?php echo $size ?>"
|
12 |
+
/>
|
13 |
+
|
14 |
+
<?php if ($note): ?>
|
15 |
+
<em><small><?php echo $note ?></small></em><br/>
|
16 |
+
<?php endif ?>
|
17 |
+
|
18 |
+
</div>
|
19 |
+
</div>
|
includes/phtmls/yarpp_options.phtml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<?php include(YARPP_DIR.'/includes/phtmls/yarpp_settings_header.phtml') ?>
|
3 |
+
|
4 |
+
<div id="yarpp_switch_container">
|
5 |
+
<ul id="yarpp_switch_tabs">
|
6 |
+
<li>
|
7 |
+
<a href="options-general.php?page=yarpp&mode=basic">YARPP Basic</a>
|
8 |
+
</li>
|
9 |
+
<li class="disabled">
|
10 |
+
<a href="options-general.php?page=yarpp&mode=pro">YARPP Pro</a>
|
11 |
+
</li>
|
12 |
+
</ul>
|
13 |
+
|
14 |
+
<div class="yarpp_switch_content">
|
15 |
+
<?php if ($yarpp->yarppPro['active']): ?>
|
16 |
+
<p>
|
17 |
+
The settings below allow you to configure the Basic version of Yet Another Related Plugin (YARPP).
|
18 |
+
</p>
|
19 |
+
<p>
|
20 |
+
<strong>“YARPP Pro”</strong> is also active on this installation. Click on the
|
21 |
+
<strong>“YARPP Pro”</strong> tab to access the enhanced features dashboard
|
22 |
+
</p>
|
23 |
+
<?php else: ?>
|
24 |
+
<p>
|
25 |
+
The settings bellow allow you to configure the Basic version of Yet Another Related Post Plugin (YARPP).
|
26 |
+
</p>
|
27 |
+
<p>
|
28 |
+
Click on the <em>"YARPP Pro"</em> tab for additional enhancements: <strong>Earn money</strong> from sponsored ads,
|
29 |
+
easily <strong>customize thumbnail layout</strong> and the <strong>new sidebar format</strong>, pull
|
30 |
+
related posts from <strong>multiple sites</strong>, and get <strong>detailed reporting.</strong>
|
31 |
+
<a href="http://www.yarpp.com" target="_blank">Learn more.</a>
|
32 |
+
</p>
|
33 |
+
<?php endif ?>
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
|
37 |
+
<form method="post">
|
38 |
+
|
39 |
+
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
40 |
+
|
41 |
+
<?php if (!$yarpp->get_option('rss_display')): ?>
|
42 |
+
<style>
|
43 |
+
.rss_displayed {
|
44 |
+
display: none;
|
45 |
+
}
|
46 |
+
</style>
|
47 |
+
<?php endif ?>
|
48 |
+
|
49 |
+
<!-- Side column -->
|
50 |
+
<div class="inner-sidebar" id="side-info-column">
|
51 |
+
<?php do_meta_boxes('settings_page_yarpp', 'side', array()) ?>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<!-- Main Content -->
|
55 |
+
|
56 |
+
<div id="post-body-content">
|
57 |
+
<?php do_meta_boxes('settings_page_yarpp', 'normal', array()) ?>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<script language="javascript">
|
61 |
+
var spinner = '<?php echo esc_url(admin_url('images/wpspin_light.gif')) ?>',
|
62 |
+
loading = '<img class="loading" src="'+spinner+'" alt="loading..."/>';
|
63 |
+
</script>
|
64 |
+
|
65 |
+
<div>
|
66 |
+
<input type="submit" class='button-primary' name="update_yarpp" value="<?php _e('Save Changes')?>" />
|
67 |
+
</div>
|
68 |
+
|
69 |
+
</div><!--#poststuff-->
|
70 |
+
|
71 |
+
</form>
|
72 |
+
|
73 |
+
</div>
|
includes/phtmls/yarpp_pro_options.phtml
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<?php include(YARPP_DIR.'/includes/phtmls/yarpp_settings_header.phtml') ?>
|
3 |
+
|
4 |
+
<div id="yarpp_switch_container">
|
5 |
+
<ul id="yarpp_switch_tabs">
|
6 |
+
<li class="<?php echo (($switch) ? null : 'disabled')?>">
|
7 |
+
<a href="options-general.php?page=yarpp&mode=basic">YARPP Basic</a>
|
8 |
+
</li>
|
9 |
+
<li class="<?php echo (($switch) ? 'disabled': null)?>">
|
10 |
+
<a href="options-general.php?page=yarpp&mode=pro">YARPP Pro</a>
|
11 |
+
</li>
|
12 |
+
</ul>
|
13 |
+
<div class="yarpp_switch_content">
|
14 |
+
<p>
|
15 |
+
<?php if ($yarpp->yarppPro['active']): ?>
|
16 |
+
Welcome to your <strong>YARPP Pro</strong> dashboard! Here you have access to the most powerful features of YARPP.
|
17 |
+
<a
|
18 |
+
href="<?php echo plugins_url('/', dirname(__FILE__))?>/yarpp_switch.php"
|
19 |
+
class="yarpp_switch_button button to_corner" data-go="basic">
|
20 |
+
Deactivate <strong>YARPP Pro</strong>
|
21 |
+
</a>
|
22 |
+
<?php else: ?>
|
23 |
+
<strong>Access more powerful features by activating YARPP Pro!</strong>
|
24 |
+
<?php endif ?>
|
25 |
+
<br/>
|
26 |
+
<ul>
|
27 |
+
<li>
|
28 |
+
Earn money from sponsored content
|
29 |
+
<br/>
|
30 |
+
<em>(now available as a flexible sidebar widget!)</em>
|
31 |
+
</li>
|
32 |
+
<li>Pull related content from multiples sites</li>
|
33 |
+
</ul>
|
34 |
+
<ul>
|
35 |
+
<li>Easily customize thumbnail layout</li>
|
36 |
+
<li>Get detailed traffic reports</li>
|
37 |
+
</ul>
|
38 |
+
</p>
|
39 |
+
|
40 |
+
<div class="clear"></div>
|
41 |
+
|
42 |
+
<?php if (!$yarpp->yarppPro['active']): ?>
|
43 |
+
<p>
|
44 |
+
<a
|
45 |
+
href="<?php echo plugins_url('/', dirname(__FILE__))?>yarpp_switch.php"
|
46 |
+
class="yarpp_switch_button button-primary" data-go="pro">
|
47 |
+
Activate <strong>YARPP Pro</strong> Now
|
48 |
+
</a>
|
49 |
+
</p>
|
50 |
+
<?php endif ?>
|
51 |
+
|
52 |
+
<div class="clear"></div>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<?php if ($yarpp->yarppPro['active']): ?>
|
57 |
+
|
58 |
+
<div class="yarpp_switch_content">
|
59 |
+
<div id="yarpp-display-mode">
|
60 |
+
Automatically display related and/or sponsored content from <strong>YARPP Pro</strong> on:
|
61 |
+
<?php
|
62 |
+
$types_url = plugins_url('/', dirname(__FILE__)).'yarpp_pro_set_display_types.php';
|
63 |
+
$post_types = $yarpp->yarppPro['auto_display_post_types'];
|
64 |
+
foreach ($yarpp->get_post_types('objects') as $post_type):
|
65 |
+
$checked = checked(in_array( $post_type->name, $post_types), true, false);
|
66 |
+
?>
|
67 |
+
<input
|
68 |
+
type="checkbox"
|
69 |
+
id="yarpp_post_type_post"
|
70 |
+
name="types[]"
|
71 |
+
value="<?php echo $post_type->name ?>"
|
72 |
+
data-href="<?php echo $types_url ?>"
|
73 |
+
<?php echo $checked ?>
|
74 |
+
/>
|
75 |
+
<label for="yarpp_post_type_post"> <?php echo $post_type->labels->name ?></label>
|
76 |
+
<?php endforeach ?>
|
77 |
+
|
78 |
+
<a href="<?php echo $types_url ?>" id="yarpp-display-mode-save" class="button-primary" style="vertical-align:middle">
|
79 |
+
Save Changes
|
80 |
+
</a>
|
81 |
+
<br/>
|
82 |
+
<br/>
|
83 |
+
<span>
|
84 |
+
To display in the sidebar, add a <em>“Related Posts (YARPP)”</em>
|
85 |
+
widget and select  <em>“YARPP Pro”</em> from the drop-down setting of the widget options.
|
86 |
+
Widgets are located under <a href="widgets.php">“Appearance” > “Widgets”</a>.
|
87 |
+
</span>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
|
91 |
+
<div id="yarpp_pro_dashboard_wrapper">
|
92 |
+
<iframe
|
93 |
+
style="border: 0"
|
94 |
+
id="yarpp_pro_dashboard"
|
95 |
+
src="<?php echo $url ?>"
|
96 |
+
frameborder="0"
|
97 |
+
border="0"
|
98 |
+
cellspacing="0"
|
99 |
+
scrolling="yes"
|
100 |
+
>
|
101 |
+
</iframe>
|
102 |
+
</div>
|
103 |
+
|
104 |
+
<script>jQuery("#screen-options-link-wrap").hide();</script>
|
105 |
+
<?php endif ?>
|
106 |
+
</div>
|
includes/phtmls/yarpp_pro_tag.phtml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script>
|
2 |
+
var aid = '<?php echo $this->yarppPro['aid'] ?>',
|
3 |
+
v = '<?php echo $this->yarppPro['v'] ?>',
|
4 |
+
credomain = 'adkengage.com',
|
5 |
+
ru = '<?php echo $ru ?>';
|
6 |
+
document.write('<sc'+'ript type=\"text/javascript\" src=\"http://'+ credomain +'/Scripts/CREReqScript.js\"></sc'+'ript>');
|
7 |
+
</script>
|
includes/phtmls/yarpp_pro_tag_ssp.phtml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="adkengage_ssp_div"></div>
|
2 |
+
<script
|
3 |
+
type="text/javascript"
|
4 |
+
src="http://adkengage.com/pshandler.js?aid=<?php echo $aid ?>&v=<?php echo $v ?>&dpid=<?php echo $dpid ?>&ru=<?php echo $ru ?>"
|
5 |
+
>
|
6 |
+
</script>
|
includes/phtmls/yarpp_settings_header.phtml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
<h2>
|
3 |
+
<?php _e('Yet Another Related Posts Plugin Options','yarpp');?>
|
4 |
+
<small>
|
5 |
+
<?php echo apply_filters('yarpp_version_html', esc_html(get_option('yarpp_version'))) ?>
|
6 |
+
</small>
|
7 |
+
</h2>
|
8 |
+
<p>
|
9 |
+
<strong><em>NEW in YARPP 4.2!</em></strong> Now you can mix and match <strong>YARPP Basic</strong> and
|
10 |
+
<strong>YARPP Pro</strong> to get the best of both features! Recommendations from both Basic and Pro can now
|
11 |
+
display beneath your articles or in your sidebar (as a <a href="widgets.php">widget</a>) or in both locations.
|
12 |
+
Use the combination that works best for you!
|
13 |
+
</p>
|
14 |
+
</div>
|
includes/phtmls/yarpp_widget_form.phtml
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="yarpp-widget-settings-switch">
|
2 |
+
<p>
|
3 |
+
<label for="<?php echo $this->get_field_id('use_yarpp_pro') ?>">Display widget using </label>
|
4 |
+
<select
|
5 |
+
class="yarpp-mode-switch"
|
6 |
+
name="<?php echo $this->get_field_name('use_pro') ?>"
|
7 |
+
<?php echo ($yarpp->yarppPro['active']) ? null : 'disabled' ?>>
|
8 |
+
<option value="0" <?php echo selected($instance['use_pro']) ?>>Yarpp Basic</option>
|
9 |
+
<option value="1" <?php echo selected($instance['use_pro']) ?>>Yarpp Pro</option>
|
10 |
+
</select>
|
11 |
+
|
12 |
+
<?php if (!$yarpp->yarppPro['active']): ?>
|
13 |
+
<div class="yarpp_pro_msg">
|
14 |
+
<p>
|
15 |
+
<strong>YARPP Pro is not active!</strong>
|
16 |
+
<br/>
|
17 |
+
Take advantage of YARPP Pro's enhanced features by creating your free account today.
|
18 |
+
</p>
|
19 |
+
<a href="options-general.php?page=yarpp&mode=pro" class="button" style="width: 100%; text-align: center">
|
20 |
+
Take me to YARPP Pro setting's page
|
21 |
+
</a>
|
22 |
+
</div>
|
23 |
+
<?php endif ?>
|
24 |
+
|
25 |
+
</p>
|
26 |
+
|
27 |
+
<div class="yarpp-widget-pro-settings" style="display: <?php echo ($instance['use_pro']) ? 'block' : 'none' ?>">
|
28 |
+
<p>
|
29 |
+
To show relevant sponsored content in this sidebar, copy and paste the correct Widget ID from your YARPP Pro dashboard.
|
30 |
+
<br/>
|
31 |
+
<br/>
|
32 |
+
<label>Widget ID: </label>
|
33 |
+
<input
|
34 |
+
type="text"
|
35 |
+
id="<?php echo $this->get_field_id('use_yarpp_pro_dpid') ?>"
|
36 |
+
name="<?php echo $this->get_field_name('pro_dpid') ?>"
|
37 |
+
value="<?php echo esc_attr($instance['pro_dpid']) ?>"
|
38 |
+
/>
|
39 |
+
<span class="yarpp_help">
|
40 |
+
<span class="yarpp_help_msg">
|
41 |
+
Create an account through the “YARPP Pro” tab on the “Settings” page, create your widget style,
|
42 |
+
and click “Get Code” to find your Widget ID.
|
43 |
+
</span>
|
44 |
+
</span>
|
45 |
+
</p>
|
46 |
+
</div>
|
47 |
+
|
48 |
+
<div class="yarpp-widget-basic-settings" style="display: <?php echo ($instance['use_pro']) ? 'none' : 'block' ?>">
|
49 |
+
<p class='yarpp-widget-type-control'>
|
50 |
+
<label style="padding-right: 10px; display: inline-block;" for="<?php echo $this->get_field_id('use_template_builtin'); ?>">
|
51 |
+
<input
|
52 |
+
type="radio"
|
53 |
+
id="<?php echo $this->get_field_id('use_template_builtin'); ?>"
|
54 |
+
name="<?php echo $this->get_field_name('use_template'); ?>"
|
55 |
+
value="builtin" <?php checked($choice === 'builtin' ) ?>
|
56 |
+
/>
|
57 |
+
<?php _e("List",'yarpp'); ?>
|
58 |
+
</label>
|
59 |
+
<br/>
|
60 |
+
<label style="padding-right: 10px; display: inline-block;" for="<?php echo $this->get_field_id('use_template_thumbnails'); ?>">
|
61 |
+
<input
|
62 |
+
type="radio"
|
63 |
+
id="<?php echo $this->get_field_id('use_template_thumbnails'); ?>"
|
64 |
+
name="<?php echo $this->get_field_name('use_template'); ?>"
|
65 |
+
value="thumbnails" <?php checked($choice === 'thumbnails') ?>
|
66 |
+
/>
|
67 |
+
<?php _e("Thumbnails", 'yarpp'); ?>
|
68 |
+
</label>
|
69 |
+
<br/>
|
70 |
+
<label style="padding-right: 10px; display: inline-block;" for="<?php echo $this->get_field_id('use_template_custom'); ?>">
|
71 |
+
<input
|
72 |
+
type="radio"
|
73 |
+
id="<?php echo $this->get_field_id('use_template_custom'); ?>"
|
74 |
+
name="<?php echo $this->get_field_name('use_template'); ?>"
|
75 |
+
value="custom" <?php checked($choice === 'custom'); disabled(!count($templates)); ?>
|
76 |
+
/>
|
77 |
+
<?php _e("Custom", 'yarpp'); ?>
|
78 |
+
</label>
|
79 |
+
</p>
|
80 |
+
<p>
|
81 |
+
<label for="<?php echo $this->get_field_id('title') ?>">
|
82 |
+
<?php _e('Title:'); ?>
|
83 |
+
<input
|
84 |
+
type="text"
|
85 |
+
class="widefat"
|
86 |
+
id="<?php echo $this->get_field_id('title') ?>"
|
87 |
+
name="<?php echo $this->get_field_name('title') ?>"
|
88 |
+
value="<?php echo esc_attr($instance['title']) ?>"/>
|
89 |
+
</label>
|
90 |
+
</p>
|
91 |
+
<p>
|
92 |
+
<label for="<?php echo $this->get_field_id('thumbnails_heading') ?>">
|
93 |
+
<?php _e('Heading:', 'yarpp') ?>
|
94 |
+
<input
|
95 |
+
type="text"
|
96 |
+
class="widefat"
|
97 |
+
id="<?php echo $this->get_field_id('thumbnails_heading') ?>"
|
98 |
+
name="<?php echo $this->get_field_name('thumbnails_heading') ?>"
|
99 |
+
value="<?php echo esc_attr($instance['thumbnails_heading']) ?>"/>
|
100 |
+
</label>
|
101 |
+
</p>
|
102 |
+
<p>
|
103 |
+
<label for="<?php echo $this->get_field_id('template_file'); ?>">
|
104 |
+
<?php _e("Template file:",'yarpp');?>
|
105 |
+
</label>
|
106 |
+
<select name="<?php echo $this->get_field_name('template_file'); ?>" id="<?php echo $this->get_field_id('template_file'); ?>">
|
107 |
+
<?php foreach ($templates as $template): ?>
|
108 |
+
<option value='<?php echo esc_attr($template['basename']); ?>' <?php selected($template['basename'], $instance['template']);?>>
|
109 |
+
<?php echo esc_html($template['name']); ?>
|
110 |
+
</option>
|
111 |
+
<?php endforeach; ?>
|
112 |
+
</select>
|
113 |
+
</p>
|
114 |
+
<br/>
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<script type="text/javascript">
|
119 |
+
jQuery(function($) {
|
120 |
+
$('.yarpp-widget-type-control','#wpbody').each(ensureTemplateChoice);
|
121 |
+
$('.yarpp-widget-type-control input','#wpbody').on('change', ensureTemplateChoice);
|
122 |
+
$('.yarpp-widget-settings-switch .yarpp-mode-switch', '#wpbody').on('change', makeTheSwitch);
|
123 |
+
|
124 |
+
function ensureTemplateChoice(e) {
|
125 |
+
if (typeof e === 'object' && 'type' in e) e.stopImmediatePropagation();
|
126 |
+
var this_form = $(this).closest('form'),
|
127 |
+
widget_id = this_form.find('.widget-id').val();
|
128 |
+
// if this widget is just in staging:
|
129 |
+
if (/__i__$/.test(widget_id)) return;
|
130 |
+
var builtin = !! $('#widget-'+widget_id+'-use_template_builtin').prop('checked'),
|
131 |
+
thumbnails = !! $('#widget-'+widget_id+'-use_template_thumbnails').prop('checked'),
|
132 |
+
custom = !! $('#widget-'+widget_id+'-use_template_custom').prop('checked');
|
133 |
+
$('#widget-'+widget_id+'-title').closest('p').toggle(builtin);
|
134 |
+
$('#widget-'+widget_id+'-thumbnails_heading').closest('p').toggle(thumbnails);
|
135 |
+
$('#widget-'+widget_id+'-template_file').closest('p').toggle(custom);
|
136 |
+
}
|
137 |
+
|
138 |
+
function makeTheSwitch(e){
|
139 |
+
if (typeof e === 'object' && 'type' in e) e.stopImmediatePropagation();
|
140 |
+
var $context = $(this).closest('.yarpp-widget-settings-switch');
|
141 |
+
if ($(this).val() === '1') {
|
142 |
+
$('.yarpp-widget-basic-settings', $context).fadeOut('fast',function(){
|
143 |
+
$('.yarpp-widget-pro-settings', $context).fadeIn('fast');
|
144 |
+
});
|
145 |
+
} else {
|
146 |
+
$('.yarpp-widget-pro-settings', $context).fadeOut('fast',function(){
|
147 |
+
$('.yarpp-widget-basic-settings', $context).fadeIn('fast');
|
148 |
+
});
|
149 |
+
}
|
150 |
+
}
|
151 |
+
});
|
152 |
+
</script>
|
includes/{styles-thumbnails.css.php → styles_thumbnails.css.php}
RENAMED
File without changes
|
includes/template_builtin.php
CHANGED
@@ -9,28 +9,56 @@
|
|
9 |
|
10 |
get_currentuserinfo();
|
11 |
|
12 |
-
$options = array(
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
if (have_posts()) {
|
16 |
-
|
|
|
|
|
17 |
while (have_posts()) {
|
18 |
the_post();
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
$output .=
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$excerpt =
|
28 |
-
|
|
|
|
|
29 |
}
|
|
|
30 |
$output .= $after_title."\n";
|
31 |
|
32 |
}
|
33 |
-
|
|
|
|
|
34 |
} else {
|
|
|
35 |
$output .= $no_results;
|
|
|
36 |
}
|
9 |
|
10 |
get_currentuserinfo();
|
11 |
|
12 |
+
$options = array(
|
13 |
+
'before_title',
|
14 |
+
'after_title',
|
15 |
+
'show_excerpt',
|
16 |
+
'excerpt_length',
|
17 |
+
'before_post',
|
18 |
+
'after_post',
|
19 |
+
'before_related',
|
20 |
+
'after_related',
|
21 |
+
'no_results'
|
22 |
+
);
|
23 |
+
|
24 |
+
extract($this->parse_args($args, $options));
|
25 |
+
$link = get_permalink();
|
26 |
+
$tooltip = esc_attr((get_the_title()) ? get_the_title() : get_the_ID());
|
27 |
+
$title = get_the_title();
|
28 |
+
|
29 |
|
30 |
if (have_posts()) {
|
31 |
+
|
32 |
+
$output .= $before_related."\n";
|
33 |
+
|
34 |
while (have_posts()) {
|
35 |
the_post();
|
36 |
+
$round = round(get_the_score(),1);
|
37 |
+
$score = (current_user_can('manage_options') && $domain !== 'rss' && !is_admin())
|
38 |
+
? '<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).'">('.$round.')</abbr>'
|
39 |
+
: null;
|
40 |
|
41 |
+
$output .=
|
42 |
+
$before_title.
|
43 |
+
'<a href="'.$link.'" rel="bookmark" title="'.$tooltip.'">'.
|
44 |
+
$title.' '.$score.
|
45 |
+
'</a>';
|
46 |
+
|
47 |
+
if ($show_excerpt) {
|
48 |
+
$excerpt = strip_tags((string) get_the_excerpt());
|
49 |
+
preg_replace('/([,;.-]+)\s*/','\1 ', $excerpt);
|
50 |
+
$excerpt = implode(' ', array_slice(preg_split('/\s+/',$excerpt), 0, $excerpt_length)).'...';
|
51 |
+
$output .= $before_post.$excerpt.$after_post;
|
52 |
}
|
53 |
+
|
54 |
$output .= $after_title."\n";
|
55 |
|
56 |
}
|
57 |
+
|
58 |
+
$output .= $after_related."\n";
|
59 |
+
|
60 |
} else {
|
61 |
+
|
62 |
$output .= $no_results;
|
63 |
+
|
64 |
}
|
includes/{template-metabox.php → template_metabox.php}
RENAMED
File without changes
|
includes/{template-widget.php → template_widget.php}
RENAMED
File without changes
|
includes/yarpp_meta_boxes_hooks.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
include_once(YARPP_DIR.'/classes/YARPP_Meta_Box.php');
|
3 |
+
include_once(YARPP_DIR.'/classes/YARPP_Meta_Box_Contact.php');
|
4 |
+
include_once(YARPP_DIR.'/classes/YARPP_Meta_Box_Display_Feed.php');
|
5 |
+
include_once(YARPP_DIR.'/classes/YARPP_Meta_Box_Display_Web.php');
|
6 |
+
include_once(YARPP_DIR.'/classes/YARPP_Meta_Box_Optin.php');
|
7 |
+
include_once(YARPP_DIR.'/classes/YARPP_Meta_Box_Pool.php');
|
8 |
+
include_once(YARPP_DIR.'/classes/YARPP_Meta_Box_Relatedness.php');
|
9 |
+
|
10 |
+
global $yarpp;
|
11 |
+
|
12 |
+
add_meta_box(
|
13 |
+
'yarpp_pool',
|
14 |
+
__( '"The Pool"', 'yarpp' ),
|
15 |
+
array(new YARPP_Meta_Box_Pool, 'display'),
|
16 |
+
'settings_page_yarpp',
|
17 |
+
'normal',
|
18 |
+
'core'
|
19 |
+
);
|
20 |
+
|
21 |
+
add_meta_box(
|
22 |
+
'yarpp_relatedness',
|
23 |
+
__( '"Relatedness" options', 'yarpp' ),
|
24 |
+
array(
|
25 |
+
new YARPP_Meta_Box_Relatedness,
|
26 |
+
'display'
|
27 |
+
),
|
28 |
+
'settings_page_yarpp',
|
29 |
+
'normal',
|
30 |
+
'core'
|
31 |
+
);
|
32 |
+
|
33 |
+
add_meta_box(
|
34 |
+
'yarpp_display_web',
|
35 |
+
__('Display options <small>for your website</small>', 'yarpp'),
|
36 |
+
array(
|
37 |
+
new YARPP_Meta_Box_Display_Web,
|
38 |
+
'display'
|
39 |
+
),
|
40 |
+
'settings_page_yarpp',
|
41 |
+
'normal',
|
42 |
+
'core'
|
43 |
+
);
|
44 |
+
|
45 |
+
add_meta_box(
|
46 |
+
'yarpp_display_rss',
|
47 |
+
__('Display options <small>for RSS</small>', 'yarpp'),
|
48 |
+
array(
|
49 |
+
new YARPP_Meta_Box_Display_Feed,
|
50 |
+
'display'
|
51 |
+
),
|
52 |
+
'settings_page_yarpp',
|
53 |
+
'normal',
|
54 |
+
'core'
|
55 |
+
);
|
56 |
+
|
57 |
+
if (!$yarpp->yarppPro['active']) {
|
58 |
+
add_meta_box(
|
59 |
+
'yarpp_display_optin',
|
60 |
+
'Get the Most Out of YARPP',
|
61 |
+
array(
|
62 |
+
new YARPP_Meta_Box_Optin,
|
63 |
+
'display'
|
64 |
+
),
|
65 |
+
'settings_page_yarpp',
|
66 |
+
'side',
|
67 |
+
'core'
|
68 |
+
);
|
69 |
+
}
|
70 |
+
|
71 |
+
add_meta_box(
|
72 |
+
'yarpp_display_contact',
|
73 |
+
__('Contact YARPP', 'yarpp'),
|
74 |
+
array(new YARPP_Meta_Box_Contact, 'display'),
|
75 |
+
'settings_page_yarpp',
|
76 |
+
'side',
|
77 |
+
'core'
|
78 |
+
);
|
79 |
+
|
80 |
+
|
81 |
+
function yarpp_make_optin_classy($classes) {
|
82 |
+
if (!yarpp_get_option('optin') )
|
83 |
+
$classes[] = 'yarpp_attention';
|
84 |
+
return $classes;
|
85 |
+
}
|
86 |
+
|
87 |
+
add_filter(
|
88 |
+
"postbox_classes_settings_page_yarpp_yarpp_display_optin",
|
89 |
+
'yarpp_make_optin_classy'
|
90 |
+
);
|
91 |
+
|
92 |
+
/** @since 3.3: hook for registering new YARPP meta boxes */
|
93 |
+
//do_action('add_meta_boxes_settings_page_yarpp');
|
includes/yarpp_myisam_notice.php
CHANGED
@@ -38,7 +38,8 @@ if (!(bool) yarpp_get_option('myisam_override') && (bool) $yarpp->diagnostic_ful
|
|
38 |
echo(
|
39 |
"<div class='updated' style='padding:15px'>".
|
40 |
'<p>'.
|
41 |
-
'<strong>"Consider Titles"</strong> and <strong>"Consider Bodies"</strong> are currently disabled.'.
|
|
|
42 |
' <a href="#" id="yarpp_fulltext_expand">Show Details [+]</a>'.
|
43 |
'</p>'.
|
44 |
'<div id="yarpp_fulltext_details" class="hidden">'.
|
38 |
echo(
|
39 |
"<div class='updated' style='padding:15px'>".
|
40 |
'<p>'.
|
41 |
+
'<strong>"Consider Titles"</strong> and <strong>"Consider Bodies"</strong> are currently disabled. '.
|
42 |
+
'As a result, "Pages" may not display in the "Related Posts" sections.'.
|
43 |
' <a href="#" id="yarpp_fulltext_expand">Show Details [+]</a>'.
|
44 |
'</p>'.
|
45 |
'<div id="yarpp_fulltext_details" class="hidden">'.
|
includes/yarpp_options.php
CHANGED
@@ -12,36 +12,36 @@ if(!$yarpp->enabled() && !$yarpp->activate()) {
|
|
12 |
if (!$yarpp->diagnostic_custom_templates()) {
|
13 |
|
14 |
$template_option = yarpp_get_option('template');
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
* @since 3.3 Move version checking here, in PHP.
|
23 |
*/
|
24 |
if (current_user_can('update_plugins')) {
|
25 |
-
|
26 |
|
27 |
/*
|
28 |
-
|
29 |
*/
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
__(
|
46 |
'There is a new version of %1$s available.'.
|
47 |
'<a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>'.
|
@@ -52,21 +52,21 @@ if (current_user_can('update_plugins')) {
|
|
52 |
$yarpp_version_info['current']['version'],
|
53 |
wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=').$file, 'upgrade-plugin_'.$file)
|
54 |
);
|
55 |
-
|
56 |
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
__(
|
62 |
"There is a new beta (%s) of Yet Another Related Posts Plugin. ".
|
63 |
"You can <a href=\"%s\">download it here</a> at your own risk.", "yarpp"),
|
64 |
$yarpp_version_info['beta']['version'],
|
65 |
$yarpp_version_info['beta']['url']
|
66 |
);
|
67 |
-
|
68 |
|
69 |
-
|
70 |
}
|
71 |
|
72 |
/* MyISAM Check */
|
@@ -74,63 +74,63 @@ include 'yarpp_myisam_notice.php';
|
|
74 |
|
75 |
/* This is not a yarpp pluging update, it is an yarpp option update */
|
76 |
if (isset($_POST['update_yarpp'])) {
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
}
|
135 |
|
136 |
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
|
@@ -144,70 +144,4 @@ if (!count($yarpp->admin->get_templates()) && $yarpp->admin->can_copy_templates(
|
|
144 |
wp_nonce_field('yarpp_copy_templates', 'yarpp_copy_templates-nonce', false);
|
145 |
}
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
<div class="wrap">
|
150 |
-
<h2>
|
151 |
-
<?php _e('Yet Another Related Posts Plugin Options','yarpp');?>
|
152 |
-
<small>
|
153 |
-
<?php echo apply_filters('yarpp_version_html', esc_html(get_option('yarpp_version'))) ?>
|
154 |
-
</small>
|
155 |
-
</h2>
|
156 |
-
|
157 |
-
<div id="yarpp_switch_container">
|
158 |
-
<ul id="yarpp_switch_tabs">
|
159 |
-
<li>
|
160 |
-
<a href="options-general.php?page=yarpp">YARPP Basic</a>
|
161 |
-
</li>
|
162 |
-
<li class="disabled">
|
163 |
-
<a href="<?php echo plugins_url('/', dirname(__FILE__)) ?>includes/yarpp_switch.php" class="yarpp_switch_button" data-go="pro">YARPP Pro</a>
|
164 |
-
</li>
|
165 |
-
</ul>
|
166 |
-
|
167 |
-
<div class="yarpp_switch_content">
|
168 |
-
<p>
|
169 |
-
The settings bellow allow you to configure the basic version of Yet Another Related Post Plugin (YARPP).
|
170 |
-
Click on the "YARPP Pro" tab for enhanced functionality: <strong>Earn money</strong> from sponsored ads,
|
171 |
-
easily <strong>customize thumbnail layout</strong>, pull related posts from <strong>multiple sites</strong>
|
172 |
-
, and get <strong>detailed reporting.</strong>
|
173 |
-
<a href="http://www.yarpp.com" target="_blank">Learn more.</a>
|
174 |
-
</p>
|
175 |
-
</div>
|
176 |
-
</div>
|
177 |
-
|
178 |
-
<form method="post">
|
179 |
-
|
180 |
-
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
181 |
-
|
182 |
-
<?php if (!$yarpp->get_option('rss_display')): ?>
|
183 |
-
<style>
|
184 |
-
.rss_displayed {
|
185 |
-
display: none;
|
186 |
-
}
|
187 |
-
</style>
|
188 |
-
<?php endif ?>
|
189 |
-
|
190 |
-
<!-- Side column -->
|
191 |
-
<div class="inner-sidebar" id="side-info-column">
|
192 |
-
<?php do_meta_boxes('settings_page_yarpp', 'side', array()) ?>
|
193 |
-
</div>
|
194 |
-
|
195 |
-
<!-- Main Content -->
|
196 |
-
<div id="post-body-content">
|
197 |
-
<?php do_meta_boxes('settings_page_yarpp', 'normal', array()) ?>
|
198 |
-
</div>
|
199 |
-
|
200 |
-
<script language="javascript">
|
201 |
-
var spinner = '<?php echo esc_url(admin_url('images/wpspin_light.gif')) ?>',
|
202 |
-
loading = '<img class="loading" src="'+spinner+'" alt="loading..."/>';
|
203 |
-
</script>
|
204 |
-
|
205 |
-
<div>
|
206 |
-
<input type="submit" class='button-primary' name="update_yarpp" value="<?php _e( 'Save Changes' )?>" />
|
207 |
-
</div>
|
208 |
-
|
209 |
-
</div><!--#poststuff-->
|
210 |
-
|
211 |
-
</form>
|
212 |
-
|
213 |
-
</div>
|
12 |
if (!$yarpp->diagnostic_custom_templates()) {
|
13 |
|
14 |
$template_option = yarpp_get_option('template');
|
15 |
+
if ($template_option !== false && $template_option !== 'thumbnails') yarpp_set_option('template', false);
|
16 |
|
17 |
+
$template_option = yarpp_get_option('rss_template');
|
18 |
+
if ($template_option !== false && $template_option !== 'thumbnails') yarpp_set_option('rss_template', false);
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
* @since 3.3 Move version checking here, in PHP.
|
23 |
*/
|
24 |
if (current_user_can('update_plugins')) {
|
25 |
+
$yarpp_version_info = $yarpp->version_info();
|
26 |
|
27 |
/*
|
28 |
+
* These strings are not localizable, as long as the plugin data on wordpress.org cannot be.
|
29 |
*/
|
30 |
+
$slug = 'yet-another-related-posts-plugin';
|
31 |
+
$plugin_name = 'Yet Another Related Posts Plugin';
|
32 |
+
$file = basename(YARPP_DIR).'/yarpp.php';
|
33 |
+
if ($yarpp_version_info['result'] === 'new') {
|
34 |
+
|
35 |
+
/* Make sure the update system is aware of this version. */
|
36 |
+
$current = get_site_transient('update_plugins');
|
37 |
+
if (!isset($current->response[$file])) {
|
38 |
+
delete_site_transient('update_plugins');
|
39 |
+
wp_update_plugins();
|
40 |
+
}
|
41 |
+
|
42 |
+
echo '<div class="updated"><p>';
|
43 |
+
$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin='.$slug.'&TB_iframe=true&width=600&height=800');
|
44 |
+
printf(
|
45 |
__(
|
46 |
'There is a new version of %1$s available.'.
|
47 |
'<a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>'.
|
52 |
$yarpp_version_info['current']['version'],
|
53 |
wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=').$file, 'upgrade-plugin_'.$file)
|
54 |
);
|
55 |
+
echo '</p></div>';
|
56 |
|
57 |
+
} else if ($yarpp_version_info['result'] === 'newbeta') {
|
58 |
|
59 |
+
echo '<div class="updated"><p>';
|
60 |
+
printf(
|
61 |
__(
|
62 |
"There is a new beta (%s) of Yet Another Related Posts Plugin. ".
|
63 |
"You can <a href=\"%s\">download it here</a> at your own risk.", "yarpp"),
|
64 |
$yarpp_version_info['beta']['version'],
|
65 |
$yarpp_version_info['beta']['url']
|
66 |
);
|
67 |
+
echo '</p></div>';
|
68 |
|
69 |
+
}
|
70 |
}
|
71 |
|
72 |
/* MyISAM Check */
|
74 |
|
75 |
/* This is not a yarpp pluging update, it is an yarpp option update */
|
76 |
if (isset($_POST['update_yarpp'])) {
|
77 |
+
$new_options = array();
|
78 |
+
foreach ($yarpp->default_options as $option => $default) {
|
79 |
+
if ( is_bool($default) )
|
80 |
+
$new_options[$option] = isset($_POST[$option]);
|
81 |
+
if ( (is_string($default) || is_int($default)) &&
|
82 |
+
isset($_POST[$option]) && is_string($_POST[$option]) )
|
83 |
+
$new_options[$option] = stripslashes($_POST[$option]);
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( isset($_POST['weight']) ) {
|
87 |
+
$new_options['weight'] = array();
|
88 |
+
$new_options['require_tax'] = array();
|
89 |
+
foreach ( (array) $_POST['weight'] as $key => $value) {
|
90 |
+
if ( $value == 'consider' )
|
91 |
+
$new_options['weight'][$key] = 1;
|
92 |
+
if ( $value == 'consider_extra' )
|
93 |
+
$new_options['weight'][$key] = YARPP_EXTRA_WEIGHT;
|
94 |
+
}
|
95 |
+
foreach ( (array) $_POST['weight']['tax'] as $tax => $value) {
|
96 |
+
if ( $value == 'consider' )
|
97 |
+
$new_options['weight']['tax'][$tax] = 1;
|
98 |
+
if ( $value == 'consider_extra' )
|
99 |
+
$new_options['weight']['tax'][$tax] = YARPP_EXTRA_WEIGHT;
|
100 |
+
if ( $value == 'require_one' ) {
|
101 |
+
$new_options['weight']['tax'][$tax] = 1;
|
102 |
+
$new_options['require_tax'][$tax] = 1;
|
103 |
+
}
|
104 |
+
if ( $value == 'require_more' ) {
|
105 |
+
$new_options['weight']['tax'][$tax] = 1;
|
106 |
+
$new_options['require_tax'][$tax] = 2;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( isset( $_POST['auto_display_post_types'] ) ) {
|
112 |
+
$new_options['auto_display_post_types'] = array_keys( $_POST['auto_display_post_types'] );
|
113 |
+
} else {
|
114 |
+
$new_options['auto_display_post_types'] = array();
|
115 |
+
}
|
116 |
+
|
117 |
+
$new_options['recent'] = isset($_POST['recent_only']) ?
|
118 |
+
$_POST['recent_number'] . ' ' . $_POST['recent_units'] : false;
|
119 |
+
|
120 |
+
if ( isset($_POST['exclude']) )
|
121 |
+
$new_options['exclude'] = implode(',',array_keys($_POST['exclude']));
|
122 |
+
else
|
123 |
+
$new_options['exclude'] = '';
|
124 |
+
|
125 |
+
$new_options['template'] = $_POST['use_template'] == 'custom' ? $_POST['template_file'] :
|
126 |
+
( $_POST['use_template'] == 'thumbnails' ? 'thumbnails' : false );
|
127 |
+
$new_options['rss_template'] = $_POST['rss_use_template'] == 'custom' ? $_POST['rss_template_file'] :
|
128 |
+
( $_POST['rss_use_template'] == 'thumbnails' ? 'thumbnails' : false );
|
129 |
+
|
130 |
+
$new_options = apply_filters( 'yarpp_settings_save', $new_options );
|
131 |
+
yarpp_set_option($new_options);
|
132 |
+
|
133 |
+
echo '<div class="updated fade"><p>'.__('Options saved!','yarpp').'</p></div>';
|
134 |
}
|
135 |
|
136 |
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
|
144 |
wp_nonce_field('yarpp_copy_templates', 'yarpp_copy_templates-nonce', false);
|
145 |
}
|
146 |
|
147 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_options.phtml');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/yarpp_pro_options.php
CHANGED
@@ -1,138 +1,20 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
$switch = (isset($_GET['go']) && $_GET['go'] === 'basic') ? $switch = true : null;
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
9 |
|
10 |
-
|
11 |
-
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
}
|
19 |
-
|
20 |
-
$src = urlencode(admin_url().'options-general.php?page='.$_GET['page']);
|
21 |
-
$aid = (isset($yarpp->yarppPro['aid']) && $yarpp->yarppPro['aid']) ? $yarpp->yarppPro['aid'] : 0;
|
22 |
-
$st = (isset($yarpp->yarppPro['st']) && $yarpp->yarppPro['st']) ? $yarpp->yarppPro['st'] : 0;
|
23 |
-
$v = (isset($yarpp->yarppPro['v']) && $yarpp->yarppPro['v']) ? $yarpp->yarppPro['v'] : 0;
|
24 |
-
$d = urlencode(get_home_url());
|
25 |
-
$url = 'https://yarpp.adkengage.com/AdcenterUI/PublisherUI/PublisherDashboard.aspx?src='.$src.'&d='.$d.'&aid='.$aid.'&st='.$st.'&plugin=1';
|
26 |
-
?>
|
27 |
-
|
28 |
-
<script>
|
29 |
-
/*
|
30 |
-
* Hide Screen Options using jQuery because add_filter('screen_options_show_screen', '__return_false')
|
31 |
-
* removes it system wide.
|
32 |
-
*/
|
33 |
-
jQuery("#screen-options-link-wrap").hide();
|
34 |
-
</script>
|
35 |
-
|
36 |
-
<div class="wrap">
|
37 |
-
<h2>
|
38 |
-
<?php _e('Yet Another Related Posts Plugin Options','yarpp');?>
|
39 |
-
<small>
|
40 |
-
<?php echo apply_filters('yarpp_version_html', esc_html(get_option('yarpp_version'))) ?>
|
41 |
-
</small>
|
42 |
-
</h2>
|
43 |
-
<div id="yarpp_switch_container">
|
44 |
-
<ul id="yarpp_switch_tabs">
|
45 |
-
<li class="<?php echo (($switch) ? null : 'disabled')?>">
|
46 |
-
<a href="options-general.php?page=yarpp&go=basic">YARPP Basic</a>
|
47 |
-
</li>
|
48 |
-
<li class="<?php echo (($switch) ? 'disabled': null)?>">
|
49 |
-
<a href="options-general.php?page=yarpp">YARPP Pro</a>
|
50 |
-
</li>
|
51 |
-
</ul>
|
52 |
-
<div class="yarpp_switch_content">
|
53 |
-
<?php if ($switch): ?>
|
54 |
-
<p>
|
55 |
-
You currently have <em>YARPP Pro</em> enabled, giving you access to even more powerful features.
|
56 |
-
</p>
|
57 |
-
<p>
|
58 |
-
If you are no longer interested in these enhancements and wish to keep only YARPP Basic features, click
|
59 |
-
the button below. Please note that by switching to YARPP Basic you will no longer be able to make money
|
60 |
-
by displaying sponsored ads, nor will you have access to detailed reporting or pull related content from
|
61 |
-
multiple domains.
|
62 |
-
</p>
|
63 |
-
<p>
|
64 |
-
<a href="<?php echo plugins_url('includes/',dirname(__FILE__)).'yarpp_switch.php' ?>" data-go="basic" class="button yarpp_switch_button">
|
65 |
-
I only want access to <em>YARPP Basic</em> features
|
66 |
-
</a>
|
67 |
-
 
|
68 |
-
<a href="options-general.php?page=yarpp" id="yarpp_switch_cancel" class="button">
|
69 |
-
No, thanks. Keep <em>YARPP Pro</em> features enabled
|
70 |
-
</a>
|
71 |
-
</p>
|
72 |
-
<?php else: ?>
|
73 |
-
<p>
|
74 |
-
<strong>Access more powerful features with YARPP Pro!</strong>
|
75 |
-
<br/>
|
76 |
-
<ul>
|
77 |
-
<li>Earn money from sponsored content</li>
|
78 |
-
<li>Pull related content from multiples sites</li>
|
79 |
-
</ul>
|
80 |
-
<ul>
|
81 |
-
<li>Easily customize thumbnail layout</li>
|
82 |
-
<li>Get detailed traffic reports</li>
|
83 |
-
</ul>
|
84 |
-
<div class="clear"></div>
|
85 |
-
</p>
|
86 |
-
<?php endif ?>
|
87 |
-
</div>
|
88 |
-
</div>
|
89 |
-
|
90 |
-
<?php if (!$switch): ?>
|
91 |
-
<div id="yarpp_pro_dashboard_wrapper">
|
92 |
-
<iframe
|
93 |
-
id="yarpp_pro_dashboard"
|
94 |
-
src="<?php echo $url ?>"
|
95 |
-
frameborder="0"
|
96 |
-
border="0"
|
97 |
-
cellspacing="0"
|
98 |
-
scrolling="yes"
|
99 |
-
>
|
100 |
-
</iframe>
|
101 |
-
</div>
|
102 |
-
|
103 |
-
<!-- MARK: API Setting override (uncomment ajax handler on options_switch.js lines 17-38)
|
104 |
-
<div class="postbox">
|
105 |
-
<h3 class="hndle">
|
106 |
-
<span style="margin-left:0.8em">API Settings</span>
|
107 |
-
</h3>
|
108 |
-
<div class="inside">
|
109 |
-
<div id="yarpp_pro_api_settings_note" class="yarpp_form_row">
|
110 |
-
<p>
|
111 |
-
Explanation of what, why and how to use this box!!!!
|
112 |
-
</p>
|
113 |
-
<br/>
|
114 |
-
<a id="yarpp_pro_api_settings_unlock" class="button">Unlock API Settings</a>
|
115 |
-
</div>
|
116 |
-
<form id="yarpp_pro_api_settings" action="?page=yarpp" method="post">
|
117 |
-
|
118 |
-
<div class="yarpp_form_row">
|
119 |
-
<label class="yarpp_pro_label">Affiliate ID: </label>
|
120 |
-
<input id="yarpp_pro_aid" type="text" name="aid" value="<?php echo ($aid) ? $aid : null ?>" disabled />
|
121 |
-
<span class="yarpp_warning"></span>
|
122 |
-
</div>
|
123 |
-
|
124 |
-
<div class="yarpp_form_row">
|
125 |
-
<label class="yarpp_pro_label">API Key: </label>
|
126 |
-
<input id="yarpp_pro_api_key" type="text" name="v" value="<?php echo ($v) ? $v : null ?>" disabled />
|
127 |
-
<span class="yarpp_warning"></span>
|
128 |
-
</div>
|
129 |
-
|
130 |
-
<div class="yarpp_form_row">
|
131 |
-
<input id="yarpp_pro_settings_submit" class="submit-btn" type="submit" value="Save API Settings" disabled />
|
132 |
-
</div>
|
133 |
-
</form>
|
134 |
-
</div>
|
135 |
-
</div>
|
136 |
-
-->
|
137 |
-
<?php endif ?>
|
138 |
-
</div>
|
1 |
<?php
|
2 |
+
global $yarpp;
|
|
|
3 |
|
4 |
+
if (isset($_GET['aid']) && isset($_GET['v']) && isset($_GET['st']) && isset($_GET['dpid'])) {
|
5 |
+
$yarpp->yarppPro['aid'] = (trim($_GET['aid']) !== '') ? $_GET['aid'] : null;
|
6 |
+
$yarpp->yarppPro['dpid']= (trim($_GET['dpid'])!== '') ? $_GET['dpid']: null;
|
7 |
+
$yarpp->yarppPro['st'] = (trim($_GET['st']) !== '') ? rawurlencode($_GET['st']) : null;
|
8 |
+
$yarpp->yarppPro['v'] = (trim($_GET['v']) !== '') ? rawurlencode($_GET['v']) : null;
|
9 |
|
10 |
+
update_option('yarpp_pro', $yarpp->yarppPro);
|
11 |
+
}
|
12 |
|
13 |
+
$src = urlencode(admin_url().'options-general.php?page='.$_GET['page']);
|
14 |
+
$aid = (isset($yarpp->yarppPro['aid']) && $yarpp->yarppPro['aid']) ? $yarpp->yarppPro['aid'] : 0;
|
15 |
+
$st = (isset($yarpp->yarppPro['st']) && $yarpp->yarppPro['st']) ? $yarpp->yarppPro['st'] : 0;
|
16 |
+
$v = (isset($yarpp->yarppPro['v']) && $yarpp->yarppPro['v']) ? $yarpp->yarppPro['v'] : 0;
|
17 |
+
$d = urlencode(get_home_url());
|
18 |
+
$url = 'https://yarpp.adkengage.com/AdcenterUI/PublisherUI/PublisherDashboard.aspx?src='.$src.'&d='.$d.'&aid='.$aid.'&st='.$st.'&plugin=1';
|
19 |
|
20 |
+
include(YARPP_DIR.'/includes/phtmls/yarpp_pro_options.phtml');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/yarpp_pro_set_display_types.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (!isset($_GET['ypsdt']) || $_GET['ypsdt'] === true) die();
|
3 |
+
$types = (isset($_GET['types']) && is_array($_GET['types'])) ? $_GET['types'] : array();
|
4 |
+
|
5 |
+
include_once(realpath('../../../../').'/wp-config.php');
|
6 |
+
$yarppPro = get_option('yarpp_pro');
|
7 |
+
$yarppPro['auto_display_post_types'] = $types;
|
8 |
+
update_option('yarpp_pro',$yarppPro);
|
9 |
+
|
10 |
+
header('Content-Type: text/plain');
|
11 |
+
die('ok');
|
includes/yarpp_switch.php
CHANGED
@@ -9,10 +9,10 @@ function switchYarppPro($status){
|
|
9 |
$yarpp = get_option('yarpp');
|
10 |
|
11 |
if($status){
|
12 |
-
$yarppPro['optin']
|
13 |
-
$yarpp['optin']
|
14 |
} else {
|
15 |
-
$yarpp['optin']
|
16 |
}
|
17 |
|
18 |
$yarppPro['active'] = $status;
|
9 |
$yarpp = get_option('yarpp');
|
10 |
|
11 |
if($status){
|
12 |
+
$yarppPro['optin'] = (bool) $yarpp['optin'];
|
13 |
+
$yarpp['optin'] = false;
|
14 |
} else {
|
15 |
+
$yarpp['optin'] = (bool) $yarppPro['optin'];
|
16 |
}
|
17 |
|
18 |
$yarppPro['active'] = $status;
|
js/options_switch.js
CHANGED
@@ -1,9 +1,4 @@
|
|
1 |
-
|
2 |
-
$('.yarpp_switch_button').click(function( e){
|
3 |
-
e.preventDefault();
|
4 |
-
var url = $(this).attr('href'),
|
5 |
-
data = { go : $(this).data('go') };
|
6 |
-
|
7 |
$.get(
|
8 |
url,
|
9 |
data,
|
@@ -13,27 +8,68 @@ jQuery(document).ready(function($){
|
|
13 |
}
|
14 |
}
|
15 |
);
|
16 |
-
|
17 |
-
/* MARK: API Setting override
|
18 |
-
$('#yarpp_pro_api_settings_unlock').click(function(){
|
19 |
-
$('#yarpp_pro_aid, #yarpp_pro_api_key, #yarpp_pro_settings_submit').attr('disabled',false);
|
20 |
-
$('#yarpp_pro_aid').focus();
|
21 |
-
$(this).attr('disabled',true);
|
22 |
-
});
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
});
|
28 |
|
29 |
-
$('#
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
});
|
38 |
-
|
39 |
});
|
1 |
+
function yarppMakeTheSwitch($,data,url){
|
|
|
|
|
|
|
|
|
|
|
2 |
$.get(
|
3 |
url,
|
4 |
data,
|
8 |
}
|
9 |
}
|
10 |
);
|
11 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
jQuery(document).ready(function($){
|
14 |
+
$('.yarpp_switch_button').on('click',function(e){
|
15 |
+
e.preventDefault();
|
16 |
+
var url = $(this).attr('href'),
|
17 |
+
data = { go : $(this).data('go') };
|
18 |
+
|
19 |
+
if(data.go === 'basic'){
|
20 |
+
$('#wpwrap').after(
|
21 |
+
'<div id="yarpp_pro_disable_overlay">'+
|
22 |
+
'</div>'+
|
23 |
+
'<div id="yarpp_pro_disable_confirm">'+
|
24 |
+
'<p>'+
|
25 |
+
'Are you sure you would like to deactivate YARPP Pro?'+
|
26 |
+
'<br/>'+
|
27 |
+
'Doing so will remove all <strong>YARPP Pro</strong> '+
|
28 |
+
'content from your site, including sidebar widgets.'+
|
29 |
+
'</p>'+
|
30 |
+
'<br/>'+
|
31 |
+
'<a id="yarpp_proceed_deactivation" class="button">Deactivate YARPP Pro</a>'+
|
32 |
+
' '+
|
33 |
+
'<a id="yarpp_cancel_deactivation" class="button-primary">Cancel Deactivation</a>'+
|
34 |
+
'</div>'
|
35 |
+
);
|
36 |
+
$('#yarpp_proceed_deactivation').on('click',function(){
|
37 |
+
yarppMakeTheSwitch($,data,url);
|
38 |
+
});
|
39 |
+
|
40 |
+
$('#yarpp_cancel_deactivation').on('click',function(){
|
41 |
+
window.location.reload();
|
42 |
+
});
|
43 |
+
|
44 |
+
} else {
|
45 |
+
yarppMakeTheSwitch($,data,url);
|
46 |
+
}
|
47 |
});
|
48 |
|
49 |
+
$('#yarpp-display-mode-save').on('click',function(e){
|
50 |
+
e.preventDefault();
|
51 |
+
var url = $(this).attr('href'),
|
52 |
+
data = {ypsdt : true, types : []};
|
53 |
+
|
54 |
+
$(this).after($('<span class="spinner"></span>'));
|
55 |
+
|
56 |
+
$i = 0;
|
57 |
+
$('input','#yarpp-display-mode').each(function(idx,val){
|
58 |
+
if(val.checked) {
|
59 |
+
data.types[$i] = val.value;
|
60 |
+
$i++;
|
61 |
}
|
62 |
});
|
63 |
+
|
64 |
+
$.get(url,data,function(resp){
|
65 |
+
setTimeout(function(){
|
66 |
+
if(resp === 'ok'){
|
67 |
+
$('.spinner','#yarpp-display-mode').remove();
|
68 |
+
} else {
|
69 |
+
$('#yarpp-display-mode').append($('<span style="vertical-align: middle" class="error-message">Something went wrong saving your settings. Please refresh the page and try again.</span>'));
|
70 |
+
}
|
71 |
+
},1000);
|
72 |
+
});
|
73 |
});
|
74 |
+
|
75 |
});
|
readme.txt
CHANGED
@@ -5,8 +5,8 @@ Author URI: http://www.yarpp.com/
|
|
5 |
Plugin URI: http://www.yarpp.com/
|
6 |
Tags: feeds, pages, posts, related, rss, yarpp, ads, multisite, multilingual, thumbnails, related posts, related content
|
7 |
Requires at least: 3.3
|
8 |
-
Tested up to: 3.
|
9 |
-
Stable tag: 4.
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Display a list of related posts on your site based on a powerful unique algorithm. Earn money by including sponsored content!
|
@@ -16,13 +16,15 @@ Display a list of related posts on your site based on a powerful unique algorith
|
|
16 |
Yet Another Related Posts Plugin (YARPP) displays pages, posts, and custom post types related to the current entry, introducing your readers to other relevant content on your site.
|
17 |
[(See current offers and promotions for YARPP Pro users.)](http://www.yarpp.com/offers)
|
18 |
|
|
|
|
|
19 |
**Enable YARPP Pro for Powerful Enhancements**
|
20 |
-----------------------------------------
|
21 |
* **Customize thumbnail layout** through the user interface.
|
22 |
* **Pull related content from multiple sites**.
|
23 |
-
* **Make money
|
24 |
* **Easily promote your product or service** on thousands of blogs and websites.
|
25 |
-
* **Get detailed reporting**
|
26 |
|
27 |
[Learn more about the new YARPP Pro enhancements!](http://www.yarpp.com)
|
28 |
|
@@ -31,7 +33,7 @@ Yet Another Related Posts Plugin (YARPP) displays pages, posts, and custom post
|
|
31 |
* **Thumbnail or list view** of related content.
|
32 |
* **Related posts, pages, and custom post types.**
|
33 |
* **Templating**: The YARPP templating system gives you advanced control of how your results are displayed.
|
34 |
-
* **An advanced and versatile algorithm**: Using a customizable algorithm considering post titles, content, tags, categories, and custom taxonomies, YARPP finds related content from across your site. [Learn More.](http://wordpress.tv/2011/01/29/michael-
|
35 |
* **Related posts in feeds**: Display related posts in RSS feeds with custom display options.
|
36 |
|
37 |
This plugin requires PHP 5, MySQL 4.1, and WordPress 3.3 or greater. See [the FAQ](http://wordpress.org/plugins/yet-another-related-posts-plugin/faq/) for answers to common questions.
|
@@ -50,7 +52,9 @@ Make sure the "display related posts in feeds" option is turned on if you would
|
|
50 |
|
51 |
= Widget =
|
52 |
|
53 |
-
Related posts can also be displayed as a widget. Go to the Appearance > Widgets options page and add the Related Posts widget. The widget will only be displayed on single entry (permalink) pages.
|
|
|
|
|
54 |
|
55 |
= Custom display through templates =
|
56 |
|
@@ -70,7 +74,7 @@ Most likely you have "no related posts" right now because the default "match thr
|
|
70 |
|
71 |
= How can I move the related posts display? =
|
72 |
|
73 |
-
If you do not want to show the Related Posts display in its default position (right below the post content), first go to YARPP options and turn off the "automatically display" options in the "website" section. If you would like to instead display it in your sidebar and you have a widget-aware theme, YARPP provides a Related Posts widget which you can add under "Appearance" > "Widgets."
|
74 |
|
75 |
If you would like to add the Related Posts display elsewhere, 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. (Make sure you don't add `echo related_posts();` or you may end up with duplicates in your related posts section.)
|
76 |
|
@@ -294,6 +298,15 @@ YARPP is currently localized in the following languages:
|
|
294 |
|
295 |
== Changelog ==
|
296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
= 4.1.2 =
|
298 |
* Tested on Wordpress 3.8.
|
299 |
* Added field boxes with API Key information to Domain page.
|
5 |
Plugin URI: http://www.yarpp.com/
|
6 |
Tags: feeds, pages, posts, related, rss, yarpp, ads, multisite, multilingual, thumbnails, related posts, related content
|
7 |
Requires at least: 3.3
|
8 |
+
Tested up to: 3.9.1
|
9 |
+
Stable tag: 4.2
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Display a list of related posts on your site based on a powerful unique algorithm. Earn money by including sponsored content!
|
16 |
Yet Another Related Posts Plugin (YARPP) displays pages, posts, and custom post types related to the current entry, introducing your readers to other relevant content on your site.
|
17 |
[(See current offers and promotions for YARPP Pro users.)](http://www.yarpp.com/offers)
|
18 |
|
19 |
+
**NEW!** Now you can mix and match **YARPP Basic** and **YARPP Pro** to get the best of both features, beneath articles or in the sidebar! Use the combination that works best for you.
|
20 |
+
|
21 |
**Enable YARPP Pro for Powerful Enhancements**
|
22 |
-----------------------------------------
|
23 |
* **Customize thumbnail layout** through the user interface.
|
24 |
* **Pull related content from multiple sites**.
|
25 |
+
* **Make money by displaying sponsored content**, at the bottom of your posts, in the sidebar, or both.
|
26 |
* **Easily promote your product or service** on thousands of blogs and websites.
|
27 |
+
* **Get detailed reporting** about your related content list.
|
28 |
|
29 |
[Learn more about the new YARPP Pro enhancements!](http://www.yarpp.com)
|
30 |
|
33 |
* **Thumbnail or list view** of related content.
|
34 |
* **Related posts, pages, and custom post types.**
|
35 |
* **Templating**: The YARPP templating system gives you advanced control of how your results are displayed.
|
36 |
+
* **An advanced and versatile algorithm**: Using a customizable algorithm considering post titles, content, tags, categories, and custom taxonomies, YARPP finds related content from across your site. [Learn More.](http://wordpress.tv/2011/01/29/michael-%E2%80%9Cmitcho%E2%80%9D-erlewine-the-yet-another-related-posts-plugin-algorithm-explained/)
|
37 |
* **Related posts in feeds**: Display related posts in RSS feeds with custom display options.
|
38 |
|
39 |
This plugin requires PHP 5, MySQL 4.1, and WordPress 3.3 or greater. See [the FAQ](http://wordpress.org/plugins/yet-another-related-posts-plugin/faq/) for answers to common questions.
|
52 |
|
53 |
= Widget =
|
54 |
|
55 |
+
Related posts can also be displayed as a widget. Go to the Appearance > Widgets options page and add the "Related Posts (YARPP)" widget. Choose to display content from YARPP Basic or YARPP Pro. The widget will only be displayed on single entry (permalink) pages.
|
56 |
+
|
57 |
+
The YARPP Basic widget can be used even if the "auto display" option is turned off. The YARPP Pro sidebar widget can be used even if you choose YARPP Basic to display related content at the bottom of your posts.
|
58 |
|
59 |
= Custom display through templates =
|
60 |
|
74 |
|
75 |
= How can I move the related posts display? =
|
76 |
|
77 |
+
If you do not want to show the Related Posts display in its default position (right below the post content), first go to YARPP options and turn off the "automatically display" options in the "website" section. If you would like to instead display it in your sidebar and you have a widget-aware theme, YARPP provides a Related Posts widget which you can add under "Appearance" > "Widgets." (You can choose to display sidebar content from either YARPP Basic or YARPP Pro.)
|
78 |
|
79 |
If you would like to add the Related Posts display elsewhere, 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. (Make sure you don't add `echo related_posts();` or you may end up with duplicates in your related posts section.)
|
80 |
|
298 |
|
299 |
== Changelog ==
|
300 |
|
301 |
+
= 4.2 =
|
302 |
+
* Tested on WordPress 3.9.
|
303 |
+
* YARPP Basic and YARPP Pro can now be used simultaneously, rather than being mutually exclusive.
|
304 |
+
* Added a YARPP Pro option to the YARPP sidebar widget.
|
305 |
+
* Enlarged "Display Options" panel textbox for increased usability.
|
306 |
+
* Updated YARPP Pro script to allow for future enhancements.
|
307 |
+
* Updated MyISAM check notice message to explain its impact on "Pages."
|
308 |
+
* Added descriptive text to explain new enhancements.
|
309 |
+
|
310 |
= 4.1.2 =
|
311 |
* Tested on Wordpress 3.8.
|
312 |
* Added field boxes with API Key information to Domain page.
|
style/options_basic.css
CHANGED
@@ -10,6 +10,7 @@ ul.yarpp_contacts li {
|
|
10 |
padding: 0px 0px 0px 30px;
|
11 |
line-height: 22px;
|
12 |
}
|
|
|
13 |
body.rtl ul.yarpp_contacts li {
|
14 |
padding: 0px 30px 0px 0px;
|
15 |
}
|
@@ -35,6 +36,7 @@ ul.yarpp_contacts li a img {
|
|
35 |
margin-top: -1px;
|
36 |
background-image: url('../images/sprites.png');
|
37 |
}
|
|
|
38 |
body.rtl .icon {
|
39 |
margin-left: none;
|
40 |
margin-right: -29px;
|
@@ -50,18 +52,23 @@ body.rtl .icon {
|
|
50 |
.icon-wordpress {
|
51 |
background-position: 0 0;
|
52 |
}
|
|
|
53 |
.icon-twitter {
|
54 |
background-position: -22px 0;
|
55 |
}
|
|
|
56 |
.icon-plugin {
|
57 |
background-position: -44px 0;
|
58 |
}
|
|
|
59 |
.icon-star {
|
60 |
background-position: -66px 0;
|
61 |
}
|
|
|
62 |
.icon-pro {
|
63 |
background-position: -88px 0;
|
64 |
}
|
|
|
65 |
.icon-facebook {
|
66 |
background-position: -110px 0;
|
67 |
}
|
@@ -83,11 +90,13 @@ body.rtl .icon {
|
|
83 |
5% { transform: rotate(0deg) scale(1.5); }
|
84 |
100% { transform: rotate(360deg) scale(1);}
|
85 |
}
|
|
|
86 |
@-moz-keyframes yarpp-spin {
|
87 |
0% { -moz-transform: rotate(0deg) scale(1); }
|
88 |
5% { -moz-transform: rotate(0deg) scale(1.5); }
|
89 |
100% { -moz-transform: rotate(360deg) scale(1);}
|
90 |
}
|
|
|
91 |
@-webkit-keyframes yarpp-spin {
|
92 |
0% { -webkit-transform: rotate(0deg) scale(1); }
|
93 |
5% { -webkit-transform: rotate(0deg) scale(1.5); }
|
@@ -100,15 +109,11 @@ a.info{
|
|
100 |
}
|
101 |
|
102 |
.yarpp_help {
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
cursor: default;
|
109 |
-
vertical-align: baseline;
|
110 |
-
width: 20px;
|
111 |
-
height: 20px;
|
112 |
}
|
113 |
|
114 |
a.yarpp_help {
|
@@ -122,7 +127,7 @@ a.yarpp_help:hover {
|
|
122 |
}
|
123 |
|
124 |
.branch-3-4 .yarpp_help, .branch-3-3 .yarpp-help {
|
125 |
-
background-image: url('../../../../wp-includes/images/wpicons.png
|
126 |
}
|
127 |
|
128 |
.exclude_terms span {
|
@@ -137,52 +142,67 @@ a.yarpp_help:hover {
|
|
137 |
margin-bottom: 5px;
|
138 |
background: #fdfdfd;
|
139 |
}
|
|
|
140 |
.yarpp_form_row {
|
141 |
overflow: visible;
|
142 |
padding: 8px;
|
143 |
}
|
|
|
144 |
.yarpp_form_row > div {
|
145 |
display: inline-block;
|
146 |
*display: inline;
|
147 |
vertical-align: baseline;
|
148 |
}
|
|
|
149 |
.yarpp_form_checkbox > div {
|
150 |
}
|
|
|
151 |
.yarpp_form_select > div {
|
152 |
padding-top: 5px;
|
153 |
padding-bottom: 5px;
|
154 |
}
|
|
|
155 |
.yarpp_form_select + .yarpp_form_select {
|
156 |
padding-top: 0px;
|
157 |
}
|
|
|
158 |
.yarpp_form_label {
|
159 |
-
width:
|
160 |
}
|
|
|
161 |
.yarpp_form_label + div {
|
162 |
padding-left: 16px;
|
|
|
163 |
}
|
|
|
164 |
.yarpp_form_textbox > .yarpp_form_label {
|
165 |
}
|
|
|
166 |
.yarpp_form_select > .yarpp_form_label {
|
167 |
padding-top: 8px;
|
168 |
}
|
|
|
169 |
.yarpp_form_post_types label {
|
170 |
padding-right: 15px;
|
171 |
line-height: 20px;
|
172 |
display: inline-block;
|
173 |
}
|
|
|
174 |
body.rtl .yarpp_form_post_types label {
|
175 |
padding-right: inherit;
|
176 |
padding-left: 15px;
|
177 |
}
|
|
|
178 |
.yarpp_form_exclude label {
|
179 |
padding-right: 5px;
|
180 |
line-height: 15px;
|
181 |
}
|
|
|
182 |
body.rtl .yarpp_form_exclude label {
|
183 |
padding-right: inherit;
|
184 |
padding-left: 5px;
|
185 |
}
|
|
|
186 |
.yarpp_form_template_file > .yarpp_form_label {
|
187 |
vertical-align: top;
|
188 |
padding-top: 5px;
|
@@ -193,20 +213,26 @@ body.rtl .yarpp_form_exclude label {
|
|
193 |
width: 50%;
|
194 |
float: right;
|
195 |
}
|
|
|
196 |
body.rtl .yarpp_code_display {
|
197 |
float: left;
|
198 |
}
|
|
|
199 |
.yarpp_code_display div {
|
200 |
overflow: auto;
|
201 |
max-height: 300px;
|
202 |
}
|
|
|
203 |
.yarpp_code_display pre {
|
204 |
direction: ltr;
|
205 |
}
|
|
|
206 |
.yarpp_scroll_wrapper {
|
207 |
overflow: auto;
|
|
|
208 |
max-height: 100px;
|
209 |
width: 60%;
|
|
|
210 |
}
|
211 |
|
212 |
@media all and (max-width:1200px) {
|
@@ -221,6 +247,7 @@ body.rtl .yarpp_code_display {
|
|
221 |
.yarpp_copy_templates_button {
|
222 |
float: right;
|
223 |
}
|
|
|
224 |
body.rtl .yarpp_copy_templates_button {
|
225 |
float: left;
|
226 |
}
|
@@ -228,6 +255,7 @@ body.rtl .yarpp_copy_templates_button {
|
|
228 |
#yarpp-optin-learnmore {
|
229 |
float: right;
|
230 |
}
|
|
|
231 |
body.rtl #yarpp-optin-learnmore {
|
232 |
float: left;
|
233 |
}
|
@@ -242,11 +270,13 @@ body.rtl #yarpp-optin-learnmore {
|
|
242 |
|
243 |
.yarpp_subbox input[type=text], .yarpp_subbox input[type=text] {
|
244 |
font-family: monospace;
|
|
|
245 |
}
|
246 |
|
247 |
.yarpp_form_template_buttons {
|
248 |
padding: 0px;
|
249 |
}
|
|
|
250 |
.yarpp_template_button {
|
251 |
position: relative;
|
252 |
height: 60px;
|
@@ -269,6 +299,7 @@ body.rtl #yarpp-optin-learnmore {
|
|
269 |
-webkit-box-shadow: 1px 1px 7px 1px #bbb;
|
270 |
box-shadow: 1px 1px 7px 1px #bbb;
|
271 |
}
|
|
|
272 |
.yarpp_template_button.disabled, .yarpp_template_button.disabled:hover, .yarpp_template_button.disabled:active {
|
273 |
-webkit-box-shadow: none;
|
274 |
box-shadow: none;
|
@@ -279,13 +310,16 @@ body.rtl #yarpp-optin-learnmore {
|
|
279 |
background-image: -o-linear-gradient(top, #FEFEFE, #F4F4F4) !important;
|
280 |
background-image: linear-gradient(top, #FEFEFE, #F4F4F4) !important;
|
281 |
}
|
|
|
282 |
.yarpp_template_button.disabled > div.label {
|
283 |
color: #bbb !important;
|
284 |
}
|
|
|
285 |
.yarpp_template_button:hover {
|
286 |
border-color: #999;
|
287 |
color: #222;
|
288 |
}
|
|
|
289 |
.yarpp_template_button:active, .yarpp_template_button.active {
|
290 |
background: #eee;
|
291 |
background-image: -webkit-linear-gradient(top, #eee, #f4f4f4);
|
@@ -297,6 +331,7 @@ body.rtl #yarpp-optin-learnmore {
|
|
297 |
-webkit-box-shadow: inset 0 2px 8px -2px rgba( 0, 0, 0, 0.5 );
|
298 |
box-shadow: inset 0 2px 8px -2px rgba( 0, 0, 0, 0.5 );
|
299 |
}
|
|
|
300 |
.yarpp_template_button > div.label {
|
301 |
width: 70px;
|
302 |
bottom: 8px;
|
@@ -311,18 +346,23 @@ body.rtl #yarpp-optin-learnmore {
|
|
311 |
background-size: 210px 40px;
|
312 |
opacity: 0.8;
|
313 |
}
|
|
|
314 |
.yarpp_template_button.disabled > div.image {
|
315 |
opacity: 0.2 !important;
|
316 |
}
|
|
|
317 |
.yarpp_template_button:active > div.image {
|
318 |
opacity: 1;
|
319 |
}
|
|
|
320 |
.yarpp_template_button[data-value=builtin] > div.image {
|
321 |
background-position: 0px 0px;
|
322 |
}
|
|
|
323 |
.yarpp_template_button[data-value=thumbnails] > div.image {
|
324 |
background-position: -70px 0px;
|
325 |
}
|
|
|
326 |
.yarpp_template_button[data-value=custom] > div.image {
|
327 |
background-position: -140px 0px;
|
328 |
}
|
10 |
padding: 0px 0px 0px 30px;
|
11 |
line-height: 22px;
|
12 |
}
|
13 |
+
|
14 |
body.rtl ul.yarpp_contacts li {
|
15 |
padding: 0px 30px 0px 0px;
|
16 |
}
|
36 |
margin-top: -1px;
|
37 |
background-image: url('../images/sprites.png');
|
38 |
}
|
39 |
+
|
40 |
body.rtl .icon {
|
41 |
margin-left: none;
|
42 |
margin-right: -29px;
|
52 |
.icon-wordpress {
|
53 |
background-position: 0 0;
|
54 |
}
|
55 |
+
|
56 |
.icon-twitter {
|
57 |
background-position: -22px 0;
|
58 |
}
|
59 |
+
|
60 |
.icon-plugin {
|
61 |
background-position: -44px 0;
|
62 |
}
|
63 |
+
|
64 |
.icon-star {
|
65 |
background-position: -66px 0;
|
66 |
}
|
67 |
+
|
68 |
.icon-pro {
|
69 |
background-position: -88px 0;
|
70 |
}
|
71 |
+
|
72 |
.icon-facebook {
|
73 |
background-position: -110px 0;
|
74 |
}
|
90 |
5% { transform: rotate(0deg) scale(1.5); }
|
91 |
100% { transform: rotate(360deg) scale(1);}
|
92 |
}
|
93 |
+
|
94 |
@-moz-keyframes yarpp-spin {
|
95 |
0% { -moz-transform: rotate(0deg) scale(1); }
|
96 |
5% { -moz-transform: rotate(0deg) scale(1.5); }
|
97 |
100% { -moz-transform: rotate(360deg) scale(1);}
|
98 |
}
|
99 |
+
|
100 |
@-webkit-keyframes yarpp-spin {
|
101 |
0% { -webkit-transform: rotate(0deg) scale(1); }
|
102 |
5% { -webkit-transform: rotate(0deg) scale(1.5); }
|
109 |
}
|
110 |
|
111 |
.yarpp_help {
|
112 |
+
display: inline-block;
|
113 |
+
background: transparent url('../../../../wp-includes/images/wpicons.png') no-repeat -520px -20px;
|
114 |
+
vertical-align: text-bottom;
|
115 |
+
width: 20px;
|
116 |
+
height: 20px;
|
|
|
|
|
|
|
|
|
117 |
}
|
118 |
|
119 |
a.yarpp_help {
|
127 |
}
|
128 |
|
129 |
.branch-3-4 .yarpp_help, .branch-3-3 .yarpp-help {
|
130 |
+
background-image: url('../../../../wp-includes/images/wpicons.png');
|
131 |
}
|
132 |
|
133 |
.exclude_terms span {
|
142 |
margin-bottom: 5px;
|
143 |
background: #fdfdfd;
|
144 |
}
|
145 |
+
|
146 |
.yarpp_form_row {
|
147 |
overflow: visible;
|
148 |
padding: 8px;
|
149 |
}
|
150 |
+
|
151 |
.yarpp_form_row > div {
|
152 |
display: inline-block;
|
153 |
*display: inline;
|
154 |
vertical-align: baseline;
|
155 |
}
|
156 |
+
|
157 |
.yarpp_form_checkbox > div {
|
158 |
}
|
159 |
+
|
160 |
.yarpp_form_select > div {
|
161 |
padding-top: 5px;
|
162 |
padding-bottom: 5px;
|
163 |
}
|
164 |
+
|
165 |
.yarpp_form_select + .yarpp_form_select {
|
166 |
padding-top: 0px;
|
167 |
}
|
168 |
+
|
169 |
.yarpp_form_label {
|
170 |
+
width: 25%;
|
171 |
}
|
172 |
+
|
173 |
.yarpp_form_label + div {
|
174 |
padding-left: 16px;
|
175 |
+
width: 70%;
|
176 |
}
|
177 |
+
|
178 |
.yarpp_form_textbox > .yarpp_form_label {
|
179 |
}
|
180 |
+
|
181 |
.yarpp_form_select > .yarpp_form_label {
|
182 |
padding-top: 8px;
|
183 |
}
|
184 |
+
|
185 |
.yarpp_form_post_types label {
|
186 |
padding-right: 15px;
|
187 |
line-height: 20px;
|
188 |
display: inline-block;
|
189 |
}
|
190 |
+
|
191 |
body.rtl .yarpp_form_post_types label {
|
192 |
padding-right: inherit;
|
193 |
padding-left: 15px;
|
194 |
}
|
195 |
+
|
196 |
.yarpp_form_exclude label {
|
197 |
padding-right: 5px;
|
198 |
line-height: 15px;
|
199 |
}
|
200 |
+
|
201 |
body.rtl .yarpp_form_exclude label {
|
202 |
padding-right: inherit;
|
203 |
padding-left: 5px;
|
204 |
}
|
205 |
+
|
206 |
.yarpp_form_template_file > .yarpp_form_label {
|
207 |
vertical-align: top;
|
208 |
padding-top: 5px;
|
213 |
width: 50%;
|
214 |
float: right;
|
215 |
}
|
216 |
+
|
217 |
body.rtl .yarpp_code_display {
|
218 |
float: left;
|
219 |
}
|
220 |
+
|
221 |
.yarpp_code_display div {
|
222 |
overflow: auto;
|
223 |
max-height: 300px;
|
224 |
}
|
225 |
+
|
226 |
.yarpp_code_display pre {
|
227 |
direction: ltr;
|
228 |
}
|
229 |
+
|
230 |
.yarpp_scroll_wrapper {
|
231 |
overflow: auto;
|
232 |
+
min-height: 25px;
|
233 |
max-height: 100px;
|
234 |
width: 60%;
|
235 |
+
vertical-align: middle !important;
|
236 |
}
|
237 |
|
238 |
@media all and (max-width:1200px) {
|
247 |
.yarpp_copy_templates_button {
|
248 |
float: right;
|
249 |
}
|
250 |
+
|
251 |
body.rtl .yarpp_copy_templates_button {
|
252 |
float: left;
|
253 |
}
|
255 |
#yarpp-optin-learnmore {
|
256 |
float: right;
|
257 |
}
|
258 |
+
|
259 |
body.rtl #yarpp-optin-learnmore {
|
260 |
float: left;
|
261 |
}
|
270 |
|
271 |
.yarpp_subbox input[type=text], .yarpp_subbox input[type=text] {
|
272 |
font-family: monospace;
|
273 |
+
width: 35%
|
274 |
}
|
275 |
|
276 |
.yarpp_form_template_buttons {
|
277 |
padding: 0px;
|
278 |
}
|
279 |
+
|
280 |
.yarpp_template_button {
|
281 |
position: relative;
|
282 |
height: 60px;
|
299 |
-webkit-box-shadow: 1px 1px 7px 1px #bbb;
|
300 |
box-shadow: 1px 1px 7px 1px #bbb;
|
301 |
}
|
302 |
+
|
303 |
.yarpp_template_button.disabled, .yarpp_template_button.disabled:hover, .yarpp_template_button.disabled:active {
|
304 |
-webkit-box-shadow: none;
|
305 |
box-shadow: none;
|
310 |
background-image: -o-linear-gradient(top, #FEFEFE, #F4F4F4) !important;
|
311 |
background-image: linear-gradient(top, #FEFEFE, #F4F4F4) !important;
|
312 |
}
|
313 |
+
|
314 |
.yarpp_template_button.disabled > div.label {
|
315 |
color: #bbb !important;
|
316 |
}
|
317 |
+
|
318 |
.yarpp_template_button:hover {
|
319 |
border-color: #999;
|
320 |
color: #222;
|
321 |
}
|
322 |
+
|
323 |
.yarpp_template_button:active, .yarpp_template_button.active {
|
324 |
background: #eee;
|
325 |
background-image: -webkit-linear-gradient(top, #eee, #f4f4f4);
|
331 |
-webkit-box-shadow: inset 0 2px 8px -2px rgba( 0, 0, 0, 0.5 );
|
332 |
box-shadow: inset 0 2px 8px -2px rgba( 0, 0, 0, 0.5 );
|
333 |
}
|
334 |
+
|
335 |
.yarpp_template_button > div.label {
|
336 |
width: 70px;
|
337 |
bottom: 8px;
|
346 |
background-size: 210px 40px;
|
347 |
opacity: 0.8;
|
348 |
}
|
349 |
+
|
350 |
.yarpp_template_button.disabled > div.image {
|
351 |
opacity: 0.2 !important;
|
352 |
}
|
353 |
+
|
354 |
.yarpp_template_button:active > div.image {
|
355 |
opacity: 1;
|
356 |
}
|
357 |
+
|
358 |
.yarpp_template_button[data-value=builtin] > div.image {
|
359 |
background-position: 0px 0px;
|
360 |
}
|
361 |
+
|
362 |
.yarpp_template_button[data-value=thumbnails] > div.image {
|
363 |
background-position: -70px 0px;
|
364 |
}
|
365 |
+
|
366 |
.yarpp_template_button[data-value=custom] > div.image {
|
367 |
background-position: -140px 0px;
|
368 |
}
|
style/options_switch.css
CHANGED
@@ -82,6 +82,13 @@ a{
|
|
82 |
list-style: disc;
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
#yarpp_pro_dashboard_wrapper{
|
86 |
position: relative;
|
87 |
top: 0;
|
@@ -128,4 +135,48 @@ a{
|
|
128 |
border: none !important;
|
129 |
padding: 8px !important;
|
130 |
margin: 1px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
82 |
list-style: disc;
|
83 |
}
|
84 |
|
85 |
+
.yarpp_switch_content .to_corner {
|
86 |
+
display: block;
|
87 |
+
position: absolute;
|
88 |
+
right: -32%;
|
89 |
+
text-align: center;
|
90 |
+
}
|
91 |
+
|
92 |
#yarpp_pro_dashboard_wrapper{
|
93 |
position: relative;
|
94 |
top: 0;
|
135 |
border: none !important;
|
136 |
padding: 8px !important;
|
137 |
margin: 1px !important;
|
138 |
+
}
|
139 |
+
|
140 |
+
#yarpp-display-mode {
|
141 |
+
margin: 1em 2em;
|
142 |
+
}
|
143 |
+
|
144 |
+
#yarpp-display-mode label {
|
145 |
+
margin-right: 1em;
|
146 |
+
}
|
147 |
+
|
148 |
+
#yarpp-display-mode .spinner{
|
149 |
+
width: 20px;
|
150 |
+
height: 20px;
|
151 |
+
display: inline-block;
|
152 |
+
float: none;
|
153 |
+
vertical-align: middle;
|
154 |
+
}
|
155 |
+
|
156 |
+
#yarpp_pro_disable_overlay{
|
157 |
+
position: fixed;
|
158 |
+
top: 0;
|
159 |
+
bottom: 0;
|
160 |
+
left: 0;
|
161 |
+
right: 0;
|
162 |
+
background-color: #EEE;
|
163 |
+
opacity: 0.7;
|
164 |
+
width: 100%;
|
165 |
+
margin: 0;
|
166 |
+
padding: 0;
|
167 |
+
z-index: 1000;
|
168 |
+
}
|
169 |
+
|
170 |
+
#yarpp_pro_disable_confirm{
|
171 |
+
position: fixed;
|
172 |
+
top: 250px;
|
173 |
+
left: 38%;
|
174 |
+
background-color: #FFF;
|
175 |
+
box-shadow: 0 0 1em -0.1em #F33;
|
176 |
+
border: 2px solid #F55;
|
177 |
+
text-align: justify;
|
178 |
+
width: 25%;
|
179 |
+
margin: 0;
|
180 |
+
padding:1em 2em;
|
181 |
+
z-index: 1001;
|
182 |
}
|
style/related.css
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.yarpp-related {
|
2 |
+
margin-top: 1em;
|
3 |
+
}
|
4 |
+
|
5 |
+
.yarpp-related a{
|
6 |
+
text-decoration: none;
|
7 |
+
font-weight: bold;
|
8 |
+
}
|
9 |
+
|
10 |
+
.yarpp-related h3{
|
11 |
+
font-weight: bold;
|
12 |
+
padding: 0 0 5px 0;
|
13 |
+
font-size: 125%;
|
14 |
+
text-transform: capitalize;
|
15 |
+
margin: 0 !important;
|
16 |
+
}
|
17 |
+
|
18 |
+
.yarpp-related .yarpp-promote{
|
19 |
+
clear: both;
|
20 |
+
background: url(http://api.engage.bidsystem.com/adk_mini_logo.png) no-repeat;
|
21 |
+
float: right;
|
22 |
+
text-indent: -1000px;
|
23 |
+
cursor: pointer;
|
24 |
+
color: #666;
|
25 |
+
font-size: 11px;
|
26 |
+
height: 17px;
|
27 |
+
width: 78px;
|
28 |
+
}
|
style/widget.css
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.yarpp_pro_msg{
|
2 |
+
border: 1px ridge #D0D0D0;
|
3 |
+
padding: 0.4em 2em 0.8em;
|
4 |
+
text-align: justify;
|
5 |
+
}
|
6 |
+
.yarpp_pro_msg strong{
|
7 |
+
display: inline-block;
|
8 |
+
text-align: center;
|
9 |
+
width: 100%;
|
10 |
+
color: orange;
|
11 |
+
}
|
12 |
+
.yarpp_help {
|
13 |
+
position: relative;
|
14 |
+
display: inline-block;
|
15 |
+
background: transparent url('../../../../wp-includes/images/wpicons.png') no-repeat -520px -20px;
|
16 |
+
vertical-align: text-bottom;
|
17 |
+
width: 20px;
|
18 |
+
height: 20px;
|
19 |
+
}
|
20 |
+
.yarpp_help_msg {
|
21 |
+
position: absolute;
|
22 |
+
left: 25px;
|
23 |
+
display: none;
|
24 |
+
border: 1px solid #D0D0D0;
|
25 |
+
width: 250px;
|
26 |
+
text-align: justify;
|
27 |
+
padding: 10px 15px;
|
28 |
+
background-color: #FFF;
|
29 |
+
box-shadow: 0 0 0.4em -0.15em #333;
|
30 |
+
z-index: 100;
|
31 |
+
}
|
32 |
+
.yarpp_help:hover .yarpp_help_msg{
|
33 |
+
display: block
|
34 |
+
}
|
uninstall.php
CHANGED
@@ -21,7 +21,8 @@ $optNames = array(
|
|
21 |
'yarpp_version_info',
|
22 |
'yarpp_version_info_timeout',
|
23 |
'yarpp_activated',
|
24 |
-
'widget_yarpp_widget'
|
|
|
25 |
);
|
26 |
|
27 |
/* Select right procedure for single or multi site */
|
21 |
'yarpp_version_info',
|
22 |
'yarpp_version_info_timeout',
|
23 |
'yarpp_activated',
|
24 |
+
'widget_yarpp_widget',
|
25 |
+
'yarpp_upgraded'
|
26 |
);
|
27 |
|
28 |
/* Select right procedure for single or multi site */
|
yarpp.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*----------------------------------------------------------------------------------------------------------------------
|
3 |
Plugin Name: Yet Another Related Posts Plugin
|
4 |
Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm. Enabling YARPP Pro gives you access to even more powerful features. <a href="http://www.yarpp.com" target="_blank">Find out more</a>.
|
5 |
-
Version: 4.
|
6 |
Author: Adknowledge
|
7 |
Author URI: http://www.yarpp.com/
|
8 |
Plugin URI: http://www.yarpp.com/
|
@@ -14,8 +14,9 @@ if(!defined('WP_CONTENT_DIR')){
|
|
14 |
define('WP_CONTENT_DIR', substr($tr,0,strrpos($tr,'/')));
|
15 |
}
|
16 |
|
17 |
-
define('YARPP_VERSION', '4.
|
18 |
define('YARPP_DIR', dirname(__FILE__));
|
|
|
19 |
define('YARPP_NO_RELATED', ':(');
|
20 |
define('YARPP_RELATED', ':)');
|
21 |
define('YARPP_NOT_CACHED', ':/');
|
2 |
/*----------------------------------------------------------------------------------------------------------------------
|
3 |
Plugin Name: Yet Another Related Posts Plugin
|
4 |
Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm. Enabling YARPP Pro gives you access to even more powerful features. <a href="http://www.yarpp.com" target="_blank">Find out more</a>.
|
5 |
+
Version: 4.2
|
6 |
Author: Adknowledge
|
7 |
Author URI: http://www.yarpp.com/
|
8 |
Plugin URI: http://www.yarpp.com/
|
14 |
define('WP_CONTENT_DIR', substr($tr,0,strrpos($tr,'/')));
|
15 |
}
|
16 |
|
17 |
+
define('YARPP_VERSION', '4.2');
|
18 |
define('YARPP_DIR', dirname(__FILE__));
|
19 |
+
define('YARPP_URL', plugins_url('',__FILE__));
|
20 |
define('YARPP_NO_RELATED', ':(');
|
21 |
define('YARPP_RELATED', ':)');
|
22 |
define('YARPP_NOT_CACHED', ':/');
|