| @@ -21,13 +21,13 @@ | ||
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Section title |
| 24 | 24 | * |
| 25 | - * @param int $title shortcode title. | |
| 25 | + * @param int $pcp_id Shortcode id. | |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - public static function pcp_section_title( $title ) { | |
| 29 | - $section_title_text = apply_filters( 'pcp_section_title_text', $title ); | |
| 28 | + public static function pcp_section_title( $pcp_id ) { | |
| 29 | + $section_title_text = apply_filters( 'pcp_section_title_text', get_the_title( $pcp_id ) ); | |
| 30 | 30 | $section_title = apply_filters( 'pcp_filter_section_title', sprintf( '<h2 class="pcp-section-title">%1$s</h2>', $section_title_text ), $section_title_text ); |
| 31 | 31 | echo wp_kses_post( $section_title ); |
| 32 | 32 | } |
| 33 | 33 | |
| @@ -35,9 +35,8 @@ | ||
| 35 | 35 | * Post title html. |
| 36 | 36 | * |
| 37 | 37 | * @param array $sorter post content option array. |
| 38 | 38 | * @param string $layout layout preset. |
| 39 | - * @param array $options The options array. | |
| 40 | 39 | * @return void |
| 41 | 40 | */ |
| 42 | 41 | public static function pcp_post_title( $sorter, $layout, $options ) { |
| 43 | 42 | |
| @@ -45,10 +44,13 @@ | ||
| 45 | 44 | $post_meta_fields = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta_group', $_meta_settings ); |
| 46 | 45 | $show_post_meta = SP_PC_Functions::pcp_metabox_value( 'show_post_meta', $_meta_settings, true ); |
| 47 | 46 | $pcp_page_link_type = SP_PC_Functions::pcp_metabox_value( 'pcp_page_link_type', $options ); |
| 48 | 47 | $pcp_link_rel = SP_PC_Functions::pcp_metabox_value( 'pcp_link_rel', $options ); |
| 49 | - $pcp_link_rel_text = $pcp_link_rel ? 'rel="nofollow"' : ''; | |
| 50 | - $pcp_link_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options ); | |
| 48 | + $pcp_link_rel_text = ''; | |
| 49 | + if ( $pcp_link_rel ) { | |
| 50 | + $pcp_link_rel_text = "rel='nofollow'"; | |
| 51 | + } | |
| 52 | + $pcp_link_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options ); | |
| 51 | 53 | if ( is_array( $post_meta_fields ) && 'accordion_layout' !== $layout && $show_post_meta ) { |
| 52 | 54 | foreach ( $post_meta_fields as $each_meta ) { |
| 53 | 55 | if ( 'taxonomy' === $each_meta['select_post_meta'] ) { |
| 54 | 56 | $taxonomy = $each_meta['post_meta_taxonomy']; |
| @@ -56,10 +58,10 @@ | ||
| 56 | 58 | if ( 'above_title' === $meta_position ) { |
| 57 | 59 | $terms = get_the_term_list( get_the_ID(), $taxonomy, '', ' ' ); |
| 58 | 60 | if ( $terms ) { |
| 59 | 61 | ?> |
| 60 | - <div class="pcp-category above_title <?php echo esc_attr( $taxonomy ); ?>"> | |
| 61 | - <?php echo wp_kses_post( $terms ); ?> | |
| 62 | + <div class="pcp-category above_title <?php echo $taxonomy; ?>"> | |
| 63 | + <?php echo $terms; ?> | |
| 62 | 64 | </div> |
| 63 | 65 | <?php |
| 64 | 66 | }; |
| 65 | 67 | } |
| @@ -91,11 +93,11 @@ | ||
| 91 | 93 | ); |
| 92 | 94 | ?> |
| 93 | 95 | <<?php echo esc_attr( $post_title_tag ); ?> class="sp-pcp-title"> |
| 94 | 96 | <?php if ( 'none' === $pcp_page_link_type ) { ?> |
| 95 | - <?php echo sprintf( '<a %2$s>%1$s</a>', wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), wp_kses_post( $pcp_link_rel_text ) ); ?> | |
| 97 | + <?php echo sprintf( '<a %2$s>%1$s</a>', wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), esc_attr( $pcp_link_rel_text ) ); ?> | |
| 96 | 98 | <?php } else { ?> |
| 97 | - <?php echo sprintf( '<a href="%1$s" %3$s target="%4$s">%2$s</a>', esc_url( get_the_permalink() ), wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), wp_kses_post( $pcp_link_rel_text ), esc_attr( $pcp_link_target ) ); ?> | |
| 99 | + <?php echo sprintf( '<a href="%1$s" %3$s target="%4$s">%2$s</a>', esc_url( get_the_permalink() ), wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), esc_attr( $pcp_link_rel_text ), esc_attr( $pcp_link_target ) ); ?> | |
| 98 | 100 | <?php } ?> |
| 99 | 101 | </<?php echo esc_attr( $post_title_tag ); ?>> |
| 100 | 102 | <?php |
| 101 | 103 | } |
| @@ -150,20 +152,23 @@ | ||
| 150 | 152 | $show_read_more = isset( $view_options['show_read_more'] ) ? $view_options['show_read_more'] : ''; |
| 151 | 153 | if ( ! $show_read_more || 'full_content' === $content_type ) { |
| 152 | 154 | return ''; |
| 153 | 155 | } |
| 154 | - | |
| 156 | + // $read_more_type = isset( $view_options['read_more_type'] ) ? $view_options['read_more_type'] : ''; | |
| 155 | 157 | $pcp_read_label = isset( $view_options['pcp_read_label'] ) ? $view_options['pcp_read_label'] : ''; |
| 156 | 158 | $pcp_page_link_type = SP_PC_Functions::pcp_metabox_value( 'pcp_page_link_type', $options ); |
| 157 | 159 | $pcp_link_rel = SP_PC_Functions::pcp_metabox_value( 'pcp_link_rel', $options ); |
| 158 | - $pcp_link_rel_text = $pcp_link_rel ? 'rel="nofollow"' : ''; | |
| 159 | - $readmore_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options ); | |
| 160 | + $pcp_link_rel_text = ''; | |
| 161 | + if ( $pcp_link_rel ) { | |
| 162 | + $pcp_link_rel_text = "rel='nofollow'"; | |
| 163 | + } | |
| 164 | + $readmore_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options ); | |
| 160 | 165 | ?> |
| 161 | 166 | <div class="sp-pcp-readmore"> |
| 162 | 167 | <?php if ( 'none' === $pcp_page_link_type ) { ?> |
| 163 | - <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" <?php echo wp_kses_post( $pcp_link_rel_text ); ?>> | |
| 168 | + <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" <?php echo esc_html( $pcp_link_rel_text ); ?>> | |
| 164 | 169 | <?php } else { ?> |
| 165 | - <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" href="<?php the_permalink(); ?>" <?php echo wp_kses_post( $pcp_link_rel_text ); ?>> | |
| 170 | + <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" href="<?php the_permalink(); ?>" <?php echo esc_html( $pcp_link_rel_text ); ?>> | |
| 166 | 171 | <?php } ?> |
| 167 | 172 | <?php echo esc_html( $pcp_read_label ); ?> </a> |
| 168 | 173 | </div> |
| 169 | 174 | <?php |
| @@ -212,8 +217,9 @@ | ||
| 212 | 217 | /** |
| 213 | 218 | * Post meta HTML |
| 214 | 219 | * |
| 215 | 220 | * @param array $sorter post content option array. |
| 221 | + * @param int $visitor_count views count. | |
| 216 | 222 | * @return void |
| 217 | 223 | */ |
| 218 | 224 | public static function pcp_post_meta_html( $sorter ) { |
| 219 | 225 | $_meta_settings = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta', $sorter ); |
| @@ -218,17 +224,16 @@ | ||
| 218 | 224 | public static function pcp_post_meta_html( $sorter ) { |
| 219 | 225 | $_meta_settings = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta', $sorter ); |
| 220 | 226 | $post_meta_fields = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta_group', $_meta_settings ); |
| 221 | 227 | $show_post_meta = SP_PC_Functions::pcp_metabox_value( 'show_post_meta', $_meta_settings, true ); |
| 222 | - $_meta_separator = ' '; | |
| 223 | - // $_meta_separator = SP_PC_Functions::pcp_metabox_value( 'meta_separator', $_meta_settings ); | |
| 228 | + $_meta_separator = SP_PC_Functions::pcp_metabox_value( 'meta_separator', $_meta_settings ); | |
| 224 | 229 | if ( $post_meta_fields && $show_post_meta ) { |
| 225 | 230 | ?> |
| 226 | 231 | <div class="sp-pcp-post-meta"> |
| 227 | 232 | <?php |
| 228 | - echo wp_kses_post( apply_filters( 'pcp_post_meta_wrapper_start', '<ul>' ) ); | |
| 233 | + echo apply_filters( 'pcp_post_meta_wrapper_start', '<ul>' ); | |
| 229 | 234 | SP_PC_Functions::pcp_get_post_meta( $post_meta_fields, $_meta_separator ); |
| 230 | - echo wp_kses_post( apply_filters( 'pcp_post_meta_wrapper_end', '</ul>' ) ); | |
| 235 | + echo apply_filters( 'pcp_post_meta_wrapper_end', '</ul>' ); | |
| 231 | 236 | ?> |
| 232 | 237 | </div> |
| 233 | 238 | <?php |
| 234 | 239 | } |
| @@ -240,9 +245,8 @@ | ||
| 240 | 245 | * @param array $sorter post sorting option. |
| 241 | 246 | * @param string $layout Layout preset. |
| 242 | 247 | * @param int $scode_id The Shortcode ID. |
| 243 | 248 | * @param object $post The Post object. |
| 244 | - * @param array $options The options array. | |
| 245 | 249 | * @return void |
| 246 | 250 | */ |
| 247 | 251 | public static function pcp_post_content_with_thumb( $sorter, $layout, $scode_id, $post, $options ) { |
| 248 | 252 | if ( $sorter ) { |
| @@ -270,9 +274,8 @@ | ||
| 270 | 274 | * |
| 271 | 275 | * @param array $sorter post sorting option. |
| 272 | 276 | * @param string $layout Layout preset. |
| 273 | 277 | * @param object $post visitor number. |
| 274 | - * @param array $options The options array. | |
| 275 | 278 | * @return void |
| 276 | 279 | */ |
| 277 | 280 | public static function pcp_post_content_without_thumb( $sorter, $layout, $post, $options ) { |
| 278 | 281 | if ( $sorter ) { |
| @@ -294,14 +297,15 @@ | ||
| 294 | 297 | |
| 295 | 298 | /** |
| 296 | 299 | * Pagination function |
| 297 | 300 | * |
| 298 | - * @param object $loop Query array. | |
| 299 | - * @param array $view_options shortcode options. | |
| 300 | - * @param array $paged The pagination type. | |
| 301 | - * @param array $on_screen screen type. | |
| 301 | + * @param array $loop Query array. | |
| 302 | + * @param array $upper_id Fields upper id. | |
| 303 | + * @param array $paged The pagination type. | |
| 304 | + * @param array $on_screen screen type. | |
| 302 | 305 | */ |
| 303 | - public static function pcp_pagination_bar( $loop, $view_options, $paged = null, $on_screen = null ) { | |
| 306 | + public static function pcp_pagination_bar( $loop, $upper_id, $paged = null, $on_screen = null ) { | |
| 307 | + $view_options = get_post_meta( $upper_id, 'sp_pcp_view_options', true ); | |
| 304 | 308 | // $posts_found; |
| 305 | 309 | $posts_found = $loop->found_posts; |
| 306 | 310 | $post_offset = isset( $view_options['pcp_post_offset'] ) ? $view_options['pcp_post_offset'] : 0; |
| 307 | 311 | $post_limit = isset( $view_options['pcp_post_limit'] ) ? $view_options['pcp_post_limit'] : ''; |
| @@ -308,9 +312,9 @@ | ||
| 308 | 312 | $post_limit = ( $post_limit > 0 && $posts_found > $post_limit ) ? $post_limit : $posts_found; |
| 309 | 313 | $post_per_page = isset( $view_options['post_per_page'] ) ? $view_options['post_per_page'] : ''; |
| 310 | 314 | $post_per_page = ( $post_per_page > $post_limit ) ? $post_limit : $post_per_page; |
| 311 | 315 | // Post display settings. |
| 312 | - $post_limit = (int) $post_limit; | |
| 316 | + $post_limit = (int) $post_limit; | |
| 313 | 317 | if ( $post_limit < 1 ) { |
| 314 | 318 | $pages = 0; |
| 315 | 319 | } else { |
| 316 | 320 | $pages = SP_PC_Functions::pcp_max_pages( $post_limit, $post_per_page ); |
| @@ -336,8 +340,8 @@ | ||
| 336 | 340 | 'prev_text' => '<i class="fa fa-angle-left"></i>', |
| 337 | 341 | 'next_text' => '<i class="fa fa-angle-right"></i>', |
| 338 | 342 | ) |
| 339 | 343 | ); |
| 340 | - echo wp_kses_post( implode( $page_links ) ); | |
| 344 | + echo implode( $page_links ); | |
| 341 | 345 | } |
| 342 | 346 | } |
| 343 | 347 | } |