@@ -21,18 +21,18 @@ 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 | - $post_ids = []; |
|
30 | - if ( is_array( $atts['gc_game'] ) ) { |
|
31 | - $post_ids = $atts['gc_game']; |
|
32 | - } elseif ( false !== strpos( (string) $atts['gc_game'], ',' ) ) { |
|
33 | - $post_ids = explode( ',', $atts['gc_game'] ); |
|
34 | - } elseif ( ! is_array( $atts['gc_game'] ) ) { |
|
35 | - $post_ids = [ $atts['gc_game'] ]; |
|
29 | + $post_ids = [ ]; |
|
30 | + if ( is_array( $atts[ 'gc_game' ] ) ) { |
|
31 | + $post_ids = $atts[ 'gc_game' ]; |
|
32 | + } elseif ( false !== strpos( (string) $atts[ 'gc_game' ], ',' ) ) { |
|
33 | + $post_ids = explode( ',', $atts[ 'gc_game' ] ); |
|
34 | + } elseif ( ! is_array( $atts[ 'gc_game' ] ) ) { |
|
35 | + $post_ids = [ $atts[ 'gc_game' ] ]; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $games = get_games( $post_ids ); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | <div <?php post_class( Game\get_game_classes( 'game-single', $game->ID ), $game->ID ); ?> id="game-<?php echo absint( $game->ID ); ?>"> |
51 | 51 | |
52 | 52 | <?php |
53 | - echo Display\get_game_title( $game ); // WPCS: XSS ok, already sanitized. |
|
53 | + echo Display\get_game_title( $game ); // WPCS: XSS ok, already sanitized. |
|
54 | 54 | echo Display\get_game_info( $game->ID ); // WPCS: XSS ok, already sanitized. |
55 | 55 | ?> |
56 | 56 | |
@@ -69,31 +69,31 @@ discard block |
||
69 | 69 | * @param array $post_ids An array of game post IDs. |
70 | 70 | * @return array An array of Game WP_Post objects. |
71 | 71 | */ |
72 | -function get_games( $post_ids = [] ) { |
|
72 | +function get_games( $post_ids = [ ] ) { |
|
73 | 73 | if ( empty( $post_ids ) ) { |
74 | 74 | $post_ids = false; |
75 | 75 | } |
76 | 76 | |
77 | 77 | if ( $post_ids ) { |
78 | 78 | // If we're only displaying select games, don't show the filters. |
79 | - add_filter( 'gc_filter_buttons', '__return_null' ); |
|
79 | + add_filter( 'gc_filter_buttons', '__return_null' ); |
|
80 | 80 | add_filter( 'gc_filter_game_filters', '__return_null' ); |
81 | 81 | |
82 | - return get_posts([ |
|
82 | + return get_posts( [ |
|
83 | 83 | 'posts_per_page' => count( $post_ids ), |
84 | 84 | 'post_type' => 'gc_game', |
85 | 85 | 'post__in' => $post_ids, |
86 | 86 | 'orderby' => 'title', |
87 | 87 | 'order' => 'ASC', |
88 | - ]); |
|
88 | + ] ); |
|
89 | 89 | } |
90 | 90 | |
91 | - return get_posts([ |
|
91 | + return get_posts( [ |
|
92 | 92 | 'posts_per_page' => -1, |
93 | 93 | 'post_type' => 'gc_game', |
94 | 94 | 'orderby' => 'title', |
95 | 95 | 'order' => 'ASC', |
96 | - ]); |
|
96 | + ] ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |