WC_Admin_Attributes::get_posted_attribute()
Get and sanitize posted attribute data.
Метод класса: WC_Admin_Attributes{}
Хуков нет.
Возвращает
Массив
.
Использование
$result = WC_Admin_Attributes::get_posted_attribute();
Код WC_Admin_Attributes::get_posted_attribute() WC Admin Attributes::get posted attribute WC 9.4.2
private static function get_posted_attribute() { $attribute = array( 'attribute_label' => isset( $_POST['attribute_label'] ) ? wc_clean( wp_unslash( $_POST['attribute_label'] ) ) : '', // WPCS: input var ok, CSRF ok. 'attribute_name' => isset( $_POST['attribute_name'] ) ? wc_sanitize_taxonomy_name( wp_unslash( $_POST['attribute_name'] ) ) : '', // WPCS: input var ok, CSRF ok, sanitization ok. 'attribute_type' => isset( $_POST['attribute_type'] ) ? wc_clean( wp_unslash( $_POST['attribute_type'] ) ) : 'select', // WPCS: input var ok, CSRF ok. 'attribute_orderby' => isset( $_POST['attribute_orderby'] ) ? wc_clean( wp_unslash( $_POST['attribute_orderby'] ) ) : '', // WPCS: input var ok, CSRF ok. 'attribute_public' => isset( $_POST['attribute_public'] ) ? 1 : 0, // WPCS: input var ok, CSRF ok. ); if ( empty( $attribute['attribute_type'] ) ) { $attribute['attribute_type'] = 'select'; } if ( empty( $attribute['attribute_label'] ) ) { $attribute['attribute_label'] = ucfirst( $attribute['attribute_name'] ); } if ( empty( $attribute['attribute_name'] ) ) { $attribute['attribute_name'] = wc_sanitize_taxonomy_name( $attribute['attribute_label'] ); } return $attribute; }