Move input filters code to "meta" file

This commit is contained in:
Kelly Dwan 2019-10-08 13:37:03 -04:00
parent cf310ce0bf
commit 1909870e92
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D
2 changed files with 22 additions and 22 deletions

View file

@ -279,6 +279,26 @@ function update_generated_meta( $meta_id, $object_id, $meta_key, $_meta_value )
}
}
/**
* Get the input filters for submitted content.
*
* @return array
*/
function get_input_filters() {
return array_merge(
// Inputs that correspond to meta values.
wp_list_pluck( get_pledge_meta_config( 'user_input' ), 'php_filter' ),
// Inputs with no corresponding meta value.
array(
'contributor-wporg-usernames' => [
'filter' => FILTER_SANITIZE_STRING,
'flags' => FILTER_REQUIRE_ARRAY,
],
'pledge-agreement' => FILTER_VALIDATE_BOOLEAN,
)
);
}
/**
* Get the metadata for a given pledge, or a default set if no pledge is provided.
*