From a8d2fdedb5094b5a994f8fce72d965fe1d81a894 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 12 Jul 2020 18:20:36 +0300 Subject: Implimented vehicle horsepower and range following current naming and code standards. --- wp-content/plugins/dx-cars/car_info.php | 8 ++++++++ wp-content/plugins/dx-cars/class.cpt.php | 16 ++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'wp-content/plugins') diff --git a/wp-content/plugins/dx-cars/car_info.php b/wp-content/plugins/dx-cars/car_info.php index b8931aa..2253fc7 100644 --- a/wp-content/plugins/dx-cars/car_info.php +++ b/wp-content/plugins/dx-cars/car_info.php @@ -7,6 +7,14 @@ + + + + + + + + diff --git a/wp-content/plugins/dx-cars/class.cpt.php b/wp-content/plugins/dx-cars/class.cpt.php index eb8eb48..f17a82b 100644 --- a/wp-content/plugins/dx-cars/class.cpt.php +++ b/wp-content/plugins/dx-cars/class.cpt.php @@ -76,10 +76,12 @@ class Vehicles { // Now that we're authenticated, time to save the data. // This sanitizes the data from the field and saves it into an array $events_meta. $events_meta = array( - 'car-year' => sanitize_text_field( isset( $_POST['car-year'] ) ? $_POST['car-year'] : null ), - 'car-millage' => sanitize_text_field( isset( $_POST['car-millage'] ) ? $_POST['car-millage'] : null ), - 'car-price' => sanitize_text_field( isset( $_POST['car-price'] ) ? $_POST['car-price'] : null ), - 'car-images' => isset($_FILES['car-images']) ? $this->get_enc_uploaded_img_urls( $_FILES['car-images'] ): null, + 'car-year' => sanitize_text_field( isset( $_POST['car-year'] ) ? $_POST['car-year'] : null ), + 'car-millage' => sanitize_text_field( isset( $_POST['car-millage'] ) ? $_POST['car-millage'] : null ), + 'car-horsepower' => sanitize_text_field( isset( $_POST['car-horsepower'] ) ? $_POST['car-horsepower'] : null ), + 'car-range' => sanitize_text_field( isset( $_POST['car-range'] ) ? $_POST['car-range'] : null ), + 'car-price' => sanitize_text_field( isset( $_POST['car-price'] ) ? $_POST['car-price'] : null ), + 'car-images' => isset($_FILES['car-images']) ? $this->get_enc_uploaded_img_urls( $_FILES['car-images'] ): null, ); // Cycle through the $events_meta array. @@ -101,6 +103,12 @@ class Vehicles { case 'car-millage': if( strcmp( "0", $value ) > 0 ) wp_die( 'Invalid millage.' ); break; + case 'car-horsepower': + if( strcmp( "0", $value ) > 0 ) wp_die( 'Invalid horsepower.' ); + break; + case 'car-range': + if( strcmp( "0", $value ) > 0 ) wp_die( 'Invalid range.' ); + break; case 'car-price': if( strcmp( "0", $value ) > 0 ) wp_die( 'Invalid price.' ); break; -- cgit v1.3.1-26-gb76a