| @@ -86,13 +86,13 @@ | ||
| 86 | 86 | $_title = $_image = $_desc = $_color = ''; |
| 87 | 87 | if ( is_archive() ) { |
| 88 | 88 | if ( is_category() || is_tag() || is_tax() ) { |
| 89 | 89 | $obj = get_queried_object(); |
| 90 | - $attachment_id = get_term_meta( $obj->term_id, 'ultp_category_image', true ); | |
| 90 | + $attachment_id = ultimate_post()->get_term_image_id( $obj ); | |
| 91 | 91 | $_title = $obj->name; |
| 92 | 92 | $_image = $attachment_id ? wp_get_attachment_url( $attachment_id ) : ''; |
| 93 | 93 | $_desc = $obj->description; |
| 94 | - $_color = get_term_meta( $obj->term_id, 'ultp_category_color', true ); | |
| 94 | + $_color = ultimate_post()->get_term_color( $obj ); | |
| 95 | 95 | } elseif ( is_date() ) { |
| 96 | 96 | $_title = is_year() ? get_the_date( 'Y' ) : ( is_month() ? get_the_date( 'F Y' ) : ( is_day() ? get_the_date( 'F j, Y' ) : '' ) ); |
| 97 | 97 | } elseif ( is_author() ) { |
| 98 | 98 | $_title = get_the_author_meta( 'display_name' ); |
| @@ -121,8 +121,9 @@ | ||
| 121 | 121 | $block_name = 'archive-title'; |
| 122 | 122 | |
| 123 | 123 | $attr['className'] = isset( $attr['className'] ) && $attr['className'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['className'] ) : ''; |
| 124 | 124 | $attr['align'] = isset( $attr['align'] ) && $attr['align'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['align'] ) : ''; |
| 125 | + $attr['blockId'] = isset( $attr['blockId'] ) ? sanitize_html_class( $attr['blockId'] ) : ''; | |
| 125 | 126 | $attr['advanceId'] = isset( $attr['advanceId'] ) ? sanitize_html_class( $attr['advanceId'] ) : ''; |
| 126 | 127 | $attr['titleTag'] = in_array( $attr['titleTag'], ultimate_post()->ultp_allowed_block_tags() ) ? $attr['titleTag'] : 'h1'; |
| 127 | 128 | $attr['layout'] = sanitize_html_class( $attr['layout'] ); |
| 128 | 129 | $attr['prefixText'] = wp_kses( $attr['prefixText'], ultimate_post()->ultp_allowed_html_tags() ); |
| @@ -130,23 +131,23 @@ | ||
| 130 | 131 | $wraper_before .= '<div ' . ( $attr['advanceId'] ? 'id="' . $attr['advanceId'] . '" ' : '' ) . ' class="wp-block-ultimate-post-' . $block_name . ' ultp-block-' . $attr['blockId'] . '' . ( $attr['align'] ? ' align' . $attr['align'] : '' ) . '' . ( $attr['className'] ? ' ' . $attr['className'] : '' ) . '">'; |
| 131 | 132 | $wraper_before .= '<div class="ultp-block-wrapper">'; |
| 132 | 133 | $wraper_before .= '<div class="ultp-block-archive-title ultp-archive-layout-' . $attr['layout'] . '">'; |
| 133 | 134 | |
| 134 | - $style = $attr['layout'] == '2' ? ( $data['image'] ? 'style="background-image: url(' . $data['image'] . ')' : 'style="background-color:' . ( $data['color'] ? $data['color'] : '#28303d' ) ) . '"' : ''; | |
| 135 | + $style = $attr['layout'] == '2' ? ( $data['image'] ? 'style="background-image: url(' . esc_url( $data['image'] ) . ')' : 'style="background-color:' . esc_attr( $data['color'] ? $data['color'] : '#28303d' ) ) . '"' : ''; | |
| 135 | 136 | $prefix = ( $attr['prefixShow'] && $attr['prefixText'] ) ? '<span class="ultp-archive-prefix">' . $attr['prefixText'] . '</span> ' : ''; |
| 136 | 137 | |
| 137 | - $name = ( $attr['titleShow'] && $data['title'] ) ? '<' . $attr['titleTag'] . ' class="ultp-archive-name" ' . ( ( $data['color'] && $attr['customTaxTitleColor'] ) ? 'style="color: ' . $data['color'] . '"' : '' ) . '>' . $prefix . $data['title'] . '</' . $attr['titleTag'] . '>' : ''; | |
| 138 | + $name = ( $attr['titleShow'] && $data['title'] ) ? '<' . $attr['titleTag'] . ' class="ultp-archive-name" ' . ( ( $data['color'] && $attr['customTaxTitleColor'] ) ? 'style="color: ' . esc_attr( $data['color'] ) . '"' : '' ) . '>' . $prefix . esc_html( $data['title'] ) . '</' . $attr['titleTag'] . '>' : ''; | |
| 138 | 139 | |
| 139 | - $excerpt = ( $attr['excerptShow'] && $data['desc'] ) ? '<div class="ultp-archive-desc">' . $data['desc'] . '</div>' : ''; | |
| 140 | + $excerpt = ( $attr['excerptShow'] && $data['desc'] ) ? '<div class="ultp-archive-desc">' . wp_kses_post( $data['desc'] ) . '</div>' : ''; | |
| 140 | 141 | |
| 141 | 142 | // Prefix |
| 142 | 143 | switch ( $attr['layout'] ) { |
| 143 | 144 | case 1: |
| 144 | - $img = ( $attr['showImage'] && $data['image'] ) ? '<img class="ultp-archive-image" src="' . $data['image'] . '" alt="' . $data['title'] . '"/>' : ''; | |
| 145 | + $img = ( $attr['showImage'] && $data['image'] ) ? '<img class="ultp-archive-image" src="' . esc_url( $data['image'] ) . '" alt="' . esc_attr( $data['title'] ) . '"/>' : ''; | |
| 145 | 146 | $post_loop .= $img . $name . $excerpt; |
| 146 | 147 | break; |
| 147 | 148 | case 2: |
| 148 | - $style_overlay = $attr['customTaxColor'] ? 'style="background-color: ' . $data['color'] . '"' : ''; | |
| 149 | + $style_overlay = $attr['customTaxColor'] ? 'style="background-color: ' . esc_attr( $data['color'] ) . '"' : ''; | |
| 149 | 150 | $post_loop .= '<div class="ultp-archive-content" ' . $style . '><div class="ultp-archive-overlay" ' . $style_overlay . '></div>' . $name . $excerpt . '</div>'; |
| 150 | 151 | break; |
| 151 | 152 | } |
| 152 | 153 | |