@@ -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__ . '\\specific_number_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__ . '\\specific_number_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]', |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | * @return string The filtered output. |
| 56 | 56 | */ |
| 57 | 57 | function specific_number_of_players( $game_id, $players_min_max, $output ) { |
| 58 | - if ( absint( $players_min_max['min'] ) === absint( $players_min_max['max'] ) ) { |
|
| 58 | + if ( absint( $players_min_max[ 'min' ] ) === absint( $players_min_max[ 'max' ] ) ) { |
|
| 59 | 59 | ob_start(); ?> |
| 60 | 60 | |
| 61 | 61 | <span class="gc-icon icon-game-players"><?php Display\the_svg( 'players', false ); ?></span><span class="game-num-players" id="game-<?php echo absint( $game_id ); ?>-num-players"> |
| 62 | 62 | <?php |
| 63 | 63 | echo 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 | </span> |
@@ -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,14 +252,14 @@ 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 | ob_start(); ?> |
| 257 | 257 | |
| 258 | 258 | <span class="gc-icon icon-game-players"><?php the_svg( 'players', false ); ?></span><span class="game-num-players" id="game-<?php echo absint( $game_id ); ?>-num-players"><?php echo esc_attr( sprintf( |
| 259 | 259 | // Translators: 1: Minimum number of players, 2: Maximum number of players. |
| 260 | 260 | __( '%1$d %2$s players', 'games-collector' ), |
| 261 | - absint( $players_min_max['min'] ), |
|
| 262 | - isset( $players_min_max['max'] ) ? sprintf( '- %d', absint( $players_min_max['max'] ) ) : '+' |
|
| 261 | + absint( $players_min_max[ 'min' ] ), |
|
| 262 | + isset( $players_min_max[ 'max' ] ) ? sprintf( '- %d', absint( $players_min_max[ 'max' ] ) ) : '+' |
|
| 263 | 263 | ) ); ?></span><?php |
| 264 | 264 | |
| 265 | 265 | $output = ob_get_clean(); |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | return; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - wp_enqueue_style( 'games-collector', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/assets/css/games-collector.css', [], '1.1.0-r2' ); |
|
| 373 | + wp_enqueue_style( 'games-collector', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/assets/css/games-collector.css', [ ], '1.1.0-r2' ); |
|
| 374 | 374 | wp_enqueue_script( 'isotope', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/assets/js/isotope.pkgd.min.js', [ 'jquery' ], '3.0.1', true ); |
| 375 | 375 | wp_enqueue_script( 'games-collector', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/assets/js/games-collector.js', [ 'jquery', 'isotope' ], '0.2' ); |
| 376 | 376 | } |