Escape outputs
This commit is contained in:
@@ -4,9 +4,9 @@ class SP_Widget_Player_list extends WP_Widget {
|
||||
function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_sportspress widget_player_list widget_sp_player_list',
|
||||
'description' => __( 'Display a list of players.', 'sportspress' ),
|
||||
'description' => esc_attr__( 'Display a list of players.', 'sportspress' ),
|
||||
);
|
||||
parent::__construct( 'sportspress-player-list', __( 'Player List', 'sportspress' ), $widget_ops );
|
||||
parent::__construct( 'sportspress-player-list', esc_attr__( 'Player List', 'sportspress' ), $widget_ops );
|
||||
}
|
||||
|
||||
function widget( $args, $instance ) {
|
||||
@@ -34,10 +34,10 @@ class SP_Widget_Player_list extends WP_Widget {
|
||||
$show_all_players_link = empty( $instance['show_all_players_link'] ) ? false : $instance['show_all_players_link'];
|
||||
|
||||
do_action( 'sportspress_before_widget', $args, $instance, 'player-list' );
|
||||
echo $before_widget;
|
||||
echo wp_kses_post( $before_widget );
|
||||
|
||||
if ( $title ) {
|
||||
echo $before_title . $title . $after_title;
|
||||
echo wp_kses_post( $before_title . $title . $after_title );
|
||||
}
|
||||
|
||||
// Action to hook into
|
||||
@@ -60,7 +60,7 @@ class SP_Widget_Player_list extends WP_Widget {
|
||||
// Action to hook into
|
||||
do_action( 'sportspress_after_widget_template', $args, $instance, 'player-list' );
|
||||
|
||||
echo $after_widget;
|
||||
echo wp_kses_post( $after_widget );
|
||||
do_action( 'sportspress_after_widget', $args, $instance, 'player-list' );
|
||||
}
|
||||
|
||||
@@ -107,13 +107,13 @@ class SP_Widget_Player_list extends WP_Widget {
|
||||
// Action to hook into
|
||||
do_action( 'sportspress_before_widget_template_form', $this, $instance, 'player-list' );
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:', 'sportspress' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id( 'caption' ); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id( 'caption' ); ?>" name="<?php echo $this->get_field_name( 'caption' ); ?>" type="text" value="<?php echo esc_attr( $caption ); ?>" /></p>
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'caption' ) ); ?>"><?php esc_attr_e( 'Heading:', 'sportspress' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'caption' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'caption' ) ); ?>" type="text" value="<?php echo esc_attr( $caption ); ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id( 'id' ); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Player List', 'sportspress' ) ); ?></label>
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php printf( esc_attr__( 'Select %s:', 'sportspress' ), esc_attr__( 'Player List', 'sportspress' ) ); ?></label>
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => 'sp_list',
|
||||
@@ -124,16 +124,16 @@ class SP_Widget_Player_list extends WP_Widget {
|
||||
'class' => 'widefat',
|
||||
);
|
||||
if ( ! sp_dropdown_pages( $args ) ) :
|
||||
sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
||||
sp_post_adder( 'sp_list', esc_attr__( 'Add New', 'sportspress' ) );
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of players to show:', 'sportspress' ); ?></label>
|
||||
<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" size="3"></p>
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_attr_e( 'Number of players to show:', 'sportspress' ); ?></label>
|
||||
<input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" size="3"></p>
|
||||
|
||||
<p class="sp-prefs">
|
||||
<?php _e( 'Performance:', 'sportspress' ); ?><br>
|
||||
<?php esc_attr_e( 'Performance:', 'sportspress' ); ?><br>
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => array( 'sp_metric', 'sp_performance', 'sp_statistic' ),
|
||||
@@ -147,40 +147,40 @@ class SP_Widget_Player_list extends WP_Widget {
|
||||
$field_name = $this->get_field_name( 'columns' ) . '[]';
|
||||
$field_id = $this->get_field_id( 'columns' );
|
||||
?>
|
||||
<label class="button"><input name="<?php echo $field_name; ?>" type="checkbox" id="<?php echo $field_id; ?>-number" value="number"
|
||||
<label class="button"><input name="<?php echo esc_attr( $field_name ); ?>" type="checkbox" id="<?php echo esc_attr( $field_id ); ?>-number" value="number"
|
||||
<?php
|
||||
if ( $columns === null || in_array( 'number', $columns ) ) :
|
||||
?>
|
||||
checked="checked"<?php endif; ?>>
|
||||
<?php
|
||||
if ( 'default' == $orderby ) {
|
||||
_e( 'Rank', 'sportspress' );
|
||||
esc_attr_e( 'Rank', 'sportspress' );
|
||||
echo '/';
|
||||
_e( 'Squad Number', 'sportspress' );
|
||||
esc_attr_e( 'Squad Number', 'sportspress' );
|
||||
} elseif ( in_array( $orderby, array( 'number', 'name' ) ) ) {
|
||||
_e( 'Squad Number', 'sportspress' );
|
||||
esc_attr_e( 'Squad Number', 'sportspress' );
|
||||
} else {
|
||||
_e( 'Rank', 'sportspress' );
|
||||
esc_attr_e( 'Rank', 'sportspress' );
|
||||
}
|
||||
?>
|
||||
</label>
|
||||
<?php foreach ( $the_columns as $column ) : ?>
|
||||
<label class="button"><input name="<?php echo $field_name; ?>" type="checkbox" id="<?php echo $field_id . '-' . $column->post_name; ?>" value="<?php echo $column->post_name; ?>"
|
||||
<label class="button"><input name="<?php echo esc_attr( $field_name ); ?>" type="checkbox" id="<?php echo esc_attr( $field_id . '-' . $column->post_name ); ?>" value="<?php echo esc_attr( $column->post_name ); ?>"
|
||||
<?php
|
||||
if ( $columns === null || in_array( $column->post_name, $columns ) ) :
|
||||
?>
|
||||
checked="checked"<?php endif; ?>><?php echo $column->post_title; ?></label>
|
||||
checked="checked"<?php endif; ?>><?php echo esc_attr( $column->post_title ); ?></label>
|
||||
<?php endforeach; ?>
|
||||
</p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><?php _e( 'Sort by:', 'sportspress' ); ?></label>
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_attr_e( 'Sort by:', 'sportspress' ); ?></label>
|
||||
<?php
|
||||
$args = array(
|
||||
'prepend_options' => array(
|
||||
'default' => __( 'Default', 'sportspress' ),
|
||||
'number' => __( 'Squad Number', 'sportspress' ),
|
||||
'name' => __( 'Name', 'sportspress' ),
|
||||
'eventsplayed' => __( 'Played', 'sportspress' ),
|
||||
'default' => esc_attr__( 'Default', 'sportspress' ),
|
||||
'number' => esc_attr__( 'Squad Number', 'sportspress' ),
|
||||
'name' => esc_attr__( 'Name', 'sportspress' ),
|
||||
'eventsplayed' => esc_attr__( 'Played', 'sportspress' ),
|
||||
),
|
||||
'post_type' => array( 'sp_metric', 'sp_performance', 'sp_statistic' ),
|
||||
'name' => $this->get_field_name( 'orderby' ),
|
||||
@@ -190,19 +190,19 @@ class SP_Widget_Player_list extends WP_Widget {
|
||||
'class' => 'sp-select-orderby widefat',
|
||||
);
|
||||
if ( ! sp_dropdown_pages( $args ) ) :
|
||||
sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
||||
sp_post_adder( 'sp_list', esc_attr__( 'Add New', 'sportspress' ) );
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id( 'order' ); ?>"><?php _e( 'Sort Order:', 'sportspress' ); ?></label>
|
||||
<select name="<?php echo $this->get_field_name( 'order' ); ?>" id="<?php echo $this->get_field_id( 'order' ); ?>" class="sp-select-order widefat" <?php disabled( $orderby, 'default' ); ?>>
|
||||
<option value="ASC" <?php selected( 'ASC', $order ); ?>><?php _e( 'Ascending', 'sportspress' ); ?></option>
|
||||
<option value="DESC" <?php selected( 'DESC', $order ); ?>><?php _e( 'Descending', 'sportspress' ); ?></option>
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_attr_e( 'Sort Order:', 'sportspress' ); ?></label>
|
||||
<select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" class="sp-select-order widefat" <?php disabled( $orderby, 'default' ); ?>>
|
||||
<option value="ASC" <?php selected( 'ASC', $order ); ?>><?php esc_attr_e( 'Ascending', 'sportspress' ); ?></option>
|
||||
<option value="DESC" <?php selected( 'DESC', $order ); ?>><?php esc_attr_e( 'Descending', 'sportspress' ); ?></option>
|
||||
</select></p>
|
||||
|
||||
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id( 'show_all_players_link' ); ?>" name="<?php echo $this->get_field_name( 'show_all_players_link' ); ?>" value="1" <?php checked( $show_all_players_link, 1 ); ?>>
|
||||
<label for="<?php echo $this->get_field_id( 'show_all_players_link' ); ?>"><?php _e( 'Display link to view all players', 'sportspress' ); ?></label></p>
|
||||
<p><input class="checkbox" type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'show_all_players_link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_all_players_link' ) ); ?>" value="1" <?php checked( $show_all_players_link, 1 ); ?>>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'show_all_players_link' ) ); ?>"><?php esc_attr_e( 'Display link to view all players', 'sportspress' ); ?></label></p>
|
||||
|
||||
<?php
|
||||
// Action to hook into
|
||||
|
||||
Reference in New Issue
Block a user