Revisions to pledge meta

This commit is contained in:
Corey McKrill 2019-10-01 17:00:44 -07:00
parent 80aca01533
commit 22b813e163
No known key found for this signature in database
GPG key ID: C2C0746F7BF17E38
2 changed files with 84 additions and 32 deletions

View file

@ -48,7 +48,7 @@ function render_shortcode() {
function get_input_filters() {
return array_merge(
// Inputs that correspond to meta values.
wp_list_pluck( PledgeMeta\get_pledge_meta_config(), 'php_filter' ),
wp_list_pluck( PledgeMeta\get_pledge_meta_config( 'user_input' ), 'php_filter' ),
// Inputs with no corresponding meta value.
array(
'contributor-wporg-usernames' => [
@ -68,7 +68,7 @@ function get_input_filters() {
function process_form() {
$submission = filter_input_array( INPUT_POST, get_input_filters() );
$submission['org-domain'] = get_normalized_domain_from_url( $submission['org-url'] );
$submission['org-domain'] = PledgeMeta\get_normalized_domain_from_url( $submission['org-url'] );
if ( in_array( null, $submission, true ) || in_array( false, $submission, true ) ) {
return new WP_Error(
@ -104,20 +104,6 @@ function process_form() {
return 'success';
}
/**
*
*
* @param string $url
*
* @return string
*/
function get_normalized_domain_from_url( $url ) {
$domain = wp_parse_url( $url, PHP_URL_HOST );
$domain = preg_replace( '#^www\.#', '', $domain );
return $domain;
}
/**
*
*