diff --git a/inc/acf.php b/inc/acf.php index aa1261d05..7b61e69f0 100644 --- a/inc/acf.php +++ b/inc/acf.php @@ -14,6 +14,8 @@ /** * Loop through and output ACF flexible content blocks for the current page. + * + * @return bool */ function _s_display_content_blocks() { if ( have_rows( 'content_blocks' ) ) : @@ -249,7 +251,12 @@ function _s_acf_flexible_content_layout_title( $title, $field, $layout, $i ) { $end_date = $other_options['end_date']; // If the block has expired, add "(expired)" to the title. - if ( _s_has_block_expired( array( 'start_date' => $start_date, 'end_date' => $end_date ) ) ) { + if ( _s_has_block_expired( + array( + 'start_date' => $start_date, + 'end_date' => $end_date, + ) ) + ) { $expired .= ' (' . esc_html__( 'expired', '_s' ) . ')'; } diff --git a/inc/customizer/settings.php b/inc/customizer/settings.php index fc3682cf9..955ad56f3 100644 --- a/inc/customizer/settings.php +++ b/inc/customizer/settings.php @@ -71,7 +71,7 @@ function _s_customize_social_icons( $wp_customize ) { $wp_customize->add_setting( '_s_' . $network . '_link', array( - 'default' => '', + 'default' => '', 'sanitize_callback' => 'esc_url', ) ); diff --git a/inc/extras.php b/inc/extras.php index d2de74565..58b1e2737 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -60,7 +60,7 @@ function _s_get_attachment_id_from_url( $attachment_url = '' ) { $attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url ); // Do something with $result. - $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $attachment_url ) ); // WPCS: db call ok , cache ok. + $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = %s AND wposts.post_type = 'attachment'", $attachment_url ) ); // WPCS db call ok, cache ok, placeholder ok. } return $attachment_id; @@ -198,6 +198,7 @@ function _s_get_placeholder_unsplash( $args = array() ) { * Display the customizer header scripts. * * @author Greg Rickaby + * @return string */ function _s_display_customizer_header_scripts() { @@ -217,6 +218,7 @@ function _s_display_customizer_header_scripts() { * Display the customizer footer scripts. * * @author Greg Rickaby + * @return string */ function _s_display_customizer_footer_scripts() { diff --git a/inc/hooks.php b/inc/hooks.php index 16018535d..2c04eebdf 100644 --- a/inc/hooks.php +++ b/inc/hooks.php @@ -68,6 +68,8 @@ function _s_body_classes( $classes ) { /** * Flush out the transients used in _s_categorized_blog. + * + * @return string */ function _s_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { @@ -81,6 +83,8 @@ function _s_category_transient_flusher() { /** * Customize "Read More" string on with the_content(); + * + * @return string */ function _s_content_more_link() { return ' ' . esc_html__( 'Read More', '_s' ) . '...'; @@ -91,7 +95,7 @@ function _s_content_more_link() { * Customize the [...] on the_excerpt(); * * @param string $more The current $more string. - * @return string Replace with "Read More..." + * @return string */ function _s_excerpt_more( $more ) { return sprintf( ' %2$s', get_permalink( get_the_ID() ), esc_html__( 'Read more...', '_s' ) ); @@ -102,7 +106,7 @@ function _s_excerpt_more( $more ) { * Enable custom mime types. * * @param array $mimes Current allowed mime types. - * @return array Updated allowed mime types. + * @return array */ function _s_custom_mime_types( $mimes ) { $mimes['svg'] = 'image/svg+xml'; diff --git a/inc/scripts.php b/inc/scripts.php index 53f3dd96a..79d955057 100644 --- a/inc/scripts.php +++ b/inc/scripts.php @@ -9,6 +9,7 @@ * Register Google font. * * @link http://themeshaper.com/2014/08/13/how-to-add-google-fonts-to-wordpress-themes/ + * @return string */ function _s_font_url() { @@ -19,7 +20,7 @@ function _s_font_url() { * supported by the following, translate this to 'off'. Do not translate * into your own language. */ - $roboto = esc_html_x( 'on', 'Roboto font: on or off', '_s' ); + $roboto = esc_html_x( 'on', 'Roboto font: on or off', '_s' ); $open_sans = esc_html_x( 'on', 'Open Sans font: on or off', '_s' ); if ( 'off' !== $roboto || 'off' !== $open_sans ) { @@ -34,7 +35,7 @@ function _s_font_url() { } $query_args = array( - 'family' => urlencode( implode( '|', $font_families ) ), + 'family' => rawurlencode( implode( '|', $font_families ) ), ); $fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' ); @@ -50,7 +51,7 @@ function _s_scripts() { /** * If WP is in script debug, or we pass ?script_debug in a URL - set debug to true. */ - $debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) || ( isset( $_GET['script_debug'] ) ) ? true : false; + $debug = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) || ( isset( $_GET['script_debug'] ) ) ? true : false; /** * If we are debugging the site, use a unique version every page load so as to ensure no cache issues. @@ -104,7 +105,7 @@ function _s_customizer_scripts() { /** * If WP is in script debug, or we pass ?script_debug in a URL - set debug to true. */ - $debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) || ( isset( $_GET['script_debug'] ) ) ? true : false; + $debug = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) || ( isset( $_GET['script_debug'] ) ) ? true : false; /** * If we are debugging the site, use a unique version every page load so as to ensure no cache issues. @@ -130,7 +131,7 @@ function _s_include_svg_icons() { // If it exists, include it. if ( file_exists( $svg_icons ) ) { - require_once( $svg_icons ); + require_once $svg_icons; } } add_action( 'wp_footer', '_s_include_svg_icons', 9999 ); diff --git a/inc/template-tags.php b/inc/template-tags.php index 106d1c82d..99488212b 100755 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -86,6 +86,7 @@ function _s_entry_footer() { * Display SVG markup. * * @param array $args The parameters needed to display the SVG. + * @return string */ function _s_display_svg( $args = array() ) { @@ -183,7 +184,7 @@ class="icon icon-" * Trim the title length. * * @param array $args Parameters include length and more. - * @return string The shortened excerpt. + * @return string */ function _s_get_the_title( $args = array() ) { @@ -204,7 +205,7 @@ function _s_get_the_title( $args = array() ) { * Limit the excerpt length. * * @param array $args Parameters include length and more. - * @return string The shortened excerpt. + * @return string */ function _s_get_the_excerpt( $args = array() ) { @@ -225,13 +226,14 @@ function _s_get_the_excerpt( $args = array() ) { * Echo an image, no matter what. * * @param string $size The image size to display. Default is thumbnail. + * @return string */ function _s_display_post_image( $size = 'thumbnail' ) { // If post has a featured image, display it. if ( has_post_thumbnail() ) { the_post_thumbnail( $size ); - return; + return false; } $attached_image_url = _s_get_attached_image_url( $size ); @@ -246,7 +248,7 @@ function _s_display_post_image( $size = 'thumbnail' ) { * Return an image URL, no matter what. * * @param string $size The image size to return. Default is thumbnail. - * @return string The image URL. + * @return string */ function _s_get_post_image_url( $size = 'thumbnail' ) { @@ -269,7 +271,7 @@ function _s_get_post_image_url( $size = 'thumbnail' ) { * Get the URL of an image that's attached to the current post, else a placeholder image URL. * * @param string $size The image size to return. Default is thumbnail. - * @return string The image URL. + * @return string */ function _s_get_attached_image_url( $size = 'thumbnail' ) { @@ -288,6 +290,8 @@ function _s_get_attached_image_url( $size = 'thumbnail' ) { /** * Echo the copyright text saved in the Customizer. + * + * @return bool */ function _s_display_copyright_text() { @@ -296,7 +300,7 @@ function _s_display_copyright_text() { // Stop if there's nothing to display. if ( ! $copyright_text ) { - return; + return false; } ?> @@ -307,7 +311,7 @@ function _s_display_copyright_text() { /** * Get the Twitter social sharing URL for the current page. * - * @return string The URL. + * @return string */ function _s_get_twitter_share_url() { return add_query_arg( @@ -321,7 +325,7 @@ function _s_get_twitter_share_url() { /** * Get the Facebook social sharing URL for the current page. * - * @return string The URL. + * @return string */ function _s_get_facebook_share_url() { return add_query_arg( 'u', rawurlencode( get_the_permalink() ), 'https://www.facebook.com/sharer/sharer.php' ); @@ -330,7 +334,7 @@ function _s_get_facebook_share_url() { /** * Get the LinkedIn social sharing URL for the current page. * - * @return string The URL. + * @return string */ function _s_get_linkedin_share_url() { return add_query_arg( @@ -434,6 +438,7 @@ function _s_display_card( $args = array() ) { * Display header button. * * @author Corey Collins + * @return string */ function _s_display_header_button() { diff --git a/template-parts/content-blocks/block-cta.php b/template-parts/content-blocks/block-cta.php index db4f4d6f8..40cd17a21 100644 --- a/template-parts/content-blocks/block-cta.php +++ b/template-parts/content-blocks/block-cta.php @@ -6,10 +6,10 @@ */ // Set up fields. -$title = get_sub_field( 'title' ); -$text = get_sub_field( 'text' ); -$button_url = get_sub_field( 'button_url' ); -$button_text = get_sub_field( 'button_text' ); +$title = get_sub_field( 'title' ); +$text = get_sub_field( 'text' ); +$button_url = get_sub_field( 'button_url' ); +$button_text = get_sub_field( 'button_text' ); $animation_class = _s_get_animation_class(); // Start a with possible block options. diff --git a/template-parts/content-blocks/block-fifty_media_text.php b/template-parts/content-blocks/block-fifty_media_text.php index 64a8ee754..d42309180 100644 --- a/template-parts/content-blocks/block-fifty_media_text.php +++ b/template-parts/content-blocks/block-fifty_media_text.php @@ -6,8 +6,8 @@ */ // Set up fields. -$image_data = get_sub_field( 'media_left' ); -$text = get_sub_field( 'text_primary' ); +$image_data = get_sub_field( 'media_left' ); +$text = get_sub_field( 'text_primary' ); $animation_class = _s_get_animation_class(); // Start a with a possible media background. diff --git a/template-parts/content-blocks/block-fifty_text_media.php b/template-parts/content-blocks/block-fifty_text_media.php index ba4644bc6..6ca8802f5 100644 --- a/template-parts/content-blocks/block-fifty_text_media.php +++ b/template-parts/content-blocks/block-fifty_text_media.php @@ -6,8 +6,8 @@ */ // Set up fields. -$image_data = get_sub_field( 'media_right' ); -$text = get_sub_field( 'text_primary' ); +$image_data = get_sub_field( 'media_right' ); +$text = get_sub_field( 'text_primary' ); $animation_class = _s_get_animation_class(); // Start a with a possible media background. diff --git a/template-parts/content-blocks/block-fifty_text_only.php b/template-parts/content-blocks/block-fifty_text_only.php index 5d64eb3d9..80d55f5b3 100644 --- a/template-parts/content-blocks/block-fifty_text_only.php +++ b/template-parts/content-blocks/block-fifty_text_only.php @@ -6,8 +6,8 @@ */ // Set up fields. -$text_primary = get_sub_field( 'text_primary' ); -$text_secondary = get_sub_field( 'text_secondary' ); +$text_primary = get_sub_field( 'text_primary' ); +$text_secondary = get_sub_field( 'text_secondary' ); $animation_class = _s_get_animation_class(); // Start a with a possible media background. diff --git a/template-parts/content-blocks/block-generic_content.php b/template-parts/content-blocks/block-generic_content.php index 1c15a7f48..c64c69140 100644 --- a/template-parts/content-blocks/block-generic_content.php +++ b/template-parts/content-blocks/block-generic_content.php @@ -6,8 +6,8 @@ */ // Set up fields. -$title = get_sub_field( 'title' ); -$content = get_sub_field( 'content' ); +$title = get_sub_field( 'title' ); +$content = get_sub_field( 'content' ); $animation_class = _s_get_animation_class(); // Start a with possible block options. diff --git a/template-parts/content-blocks/block-hero.php b/template-parts/content-blocks/block-hero.php index 473a73729..d445bd591 100644 --- a/template-parts/content-blocks/block-hero.php +++ b/template-parts/content-blocks/block-hero.php @@ -6,7 +6,7 @@ */ // Set up fields. -$hero = get_sub_field( 'hero_slides' ); +$hero = get_sub_field( 'hero_slides' ); $slide_count = count( $hero ); // Start repeater markup... @@ -26,10 +26,10 @@ the_row(); // Set up fields. - $title = get_sub_field( 'headline' ); - $text = get_sub_field( 'text' ); - $button_text = get_sub_field( 'button_text' ); - $button_url = get_sub_field( 'button_url' ); + $title = get_sub_field( 'headline' ); + $text = get_sub_field( 'text' ); + $button_text = get_sub_field( 'button_text' ); + $button_url = get_sub_field( 'button_url' ); $animation_class = _s_get_animation_class(); // Start a with possible block options. diff --git a/template-parts/content-blocks/block-recent_posts.php b/template-parts/content-blocks/block-recent_posts.php index d8ca14d15..59b5cb544 100644 --- a/template-parts/content-blocks/block-recent_posts.php +++ b/template-parts/content-blocks/block-recent_posts.php @@ -10,10 +10,10 @@ */ // Set up fields. -$title = get_sub_field( 'title' ); -$post_count = get_sub_field( 'number_of_posts' ); -$categories = get_sub_field( 'categories' ); -$tags = get_sub_field( 'tags' ); +$title = get_sub_field( 'title' ); +$post_count = get_sub_field( 'number_of_posts' ); +$categories = get_sub_field( 'categories' ); +$tags = get_sub_field( 'tags' ); $animation_class = _s_get_animation_class(); // Variable to hold query args. diff --git a/template-parts/content-blocks/block-related_posts.php b/template-parts/content-blocks/block-related_posts.php index 105069b1f..56d3268b7 100644 --- a/template-parts/content-blocks/block-related_posts.php +++ b/template-parts/content-blocks/block-related_posts.php @@ -6,8 +6,8 @@ */ // Set up fields. -$title = get_sub_field( 'title' ); -$related_posts = get_sub_field( 'related_posts' ); +$title = get_sub_field( 'title' ); +$related_posts = get_sub_field( 'related_posts' ); $animation_class = _s_get_animation_class(); // Display section if we have any posts. diff --git a/template-parts/scaffolding/scaffolding-icons.php b/template-parts/scaffolding/scaffolding-icons.php index 19ecff022..9381419f9 100644 --- a/template-parts/scaffolding/scaffolding-icons.php +++ b/template-parts/scaffolding/scaffolding-icons.php @@ -20,7 +20,7 @@ 'parameters' => array( '$args' => '(required) Configuration arguments.', ), - 'arguments' => array( + 'arguments' => array( 'icon' => '(required) The SVG icon file name. Default none', 'title' => '(optional) The title of the icon. Default: none', 'desc' => '(optional) The description of the icon. Default: none', @@ -28,7 +28,7 @@ 'height' => '(optional) The height of the icon. Default: none', 'width' => '(optional) The width of the icon. Default: none', ), - 'output' => _s_display_svg( array( + 'output' => _s_display_svg( array( 'icon' => 'facebook-square', ) ), ) );