55 * Description: Show a random post on every page load.
66 * Plugin URI: http://wpscholar.com/wordpress-plugins/random-post-on-refresh/
77 * Author: Micah Wood
8- * Author URI: http ://wpscholar.com
9- * Version: 1.1
8+ * Author URI: https ://wpscholar.com
9+ * Version: 1.1.1
1010 * Text Domain: random-post-on-refresh
1111 * License: GPL3
1212 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
13- * Copyright 2018 by Micah Wood - All rights reserved.
13+ * Copyright 2018-2019 by Micah Wood - All rights reserved.
1414 */
1515
1616if ( ! class_exists ( 'RandomPostOnRefresh ' ) ) {
@@ -80,10 +80,10 @@ function ( $group ) {
8080 );
8181
8282 $ can_show = [ 'title ' , 'image ' , 'excerpt ' , 'content ' ];
83- $ show = array_merge ( ...$ groups );
83+ $ show = array_merge ( ...$ groups );
8484
85- $ show_title = in_array ( 'title ' , $ show , true );
86- $ show_image = in_array ( 'image ' , $ show , true );
85+ $ show_title = in_array ( 'title ' , $ show , true );
86+ $ show_image = in_array ( 'image ' , $ show , true );
8787 $ show_excerpt = in_array ( 'excerpt ' , $ show , true );
8888 $ show_content = in_array ( 'content ' , $ show , true );
8989
@@ -99,7 +99,7 @@ function ( $group ) {
9999 if ( ! empty ( $ atts ['taxonomy ' ] ) && ! taxonomy_exists ( $ atts ['taxonomy ' ] ) ) {
100100 return self ::error (
101101 sprintf (
102- // Translators: %1$s is replaced with taxonomy shortcode argument and %2$s is replaced with a comma-separated list of available taxonomies.
102+ // Translators: %1$s is replaced with taxonomy shortcode argument and %2$s is replaced with a comma-separated list of available taxonomies.
103103 __ ( 'Sorry, taxonomy "%1$s" is invalid. Valid options are: %2$s. Please check your shortcode implementation. ' , 'random-post-on-refresh ' ),
104104 $ atts ['taxonomy ' ],
105105 implode ( ', ' , get_taxonomies () )
@@ -130,7 +130,7 @@ function ( $group ) {
130130 if ( ! post_type_exists ( $ post_type ) ) {
131131 return self ::error (
132132 sprintf (
133- // Translators: %1$s is replaced with post_type shortcode argument and %2$s is replaced with a comma-separated list of available post types.
133+ // Translators: %1$s is replaced with post_type shortcode argument and %2$s is replaced with a comma-separated list of available post types.
134134 __ ( 'Sorry, post type "%1$s" is invalid. Valid options are: %2$s. Please check your shortcode implementation. ' , 'random-post-on-refresh ' ),
135135 $ post_type ,
136136 implode ( ', ' , get_post_types ( [ 'public ' => true ] ) )
@@ -287,9 +287,7 @@ public static function list_to_array( $list, $delimiter = ',' ) {
287287 * @return string
288288 */
289289 public static function get_the_excerpt ( WP_Post $ post ) {
290- $ excerpt = empty ( $ post ->post_excerpt ) ? $ post ->post_content : $ post ->post_excerpt ;
291-
292- return (string ) apply_filters ( 'the_excerpt ' , apply_filters ( 'get_the_excerpt ' , wp_kses_post ( $ excerpt ) ) );
290+ return (string ) apply_filters ( 'the_excerpt ' , apply_filters ( 'get_the_excerpt ' , $ post ->post_excerpt , $ post ) );
293291 }
294292
295293 /**
0 commit comments