@@ -21,20 +21,20 @@ discard block |
||
21 | 21 | * @return string Displays a list of all games. |
22 | 22 | */ |
23 | 23 | function shortcode( $atts ) { |
24 | - $atts = shortcode_atts([ |
|
24 | + $atts = shortcode_atts( [ |
|
25 | 25 | 'gc_game' => '', |
26 | 26 | ], $atts ); |
27 | 27 | |
28 | 28 | // Get the ID from the atts, if one was set, so we can get a single game (or all games). |
29 | 29 | $post_ids = null; |
30 | - if ( '' === $atts['gc_game'] ) { |
|
31 | - $post_ids = []; |
|
32 | - } elseif ( is_array( $atts['gc_game'] ) ) { |
|
33 | - $post_ids = $atts['gc_game']; |
|
34 | - } elseif ( false !== strpos( (string) $atts['gc_game'], ',' ) ) { |
|
35 | - $post_ids = explode( ',', $atts['gc_game'] ); |
|
36 | - } elseif ( ! is_array( $atts['gc_game'] ) ) { |
|
37 | - $post_ids = [ $atts['gc_game'] ]; |
|
30 | + if ( '' === $atts[ 'gc_game' ] ) { |
|
31 | + $post_ids = [ ]; |
|
32 | + } elseif ( is_array( $atts[ 'gc_game' ] ) ) { |
|
33 | + $post_ids = $atts[ 'gc_game' ]; |
|
34 | + } elseif ( false !== strpos( (string) $atts[ 'gc_game' ], ',' ) ) { |
|
35 | + $post_ids = explode( ',', $atts[ 'gc_game' ] ); |
|
36 | + } elseif ( ! is_array( $atts[ 'gc_game' ] ) ) { |
|
37 | + $post_ids = [ $atts[ 'gc_game' ] ]; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $games = get_games( $post_ids ); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | <div <?php post_class( Game\get_game_classes( 'game-single', $game->ID ), $game->ID ); ?> id="game-<?php echo absint( $game->ID ); ?>"> |
53 | 53 | |
54 | 54 | <?php |
55 | - echo Display\get_game_title( $game ); // WPCS: XSS ok, already sanitized. |
|
55 | + echo Display\get_game_title( $game ); // WPCS: XSS ok, already sanitized. |
|
56 | 56 | echo Display\get_game_info( $game->ID ); // WPCS: XSS ok, already sanitized. |
57 | 57 | ?> |
58 | 58 | |
@@ -71,31 +71,31 @@ discard block |
||
71 | 71 | * @param array $post_ids An array of game post IDs. |
72 | 72 | * @return array An array of Game WP_Post objects. |
73 | 73 | */ |
74 | -function get_games( $post_ids = [] ) { |
|
74 | +function get_games( $post_ids = [ ] ) { |
|
75 | 75 | if ( empty( $post_ids ) ) { |
76 | 76 | $post_ids = false; |
77 | 77 | } |
78 | 78 | |
79 | 79 | if ( $post_ids ) { |
80 | 80 | // If we're only displaying select games, don't show the filters. |
81 | - add_filter( 'gc_filter_buttons', '__return_null' ); |
|
81 | + add_filter( 'gc_filter_buttons', '__return_null' ); |
|
82 | 82 | add_filter( 'gc_filter_game_filters', '__return_null' ); |
83 | 83 | |
84 | - return get_posts([ |
|
84 | + return get_posts( [ |
|
85 | 85 | 'posts_per_page' => count( $post_ids ), |
86 | 86 | 'post_type' => 'gc_game', |
87 | 87 | 'post__in' => $post_ids, |
88 | 88 | 'orderby' => 'title', |
89 | 89 | 'order' => 'ASC', |
90 | - ]); |
|
90 | + ] ); |
|
91 | 91 | } |
92 | 92 | |
93 | - return get_posts([ |
|
93 | + return get_posts( [ |
|
94 | 94 | 'posts_per_page' => -1, |
95 | 95 | 'post_type' => 'gc_game', |
96 | 96 | 'orderby' => 'title', |
97 | 97 | 'order' => 'ASC', |
98 | - ]); |
|
98 | + ] ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |