diff --git a/includes/class-displayfeaturedimagegenesis-common.php b/includes/class-displayfeaturedimagegenesis-common.php index f6256a9..73c2fdd 100644 --- a/includes/class-displayfeaturedimagegenesis-common.php +++ b/includes/class-displayfeaturedimagegenesis-common.php @@ -34,8 +34,8 @@ class Display_Featured_Image_Genesis_Common { add_filter( 'jetpack_photon_override_image_downsize', '__return_true' ); // turn Photon off so we can get the correct image - $image_id = self::set_image_id(); - $image_size = self::image_size(); + $image_id = self::set_image_id(); + $image_size = self::image_size(); $item->backstretch = wp_get_attachment_image_src( $image_id, $image_size ); // set a content variable so backstretch doesn't show if full size image exists in post. @@ -193,7 +193,7 @@ class Display_Featured_Image_Genesis_Common { * @return string * @since 2.5.0 */ - static function singular_reset_image( $image_id ) { + public static function singular_reset_image( $image_id ) { $fullsize = wp_get_attachment_image_src( $image_id, 'full' ); $post = get_post( get_the_ID() ); $item_content = strpos( $post->post_content, 'src="' . $fullsize[0] ); @@ -217,7 +217,7 @@ class Display_Featured_Image_Genesis_Common { /** * @param string $title * - * @return mixed|void + * @return string */ protected static function set_item_title( $title = '' ) { @@ -232,7 +232,7 @@ class Display_Featured_Image_Genesis_Common { } elseif ( is_category() || is_tag() || is_tax() ) { $term = is_tax() ? get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ) : get_queried_object(); if ( ! $term ) { - return; + return ''; } $title = displayfeaturedimagegenesis_get_term_meta( $term, 'headline' ); if ( empty( $title ) && $a11ycheck ) { diff --git a/includes/class-displayfeaturedimagegenesis-description.php b/includes/class-displayfeaturedimagegenesis-description.php index a4a8afb..320ee64 100644 --- a/includes/class-displayfeaturedimagegenesis-description.php +++ b/includes/class-displayfeaturedimagegenesis-description.php @@ -234,9 +234,12 @@ class Display_Featured_Image_Genesis_Description { /** * Actually print the description for the archive page. Adds hooks for moving output. - * @param $intro_text string the archive intro text. + * + * @param $intro_text string the archive intro text. * @param string $class optional class for the div. * + * @param string $context + * * @since 2.5.0 */ protected function print_description( $intro_text, $class = '', $context = 'archive_intro' ) { diff --git a/includes/helper-functions.php b/includes/helper-functions.php index d0e0a55..00e35fc 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -21,7 +21,7 @@ function displayfeaturedimagegenesis_get_term_image( $term_id, $image_id = '' ) $image_id = get_term_meta( $term_id, 'displayfeaturedimagegenesis', true ); } if ( ! $image_id ) { - $term_meta = get_option( "displayfeaturedimagegenesis_$term_id" ); + $term_meta = get_option( "displayfeaturedimagegenesis_{$term_id}" ); if ( $term_meta ) { $image_id = displayfeaturedimagegenesis_check_image_id( $term_meta['term_image'] ); } @@ -59,13 +59,12 @@ function display_featured_image_genesis_get_term_image_id( $image_id = '' ) { } return (int) $image_id; - } /** * Helper function to get the term image URL. * @param string $size image size - * @return url URL associated with the term image + * @return string URL associated with the term image * * @since 2.1.0 */ @@ -75,20 +74,21 @@ function display_featured_image_genesis_get_term_image_url( $size = 'displayfeat $image_url = wp_get_attachment_image_src( $image_id, $size ); return esc_url( $image_url[0] ); - } /** * Helper function to get the default image ID. - * @return ID ID associated with the fallback/default image + * + * @param string $image_id + * + * @return int ID associated with the fallback/default image * * @since 2.1.0 */ function display_featured_image_genesis_get_default_image_id( $image_id = '' ) { $displaysetting = displayfeaturedimagegenesis_get_setting(); - $fallback = $displaysetting['default']; - $image_id = displayfeaturedimagegenesis_check_image_id( $fallback ); + $image_id = displayfeaturedimagegenesis_check_image_id( $displaysetting['default'] ); return (int) $image_id; @@ -96,8 +96,8 @@ function display_featured_image_genesis_get_default_image_id( $image_id = '' ) { /** * Helper function to get the default image URL. - * @param image size $size image size to retrieve - * @return URL URL associated with the term image + * @param string size $size image size to retrieve + * @return string URL associated with the term image * * @since 2.1.0 */ @@ -112,7 +112,10 @@ function display_featured_image_genesis_get_default_image_url( $size = 'displayf /** * Get custom post type featured image ID. - * @return ID Gets the ID of the image assigned as the custom post type featured image. + * + * @param string $image_id + * + * @return int Gets the ID of the image assigned as the custom post type featured image. * * @since 2.1.0 */ @@ -122,7 +125,7 @@ function display_featured_image_genesis_get_cpt_image_id( $image_id = '' ) { $displaysetting = displayfeaturedimagegenesis_get_setting(); $object = get_queried_object(); if ( ! $object || is_admin() ) { - return; + return ''; } if ( $object->name ) { // results in post type on cpt archive $post_type = $object->name; @@ -142,7 +145,7 @@ function display_featured_image_genesis_get_cpt_image_id( $image_id = '' ) { /** * Get the custom post type featured image URL. * @param string $size image size - * @return URL returns the image URL for the custom post type featured image + * @return string returns the image URL for the custom post type featured image * * @since 2.1.0 */ @@ -152,13 +155,13 @@ function display_featured_image_genesis_get_cpt_image_url( $size = 'displayfeatu $image_url = wp_get_attachment_image_src( $image_id, $size ); return esc_url( $image_url[0] ); - } /** * Add term/default image to blog/archive pages. Use: * add_action( 'genesis_entry_content', 'display_featured_image_genesis_add_archive_thumbnails', 5 ); - * @return image If a post doesn't have its own thumbnail, you can use this function to add one to archive pages. + * + * If a post doesn't have its own thumbnail, you can use this function to add one to archive pages. * * @since 2.1.0 */ @@ -170,7 +173,7 @@ function display_featured_image_genesis_add_archive_thumbnails() { return; } - $args = array( + $args = array( 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_type' => 'attachment', @@ -210,7 +213,6 @@ function display_featured_image_genesis_add_archive_thumbnails() { esc_url( $permalink ), wp_kses_post( $image ) ); - } /**