instance = $instance; $this->args = $this->update_args( $args ); $this->id_base = $id_base; $this->init(); } /** * Output the featured author. * @since 3.1.0 */ private function init() { if ( ! empty( $this->instance['title'] ) ) { echo wp_kses_post( $this->args['before_title'] . apply_filters( 'widget_title', $this->instance['title'], $this->instance, $this->id_base ) . $this->args['after_title'] ); } $this->do_featured_image(); $text = $this->get_gravatar(); $text .= $this->get_author_description(); $text .= $this->get_author_link(); echo wp_kses_post( wpautop( $text ) ); $this->do_author_archive_link(); } /** * Echo the author featured image. */ private function do_featured_image() { if ( ! $this->instance['show_featured_image'] ) { return; } $image_id = get_the_author_meta( 'displayfeaturedimagegenesis', $this->instance['user'] ); if ( ! $image_id ) { return; } echo wp_get_attachment_image( $image_id, $this->instance['featured_image_size'], false, array( 'alt' => get_the_author_meta( 'display_name', $this->instance['user'] ), 'class' => $this->instance['featured_image_alignment'], ) ); } /** * Return the author gravatar. * * @return string */ private function get_gravatar() { if ( ! $this->instance['show_gravatar'] ) { return ''; } $gravatar = get_avatar( $this->instance['user'], $this->instance['size'] ); if ( empty( $this->instance['gravatar_alignment'] ) ) { return $gravatar; } return '' . $gravatar . ''; } /** * Return the author bio/info. * * @param $this ->instance * * @return string */ private function get_author_description() { if ( ! $this->instance['author_info'] ) { return ''; } return 'text' === $this->instance['author_info'] ? $this->instance['bio_text'] : get_the_author_meta( 'description', $this->instance['user'] ); } /** * Return the author link. * * @return string */ private function get_author_link() { return $this->instance['page'] && $this->instance['page_link_text'] ? sprintf( ' %s', get_page_link( $this->instance['page'] ), $this->instance['page_link_text'] ) : ''; } /** * Output the author link. */ private function do_author_archive_link() { if ( ! $this->instance['posts_link'] || ! $this->instance['link_text'] ) { return; } // If posts link option checked, add posts link to output $display_name = get_the_author_meta( 'display_name', $this->instance['user'] ); $user_name = ! empty( $display_name ) && function_exists( 'genesis_a11y' ) && genesis_a11y() ? '' . $display_name . ': ' : ''; printf( '
', esc_url( get_author_posts_url( $this->instance['user'] ) ), wp_kses_post( $user_name ), esc_attr( $this->instance['link_text'] ) ); } /** * Update the "sidebar" args with some defaults (really only needed for the title). * * @param array $args * * @return array * @since 1.7.0 * */ private function update_args( $args ) { $defaults = array( 'before_title' => '