Validated webhook delivery_url and topic

This commit is contained in:
Claudio Sanches 2014-12-17 10:45:20 -02:00
parent 6ccf391168
commit 9b9243fb92
1 changed files with 8 additions and 2 deletions

View File

@ -185,7 +185,9 @@ class WC_Meta_Box_Webhook_Data {
private static function update_delivery_url( $webhook ) {
$delivery_url = ! empty( $_POST['delivery_url'] ) ? $_POST['delivery_url'] : '';
$webhook->set_delivery_url( $delivery_url );
if ( wc_is_valid_url( $delivery_url ) ) {
$webhook->set_delivery_url( $delivery_url );
}
}
/**
@ -214,7 +216,11 @@ class WC_Meta_Box_Webhook_Data {
list( $resource, $event ) = explode( '.', wc_clean( $_POST['custom_topic'] ) );
}
$webhook->set_topic( $resource . '.' . $event );
$topic = $resource . '.' . $event;
if ( wc_is_webhook_valid_topic( $topic ) ) {
$webhook->set_topic( $topic );
}
}
}