Escapes based on phpcs #9

This commit is contained in:
Savvas Hadjigeorgiou
2021-11-12 07:41:10 +02:00
parent fa4a51461c
commit f5aae77471
4 changed files with 35 additions and 35 deletions

View File

@@ -470,7 +470,7 @@ if ( class_exists( 'WP_Importer' ) ) {
// Show Result
echo '<div class="updated settings-error below-h2"><p>
' . sprintf( __( 'Import complete - imported <strong>%1$s</strong> events and skipped <strong>%2$s</strong>.', 'sportspress' ), $this->imported, $this->skipped ) . '
' . sprintf( esc_html__( 'Import complete - imported <strong>%1$s</strong> events and skipped <strong>%2$s</strong>.', 'sportspress' ), esc_html( $this->imported ), esc_html( $this->skipped ) ) . '
</p></div>';
$this->import_end();
@@ -480,7 +480,7 @@ if ( class_exists( 'WP_Importer' ) ) {
* Performs post-import cleanup of files and the cache
*/
function import_end() {
echo '<p>' . __( 'All done!', 'sportspress' ) . ' <a href="' . admin_url( 'edit.php?post_type=sp_event' ) . '">' . __( 'View Events', 'sportspress' ) . '</a>' . '</p>';
echo '<p>' . esc_html__( 'All done!', 'sportspress' ) . ' <a href="' . esc_url( admin_url( 'edit.php?post_type=sp_event' ) ) . '">' . esc_html__( 'View Events', 'sportspress' ) . '</a>' . '</p>';
do_action( 'import_end' );
}
@@ -493,9 +493,9 @@ if ( class_exists( 'WP_Importer' ) ) {
*/
function greet() {
echo '<div class="narrow">';
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '</p>';
echo '<p>' . sprintf( __( 'Events need to be defined with columns in a specific order (3+ columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/events-sample.csv' ) . '</p>';
echo '<p>' . sprintf( __( 'Supports CSV files generated by <a href="%s">LeagueLobster</a>.', 'sportspress' ), 'http://tboy.co/leaguelobster' ) . '</p>';
echo '<p>' . esc_html__( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '</p>';
echo '<p>' . sprintf( esc_html__( 'Events need to be defined with columns in a specific order (3+ columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), esc_url( plugin_dir_url( SP_PLUGIN_FILE ) ) . 'dummy-data/events-sample.csv' ) . '</p>';
echo '<p>' . sprintf( esc_html__( 'Supports CSV files generated by <a href="%s">LeagueLobster</a>.', 'sportspress' ), 'http://tboy.co/leaguelobster' ) . '</p>';
wp_import_upload_form( 'admin.php?import=sp_event_csv&step=1' );
echo '</div>';
}
@@ -511,7 +511,7 @@ if ( class_exists( 'WP_Importer' ) ) {
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label><?php _e( 'Format', 'sportspress' ); ?></label><br/></th>
<th scope="row"><label><?php esc_html_e( 'Format', 'sportspress' ); ?></label><br/></th>
<td class="forminp forminp-radio" id="sp_formatdiv">
<fieldset id="post-formats-select">
<ul>
@@ -527,24 +527,24 @@ if ( class_exists( 'WP_Importer' ) ) {
</td>
</tr>
<tr>
<th scope="row"><label><?php _e( 'League', 'sportspress' ); ?></label><br/></th>
<th scope="row"><label><?php esc_html_e( 'League', 'sportspress' ); ?></label><br/></th>
<td>
<?php
$args = array(
'taxonomy' => 'sp_league',
'name' => 'sp_league',
'values' => 'slug',
'show_option_none' => __( '&mdash; Not set &mdash;', 'sportspress' ),
'show_option_none' => esc_attr__( '&mdash; Not set &mdash;', 'sportspress' ),
);
if ( ! sp_dropdown_taxonomies( $args ) ) :
echo '<p>' . __( 'None', 'sportspress' ) . '</p>';
echo '<p>' . esc_html__( 'None', 'sportspress' ) . '</p>';
sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
endif;
?>
</td>
</tr>
<tr>
<th scope="row"><label><?php _e( 'Season', 'sportspress' ); ?></label><br/></th>
<th scope="row"><label><?php esc_html_e( 'Season', 'sportspress' ); ?></label><br/></th>
<td>
<?php
$args = array(
@@ -554,7 +554,7 @@ if ( class_exists( 'WP_Importer' ) ) {
'show_option_none' => __( '&mdash; Not set &mdash;', 'sportspress' ),
);
if ( ! sp_dropdown_taxonomies( $args ) ) :
echo '<p>' . __( 'None', 'sportspress' ) . '</p>';
echo '<p>' . esc_html__( 'None', 'sportspress' ) . '</p>';
sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
endif;
?>
@@ -562,7 +562,7 @@ if ( class_exists( 'WP_Importer' ) ) {
</tr>
<tr>
<th scope="row" class="titledesc">
<?php _e( 'Date Format', 'sportspress' ); ?>
<?php esc_html_e( 'Date Format', 'sportspress' ); ?>
</th>
<td class="forminp forminp-radio">
<fieldset>

View File

@@ -104,8 +104,8 @@ if ( class_exists( 'WP_Importer' ) ) {
*/
function dropdown( $selected ) {
?>
<select name="sp_columns[]" data-index="<?php echo array_search( $selected, array_keys( $this->columns ) ); ?>">
<option value="0">&mdash; <?php _e( 'Disable', 'sportspress' ); ?> &mdash;</option>
<select name="sp_columns[]" data-index="<?php echo esc_attr( array_search( $selected, array_keys( $this->columns ) ) ); ?>">
<option value="0">&mdash; <?php esc_html_e( 'Disable', 'sportspress' ); ?> &mdash;</option>
<?php foreach ( $this->columns as $key => $label ) : ?>
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $selected, $key ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
@@ -150,7 +150,7 @@ if ( class_exists( 'WP_Importer' ) ) {
</th>
<?php endforeach; ?>
<th scope="col" class="sp-actions-column">
<a href="#" title="<?php _e( 'Insert row after', 'sportspress' ); ?>" class="dashicons dashicons-plus-alt sp-add-row sp-add-first"></a>
<a href="#" title="<?php esc_attr_e( 'Insert row after', 'sportspress' ); ?>" class="dashicons dashicons-plus-alt sp-add-row sp-add-first"></a>
</th>
</tr>
</thead>
@@ -167,15 +167,15 @@ if ( class_exists( 'WP_Importer' ) ) {
<?php
if ( in_array( $key, $this->optionals ) ) {
?>
placeholder="<?php _e( 'Default', 'sportspress' ); ?>"<?php } ?>>
placeholder="<?php esc_attr_e( 'Default', 'sportspress' ); ?>"<?php } ?>>
</td>
<?php
$index ++;
endforeach;
?>
<td class="sp-actions-column">
<a href="#" title="<?php _e( 'Delete row', 'sportspress' ); ?>" class="dashicons dashicons-dismiss sp-delete-row"></a>
<a href="#" title="<?php _e( 'Insert row after', 'sportspress' ); ?>" class="dashicons dashicons-plus-alt sp-add-row"></a>
<a href="#" title="<?php esc_attr_e( 'Delete row', 'sportspress' ); ?>" class="dashicons dashicons-dismiss sp-delete-row"></a>
<a href="#" title="<?php esc_attr_e( 'Insert row after', 'sportspress' ); ?>" class="dashicons dashicons-plus-alt sp-add-row"></a>
</td>
</tr>
<?php
@@ -189,13 +189,13 @@ endwhile;
</td>
<?php endforeach; ?>
<td class="sp-actions-column">
<a href="#" title="<?php _e( 'Insert row after', 'sportspress' ); ?>" class="dashicons dashicons-plus-alt sp-add-row"></a>
<a href="#" title="<?php esc_attr_e( 'Insert row after', 'sportspress' ); ?>" class="dashicons dashicons-plus-alt sp-add-row"></a>
</td>
</tr>
</tbody>
</table>
<p class="sp-post-count alignright">
<?php printf( __( 'Displaying %1$s&#8211;%2$s of %3$s', 'sportspress' ), 1, $this->imported + 1, $this->imported + 1 ); ?>
<?php printf( esc_html__( 'Displaying %1$s&#8211;%2$s of %3$s', 'sportspress' ), 1, esc_html( $this->imported + 1 ), esc_html( $this->imported + 1 ) ); ?>
</p>
<p class="submit">
<input type="submit" class="button button-primary button-hero" value="<?php echo esc_attr( $this->import_label ); ?>" />
@@ -204,8 +204,8 @@ endwhile;
<?php
else :
echo '<p><strong>' . __( 'Sorry, there has been an error.', 'sportspress' ) . '</strong><br />';
_e( 'The CSV is invalid.', 'sportspress' ) . '</p>';
echo '<p><strong>' . esc_html__( 'Sorry, there has been an error.', 'sportspress' ) . '</strong><br />';
esc_html_e( 'The CSV is invalid.', 'sportspress' ) . '</p>';
$this->footer();
die();
@@ -240,7 +240,7 @@ endwhile;
$file = wp_import_handle_upload();
if ( isset( $file['error'] ) ) {
echo '<p><strong>' . __( 'Sorry, there has been an error.', 'sportspress' ) . '</strong><br />';
echo '<p><strong>' . esc_html__( 'Sorry, there has been an error.', 'sportspress' ) . '</strong><br />';
echo esc_html( $file['error'] ) . '</p>';
return false;
}
@@ -255,7 +255,7 @@ endwhile;
} else {
echo '<p><strong>' . __( 'Sorry, there has been an error.', 'sportspress' ) . '</strong></p>';
echo '<p><strong>' . esc_html__( 'Sorry, there has been an error.', 'sportspress' ) . '</strong></p>';
return false;
}
@@ -271,7 +271,7 @@ endwhile;
* @return void
*/
function header() {
echo '<div class="wrap"><h2>' . $this->import_label . '</h2>';
echo '<div class="wrap"><h2>' . esc_html( $this->import_label ) . '</h2>';
}
/**

View File

@@ -83,7 +83,7 @@ if ( class_exists( 'WP_Importer' ) ) {
// Show Result
echo '<div class="updated settings-error below-h2"><p>
' . sprintf( __( 'Import complete - imported <strong>%1$s</strong> officials and skipped <strong>%2$s</strong>.', 'sportspress' ), $this->imported, $this->skipped ) . '
' . sprintf( esc_html__( 'Import complete - imported <strong>%1$s</strong> officials and skipped <strong>%2$s</strong>.', 'sportspress' ), esc_html( $this->imported ), esc_html( $this->skipped ) ) . '
</p></div>';
$this->import_end();
@@ -93,7 +93,7 @@ if ( class_exists( 'WP_Importer' ) ) {
* Performs post-import cleanup of files and the cache
*/
function import_end() {
echo '<p>' . __( 'All done!', 'sportspress' ) . ' <a href="' . admin_url( 'edit.php?post_type=sp_official' ) . '">' . __( 'View Officials', 'sportspress' ) . '</a>' . '</p>';
echo '<p>' . esc_html__( 'All done!', 'sportspress' ) . ' <a href="' . esc_url( admin_url( 'edit.php?post_type=sp_official' ) ) . '">' . esc_html__( 'View Officials', 'sportspress' ) . '</a>' . '</p>';
do_action( 'import_end' );
}
@@ -105,7 +105,7 @@ if ( class_exists( 'WP_Importer' ) ) {
* @return void
*/
function header() {
echo '<div class="wrap"><h2>' . __( 'Import Officials', 'sportspress' ) . '</h2>';
echo '<div class="wrap"><h2>' . esc_html__( 'Import Officials', 'sportspress' ) . '</h2>';
}
/**
@@ -116,8 +116,8 @@ if ( class_exists( 'WP_Importer' ) ) {
*/
function greet() {
echo '<div class="narrow">';
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '</p>';
echo '<p>' . sprintf( __( 'Officials need to be defined with columns in a specific order. <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/officials-sample.csv' ) . '</p>';
echo '<p>' . esc_html__( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '</p>';
echo '<p>' . sprintf( esc_html__( 'Officials need to be defined with columns in a specific order. <a href="%s">Click here to download a sample</a>.', 'sportspress' ), esc_url( plugin_dir_url( SP_PLUGIN_FILE ) ) . 'dummy-data/officials-sample.csv' ) . '</p>';
wp_import_upload_form( 'admin.php?import=sp_official_csv&step=1' );
echo '</div>';
}

View File

@@ -120,7 +120,7 @@ if ( class_exists( 'WP_Importer' ) ) {
// Show Result
echo '<div class="updated settings-error below-h2"><p>
' . sprintf( __( 'Import complete - imported <strong>%1$s</strong> teams and skipped <strong>%2$s</strong>.', 'sportspress' ), $this->imported, $this->skipped ) . '
' . sprintf( esc_html__( 'Import complete - imported <strong>%1$s</strong> teams and skipped <strong>%2$s</strong>.', 'sportspress' ), esc_html( $this->imported ), esc_html( $this->skipped ) ) . '
</p></div>';
$this->import_end();
@@ -130,7 +130,7 @@ if ( class_exists( 'WP_Importer' ) ) {
* Performs post-import cleanup of files and the cache
*/
function import_end() {
echo '<p>' . __( 'All done!', 'sportspress' ) . ' <a href="' . admin_url( 'edit.php?post_type=sp_team' ) . '">' . __( 'View Teams', 'sportspress' ) . '</a>' . '</p>';
echo '<p>' . esc_html__( 'All done!', 'sportspress' ) . ' <a href="' . esc_url( admin_url( 'edit.php?post_type=sp_team' ) ) . '">' . esc_html__( 'View Teams', 'sportspress' ) . '</a>' . '</p>';
do_action( 'import_end' );
}
@@ -143,8 +143,8 @@ if ( class_exists( 'WP_Importer' ) ) {
*/
function greet() {
echo '<div class="narrow">';
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '</p>';
echo '<p>' . sprintf( __( 'Teams need to be defined with columns in a specific order (3 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/teams-sample.csv' ) . '</p>';
echo '<p>' . esc_html__( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '</p>';
echo '<p>' . sprintf( esc_html__( 'Teams need to be defined with columns in a specific order (3 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), esc_url( plugin_dir_url( SP_PLUGIN_FILE ) ) . 'dummy-data/teams-sample.csv' ) . '</p>';
wp_import_upload_form( 'admin.php?import=sp_team_csv&step=1' );
echo '</div>';
}
@@ -164,7 +164,7 @@ if ( class_exists( 'WP_Importer' ) ) {
<label>
<input type="hidden" name="merge" value="0">
<input type="checkbox" name="merge" value="1" checked="checked">
<?php _e( 'Merge duplicates', 'sportspress' ); ?>
<?php esc_html_e( 'Merge duplicates', 'sportspress' ); ?>
</label>
</td>
</tr>