/** * validates a single shipping band */ private static function validate_shipping_band($band, $band_index, $default) { $details = array(); if (isset($band["name_" . $band_index]) && trim($band["name_" . $band_index]) !== "" && isset($band["band_id_" . $band_index]) && trim($band["band_id_" . $band_index]) !== "") { $regions = parent::get_shipping_regions(); foreach ($regions as $region_code => $region_data) { // get shorthand for array indexes $s1 = "shipping_one_" . $region_code . "_" . $band_index; $sm = "shipping_multiple_" . $region_code . "_" . $band_index; if (isset($band[$s1]) && trim($band[$s1]) !== "" && isset($band[$sm]) && trim($band[$sm]) !== "") { $details[$region_code] = array(); $details[$region_code]["shipping_one"] = SimplePayPalPluginAdmin::dec2($band[$s1]); $details[$region_code]["shipping_multiple"] = SimplePayPalPluginAdmin::dec2($band[$sm]); } } if (count($details)) { $details["name"] = trim($band["name_" . $band_index]); $details["band_id"] = $band["band_id_" . $band_index]; $details["default"] = $default == $band_index ? 1 : 0; $details["additional_free"] = isset($band["additional_free_" . $band_index]) ? 1 : 0; } } return $details; }