| @@ -158,8 +158,9 @@ | ||
| 158 | 158 | $this->add_group_control( |
| 159 | 159 | Group_Control_Image_Size::get_type(), |
| 160 | 160 | [ |
| 161 | 161 | 'name' => 'primary_thumbnail', |
| 162 | + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour. | |
| 162 | 163 | 'exclude' => ['custom'], |
| 163 | 164 | 'default' => 'full', |
| 164 | 165 | ] |
| 165 | 166 | ); |
| @@ -278,8 +279,11 @@ | ||
| 278 | 279 | ], |
| 279 | 280 | 'default' => [ |
| 280 | 281 | 'size' => 12, |
| 281 | 282 | ], |
| 283 | + 'condition' => [ | |
| 284 | + 'posts_source!' => 'current_query', | |
| 285 | + ] | |
| 282 | 286 | ] |
| 283 | 287 | ); |
| 284 | 288 | |
| 285 | 289 | $this->register_query_builder_controls(); |
| @@ -317,10 +321,13 @@ | ||
| 317 | 321 | |
| 318 | 322 | $this->add_control( |
| 319 | 323 | 'pauseonhover', |
| 320 | 324 | [ |
| 321 | - 'label' => esc_html__('Pause on Hover', 'ultimate-post-kit'), | |
| 322 | - 'type' => Controls_Manager::SWITCHER, | |
| 325 | + 'label' => esc_html__('Pause on Hover', 'ultimate-post-kit'), | |
| 326 | + 'type' => Controls_Manager::SWITCHER, | |
| 327 | + 'condition' => [ | |
| 328 | + 'autoplay' => 'yes', | |
| 329 | + ], | |
| 323 | 330 | ] |
| 324 | 331 | ); |
| 325 | 332 | |
| 326 | 333 | $this->add_control( |
| @@ -585,8 +592,11 @@ | ||
| 585 | 592 | [ |
| 586 | 593 | 'name' => 'meta_author_typography', |
| 587 | 594 | 'label' => esc_html__('Author Typography', 'ultimate-post-kit'), |
| 588 | 595 | 'selector' => '{{WRAPPER}} .upk-skide-slider .upk-meta .upk-author-name a', |
| 596 | + 'condition' => [ | |
| 597 | + 'show_author' => 'yes', | |
| 598 | + ], | |
| 589 | 599 | ] |
| 590 | 600 | ); |
| 591 | 601 | |
| 592 | 602 | $this->add_group_control( |
| @@ -876,11 +886,11 @@ | ||
| 876 | 886 | */ |
| 877 | 887 | public function query_posts($posts_per_page) { |
| 878 | 888 | |
| 879 | 889 | $default = $this->getGroupControlQueryArgs(); |
| 890 | + $args = []; | |
| 880 | 891 | if ($posts_per_page) { |
| 881 | 892 | $args['posts_per_page'] = $posts_per_page; |
| 882 | - // $args['paged'] = max(1, get_query_var('paged'), get_query_var('page')); | |
| 883 | 893 | } |
| 884 | 894 | $args = array_merge($default, $args); |
| 885 | 895 | $this->_query = new WP_Query($args); |
| 886 | 896 | } |
| @@ -909,9 +919,10 @@ | ||
| 909 | 919 | if (!$this->get_settings('show_title')) { |
| 910 | 920 | return; |
| 911 | 921 | } |
| 912 | 922 | |
| 913 | - printf('<%1$s class="upk-title"><a href="%2$s" title="%3$s">%3$s</a></%1$s>', esc_attr(Utils::get_valid_html_tag($settings['title_tags'])), esc_url( get_permalink() ), esc_html( get_the_title() )); | |
| 923 | + $title = get_the_title(); | |
| 924 | + printf('<%1$s class="upk-title"><a href="%2$s" title="%4$s">%3$s</a></%1$s>', esc_attr(Utils::get_valid_html_tag($settings['title_tags'])), esc_url( get_permalink() ), esc_html( $title ), esc_attr( $title )); | |
| 914 | 925 | } |
| 915 | 926 | |
| 916 | 927 | public function render_excerpt($excerpt_length) { |
| 917 | 928 | |
| @@ -924,9 +935,9 @@ | ||
| 924 | 935 | <?php |
| 925 | 936 | if (has_excerpt()) { |
| 926 | 937 | the_excerpt(); |
| 927 | 938 | } else { |
| 928 | - echo ultimate_post_kit_custom_excerpt($excerpt_length, $strip_shortcode); | |
| 939 | + echo wp_kses_post( ultimate_post_kit_custom_excerpt($excerpt_length, $strip_shortcode) ); | |
| 929 | 940 | } |
| 930 | 941 | ?> |
| 931 | 942 | </div> |
| 932 | 943 | |
| @@ -939,9 +950,9 @@ | ||
| 939 | 950 | return; |
| 940 | 951 | } |
| 941 | 952 | ?> |
| 942 | 953 | <div class="upk-category" data-swiper-parallax="-300"> |
| 943 | - <?php echo get_the_category_list(' '); ?> | |
| 954 | + <?php echo wp_kses_post( get_the_category_list(' ') ); ?> | |
| 944 | 955 | </div> |
| 945 | 956 | <?php |
| 946 | 957 | } |
| 947 | 958 | |
| @@ -992,16 +1003,14 @@ | ||
| 992 | 1003 | |
| 993 | 1004 | if (!$this->get_settings('show_comments')) { |
| 994 | 1005 | return; |
| 995 | 1006 | } |
| 996 | - ?> | |
| 997 | - | |
| 1007 | + | |
| 1008 | + ?> | |
| 998 | 1009 | <div class="upk-comments"> |
| 999 | - <?php echo get_comments_number($id) ?> | |
| 1000 | - <?php echo esc_html__('Comments', 'ultimate-post-kit') ?> | |
| 1010 | + <?php echo esc_html( Utils::get_formatted_comments_count( $id ) ); ?> | |
| 1001 | 1011 | </div> |
| 1002 | - | |
| 1003 | - <?php | |
| 1012 | + <?php | |
| 1004 | 1013 | } |
| 1005 | 1014 | |
| 1006 | 1015 | public function render_header() { |
| 1007 | 1016 | $id = 'upk-skide-slider-' . $this->get_id(); |
| @@ -1040,9 +1049,9 @@ | ||
| 1040 | 1049 | $this->add_render_attribute('swiper', 'class', 'swiper-carousel swiper'); |
| 1041 | 1050 | |
| 1042 | 1051 | ?> |
| 1043 | 1052 | <div <?php $this->print_render_attribute_string('skide-slider'); ?>> |
| 1044 | - <div <?php echo $this->get_render_attribute_string('swiper'); ?>> | |
| 1053 | + <div <?php $this->print_render_attribute_string('swiper'); ?>> | |
| 1045 | 1054 | <div class="swiper-wrapper"> |
| 1046 | 1055 | <?php |
| 1047 | 1056 | } |
| 1048 | 1057 | |
| @@ -1078,24 +1087,27 @@ | ||
| 1078 | 1087 | </div> |
| 1079 | 1088 | <?php endif; ?> |
| 1080 | 1089 | |
| 1081 | 1090 | <div class="upk-meta" data-swiper-parallax="-100"> |
| 1091 | + <?php if ('yes' === $settings['show_author']) : ?> | |
| 1082 | 1092 | <div class="upk-author-img"> |
| 1083 | 1093 | <?php echo get_avatar(get_the_author_meta('ID'), 48); ?> |
| 1084 | 1094 | </div> |
| 1095 | + <?php endif; ?> | |
| 1085 | 1096 | <div class="upk-meta-info"> |
| 1097 | + <?php if ('yes' === $settings['show_author']) : ?> | |
| 1086 | 1098 | <div class="upk-author-name"> |
| 1087 | 1099 | <a href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>"> |
| 1088 | 1100 | <?php echo esc_html( get_the_author() ); ?> |
| 1089 | 1101 | </a> |
| 1090 | 1102 | </div> |
| 1091 | - | |
| 1103 | + <?php endif; ?> | |
| 1092 | 1104 | <?php if ($settings['show_comments'] or $settings['show_date'] or $settings['show_reading_time']) : ?> |
| 1093 | 1105 | <div class="upk-date-comments"> |
| 1094 | 1106 | <?php $this->render_date(); ?> |
| 1095 | 1107 | |
| 1096 | 1108 | <?php if ($settings['show_comments']) : ?> |
| 1097 | - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> | |
| 1109 | + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>"> | |
| 1098 | 1110 | <?php $this->render_comments($post_id); ?> |
| 1099 | 1111 | </div> |
| 1100 | 1112 | <?php endif; ?> |
| 1101 | 1113 | |
| @@ -1100,10 +1112,10 @@ | ||
| 1100 | 1112 | <?php endif; ?> |
| 1101 | 1113 | |
| 1102 | 1114 | <?php if (_is_upk_pro_activated()) : |
| 1103 | 1115 | if ('yes' === $settings['show_reading_time']) : ?> |
| 1104 | - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> | |
| 1105 | - <?php echo esc_html( ultimate_post_kit_reading_time(get_the_content(), $settings['avg_reading_speed']) ); ?> | |
| 1116 | + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>"> | |
| 1117 | + <?php echo esc_html( ultimate_post_kit_reading_time(get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no') ); ?> | |
| 1106 | 1118 | </div> |
| 1107 | 1119 | <?php endif; ?> |
| 1108 | 1120 | <?php endif; ?> |
| 1109 | 1121 | </div> |
| @@ -1182,8 +1194,9 @@ | ||
| 1182 | 1194 | </div> |
| 1183 | 1195 | </div> |
| 1184 | 1196 | <?php |
| 1185 | 1197 | if (_is_upk_pro_activated()) { |
| 1198 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- established hook name relied on across the plugin family; renaming would break integration. | |
| 1186 | 1199 | apply_filters('show_top_stories', $this); |
| 1187 | 1200 | } |
| 1188 | 1201 | ?> |
| 1189 | 1202 | |