Changeset 1702542
- Timestamp:
- 07/25/2017 05:31:45 PM (9 years ago)
- Location:
- track-connect/trunk
- Files:
-
- 5 edited
-
includes/api/request.php (modified) (16 diffs)
-
includes/views/archive-listing.php (modified) (3 diffs)
-
includes/views/search-widget.php (modified) (1 diff)
-
plugin.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
track-connect/trunk/includes/api/request.php
r1527834 r1702542 23 23 array( 24 24 'timeout' => 500, 25 'body' => array( 25 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; TrackConnect/'. WP_LISTINGS_VERSION .'; ' . get_bloginfo( 'url' ) ), 26 'body' => array( 26 27 'token' => $this->token 27 28 ) … … 64 65 array( 65 66 'timeout' => 500, 66 'body' => array( 67 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; TrackConnect/'. WP_LISTINGS_VERSION .'; ' . get_bloginfo( 'url' ) ), 68 'body' => array( 67 69 'token' => $this->token, 68 70 'nodetype' => $nodeTypeId … … 99 101 $unitsCreated = 0; 100 102 $unitsUpdated = 0; 101 103 $lodgingTypes = []; 104 if(get_option('track_connect_lodging_types')){ 105 $lodgingTypes = (array)json_decode(get_option('track_connect_lodging_types')); 106 } 107 102 108 foreach(json_decode($units['body'])->response as $id => $unit){ 103 109 if(isset($unit->images)){ … … 228 234 ) 229 235 )); 230 236 237 if($unit->lodgingtypes){ 238 foreach ($unit->lodgingtypes as $lodgingTypeId => $lodgingTypeName){ 239 update_post_meta($post_id, '_listing_lodging_type_'.$lodgingTypeId, $lodgingTypeId); 240 $lodgingTypes[$lodgingTypeId] = $lodgingTypeName; 241 } 242 } 243 231 244 $my_post = array( 232 245 'ID' => $post_id, … … 358 371 $post_id,'_listing_youtube_id', !isset($youtube_id)?null:$youtube_id 359 372 ) 360 )); 361 373 )); 374 375 if($unit->lodgingtypes){ 376 foreach ($unit->lodgingtypes as $lodgingTypeId => $lodgingTypeName){ 377 update_post_meta($post_id, '_listing_lodging_type_'.$lodgingTypeId, $lodgingTypeId); 378 $lodgingTypes[$lodgingTypeId] = $lodgingTypeName; 379 } 380 } 381 362 382 // Create image 363 383 $image = $wpdb->get_row("SELECT post_id FROM ".$wpdb->prefix."postmeta WHERE post_id = '".$post_id."' AND meta_key = '_thumbnail_id' LIMIT 1;"); … … 390 410 } 391 411 392 } 393 394 $this->rebuildTaxonomies(); 412 } 413 414 /** 415 * It's possible that if they delete a lodging type it won't get removed, if that happens we can just delete 416 * the option manually and re-sync. 417 */ 418 419 if(count($lodgingTypes)){ 420 update_option('track_connect_lodging_types', json_encode($lodgingTypes)); 421 } 422 423 $this->rebuildTaxonomies(); 395 424 396 425 return array( … … 416 445 $unitsUpdated = 0; 417 446 $unitsRemoved = 0; 447 $lodgingTypes = []; 448 if(get_option('track_connect_lodging_types')){ 449 $lodgingTypes = (array)json_decode(get_option('track_connect_lodging_types')); 450 } 451 418 452 419 453 $this->getAmenities(); … … 421 455 array( 422 456 'timeout' => 500, 423 'body' => array( 457 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; TrackConnect/'. WP_LISTINGS_VERSION .'; ' . get_bloginfo( 'url' ) ), 458 'body' => array( 424 459 'token' => $this->token, 425 460 'page' => $page, … … 583 618 ) 584 619 )); 585 620 621 if(isset($unit->lodgingtype) && isset($unit->lodgingtypename)){ 622 $lodgingTypes[$unit->lodgingtype] = $unit->lodgingtypename; 623 } 624 586 625 $my_post = array( 587 626 'ID' => $post_id, … … 731 770 $post_id,'_listing_youtube_id', null 732 771 ) 733 )); 734 772 )); 773 774 if(isset($unit->lodgingtype) && isset($unit->lodgingtypename)){ 775 $lodgingTypes[$unit->lodgingtype] = $unit->lodgingtypename; 776 } 777 735 778 // Create image 736 779 $image = $wpdb->get_row("SELECT post_id FROM ".$wpdb->prefix."postmeta WHERE post_id = '".$post_id."' AND meta_key = '_thumbnail_id' LIMIT 1;"); … … 763 806 } 764 807 765 } 808 } 809 810 update_option('track_connect_lodging_types', json_encode($lodgingTypes)); 766 811 767 812 return array( … … 792 837 array( 793 838 'timeout' => 500, 794 'body' => array( 839 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; TrackConnect/'. WP_LISTINGS_VERSION .'; ' . get_bloginfo( 'url' ) ), 840 'body' => array( 795 841 'token' => $this->token 796 842 ) … … 876 922 array( 877 923 'timeout' => 500, 878 'body' => array( 924 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; TrackConnect/'. WP_LISTINGS_VERSION .'; ' . get_bloginfo( 'url' ) ), 925 'body' => array( 879 926 'token' => $this->token 880 927 ) … … 940 987 array( 941 988 'timeout' => 500, 942 'body' => array( 989 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; TrackConnect/'. WP_LISTINGS_VERSION .'; ' . get_bloginfo( 'url' ) ), 990 'body' => array( 943 991 'token' => $this->token, 944 992 'checkin' => $checkin, … … 988 1036 array( 989 1037 'timeout' => 500, 990 'body' => array( 1038 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; TrackConnect/'. WP_LISTINGS_VERSION .'; ' . get_bloginfo( 'url' ) ), 1039 'body' => array( 991 1040 'token' => $this->token, 992 1041 'unit_id' => $unitId … … 1002 1051 array( 1003 1052 'timeout' => 500, 1004 'body' => array( 1053 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; TrackConnect/'. WP_LISTINGS_VERSION .'; ' . get_bloginfo( 'url' ) ), 1054 'body' => array( 1005 1055 'token' => $this->token, 1006 1056 'cid' => $unitId, -
track-connect/trunk/includes/views/archive-listing.php
r1699200 r1702542 19 19 $sleeps = (isset($_REQUEST['sleeps']))? $_REQUEST['sleeps']:0; 20 20 $debug = (isset($_REQUEST['track_debug']))? $_REQUEST['track_debug']:0; 21 $lodgingType = (isset($_REQUEST['lodging']))? $_REQUEST['lodging']:0; 22 21 23 $availableUnits = false; 22 24 $checkAvailability = false; … … 76 78 function archive_listing_loop() { 77 79 78 global $post,$wp_query,$wp_the_query,$availableUnits,$checkAvailability,$bedrooms,$checkin,$checkout,$mam_posts_query,$lowRate,$highRate,$lowBed,$highBed, $sleeps ;80 global $post,$wp_query,$wp_the_query,$availableUnits,$checkAvailability,$bedrooms,$checkin,$checkout,$mam_posts_query,$lowRate,$highRate,$lowBed,$highBed, $sleeps, $lodgingType; 79 81 80 82 $count = 0; // start counter at 0 … … 160 162 } 161 163 164 if($lodgingType){ 165 $metaArgs[] = array( 166 'key' => '_listing_lodging_type', 167 'value' => $lodgingType, 168 'compare' => '=' 169 ); 170 } 171 162 172 if(count($metaArgs)){ 163 173 $args += array('meta_query' => array( -
track-connect/trunk/includes/views/search-widget.php
r1699211 r1702542 55 55 <select name="lodging" id="lodging" class="listing-lodging"> 56 56 <option value="">No Preference</option> 57 <?php foreach ( $this->getLodgingTypes() as $lodge): ?>58 <option <?= ( $lodgingType == $lodg e->meta_value) ? 'SELECTED' : ''; ?>59 value="<?= $lodg e->meta_value ?>"><?= $lodge->meta_value?></option>';57 <?php foreach ( (array)json_decode(get_option('track_connect_lodging_types')) as $lodgingTypeId => $lodgingTypeValue): ?> 58 <option <?= ( $lodgingType == $lodgingTypeId ) ? 'SELECTED' : ''; ?> 59 value="<?= $lodgingTypeId ?>"><?= $lodgingTypeValue; ?></option>'; 60 60 <?php endforeach; ?> 61 61 </select> -
track-connect/trunk/plugin.php
r1699211 r1702542 7 7 Author URI: http://www.trackhs.com 8 8 9 Version: 3.0. 79 Version: 3.0.8 10 10 11 11 License: GNU General Public License v2.0 (or later) -
track-connect/trunk/readme.txt
r1699211 r1702542 4 4 Requires at least: 3.7 5 5 Tested up to: 4.8 6 Stable tag: 3.0. 76 Stable tag: 3.0.8 7 7 8 8 Creates and syncs listing-type posts from TRACK PM, a cloud-based property management system (www.trackhs.com). … … 45 45 == Changelog == 46 46 47 = 3.0.8 = 48 Fixed issue with lodging types and added version logging in API request. 49 47 50 = 3.0.7 = 48 51 Fixed another issue with sidebar bedroom slider.
Note: See TracChangeset
for help on using the changeset viewer.