sanitize_order_array( $order ); $markup = ''; $markup .= '
'; $markup .= $this->get_avatar( $order ); $markup .= ''; $markup .= '
'; echo wp_kses( $markup, consted_alowed_tags() ); } /** * Makes sure there's a valid meta order array. * * @param array $order meta order array. * * @return mixed */ private function sanitize_order_array( $order ) { $allowed_order_values = array( 'avatar', 'author', 'date', 'category', 'comments', ); foreach ( $order as $index => $value ) { if ( ! in_array( $value, $allowed_order_values ) ) { unset( $order[ $index ] ); } } return $order; } /** * Get the get_avatar a link. * * @return string */ private function get_avatar( $order ) { if( !empty( $order ) && in_array( 'avatar',$order ) ) return '
'.get_avatar( get_the_author_meta('user_email'), $size = '60').'
'; } /** * Get the comments with a link. * * @return string */ private function get_comments() { $comments_number = get_comments_number(); if ( ! comments_open() ) { return ''; } if ( $comments_number == 0 ) { return ''; } else { /* translators: %s: number of comments */ $comments = sprintf( _n( '%s Comment', '%s Comments', $comments_number, 'consted' ), $comments_number ); } return '' . esc_html( $comments ) . ''; } /** * Render the tags list. */ public function render_tags_list() { $tags = get_the_tags(); if ( ! is_array( $tags ) ) { return; } $html = '
'; $html .= '' . esc_html__( 'Tags', 'consted' ) . ':'; foreach ( $tags as $tag ) { $tag_link = get_tag_link( $tag->term_id ); $html .= ''; } $html .= '
'; echo wp_kses_post( $html ); } /** * Get