Skip to content

Commit 51a307b

Browse files
committed
Fix simple liniting issues
1 parent 35a93e3 commit 51a307b

File tree

1 file changed

+40
-30
lines changed

1 file changed

+40
-30
lines changed

themes/osi/inc/template-functions.php

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @return array
1414
*/
15-
function osi_body_classes( $classes ) {
15+
function osi_body_classes( array $classes ) {
1616
// Adds a class of hfeed to non-singular pages.
1717
if ( ! is_singular() ) {
1818
$classes[] = 'hfeed';
@@ -55,7 +55,16 @@ function is_blog() {
5555
return ( ( 'post' === $posttype ) && ( is_home() || is_single() || is_archive() || is_category() || is_tag() || is_author() ) ) ? true : false;
5656
}
5757

58-
function fix_blog_link_on_cpt( $classes, $item, $args ) {
58+
/**
59+
* Fixes blog link for cpt.
60+
*
61+
* @param array $classes The classes.
62+
* @param object $item The link item.
63+
* @param array $args Additional args.
64+
*
65+
* @return array
66+
*/
67+
function fix_blog_link_on_cpt( $classes, $item, $args ) { //phpcs:ignore
5968
if ( ! is_blog() ) {
6069
$blog_page_id = intval( get_option( 'page_for_posts' ) );
6170

@@ -76,13 +85,13 @@ function fix_blog_link_on_cpt( $classes, $item, $args ) {
7685
*
7786
* @link http://justintadlock.com/archives/2011/07/01/captions-in-wordpress
7887
*
79-
* @param string $output The caption output. Default empty.
80-
* @param array $attr Attributes of the caption shortcode.
88+
* @param string $output The caption output. Default empty.
89+
* @param array $attr Attributes of the caption shortcode.
8190
* @param string $content The image element output.
8291
*
8392
* @return string
8493
*/
85-
function osi_caption( $output, $attr, $content ) {
94+
function osi_caption( $output, $attr, $content ) { //phpcs:ignore
8695
if ( is_feed() ) {
8796
return $output;
8897
}
@@ -116,13 +125,13 @@ function osi_caption( $output, $attr, $content ) {
116125

117126

118127
/**
119-
* remove width attribute of thumbnails
128+
* Remove width attribute of thumbnails.
120129
*
121130
* @param string $html The HTML content.
122131
*
123132
* @return string
124133
*/
125-
function osi_remove_width_attribute( $html ) {
134+
function osi_remove_width_attribute( string $html ): string {
126135
$html = preg_replace( '/(width|height)="\d*"\s/', '', $html );
127136
return $html;
128137
}
@@ -133,11 +142,11 @@ function osi_remove_width_attribute( $html ) {
133142
* From http://wordpress.stackexchange.com/questions/115368/overide-gallery-default-link-to-settings
134143
* Default image links in gallery (not the same as image_default_link_type)
135144
*
136-
* @param array $settings
145+
* @param array $settings The settings array.
137146
*
138147
* @return array
139148
*/
140-
function osi_gallery_default_type_set_link( $settings ) {
149+
function osi_gallery_default_type_set_link( array $settings ): array {
141150
$settings['galleryDefaults']['link'] = 'file';
142151
return $settings;
143152
}
@@ -161,12 +170,12 @@ function osi_inline_media_styles() {
161170
return $styles;
162171
}
163172

164-
/**
165-
* Check if we're on the license search page
166-
*
167-
* @return boolean
168-
*/
169173
if ( ! function_exists( 'is_license_search' ) ) {
174+
/**
175+
* Check if we're on the license search page
176+
*
177+
* @return boolean
178+
*/
170179
function is_license_search() {
171180
if ( ! isset( $_REQUEST['ls'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
172181
return false;
@@ -176,12 +185,13 @@ function is_license_search() {
176185
}
177186
}
178187

179-
/**
180-
* Get the license search query
181-
*
182-
* @return string
183-
*/
188+
184189
if ( ! function_exists( 'get_license_search_query' ) ) {
190+
/**
191+
* Get the license search query
192+
*
193+
* @return string
194+
*/
185195
function get_license_search_query() {
186196
$query = isset( $_REQUEST['ls'] ) ? $_REQUEST['ls'] : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
187197

@@ -194,15 +204,15 @@ function get_license_search_query() {
194204

195205
/**
196206
* Meta Block Field Filter Date
197-
*
198-
* @param string $content The content of the block.
199-
* @param array $attributes The attributes of the block.
200-
* @param array $block The block.
201-
* @param int $post_id The post ID.
202-
*
207+
*
208+
* @param string $content The content of the block.
209+
* @param array $attributes The attributes of the block.
210+
* @param array $block The block.
211+
* @param integer $post_id The post ID.
212+
*
203213
* @return string
204214
*/
205-
function osi_filter_meta_block_date_output( $content, $attributes, $block, $post_id ) {
215+
function osi_filter_meta_block_date_output( string $content, array $attributes, $block, $post_id ) { //phpcs:ignore
206216
if ( is_numeric( $content ) && 8 === strlen( $content ) ) {
207217
$content = DateTime::createFromFormat( 'Ymd', $content )->format( 'M Y' );
208218
}
@@ -212,12 +222,12 @@ function osi_filter_meta_block_date_output( $content, $attributes, $block, $post
212222

213223
/**
214224
* Order Press Mentions by Publication Date
215-
*
225+
*
216226
* @param WP_Query $query The WP_Query instance (passed by reference).
217-
*
227+
*
218228
* @return WP_Query
219229
*/
220-
function osi_press_mentions_by_publication_date( $query ) {
230+
function osi_press_mentions_by_publication_date( WP_Query $query ) {
221231
if ( ! is_admin() && $query->is_main_query() ) {
222232
if ( is_post_type_archive( 'press-mentions' ) ) {
223233
$query->set( 'meta_key', 'date_of_publication' );
@@ -307,7 +317,7 @@ function osi_supporters_shortcode_renderer( array $args = array() ): string {
307317
$per_page = isset( $args['limit'] ) ? $args['limit'] : -1;
308318

309319
// Override the main query for this specific case
310-
query_posts(
320+
query_posts( // phpcs:ignore
311321
array(
312322
'post_type' => 'supporter',
313323
'posts_per_page' => $per_page,

0 commit comments

Comments
 (0)