Browse Source

Public Themes P: PHP Rector fixes (#7391)

Matthew Reishus 1 year ago
parent
commit
62f9da4f99

+ 1 - 1
penscratch-2/inc/template-tags.php

@@ -60,7 +60,7 @@ function penscratch_2_categorized_blog() {
 		) );
 
 		// Count the number of categories that are attached to the posts.
-		$all_the_cool_cats = count( $all_the_cool_cats );
+		$all_the_cool_cats = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0;
 
 		set_transient( 'penscratch_2_categories', $all_the_cool_cats );
 	}

+ 1 - 0
photos/inc/icon-functions.php

@@ -30,6 +30,7 @@ add_action( 'wp_footer', 'photos_include_svg_icons', 9999 );
  * @return string SVG markup.
  */
 function photos_get_svg( $args = array() ) {
+	$unique_id = null;
 	// Make sure $args are an array.
 	if ( empty( $args ) ) {
 		return __( 'Please define default parameters in the form of an array.', 'photos' );

+ 4 - 0
photos/inc/logo-resizer.php

@@ -36,6 +36,8 @@ add_action( 'customize_register', 'photos_logo_resizer_customize_register' );
  * Add support for logo resizing by filtering `get_custom_logo`.
  */
 function photos_customize_logo_resize( $html ) {
+	$max = [];
+	$img = [];
 	$size = get_theme_mod( 'logo_size' );
 	$custom_logo_id = get_theme_mod( 'custom_logo' );
 	// set the short side minimum
@@ -91,6 +93,8 @@ add_filter( 'get_custom_logo', 'photos_customize_logo_resize' );
 
 /* Helper function to determine the max size of the logo */
 function photos_logo_resize_min_max( $short, $long, $short_max, $long_max, $percent, $min ){
+	$max = [];
+	$size = [];
 	$ratio        = ( $long / $short );
 	$max['long']  = ( $long_max >= $long ) ? $long : $long_max;
 	$max['short'] = ( $short_max >= ( $max['long'] / $ratio ) ) ? floor( $max['long'] / $ratio ) : $short_max;

+ 1 - 1
pique/inc/extras.php

@@ -155,7 +155,7 @@ class Pique_Menu extends Walker_Nav_Menu {
 		$classes = empty( $item->classes ) ? array() : (array) $item->classes;
 		$classes[] = 'menu-item-' . $item->ID;
 
-		$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
+		$class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
 		$class_names = ' class="' . esc_attr( $class_names ) . '"';
 
 		$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );

+ 2 - 1
pique/inc/template-tags.php

@@ -75,6 +75,7 @@ endif;
  * layout with multiple posts/pages shown gets confusing.
  */
 function pique_edit_link( $id ) {
+	$type = null;
 	if ( is_page() ) :
 		$type = esc_html__( 'Page', 'pique' );
 	elseif ( get_post( $id ) ) :
@@ -110,7 +111,7 @@ function pique_categorized_blog() {
 		) );
 
 		// Count the number of categories that are attached to the posts.
-		$all_the_cool_cats = count( $all_the_cool_cats );
+		$all_the_cool_cats = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0;
 
 		set_transient( 'pique_categories', $all_the_cool_cats );
 	}

+ 1 - 1
publication/inc/template-tags.php

@@ -77,7 +77,7 @@ function publication_categorized_blog() {
 		) );
 
 		// Count the number of categories that are attached to the posts.
-		$all_the_cool_cats = count( $all_the_cool_cats );
+		$all_the_cool_cats = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0;
 
 		set_transient( 'publication_categories', $all_the_cool_cats );
 	}