Website Summary Files Commits Branches @commit @diff @stats
path: root / wp-content / plugins
diff options
context:
space:
mode:
Commita31eb16e5edbb293e8714f70c5f88d89dcc5e29d (patch)
Author
 pgmatev <petargabriel.matev@gmail.com>
2020-07-13 19:01:00 +0300
Committer
 pgmatev <petargabriel.matev@gmail.com>
2020-07-13 19:01:00 +0300
Filesa16fcff75c73ea2b91992e4b10a32d7eb1cebb10 /wp-content/plugins
tues-interns-2020-a31eb16e5edbb293e8714f70c5f88d89dcc5e29d.tar
tues-interns-2020-a31eb16e5edbb293e8714f70c5f88d89dcc5e29d.tar.gz
tues-interns-2020-a31eb16e5edbb293e8714f70c5f88d89dcc5e29d.zip
Parent1f051aeb86fcf1134b3cbc658db41a835aeb1d52 (diff)
Parenta8d2fdedb5094b5a994f8fce72d965fe1d81a894 (diff)
Merge branch 'feature-cars-cpt' of https://github.com/DevriX/tues-interns-2020 into feature-users-cm
2 files changed, 20 insertions, 4 deletions
-rw-r--r--wp-content/plugins/dx-cars/car_info.php8
-rw-r--r--wp-content/plugins/dx-cars/class.cpt.php16
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
@@ -8,6 +8,14 @@
<td><input type="text" name="car-millage" value="<?php echo( sanitize_text_field( get_post_meta( get_the_ID(), __( 'car-millage' ), true ) ) ) ?>"></td>
</tr>
<tr>
+ <td><?php _e( 'Horsepower:' ) ?></td>
+ <td><input type="text" name="car-horsepower" value="<?php echo( sanitize_text_field( get_post_meta( get_the_ID(), __( 'car-horsepower' ), true ) ) ) ?>"></td>
+ </tr>
+ <tr>
+ <td><?php _e( 'Range:' ) ?></td>
+ <td><input type="text" name="car-range" value="<?php echo( sanitize_text_field( get_post_meta( get_the_ID(), __( 'car-range' ), true ) ) ) ?>"></td>
+ </tr>
+ <tr>
<td><?php _e( 'Price:' ) ?></td>
<td><input type="text" name="car-price" value="<?php echo( sanitize_text_field( get_post_meta( get_the_ID(), __( 'car-price' ), true ) ) ) ?>"></td>
</tr>
diff --git a/wp-content/plugins/dx-cars/class.cpt.php b/wp-content/plugins/dx-cars/class.cpt.php
index 03bdec3..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' => $this->get_enc_uploaded_img_urls( $_FILES['car-images'] ),
+ '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;