Update for mobile numbers if the format is yyyy-mm-dd
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 20 Nov 2015 16:38:45 +0000 (11:38 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 20 Nov 2015 16:38:45 +0000 (11:38 -0500)
page-150.php
style.css

index bb12085..3430a2d 100644 (file)
                     <?php endwhile; else:?>
                     <p><?php _e('Sorry, no results found.');?></p>
                     <?php endif;?>
-                    <?php $formData = filter_var_array(
+                    <?php
+                    $formData2 = filter_var_array(
+                        $_POST,
+                        array(
+                            'ArrivalDate'   => array(
+                                'filter'  => FILTER_VALIDATE_REGEXP,
+                                'options' => array(
+                                    'regexp' => '%[0-9]{4}-[0-9]{2}-[0-9]{2}%'
+                                )
+                            ),
+                            'DepartureDate' => array(
+                                'filter'  => FILTER_VALIDATE_REGEXP,
+                                'options' => array(
+                                    'regexp' => '%[0-9]{4}-[0-9]{2}-[0-9]{2}%'
+                                )
+                            ),
+                        )
+                    );
+                    $formData = filter_var_array(
                         $_POST,
                         array(
                             'ArrivalDate'   => array(
                     );
                     $location  = urlencode($formData['Location']);
                     $arrival   = urlencode($formData['ArrivalDate']);
+                    if ($formData2['ArrivalDate']) {
+                        $arrival = urlencode( date( "m/d/Y", strtotime( $formData2['ArrivalDate'] ) )  );
+                    }
                     $departure = urlencode($formData['DepartureDate']);
+                    if ($formData2['DepartureDate']) {
+                        $departure = urlencode( date( "m/d/Y", strtotime( $formData2['DepartureDate'] ) )  );
+                    }
                     $occupancy = urlencode($formData['Occupancy']);
-                    if ($arrival == NULL || $departure == NULL || $occupancy == NULL){
+                    if ($arrival == NULL || $departure == NULL){
                         $arrival   = urlencode(date("m/d/Y", strtotime("+2 days")));
                         $departure = urlencode(date("m/d/Y", strtotime($arrival. ' +2 days')));
+                    }
+                    if ($occupancy == NULL){
                         $occupancy = urlencode(1);
                     }
                     $iframeSrc = "https://weblink.instantsoftware.com/search/1134?ArrivalDate={$arrival}&DepartureDate={$departure}&Occupancy={$occupancy}&Location={$location}";?>
index 6310d71..2e6e571 100644 (file)
--- a/style.css
+++ b/style.css
@@ -3,5 +3,5 @@ Theme Name: BigPowderhornLodging
 Author: Gaslight Media
 Author URI: http://www.gaslightmedia.com
 Description: A theme for BigPowderhornLodging
-Version: 1.0.5
+Version: 1.0.6
 */