Changeset 3389696
- Timestamp:
- 11/04/2025 01:22:27 PM (5 months ago)
- Location:
- houzez-property-feed/trunk
- Files:
-
- 11 edited
-
README.txt (modified) (2 diffs)
-
assets/js/admin-import.js (modified) (1 diff)
-
houzez-property-feed.php (modified) (2 diffs)
-
includes/class-houzez-property-feed-ajax.php (modified) (2 diffs)
-
includes/class-houzez-property-feed-license.php (modified) (6 diffs)
-
includes/class-houzez-property-feed-process.php (modified) (2 diffs)
-
includes/format-functions.php (modified) (3 diffs)
-
includes/import-formats/class-houzez-property-feed-format-10ninety.php (modified) (4 diffs)
-
includes/import-formats/class-houzez-property-feed-format-acquaint.php (modified) (4 diffs)
-
includes/import-formats/class-houzez-property-feed-format-agestanet.php (modified) (3 diffs)
-
includes/views/admin-settings-import-settings-format.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
houzez-property-feed/trunk/README.txt
r3389596 r3389696 4 4 Requires at least: 3.8 5 5 Tested up to: 6.8 6 Stable tag: 2.5.3 37 Version: 2.5.3 36 Stable tag: 2.5.34 7 Version: 2.5.34 8 8 Homepage: https://houzezpropertyfeed.com 9 9 License: GPLv3 … … 144 144 == Changelog == 145 145 146 = 2.5.34 - 2025-11-04 = 147 * Started to roll out new 'Test Details' feature to some formats. This allows the user to test the details are valid when entering them before continuing any further. 148 146 149 = 2.5.33 - 2025-11-04 = 147 150 * Updated license functionality to also consider upcoming annual pricing model -
houzez-property-feed/trunk/assets/js/admin-import.js
r3325700 r3389696 222 222 }); 223 223 // 224 225 jQuery('a.test-import-details').click(function(e) 226 { 227 e.preventDefault(); 228 229 var test_button = jQuery(this); 230 231 test_button.parent().find('.test-results-success').hide(); 232 test_button.parent().find('.test-results-error').hide(); 233 234 jQuery(this).html('Testing...'); 235 jQuery(this).attr('disabled', 'disabled'); 236 237 var format = jQuery(this).data('format'); 238 239 var parentTd = jQuery('#import_settings_' + format); 240 241 var data = { 242 'action': 'houzez_property_feed_test_property_import_details', 243 'format': format 244 }; 245 246 // Find all input fields within that 'td' 247 var inputs = parentTd.find('input, select'); 248 249 parentTd.find('input, select').each(function() 250 { 251 var element = jQuery(this); 252 var element_name = element.attr('name').replace(format + "_", ""); 253 254 // Handle checkboxes 255 if (element.attr('type') === 'checkbox') { 256 data[element_name] = element.is(':checked') ? element.val() : 'no'; 257 // Handle select fields 258 } else if (element.is('select')) { 259 // Handle multi-select 260 if (element.prop('multiple')) { 261 data[element_name] = element.val() || []; 262 } else { 263 // Handle single select 264 data[element_name] = element.val(); 265 } 266 // Handle other input fields (e.g., text, number, etc.) 267 } else { 268 data[element_name] = element.val(); 269 } 270 }); 271 272 jQuery.post( ajaxurl, data, function(response) 273 { 274 if ( response.success == true ) 275 { 276 test_button.parent().find('.test-results-success').html('<p>Details appear valid. ' + response.properties + ' properties found for importing.</p>'); 277 test_button.parent().find('.test-results-success').show(); 278 } 279 else 280 { 281 test_button.parent().find('.test-results-error').html('<p>' + response.error + '</p>'); 282 test_button.parent().find('.test-results-error').show(); 283 } 284 285 test_button.html('Test Details'); 286 test_button.attr('disabled', false); 287 }); 288 }); 224 289 225 290 if ( jQuery('.automatic-imports-table').length > 0 ) -
houzez-property-feed/trunk/houzez-property-feed.php
r3389596 r3389696 4 4 * Plugin Uri: https://houzezpropertyfeed.com 5 5 * Description: Automatically import properties to Houzez from estate agency CRMs and export to portals 6 * Version: 2.5.3 36 * Version: 2.5.34 7 7 * Author: PropertyHive 8 8 * Author URI: https://wp-property-hive.com … … 20 20 * @var string 21 21 */ 22 public $version = '2.5.3 3';22 public $version = '2.5.34'; 23 23 24 24 /** -
houzez-property-feed/trunk/includes/class-houzez-property-feed-ajax.php
r3323531 r3389696 24 24 25 25 add_action( "wp_ajax_houzez_property_feed_import_import", array( $this, "import_import" ) ); 26 27 add_action( 'wp_ajax_houzez_property_feed_test_property_import_details', array( $this, 'test_property_import_details' ) ); 26 28 } 27 29 … … 725 727 wp_send_json_success(array('url' => admin_url('admin.php?page=houzez-property-feed-import&hpfsuccessmessage=' . base64_encode('Import completed successfully.')))); 726 728 } 729 730 public function test_property_import_details() 731 { 732 header( 'Content-Type: application/json; charset=utf-8' ); 733 734 $format = isset($_POST['format']) ? sanitize_text_field(wp_unslash($_POST['format'])) : ''; 735 736 if ( empty($format) ) 737 { 738 $return = array( 739 'success' => false, 740 'error' => __( 'No format passed', 'houzezpropertyfeed' ) 741 ); 742 echo json_encode($return); 743 die(); 744 } 745 746 $import_object = hpf_get_import_object_from_format( $format, '', '' ); 747 748 if ( $import_object === false || empty($import_object) ) 749 { 750 $return = array( 751 'success' => false, 752 'error' => __( 'Couldn\'t create import object', 'houzezpropertyfeed' ) 753 ); 754 echo json_encode($return); 755 die(); 756 } 757 758 $parsed = $import_object->parse(true); 759 760 if ( !$parsed ) 761 { 762 $errors = ( isset($import_object->errors) ? $import_object->errors : array() ); 763 $error = 'Please check they are correct.'; 764 if ( !empty($errors) ) 765 { 766 $error = $errors[array_key_last($errors)]; 767 $explode_error = explode(" - ", $error, 2); 768 if ( count($explode_error) == 2 ) 769 { 770 $error = $explode_error[1]; 771 } 772 } 773 774 $return = array( 775 'success' => false, 776 'error' => 'An error occurred whilst obtaining the properties using the details provided:<br><br>' . nl2br(esc_html($error)) 777 ); 778 echo json_encode($return); 779 die(); 780 } 781 else 782 { 783 $return = array( 784 'success' => true, 785 'properties' => count($import_object->properties) 786 ); 787 echo json_encode($return); 788 die(); 789 } 790 791 wp_die(); 792 } 727 793 } 728 794 -
houzez-property-feed/trunk/includes/class-houzez-property-feed-license.php
r3389596 r3389696 141 141 $instance_id = get_option( 'houzez_property_feed_instance_id', '' ); 142 142 143 $product_ids_to_try = array(17, 394 3);143 $product_ids_to_try = array(17, 3944, 3945); 144 144 $last_error_message = ''; 145 145 $last_body_dump = ''; … … 238 238 } 239 239 240 $product_ids_to_try = array(17, 394 3);240 $product_ids_to_try = array(17, 3944, 3945); 241 241 $last_error = ''; 242 242 … … 278 278 die(); 279 279 } else { 280 280 281 $last_error = __( 'Error when activating license key', 'houzezpropertyfeed' ) . ': ' . $body['error']; 281 282 continue; … … 288 289 289 290 // If we reach here, all attempts failed 290 wp_redirect( admin_url( 'admin.php?page=' . ( isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'houzez-property-feed-import' ) . '&tab=license&hpferrormessage=' . base64_encode( $last_error) ) );291 wp_redirect( admin_url( 'admin.php?page=' . ( isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'houzez-property-feed-import' ) . '&tab=license&hpferrormessage=' . base64_encode( urlencode($last_error) ) ) ); 291 292 die(); 292 293 } … … 299 300 $instance_id = get_option( 'houzez_property_feed_instance_id', '' ); 300 301 301 $product_ids_to_try = array(17, 394 3);302 $product_ids_to_try = array(17, 3944, 3945); 302 303 $last_error = ''; 303 304 … … 349 350 350 351 // If we reach here, all attempts failed 351 wp_redirect( admin_url( 'admin.php?page=' . ( isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'houzez-property-feed-import' ) . '&tab=license&hpferrormessage=' . base64_encode( $last_error) ) );352 wp_redirect( admin_url( 'admin.php?page=' . ( isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'houzez-property-feed-import' ) . '&tab=license&hpferrormessage=' . base64_encode( urlencode($last_error) ) ) ); 352 353 die(); 353 354 } -
houzez-property-feed/trunk/includes/class-houzez-property-feed-process.php
r3358551 r3389696 39 39 */ 40 40 public $background_mode = false; 41 42 /** 43 * @var array 44 * Used in testing 45 */ 46 public $errors = array(); 41 47 42 48 public function __construct() … … 392 398 if ( $this->is_import ) { $this->ping(); } 393 399 } 400 401 $this->errors[] = $message; 394 402 } 395 403 -
houzez-property-feed/trunk/includes/format-functions.php
r3389138 r3389696 105 105 'help_url' => 'https://houzezpropertyfeed.com/documentation/managing-imports/formats/10ninety/', 106 106 'warnings' => array_filter( array( $simplexml_warning ) ), 107 'test_button' => true, 107 108 'background_mode' => true, 108 109 ), … … 149 150 'help_url' => 'https://houzezpropertyfeed.com/documentation/managing-imports/formats/acquaint/', 150 151 'warnings' => array_filter( array( $simplexml_warning ) ), 152 'test_button' => true, 151 153 'background_mode' => true, 152 154 ), … … 267 269 ), 268 270 'help_url' => 'https://houzezpropertyfeed.com/documentation/managing-imports/formats/agestanet/', 271 'test_button' => true, 269 272 'warnings' => array_filter( array( $simplexml_warning ) ), 270 273 ), -
houzez-property-feed/trunk/includes/import-formats/class-houzez-property-feed-format-10ninety.php
r3389596 r3389696 24 24 } 25 25 26 public function parse( )26 public function parse( $test = false ) 27 27 { 28 $this->properties = array(); // Reset properties in the event we're importing multiple files 28 $this->properties = array(); 29 30 if ( $test === false || $troubleshooting === true ) 31 { 32 $import_settings = houzez_property_feed_get_import_settings_from_id( $this->import_id ); 33 $test = true; 34 } 35 else 36 { 37 $import_settings = map_deep( wp_unslash($_POST), 'sanitize_text_field' ); 38 if ( isset( $_POST['xml_url'] ) ) 39 { 40 $import_settings['xml_url'] = sanitize_url( wp_unslash( $_POST['xml_url'] ) ); 41 } 42 } 29 43 30 44 $this->log("Parsing properties", '', 0, '', false); 31 32 $import_settings = houzez_property_feed_get_import_settings_from_id( $this->import_id );33 45 34 46 $pro_active = apply_filters( 'houzez_property_feed_pro_active', false ); … … 87 99 foreach ($xml->property as $property) 88 100 { 89 if ( $ limit !== FALSE && count($this->properties) >= $limit )101 if ( $test === false && $limit !== FALSE && count($this->properties) >= $limit ) 90 102 { 91 103 return true; … … 94 106 $this->properties[] = $property; 95 107 96 if ( $ background_mode === true )108 if ( $test === false && $background_mode === true ) 97 109 { 98 110 $this->write_to_queue( (string)$property->AGENT_REF, $property ); … … 108 120 } 109 121 110 if ( empty($this->properties) )122 if ( $test === false && empty($this->properties) ) 111 123 { 112 124 $this->log_error( 'No properties found. We\'re not going to continue as this could likely be wrong and all properties will get removed if we continue.' ); -
houzez-property-feed/trunk/includes/import-formats/class-houzez-property-feed-format-acquaint.php
r3389596 r3389696 22 22 } 23 23 24 public function parse( )24 public function parse( $test = false ) 25 25 { 26 $this->properties = array(); // Reset properties in the event we're importing multiple files 26 $this->properties = array(); 27 28 if ( $test === false || $troubleshooting === true ) 29 { 30 $import_settings = houzez_property_feed_get_import_settings_from_id( $this->import_id ); 31 $test = true; 32 } 33 else 34 { 35 $import_settings = map_deep( wp_unslash($_POST), 'sanitize_text_field' ); 36 if ( isset( $_POST['xml_url'] ) ) 37 { 38 $import_settings['xml_url'] = sanitize_url( wp_unslash( $_POST['xml_url'] ) ); 39 } 40 } 27 41 28 42 $this->log("Parsing properties", '', 0, '', false); 29 30 $import_settings = houzez_property_feed_get_import_settings_from_id( $this->import_id );31 43 32 44 $pro_active = apply_filters( 'houzez_property_feed_pro_active', false ); … … 85 97 foreach ( $xml->properties->property as $property ) 86 98 { 87 if ( $ limit !== FALSE && count($this->properties) >= $limit )99 if ( $test === false && $limit !== FALSE && count($this->properties) >= $limit ) 88 100 { 89 101 return true; … … 92 104 $this->properties[] = $property; 93 105 94 if ( $ background_mode === true )106 if ( $test === false && $background_mode === true ) 95 107 { 96 108 $this->write_to_queue( (string)$property->id, $property ); … … 106 118 } 107 119 108 if ( empty($this->properties) )120 if ( $test === false && empty($this->properties) ) 109 121 { 110 122 $this->log_error( 'No properties found. We\'re not going to continue as this could likely be wrong and all properties will get removed if we continue.' ); -
houzez-property-feed/trunk/includes/import-formats/class-houzez-property-feed-format-agestanet.php
r3389596 r3389696 27 27 } 28 28 29 public function parse( )29 public function parse( $test = false ) 30 30 { 31 $this->properties = array(); // Reset properties in the event we're importing multiple files 32 33 $this->log("Parsing properties", '', 0, '', false); 34 35 $import_settings = houzez_property_feed_get_import_settings_from_id( $this->import_id ); 36 37 $contents = ''; 38 39 $response = wp_remote_get( $import_settings['xml_url'], array( 'timeout' => 360, 'sslverify' => false ) ); 40 if ( !is_wp_error($response) && is_array( $response ) ) 31 $this->properties = array(); 32 33 if ( $test === false || $troubleshooting === true ) 41 34 { 42 $contents = $response['body']; 35 $import_settings = houzez_property_feed_get_import_settings_from_id( $this->import_id ); 36 $test = true; 43 37 } 44 38 else 45 39 { 46 $this->log_error( "Failed to obtain XML. Dump of response as follows: " . print_r($response, TRUE) ); 47 48 return false; 40 $import_settings = map_deep( wp_unslash($_POST), 'sanitize_text_field' ); 41 if ( isset( $_POST['xml_url'] ) ) 42 { 43 $import_settings['xml_url'] = sanitize_url( wp_unslash( $_POST['xml_url'] ) ); 44 } 49 45 } 46 47 $this->log("Parsing properties", '', 0, '', false); 48 49 $limit = apply_filters( "houzez_property_feed_property_limit", 25 ); 50 if ( $limit !== false ) 51 { 52 53 } 54 else 55 { 56 // using pro, but check for limit setting 57 if ( 58 $pro_active === true && 59 isset($import_settings['limit']) && 60 !empty((int)$import_settings['limit']) && 61 is_numeric($import_settings['limit']) 62 ) 63 { 64 $limit = (int)$import_settings['limit']; 65 } 66 } 67 68 $contents = ''; 69 70 $response = wp_remote_get( $import_settings['xml_url'], array( 'timeout' => 360, 'sslverify' => false ) ); 71 72 if ( is_wp_error( $response ) ) 73 { 74 $this->log_error( 'Response: ' . $response->get_error_message() ); 75 76 return false; 77 } 78 79 if ( wp_remote_retrieve_response_code($response) !== 200 ) 80 { 81 $this->log_error( wp_remote_retrieve_response_code($response) . ' response received when requesting properties. Error message: ' . wp_remote_retrieve_response_message($response) ); 82 return false; 83 } 84 85 $contents = $response['body']; 50 86 51 87 $xml = simplexml_load_string($contents); … … 55 91 foreach ( $xml->immobili->immobile as $property ) 56 92 { 93 if ( $test === false && $limit !== FALSE && count($this->properties) >= $limit ) 94 { 95 return true; 96 } 97 57 98 $this->properties[] = $property; 58 99 } … … 66 107 } 67 108 68 if ( empty($this->properties) )109 if ( $test === false && empty($this->properties) ) 69 110 { 70 111 $this->log_error( 'No properties found. We\'re not going to continue as this could likely be wrong and all properties will get removed if we continue.' ); -
houzez-property-feed/trunk/includes/views/admin-settings-import-settings-format.php
r3255514 r3389696 239 239 <?php 240 240 } 241 if ( isset($format['test_button']) && $format['test_button'] === true ) 242 { 243 echo '<tr> 244 <th> </th> 245 <td> 246 <a href="" data-format="' . $key . '" class="test-import-details button">Test Details</a> 247 <div class="test-results-success notice notice-success inline" style="display:none; margin-top:20px"></div> 248 <div class="test-results-error notice notice-error inline" style="display:none; margin-top:20px"></div> 249 </td> 250 </tr>'; 251 } 241 252 ?> 242 253 </tbody>
Note: See TracChangeset
for help on using the changeset viewer.