Merge pull request #6228 from woothemes/tax-settings-escape

Escape js array labels.
This commit is contained in:
Mike Jolley 2014-09-11 14:45:29 +01:00
commit f72d041167
1 changed files with 2 additions and 2 deletions

View File

@ -480,7 +480,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
var availableCountries = [<?php var availableCountries = [<?php
$countries = array(); $countries = array();
foreach ( WC()->countries->get_allowed_countries() as $value => $label ) foreach ( WC()->countries->get_allowed_countries() as $value => $label )
$countries[] = '{ label: "' . $label . '", value: "' . $value . '" }'; $countries[] = '{ label: "' . esc_attr( $label ) . '", value: "' . $value . '" }';
echo implode( ', ', $countries ); echo implode( ', ', $countries );
?>]; ?>];
@ -488,7 +488,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
$countries = array(); $countries = array();
foreach ( WC()->countries->get_allowed_country_states() as $value => $label ) foreach ( WC()->countries->get_allowed_country_states() as $value => $label )
foreach ( $label as $code => $state ) foreach ( $label as $code => $state )
$countries[] = '{ label: "' . $state . '", value: "' . $code . '" }'; $countries[] = '{ label: "' . esc_attr( $state ) . '", value: "' . $code . '" }';
echo implode( ', ', $countries ); echo implode( ', ', $countries );
?>]; ?>];