@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function bootstrap() { |
16 | 16 | // Add all your plugin hooks here. |
17 | - add_action( 'cmb2_init', __NAMESPACE__ . '\\Game\\fields' ); |
|
18 | - add_action( 'init', __NAMESPACE__ . '\\Game\\register_cpt' ); |
|
19 | - add_action( 'init', __NAMESPACE__ . '\\Attributes\\register_taxonomy' ); |
|
20 | - add_action( 'admin_init', __NAMESPACE__ . '\\Attributes\\create_default_attributes' ); |
|
21 | - add_action( 'add_meta_boxes', __NAMESPACE__ . '\\Attributes\\metabox' ); |
|
22 | - add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\Attributes\\enqueue_scripts' ); |
|
23 | - add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\Display\\enqueue_scripts' ); |
|
24 | - add_action( 'register_shortcode_ui', __NAMESPACE__ . '\\Shortcode\\register_all_games_shortcode' ); |
|
25 | - add_action( 'register_shortcode_ui', __NAMESPACE__ . '\\Shortcode\\register_individual_games_shortcode' ); |
|
26 | - add_filter( 'rest_prepare_gc_game', __NAMESPACE__ . '\\Api\\filter_games_json', 10, 2 ); |
|
27 | - add_filter( 'gc_filter_players', __NAMESPACE__ . '\\numbers_of_players', 10, 3 ); |
|
28 | - add_shortcode( 'games-collector', __NAMESPACE__ . '\\Shortcode\\shortcode' ); |
|
17 | + add_action( 'cmb2_init', __NAMESPACE__ . '\\Game\\fields' ); |
|
18 | + add_action( 'init', __NAMESPACE__ . '\\Game\\register_cpt' ); |
|
19 | + add_action( 'init', __NAMESPACE__ . '\\Attributes\\register_taxonomy' ); |
|
20 | + add_action( 'admin_init', __NAMESPACE__ . '\\Attributes\\create_default_attributes' ); |
|
21 | + add_action( 'add_meta_boxes', __NAMESPACE__ . '\\Attributes\\metabox' ); |
|
22 | + add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\Attributes\\enqueue_scripts' ); |
|
23 | + add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\Display\\enqueue_scripts' ); |
|
24 | + add_action( 'register_shortcode_ui', __NAMESPACE__ . '\\Shortcode\\register_all_games_shortcode' ); |
|
25 | + add_action( 'register_shortcode_ui', __NAMESPACE__ . '\\Shortcode\\register_individual_games_shortcode' ); |
|
26 | + add_filter( 'rest_prepare_gc_game', __NAMESPACE__ . '\\Api\\filter_games_json', 10, 2 ); |
|
27 | + add_filter( 'gc_filter_players', __NAMESPACE__ . '\\numbers_of_players', 10, 3 ); |
|
28 | + add_shortcode( 'games-collector', __NAMESPACE__ . '\\Shortcode\\shortcode' ); |
|
29 | 29 | add_shortcode( 'games-collector-list', __NAMESPACE__ . '\\Shortcode\\shortcode' ); |
30 | 30 | } |
31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function activate() { |
38 | 38 | if ( ! get_page_by_title( esc_html__( 'Games', 'games-collector' ) ) ) { |
39 | - wp_insert_post([ |
|
39 | + wp_insert_post( [ |
|
40 | 40 | 'post_type' => 'page', |
41 | 41 | 'post_title' => esc_html__( 'Games', 'games-collector' ), |
42 | 42 | 'post_content' => '[games-collector]', |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | function numbers_of_players( $game_id, $players_min_max, $output ) { |
60 | 60 | |
61 | 61 | // Deal with max number of players matching min number of players. |
62 | - if ( absint( $players_min_max['min'] ) === absint( $players_min_max['max'] ) ) { |
|
62 | + if ( absint( $players_min_max[ 'min' ] ) === absint( $players_min_max[ 'max' ] ) ) { |
|
63 | 63 | return esc_attr( sprintf( |
64 | 64 | // Translators: %d is the number of players. |
65 | - _n( '%d player', '%d players', absint( $players_min_max['min'] ), 'games-collector' ), |
|
66 | - absint( $players_min_max['min'] ) |
|
65 | + _n( '%d player', '%d players', absint( $players_min_max[ 'min' ] ), 'games-collector' ), |
|
66 | + absint( $players_min_max[ 'min' ] ) |
|
67 | 67 | ) ); |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Deal with indeterminate or large number of max players. |
71 | - if ( 0 === absint( $players_min_max['max'] ) || 20 <= absint( $players_min_max['max'] ) ) { |
|
71 | + if ( 0 === absint( $players_min_max[ 'max' ] ) || 20 <= absint( $players_min_max[ 'max' ] ) ) { |
|
72 | 72 | return esc_attr( sprintf( |
73 | 73 | // Translators: %d is the minimum number players. |
74 | 74 | __( '%d+ players', 'games-collector' ), |
75 | - absint( $players_min_max['min'] ) |
|
75 | + absint( $players_min_max[ 'min' ] ) |
|
76 | 76 | ) ); |
77 | 77 | } |
78 | 78 |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | |
60 | 60 | <div class="game-info" id="game-<?php echo absint( $game_id ); ?>-info"> |
61 | 61 | <?php |
62 | - echo get_players( $game_id ); // WPCS: XSS ok, already sanitized. |
|
62 | + echo get_players( $game_id ); // WPCS: XSS ok, already sanitized. |
|
63 | 63 | echo get_playing_time( $game_id ); // WPCS: XSS ok, already sanitized. |
64 | - echo get_age( $game_id ); // WPCS: XSS ok, already sanitized. |
|
65 | - echo get_difficulty( $game_id ); // WPCS: XSS ok, already sanitized. |
|
66 | - echo get_attributes( $game_id ); // WPCS: XSS ok, already sanitized. |
|
64 | + echo get_age( $game_id ); // WPCS: XSS ok, already sanitized. |
|
65 | + echo get_difficulty( $game_id ); // WPCS: XSS ok, already sanitized. |
|
66 | + echo get_attributes( $game_id ); // WPCS: XSS ok, already sanitized. |
|
67 | 67 | ?> |
68 | 68 | </div> |
69 | 69 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return string Select markup for filters. |
158 | 158 | */ |
159 | 159 | function get_filters() { |
160 | - $player_filter = '<div class="player-filter"><label for="players-filter-select">' . esc_html__( 'How many players?', 'games-collector' ) . ':</label> |
|
160 | + $player_filter = '<div class="player-filter"><label for="players-filter-select">' . esc_html__( 'How many players?', 'games-collector' ) . ':</label> |
|
161 | 161 | <select class="players-filter-select"> |
162 | 162 | <option selected>- ' . esc_html__( 'Select one', 'games-collector' ) . ' -</option> |
163 | 163 | <option value=".2-players,.min-2-players,.max-2-players,.max-3-players,.max-4-players,.max-5-players,.max-6-players,.max-7-players,.8-or-more-players">' . esc_html__( '2+ players', 'games-collector' ) . '</option> |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $attribute_list = Attributes\get_the_attribute_list( |
228 | 228 | $game_id, |
229 | 229 | '<div class="game-attributes"><span class="gc-icon icon-game-attributes">' . get_svg( 'tags', false ) . '</span><span class="game-attributes" id="game-' . absint( $game_id ) . '-attributes">', // Before. |
230 | - ', ', // Seperator. |
|
230 | + ', ', // Seperator. |
|
231 | 231 | '</span></div>' // After. |
232 | 232 | ); |
233 | 233 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | function get_players( $game_id ) { |
253 | 253 | $players_min_max = Game\get_players_min_max( $game_id ); |
254 | 254 | |
255 | - if ( isset( $players_min_max['min'] ) ) { |
|
255 | + if ( isset( $players_min_max[ 'min' ] ) ) { |
|
256 | 256 | /** |
257 | 257 | * Allow the # of players to be filtered (but only if there actually are players). |
258 | 258 | * |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | $num_players = apply_filters( 'gc_filter_players', $game_id, $players_min_max, sprintf( |
266 | 266 | // Translators: 1: Minimum number of players, 2: Maximum number of players. |
267 | 267 | __( '%1$d %2$s players', 'games-collector' ), |
268 | - absint( $players_min_max['min'] ), |
|
269 | - isset( $players_min_max['max'] ) ? sprintf( '- %d', absint( $players_min_max['max'] ) ) : '+' |
|
268 | + absint( $players_min_max[ 'min' ] ), |
|
269 | + isset( $players_min_max[ 'max' ] ) ? sprintf( '- %d', absint( $players_min_max[ 'max' ] ) ) : '+' |
|
270 | 270 | ) ); |
271 | 271 | |
272 | 272 | ob_start(); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | return; |
385 | 385 | } |
386 | 386 | |
387 | - wp_enqueue_style( 'games-collector', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/assets/css/games-collector.css', [], '1.1.0-r2' ); |
|
387 | + wp_enqueue_style( 'games-collector', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/assets/css/games-collector.css', [ ], '1.1.0-r2' ); |
|
388 | 388 | wp_enqueue_script( 'isotope', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/assets/js/isotope.pkgd.min.js', [ 'jquery' ], '3.0.1', true ); |
389 | 389 | wp_enqueue_script( 'games-collector', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/assets/js/games-collector.js', [ 'jquery', 'isotope' ], '0.2' ); |
390 | 390 | } |