Making WordPress.org

Ticket #2869: 2869.meta.2.diff

File 2869.meta.2.diff, 1.9 KB (added by davidmosterd, 8 years ago)

code standards and small readable fix on variable name

  • wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php

    diff --git wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php
    index 43f3413e..5b79b3fa 100644
    class WordCamp_Post_Types_Plugin { 
    18221822                        return;
    18231823                }
    18241824
    1825                 if ( isset( $_POST['wcpt-meta-sponsor-info'] ) && wp_verify_nonce( $_POST['wcpt-meta-sponsor-info'], 'edit-sponsor-info' ) ) {
     1825                if ( wp_verify_nonce( filter_input( INPUT_POST, 'wcpt-meta-sponsor-info' ), 'edit-sponsor-info' ) ) {
    18261826                        $text_values = array(
    18271827                                'company_name', 'first_name', 'last_name', 'email_address', 'phone_number', 'vat_number', 'twitter_handle',
    18281828                                'street_address1', 'street_address2', 'city', 'state', 'zip_code', 'country'
    18291829                        );
    18301830
    18311831                        foreach ( $text_values as $id ) {
    1832                                 $values[ $id ] = sanitize_text_field( $_POST["_wcpt_sponsor_$id"] );
     1832                                $values[ $id ] = sanitize_text_field( filter_input( INPUT_POST, '_wcpt_sponsor_' . $id ) );
    18331833                        }
    18341834
    1835                         $values['website'] = esc_url_raw( $_POST['_wcpt_sponsor_website'] );
     1835                        $values['website'] = esc_url_raw( filter_input( INPUT_POST, '_wcpt_sponsor_website' ) );
    18361836                        // TODO: maybe only allows links to home page, depending on outcome of http://make.wordpress.org/community/2013/12/31/irs-rules-for-corporate-sponsorship-of-wordcamp/
    18371837
    18381838                        $values['first_name'] = ucfirst( $values['first_name'] );
    18391839                        $values['last_name' ] = ucfirst( $values['last_name' ] );
    18401840
    18411841                        foreach( $values as $id => $value ) {
     1842                                $meta_key = '_wcpt_sponsor_' . $id;
     1843
    18421844                                if ( empty( $value ) ) {
    1843                                         delete_post_meta( $post_id, "_wcpt_sponsor_$id" );
     1845                                        delete_post_meta( $post_id, $meta_key );
    18441846                                } else {
    1845                                         update_post_meta( $post_id, "_wcpt_sponsor_$id", $value );
     1847                                        update_post_meta( $post_id, $meta_key, $value );
    18461848                                }
    18471849                        }
    18481850                }