Version Description
(14-July-2021) =
* New: Adds a yarpp_add_image_size
filter to avoid creating YARPP thumbnail sizes
+ add_filter( 'yarpp_add_image_size', '__return_false' );
* New: Preview YARPP Templates on the YARPP settings page under Automatic Display Options
* Docs: Added FAQ on how to remove sold out WooCommerce products from recommendations (and otherwise filter by postmeta)
Download this release
Release Info
Developer | jeffparker |
Plugin | Yet Another Related Posts Plugin (YARPP) |
Version | 5.26.0 |
Comparing to | |
See all releases |
Code changes from version 5.25.0 to 5.26.0
- classes/YARPP_Admin.php +113 -28
- classes/YARPP_Cache_Bypass.php +11 -50
- classes/YARPP_Cache_Demo_Bypass.php +258 -0
- classes/YARPP_Core.php +61 -23
- classes/YARPP_Meta_Box.php +1 -1
- classes/YARPP_Meta_Box_Display_Feed.php +0 -5
- classes/YARPP_Meta_Box_Display_Web.php +24 -6
- images/preview_thumbnail_example.png +0 -0
- includes/yarpp_options.php +1 -2
- js/options_basic.min.js +1 -1
- readme.txt +69 -25
- src/css/public/options_basic.css +361 -198
- src/js/options_basic.js +347 -69
- style/options_basic.css +1 -1
- style/styles_thumbnails.css +1 -1
- yarpp.php +3 -2
classes/YARPP_Admin.php
CHANGED
@@ -37,7 +37,6 @@ class YARPP_Admin {
|
|
37 |
add_action( 'save_post', array( $this, 'yarpp_save_meta_box' ) );
|
38 |
|
39 |
add_filter( 'current_screen', array( $this, 'settings_screen' ) );
|
40 |
-
add_filter( 'screen_settings', array( $this, 'render_screen_settings' ), 10, 2 );
|
41 |
add_filter( 'default_hidden_meta_boxes', array( $this, 'default_hidden_meta_boxes' ), 10, 2 );
|
42 |
add_filter( 'shareaholic_deactivate_feedback_form_plugins', array( $this, 'deactivation_survey_data' ) );
|
43 |
}
|
@@ -63,12 +62,12 @@ class YARPP_Admin {
|
|
63 |
function ajax_register() {
|
64 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
65 |
add_action( 'wp_ajax_yarpp_display_exclude_terms', array( $this, 'ajax_display_exclude_terms' ) );
|
66 |
-
add_action( 'wp_ajax_yarpp_display_demo', array( $this, 'ajax_display_demo' ) );
|
|
|
67 |
add_action( 'wp_ajax_yarpp_display', array( $this, 'ajax_display' ) );
|
68 |
add_action( 'wp_ajax_yarpp_optin_data', array( $this, 'ajax_optin_data' ) );
|
69 |
add_action( 'wp_ajax_yarpp_optin_enable', array( $this, 'ajax_optin_enable' ) );
|
70 |
add_action( 'wp_ajax_yarpp_optin_disable', array( $this, 'ajax_optin_disable' ) );
|
71 |
-
add_action( 'wp_ajax_yarpp_set_display_code', array( $this, 'ajax_set_display_code' ) );
|
72 |
add_action( 'wp_ajax_yarpp_switch', array( $this, 'ajax_switch' ) );
|
73 |
add_action( 'wp_ajax_yarpp_clear_cache', array( $this, 'ajax_clear_cache' ) );
|
74 |
}
|
@@ -523,18 +522,12 @@ class YARPP_Admin {
|
|
523 |
return $text;
|
524 |
}
|
525 |
|
|
|
|
|
|
|
526 |
public function render_screen_settings( $output, $current_screen ) {
|
527 |
-
|
528 |
-
|
529 |
-
}
|
530 |
-
|
531 |
-
$output .= "<div id='yarpp_extra_screen_settings'><label for='yarpp_display_code'><input type='checkbox' name='yarpp_display_code' id='yarpp_display_code'";
|
532 |
-
$output .= checked( $this->core->get_option( 'display_code' ), true, false );
|
533 |
-
$output .= ' />';
|
534 |
-
$output .= __( 'Show example code output', 'yarpp' );
|
535 |
-
$output .= '</label></div>';
|
536 |
-
|
537 |
-
return $output;
|
538 |
}
|
539 |
|
540 |
// since 3.3
|
@@ -565,8 +558,12 @@ class YARPP_Admin {
|
|
565 |
'forbidden' => __( 'You are not allowed to do this!', 'yarpp' ),
|
566 |
'nonce_fail' => __( 'You left this page open for too long. Please refresh the page and try again!', 'yarpp' ),
|
567 |
'error' => __( 'There is some error. Please refresh the page and try again!', 'yarpp' ),
|
|
|
|
|
568 |
);
|
569 |
wp_localize_script( 'yarpp_options', 'yarpp_messages', $translation_strings );
|
|
|
|
|
570 |
}
|
571 |
|
572 |
$metabox_post_types = $this->core->get_option( 'auto_display_post_types' );
|
@@ -764,20 +761,110 @@ class YARPP_Admin {
|
|
764 |
die();
|
765 |
}
|
766 |
|
|
|
|
|
|
|
|
|
767 |
public function ajax_display_demo() {
|
768 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
|
770 |
header( 'HTTP/1.1 200' );
|
771 |
header( 'Content-Type: text/html; charset=UTF-8' );
|
772 |
|
773 |
-
$
|
774 |
-
'
|
775 |
-
'
|
|
|
|
|
|
|
|
|
|
|
776 |
);
|
777 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
778 |
$return = $this->core->display_demo_related( $args, false );
|
779 |
-
|
780 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
781 |
}
|
782 |
|
783 |
/**
|
@@ -872,15 +959,13 @@ class YARPP_Admin {
|
|
872 |
}
|
873 |
}
|
874 |
|
|
|
|
|
|
|
|
|
875 |
public function ajax_set_display_code() {
|
876 |
-
|
877 |
-
|
878 |
-
header( 'HTTP/1.1 200' );
|
879 |
-
header( 'Content-Type: text; charset=UTF-8' );
|
880 |
-
|
881 |
-
$data = $this->core->set_option( 'display_code', isset( $_REQUEST['checked'] ) );
|
882 |
-
echo 'ok';
|
883 |
-
die();
|
884 |
}
|
885 |
|
886 |
/**
|
37 |
add_action( 'save_post', array( $this, 'yarpp_save_meta_box' ) );
|
38 |
|
39 |
add_filter( 'current_screen', array( $this, 'settings_screen' ) );
|
|
|
40 |
add_filter( 'default_hidden_meta_boxes', array( $this, 'default_hidden_meta_boxes' ), 10, 2 );
|
41 |
add_filter( 'shareaholic_deactivate_feedback_form_plugins', array( $this, 'deactivation_survey_data' ) );
|
42 |
}
|
62 |
function ajax_register() {
|
63 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
64 |
add_action( 'wp_ajax_yarpp_display_exclude_terms', array( $this, 'ajax_display_exclude_terms' ) );
|
65 |
+
add_action( 'wp_ajax_yarpp_display_demo', array( $this, 'ajax_display_demo' ) ); // deprecated action and function
|
66 |
+
add_action( 'wp_ajax_yarpp_display_preview', array( $this, 'ajax_display_preview' ) );
|
67 |
add_action( 'wp_ajax_yarpp_display', array( $this, 'ajax_display' ) );
|
68 |
add_action( 'wp_ajax_yarpp_optin_data', array( $this, 'ajax_optin_data' ) );
|
69 |
add_action( 'wp_ajax_yarpp_optin_enable', array( $this, 'ajax_optin_enable' ) );
|
70 |
add_action( 'wp_ajax_yarpp_optin_disable', array( $this, 'ajax_optin_disable' ) );
|
|
|
71 |
add_action( 'wp_ajax_yarpp_switch', array( $this, 'ajax_switch' ) );
|
72 |
add_action( 'wp_ajax_yarpp_clear_cache', array( $this, 'ajax_clear_cache' ) );
|
73 |
}
|
522 |
return $text;
|
523 |
}
|
524 |
|
525 |
+
/**
|
526 |
+
* @deprecated since 5.26.0
|
527 |
+
*/
|
528 |
public function render_screen_settings( $output, $current_screen ) {
|
529 |
+
_deprecated_function( 'YARPP_Admin::render_screen_settings', '5.26.0');
|
530 |
+
return '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
}
|
532 |
|
533 |
// since 3.3
|
558 |
'forbidden' => __( 'You are not allowed to do this!', 'yarpp' ),
|
559 |
'nonce_fail' => __( 'You left this page open for too long. Please refresh the page and try again!', 'yarpp' ),
|
560 |
'error' => __( 'There is some error. Please refresh the page and try again!', 'yarpp' ),
|
561 |
+
'show_code' => __( 'Show Code', 'yarpp' ),
|
562 |
+
'hide_code' => __( 'Hide Code', 'yarpp' )
|
563 |
);
|
564 |
wp_localize_script( 'yarpp_options', 'yarpp_messages', $translation_strings );
|
565 |
+
|
566 |
+
wp_enqueue_code_editor(array('type' => 'text/html'));
|
567 |
}
|
568 |
|
569 |
$metabox_post_types = $this->core->get_option( 'auto_display_post_types' );
|
761 |
die();
|
762 |
}
|
763 |
|
764 |
+
/**
|
765 |
+
* @deprecated since 5.26.0 use YARPP_Admin::ajax_display_preview() instead
|
766 |
+
* @see YARPP_Admin::ajax_display_preview()
|
767 |
+
*/
|
768 |
public function ajax_display_demo() {
|
769 |
+
_deprecated_function( 'YARPP_Admin::ajax_display_demo', '5.26.0', 'YARPP_Admin::ajax_display_preview' );
|
770 |
+
return $this->ajax_display_preview();
|
771 |
+
}
|
772 |
+
|
773 |
+
/**
|
774 |
+
* Generates a Demo Preview for YARPP core templates.
|
775 |
+
*
|
776 |
+
* AJAX Post Call
|
777 |
+
* Accepted Post parameters:
|
778 |
+
*
|
779 |
+
* @global int $_POST['limit']. Limit of Posts for display.
|
780 |
+
* @global string $_POST['template']. Template to be selected. 'thumbnails' | 'list' | {custom template name}. default: 'list'
|
781 |
+
* @global string $_POST['order']. Ordering the posts by: 'score DESC' | 'score ASC' | 'post_date DESC' | 'post_date ASC' | 'post_title ASC' | 'post_title DESC'. default: 'score DESC'
|
782 |
+
* @global bool $_POST['promote_yarpp']. YARPP promotional text
|
783 |
+
* @global string $_POST['thumbnails_heading']. Heading for the block
|
784 |
+
* @global string $_POST['thumbnails_default']. Default image for the thumbnails
|
785 |
+
* @global string $_POST['before_title']. Works only for template 'list'
|
786 |
+
* @global string $_POST['after_title']. Works only for template 'list'
|
787 |
+
* @global bool $_POST['show_excerpt']. Works only for template 'list'
|
788 |
+
* @global int $_POST['excerpt_length']. Works only for template 'list'
|
789 |
+
* @global string $_POST['before_post']. Works only for template 'list'
|
790 |
+
* @global string $_POST['after_post']. Works only for template 'list'
|
791 |
+
* @global string $_POST['before_related']. Works only for template 'list'
|
792 |
+
* @global string $_POST['after_related']. Works only for template 'list'
|
793 |
+
*
|
794 |
+
* @return JSON Response with structure:
|
795 |
+
* array(
|
796 |
+
* "styles" => inline styles of the requested template
|
797 |
+
* "html" => HTML code of the requested template
|
798 |
+
* "code" => HTML code Encoded of the requested template
|
799 |
+
* )
|
800 |
+
*/
|
801 |
+
public function ajax_display_preview() {
|
802 |
+
check_ajax_referer( 'yarpp_display_preview' );
|
803 |
+
|
804 |
+
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
805 |
+
wp_send_json_error( array(
|
806 |
+
'message' => 'Not allowed'
|
807 |
+
), 405 );
|
808 |
+
}
|
809 |
|
810 |
header( 'HTTP/1.1 200' );
|
811 |
header( 'Content-Type: text/html; charset=UTF-8' );
|
812 |
|
813 |
+
$defaults = array(
|
814 |
+
'domain' => 'website',
|
815 |
+
'limit' => yarpp_get_option( 'limit' ),
|
816 |
+
'template' => yarpp_get_option( 'template' ),
|
817 |
+
'order' => yarpp_get_option( 'order' ),
|
818 |
+
'promote_yarpp' => yarpp_get_option( 'promote_yarpp' ),
|
819 |
+
'show_excerpt' => yarpp_get_option( 'show_excerpt' ),
|
820 |
+
'thumbnails_default' => yarpp_get_option( 'thumbnails_default' ),
|
821 |
);
|
822 |
|
823 |
+
$allowed = array(
|
824 |
+
'limit',
|
825 |
+
'template',
|
826 |
+
'order',
|
827 |
+
'promote_yarpp',
|
828 |
+
'thumbnails_heading',
|
829 |
+
'thumbnails_default',
|
830 |
+
'before_title',
|
831 |
+
'after_title',
|
832 |
+
'show_excerpt',
|
833 |
+
'excerpt_length',
|
834 |
+
'before_post',
|
835 |
+
'after_post',
|
836 |
+
'before_related',
|
837 |
+
'after_related',
|
838 |
+
'size',
|
839 |
+
);
|
840 |
+
|
841 |
+
$args = array_intersect_key( $_POST, array_flip( $allowed ) );
|
842 |
+
$args = array_merge( $defaults, $args );
|
843 |
+
|
844 |
+
foreach ( $args as $key => $value ) {
|
845 |
+
$args[$key] = wp_unslash($value);
|
846 |
+
}
|
847 |
+
|
848 |
$return = $this->core->display_demo_related( $args, false );
|
849 |
+
|
850 |
+
$size = isset( $_POST['size'] ) ? sanitize_text_field( $_POST['size'] ) : 'thumbnail';
|
851 |
+
|
852 |
+
$load_styles = file_get_contents( plugins_url( '/style/related.css', YARPP_MAIN_FILE ) );
|
853 |
+
|
854 |
+
if ( 'thumbnails' === $args['template'] ) {
|
855 |
+
$load_styles .= file_get_contents( plugins_url( '/style/styles_thumbnails.css', YARPP_MAIN_FILE ) );
|
856 |
+
}
|
857 |
+
if ( ! in_array( $args['template'], array( 'builtin', 'list' ), true ) ) {
|
858 |
+
$load_styles .= yarpp_thumbnail_inline_css( yarpp_get_image_sizes( $size ) );
|
859 |
+
}
|
860 |
+
|
861 |
+
wp_send_json(
|
862 |
+
array(
|
863 |
+
'styles' => $load_styles,
|
864 |
+
'html' => $return,
|
865 |
+
'code' => htmlspecialchars( $return ),
|
866 |
+
)
|
867 |
+
);
|
868 |
}
|
869 |
|
870 |
/**
|
959 |
}
|
960 |
}
|
961 |
|
962 |
+
/**
|
963 |
+
* @deprecated since 5.26.0 use YARPP_Admin::ajax_display_preview() instead
|
964 |
+
* @see YARPP_Admin::ajax_display_preview()
|
965 |
+
*/
|
966 |
public function ajax_set_display_code() {
|
967 |
+
_deprecated_function( 'YARPP_Admin::ajax_set_display_code', '5.26.0', 'YARPP_Admin::ajax_display_preview' );
|
968 |
+
return $this->ajax_display_preview();
|
|
|
|
|
|
|
|
|
|
|
|
|
969 |
}
|
970 |
|
971 |
/**
|
classes/YARPP_Cache_Bypass.php
CHANGED
@@ -2,12 +2,10 @@
|
|
2 |
|
3 |
class YARPP_Cache_Bypass extends YARPP_Cache {
|
4 |
|
5 |
-
public $name
|
6 |
-
public $demo_time = false;
|
7 |
|
8 |
private $related_postdata = array();
|
9 |
private $related_IDs = array();
|
10 |
-
private $demo_limit = 0;
|
11 |
|
12 |
/**
|
13 |
* SETUP/STATUS
|
@@ -81,46 +79,10 @@ class YARPP_Cache_Bypass extends YARPP_Cache {
|
|
81 |
}
|
82 |
|
83 |
public function demo_request_filter( $arg ) {
|
84 |
-
global $
|
|
|
85 |
|
86 |
-
$
|
87 |
-
|
88 |
-
$loremipsum =
|
89 |
-
'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras tincidunt justo a urna. Ut turpis. Phasellus' .
|
90 |
-
'convallis, odio sit amet cursus convallis, eros orci scelerisque velit, ut sodales neque nisl at ante. ' .
|
91 |
-
'Suspendisse metus. Curabitur auctor pede quis mi. Pellentesque lorem justo, condimentum ac, dapibus sit ' .
|
92 |
-
'amet, ornare et, erat. Quisque velit. Etiam sodales dui feugiat neque suscipit bibendum. Integer mattis. ' .
|
93 |
-
'Nullam et ante non sem commodo malesuada. Pellentesque ultrices fermentum lectus. Maecenas hendrerit neque ac ' .
|
94 |
-
'est. Fusce tortor mi, tristique sed, cursus at, pellentesque non, dui. Suspendisse potenti.';
|
95 |
-
|
96 |
-
return "SELECT
|
97 |
-
SQL_CALC_FOUND_ROWS ID + {$this->demo_limit} as ID,
|
98 |
-
post_author,
|
99 |
-
post_date,
|
100 |
-
post_date_gmt,
|
101 |
-
'{$loremipsum}' as post_content,
|
102 |
-
concat('" . __( 'Example post ', 'yarpp' ) . "', @count:=@count+1) as post_title,
|
103 |
-
0 as post_category,
|
104 |
-
'' as post_excerpt,
|
105 |
-
'publish' as post_status,
|
106 |
-
'open' as comment_status,
|
107 |
-
'open' as ping_status,
|
108 |
-
'' as post_password,
|
109 |
-
concat('example-post-',@count) as post_name,
|
110 |
-
'' as to_ping,
|
111 |
-
'' as pinged,
|
112 |
-
post_modified,
|
113 |
-
post_modified_gmt,
|
114 |
-
'' as post_content_filtered,
|
115 |
-
0 as post_parent,
|
116 |
-
concat('PERMALINK',@count) as guid,
|
117 |
-
0 as menu_order,
|
118 |
-
'post' as post_type,
|
119 |
-
'' as post_mime_type,
|
120 |
-
0 as comment_count,
|
121 |
-
'SCORE' as score
|
122 |
-
FROM $wpdb->posts
|
123 |
-
ORDER BY ID DESC LIMIT 0, {$this->demo_limit}";
|
124 |
}
|
125 |
|
126 |
public function limit_filter( $arg ) {
|
@@ -159,12 +121,11 @@ class YARPP_Cache_Bypass extends YARPP_Cache {
|
|
159 |
add_action( 'parse_query', array( &$this, 'set_score_override_flag' ) ); // sets the score override flag.
|
160 |
}
|
161 |
|
162 |
-
public function begin_demo_time( $limit ) {
|
163 |
-
$
|
164 |
-
|
165 |
|
166 |
-
|
167 |
-
add_filter( 'posts_request', array( &$this, 'demo_request_filter' ) );
|
168 |
}
|
169 |
|
170 |
public function end_yarpp_time() {
|
@@ -180,10 +141,10 @@ class YARPP_Cache_Bypass extends YARPP_Cache {
|
|
180 |
}
|
181 |
|
182 |
public function end_demo_time() {
|
183 |
-
$
|
|
|
184 |
|
185 |
-
|
186 |
-
remove_filter( 'posts_request', array( &$this, 'demo_request_filter' ) );
|
187 |
}
|
188 |
|
189 |
public function related( $reference_ID = null, $related_ID = null ) {
|
2 |
|
3 |
class YARPP_Cache_Bypass extends YARPP_Cache {
|
4 |
|
5 |
+
public $name = 'bypass';
|
|
|
6 |
|
7 |
private $related_postdata = array();
|
8 |
private $related_IDs = array();
|
|
|
9 |
|
10 |
/**
|
11 |
* SETUP/STATUS
|
79 |
}
|
80 |
|
81 |
public function demo_request_filter( $arg ) {
|
82 |
+
global $yarpp;
|
83 |
+
_deprecated_function( 'YARPP_Cache_Bypass::demo_request_filter', '5.26.0', 'YARPP_Cache_Demo_Bypass::demo_request_filter' );
|
84 |
|
85 |
+
return $yarpp->demo_cache_bypass->demo_request_filter($arg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
public function limit_filter( $arg ) {
|
121 |
add_action( 'parse_query', array( &$this, 'set_score_override_flag' ) ); // sets the score override flag.
|
122 |
}
|
123 |
|
124 |
+
public function begin_demo_time( $limit, $order = 'score DESC', $thumbnail = '', $size = '' ) {
|
125 |
+
global $yarpp;
|
126 |
+
_deprecated_function( 'YARPP_Cache_Bypass::begin_demo_time', '5.26.0', 'YARPP_Cache_Demo_Bypass::begin_demo_time' );
|
127 |
|
128 |
+
return $yarpp->demo_cache_bypass->begin_demo_time($limit, $order, $thumbnail, $size);
|
|
|
129 |
}
|
130 |
|
131 |
public function end_yarpp_time() {
|
141 |
}
|
142 |
|
143 |
public function end_demo_time() {
|
144 |
+
global $yarpp;
|
145 |
+
_deprecated_function( 'YARPP_Cache_Bypass::end_demo_time', '5.26.0', 'YARPP_Cache_Demo_Bypass::end_demo_time' );
|
146 |
|
147 |
+
return $yarpp->demo_cache_bypass->end_demo_time();
|
|
|
148 |
}
|
149 |
|
150 |
public function related( $reference_ID = null, $related_ID = null ) {
|
classes/YARPP_Cache_Demo_Bypass.php
ADDED
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This Class is used to preview demo related posts returning dummy content and none of this data is related to the Database.
|
4 |
+
* This is not meant to be used on production environments, unless you want to use it to show examples of related posts with dummy content.
|
5 |
+
*
|
6 |
+
* @since 5.26.0
|
7 |
+
*/
|
8 |
+
class YARPP_Cache_Demo_Bypass extends YARPP_Cache {
|
9 |
+
|
10 |
+
public $name = 'bypass';
|
11 |
+
public $demo_time = false;
|
12 |
+
|
13 |
+
private $demo_limit = 0;
|
14 |
+
private $demo_order = 'score DESC';
|
15 |
+
private $demo_thumbnail_size = 'thumbnail';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* SETUP/STATUS
|
19 |
+
*/
|
20 |
+
public function __construct( $core ) {
|
21 |
+
parent::__construct( $core );
|
22 |
+
}
|
23 |
+
|
24 |
+
public function is_enabled() {
|
25 |
+
return true; // always enabled.
|
26 |
+
}
|
27 |
+
|
28 |
+
public function cache_status() {
|
29 |
+
return 0; // always uncached.
|
30 |
+
}
|
31 |
+
|
32 |
+
public function stats() {
|
33 |
+
return array(); // always unknown.
|
34 |
+
}
|
35 |
+
|
36 |
+
public function uncached( $limit = 20, $offset = 0 ) {
|
37 |
+
return array(); // nothing to cache.
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
* For demo will always have thumbnails since are going to be generated on the fly. User by filter "post_thumbnail_id"
|
43 |
+
*
|
44 |
+
* @param array $arg
|
45 |
+
* @return int Must be negative to avoid clashes with existing ids
|
46 |
+
*/
|
47 |
+
public function demo_post_thumbnail_id() {
|
48 |
+
return -1;
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
* For demo will always have thumbnails since are going to be generated on the fly. User by filter "post_thumbnail_id"
|
54 |
+
*
|
55 |
+
* @param array $arg
|
56 |
+
* @return boolean
|
57 |
+
*/
|
58 |
+
public function demo_has_thumbnails_filter( $arg ) {
|
59 |
+
return true;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Ignoring this filter since we are hardcoding the src of the default thumbnail
|
64 |
+
*
|
65 |
+
* @return array
|
66 |
+
*/
|
67 |
+
public function demo_image_downsize_filter() {
|
68 |
+
return [false, false, false];
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Update thumbnails sizes for demo thumbnails. user on Filter "post_thumbnail_size"
|
74 |
+
*
|
75 |
+
* Will return the demo_thumbnail_size.
|
76 |
+
*
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function demo_thumbnails_size_filter() {
|
80 |
+
if ( empty($this->demo_thumbnail_size) ) {
|
81 |
+
$this->demo_thumbnail_size = 'thumbnail';
|
82 |
+
}
|
83 |
+
return $this->demo_thumbnail_size;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Fills the metadata for the thumbnail image, this includes the sizes on the image
|
88 |
+
*
|
89 |
+
* @return array
|
90 |
+
*/
|
91 |
+
public function demo_image_metadata_filter() {
|
92 |
+
$size = yarpp_get_image_sizes($this->demo_thumbnail_size);
|
93 |
+
return array(
|
94 |
+
'width' => $size['width'],
|
95 |
+
'height' => $size['height'],
|
96 |
+
'file' => '/images/preview_thumbnail_example.png',
|
97 |
+
'sizes' => yarpp_get_image_sizes(),
|
98 |
+
'image_meta' => []
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Generates the default thumbnail src. Uses filter "wp_get_attachment_image_src"
|
104 |
+
*
|
105 |
+
* @return array
|
106 |
+
*/
|
107 |
+
public function demo_thumbnails_src_filter() {
|
108 |
+
$size = yarpp_get_image_sizes($this->demo_thumbnail_size);
|
109 |
+
|
110 |
+
return array(
|
111 |
+
plugins_url('/images/preview_thumbnail_example.png', YARPP_MAIN_FILE),
|
112 |
+
$size['width'],
|
113 |
+
$size['height']
|
114 |
+
);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Overwrites the default thumbnail html. Uses filter "post_thumbnail_html"
|
119 |
+
*
|
120 |
+
* @return string html of the image
|
121 |
+
*/
|
122 |
+
public function demo_post_thumbnail_html( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
|
123 |
+
$size = apply_filters( 'post_thumbnail_size', $size, -1 );
|
124 |
+
$html = wp_get_attachment_image( -1, $size, false, $attr );
|
125 |
+
return $html;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Generates the post pages for the demo preview. Uses filter "posts_request"
|
130 |
+
*
|
131 |
+
* @return array
|
132 |
+
*/
|
133 |
+
public function demo_request_filter() {
|
134 |
+
global $wpdb;
|
135 |
+
|
136 |
+
$order = $this->demo_order;
|
137 |
+
$order = explode(' ', $order);
|
138 |
+
$order_direction = ( isset( $order[1] ) && 'ASC' === trim( $order[1]) ) ? 'ASC' : 'DESC';
|
139 |
+
$order_column = isset( $order[0] ) ? $order[0] : 'score';
|
140 |
+
|
141 |
+
if ( ! in_array($order_column, array('score', 'post_date', 'post_title')) ) {
|
142 |
+
$order_column = 'score';
|
143 |
+
}
|
144 |
+
|
145 |
+
$wpdb->query( 'set @count = 0;' );
|
146 |
+
|
147 |
+
$post_title = __( 'Example post ', 'yarpp' );
|
148 |
+
$loremipsum =
|
149 |
+
'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras tincidunt justo a urna. Ut turpis. Phasellus' .
|
150 |
+
'convallis, odio sit amet cursus convallis, eros orci scelerisque velit, ut sodales neque nisl at ante. ' .
|
151 |
+
'Suspendisse metus. Curabitur auctor pede quis mi. Pellentesque lorem justo, condimentum ac, dapibus sit ' .
|
152 |
+
'amet, ornare et, erat. Quisque velit. Etiam sodales dui feugiat neque suscipit bibendum. Integer mattis. ' .
|
153 |
+
'Nullam et ante non sem commodo malesuada. Pellentesque ultrices fermentum lectus. Maecenas hendrerit neque ac ' .
|
154 |
+
'est. Fusce tortor mi, tristique sed, cursus at, pellentesque non, dui. Suspendisse potenti.';
|
155 |
+
|
156 |
+
return $wpdb->prepare(
|
157 |
+
"SELECT
|
158 |
+
SQL_CALC_FOUND_ROWS ID + %d as ID,
|
159 |
+
post_author,
|
160 |
+
CURRENT_TIMESTAMP - INTERVAL FLOOR(RAND() * 30) DAY AS post_date,
|
161 |
+
post_date_gmt,
|
162 |
+
'{$loremipsum}' as post_content,
|
163 |
+
concat(%s, @count:=@count+1) as post_title,
|
164 |
+
0 as post_category,
|
165 |
+
'' as post_excerpt,
|
166 |
+
'publish' as post_status,
|
167 |
+
'open' as comment_status,
|
168 |
+
'open' as ping_status,
|
169 |
+
'' as post_password,
|
170 |
+
concat('example-post-',@count) as post_name,
|
171 |
+
'' as to_ping,
|
172 |
+
'' as pinged,
|
173 |
+
post_modified,
|
174 |
+
post_modified_gmt,
|
175 |
+
'' as post_content_filtered,
|
176 |
+
0 as post_parent,
|
177 |
+
concat('PERMALINK',@count) as guid,
|
178 |
+
0 as menu_order,
|
179 |
+
'post' as post_type,
|
180 |
+
'' as post_mime_type,
|
181 |
+
0 as comment_count,
|
182 |
+
ROUND(RAND() * 5, 2) as score
|
183 |
+
FROM $wpdb->posts
|
184 |
+
ORDER BY {$order_column} {$order_direction} LIMIT 0, %d",
|
185 |
+
$this->demo_limit,
|
186 |
+
$post_title,
|
187 |
+
$this->demo_limit
|
188 |
+
);
|
189 |
+
}
|
190 |
+
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Starts Demo preview generation of thumbnails and posts
|
194 |
+
*
|
195 |
+
* @param integer $limit
|
196 |
+
* @param string $order
|
197 |
+
* @param string $thumbnail
|
198 |
+
* @param string $size
|
199 |
+
* @return void
|
200 |
+
*/
|
201 |
+
public function begin_demo_time( $limit, $order = 'score DESC', $size = '' ) {
|
202 |
+
$this->demo_time = true;
|
203 |
+
$this->demo_limit = $limit;
|
204 |
+
$this->demo_order = $order;
|
205 |
+
$this->demo_thumbnail_size = $size;
|
206 |
+
|
207 |
+
add_action( 'pre_get_posts', array( &$this, 'add_signature' ) );
|
208 |
+
add_filter( 'posts_request', array( &$this, 'demo_request_filter' ) );
|
209 |
+
add_filter( 'has_post_thumbnail', array( &$this, 'demo_has_thumbnails_filter' ) );
|
210 |
+
add_filter( 'post_thumbnail_id', array( &$this, 'demo_post_thumbnail_id' ) );
|
211 |
+
add_filter( 'image_downsize', array( &$this, 'demo_image_downsize_filter' ) );
|
212 |
+
add_filter( 'post_thumbnail_size', array( &$this, 'demo_thumbnails_size_filter' ) );
|
213 |
+
add_filter( 'wp_get_attachment_image_src', array(&$this, 'demo_thumbnails_src_filter') );
|
214 |
+
add_filter( 'post_thumbnail_html', array(&$this, 'demo_post_thumbnail_html'), 10 , 5 );
|
215 |
+
add_filter( 'wp_get_attachment_metadata', array( &$this, 'demo_image_metadata_filter' ) );
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* End Demo preview generation of thumbnails and posts
|
220 |
+
*
|
221 |
+
* @return void
|
222 |
+
*/
|
223 |
+
public function end_demo_time() {
|
224 |
+
$this->demo_time = false;
|
225 |
+
|
226 |
+
remove_action( 'pre_get_posts', array( &$this, 'add_signature' ) );
|
227 |
+
remove_filter( 'posts_request', array( &$this, 'demo_request_filter' ) );
|
228 |
+
remove_filter( 'has_post_thumbnail', array( &$this, 'demo_has_thumbnails_filter' ) );
|
229 |
+
remove_filter( 'post_thumbnail_id', array( &$this, 'demo_post_thumbnail_id' ) );
|
230 |
+
remove_filter( 'image_downsize', array( &$this, 'demo_image_downsize_filter' ) );
|
231 |
+
remove_filter( 'post_thumbnail_size', array( &$this, 'demo_thumbnails_size_filter' ) );
|
232 |
+
remove_filter( 'wp_get_attachment_image_src', array(&$this, 'demo_thumbnails_src_filter') );
|
233 |
+
remove_filter( 'post_thumbnail_html', array(&$this, 'demo_post_thumbnail_html') );
|
234 |
+
remove_filter( 'wp_get_attachment_metadata', array( &$this, 'demo_image_metadata_filter' ) );
|
235 |
+
}
|
236 |
+
|
237 |
+
public function related( $reference_ID = null, $related_ID = null ) {
|
238 |
+
global $wpdb;
|
239 |
+
|
240 |
+
$results = $this->query_safely(
|
241 |
+
'get_results',
|
242 |
+
array(
|
243 |
+
$this->sql( $reference_ID ),
|
244 |
+
ARRAY_A,
|
245 |
+
)
|
246 |
+
);
|
247 |
+
if ( ! $results || ! count( $results ) || $results instanceof WP_Error ) {
|
248 |
+
return false;
|
249 |
+
}
|
250 |
+
|
251 |
+
$results_ids = wp_list_pluck( $results, 'ID' );
|
252 |
+
if ( is_null( $related_ID ) ) {
|
253 |
+
return $results_ids;
|
254 |
+
} else {
|
255 |
+
return in_array( $related_ID, $results_ids );
|
256 |
+
}
|
257 |
+
}
|
258 |
+
}
|
classes/YARPP_Core.php
CHANGED
@@ -19,6 +19,10 @@ class YARPP {
|
|
19 |
* @var YARPP_Cache_Bypass
|
20 |
*/
|
21 |
public $cache_bypass;
|
|
|
|
|
|
|
|
|
22 |
/**
|
23 |
* @var YARPP_Cache
|
24 |
*/
|
@@ -56,11 +60,12 @@ class YARPP {
|
|
56 |
load_plugin_textdomain( 'yarpp', false, plugin_basename( YARPP_DIR ) . '/lang' );
|
57 |
|
58 |
/* Load cache object. */
|
59 |
-
$this->storage_class
|
60 |
-
$this->cache
|
61 |
-
$this->cache_bypass
|
62 |
-
$this->
|
63 |
-
$this->
|
|
|
64 |
|
65 |
register_activation_hook( __FILE__, array( $this, 'activate' ) );
|
66 |
|
@@ -104,7 +109,13 @@ class YARPP {
|
|
104 |
* If theme has already yarpp-thumbnail size registered and we also try to register yarpp-thumbnail then it will throw a fatal error. So it is necessary to check if yarpp-thumbnail size is not registered.
|
105 |
*/
|
106 |
global $add_image_size_by_yarpp;
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
$width = 120;
|
109 |
$height = 120;
|
110 |
$crop = true;
|
@@ -222,7 +233,6 @@ class YARPP {
|
|
222 |
'thumbnails_default' => plugins_url( 'images/default.png', dirname( __FILE__ ) ),
|
223 |
'rss_thumbnails_heading' => __( 'Related posts:', 'yarpp' ),
|
224 |
'rss_thumbnails_default' => plugins_url( 'images/default.png', dirname( __FILE__ ) ),
|
225 |
-
'display_code' => false,
|
226 |
'auto_display_archive' => false,
|
227 |
'auto_display_post_types' => array( 'post' ),
|
228 |
'pools' => array(),
|
@@ -1208,7 +1218,6 @@ class YARPP {
|
|
1208 |
'thumbnails_default',
|
1209 |
'rss_thumbnails_heading',
|
1210 |
'rss_thumbnails_default',
|
1211 |
-
'display_code',
|
1212 |
);
|
1213 |
|
1214 |
$data = array(
|
@@ -1474,6 +1483,7 @@ class YARPP {
|
|
1474 |
|
1475 |
// Add CSS class to identify domain.
|
1476 |
if ( isset( $domain ) && $domain ) {
|
|
|
1477 |
$output .= " yarpp-related-{$domain}";
|
1478 |
}
|
1479 |
|
@@ -1695,7 +1705,7 @@ class YARPP {
|
|
1695 |
public function display_demo_related( $args = array(), $echo = true ) {
|
1696 |
// If YARPP cache is already finding the current post's content, don't ask it to do it again.
|
1697 |
// Avoid infinite recursion here.
|
1698 |
-
if ( $this->
|
1699 |
return false;
|
1700 |
}
|
1701 |
|
@@ -1705,18 +1715,11 @@ class YARPP {
|
|
1705 |
'template',
|
1706 |
'order',
|
1707 |
'promote_yarpp',
|
|
|
|
|
1708 |
);
|
1709 |
extract( $this->parse_args( $args, $options ) );
|
1710 |
-
|
1711 |
-
$this->cache_bypass->begin_demo_time( $limit );
|
1712 |
-
|
1713 |
-
$output = "<div class='";
|
1714 |
-
if ( $domain === 'website' ) {
|
1715 |
-
$output .= 'yarpp-related';
|
1716 |
-
} else {
|
1717 |
-
$output .= "yarpp-related yarpp-related-{$domain}";
|
1718 |
-
}
|
1719 |
-
$output .= "'>\n";
|
1720 |
|
1721 |
global $wp_query;
|
1722 |
$wp_query = new WP_Query();
|
@@ -1725,6 +1728,41 @@ class YARPP {
|
|
1725 |
|
1726 |
$this->prep_query( $domain === 'rss' );
|
1727 |
$related_query = $wp_query; // backwards compatibility
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1728 |
|
1729 |
if ( (bool) $template && $template === 'thumbnails' ) {
|
1730 |
include YARPP_DIR . '/includes/template_thumbnails.php';
|
@@ -1738,7 +1776,7 @@ class YARPP {
|
|
1738 |
}
|
1739 |
$output = trim( $output ) . "\n";
|
1740 |
|
1741 |
-
$this->
|
1742 |
|
1743 |
if ( $promote_yarpp ) {
|
1744 |
$output .=
|
@@ -1896,9 +1934,9 @@ class YARPP {
|
|
1896 |
* "yarpp_meta" postmeta's key "yarpp_display_for_this_post", and whether the post's content contains
|
1897 |
* the magic comment "<!--noyarpp-->"`. If either one of those is true `$noyarpp` will be true, otherwise false.
|
1898 |
*/
|
1899 |
-
$noyarpp = $this->yarpp_disabled_for_this_post();
|
1900 |
if ( strpos( $content, '<!--noyarpp-->' ) !== false ) {
|
1901 |
-
$noyarpp = true; // content includes <!--noyarpp--> ?
|
1902 |
}
|
1903 |
/**
|
1904 |
* Filters whether or not to disable adding YARPP's related posts on the current post.
|
@@ -1909,7 +1947,7 @@ class YARPP {
|
|
1909 |
* @param string $content post's content
|
1910 |
* @since 5.24.0
|
1911 |
*/
|
1912 |
-
$noyarpp = apply_filters( 'noyarpp', $noyarpp, $content );
|
1913 |
|
1914 |
return $noyarpp;
|
1915 |
}
|
19 |
* @var YARPP_Cache_Bypass
|
20 |
*/
|
21 |
public $cache_bypass;
|
22 |
+
/**
|
23 |
+
* @var YARPP_Cache_Demo_Bypass
|
24 |
+
*/
|
25 |
+
public $demo_cache_bypass;
|
26 |
/**
|
27 |
* @var YARPP_Cache
|
28 |
*/
|
60 |
load_plugin_textdomain( 'yarpp', false, plugin_basename( YARPP_DIR ) . '/lang' );
|
61 |
|
62 |
/* Load cache object. */
|
63 |
+
$this->storage_class = 'YARPP_Cache_' . ucfirst( YARPP_CACHE_TYPE );
|
64 |
+
$this->cache = new $this->storage_class( $this );
|
65 |
+
$this->cache_bypass = new YARPP_Cache_Bypass( $this );
|
66 |
+
$this->demo_cache_bypass = new YARPP_Cache_Demo_Bypass( $this );
|
67 |
+
$this->db_schema = new YARPP_DB_Schema();
|
68 |
+
$this->db_options = new YARPP_DB_Options();
|
69 |
|
70 |
register_activation_hook( __FILE__, array( $this, 'activate' ) );
|
71 |
|
109 |
* If theme has already yarpp-thumbnail size registered and we also try to register yarpp-thumbnail then it will throw a fatal error. So it is necessary to check if yarpp-thumbnail size is not registered.
|
110 |
*/
|
111 |
global $add_image_size_by_yarpp;
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Filters whether or not to register YARPP's image size "yarpp-thumbnail". Defaults to registering it
|
115 |
+
* if it wasn't already by the theme or some other plugin. But if you don't want yarpp-thumbnail sizes being
|
116 |
+
* generated at all, have it always return false.
|
117 |
+
*/
|
118 |
+
if ( apply_filters('yarpp_add_image_size', false === yarpp_get_image_sizes( 'yarpp-thumbnail' ) ) ) {
|
119 |
$width = 120;
|
120 |
$height = 120;
|
121 |
$crop = true;
|
233 |
'thumbnails_default' => plugins_url( 'images/default.png', dirname( __FILE__ ) ),
|
234 |
'rss_thumbnails_heading' => __( 'Related posts:', 'yarpp' ),
|
235 |
'rss_thumbnails_default' => plugins_url( 'images/default.png', dirname( __FILE__ ) ),
|
|
|
236 |
'auto_display_archive' => false,
|
237 |
'auto_display_post_types' => array( 'post' ),
|
238 |
'pools' => array(),
|
1218 |
'thumbnails_default',
|
1219 |
'rss_thumbnails_heading',
|
1220 |
'rss_thumbnails_default',
|
|
|
1221 |
);
|
1222 |
|
1223 |
$data = array(
|
1483 |
|
1484 |
// Add CSS class to identify domain.
|
1485 |
if ( isset( $domain ) && $domain ) {
|
1486 |
+
$domain = esc_attr($domain);
|
1487 |
$output .= " yarpp-related-{$domain}";
|
1488 |
}
|
1489 |
|
1705 |
public function display_demo_related( $args = array(), $echo = true ) {
|
1706 |
// If YARPP cache is already finding the current post's content, don't ask it to do it again.
|
1707 |
// Avoid infinite recursion here.
|
1708 |
+
if ( $this->demo_cache_bypass->demo_time ) {
|
1709 |
return false;
|
1710 |
}
|
1711 |
|
1715 |
'template',
|
1716 |
'order',
|
1717 |
'promote_yarpp',
|
1718 |
+
'size',
|
1719 |
+
'thumbnails_default'
|
1720 |
);
|
1721 |
extract( $this->parse_args( $args, $options ) );
|
1722 |
+
$this->demo_cache_bypass->begin_demo_time( $limit, $order, $size );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1723 |
|
1724 |
global $wp_query;
|
1725 |
$wp_query = new WP_Query();
|
1728 |
|
1729 |
$this->prep_query( $domain === 'rss' );
|
1730 |
$related_query = $wp_query; // backwards compatibility
|
1731 |
+
$related_count = $related_query->post_count;
|
1732 |
+
|
1733 |
+
$output = '';
|
1734 |
+
// CSS class "yarpp-related" exists for backwards compatibility in-case older custom themes are dependent on it
|
1735 |
+
$output .= "<div class='yarpp yarpp-related";
|
1736 |
+
|
1737 |
+
// Add CSS class to identify domain
|
1738 |
+
if ( isset( $domain ) && $domain ) {
|
1739 |
+
$domain = esc_attr( $domain );
|
1740 |
+
$output .= " yarpp-related-{$domain}";
|
1741 |
+
}
|
1742 |
+
// Add CSS class to identify no results
|
1743 |
+
if ( $related_count < 1 ) {
|
1744 |
+
$output .= ' yarpp-related-none';
|
1745 |
+
}
|
1746 |
+
|
1747 |
+
// Add CSS class to identify template
|
1748 |
+
if ( isset( $template ) && $template ) {
|
1749 |
+
// Normalize "thumbnail" and "thumbnails" to reference the same inbuilt template
|
1750 |
+
if ( $template === 'thumbnail' ) {
|
1751 |
+
$template = 'thumbnails';
|
1752 |
+
}
|
1753 |
+
// Sanitize template name; remove file extension if exists
|
1754 |
+
if ( strpos( $template, '.php' ) ) {
|
1755 |
+
$template_css_class_suffix = preg_replace( '/' . preg_quote( '.php', '/' ) . '$/', '', $template );
|
1756 |
+
} else {
|
1757 |
+
$template_css_class_suffix = $template;
|
1758 |
+
}
|
1759 |
+
$output .= " yarpp-template-$template_css_class_suffix";
|
1760 |
+
} else {
|
1761 |
+
// fallback to default template ("list")
|
1762 |
+
$output .= ' yarpp-template-list';
|
1763 |
+
}
|
1764 |
+
|
1765 |
+
$output .= "'>\n";
|
1766 |
|
1767 |
if ( (bool) $template && $template === 'thumbnails' ) {
|
1768 |
include YARPP_DIR . '/includes/template_thumbnails.php';
|
1776 |
}
|
1777 |
$output = trim( $output ) . "\n";
|
1778 |
|
1779 |
+
$this->demo_cache_bypass->end_demo_time();
|
1780 |
|
1781 |
if ( $promote_yarpp ) {
|
1782 |
$output .=
|
1934 |
* "yarpp_meta" postmeta's key "yarpp_display_for_this_post", and whether the post's content contains
|
1935 |
* the magic comment "<!--noyarpp-->"`. If either one of those is true `$noyarpp` will be true, otherwise false.
|
1936 |
*/
|
1937 |
+
$noyarpp = $this->yarpp_disabled_for_this_post(); // post meta flag.
|
1938 |
if ( strpos( $content, '<!--noyarpp-->' ) !== false ) {
|
1939 |
+
$noyarpp = true; // does content includes <!--noyarpp--> ?
|
1940 |
}
|
1941 |
/**
|
1942 |
* Filters whether or not to disable adding YARPP's related posts on the current post.
|
1947 |
* @param string $content post's content
|
1948 |
* @since 5.24.0
|
1949 |
*/
|
1950 |
+
$noyarpp = apply_filters( 'noyarpp', $noyarpp, $content );
|
1951 |
|
1952 |
return $noyarpp;
|
1953 |
}
|
classes/YARPP_Meta_Box.php
CHANGED
@@ -90,7 +90,7 @@ class YARPP_Meta_Box {
|
|
90 |
public function displayorder( $option, $class = null ) {
|
91 |
echo "<div class='yarpp_form_row yarpp_form_select $class'><div class='yarpp_form_label'>";
|
92 |
_e( 'Order results:', 'yarpp' );
|
93 |
-
echo "</div><div><select name='$option' id='
|
94 |
$order = yarpp_get_option( $option );
|
95 |
?>
|
96 |
<option value="score DESC" <?php echo ( $order == 'score DESC' ? ' selected="selected"' : '' ); ?>><?php _e( 'score (high relevance to low)', 'yarpp' ); ?></option>
|
90 |
public function displayorder( $option, $class = null ) {
|
91 |
echo "<div class='yarpp_form_row yarpp_form_select $class'><div class='yarpp_form_label'>";
|
92 |
_e( 'Order results:', 'yarpp' );
|
93 |
+
echo "</div><div><select name='" . esc_attr( $option ) . "' id='" . esc_attr( $option ) . "'>";
|
94 |
$order = yarpp_get_option( $option );
|
95 |
?>
|
96 |
<option value="score DESC" <?php echo ( $order == 'score DESC' ? ' selected="selected"' : '' ); ?>><?php _e( 'score (high relevance to low)', 'yarpp' ); ?></option>
|
classes/YARPP_Meta_Box_Display_Feed.php
CHANGED
@@ -5,11 +5,6 @@ class YARPP_Meta_Box_Display_Feed extends YARPP_Meta_Box {
|
|
5 |
global $yarpp;
|
6 |
|
7 |
echo '<div>';
|
8 |
-
echo '<div class="rss_displayed yarpp_code_display"';
|
9 |
-
if ( ! $yarpp->get_option( 'code_display' ) ) {
|
10 |
-
echo ' style="display: none;"';
|
11 |
-
}
|
12 |
-
echo '><b>' . __( 'RSS display code example', 'yarpp' ) . '</b><br /><small>' . __( '(Update options to reload.)', 'yarpp' ) . "</small><br/><div id='display_demo_rss'></div></div>";
|
13 |
|
14 |
$this->checkbox( 'rss_display', __( 'Display related posts in feeds?', 'yarpp' ) . " <span class='yarpp_help dashicons dashicons-editor-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>", '' );
|
15 |
$this->checkbox( 'rss_excerpt_display', __( 'Display related posts in the descriptions?', 'yarpp' ) . " <span class='yarpp_help dashicons dashicons-editor-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' );
|
5 |
global $yarpp;
|
6 |
|
7 |
echo '<div>';
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
$this->checkbox( 'rss_display', __( 'Display related posts in feeds?', 'yarpp' ) . " <span class='yarpp_help dashicons dashicons-editor-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>", '' );
|
10 |
$this->checkbox( 'rss_excerpt_display', __( 'Display related posts in the descriptions?', 'yarpp' ) . " <span class='yarpp_help dashicons dashicons-editor-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' );
|
classes/YARPP_Meta_Box_Display_Web.php
CHANGED
@@ -16,12 +16,6 @@ class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
|
|
16 |
);
|
17 |
|
18 |
echo '<div>';
|
19 |
-
echo '<div class="yarpp_code_display"';
|
20 |
-
if ( ! $yarpp->get_option( 'code_display' ) ) {
|
21 |
-
echo ' style="display: none;"';
|
22 |
-
}
|
23 |
-
echo '><strong>' . __( 'Website display code example', 'yarpp' ) . '</strong><br /><small>' . __( '(Update options to reload.)', 'yarpp' ) . "</small><br/><div id='display_demo_web'></div></div>";
|
24 |
-
|
25 |
echo "<div class='yarpp_form_row yarpp_form_post_types'><div>";
|
26 |
echo __( 'Automatically display related content on: ', 'yarpp' );
|
27 |
echo " <span class='yarpp_help dashicons dashicons-editor-help' data-help='" . esc_attr( __( 'This option automatically displays YARPP right after the content on single entry pages. If this option is off, you will need to manually insert the <code>[yarpp]</code> shortcode, block or <code>yarpp_related()</code> PHP function into your theme files.', 'yarpp' ) ) . "'> </span> ";
|
@@ -125,5 +119,29 @@ class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
|
|
125 |
|
126 |
$this->displayorder( 'order' );
|
127 |
$this->checkbox( 'promote_yarpp', __( 'Link to YARPP?', 'yarpp' ) . " <span class='yarpp_help dashicons dashicons-editor-help' data-help='" . esc_attr( sprintf( __( 'This option will add the code %s These links are greatly appreciated and keeps us motivated.', 'yarpp' ), '<code>' . htmlspecialchars( sprintf( __( "Powered by <a href='%s' title='WordPress Related Posts Plugin' target='_blank'>YARPP</a>.", 'yarpp' ), 'https://yarpp.com' ) ) . '</code>' ) ) . "'> </span>", 'yarpp' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
}
|
16 |
);
|
17 |
|
18 |
echo '<div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
echo "<div class='yarpp_form_row yarpp_form_post_types'><div>";
|
20 |
echo __( 'Automatically display related content on: ', 'yarpp' );
|
21 |
echo " <span class='yarpp_help dashicons dashicons-editor-help' data-help='" . esc_attr( __( 'This option automatically displays YARPP right after the content on single entry pages. If this option is off, you will need to manually insert the <code>[yarpp]</code> shortcode, block or <code>yarpp_related()</code> PHP function into your theme files.', 'yarpp' ) ) . "'> </span> ";
|
119 |
|
120 |
$this->displayorder( 'order' );
|
121 |
$this->checkbox( 'promote_yarpp', __( 'Link to YARPP?', 'yarpp' ) . " <span class='yarpp_help dashicons dashicons-editor-help' data-help='" . esc_attr( sprintf( __( 'This option will add the code %s These links are greatly appreciated and keeps us motivated.', 'yarpp' ), '<code>' . htmlspecialchars( sprintf( __( "Powered by <a href='%s' title='WordPress Related Posts Plugin' target='_blank'>YARPP</a>.", 'yarpp' ), 'https://yarpp.com' ) ) . '</code>' ) ) . "'> </span>", 'yarpp' );
|
122 |
+
|
123 |
+
// Theme preview section
|
124 |
+
echo '<div class="yarpp-preview__wrapper">';
|
125 |
+
echo '<div class="yarpp_form_row yarpp-preview__title">';
|
126 |
+
echo '<h1>' . __( 'Preview', 'yarpp' ) . '</h1>';
|
127 |
+
echo '</div>';
|
128 |
+
echo '<div id="yarpp-display-html-preview">';
|
129 |
+
echo '<div class="yarpp-preview__media__controls">';
|
130 |
+
echo '<button type="button" id="yarpp-preview-mobile" class="button-secondary">' . __( 'Mobile', 'yarpp' ) . ' ' . __( '(320px)', 'yarpp' ) . '</button>';
|
131 |
+
echo '<button type="button" id="yarpp-preview-tablet" class="button-secondary">' . __( 'Tablet', 'yarpp' ) . ' ' . __( '(768px)', 'yarpp' ) . '</button>';
|
132 |
+
echo '<button type="button" id="yarpp-preview-desktop" class="button-secondary">' . __( 'Desktop', 'yarpp' ) . ' ' . __( '(1200px)', 'yarpp' ) . '</button>';
|
133 |
+
echo '</div>';
|
134 |
+
echo '<div class="yarpp-preview__iframe__container">';
|
135 |
+
echo '<div class="yarpp-preview__iframe__backdrop">';
|
136 |
+
echo '</div>';
|
137 |
+
echo '</div>';
|
138 |
+
echo '<div class="yarpp-preview__show-preview-width"><span id="yarpp-preview__show-preview-width__value"></span></div>';
|
139 |
+
echo '<div class="yarpp-preview__show-code">';
|
140 |
+
echo '<button type="button" id="yarpp-preview-show-code" class="button-secondary">' . __( 'Show Code', 'yarpp' ) . '</button>';
|
141 |
+
echo '</div>';
|
142 |
+
echo '</div>';
|
143 |
+
echo '<div id="yarpp-display-code-preview">';
|
144 |
+
echo '</div>';
|
145 |
+
echo '</div>';
|
146 |
}
|
147 |
}
|
images/preview_thumbnail_example.png
ADDED
Binary file
|
includes/yarpp_options.php
CHANGED
@@ -180,10 +180,9 @@ if ( isset( $_POST['update_yarpp'] ) && check_admin_referer( 'update_yarpp', 'up
|
|
180 |
|
181 |
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
182 |
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
183 |
-
wp_nonce_field( 'yarpp_display_demo', 'yarpp_display_demo-nonce', false );
|
184 |
wp_nonce_field( 'yarpp_display_exclude_terms', 'yarpp_display_exclude_terms-nonce', false );
|
185 |
wp_nonce_field( 'yarpp_optin_data', 'yarpp_optin_data-nonce', false );
|
186 |
-
wp_nonce_field( '
|
187 |
|
188 |
if ( ! count( $yarpp->admin->get_templates() ) && $yarpp->admin->can_copy_templates() ) {
|
189 |
wp_nonce_field( 'yarpp_copy_templates', 'yarpp_copy_templates-nonce', false );
|
180 |
|
181 |
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
182 |
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
|
|
183 |
wp_nonce_field( 'yarpp_display_exclude_terms', 'yarpp_display_exclude_terms-nonce', false );
|
184 |
wp_nonce_field( 'yarpp_optin_data', 'yarpp_optin_data-nonce', false );
|
185 |
+
wp_nonce_field( 'yarpp_display_preview', 'yarpp_display_preview-nonce', false );
|
186 |
|
187 |
if ( ! count( $yarpp->admin->get_templates() ) && $yarpp->admin->can_copy_templates() ) {
|
188 |
wp_nonce_field( 'yarpp_copy_templates', 'yarpp_copy_templates-nonce', false );
|
js/options_basic.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(i){function a(){var a,e=i(this).closest("#yarpp_display_web, #yarpp_display_rss");e.length&&(value=e.find(".use_template").val(),e.find(".yarpp_subbox").hide(),e.find(".template_options_"+value).show(),a=e.find(".yarpp_no_results"),"custom"===value?a.hide():a.show(),a=e.find(".generate_missing_thumbnails"),"builtin"===value?a.hide():a.show(),t.apply(e))}function t(){var a=i(this).closest("#yarpp_display_web, #yarpp_display_rss");a.find(".excerpted").toggle(!("builtin"!==a.find(".use_template").val()||!a.find(".show_excerpt input").prop("checked")))}postboxes.add_postbox_toggles(pagenow),i(".use_template").each(a).change(a),i(".show_excerpt, .use_template, #yarpp-rss_display").click(t);var s=!1;function e(){var e;i("#yarpp_display_web .inside").is(":visible")&&(i(".yarpp_code_display").toggle(i("#yarpp_display_code").is(":checked")),i("#yarpp_display_web .yarpp_code_display").is(":visible")&&!s&&(s=!0,e=i("#display_demo_web"),i.ajax({type:"POST",url:ajaxurl,data:{action:"yarpp_display_demo",domain:"website",_ajax_nonce:i("#yarpp_display_demo-nonce").val()},beforeSend:function(){e.html(loading)},success:function(a){e.html("<pre>"+a+"</pre>")},dataType:"html"})))}i("#yarpp_display_web .handlediv, #yarpp_display_web-hide").click(e),e();var p=!1;function n(){var e;i("#yarpp_display_rss .inside").is(":visible")&&(i("#yarpp-rss_display").is(":checked")?(i(".rss_displayed").show(),i(".yarpp_code_display").toggle(i("#yarpp_display_code").is(":checked")),i("#yarpp_display_rss .yarpp_code_display").is(":visible")&&!p&&(p=!0,e=i("#display_demo_rss"),i.ajax({type:"POST",url:ajaxurl,data:{action:"yarpp_display_demo",domain:"rss",_ajax_nonce:i("#yarpp_display_demo-nonce").val()},beforeSend:function(){e.html(loading)},success:function(a){e.html("<pre>"+a+"</pre>")},dataType:"html"})),i("#yarpp_display_rss").each(a)):i(".rss_displayed").hide())}function o(){i("#yarpp_display_api .inside").is(":visible")&&(i("#yarpp-rest_api_display").is(":checked")?i(".yarpp_rest_displayed").show():i(".yarpp_rest_displayed").hide())}function r(){i("#yarpp-rest_api_client_side_caching").is(":checked")?i(".yarpp_rest_browser_cache_displayed").show():i(".yarpp_rest_browser_cache_displayed").hide()}i("#yarpp-rss_display, #yarpp_display_rss .handlediv, #yarpp_display_rss-hide").click(n),n(),i("#yarpp-rest_api_display").click(o),o(),i("#yarpp-rest_api_client_side_caching").click(r),r();var c=!1;function l(){var s,a;function p(e){var t;e in s||((t=i("#exclude_"+e)).find(".loading").length||(e in a?a[e]=a[e]+100:a[e]=0,i.ajax({type:"POST",url:ajaxurl,data:{action:"yarpp_display_exclude_terms",taxonomy:e,offset:a[e],_ajax_nonce:i("#yarpp_display_exclude_terms-nonce").val()},beforeSend:function(){t.append(loading)},success:function(a){if(t.find(".loading").remove(),":("==a)return s[e]=!0,void t.append("-");t.append(a)},dataType:"html"})))}!c&&i("#yarpp_pool .inside").is(":visible")&&(c=!0,s={},a={},i(".exclude_terms").each(function(){var t,a=jQuery(this).attr("id");a&&(p(t=a.replace("exclude_","")),i("#exclude_"+t).parent(".yarpp_scroll_wrapper").scroll(function(){var a=i(this),e=a.children("div");a.scrollTop()+a.height()>e.height()-10&&p(t)}))}))}function d(a){i("#tab-link-"+a+" a").click(),i("#contextual-help-link").click()}function _(){var a=i(this).find("option:selected"),e=a.closest(".yarpp_form_row");a.attr("data-url")?e.find(".template_author_wrap").toggle(!!a.attr("data-author")).find("span").empty().append("<a>"+a.attr("data-author")+"</a>").attr("href",a.attr("data-url")):e.find(".template_author_wrap").toggle(!!a.attr("data-author")).find("span").text(a.attr("data-author")),e.find(".template_description_wrap").toggle(!!a.attr("data-description")).find("span").text(a.attr("data-description")),e.find(".template_file_wrap").toggle(!!a.attr("data-basename")).find("span").text(a.attr("data-basename"))}i("#yarpp_pool .handlediv, #yarpp_pool-hide").click(l),l(),i("#yarpp-optin-learnmore").click(function(){d("optin")}),i("#yarpp-help-cpt").click(function(){d("dev")}),"#help-optin"==location.hash&&setTimeout(function(){d("optin")}),i(".yarpp_help[data-help]").hover(function(){var a=i(this),e={content:"<p>"+a.attr("data-help")+"</p>",position:{edge:isRtl?"right":"left",align:"center",of:a},document:{body:a}},t=a.pointer(e).pointer("open");a.closest(".yarpp_form_row, p").mouseleave(function(){t.pointer("close")})}),i(".yarpp_template_button[data-help]").hover(function(){var a=i(this),e="<p>"+a.attr("data-help")+"</p>",t=a.pointer({content:e,position:{edge:"bottom",of:a},document:{body:a}}).pointer("open");a.mouseleave(function(){t.pointer("close")}),i(".yarpp_copy_templates_button").on("click",function(){const a=i(this),e=a.siblings(".spinner");a.addClass("yarpp-disabled"),e.addClass("is-active"),window.location=window.location+(window.location.search.length?"&":"?")+"action=copy_templates&_ajax_nonce="+i("#yarpp_copy_templates-nonce").val()})}),i(".yarpp_spin_on_click").on("click",function(){const a=i(this),e=a.siblings(".spinner");a.addClass("yarpp-disabled"),e.addClass("is-active")}),i(".yarpp_template_button:not(.disabled)").click(function(){i(this).siblings("input").val(i(this).attr("data-value")).change(),i(this).siblings().removeClass("active"),i(this).addClass("active")}),i("#template_file, #rss_template_file").each(_).change(_);var y=!1;function h(){var e;i("#optin_data_frame").is(":visible")&&!y&&(y=!0,e=i("#optin_data_frame"),i.ajax({type:"POST",url:ajaxurl,data:{action:"yarpp_optin_data",_ajax_nonce:i("#yarpp_optin_data-nonce").val()},beforeSend:function(){e.html(loading)},success:function(a){e.html("<pre>"+a+"</pre>")},dataType:"html"}))}function u(){setTimeout(h,0)}function f(){var a=i(".yarpp_form_post_types").is(":has(input[type=checkbox]:checked)");i("#yarpp-auto_display_archive").attr("disabled",!a),a||i("#yarpp-auto_display_archive").prop("checked",!1)}function m(a,e){a?(i(".yarpp_form_post_types #yarpp_post_type_"+e).prop("disabled",!1),i(".yarpp_form_post_types #yarpp_post_type_"+e).siblings().hide()):(i(".yarpp_form_post_types #yarpp_post_type_"+e).prop("disabled",!0),i(".yarpp_form_post_types #yarpp_post_type_"+e).siblings().show())}i("#yarpp-optin-learnmore, a[aria-controls=tab-panel-optin]").bind("click focus",u),u(),i(".sync_no_results, .sync_rss_no_results").change(function(){var a=i(this).find("input").attr("value");i(this).hasClass("sync_no_results")&&i(".sync_no_results input").attr("value",a),i(this).hasClass("sync_rss_no_results")&&i(".sync_rss_no_results input").attr("value",a)}),i("#yarpp_display_code").click(function(){var a={action:"yarpp_set_display_code",_ajax_nonce:i("#yarpp_set_display_code-nonce").val()};i(this).is(":checked")&&(a.checked=!0),i.ajax({type:"POST",url:ajaxurl,data:a}),e(),n()}),i(".yarpp_form_post_types input[type=checkbox]").change(f),f(),i("#yarpp_fulltext_expand").click(function(a){a.preventDefault();a=i("#yarpp_fulltext_details");a.slideToggle(),a.hasClass("hidden")?(a.removeClass("hidden"),i(this).text("Hide Details [-]")):(a.addClass("hidden"),i(this).text("Show Details [+]"))}),i(".include_post_type input[type=checkbox]").change(function(a){var e=i(this).attr("data-post-type");i("#yarpp-same_post_type").is(":checked")?m(i(this).is(":checked"),e):i(".yarpp_form_post_types #yarpp_post_type_"+e).prop("disabled",!1)}),i("#yarpp-same_post_type").change(function(a){i(this).is(":checked")?i(".include_post_type input[type=checkbox]").each(function(){var a=i(this).attr("data-post-type");m(i(this).is(":checked"),a)}):(i(".yarpp_form_post_types input[type=checkbox]").prop("disabled",!1),i(".yarpp_form_post_types input[type=checkbox]").siblings().hide())});var v=i('\t\t\t<div id="shareaholic-deactivate-dialog" class="shareaholic-deactivate-dialog" data-remodal-id="">\t\t\t\t<div class="shareaholic-deactivate-header" style="background-image: url('+yarpp_messages.logo+"); background-color: "+yarpp_messages.bgcolor+';"><div class="shareaholic-deactivate-text"><h2>'+yarpp_messages.model_title+'</h2></div></div>\t\t\t\t<div class="shareaholic-deactivate-body">\t\t\t\t\t<div class="shareaholic-deactivate-body-foreword">'+yarpp_messages.alert_message+'</div>\t\t\t\t\t<div class="shareaholic-deactivate-dialog-footer"> <input type="submit" class="button confirm button-secondary" id="yarpp-clear-cache-submit" value="Delete"/>\t\t\t\t\t\t<button data-remodal-action="cancel" class="button button-secondary">Cancel</button>\t\t\t\t\t\t</div>\t\t\t\t</div>\t\t\t</div>\t\t')[0];i("#yarpp-clear-cache").click(function(){i(v).remodal({hashTracking:!1,closeOnOutsideClick:!1}).open(),event.preventDefault()}),i(document.body).on("click","#yarpp-clear-cache-submit",function(){i(v).remodal().close();var t="#yarpp-clear-cache",s="#display_notices",p="notice notice-error is-dismissible";i(t).prop("disabled",!0),i.ajax({type:"POST",url:ajaxurl,data:{action:"yarpp_clear_cache",_ajax_nonce:i("#clear_cache-nonce").val()},beforeSend:function(){i(t).siblings(".spinner").addClass("is-active")},success:function(a){var e;i(t).siblings(".spinner").removeClass("is-active"),i(s).show(),"success"==a?(e=yarpp_messages.success,p="notice notice-success is-dismissible",i(t).prop("disabled",!1)):e="forbidden"==a?yarpp_messages.forbidden:"nonce_fail"==a?yarpp_messages.nonce_fail:yarpp_messages.error,i(s).addClass(p),i(s).html("<p>"+e+"</p>")},error:function(a){i(s).show(),i(s).addClass(p),i(t).siblings(".spinner").removeClass("is-active"),i(s).html("<p>"+yarpp_messages.error+"</p>")}}),i(s).delay(5e3).fadeOut(1e3)})});
|
1 |
+
jQuery(function(p){function e(){var e,t=p(this).closest("#yarpp_display_web, #yarpp_display_rss");t.length&&(value=t.find(".use_template").val(),t.find(".yarpp_subbox").hide(),t.find(".template_options_"+value).show(),e=t.find(".yarpp_no_results"),"custom"===value?e.hide():e.show(),e=t.find(".generate_missing_thumbnails"),"builtin"===value?e.hide():e.show(),a.apply(t))}function a(){var e=p(this).closest("#yarpp_display_web, #yarpp_display_rss");e.find(".excerpted").toggle(!("builtin"!==e.find(".use_template").val()||!e.find(".show_excerpt input").prop("checked")))}function t(){p("#yarpp_display_rss .inside").is(":visible")&&(p("#yarpp-rss_display").is(":checked")?(p(".rss_displayed").show(),p("#yarpp_display_rss").each(e)):p(".rss_displayed").hide())}function i(){p("#yarpp_display_api .inside").is(":visible")&&(p("#yarpp-rest_api_display").is(":checked")?p(".yarpp_rest_displayed").show():p(".yarpp_rest_displayed").hide())}function n(){p("#yarpp-rest_api_client_side_caching").is(":checked")?p(".yarpp_rest_browser_cache_displayed").show():p(".yarpp_rest_browser_cache_displayed").hide()}postboxes.add_postbox_toggles(pagenow),p(".use_template").each(e).change(e),p(".show_excerpt, .use_template, #yarpp-rss_display").click(a),p("#yarpp-rss_display, #yarpp_display_rss .handlediv, #yarpp_display_rss-hide").click(t),t(),p("#yarpp-rest_api_display").click(i),i(),p("#yarpp-rest_api_client_side_caching").click(n),n();var s=!1;function r(){var i,e;function n(t){var a;t in i||((a=p("#exclude_"+t)).find(".loading").length||(t in e?e[t]=e[t]+100:e[t]=0,p.ajax({type:"POST",url:ajaxurl,data:{action:"yarpp_display_exclude_terms",taxonomy:t,offset:e[t],_ajax_nonce:p("#yarpp_display_exclude_terms-nonce").val()},beforeSend:function(){a.append(loading)},success:function(e){if(a.find(".loading").remove(),":("==e)return i[t]=!0,void a.append("-");a.append(e)},dataType:"html"})))}!s&&p("#yarpp_pool .inside").is(":visible")&&(s=!0,i={},e={},p(".exclude_terms").each(function(){var a,e=jQuery(this).attr("id");e&&(n(a=e.replace("exclude_","")),p("#exclude_"+a).parent(".yarpp_scroll_wrapper").scroll(function(){var e=p(this),t=e.children("div");e.scrollTop()+e.height()>t.height()-10&&n(a)}))}))}function o(e){p("#tab-link-"+e+" a").click(),p("#contextual-help-link").click()}p("#yarpp_pool .handlediv, #yarpp_pool-hide").click(r),r(),p("#yarpp-optin-learnmore").click(function(){o("optin")}),p("#yarpp-help-cpt").click(function(){o("dev")}),"#help-optin"==location.hash&&setTimeout(function(){o("optin")}),p(".yarpp_help[data-help]").hover(function(){var e=p(this),t={content:"<p>"+e.attr("data-help")+"</p>",position:{edge:isRtl?"right":"left",align:"center",of:e},document:{body:e}},a=e.pointer(t).pointer("open");e.closest(".yarpp_form_row, p").mouseleave(function(){a.pointer("close")})}),p(".yarpp_template_button[data-help]").hover(function(){var e=p(this),t="<p>"+e.attr("data-help")+"</p>",a=e.pointer({content:t,position:{edge:"bottom",of:e},document:{body:e}}).pointer("open");e.mouseleave(function(){a.pointer("close")}),p(".yarpp_copy_templates_button").on("click",function(){const e=p(this),t=e.siblings(".spinner");e.addClass("yarpp-disabled"),t.addClass("is-active"),window.location=window.location+(window.location.search.length?"&":"?")+"action=copy_templates&_ajax_nonce="+p("#yarpp_copy_templates-nonce").val()})}),p(".yarpp_spin_on_click").on("click",function(){const e=p(this),t=e.siblings(".spinner");e.addClass("yarpp-disabled"),t.addClass("is-active")});const c=document.getElementById("yarpp-preview-show-code"),d=document.getElementById("yarpp-display-code-preview");function l(e=!1){"none"===d.style.display||e?(d.style.display="block",c.innerText=yarpp_messages.hide_code):(d.style.display="none",c.innerText=yarpp_messages.show_code)}c&&c.addEventListener("click",()=>l());const _=document.querySelector("#yarpp-display-html-preview .yarpp-preview__iframe__container");if(_){let a;function u(e){var t=e.x-a;a=e.x,_.style.width=parseInt(getComputedStyle(_,"").width)+t+"px",D()}_.addEventListener("mousedown",function(e){e.layerX-e.offsetX<50&&(a=e.x,document.addEventListener("mousemove",u,!1))}),document.addEventListener("mouseup",function(){document.removeEventListener("mousemove",u,!1)})}let y={};function h(e,t,a="value"){t=t.target[a];y[e]="checked"===a?t?1:0:t,P()}const m=document.querySelector("#limit[name=limit]");m&&m.addEventListener("blur",e=>h("limit",e));const f=document.querySelector("#yarpp-promote_yarpp[name=promote_yarpp]");f&&f.addEventListener("change",e=>h("promote_yarpp",e,"checked"));const v=document.querySelector("#order[name=order]");v&&v.addEventListener("change",e=>h("order",e));const b=document.querySelector("#template_file[name=template_file]");b&&b.addEventListener("change",e=>h("template",e));const g=document.querySelectorAll("input[name=thumbnail_size_display]");0<g.length&&g.forEach(e=>{e.addEventListener("change",e=>h("size",e))});const w=document.querySelectorAll("input[name=custom_theme_thumbnail_size_display]");0<w.length&&w.forEach(e=>{e.addEventListener("change",e=>h("size",e))});const x=document.querySelector("#thumbnails_heading[name=thumbnails_heading]");x&&x.addEventListener("blur",e=>h("thumbnails_heading",e));const k=document.querySelector("#thumbnails_default[name=thumbnails_default]");k&&k.addEventListener("blur",e=>h("thumbnails_default",e));const E=document.querySelector("#before_related[name=before_related]");E&&E.addEventListener("blur",e=>h("before_related",e));const S=document.querySelector("#after_related[name=after_related]");S&&S.addEventListener("blur",e=>h("after_related",e));const L=document.querySelector("#before_title[name=before_title]");L&&L.addEventListener("blur",e=>h("before_title",e));const q=document.querySelector("#after_title[name=after_title]");q&&q.addEventListener("blur",e=>h("after_title",e));const C=document.querySelector("#yarpp-show_excerpt[name=show_excerpt]");C&&C.addEventListener("change",e=>h("show_excerpt",e,"checked"));const T=document.querySelector("#excerpt_length[name=excerpt_length]");T&&T.addEventListener("blur",e=>h("excerpt_length",e));const j=document.querySelector("#before_post[name=before_post]");j&&j.addEventListener("blur",e=>h("before_post",e));const z=document.querySelector("#after_post[name=after_post]");function O(e){_.style.width=e+"px",D()}function D(){var e=document.querySelector(".yarpp-preview__iframe__backdrop");e&&(document.querySelector("#yarpp-preview__show-preview-width__value").innerText=e.offsetWidth-20+"px")}z&&z.addEventListener("blur",e=>h("after_post",e)),window.addEventListener("resize",D);const A=document.querySelector("#yarpp-preview-mobile");A&&A.addEventListener("click",e=>O(320));const B=document.querySelector("#yarpp-preview-tablet");B&&B.addEventListener("click",e=>O(768));const I=document.querySelector("#yarpp-preview-desktop");function P(e=null){c.setAttribute("disabled","disabled");var n=p("#yarpp-display-html-preview .yarpp-preview__iframe__container"),s=p("#yarpp-display-code-preview");const r=document.querySelector("#yarpp-display-html-preview div.yarpp-preview__iframe__backdrop");if(D(),e){if("custom"===e){y.template=b.value;let t=null;w.forEach(e=>{e.checked&&(t=e.value)}),t&&(y.size=t)}else y.template=e;"thumbnails"===e&&(g.forEach(e=>{e.checked&&(checked_value=e.value)}),checked_value&&(y.size=checked_value))}p.ajax({type:"POST",url:ajaxurl,data:{action:"yarpp_display_preview",_ajax_nonce:p("#yarpp_display_preview-nonce").val(),...y},beforeSend:function(){n.html(loading)},success:function(e){const a=JSON.parse(e),i=document.createElement("style");i.appendChild(document.createTextNode(a.styles));const t=document.createElement("iframe");t.width="100%",t.height="100%",t.style="overflow: hidden; user-select: none; outline: 0; background-color: white;",n.html(t),n.prepend(r),t.onload=e=>{const t=e.target.contentWindow.document;t.getElementsByTagName("head")[0].appendChild(i),t.body.innerHTML=a.html,t.body.style="overflow:hidden;"},"codeEditor"in wp?(l(!0),e={...wp.codeEditor.defaultSettings,type:"text/html",codemirror:{...wp.codeEditor.defaultSettings.codemirror,indentUnit:2,tabSize:2,readOnly:!0}},s.html('<textarea id="yarpp-preview-code-textarea">'+a.code+"</textarea>"),wp.codeEditor.initialize(document.getElementById("yarpp-preview-code-textarea"),e),l()):s.html("<pre><code>"+a.code+"</code></pre>"),c.removeAttribute("disabled")},dataType:"html"})}function N(){var e=p(this).find("option:selected"),t=e.closest(".yarpp_form_row");e.attr("data-url")?t.find(".template_author_wrap").toggle(!!e.attr("data-author")).find("span").empty().append("<a>"+e.attr("data-author")+"</a>").attr("href",e.attr("data-url")):t.find(".template_author_wrap").toggle(!!e.attr("data-author")).find("span").text(e.attr("data-author")),t.find(".template_description_wrap").toggle(!!e.attr("data-description")).find("span").text(e.attr("data-description")),t.find(".template_file_wrap").toggle(!!e.attr("data-basename")).find("span").text(e.attr("data-basename"))}I&&I.addEventListener("click",e=>O(1200)),P(),p(".yarpp_template_button:not(.disabled)").click(function(){var e=p(this).attr("data-value");p(this).siblings("input").val(e).change(),p(this).siblings().removeClass("active"),p(this).addClass("active"),p(this).parents("#yarpp_display_web").length&&P(e)}),p("#template_file, #rss_template_file").each(N).change(N);var H=!1;function Q(){var t;p("#optin_data_frame").is(":visible")&&!H&&(H=!0,t=p("#optin_data_frame"),p.ajax({type:"POST",url:ajaxurl,data:{action:"yarpp_optin_data",_ajax_nonce:p("#yarpp_optin_data-nonce").val()},beforeSend:function(){t.html(loading)},success:function(e){t.html("<pre>"+e+"</pre>")},dataType:"html"}))}function W(){setTimeout(Q,0)}function X(){var e=p(".yarpp_form_post_types").is(":has(input[type=checkbox]:checked)");p("#yarpp-auto_display_archive").attr("disabled",!e),e||p("#yarpp-auto_display_archive").prop("checked",!1)}function J(e,t){e?(p(".yarpp_form_post_types #yarpp_post_type_"+t).prop("disabled",!1),p(".yarpp_form_post_types #yarpp_post_type_"+t).siblings().hide()):(p(".yarpp_form_post_types #yarpp_post_type_"+t).prop("disabled",!0),p(".yarpp_form_post_types #yarpp_post_type_"+t).siblings().show())}p("#yarpp-optin-learnmore, a[aria-controls=tab-panel-optin]").bind("click focus",W),W(),p(".sync_no_results, .sync_rss_no_results").change(function(){var e=p(this).find("input").attr("value");p(this).hasClass("sync_no_results")&&p(".sync_no_results input").attr("value",e),p(this).hasClass("sync_rss_no_results")&&p(".sync_rss_no_results input").attr("value",e)}),p(".yarpp_form_post_types input[type=checkbox]").change(X),X(),p("#yarpp_fulltext_expand").click(function(e){e.preventDefault();e=p("#yarpp_fulltext_details");e.slideToggle(),e.hasClass("hidden")?(e.removeClass("hidden"),p(this).text("Hide Details [-]")):(e.addClass("hidden"),p(this).text("Show Details [+]"))}),p(".include_post_type input[type=checkbox]").change(function(e){var t=p(this).attr("data-post-type");p("#yarpp-same_post_type").is(":checked")?J(p(this).is(":checked"),t):p(".yarpp_form_post_types #yarpp_post_type_"+t).prop("disabled",!1)}),p("#yarpp-same_post_type").change(function(e){p(this).is(":checked")?p(".include_post_type input[type=checkbox]").each(function(){var e=p(this).attr("data-post-type");J(p(this).is(":checked"),e)}):(p(".yarpp_form_post_types input[type=checkbox]").prop("disabled",!1),p(".yarpp_form_post_types input[type=checkbox]").siblings().hide())});var M=p('\t\t\t<div id="shareaholic-deactivate-dialog" class="shareaholic-deactivate-dialog" data-remodal-id="">\t\t\t\t<div class="shareaholic-deactivate-header" style="background-image: url('+yarpp_messages.logo+"); background-color: "+yarpp_messages.bgcolor+';"><div class="shareaholic-deactivate-text"><h2>'+yarpp_messages.model_title+'</h2></div></div>\t\t\t\t<div class="shareaholic-deactivate-body">\t\t\t\t\t<div class="shareaholic-deactivate-body-foreword">'+yarpp_messages.alert_message+'</div>\t\t\t\t\t<div class="shareaholic-deactivate-dialog-footer"> <input type="submit" class="button confirm button-secondary" id="yarpp-clear-cache-submit" value="Delete"/>\t\t\t\t\t\t<button data-remodal-action="cancel" class="button button-secondary">Cancel</button>\t\t\t\t\t\t</div>\t\t\t\t</div>\t\t\t</div>\t\t')[0];p("#yarpp-clear-cache").click(function(){p(M).remodal({hashTracking:!1,closeOnOutsideClick:!1}).open(),event.preventDefault()}),p(document.body).on("click","#yarpp-clear-cache-submit",function(){p(M).remodal().close();var a="#yarpp-clear-cache",i="#display_notices",n="notice notice-error is-dismissible";p(a).prop("disabled",!0),p.ajax({type:"POST",url:ajaxurl,data:{action:"yarpp_clear_cache",_ajax_nonce:p("#clear_cache-nonce").val()},beforeSend:function(){p(a).siblings(".spinner").addClass("is-active")},success:function(e){var t;p(a).siblings(".spinner").removeClass("is-active"),p(i).show(),"success"==e?(t=yarpp_messages.success,n="notice notice-success is-dismissible",p(a).prop("disabled",!1)):t="forbidden"==e?yarpp_messages.forbidden:"nonce_fail"==e?yarpp_messages.nonce_fail:yarpp_messages.error,p(i).addClass(n),p(i).html("<p>"+t+"</p>")},error:function(e){p(i).show(),p(i).addClass(n),p(a).siblings(".spinner").removeClass("is-active"),p(i).html("<p>"+yarpp_messages.error+"</p>")}}),p(i).delay(5e3).fadeOut(1e3)})});
|
readme.txt
CHANGED
@@ -6,23 +6,25 @@ Requires at least: 3.7
|
|
6 |
Requires PHP: 5.3
|
7 |
License: GPLv2 or later
|
8 |
Tested up to: 5.7
|
9 |
-
Stable tag: 5.
|
10 |
|
11 |
The best WordPress plugin for displaying related posts. Simple and flexible, with a powerful proven algorithm and inbuilt caching.
|
12 |
|
13 |
== Description ==
|
14 |
|
|
|
|
|
15 |
*Yet Another Related Posts Plugin (YARPP)* is a professionally maintained, highly customizable, performant and feature rich plugin that displays pages, posts, and custom post types related to the current entry. YARPP introduces your visitors to other relevant content on your site -- boosting visitor engagement, time on site and SEO. Related Posts can increase your pageviews up to 10%. Simply install, activate and watch your sessions and pageviews increase.
|
16 |
|
17 |
-
|
18 |
-
|
19 |
* **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
|
20 |
* **Caching**: Inbuilt cache makes subsequent queries super efficient and fast
|
21 |
-
* **Custom Templates and Styles**: Use
|
22 |
* **Flexible** with a full range of placement options, including:
|
23 |
+ [Automatic Display Options](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation) (pick where to show YARPP from the YARPP settings page)
|
24 |
+ [RSS/Feed Options](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation)
|
25 |
-
+ [Gutenberg
|
26 |
+ [[yarpp] Shortcode](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation)
|
27 |
+ [Widget](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation)
|
28 |
+ [YARPP functions()](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation)
|
@@ -34,18 +36,23 @@ The best WordPress plugin for displaying related posts. Simple and flexible, wit
|
|
34 |
* **WooCommerce** support
|
35 |
* **Professionally maintained and supported** with regular updates
|
36 |
|
37 |
-
|
38 |
-
-------------------------------------------
|
39 |
|
40 |
https://videopress.com/v/0n2TSzkb
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
YARPP is
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
49 |
|
50 |
YARPP works best with PHP 5.3 or greater, MySQL 5.6 or greater OR MariaDB 10.1 or greater, and WordPress 3.7 or greater. See [the FAQ](https://wordpress.org/plugins/yet-another-related-posts-plugin/faq/) for answers to common questions.
|
51 |
|
@@ -54,9 +61,9 @@ YARPP works best with PHP 5.3 or greater, MySQL 5.6 or greater OR MariaDB 10.1 o
|
|
54 |
1. YARPP options in WP-Admin: Automatic Display Options
|
55 |
2. YARPP options in WP-Admin: "The Pool" settings
|
56 |
3. YARPP options in WP-Admin: "The Algorithm" settings
|
57 |
-
4. Example - starwars.com
|
58 |
-
5. Example - CB2.com
|
59 |
-
6. Example - chrisguillebeau.com
|
60 |
|
61 |
== Installation ==
|
62 |
|
@@ -333,18 +340,49 @@ Some common overrides that YARPP users have added are:
|
|
333 |
|
334 |
Once you save any CSS changes, empty your browser's cache and reload your page to see the effect.
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
= I'm using the Thumbnails display. How can I change the thumbnail size? =
|
337 |
|
338 |
As of YARPP v5.19.0, YARPP usually defaults to using WordPress' default thumbnail size. This can be changed to another thumbnail size using the YARPP setting "Thumbnail Size".
|
339 |
|
340 |
However, if you used YARPP before v5.19.0, or your theme defines a "yarpp-thumbnail" size, the default is the "yarpp-thumbnail". To change "yarpp-thumbnail" size, add the following to your theme's `functions.php` file with appropriate width and height variables:
|
341 |
|
342 |
-
`add_image_size('yarpp-thumbnail', $width, $height, true);`
|
343 |
|
344 |
When you do this, make sure you also set the YARPP setting "Thumbnail Size" to "yarpp-thumbnail".
|
345 |
|
346 |
Each time you change YARPP's thumbnail dimensions like this, you will probably want to have WordPress regenerate appropriate sized thumbnails for all of your images. We highly recommend the [Regenerate Thumbnails](https://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin for this purpose.
|
347 |
|
|
|
|
|
|
|
|
|
348 |
= I'm using the Thumbnails display. Why aren't the right size thumbnails being served? =
|
349 |
|
350 |
By default, if an appropriately sized thumbnail is not available in WordPress, a larger image will be served and will be made to fit in the thumbnail space via CSS. Sometimes this means images will be scaled down in a weird way, so it is not ideal. What you really want is for YARPP to serve appropriately-sized thumbnails.
|
@@ -491,17 +529,24 @@ Beginning with version 4.0.7, YARPP includes clean uninstall functionality. If y
|
|
491 |
|
492 |
|
493 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
= 5.25.0 (23-June-2021) =
|
495 |
* Enhancement: Cleaned up old unused code (adkengage)
|
496 |
|
497 |
= 5.24.0 (17-June-2021) =
|
498 |
* Enhancement: Option to automatically generate missing thumbnail sizes on the fly when using Custom YARPP Templates
|
499 |
-
* [New](https://wordpress.org/support/topic/remove-yarpp-from-the_content-or-the_excerpt/):
|
|
|
500 |
* Enhancement: Use the faster and less memory intensive function `strpos()` instead of `stristr()`
|
501 |
|
502 |
= 5.23.0 (02-June-2021) =
|
503 |
-
* [New](https://wordpress.org/support/topic/is-it-possible-to-use-different-styles-of-yarpp-in-every-post/): Ability to specify maximum number of posts to show in the YARPP shortcode.
|
504 |
-
+ `[yarpp template="list" limit=3]`
|
505 |
* Bugfix: Check `wp_parse_list` exists for backwards compatibility to older versions of WordPress
|
506 |
* [Bugfix](https://wordpress.org/support/topic/yarpp_related-does-not-return-all-posts/): Use query parameters when priming cache using `yarpp_related`. Resolves bug with `yarpp_function` not fully accounting for all parameters passed to it.
|
507 |
|
@@ -538,10 +583,8 @@ Beginning with version 4.0.7, YARPP includes clean uninstall functionality. If y
|
|
538 |
* [Bugfix](https://wordpress.org/support/topic/warning-message-yarpp_cache-php/): Resolves `join` warning (Part 2/2)
|
539 |
|
540 |
= 5.17.0 (06-April-2021) =
|
541 |
-
* [New](https://wordpress.org/support/topic/unable-to-dequeue-related-css-stylesheet/): Adds filter to be able to dequeue related.css
|
542 |
-
`
|
543 |
-
add_filter( 'yarpp_enqueue_related_style', '_\_return_false' );
|
544 |
-
`
|
545 |
* New: Adds friendly per-post meta box options to disable YARPP automatic display on a specific post
|
546 |
|
547 |
= 5.16.1 (29-March-2021) =
|
@@ -652,7 +695,8 @@ add_filter( 'yarpp_enqueue_related_style', '_\_return_false' );
|
|
652 |
= 5.3.0 (29-July-2020) =
|
653 |
* New: REST API support! ([documentation](https://support.shareaholic.com/hc/en-us/articles/360046456752))
|
654 |
* Enhancement: [WP Rest Cache Plugin](https://wordpress.org/plugins/wp-rest-cache/) support
|
655 |
-
* Enhancement:
|
|
|
656 |
* Bugfix: Fixes deactivation survey when Google Translate in Chrome auto translates the admin page
|
657 |
|
658 |
= 5.2.2 (21-July-2020) =
|
@@ -1349,5 +1393,5 @@ After a break of many years, the plugin is 100% supported now that the baton has
|
|
1349 |
* Initial upload
|
1350 |
|
1351 |
== Upgrade Notice ==
|
1352 |
-
= 5.
|
1353 |
We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thank you for using YARPP!
|
6 |
Requires PHP: 5.3
|
7 |
License: GPLv2 or later
|
8 |
Tested up to: 5.7
|
9 |
+
Stable tag: 5.26.0
|
10 |
|
11 |
The best WordPress plugin for displaying related posts. Simple and flexible, with a powerful proven algorithm and inbuilt caching.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
= Related Posts Plugin for WordPress =
|
16 |
+
|
17 |
*Yet Another Related Posts Plugin (YARPP)* is a professionally maintained, highly customizable, performant and feature rich plugin that displays pages, posts, and custom post types related to the current entry. YARPP introduces your visitors to other relevant content on your site -- boosting visitor engagement, time on site and SEO. Related Posts can increase your pageviews up to 10%. Simply install, activate and watch your sessions and pageviews increase.
|
18 |
|
19 |
+
= Key Features =
|
20 |
+
|
21 |
* **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
|
22 |
* **Caching**: Inbuilt cache makes subsequent queries super efficient and fast
|
23 |
+
* **Custom Templates and Styles**: Use a pre-built **list** or **thumbnail** template, or use the YARPP custom templating system for 100% control of how results are styles and displayed
|
24 |
* **Flexible** with a full range of placement options, including:
|
25 |
+ [Automatic Display Options](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation) (pick where to show YARPP from the YARPP settings page)
|
26 |
+ [RSS/Feed Options](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation)
|
27 |
+
+ [Block Editor (Gutenberg)](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation)
|
28 |
+ [[yarpp] Shortcode](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation)
|
29 |
+ [Widget](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation)
|
30 |
+ [YARPP functions()](https://wordpress.org/plugins/yet-another-related-posts-plugin/#installation)
|
36 |
* **WooCommerce** support
|
37 |
* **Professionally maintained and supported** with regular updates
|
38 |
|
39 |
+
= YARPP Algorithm Explained =
|
|
|
40 |
|
41 |
https://videopress.com/v/0n2TSzkb
|
42 |
|
43 |
+
= Contribute: Translate YARPP =
|
44 |
+
|
45 |
+
YARPP is available for [translation directly on WordPress.org](https://translate.wordpress.org/projects/wp-plugins/yet-another-related-posts-plugin/). Please check out the official [Translator Handbook](https://make.wordpress.org/polyglots/handbook/rosetta/theme-plugin-directories/).
|
46 |
+
|
47 |
+
= Wide Support =
|
48 |
|
49 |
+
YARPP is the **most popular** and **the highest rated** [Related Posts Plugin for WordPress](https://yarpp.com/). With your support, this plugin always strives to be the best WordPress plugin for Content Discovery and Related Posts.
|
50 |
|
51 |
+
✔ Over 10 years of development
|
52 |
+
✔ Over 6 million downloads
|
53 |
+
✔ Translated into more than a dozen languages
|
54 |
+
✔ Professionally maintained and actively supported with regular updates
|
55 |
+
✔ Works with all languages
|
56 |
|
57 |
YARPP works best with PHP 5.3 or greater, MySQL 5.6 or greater OR MariaDB 10.1 or greater, and WordPress 3.7 or greater. See [the FAQ](https://wordpress.org/plugins/yet-another-related-posts-plugin/faq/) for answers to common questions.
|
58 |
|
61 |
1. YARPP options in WP-Admin: Automatic Display Options
|
62 |
2. YARPP options in WP-Admin: "The Pool" settings
|
63 |
3. YARPP options in WP-Admin: "The Algorithm" settings
|
64 |
+
4. Example - YARPP on starwars.com
|
65 |
+
5. Example - YARPP on CB2.com
|
66 |
+
6. Example - YARPP on chrisguillebeau.com
|
67 |
|
68 |
== Installation ==
|
69 |
|
340 |
|
341 |
Once you save any CSS changes, empty your browser's cache and reload your page to see the effect.
|
342 |
|
343 |
+
= How do I remove sold out WooCommerce products from recommendations (and otherwise filter by postmeta)? =
|
344 |
+
If you use YARPP to show related products and want to exclude products that are sold out, use the following code snippet:
|
345 |
+
|
346 |
+
<code>
|
347 |
+
function yarpp_custom_wp_query($query) {
|
348 |
+
if(isset($query->yarpp_cache_type)){
|
349 |
+
$query->set('post_type', 'product');
|
350 |
+
$meta_query = [
|
351 |
+
'relation' => 'AND',
|
352 |
+
[
|
353 |
+
'key' => '_stock_status',
|
354 |
+
'value' => ['instock','onbackorder'],
|
355 |
+
'compare' => 'IN',
|
356 |
+
]
|
357 |
+
];
|
358 |
+
$query->set('meta_query', $meta_query);
|
359 |
+
}
|
360 |
+
|
361 |
+
return $query;
|
362 |
+
}
|
363 |
+
add_filter('pre_get_posts', 'yarpp_custom_wp_query', 100);
|
364 |
+
</code>
|
365 |
+
|
366 |
+
Note: this filter applies after the related items were already calculated, so when it filters out an item you will see fewer related items than you requested.
|
367 |
+
|
368 |
+
You can similarly [filter WordPress' meta queries](https://developer.wordpress.org/reference/classes/wp_meta_query/) to include/excluded posts from YARPP's related results.
|
369 |
+
|
370 |
= I'm using the Thumbnails display. How can I change the thumbnail size? =
|
371 |
|
372 |
As of YARPP v5.19.0, YARPP usually defaults to using WordPress' default thumbnail size. This can be changed to another thumbnail size using the YARPP setting "Thumbnail Size".
|
373 |
|
374 |
However, if you used YARPP before v5.19.0, or your theme defines a "yarpp-thumbnail" size, the default is the "yarpp-thumbnail". To change "yarpp-thumbnail" size, add the following to your theme's `functions.php` file with appropriate width and height variables:
|
375 |
|
376 |
+
`add_image_size( 'yarpp-thumbnail', $width, $height, true );`
|
377 |
|
378 |
When you do this, make sure you also set the YARPP setting "Thumbnail Size" to "yarpp-thumbnail".
|
379 |
|
380 |
Each time you change YARPP's thumbnail dimensions like this, you will probably want to have WordPress regenerate appropriate sized thumbnails for all of your images. We highly recommend the [Regenerate Thumbnails](https://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin for this purpose.
|
381 |
|
382 |
+
Note: if you don't use YARPP's thumbnail size, you might want to avoid generating it for newly uploaded images to save space. To do that add the following code snippet to your theme's `functions.php` file:
|
383 |
+
|
384 |
+
`add_filter( 'yarpp_add_image_size', "__return_false" );`
|
385 |
+
|
386 |
= I'm using the Thumbnails display. Why aren't the right size thumbnails being served? =
|
387 |
|
388 |
By default, if an appropriately sized thumbnail is not available in WordPress, a larger image will be served and will be made to fit in the thumbnail space via CSS. Sometimes this means images will be scaled down in a weird way, so it is not ideal. What you really want is for YARPP to serve appropriately-sized thumbnails.
|
529 |
|
530 |
|
531 |
== Changelog ==
|
532 |
+
= 5.26.0 (14-July-2021) =
|
533 |
+
* [New](https://wordpress.org/support/topic/disable-yarpp-thumbnail-120x120/): Adds a `yarpp_add_image_size` filter to avoid creating YARPP thumbnail sizes
|
534 |
+
+ `add_filter( 'yarpp_add_image_size', '__return_false' );`
|
535 |
+
* New: Preview YARPP Templates on the YARPP settings page under Automatic Display Options
|
536 |
+
* Docs: Added FAQ on how to remove sold out WooCommerce products from recommendations (and otherwise filter by postmeta)
|
537 |
+
|
538 |
= 5.25.0 (23-June-2021) =
|
539 |
* Enhancement: Cleaned up old unused code (adkengage)
|
540 |
|
541 |
= 5.24.0 (17-June-2021) =
|
542 |
* Enhancement: Option to automatically generate missing thumbnail sizes on the fly when using Custom YARPP Templates
|
543 |
+
* [New](https://wordpress.org/support/topic/remove-yarpp-from-the_content-or-the_excerpt/): Adds a `noyarpp` filter to control YARPP Automatic Display programatically.
|
544 |
+
+ For example: `add_filter( 'noyarpp', 'custom_function' );`
|
545 |
* Enhancement: Use the faster and less memory intensive function `strpos()` instead of `stristr()`
|
546 |
|
547 |
= 5.23.0 (02-June-2021) =
|
548 |
+
* [New](https://wordpress.org/support/topic/is-it-possible-to-use-different-styles-of-yarpp-in-every-post/): Ability to specify maximum number of posts to show in the YARPP shortcode.
|
549 |
+
+ For example, to set maximum post limit to 3: `[yarpp template="list" limit=3]`
|
550 |
* Bugfix: Check `wp_parse_list` exists for backwards compatibility to older versions of WordPress
|
551 |
* [Bugfix](https://wordpress.org/support/topic/yarpp_related-does-not-return-all-posts/): Use query parameters when priming cache using `yarpp_related`. Resolves bug with `yarpp_function` not fully accounting for all parameters passed to it.
|
552 |
|
583 |
* [Bugfix](https://wordpress.org/support/topic/warning-message-yarpp_cache-php/): Resolves `join` warning (Part 2/2)
|
584 |
|
585 |
= 5.17.0 (06-April-2021) =
|
586 |
+
* [New](https://wordpress.org/support/topic/unable-to-dequeue-related-css-stylesheet/): Adds `yarpp_enqueue_related_style` filter to be able to dequeue related.css
|
587 |
+
+ `add_filter( 'yarpp_enqueue_related_style', '__return_false' );`
|
|
|
|
|
588 |
* New: Adds friendly per-post meta box options to disable YARPP automatic display on a specific post
|
589 |
|
590 |
= 5.16.1 (29-March-2021) =
|
695 |
= 5.3.0 (29-July-2020) =
|
696 |
* New: REST API support! ([documentation](https://support.shareaholic.com/hc/en-us/articles/360046456752))
|
697 |
* Enhancement: [WP Rest Cache Plugin](https://wordpress.org/plugins/wp-rest-cache/) support
|
698 |
+
* Enhancement: Adds filters to change the priority for YARPP's filters on `the_content`, `the_content_feed` and `the_excerpt_rss`
|
699 |
+
+ For example: `add_filter( 'yarpp_content_priority', 1 );`
|
700 |
* Bugfix: Fixes deactivation survey when Google Translate in Chrome auto translates the admin page
|
701 |
|
702 |
= 5.2.2 (21-July-2020) =
|
1393 |
* Initial upload
|
1394 |
|
1395 |
== Upgrade Notice ==
|
1396 |
+
= 5.26.0 =
|
1397 |
We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thank you for using YARPP!
|
src/css/public/options_basic.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#yarpp_author_text {
|
2 |
-
|
3 |
}
|
4 |
|
5 |
.yarpp-red {
|
@@ -16,105 +16,125 @@
|
|
16 |
}
|
17 |
|
18 |
ul.yarpp_contacts li {
|
19 |
-
|
20 |
-
|
21 |
}
|
22 |
|
23 |
body.rtl ul.yarpp_contacts li {
|
24 |
-
|
25 |
}
|
26 |
|
27 |
ul.yarpp_contacts li a img {
|
28 |
-
|
29 |
}
|
30 |
|
31 |
/* hide pointer dismiss buttons on this page */
|
32 |
.postbox .wp-pointer-buttons {
|
33 |
-
|
34 |
}
|
35 |
|
36 |
-
#tab-panel-faq,
|
37 |
-
|
|
|
38 |
}
|
39 |
|
40 |
.icon {
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
}
|
48 |
|
49 |
body.rtl .icon {
|
50 |
-
|
51 |
-
|
52 |
}
|
53 |
|
54 |
@media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
}
|
60 |
|
61 |
.icon-wordpress {
|
62 |
-
|
63 |
}
|
64 |
|
65 |
.icon-twitter {
|
66 |
-
|
67 |
}
|
68 |
|
69 |
.icon-plugin {
|
70 |
-
|
71 |
}
|
72 |
|
73 |
.icon-star {
|
74 |
-
|
75 |
}
|
76 |
|
77 |
.icon-pro {
|
78 |
-
|
79 |
}
|
80 |
|
81 |
.icon-facebook {
|
82 |
-
|
83 |
}
|
84 |
|
85 |
-
.icon.spin,
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
95 |
}
|
96 |
|
97 |
@keyframes yarpp-spin {
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
|
103 |
@-moz-keyframes yarpp-spin {
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
|
109 |
@-webkit-keyframes yarpp-spin {
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
|
115 |
-
a.info{
|
116 |
-
|
117 |
-
|
118 |
}
|
119 |
|
120 |
.yarpp_help .wp-pointer-content p {
|
@@ -123,36 +143,36 @@ a.info{
|
|
123 |
}
|
124 |
|
125 |
a.yarpp_help {
|
126 |
-
|
127 |
-
|
128 |
}
|
129 |
|
130 |
a.yarpp_help:hover {
|
131 |
-
|
132 |
-
|
133 |
}
|
134 |
|
135 |
.exclude_terms span {
|
136 |
-
|
137 |
}
|
138 |
|
139 |
#yarpp_display_optin.yarpp_attention {
|
140 |
-
|
141 |
}
|
142 |
|
143 |
.yarpp_subbox {
|
144 |
-
|
145 |
-
|
146 |
}
|
147 |
|
148 |
.yarpp_form_row {
|
149 |
-
|
150 |
-
|
151 |
}
|
152 |
|
153 |
.yarpp_form_row > div {
|
154 |
-
|
155 |
-
|
156 |
}
|
157 |
|
158 |
.yarpp_form_row > div > label {
|
@@ -163,247 +183,390 @@ a.yarpp_help:hover {
|
|
163 |
}
|
164 |
|
165 |
.yarpp_form_select > div {
|
166 |
-
|
167 |
-
|
168 |
}
|
169 |
|
170 |
.yarpp_form_select + .yarpp_form_select {
|
171 |
-
|
172 |
}
|
173 |
|
174 |
.yarpp_form_label {
|
175 |
-
|
176 |
}
|
177 |
|
178 |
.yarpp_form_label + div {
|
179 |
-
|
180 |
-
|
181 |
}
|
182 |
|
183 |
.yarpp_form_textbox > .yarpp_form_label {
|
184 |
}
|
185 |
|
186 |
.yarpp_form_select > .yarpp_form_label {
|
187 |
-
|
188 |
}
|
189 |
|
190 |
.yarpp_form_post_types label {
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
}
|
195 |
|
196 |
body.rtl .yarpp_form_post_types label {
|
197 |
-
|
198 |
-
|
199 |
}
|
200 |
|
201 |
.yarpp_form_exclude label {
|
202 |
-
|
203 |
-
|
204 |
}
|
205 |
|
206 |
body.rtl .yarpp_form_exclude label {
|
207 |
-
|
208 |
-
|
209 |
}
|
210 |
|
211 |
.yarpp_form_template_file > .yarpp_form_label {
|
212 |
-
|
213 |
-
|
214 |
}
|
215 |
|
216 |
.yarpp_code_display {
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
}
|
221 |
|
222 |
body.rtl .yarpp_code_display {
|
223 |
-
|
224 |
}
|
225 |
|
226 |
.yarpp_code_display div {
|
227 |
-
|
228 |
-
|
229 |
}
|
230 |
|
231 |
.yarpp_code_display pre {
|
232 |
-
|
233 |
}
|
234 |
|
235 |
.yarpp_scroll_wrapper {
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
vertical-align: middle;
|
241 |
}
|
242 |
|
243 |
-
@media all and (max-width:1200px) {
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
}
|
251 |
|
252 |
#yarpp-optin-learnmore {
|
253 |
-
|
254 |
}
|
255 |
|
256 |
body.rtl #yarpp-optin-learnmore {
|
257 |
-
|
258 |
}
|
259 |
|
260 |
-
.template_file_wrap,
|
261 |
-
|
|
|
|
|
262 |
}
|
263 |
|
264 |
.template_file_wrap {
|
265 |
-
|
266 |
}
|
267 |
|
268 |
-
.yarpp_subbox input[type=text],
|
269 |
-
|
270 |
-
|
|
|
271 |
}
|
272 |
|
273 |
.yarpp_form_template_buttons {
|
274 |
-
|
275 |
}
|
276 |
|
277 |
.yarpp_template_button {
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
}
|
299 |
-
|
300 |
-
.yarpp_template_button.disabled,
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
|
|
|
|
309 |
}
|
310 |
|
311 |
.yarpp_template_button.disabled > div.label {
|
312 |
-
|
313 |
}
|
314 |
|
315 |
.yarpp_template_button:hover {
|
316 |
-
|
317 |
-
|
318 |
}
|
319 |
|
320 |
-
.yarpp_template_button:active,
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
|
|
330 |
}
|
331 |
|
332 |
.yarpp_template_button > div.label {
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
}
|
338 |
|
339 |
.yarpp_template_button > div.image {
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
}
|
346 |
|
347 |
.yarpp_template_button.disabled > div.image {
|
348 |
-
|
349 |
}
|
350 |
|
351 |
.yarpp_template_button:active > div.image {
|
352 |
-
|
353 |
}
|
354 |
|
355 |
-
.yarpp_template_button[data-value=builtin] > div.image {
|
356 |
-
|
357 |
}
|
358 |
|
359 |
-
.yarpp_template_button[data-value=thumbnails] > div.image {
|
360 |
-
|
361 |
}
|
362 |
|
363 |
-
.yarpp_template_button[data-value=custom] > div.image {
|
364 |
-
|
365 |
}
|
366 |
|
367 |
#optin_data_frame {
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
}
|
372 |
|
373 |
#yarpp_extra_screen_settings {
|
374 |
-
|
375 |
}
|
376 |
|
377 |
.help-tab-content {
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
}
|
382 |
|
383 |
.yarpp_red {
|
384 |
-
|
385 |
-
|
386 |
-
}
|
387 |
-
|
388 |
-
.yarpp_separated{
|
389 |
-
|
390 |
-
|
391 |
-
}
|
392 |
-
|
393 |
-
.yarpp-callout{
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
}
|
399 |
-
.yarpp-notice{
|
400 |
-
|
401 |
-
}
|
402 |
-
.yarpp-disabled{
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
}
|
1 |
#yarpp_author_text {
|
2 |
+
width: 900px;
|
3 |
}
|
4 |
|
5 |
.yarpp-red {
|
16 |
}
|
17 |
|
18 |
ul.yarpp_contacts li {
|
19 |
+
padding: 0px 0px 0px 30px;
|
20 |
+
line-height: 22px;
|
21 |
}
|
22 |
|
23 |
body.rtl ul.yarpp_contacts li {
|
24 |
+
padding: 0px 30px 0px 0px;
|
25 |
}
|
26 |
|
27 |
ul.yarpp_contacts li a img {
|
28 |
+
vertical-align: bottom;
|
29 |
}
|
30 |
|
31 |
/* hide pointer dismiss buttons on this page */
|
32 |
.postbox .wp-pointer-buttons {
|
33 |
+
display: none;
|
34 |
}
|
35 |
|
36 |
+
#tab-panel-faq,
|
37 |
+
#tab-panel-dev {
|
38 |
+
direction: ltr;
|
39 |
}
|
40 |
|
41 |
.icon {
|
42 |
+
width: 22px;
|
43 |
+
height: 22px;
|
44 |
+
position: absolute;
|
45 |
+
margin-left: -29px;
|
46 |
+
margin-top: -1px;
|
47 |
+
background-image: url('../images/sprites.png');
|
48 |
}
|
49 |
|
50 |
body.rtl .icon {
|
51 |
+
margin-left: none;
|
52 |
+
margin-right: -29px;
|
53 |
}
|
54 |
|
55 |
@media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
|
56 |
+
.icon {
|
57 |
+
background-image: url('../images/sprites-2x.png');
|
58 |
+
background-size: 132px 22px;
|
59 |
+
}
|
60 |
}
|
61 |
|
62 |
.icon-wordpress {
|
63 |
+
background-position: 0 0;
|
64 |
}
|
65 |
|
66 |
.icon-twitter {
|
67 |
+
background-position: -22px 0;
|
68 |
}
|
69 |
|
70 |
.icon-plugin {
|
71 |
+
background-position: -44px 0;
|
72 |
}
|
73 |
|
74 |
.icon-star {
|
75 |
+
background-position: -66px 0;
|
76 |
}
|
77 |
|
78 |
.icon-pro {
|
79 |
+
background-position: -88px 0;
|
80 |
}
|
81 |
|
82 |
.icon-facebook {
|
83 |
+
background-position: -110px 0;
|
84 |
}
|
85 |
|
86 |
+
.icon.spin,
|
87 |
+
.icon-star:hover {
|
88 |
+
transform-origin: 11px 12px;
|
89 |
+
-o-transform-origin: 11px 12px;
|
90 |
+
-webkit-transform-origin: 11px 12px;
|
91 |
+
-moz-transform-origin: 11px 12px;
|
92 |
+
animation: 3s ease 2s normal none 1 yarpp-spin;
|
93 |
+
-o-animation: 3s ease 2s normal none 1 yarpp-spin;
|
94 |
+
-webkit-animation: 3s ease 2s normal none 1 yarpp-spin;
|
95 |
+
-moz-animation: 3s ease 2s normal none 1 yarpp-spin;
|
96 |
+
z-index: 1;
|
97 |
}
|
98 |
|
99 |
@keyframes yarpp-spin {
|
100 |
+
0% {
|
101 |
+
transform: rotate(0deg) scale(1);
|
102 |
+
}
|
103 |
+
5% {
|
104 |
+
transform: rotate(0deg) scale(1.5);
|
105 |
+
}
|
106 |
+
100% {
|
107 |
+
transform: rotate(360deg) scale(1);
|
108 |
+
}
|
109 |
}
|
110 |
|
111 |
@-moz-keyframes yarpp-spin {
|
112 |
+
0% {
|
113 |
+
-moz-transform: rotate(0deg) scale(1);
|
114 |
+
}
|
115 |
+
5% {
|
116 |
+
-moz-transform: rotate(0deg) scale(1.5);
|
117 |
+
}
|
118 |
+
100% {
|
119 |
+
-moz-transform: rotate(360deg) scale(1);
|
120 |
+
}
|
121 |
}
|
122 |
|
123 |
@-webkit-keyframes yarpp-spin {
|
124 |
+
0% {
|
125 |
+
-webkit-transform: rotate(0deg) scale(1);
|
126 |
+
}
|
127 |
+
5% {
|
128 |
+
-webkit-transform: rotate(0deg) scale(1.5);
|
129 |
+
}
|
130 |
+
100% {
|
131 |
+
-webkit-transform: rotate(360deg) scale(1);
|
132 |
+
}
|
133 |
}
|
134 |
|
135 |
+
a.info {
|
136 |
+
position: relative;
|
137 |
+
z-index: 24;
|
138 |
}
|
139 |
|
140 |
.yarpp_help .wp-pointer-content p {
|
143 |
}
|
144 |
|
145 |
a.yarpp_help {
|
146 |
+
text-decoration: none;
|
147 |
+
cursor: pointer;
|
148 |
}
|
149 |
|
150 |
a.yarpp_help:hover {
|
151 |
+
text-decoration: none;
|
152 |
+
background-position: -520px -0px;
|
153 |
}
|
154 |
|
155 |
.exclude_terms span {
|
156 |
+
display: inline-block;
|
157 |
}
|
158 |
|
159 |
#yarpp_display_optin.yarpp_attention {
|
160 |
+
border: 2px solid #bbb;
|
161 |
}
|
162 |
|
163 |
.yarpp_subbox {
|
164 |
+
margin-bottom: 5px;
|
165 |
+
background: #fdfdfd;
|
166 |
}
|
167 |
|
168 |
.yarpp_form_row {
|
169 |
+
overflow: visible;
|
170 |
+
padding: 8px;
|
171 |
}
|
172 |
|
173 |
.yarpp_form_row > div {
|
174 |
+
display: inline-block;
|
175 |
+
vertical-align: top;
|
176 |
}
|
177 |
|
178 |
.yarpp_form_row > div > label {
|
183 |
}
|
184 |
|
185 |
.yarpp_form_select > div {
|
186 |
+
padding-top: 5px;
|
187 |
+
padding-bottom: 5px;
|
188 |
}
|
189 |
|
190 |
.yarpp_form_select + .yarpp_form_select {
|
191 |
+
padding-top: 0px;
|
192 |
}
|
193 |
|
194 |
.yarpp_form_label {
|
195 |
+
width: 25%;
|
196 |
}
|
197 |
|
198 |
.yarpp_form_label + div {
|
199 |
+
padding-left: 16px;
|
200 |
+
width: 70%;
|
201 |
}
|
202 |
|
203 |
.yarpp_form_textbox > .yarpp_form_label {
|
204 |
}
|
205 |
|
206 |
.yarpp_form_select > .yarpp_form_label {
|
207 |
+
padding-top: 8px;
|
208 |
}
|
209 |
|
210 |
.yarpp_form_post_types label {
|
211 |
+
padding-right: 15px;
|
212 |
+
line-height: 20px;
|
213 |
+
display: inline-block;
|
214 |
}
|
215 |
|
216 |
body.rtl .yarpp_form_post_types label {
|
217 |
+
padding-right: inherit;
|
218 |
+
padding-left: 15px;
|
219 |
}
|
220 |
|
221 |
.yarpp_form_exclude label {
|
222 |
+
padding-right: 5px;
|
223 |
+
line-height: 15px;
|
224 |
}
|
225 |
|
226 |
body.rtl .yarpp_form_exclude label {
|
227 |
+
padding-right: inherit;
|
228 |
+
padding-left: 5px;
|
229 |
}
|
230 |
|
231 |
.yarpp_form_template_file > .yarpp_form_label {
|
232 |
+
vertical-align: top;
|
233 |
+
padding-top: 5px;
|
234 |
}
|
235 |
|
236 |
.yarpp_code_display {
|
237 |
+
border-left: 8px transparent solid;
|
238 |
+
width: 50%;
|
239 |
+
float: right;
|
240 |
}
|
241 |
|
242 |
body.rtl .yarpp_code_display {
|
243 |
+
float: left;
|
244 |
}
|
245 |
|
246 |
.yarpp_code_display div {
|
247 |
+
overflow: auto;
|
248 |
+
max-height: 300px;
|
249 |
}
|
250 |
|
251 |
.yarpp_code_display pre {
|
252 |
+
direction: ltr;
|
253 |
}
|
254 |
|
255 |
.yarpp_scroll_wrapper {
|
256 |
+
overflow: auto;
|
257 |
+
min-height: 25px;
|
258 |
+
max-height: 100px;
|
259 |
+
width: 60%;
|
260 |
vertical-align: middle;
|
261 |
}
|
262 |
|
263 |
+
@media all and (max-width: 1200px) {
|
264 |
+
.yarpp_scroll_wrapper {
|
265 |
+
width: 50%;
|
266 |
+
}
|
267 |
+
.yarpp_code_display {
|
268 |
+
max-width: 60%;
|
269 |
+
}
|
270 |
}
|
271 |
|
272 |
#yarpp-optin-learnmore {
|
273 |
+
float: right;
|
274 |
}
|
275 |
|
276 |
body.rtl #yarpp-optin-learnmore {
|
277 |
+
float: left;
|
278 |
}
|
279 |
|
280 |
+
.template_file_wrap,
|
281 |
+
.template_author_wrap,
|
282 |
+
.template_description_wrap {
|
283 |
+
margin: 3px 0;
|
284 |
}
|
285 |
|
286 |
.template_file_wrap {
|
287 |
+
font-family: monospace;
|
288 |
}
|
289 |
|
290 |
+
.yarpp_subbox input[type='text'],
|
291 |
+
.yarpp_subbox input[type='text'] {
|
292 |
+
font-family: monospace;
|
293 |
+
width: 35%;
|
294 |
}
|
295 |
|
296 |
.yarpp_form_template_buttons {
|
297 |
+
padding: 0px;
|
298 |
}
|
299 |
|
300 |
.yarpp_template_button {
|
301 |
+
position: relative;
|
302 |
+
height: 60px;
|
303 |
+
width: 70px;
|
304 |
+
padding: 8px;
|
305 |
+
-webkit-border-radius: 3px;
|
306 |
+
border-radius: 7px;
|
307 |
+
border: 1px solid #aaa;
|
308 |
+
margin: 10px;
|
309 |
+
margin-right: 5px;
|
310 |
+
margin-bottom: 20px;
|
311 |
+
cursor: pointer;
|
312 |
+
background: #f3f3f3;
|
313 |
+
background-image: -webkit-linear-gradient(to bottom, #fefefe, #f4f4f4);
|
314 |
+
background-image: -moz-linear-gradient(to bottom, #fefefe, #f4f4f4);
|
315 |
+
background-image: -o-linear-gradient(to bottom, #fefefe, #f4f4f4);
|
316 |
+
background-image: linear-gradient(to bottom, #fefefe, #f4f4f4);
|
317 |
+
color: #333;
|
318 |
+
text-shadow: 0 1px 0 white;
|
319 |
+
-webkit-box-shadow: 1px 1px 7px 1px #bbb;
|
320 |
+
box-shadow: 1px 1px 7px 1px #bbb;
|
321 |
+
}
|
322 |
+
|
323 |
+
.yarpp_template_button.disabled,
|
324 |
+
.yarpp_template_button.disabled:hover,
|
325 |
+
.yarpp_template_button.disabled:active {
|
326 |
+
-webkit-box-shadow: none;
|
327 |
+
box-shadow: none;
|
328 |
+
border-color: #ddd;
|
329 |
+
background: #f3f3f3;
|
330 |
+
background-image: -webkit-linear-gradient(to bottom, #fefefe, #f4f4f4);
|
331 |
+
background-image: -moz-linear-gradient(to bottom, #fefefe, #f4f4f4);
|
332 |
+
background-image: -o-linear-gradient(to bottom, #fefefe, #f4f4f4);
|
333 |
+
background-image: linear-gradient(to bottom, #fefefe, #f4f4f4);
|
334 |
}
|
335 |
|
336 |
.yarpp_template_button.disabled > div.label {
|
337 |
+
color: #bbb;
|
338 |
}
|
339 |
|
340 |
.yarpp_template_button:hover {
|
341 |
+
border-color: #999;
|
342 |
+
color: #222;
|
343 |
}
|
344 |
|
345 |
+
.yarpp_template_button:active,
|
346 |
+
.yarpp_template_button.active {
|
347 |
+
background: #eee;
|
348 |
+
background-image: -webkit-linear-gradient(to bottom, #eee, #f4f4f4);
|
349 |
+
background-image: -moz-linear-gradient(to bottom, #eee, #f4f4f4);
|
350 |
+
background-image: -o-linear-gradient(to bottom, #eee, #f4f4f4);
|
351 |
+
background-image: linear-gradient(to bottom, #eee, #f4f4f4);
|
352 |
+
border-color: #999;
|
353 |
+
text-shadow: 0 -1px 0 white;
|
354 |
+
-webkit-box-shadow: inset 0 2px 8px -2px rgba(0, 0, 0, 0.5);
|
355 |
+
box-shadow: inset 0 2px 8px -2px rgba(0, 0, 0, 0.5);
|
356 |
}
|
357 |
|
358 |
.yarpp_template_button > div.label {
|
359 |
+
width: 70px;
|
360 |
+
bottom: 8px;
|
361 |
+
text-align: center;
|
362 |
+
position: absolute;
|
363 |
}
|
364 |
|
365 |
.yarpp_template_button > div.image {
|
366 |
+
width: 70px;
|
367 |
+
height: 40px;
|
368 |
+
background-image: url('../images/template-buttons-2x.png');
|
369 |
+
background-size: 210px 40px;
|
370 |
+
opacity: 0.8;
|
371 |
}
|
372 |
|
373 |
.yarpp_template_button.disabled > div.image {
|
374 |
+
opacity: 0.2;
|
375 |
}
|
376 |
|
377 |
.yarpp_template_button:active > div.image {
|
378 |
+
opacity: 1;
|
379 |
}
|
380 |
|
381 |
+
.yarpp_template_button[data-value='builtin'] > div.image {
|
382 |
+
background-position: 0px 0px;
|
383 |
}
|
384 |
|
385 |
+
.yarpp_template_button[data-value='thumbnails'] > div.image {
|
386 |
+
background-position: -70px 0px;
|
387 |
}
|
388 |
|
389 |
+
.yarpp_template_button[data-value='custom'] > div.image {
|
390 |
+
background-position: -140px 0px;
|
391 |
}
|
392 |
|
393 |
#optin_data_frame {
|
394 |
+
overflow: scroll;
|
395 |
+
max-height: 300px;
|
396 |
+
direction: ltr;
|
397 |
}
|
398 |
|
399 |
#yarpp_extra_screen_settings {
|
400 |
+
border-top: 1px solid #e0e0e0;
|
401 |
}
|
402 |
|
403 |
.help-tab-content {
|
404 |
+
max-height: 500px;
|
405 |
+
width: 100%;
|
406 |
+
overflow: auto;
|
407 |
}
|
408 |
|
409 |
.yarpp_red {
|
410 |
+
color: red;
|
411 |
+
font-weight: bold;
|
412 |
+
}
|
413 |
+
|
414 |
+
.yarpp_separated {
|
415 |
+
display: inline-block;
|
416 |
+
margin: 1.5em 1em;
|
417 |
+
}
|
418 |
+
|
419 |
+
.yarpp-callout {
|
420 |
+
margin: 5px 0 15px;
|
421 |
+
border: 1px solid #ccd0d4;
|
422 |
+
border-left-width: 4px;
|
423 |
+
padding: 1px 12px;
|
424 |
+
}
|
425 |
+
.yarpp-notice {
|
426 |
+
border-left-color: #ffb900;
|
427 |
+
}
|
428 |
+
.yarpp-disabled {
|
429 |
+
color: #a7aaad !important;
|
430 |
+
background: #f6f7f7 !important;
|
431 |
+
border-color: #dcdcde !important;
|
432 |
+
box-shadow: none !important;
|
433 |
+
text-shadow: none !important;
|
434 |
+
cursor: not-allowed !important;
|
435 |
+
}
|
436 |
+
|
437 |
+
.yarpp-preview__wrapper {
|
438 |
+
position: relative;
|
439 |
+
display: flex;
|
440 |
+
flex-direction: column;
|
441 |
+
align-items: center;
|
442 |
+
}
|
443 |
+
|
444 |
+
.yarpp-preview__title {
|
445 |
+
align-self: flex-start;
|
446 |
+
}
|
447 |
+
|
448 |
+
#yarpp-display-html-preview {
|
449 |
+
position: relative;
|
450 |
+
display: grid;
|
451 |
+
grid-template-rows: 1fr auto;
|
452 |
+
grid-template-columns: 100%;
|
453 |
+
height: 660px;
|
454 |
+
width: 100%;
|
455 |
+
border: solid 1px #e4e4e7;
|
456 |
+
background-color: #fafafa;
|
457 |
+
}
|
458 |
+
|
459 |
+
#yarpp-display-code-preview {
|
460 |
+
width: 100%;
|
461 |
+
background-color: #fafafa;
|
462 |
+
border: 1px solid #e4e4e7;
|
463 |
+
border-top: none;
|
464 |
+
}
|
465 |
+
|
466 |
+
#yarpp-display-code-preview pre code {
|
467 |
+
font-size: 0.9em;
|
468 |
+
display: block;
|
469 |
+
padding: 16px;
|
470 |
+
max-height: 320px;
|
471 |
+
white-space: pre-wrap;
|
472 |
+
overflow-y: auto;
|
473 |
+
background-color: #fafafa;
|
474 |
+
}
|
475 |
+
|
476 |
+
.yarpp-preview__wrapper .yarpp-preview__iframe__container {
|
477 |
+
position: relative;
|
478 |
+
max-width: calc(100% - 60px); /* 20px size of after selector 40px of backdrop padding*/
|
479 |
+
min-width: 320px; /* Most common Mobile size */
|
480 |
+
height: calc(100% - 72px); /* minus 72px size of margins */
|
481 |
+
margin: 36px auto;
|
482 |
+
padding-right: 20px;
|
483 |
+
border: 12px solid #374151;
|
484 |
+
border-radius: 12px;
|
485 |
+
}
|
486 |
+
|
487 |
+
.yarpp-preview__wrapper .yarpp-preview__iframe__backdrop {
|
488 |
+
position: absolute;
|
489 |
+
top: 50%;
|
490 |
+
left: 50%;
|
491 |
+
right: 0;
|
492 |
+
width: 100%;
|
493 |
+
height: 100%;
|
494 |
+
transform: translate(-50%, -50%);
|
495 |
+
user-select: none;
|
496 |
+
outline: 0;
|
497 |
+
cursor: col-resize;
|
498 |
+
}
|
499 |
+
|
500 |
+
.yarpp-preview__wrapper .yarpp-preview__iframe__container:after {
|
501 |
+
content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path d="M8 5a1 1 0 100 2h5.586l-1.293 1.293a1 1 0 001.414 1.414l3-3a1 1 0 000-1.414l-3-3a1 1 0 10-1.414 1.414L13.586 5H8zM12 15a1 1 0 100-2H6.414l1.293-1.293a1 1 0 10-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L6.414 15H12z" /></svg>');
|
502 |
+
position: absolute;
|
503 |
+
display: flex;
|
504 |
+
align-items: center;
|
505 |
+
top: 0;
|
506 |
+
right: 0;
|
507 |
+
width: 20px;
|
508 |
+
height: 100%;
|
509 |
+
background-color: #f3f4f6;
|
510 |
+
border-left: 1px solid #d1d5db;
|
511 |
+
cursor: col-resize;
|
512 |
+
}
|
513 |
+
|
514 |
+
.yarpp-preview__wrapper .yarpp-preview__dragger {
|
515 |
+
height: 100%;
|
516 |
+
width: 20px;
|
517 |
+
background-color: red;
|
518 |
+
}
|
519 |
+
|
520 |
+
.yarpp-preview__media__controls {
|
521 |
+
display: none;
|
522 |
+
height: 100px;
|
523 |
+
width: 100%;
|
524 |
+
grid-template-columns: repeat(auto-fit, 160px);
|
525 |
+
column-gap: 1rem;
|
526 |
+
row-gap: 1rem;
|
527 |
+
align-items: center;
|
528 |
+
align-content: center;
|
529 |
+
justify-content: center;
|
530 |
+
border-bottom: 1px solid #e4e4e7;
|
531 |
+
}
|
532 |
+
|
533 |
+
.yarpp-preview__show-code {
|
534 |
+
display: grid;
|
535 |
+
align-items: center;
|
536 |
+
justify-items: flex-start;
|
537 |
+
height: 64px;
|
538 |
+
margin-left: 1rem;
|
539 |
+
}
|
540 |
+
|
541 |
+
.yarpp-preview__show-preview-width {
|
542 |
+
text-align: center;
|
543 |
+
}
|
544 |
+
|
545 |
+
#yarpp-preview-desktop {
|
546 |
+
display: none;
|
547 |
+
}
|
548 |
+
|
549 |
+
@media screen and (min-width: 767px) {
|
550 |
+
.yarpp-preview__media__controls {
|
551 |
+
display: grid;
|
552 |
+
}
|
553 |
+
#yarpp-display-html-preview {
|
554 |
+
grid-template-rows: auto 1fr auto;
|
555 |
+
}
|
556 |
+
}
|
557 |
+
|
558 |
+
@media screen and (min-width: 1200px) {
|
559 |
+
.yarpp-preview__media__controls {
|
560 |
+
display: grid;
|
561 |
+
height: 64px;
|
562 |
+
}
|
563 |
+
|
564 |
+
#yarpp-preview-desktop {
|
565 |
+
display: block;
|
566 |
+
}
|
567 |
+
|
568 |
+
#yarpp-display-html-preview {
|
569 |
+
grid-template-rows: auto 1fr auto;
|
570 |
+
height: 720px;
|
571 |
+
}
|
572 |
}
|
src/js/options_basic.js
CHANGED
@@ -41,67 +41,10 @@ jQuery(function ($) {
|
|
41 |
}
|
42 |
$('.show_excerpt, .use_template, #yarpp-rss_display').click(excerpt);
|
43 |
|
44 |
-
var loaded_demo_web = false;
|
45 |
-
function display() {
|
46 |
-
if (!$('#yarpp_display_web .inside').is(':visible')) return;
|
47 |
-
|
48 |
-
$('.yarpp_code_display').toggle($('#yarpp_display_code').is(':checked'));
|
49 |
-
if (
|
50 |
-
$('#yarpp_display_web .yarpp_code_display').is(':visible') &&
|
51 |
-
!loaded_demo_web
|
52 |
-
) {
|
53 |
-
loaded_demo_web = true;
|
54 |
-
var demo_web = $('#display_demo_web');
|
55 |
-
$.ajax({
|
56 |
-
type: 'POST',
|
57 |
-
url: ajaxurl,
|
58 |
-
data: {
|
59 |
-
action: 'yarpp_display_demo',
|
60 |
-
domain: 'website',
|
61 |
-
_ajax_nonce: $('#yarpp_display_demo-nonce').val(),
|
62 |
-
},
|
63 |
-
beforeSend: function () {
|
64 |
-
demo_web.html(loading);
|
65 |
-
},
|
66 |
-
success: function (html) {
|
67 |
-
demo_web.html('<pre>' + html + '</pre>');
|
68 |
-
},
|
69 |
-
dataType: 'html',
|
70 |
-
});
|
71 |
-
}
|
72 |
-
}
|
73 |
-
$('#yarpp_display_web .handlediv, #yarpp_display_web-hide').click(display);
|
74 |
-
display();
|
75 |
-
|
76 |
-
var loaded_demo_rss = false;
|
77 |
function rss_display() {
|
78 |
if (!$('#yarpp_display_rss .inside').is(':visible')) return;
|
79 |
if ($('#yarpp-rss_display').is(':checked')) {
|
80 |
$('.rss_displayed').show();
|
81 |
-
$('.yarpp_code_display').toggle($('#yarpp_display_code').is(':checked'));
|
82 |
-
if (
|
83 |
-
$('#yarpp_display_rss .yarpp_code_display').is(':visible') &&
|
84 |
-
!loaded_demo_rss
|
85 |
-
) {
|
86 |
-
loaded_demo_rss = true;
|
87 |
-
var demo_rss = $('#display_demo_rss');
|
88 |
-
$.ajax({
|
89 |
-
type: 'POST',
|
90 |
-
url: ajaxurl,
|
91 |
-
data: {
|
92 |
-
action: 'yarpp_display_demo',
|
93 |
-
domain: 'rss',
|
94 |
-
_ajax_nonce: $('#yarpp_display_demo-nonce').val(),
|
95 |
-
},
|
96 |
-
beforeSend: function () {
|
97 |
-
demo_rss.html(loading);
|
98 |
-
},
|
99 |
-
success: function (html) {
|
100 |
-
demo_rss.html('<pre>' + html + '</pre>');
|
101 |
-
},
|
102 |
-
dataType: 'html',
|
103 |
-
});
|
104 |
-
}
|
105 |
$('#yarpp_display_rss').each(template);
|
106 |
} else {
|
107 |
$('.rss_displayed').hide();
|
@@ -272,10 +215,347 @@ jQuery(function ($) {
|
|
272 |
spinner.addClass('is-active');
|
273 |
});
|
274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
$('.yarpp_template_button:not(.disabled)').click(function () {
|
276 |
-
$(this).
|
|
|
277 |
$(this).siblings().removeClass('active');
|
278 |
$(this).addClass('active');
|
|
|
|
|
|
|
279 |
});
|
280 |
|
281 |
function template_info() {
|
@@ -306,6 +586,7 @@ jQuery(function ($) {
|
|
306 |
$('#template_file, #rss_template_file').each(template_info).change(template_info);
|
307 |
|
308 |
var loaded_optin_data = false;
|
|
|
309 |
function _display_optin_data() {
|
310 |
if (!$('#optin_data_frame').is(':visible') || loaded_optin_data) return;
|
311 |
loaded_optin_data = true;
|
@@ -326,13 +607,16 @@ jQuery(function ($) {
|
|
326 |
dataType: 'html',
|
327 |
});
|
328 |
}
|
|
|
329 |
function display_optin_data() {
|
330 |
setTimeout(_display_optin_data, 0);
|
331 |
}
|
|
|
332 |
$('#yarpp-optin-learnmore, a[aria-controls=tab-panel-optin]').bind(
|
333 |
'click focus',
|
334 |
display_optin_data,
|
335 |
);
|
|
|
336 |
display_optin_data();
|
337 |
|
338 |
function sync_no_results() {
|
@@ -344,17 +628,6 @@ jQuery(function ($) {
|
|
344 |
}
|
345 |
$('.sync_no_results, .sync_rss_no_results').change(sync_no_results);
|
346 |
|
347 |
-
$('#yarpp_display_code').click(function () {
|
348 |
-
var args = {
|
349 |
-
action: 'yarpp_set_display_code',
|
350 |
-
_ajax_nonce: $('#yarpp_set_display_code-nonce').val(),
|
351 |
-
};
|
352 |
-
if ($(this).is(':checked')) args.checked = true;
|
353 |
-
$.ajax({ type: 'POST', url: ajaxurl, data: args });
|
354 |
-
display();
|
355 |
-
rss_display();
|
356 |
-
});
|
357 |
-
|
358 |
function auto_display_archive() {
|
359 |
var available = $('.yarpp_form_post_types').is(
|
360 |
':has(input[type=checkbox]:checked)',
|
@@ -364,6 +637,7 @@ jQuery(function ($) {
|
|
364 |
}
|
365 |
|
366 |
$('.yarpp_form_post_types input[type=checkbox]').change(auto_display_archive);
|
|
|
367 |
auto_display_archive();
|
368 |
|
369 |
$('#yarpp_fulltext_expand').click(function (e) {
|
@@ -380,6 +654,7 @@ jQuery(function ($) {
|
|
380 |
$(this).text('Show Details [+]');
|
381 |
}
|
382 |
});
|
|
|
383 |
$('.include_post_type input[type=checkbox]').change(function (e) {
|
384 |
var get_attr = $(this).attr('data-post-type');
|
385 |
if ($('#yarpp-same_post_type').is(':checked')) {
|
@@ -391,6 +666,7 @@ jQuery(function ($) {
|
|
391 |
);
|
392 |
}
|
393 |
});
|
|
|
394 |
$('#yarpp-same_post_type').change(function (e) {
|
395 |
var get_checkboxes = '.include_post_type input[type=checkbox]';
|
396 |
if ($(this).is(':checked')) {
|
@@ -444,6 +720,7 @@ jQuery(function ($) {
|
|
444 |
</div>\
|
445 |
',
|
446 |
)[0];
|
|
|
447 |
$('#yarpp-clear-cache').click(function () {
|
448 |
var inst = $(yarpp_model).remodal({
|
449 |
hashTracking: false,
|
@@ -452,6 +729,7 @@ jQuery(function ($) {
|
|
452 |
inst.open();
|
453 |
event.preventDefault();
|
454 |
});
|
|
|
455 |
$(document.body).on('click', '#yarpp-clear-cache-submit', function () {
|
456 |
var inst = $(yarpp_model).remodal();
|
457 |
/**
|
41 |
}
|
42 |
$('.show_excerpt, .use_template, #yarpp-rss_display').click(excerpt);
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
function rss_display() {
|
45 |
if (!$('#yarpp_display_rss .inside').is(':visible')) return;
|
46 |
if ($('#yarpp-rss_display').is(':checked')) {
|
47 |
$('.rss_displayed').show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
$('#yarpp_display_rss').each(template);
|
49 |
} else {
|
50 |
$('.rss_displayed').hide();
|
215 |
spinner.addClass('is-active');
|
216 |
});
|
217 |
|
218 |
+
const show_code_button = document.getElementById('yarpp-preview-show-code');
|
219 |
+
const code_container = document.getElementById('yarpp-display-code-preview');
|
220 |
+
|
221 |
+
function toggle_code_container(force_show = false) {
|
222 |
+
if (code_container.style.display === 'none' || force_show) {
|
223 |
+
code_container.style.display = 'block';
|
224 |
+
|
225 |
+
show_code_button.innerText = yarpp_messages.hide_code;
|
226 |
+
} else {
|
227 |
+
code_container.style.display = 'none';
|
228 |
+
|
229 |
+
show_code_button.innerText = yarpp_messages.show_code;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
if (show_code_button) {
|
234 |
+
show_code_button.addEventListener('click', () => toggle_code_container());
|
235 |
+
}
|
236 |
+
|
237 |
+
const drag_container = document.querySelector(
|
238 |
+
'#yarpp-display-html-preview .yarpp-preview__iframe__container',
|
239 |
+
);
|
240 |
+
|
241 |
+
if (drag_container) {
|
242 |
+
let mouse_position;
|
243 |
+
function resize_html_preview(event) {
|
244 |
+
const dx = event.x - mouse_position;
|
245 |
+
mouse_position = event.x;
|
246 |
+
drag_container.style.width =
|
247 |
+
parseInt(getComputedStyle(drag_container, '').width) + dx + 'px';
|
248 |
+
update_preview_width_ui();
|
249 |
+
}
|
250 |
+
|
251 |
+
drag_container.addEventListener('mousedown', function (e) {
|
252 |
+
const dragger_position = e.layerX - e.offsetX;
|
253 |
+
if (dragger_position < 50) {
|
254 |
+
mouse_position = e.x;
|
255 |
+
document.addEventListener('mousemove', resize_html_preview, false);
|
256 |
+
}
|
257 |
+
});
|
258 |
+
document.addEventListener('mouseup', function () {
|
259 |
+
document.removeEventListener('mousemove', resize_html_preview, false);
|
260 |
+
});
|
261 |
+
}
|
262 |
+
|
263 |
+
let preview_body = {};
|
264 |
+
|
265 |
+
function handle_change(field, event, target_value = 'value') {
|
266 |
+
const new_value = event.target[target_value];
|
267 |
+
if (target_value === 'checked') {
|
268 |
+
preview_body[field] = new_value ? 1 : 0;
|
269 |
+
} else {
|
270 |
+
preview_body[field] = new_value;
|
271 |
+
}
|
272 |
+
show_display_preview();
|
273 |
+
}
|
274 |
+
|
275 |
+
const limit_input = document.querySelector('#limit[name=limit]');
|
276 |
+
if (limit_input) {
|
277 |
+
limit_input.addEventListener('blur', (e) => handle_change('limit', e));
|
278 |
+
}
|
279 |
+
|
280 |
+
const promote_yarpp_checkbox = document.querySelector(
|
281 |
+
'#yarpp-promote_yarpp[name=promote_yarpp]',
|
282 |
+
);
|
283 |
+
if (promote_yarpp_checkbox) {
|
284 |
+
promote_yarpp_checkbox.addEventListener('change', (e) =>
|
285 |
+
handle_change('promote_yarpp', e, 'checked'),
|
286 |
+
);
|
287 |
+
}
|
288 |
+
|
289 |
+
const order_select = document.querySelector('#order[name=order]');
|
290 |
+
if (order_select) {
|
291 |
+
order_select.addEventListener('change', (e) => handle_change('order', e));
|
292 |
+
}
|
293 |
+
|
294 |
+
const custom_template_select = document.querySelector(
|
295 |
+
'#template_file[name=template_file]',
|
296 |
+
);
|
297 |
+
if (custom_template_select) {
|
298 |
+
custom_template_select.addEventListener('change', (e) =>
|
299 |
+
handle_change('template', e),
|
300 |
+
);
|
301 |
+
}
|
302 |
+
|
303 |
+
const thumbnails_template_size_radio = document.querySelectorAll(
|
304 |
+
'input[name=thumbnail_size_display]',
|
305 |
+
);
|
306 |
+
if (thumbnails_template_size_radio.length > 0) {
|
307 |
+
thumbnails_template_size_radio.forEach((radio_button) => {
|
308 |
+
radio_button.addEventListener('change', (e) => handle_change('size', e));
|
309 |
+
});
|
310 |
+
}
|
311 |
+
|
312 |
+
const custom_template_size_radio = document.querySelectorAll(
|
313 |
+
'input[name=custom_theme_thumbnail_size_display]',
|
314 |
+
);
|
315 |
+
if (custom_template_size_radio.length > 0) {
|
316 |
+
custom_template_size_radio.forEach((radio_button) => {
|
317 |
+
radio_button.addEventListener('change', (e) => handle_change('size', e));
|
318 |
+
});
|
319 |
+
}
|
320 |
+
|
321 |
+
const thumbnails_heading_input = document.querySelector(
|
322 |
+
'#thumbnails_heading[name=thumbnails_heading]',
|
323 |
+
);
|
324 |
+
if (thumbnails_heading_input) {
|
325 |
+
thumbnails_heading_input.addEventListener('blur', (e) =>
|
326 |
+
handle_change('thumbnails_heading', e),
|
327 |
+
);
|
328 |
+
}
|
329 |
+
|
330 |
+
const thumbnails_default_input = document.querySelector(
|
331 |
+
'#thumbnails_default[name=thumbnails_default]',
|
332 |
+
);
|
333 |
+
if (thumbnails_default_input) {
|
334 |
+
thumbnails_default_input.addEventListener('blur', (e) =>
|
335 |
+
handle_change('thumbnails_default', e),
|
336 |
+
);
|
337 |
+
}
|
338 |
+
|
339 |
+
const list_before_related_input = document.querySelector(
|
340 |
+
'#before_related[name=before_related]',
|
341 |
+
);
|
342 |
+
if (list_before_related_input) {
|
343 |
+
list_before_related_input.addEventListener('blur', (e) =>
|
344 |
+
handle_change('before_related', e),
|
345 |
+
);
|
346 |
+
}
|
347 |
+
|
348 |
+
const list_after_related_input = document.querySelector(
|
349 |
+
'#after_related[name=after_related]',
|
350 |
+
);
|
351 |
+
if (list_after_related_input) {
|
352 |
+
list_after_related_input.addEventListener('blur', (e) =>
|
353 |
+
handle_change('after_related', e),
|
354 |
+
);
|
355 |
+
}
|
356 |
+
|
357 |
+
const list_before_title_input = document.querySelector(
|
358 |
+
'#before_title[name=before_title]',
|
359 |
+
);
|
360 |
+
if (list_before_title_input) {
|
361 |
+
list_before_title_input.addEventListener('blur', (e) =>
|
362 |
+
handle_change('before_title', e),
|
363 |
+
);
|
364 |
+
}
|
365 |
+
|
366 |
+
const list_after_title_input = document.querySelector(
|
367 |
+
'#after_title[name=after_title]',
|
368 |
+
);
|
369 |
+
if (list_after_title_input) {
|
370 |
+
list_after_title_input.addEventListener('blur', (e) =>
|
371 |
+
handle_change('after_title', e),
|
372 |
+
);
|
373 |
+
}
|
374 |
+
|
375 |
+
const list_show_excerpt = document.querySelector(
|
376 |
+
'#yarpp-show_excerpt[name=show_excerpt]',
|
377 |
+
);
|
378 |
+
if (list_show_excerpt) {
|
379 |
+
list_show_excerpt.addEventListener('change', (e) =>
|
380 |
+
handle_change('show_excerpt', e, 'checked'),
|
381 |
+
);
|
382 |
+
}
|
383 |
+
|
384 |
+
const list_excerpt_length = document.querySelector(
|
385 |
+
'#excerpt_length[name=excerpt_length]',
|
386 |
+
);
|
387 |
+
if (list_excerpt_length) {
|
388 |
+
list_excerpt_length.addEventListener('blur', (e) =>
|
389 |
+
handle_change('excerpt_length', e),
|
390 |
+
);
|
391 |
+
}
|
392 |
+
|
393 |
+
const list_before_post_input = document.querySelector(
|
394 |
+
'#before_post[name=before_post]',
|
395 |
+
);
|
396 |
+
if (list_before_post_input) {
|
397 |
+
list_before_post_input.addEventListener('blur', (e) =>
|
398 |
+
handle_change('before_post', e),
|
399 |
+
);
|
400 |
+
}
|
401 |
+
|
402 |
+
const list_after_post_input = document.querySelector('#after_post[name=after_post]');
|
403 |
+
if (list_after_post_input) {
|
404 |
+
list_after_post_input.addEventListener('blur', (e) =>
|
405 |
+
handle_change('after_post', e),
|
406 |
+
);
|
407 |
+
}
|
408 |
+
|
409 |
+
function set_preview_width(width) {
|
410 |
+
drag_container.style.width = width + 'px';
|
411 |
+
update_preview_width_ui();
|
412 |
+
}
|
413 |
+
|
414 |
+
function update_preview_width_ui() {
|
415 |
+
const backdrop = document.querySelector('.yarpp-preview__iframe__backdrop');
|
416 |
+
// Compute and display template preview iframe width in UI
|
417 |
+
if (backdrop) {
|
418 |
+
document.querySelector(
|
419 |
+
'#yarpp-preview__show-preview-width__value',
|
420 |
+
).innerText = backdrop.offsetWidth - 20 + 'px';
|
421 |
+
}
|
422 |
+
}
|
423 |
+
|
424 |
+
// If the browser window is resized, update template preview iframe width displayed in UI
|
425 |
+
window.addEventListener('resize', update_preview_width_ui);
|
426 |
+
|
427 |
+
const preview_mobile_button = document.querySelector('#yarpp-preview-mobile');
|
428 |
+
if (preview_mobile_button) {
|
429 |
+
preview_mobile_button.addEventListener('click', (e) => set_preview_width(320));
|
430 |
+
}
|
431 |
+
|
432 |
+
const preview_tablet_button = document.querySelector('#yarpp-preview-tablet');
|
433 |
+
if (preview_tablet_button) {
|
434 |
+
preview_tablet_button.addEventListener('click', (e) => set_preview_width(768));
|
435 |
+
}
|
436 |
+
|
437 |
+
const preview_desktop_button = document.querySelector('#yarpp-preview-desktop');
|
438 |
+
if (preview_desktop_button) {
|
439 |
+
preview_desktop_button.addEventListener('click', (e) => set_preview_width(1200));
|
440 |
+
}
|
441 |
+
|
442 |
+
function show_display_preview(template = null) {
|
443 |
+
// disables the Show Button and waits until it's available to enable it again
|
444 |
+
show_code_button.setAttribute('disabled', 'disabled');
|
445 |
+
var html_frame = $(
|
446 |
+
'#yarpp-display-html-preview .yarpp-preview__iframe__container',
|
447 |
+
);
|
448 |
+
var code_frame = $('#yarpp-display-code-preview');
|
449 |
+
const backdrop = document.querySelector(
|
450 |
+
'#yarpp-display-html-preview div.yarpp-preview__iframe__backdrop',
|
451 |
+
);
|
452 |
+
|
453 |
+
update_preview_width_ui();
|
454 |
+
|
455 |
+
if (template) {
|
456 |
+
// if the template is custom, checks the custom select template and changes it
|
457 |
+
if (template === 'custom') {
|
458 |
+
preview_body.template = custom_template_select.value;
|
459 |
+
let checked_value = null;
|
460 |
+
|
461 |
+
custom_template_size_radio.forEach((rb) => {
|
462 |
+
if (rb.checked) {
|
463 |
+
checked_value = rb.value;
|
464 |
+
}
|
465 |
+
});
|
466 |
+
if (checked_value) {
|
467 |
+
preview_body.size = checked_value;
|
468 |
+
}
|
469 |
+
} else {
|
470 |
+
preview_body.template = template;
|
471 |
+
}
|
472 |
+
|
473 |
+
if (template === 'thumbnails') {
|
474 |
+
thumbnails_template_size_radio.forEach((rb) => {
|
475 |
+
if (rb.checked) {
|
476 |
+
checked_value = rb.value;
|
477 |
+
}
|
478 |
+
});
|
479 |
+
if (checked_value) {
|
480 |
+
preview_body.size = checked_value;
|
481 |
+
}
|
482 |
+
}
|
483 |
+
}
|
484 |
+
|
485 |
+
$.ajax({
|
486 |
+
type: 'POST',
|
487 |
+
url: ajaxurl,
|
488 |
+
data: {
|
489 |
+
action: 'yarpp_display_preview',
|
490 |
+
_ajax_nonce: $('#yarpp_display_preview-nonce').val(),
|
491 |
+
...preview_body,
|
492 |
+
},
|
493 |
+
beforeSend: function () {
|
494 |
+
html_frame.html(loading);
|
495 |
+
},
|
496 |
+
success: function (response) {
|
497 |
+
const json = JSON.parse(response);
|
498 |
+
const inline_css = document.createElement('style');
|
499 |
+
inline_css.appendChild(document.createTextNode(json.styles));
|
500 |
+
const preview_iframe = document.createElement('iframe');
|
501 |
+
preview_iframe.width = '100%';
|
502 |
+
preview_iframe.height = '100%';
|
503 |
+
preview_iframe.style =
|
504 |
+
'overflow: hidden; user-select: none; outline: 0; background-color: white;';
|
505 |
+
html_frame.html(preview_iframe);
|
506 |
+
html_frame.prepend(backdrop);
|
507 |
+
|
508 |
+
preview_iframe.onload = (event) => {
|
509 |
+
const iframe_document = event.target.contentWindow.document;
|
510 |
+
iframe_document
|
511 |
+
.getElementsByTagName('head')[0]
|
512 |
+
.appendChild(inline_css);
|
513 |
+
iframe_document.body.innerHTML = json.html;
|
514 |
+
iframe_document.body.style = 'overflow:hidden;';
|
515 |
+
};
|
516 |
+
|
517 |
+
if ('codeEditor' in wp) {
|
518 |
+
toggle_code_container(true);
|
519 |
+
const settings = {
|
520 |
+
...wp.codeEditor.defaultSettings,
|
521 |
+
type: 'text/html',
|
522 |
+
codemirror: {
|
523 |
+
...wp.codeEditor.defaultSettings.codemirror,
|
524 |
+
indentUnit: 2,
|
525 |
+
tabSize: 2,
|
526 |
+
readOnly: true,
|
527 |
+
},
|
528 |
+
};
|
529 |
+
code_frame.html(
|
530 |
+
'<textarea id="yarpp-preview-code-textarea">' +
|
531 |
+
json.code +
|
532 |
+
'</textarea>',
|
533 |
+
);
|
534 |
+
wp.codeEditor.initialize(
|
535 |
+
document.getElementById('yarpp-preview-code-textarea'),
|
536 |
+
settings,
|
537 |
+
);
|
538 |
+
toggle_code_container();
|
539 |
+
} else {
|
540 |
+
code_frame.html('<pre><code>' + json.code + '</code></pre>');
|
541 |
+
}
|
542 |
+
// removes the disabled when it's ready
|
543 |
+
show_code_button.removeAttribute('disabled');
|
544 |
+
},
|
545 |
+
dataType: 'html',
|
546 |
+
});
|
547 |
+
}
|
548 |
+
|
549 |
+
show_display_preview();
|
550 |
+
|
551 |
$('.yarpp_template_button:not(.disabled)').click(function () {
|
552 |
+
const current_template = $(this).attr('data-value');
|
553 |
+
$(this).siblings('input').val(current_template).change();
|
554 |
$(this).siblings().removeClass('active');
|
555 |
$(this).addClass('active');
|
556 |
+
if ($(this).parents('#yarpp_display_web').length) {
|
557 |
+
show_display_preview(current_template);
|
558 |
+
}
|
559 |
});
|
560 |
|
561 |
function template_info() {
|
586 |
$('#template_file, #rss_template_file').each(template_info).change(template_info);
|
587 |
|
588 |
var loaded_optin_data = false;
|
589 |
+
|
590 |
function _display_optin_data() {
|
591 |
if (!$('#optin_data_frame').is(':visible') || loaded_optin_data) return;
|
592 |
loaded_optin_data = true;
|
607 |
dataType: 'html',
|
608 |
});
|
609 |
}
|
610 |
+
|
611 |
function display_optin_data() {
|
612 |
setTimeout(_display_optin_data, 0);
|
613 |
}
|
614 |
+
|
615 |
$('#yarpp-optin-learnmore, a[aria-controls=tab-panel-optin]').bind(
|
616 |
'click focus',
|
617 |
display_optin_data,
|
618 |
);
|
619 |
+
|
620 |
display_optin_data();
|
621 |
|
622 |
function sync_no_results() {
|
628 |
}
|
629 |
$('.sync_no_results, .sync_rss_no_results').change(sync_no_results);
|
630 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
631 |
function auto_display_archive() {
|
632 |
var available = $('.yarpp_form_post_types').is(
|
633 |
':has(input[type=checkbox]:checked)',
|
637 |
}
|
638 |
|
639 |
$('.yarpp_form_post_types input[type=checkbox]').change(auto_display_archive);
|
640 |
+
|
641 |
auto_display_archive();
|
642 |
|
643 |
$('#yarpp_fulltext_expand').click(function (e) {
|
654 |
$(this).text('Show Details [+]');
|
655 |
}
|
656 |
});
|
657 |
+
|
658 |
$('.include_post_type input[type=checkbox]').change(function (e) {
|
659 |
var get_attr = $(this).attr('data-post-type');
|
660 |
if ($('#yarpp-same_post_type').is(':checked')) {
|
666 |
);
|
667 |
}
|
668 |
});
|
669 |
+
|
670 |
$('#yarpp-same_post_type').change(function (e) {
|
671 |
var get_checkboxes = '.include_post_type input[type=checkbox]';
|
672 |
if ($(this).is(':checked')) {
|
720 |
</div>\
|
721 |
',
|
722 |
)[0];
|
723 |
+
|
724 |
$('#yarpp-clear-cache').click(function () {
|
725 |
var inst = $(yarpp_model).remodal({
|
726 |
hashTracking: false,
|
729 |
inst.open();
|
730 |
event.preventDefault();
|
731 |
});
|
732 |
+
|
733 |
$(document.body).on('click', '#yarpp-clear-cache-submit', function () {
|
734 |
var inst = $(yarpp_model).remodal();
|
735 |
/**
|
style/options_basic.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#yarpp_author_text{width:900px}.yarpp-red{color:#dc3232}.yarpp-no-float{float:none;margin-bottom:5px}.form-table td{line-height:11px}ul.yarpp_contacts li{line-height:22px;padding:0 0 0 30px}body.rtl ul.yarpp_contacts li{padding:0 30px 0 0}ul.yarpp_contacts li a img{vertical-align:bottom}.postbox .wp-pointer-buttons{display:none}#tab-panel-dev,#tab-panel-faq{direction:ltr}.icon{background-image:url(../images/sprites.png);height:22px;margin-left:-29px;margin-top:-1px;position:absolute;width:22px}body.rtl .icon{margin-left:none;margin-right:-29px}@media only screen and (-webkit-min-device-pixel-ratio:1.5){.icon{background-image:url(../images/sprites-2x.png);background-size:132px 22px}}.icon-wordpress{background-position:0 0}.icon-twitter{background-position:-22px 0}.icon-plugin{background-position:-44px 0}.icon-star{background-position:-66px 0}.icon-pro{background-position:-88px 0}.icon-facebook{background-position:-110px 0}.icon-star:hover,.icon.spin{animation:yarpp-spin 3s ease 2s 1 normal none;-o-animation:yarpp-spin 3s ease 2s 1 normal none;-webkit-animation:yarpp-spin 3s ease 2s 1 normal none;-moz-animation:yarpp-spin 3s ease 2s 1 normal none;transform-origin:11px 12px;-o-transform-origin:11px 12px;-webkit-transform-origin:11px 12px;-moz-transform-origin:11px 12px;z-index:1}@keyframes yarpp-spin{0%{transform:rotate(0deg) scale(1)}5%{transform:rotate(0deg) scale(1.5)}to{transform:rotate(1turn) scale(1)}}@-webkit-keyframes yarpp-spin{0%{-webkit-transform:rotate(0deg) scale(1)}5%{-webkit-transform:rotate(0deg) scale(1.5)}to{-webkit-transform:rotate(1turn) scale(1)}}a.info{position:relative;z-index:24}.yarpp_help .wp-pointer-content p{font-family:sans-serif;text-align:left}a.yarpp_help{cursor:pointer;text-decoration:none}a.yarpp_help:hover{background-position:-520px 0;text-decoration:none}.exclude_terms span{display:inline-block}#yarpp_display_optin.yarpp_attention{border:2px solid #bbb}.yarpp_subbox{background:#fdfdfd;margin-bottom:5px}.yarpp_form_row{overflow:visible;padding:8px}.yarpp_form_row>div{display:inline-block;vertical-align:top}.yarpp_form_row>div>label{vertical-align:baseline}.yarpp_form_select>div{padding-bottom:5px;padding-top:5px}.yarpp_form_select+.yarpp_form_select{padding-top:0}.yarpp_form_label{width:25%}.yarpp_form_label+div{padding-left:16px;width:70%}.yarpp_form_select>.yarpp_form_label{padding-top:8px}.yarpp_form_post_types label{display:inline-block;line-height:20px;padding-right:15px}body.rtl .yarpp_form_post_types label{padding-left:15px;padding-right:inherit}.yarpp_form_exclude label{line-height:15px;padding-right:5px}body.rtl .yarpp_form_exclude label{padding-left:5px;padding-right:inherit}.yarpp_form_template_file>.yarpp_form_label{padding-top:5px;vertical-align:top}.yarpp_code_display{border-left:8px solid transparent;float:right;width:50%}body.rtl .yarpp_code_display{float:left}.yarpp_code_display div{max-height:300px;overflow:auto}.yarpp_code_display pre{direction:ltr}.yarpp_scroll_wrapper{max-height:100px;min-height:25px;overflow:auto;vertical-align:middle;width:60%}@media (max-width:1200px){.yarpp_scroll_wrapper{width:50%}.yarpp_code_display{max-width:60%}}#yarpp-optin-learnmore{float:right}body.rtl #yarpp-optin-learnmore{float:left}.template_author_wrap,.template_description_wrap,.template_file_wrap{margin:3px 0}.template_file_wrap{font-family:monospace}.yarpp_subbox input[type=text]{font-family:monospace;width:35%}.yarpp_form_template_buttons{padding:0}.yarpp_template_button{background:#f3f3f3;background-image:linear-gradient(180deg,#fefefe,#f4f4f4);border:1px solid #aaa;border-radius:7px;box-shadow:1px 1px 7px 1px #bbb;color:#333;cursor:pointer;height:60px;margin:10px 5px 20px 10px;padding:8px;position:relative;text-shadow:0 1px 0 #fff;width:70px}.yarpp_template_button.disabled,.yarpp_template_button.disabled:active,.yarpp_template_button.disabled:hover{background:#f3f3f3;background-image:linear-gradient(180deg,#fefefe,#f4f4f4);border-color:#ddd;box-shadow:none}.yarpp_template_button.disabled>div.label{color:#bbb}.yarpp_template_button:hover{border-color:#999;color:#222}.yarpp_template_button.active,.yarpp_template_button:active{background:#eee;background-image:linear-gradient(180deg,#eee,#f4f4f4);border-color:#999;box-shadow:inset 0 2px 8px -2px rgba(0,0,0,.5);text-shadow:0 -1px 0 #fff}.yarpp_template_button>div.label{bottom:8px;position:absolute;text-align:center;width:70px}.yarpp_template_button>div.image{background-image:url(../images/template-buttons-2x.png);background-size:210px 40px;height:40px;opacity:.8;width:70px}.yarpp_template_button.disabled>div.image{opacity:.2}.yarpp_template_button:active>div.image{opacity:1}.yarpp_template_button[data-value=builtin]>div.image{background-position:0 0}.yarpp_template_button[data-value=thumbnails]>div.image{background-position:-70px 0}.yarpp_template_button[data-value=custom]>div.image{background-position:-140px 0}#optin_data_frame{direction:ltr;max-height:300px;overflow:scroll}#yarpp_extra_screen_settings{border-top:1px solid #e0e0e0}.help-tab-content{max-height:500px;overflow:auto;width:100%}.yarpp_red{color:red;font-weight:700}.yarpp_separated{display:inline-block;margin:1.5em 1em}.yarpp-callout{border:1px solid #ccd0d4;border-left-width:4px;margin:5px 0 15px;padding:1px 12px}.yarpp-notice{border-left-color:#ffb900}.yarpp-disabled{background:#f6f7f7!important;border-color:#dcdcde!important;box-shadow:none!important;color:#a7aaad!important;cursor:not-allowed!important;text-shadow:none!important}
|
1 |
+
#yarpp_author_text{width:900px}.yarpp-red{color:#dc3232}.yarpp-no-float{float:none;margin-bottom:5px}.form-table td{line-height:11px}ul.yarpp_contacts li{line-height:22px;padding:0 0 0 30px}body.rtl ul.yarpp_contacts li{padding:0 30px 0 0}ul.yarpp_contacts li a img{vertical-align:bottom}.postbox .wp-pointer-buttons{display:none}#tab-panel-dev,#tab-panel-faq{direction:ltr}.icon{background-image:url(../images/sprites.png);height:22px;margin-left:-29px;margin-top:-1px;position:absolute;width:22px}body.rtl .icon{margin-left:none;margin-right:-29px}@media only screen and (-webkit-min-device-pixel-ratio:1.5){.icon{background-image:url(../images/sprites-2x.png);background-size:132px 22px}}.icon-wordpress{background-position:0 0}.icon-twitter{background-position:-22px 0}.icon-plugin{background-position:-44px 0}.icon-star{background-position:-66px 0}.icon-pro{background-position:-88px 0}.icon-facebook{background-position:-110px 0}.icon-star:hover,.icon.spin{animation:yarpp-spin 3s ease 2s 1 normal none;-o-animation:yarpp-spin 3s ease 2s 1 normal none;-webkit-animation:yarpp-spin 3s ease 2s 1 normal none;-moz-animation:yarpp-spin 3s ease 2s 1 normal none;transform-origin:11px 12px;-o-transform-origin:11px 12px;-webkit-transform-origin:11px 12px;-moz-transform-origin:11px 12px;z-index:1}@keyframes yarpp-spin{0%{transform:rotate(0deg) scale(1)}5%{transform:rotate(0deg) scale(1.5)}to{transform:rotate(1turn) scale(1)}}@-webkit-keyframes yarpp-spin{0%{-webkit-transform:rotate(0deg) scale(1)}5%{-webkit-transform:rotate(0deg) scale(1.5)}to{-webkit-transform:rotate(1turn) scale(1)}}a.info{position:relative;z-index:24}.yarpp_help .wp-pointer-content p{font-family:sans-serif;text-align:left}a.yarpp_help{cursor:pointer;text-decoration:none}a.yarpp_help:hover{background-position:-520px 0;text-decoration:none}.exclude_terms span{display:inline-block}#yarpp_display_optin.yarpp_attention{border:2px solid #bbb}.yarpp_subbox{background:#fdfdfd;margin-bottom:5px}.yarpp_form_row{overflow:visible;padding:8px}.yarpp_form_row>div{display:inline-block;vertical-align:top}.yarpp_form_row>div>label{vertical-align:baseline}.yarpp_form_select>div{padding-bottom:5px;padding-top:5px}.yarpp_form_select+.yarpp_form_select{padding-top:0}.yarpp_form_label{width:25%}.yarpp_form_label+div{padding-left:16px;width:70%}.yarpp_form_select>.yarpp_form_label{padding-top:8px}.yarpp_form_post_types label{display:inline-block;line-height:20px;padding-right:15px}body.rtl .yarpp_form_post_types label{padding-left:15px;padding-right:inherit}.yarpp_form_exclude label{line-height:15px;padding-right:5px}body.rtl .yarpp_form_exclude label{padding-left:5px;padding-right:inherit}.yarpp_form_template_file>.yarpp_form_label{padding-top:5px;vertical-align:top}.yarpp_code_display{border-left:8px solid transparent;float:right;width:50%}body.rtl .yarpp_code_display{float:left}.yarpp_code_display div{max-height:300px;overflow:auto}.yarpp_code_display pre{direction:ltr}.yarpp_scroll_wrapper{max-height:100px;min-height:25px;overflow:auto;vertical-align:middle;width:60%}@media (max-width:1200px){.yarpp_scroll_wrapper{width:50%}.yarpp_code_display{max-width:60%}}#yarpp-optin-learnmore{float:right}body.rtl #yarpp-optin-learnmore{float:left}.template_author_wrap,.template_description_wrap,.template_file_wrap{margin:3px 0}.template_file_wrap{font-family:monospace}.yarpp_subbox input[type=text]{font-family:monospace;width:35%}.yarpp_form_template_buttons{padding:0}.yarpp_template_button{background:#f3f3f3;background-image:linear-gradient(180deg,#fefefe,#f4f4f4);border:1px solid #aaa;border-radius:7px;box-shadow:1px 1px 7px 1px #bbb;color:#333;cursor:pointer;height:60px;margin:10px 5px 20px 10px;padding:8px;position:relative;text-shadow:0 1px 0 #fff;width:70px}.yarpp_template_button.disabled,.yarpp_template_button.disabled:active,.yarpp_template_button.disabled:hover{background:#f3f3f3;background-image:linear-gradient(180deg,#fefefe,#f4f4f4);border-color:#ddd;box-shadow:none}.yarpp_template_button.disabled>div.label{color:#bbb}.yarpp_template_button:hover{border-color:#999;color:#222}.yarpp_template_button.active,.yarpp_template_button:active{background:#eee;background-image:linear-gradient(180deg,#eee,#f4f4f4);border-color:#999;box-shadow:inset 0 2px 8px -2px rgba(0,0,0,.5);text-shadow:0 -1px 0 #fff}.yarpp_template_button>div.label{bottom:8px;position:absolute;text-align:center;width:70px}.yarpp_template_button>div.image{background-image:url(../images/template-buttons-2x.png);background-size:210px 40px;height:40px;opacity:.8;width:70px}.yarpp_template_button.disabled>div.image{opacity:.2}.yarpp_template_button:active>div.image{opacity:1}.yarpp_template_button[data-value=builtin]>div.image{background-position:0 0}.yarpp_template_button[data-value=thumbnails]>div.image{background-position:-70px 0}.yarpp_template_button[data-value=custom]>div.image{background-position:-140px 0}#optin_data_frame{direction:ltr;max-height:300px;overflow:scroll}#yarpp_extra_screen_settings{border-top:1px solid #e0e0e0}.help-tab-content{max-height:500px;overflow:auto;width:100%}.yarpp_red{color:red;font-weight:700}.yarpp_separated{display:inline-block;margin:1.5em 1em}.yarpp-callout{border:1px solid #ccd0d4;border-left-width:4px;margin:5px 0 15px;padding:1px 12px}.yarpp-notice{border-left-color:#ffb900}.yarpp-disabled{background:#f6f7f7!important;border-color:#dcdcde!important;box-shadow:none!important;color:#a7aaad!important;cursor:not-allowed!important;text-shadow:none!important}.yarpp-preview__wrapper{align-items:center;display:flex;flex-direction:column;position:relative}.yarpp-preview__title{align-self:flex-start}#yarpp-display-html-preview{display:grid;grid-template-columns:100%;grid-template-rows:1fr auto;height:660px;position:relative}#yarpp-display-code-preview,#yarpp-display-html-preview{background-color:#fafafa;border:1px solid #e4e4e7;width:100%}#yarpp-display-code-preview{border-top:none}#yarpp-display-code-preview pre code{background-color:#fafafa;display:block;font-size:.9em;max-height:320px;overflow-y:auto;padding:16px;white-space:pre-wrap}.yarpp-preview__wrapper .yarpp-preview__iframe__container{border:12px solid #374151;border-radius:12px;height:calc(100% - 72px);margin:36px auto;max-width:calc(100% - 60px);min-width:320px;padding-right:20px;position:relative}.yarpp-preview__wrapper .yarpp-preview__iframe__backdrop{cursor:col-resize;height:100%;left:50%;outline:0;position:absolute;right:0;top:50%;transform:translate(-50%,-50%);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.yarpp-preview__wrapper .yarpp-preview__iframe__container:after{align-items:center;background-color:#f3f4f6;border-left:1px solid #d1d5db;content:url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path d="M8 5a1 1 0 100 2h5.586l-1.293 1.293a1 1 0 001.414 1.414l3-3a1 1 0 000-1.414l-3-3a1 1 0 10-1.414 1.414L13.586 5H8zM12 15a1 1 0 100-2H6.414l1.293-1.293a1 1 0 10-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L6.414 15H12z" /></svg>');cursor:col-resize;display:flex;height:100%;position:absolute;right:0;top:0;width:20px}.yarpp-preview__wrapper .yarpp-preview__dragger{background-color:red;height:100%;width:20px}.yarpp-preview__media__controls{align-content:center;align-items:center;border-bottom:1px solid #e4e4e7;-moz-column-gap:1rem;column-gap:1rem;display:none;grid-template-columns:repeat(auto-fit,160px);height:100px;justify-content:center;row-gap:1rem;width:100%}.yarpp-preview__show-code{align-items:center;display:grid;height:64px;justify-items:flex-start;margin-left:1rem}.yarpp-preview__show-preview-width{text-align:center}#yarpp-preview-desktop{display:none}@media screen and (min-width:767px){.yarpp-preview__media__controls{display:grid}#yarpp-display-html-preview{grid-template-rows:auto 1fr auto}}@media screen and (min-width:1200px){.yarpp-preview__media__controls{display:grid;height:64px}#yarpp-preview-desktop{display:block}#yarpp-display-html-preview{grid-template-rows:auto 1fr auto;height:720px}}
|
style/styles_thumbnails.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.yarpp-thumbnail-default,.yarpp-thumbnail-title,.yarpp-thumbnails-horizontal .yarpp-thumbnail{display:inline-block}.yarpp-thumbnails-horizontal .yarpp-thumbnail{border:1px solid
|
1 |
+
.yarpp-thumbnail-default,.yarpp-thumbnail-title,.yarpp-thumbnails-horizontal .yarpp-thumbnail{display:inline-block}.yarpp-thumbnails-horizontal .yarpp-thumbnail{border:1px solid rgba(127,127,127,.1);vertical-align:top}.yarpp-thumbnails-horizontal .yarpp-thumbnail-default,.yarpp-thumbnails-horizontal .yarpp-thumbnail>img{display:block}.yarpp-thumbnails-horizontal .yarpp-thumbnail-title{font-size:1em;line-height:1.4em;max-height:2.8em;overflow:hidden;text-decoration:inherit}.yarpp-thumbnail-default{overflow:hidden}
|
yarpp.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Yet Another Related Posts Plugin (YARPP)
|
4 |
Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm.
|
5 |
-
Version: 5.
|
6 |
Author: YARPP
|
7 |
Author URI: https://yarpp.com/
|
8 |
Plugin URI: https://yarpp.com/
|
@@ -25,7 +25,7 @@ if ( ! defined( 'WP_CONTENT_DIR' ) ) {
|
|
25 |
define( 'WP_CONTENT_DIR', substr( $tr, 0, strrpos( $tr, '/' ) ) );
|
26 |
}
|
27 |
|
28 |
-
define( 'YARPP_VERSION', '5.
|
29 |
|
30 |
define( 'YARPP_DIR', dirname( __FILE__ ) );
|
31 |
/**
|
@@ -81,6 +81,7 @@ require_once YARPP_DIR . '/classes/YARPP_Block.php';
|
|
81 |
require_once YARPP_DIR . '/classes/YARPP_Widget.php';
|
82 |
require_once YARPP_DIR . '/classes/YARPP_Cache.php';
|
83 |
require_once YARPP_DIR . '/classes/YARPP_Cache_Bypass.php';
|
|
|
84 |
require_once YARPP_DIR . '/classes/YARPP_Cache_' . ucfirst( YARPP_CACHE_TYPE ) . '.php';
|
85 |
require_once YARPP_DIR . '/lib/plugin-deactivation-survey/deactivate-feedback-form.php';
|
86 |
require_once YARPP_DIR . '/classes/YARPP_DB_Schema.php';
|
2 |
/*
|
3 |
Plugin Name: Yet Another Related Posts Plugin (YARPP)
|
4 |
Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm.
|
5 |
+
Version: 5.26.0
|
6 |
Author: YARPP
|
7 |
Author URI: https://yarpp.com/
|
8 |
Plugin URI: https://yarpp.com/
|
25 |
define( 'WP_CONTENT_DIR', substr( $tr, 0, strrpos( $tr, '/' ) ) );
|
26 |
}
|
27 |
|
28 |
+
define( 'YARPP_VERSION', '5.26.0' );
|
29 |
|
30 |
define( 'YARPP_DIR', dirname( __FILE__ ) );
|
31 |
/**
|
81 |
require_once YARPP_DIR . '/classes/YARPP_Widget.php';
|
82 |
require_once YARPP_DIR . '/classes/YARPP_Cache.php';
|
83 |
require_once YARPP_DIR . '/classes/YARPP_Cache_Bypass.php';
|
84 |
+
require_once YARPP_DIR . '/classes/YARPP_Cache_Demo_Bypass.php';
|
85 |
require_once YARPP_DIR . '/classes/YARPP_Cache_' . ucfirst( YARPP_CACHE_TYPE ) . '.php';
|
86 |
require_once YARPP_DIR . '/lib/plugin-deactivation-survey/deactivate-feedback-form.php';
|
87 |
require_once YARPP_DIR . '/classes/YARPP_DB_Schema.php';
|