Merge pull request #2431 from thenbrent/deprecated-find-rate-args

Deprecate old params for WC_Tax->find_rates()
This commit is contained in:
Mike Jolley 2013-02-12 02:55:02 -08:00
commit 3a734e230e
1 changed files with 27 additions and 1 deletions

View File

@ -29,9 +29,35 @@ class WC_Tax {
* @param string $args (default: '')
* @return array
*/
public function find_rates( $args = '' ) {
public function find_rates( $args = array(), $deprecated_state = null, $deprecated_postcode = null, $deprecated_class = null ) {
global $wpdb;
// Make sure the arguments match the WC 2.0 structure
if ( is_string( $args ) ) {
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.0', __( 'Use $args["country"] instead.', 'woocommerce' ) );
$args = array(
'country' => $args
);
}
if ( func_num_args() > 1 ) {
if ( null !== $deprecated_state ) {
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.0', __( 'Use $args["state"] instead.', 'woocommerce' ) );
$args['state'] = $deprecated_state;
}
if ( null !== $deprecated_postcode ) {
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.0', __( 'Use $args["postcode"] instead.', 'woocommerce' ) );
$args['postcode'] = $deprecated_postcode;
}
if ( null !== $deprecated_class ) {
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.0', __( 'Use $args["tax_class"] instead.', 'woocommerce' ) );
$args['tax_class'] = $deprecated_class;
}
}
$defaults = array(
'country' => '',
'state' => '',