| 1 |
<?php |
| 2 |
namespace SparkAPI; |
| 3 |
|
| 4 |
defined( 'ABSPATH' ) or die( 'This plugin requires WordPress' ); |
| 5 |
|
| 6 |
class PropertyTypes extends Core { |
| 7 |
|
| 8 |
function __construct(){ |
| 9 |
parent::__construct(); |
| 10 |
} |
| 11 |
|
| 12 |
function get_property_sub_types() { |
| 13 |
$response = $this->get_from_api( 'GET', 'standardfields/PropertySubType', DAY_IN_SECONDS ); |
| 14 |
if( true == $response[ 'success' ] && array_key_exists( 'FieldList', $response[ 'results' ][ 0 ][ 'PropertySubType' ] ) ){ |
| 15 |
return $response[ 'results' ][ 0 ][ 'PropertySubType' ][ 'FieldList' ]; |
| 16 |
} |
| 17 |
return false; |
| 18 |
} |
| 19 |
|
| 20 |
function get_property_types(){ |
| 21 |
$records = false; |
| 22 |
$response = $this->get_from_api( 'GET', 'propertytypes', DAY_IN_SECONDS ); |
| 23 |
if( true == $response[ 'success' ] ){ |
| 24 |
$records = array(); |
| 25 |
foreach( $response[ 'results' ] as $res ){ |
| 26 |
$records[ $res[ 'MlsCode' ] ] = $res[ 'MlsName' ]; |
| 27 |
} |
| 28 |
} |
| 29 |
return $records; |
| 30 |
} |
| 31 |
} |