public function widget($args, $instance) { extract($args, EXTR_SKIP); $options = get_option(DSIDXPRESS_OPTION_NAME); if (!isset($options["Activated"]) || !$options["Activated"]) { return; } wp_enqueue_script('jquery', false, array(), false, true); $apiRequestParams = array(); $apiRequestParams['responseDirective.ViewNameSuffix'] = 'widget'; $apiRequestParams['query.MlsNumber'] = $instance['mls_number']; $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData('Details', $apiRequestParams); if (empty($apiHttpResponse['errors']) && $apiHttpResponse['response']['code'] == '200') { $data = $apiHttpResponse['body']; } else { switch ($apiHttpResponse["response"]["code"]) { case 403: $data = '<p class="dsidx-error">' . DSIDXPRESS_INACTIVE_ACCOUNT_MESSAGE . '</p>'; break; case 404: $data = '<p class="dsidx-error">' . sprintf(DSIDXPRESS_INVALID_MLSID_MESSAGE, $instance["mls_number"]) . '</p>'; break; default: $data = '<p class="dsidx-error">' . DSIDXPRESS_IDX_ERROR_MESSAGE . '</p>'; } } echo $before_widget . $data . $after_widget; }
function fetch_data($type = 'Results', $atts) { if (Bon_IDX::is_debug()) { Bon_IDX::r($atts, true, 'fetch_data: ' . $type, false); } $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData($type, $atts, false, 0); $response = $apiHttpResponse["body"]; $decoded = json_decode($response); $response = is_null($decoded) ? $response : $decoded; return $response; }
public static function AddScripts($needs_plugin_url = false) { wp_enqueue_script('dsidx-autocomplete'); if ($needs_plugin_url) { $home_url = get_home_url(); $plugin_url = dsSearchAgent_ApiRequest::MakePluginsUrlRelative(plugin_dir_url(__FILE__)); echo <<<HTML \t\t\t\t<script type="text/javascript"> \t\t\t\tif (typeof localdsidx == "undefined" || !localdsidx) { var localdsidx = {}; }; \t\t\t\tlocaldsidx.pluginUrl = "{$plugin_url}"; \t\t\t\tlocaldsidx.homeUrl = "{$home_url}"; \t\t\t\t</script> HTML; } }
static function getCapabilities() { $capabilities = dsSearchAgent_ApiRequest::FetchData('MlsCapabilities'); if (isset($capabilities['response']['code'])) { switch ($capabilities['response']['code']) { case 200: return json_decode($capabilities['body']); break; default: return $capabilities['response']['code']; } } else { return false; } }
static function insert_disclaimer() { global $wp_query; if (is_array($wp_query->query) && (isset($wp_query->query["idx-action"]) && $wp_query->query["idx-action"] == "details" || isset($wp_query->query["idx-action"]) && $wp_query->query["idx-action"] == "results")) { return; } $apiParams = array(); $apiParams["responseDirective.IncludeDsDisclaimer"] = defined('ZPRESS_API') && ZPRESS_API != '' ? "false" : "true"; if (!empty(self::$viewName)) { $apiParams["responseDirective.ViewName"] = self::$viewName; } $disclaimer = dsSearchAgent_ApiRequest::FetchData("Disclaimer", $apiParams); if (isset($disclaimer['response']['code']) && $disclaimer['response']['code'] == '500') { echo $disclaimer["body"]; } }
public static function enqueueGlobals() { if (defined('DOING_CRON') && DOING_CRON) { return; } global $pagenow; $options = get_option(DSIDXPRESS_OPTION_NAME); if (!isset($options["Activated"]) || !$options["Activated"]) { return; } $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("EnqueueGlobalAssets", array(), false, 3600); wp_enqueue_style('dsidxpress-icons', DSIDXPRESS_PLUGIN_URL . 'css/dsidx-icons.css'); if (is_admin() || in_array($pagenow, array('wp-login.php', 'wp-register.php'))) { return; } wp_enqueue_style('dsidxpress-unconditional', DSIDXPRESS_PLUGIN_URL . 'css/client.css'); wp_enqueue_style('dsidxwidgets-unconditional', DSIDXWIDGETS_PLUGIN_URL . 'css/client.css'); }
static function ProcessNewUser($user_id) { if (@$_POST["dsidxpress"] != "1") { return; } $new_user = new WP_User($user_id); $new_user->add_role(dsSearchAgent_Roles::$Role_Name); $referring_url = $_SERVER['HTTP_REFERER']; $post_vars = array(); $post_vars["propertyID"] = $_POST["propertyID"]; $post_vars["firstName"] = $_POST["first_name"]; $post_vars["lastName"] = $_POST["last_name"]; $post_vars["phoneNumber"] = $_POST["phone_number"]; $post_vars["emailAddress"] = $_POST["user_email"]; $post_vars["scheduleYesNo"] = ""; $post_vars["scheduleDateDay"] = "1"; $post_vars["scheduleDateMonth"] = "1"; $post_vars["comments"] = ""; $post_vars["referringURL"] = $referring_url; //$post_vars["returnURL"] = $_POST[""]; $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("ContactForm", $post_vars, false, 0); wp_set_auth_cookie($user_id, true, is_ssl()); }
function widget($args, $instance) { extract($args); extract($instance); $title = apply_filters("widget_title", $title); $options = get_option(DSIDXPRESS_OPTION_NAME); if (!$options["Activated"]) { return; } $pluginUrl = plugins_url() . '/dsidxpress/'; wp_enqueue_script('dsidxpress_widget_search_view', $pluginUrl . 'js/widget-client.js', array('jquery'), DSIDXPRESS_PLUGIN_VERSION, true); $formAction = get_home_url() . "/idx/"; $capabilities = dsSearchAgent_ApiRequest::FetchData('MlsCapabilities'); $capabilities = json_decode($capabilities['body'], true); $defaultSearchPanels = dsSearchAgent_ApiRequest::FetchData("AccountSearchPanelsDefault", array(), false, 60 * 60 * 24); $defaultSearchPanels = $defaultSearchPanels["response"]["code"] == "200" ? json_decode($defaultSearchPanels["body"]) : null; $propertyTypes = dsSearchAgent_ApiRequest::FetchData("AccountSearchSetupFilteredPropertyTypes", array(), false, 60 * 60 * 24); $propertyTypes = $propertyTypes["response"]["code"] == "200" ? json_decode($propertyTypes["body"]) : null; $account_options = dsSearchAgent_ApiRequest::FetchData("AccountOptions", array(), false); $account_options = $account_options["response"]["code"] == "200" ? json_decode($account_options["body"]) : null; $values = array(); $values['idx-q-Locations'] = isset($_GET['idx-q-Locations']) ? $_GET['idx-q-Locations'] : null; $values['idx-q-PropertyTypes'] = isset($_GET['idx-q-PropertyTypes']) ? $_GET['idx-q-PropertyTypes'] : null; $values['idx-q-Cities'] = isset($_GET['idx-q-Cities']) ? $_GET['idx-q-Cities'] : null; $values['idx-q-Communities'] = isset($_GET['idx-q-Communities']) ? $_GET['idx-q-Communities'] : null; $values['idx-q-TractIdentifiers'] = isset($_GET['idx-q-TractIdentifiers']) ? $_GET['idx-q-TractIdentifiers'] : null; $values['idx-q-ZipCodes'] = isset($_GET['idx-q-ZipCodes']) ? $_GET['idx-q-ZipCodes'] : null; $values['idx-q-PriceMin'] = isset($_GET['idx-q-PriceMin']) ? $_GET['idx-q-PriceMin'] : null; $values['idx-q-PriceMax'] = isset($_GET['idx-q-PriceMax']) ? $_GET['idx-q-PriceMax'] : null; $values['idx-q-BedsMin'] = isset($_GET['idx-q-BedsMin']) ? $_GET['idx-q-BedsMin'] : null; $values['idx-q-BathsMin'] = isset($_GET['idx-q-BathsMin']) ? $_GET['idx-q-BathsMin'] : null; $values['idx-q-ImprovedSqFtMin'] = isset($_GET['idx-q-ImprovedSqFtMin']) ? $_GET['idx-q-ImprovedSqFtMin'] : null; $values['idx-q-MlsNumbers'] = isset($_GET['idx-q-MlsNumbers']) ? $_GET['idx-q-MlsNumbers'] : null; $specialSlugs = array('city' => 'idx-q-Cities', 'community' => 'idx-q-Communities', 'tract' => 'idx-q-TractIdentifiers', 'zip' => 'idx-q-ZipCodes'); $urlParts = explode('/', $_SERVER['REQUEST_URI']); $count = 0; foreach ($urlParts as $p) { if (array_key_exists($p, $specialSlugs) && isset($urlParts[$count + 1])) { $values[$specialSlugs[$p]] = $urlParts[$count + 1]; } $count++; } echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo <<<HTML \t\t\t<div class="dsidx-resp-search-box dsidx-widget dsidx-resp-vertical"> \t\t\t<label id="idx-search-invalid-msg" style="color:red"></label> \t\t\t<form class="dsidx-resp-search-form" action="{$formAction}" method="get" onsubmit="return dsidx_w.searchWidget.validate();" > \t\t\t\t<fieldset> \t\t\t\t<div class="dsidx-resp-area"> \t\t\t\t<label>Property Type</label> \t\t\t\t<select name="idx-q-PropertyTypes" class="dsidx-search-widget-propertyTypes"> \t\t\t\t\t<option value="">Any</option> HTML; if (is_array($propertyTypes)) { foreach ($propertyTypes as $propertyType) { $name = htmlentities($propertyType->DisplayName); $selected = $propertyType->SearchSetupPropertyTypeID == $values['idx-q-PropertyTypes'] ? ' selected="selected"' : ''; echo "<option value=\"{$propertyType->SearchSetupPropertyTypeID}\"{$selected}>{$name}</option>"; } } echo <<<HTML \t\t\t\t</select> \t\t\t\t</div> \t\t\t\t<div class="dsidx-resp-area"> HTML; if ($searchOptions['show_cities'] == 'yes' && !empty($searchOptions['cities'])) { echo <<<HTML \t\t\t\t<label>City</label> \t\t\t\t<select id="idx-q-Cities" name="idx-q-Cities" class="idx-q-Location-Filter"> \t\t\t\t\t<option value="">Any</option> HTML; foreach ($searchOptions["cities"] as $city) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $city = htmlentities(trim($city)); $selected = strtolower($city) == strtolower($values['idx-q-Cities']) ? ' selected="selected"' : ''; echo "<option value=\"{$city}\"{$selected}>{$city}</option>"; } echo '</select>'; echo '</div>'; } if ($searchOptions['show_communities'] == 'yes' && !empty($searchOptions['communities'])) { echo <<<HTML \t\t\t\t<div class="dsidx-resp-area"> \t\t\t\t<label>Community</label> \t\t\t\t<select id="idx-q-Communities" name="idx-q-Communities" class="idx-q-Location-Filter"> \t\t\t\t\t<option value="">Any</option> HTML; foreach ($searchOptions['communities'] as $community) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $community = htmlentities(trim($community)); $selected = strtolower($community) == strtolower($values['idx-q-Communities']) ? ' selected="selected"' : ''; echo "<option value=\"{$community}\"{$selected}>{$community}</option>"; } echo '</select>'; echo '</div>'; } if ($searchOptions['show_tracts'] == 'yes' && !empty($searchOptions['tracts'])) { echo <<<HTML \t\t\t\t<div class="dsidx-resp-area"> \t\t\t\t<label>Tract</label> \t\t\t\t<select id="idx-q-TractIdentifiers" name="idx-q-TractIdentifiers" class="idx-q-Location-Filter"> \t\t\t\t\t<option value="">Any</option> HTML; foreach ($searchOptions["tracts"] as $tract) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $tract = htmlentities(trim($tract)); $selected = strtolower($tract) == strtolower($values['idx-q-TractIdentifiers']) ? ' selected="selected"' : ''; echo "<option value=\"{$tract}\"{$selected}>{$tract}</option>"; } echo '</select>'; echo '</div>'; } if ($searchOptions['show_zips'] == 'yes' && !empty($searchOptions['zips'])) { echo <<<HTML \t\t\t\t<div class="dsidx-resp-area"> \t\t\t\t<label>Zip</label> \t\t\t\t<select id="idx-q-ZipCodes" name="idx-q-ZipCodes" class="idx-q-Location-Filter"> \t\t\t\t\t<option value="">Any</option> HTML; foreach ($searchOptions["zips"] as $zip) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $zip = htmlentities(trim($zip)); $selected = strtolower($zip) == strtolower($values['idx-q-ZipCodes']) ? ' selected="selected"' : ''; echo "<option value=\"{$zip}\"{$selected}>{$zip}</option>"; } echo '</select>'; echo '</div>'; } if ($searchOptions["show_mlsnumber"] == "yes") { echo <<<HTML \t\t\t\t<div class="dsidx-resp-area"> \t\t\t\t<label for="idx-q-MlsNumbers">MLS #</label> \t\t\t\t<input id="idx-q-MlsNumbers" name="idx-q-MlsNumbers" type="text" class="dsidx-mlsnumber" value="{$values['idx-q-MlsNumbers']}" /> \t\t\t\t</div> HTML; } echo <<<HTML \t\t\t\t<div class="dsidx-resp-area dsidx-resp-area-half dsidx-resp-area-half dsidx-resp-area-left"> \t\t\t\t<label for="idx-q-PriceMin">Price From</label> \t\t\t\t<input id="idx-q-PriceMin" name="idx-q-PriceMin" type="text" class="dsidx-price" placeholder="Any" value="{$values['idx-q-PriceMin']}" /> </div> \t\t\t\t<div class="dsidx-resp-area dsidx-resp-area-half dsidx-resp-area-half dsidx-resp-area-right"> \t\t\t\t<label for="idx-q-PriceMin">To</label> \t\t\t\t<input id="idx-q-PriceMax" name="idx-q-PriceMax" type="text" class="dsidx-price" placeholder="Any" value="{$values['idx-q-PriceMax']}" /> \t\t\t\t</div> HTML; echo <<<HTML \t\t\t\t<div class="dsidx-resp-area dsidx-resp-min-baths-area dsidx-resp-area-half dsidx-resp-area-left"> \t\t\t\t<label for="idx-q-BedsMin">Beds</label> \t\t\t\t<select id="idx-q-BedsMin" name="idx-q-BedsMin" class="dsidx-beds"> \t\t\t\t\t<option value="">Any</option> HTML; for ($i = 1; $i <= 9; $i++) { $selected = $i == $values['idx-q-BedsMin'] ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '>' . $i . '+</option>'; } echo <<<HTML \t\t\t\t</select> \t\t\t\t</div> \t\t\t\t<div class="dsidx-resp-area dsidx-resp-min-baths-area dsidx-resp-area-half dsidx-resp-area-right"> \t\t\t\t<label for="idx-q-BathsMin">Baths</label> \t\t\t\t<select id="idx-q-BathsMin" name="idx-q-BathsMin" class="dsidx-baths"> \t\t\t\t\t<option value="">Any</option> HTML; for ($i = 1; $i <= 9; $i++) { $selected = $i == $values['idx-q-BathsMin'] ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '>' . $i . '+</option>'; } echo <<<HTML \t\t\t\t</select> \t\t\t\t</div> HTML; if (isset($defaultSearchPanels)) { foreach ($defaultSearchPanels as $key => $value) { if ($value->DomIdentifier == "search-input-home-size" && isset($capabilities['MinImprovedSqFt']) && $capabilities['MinImprovedSqFt'] > 0) { echo <<<HTML \t\t\t\t\t\t<div class="dsidx-resp-area"> \t\t\t\t\t\t<label for="idx-q-ImprovedSqFtMin">Min Sqft</label> \t\t\t\t\t\t<input id="idx-q-ImprovedSqFtMin" name="idx-q-ImprovedSqFtMin" type="text" class="dsidx-improvedsqft" placeholder="Any" value="{$values['idx-q-ImprovedSqFtMin']}" /> \t\t\t\t\t\t</div> HTML; break; } } } echo <<<HTML \t\t\t\t<div class="dsidx-resp-area dsidx-resp-area-submit"> \t\t\t\t\t<label for="idx-q-PriceMin"> </label> \t\t\t\t\t<input type="submit" class="submit" value="Search for properties" /> \t\t\t\t</div> HTML; if ($options["HasSearchAgentPro"] == "yes" && $searchOptions["show_advanced"] == "yes") { echo <<<HTML \t\t\t\t\t<div style="float: right;"> \t\t\t\t\ttry our <a href="{$formAction}advanced/"><img src="{$pluginUrl}assets/adv_search-16.png" /> Advanced Search</a> \t\t\t\t\t</div> HTML; } if ($account_options->EulaLink) { $eula_url = $account_options->EulaLink; echo <<<HTML \t\t\t\t\t<p>By searching, you agree to the <a href="{$eula_url}" target="_blank">EULA</a></p> HTML; } echo <<<HTML \t\t\t</fieldset> \t\t\t</form> \t\t\t</div> HTML; echo $after_widget; dsidx_footer::ensure_disclaimer_exists("search"); }
static function GetPhotosXML() { $post_vars = array_map("stripcslashes", $_GET); $apiRequestParams = array(); $apiRequestParams['propertyid'] = $post_vars['pid']; $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData('Photos', $apiRequestParams, false); header('Content-type: text/xml'); echo $apiHttpResponse['body']; die; }
function shandora_get_search_listing_form_idx() { global $bon; $options = get_option(DSIDXPRESS_OPTION_NAME); if (!$options["Activated"]) { return; } $pluginUrl = plugins_url() . '/dsidxpress/'; wp_enqueue_script('dsidxpress_widget_search_view', $pluginUrl . 'js/widget-client.js', array('jquery'), DSIDXPRESS_PLUGIN_VERSION, true); $formAction = get_home_url() . "/idx/"; $defaultSearchPanels = dsSearchAgent_ApiRequest::FetchData("AccountSearchPanelsDefault", array(), false, 60 * 60 * 24); $defaultSearchPanels = $defaultSearchPanels["response"]["code"] == "200" ? json_decode($defaultSearchPanels["body"]) : null; $propertyTypes = dsSearchAgent_ApiRequest::FetchData("AccountSearchSetupFilteredPropertyTypes", array(), false, 60 * 60 * 24); $propertyTypes = $propertyTypes["response"]["code"] == "200" ? json_decode($propertyTypes["body"]) : null; $account_options = dsSearchAgent_ApiRequest::FetchData("AccountOptions", array(), false); if ($account_options && isset($account_options['response'])) { $account_options = $account_options["response"]["code"] == "200" ? json_decode($account_options["body"]) : null; } $autoload_options = bon_get_option('idx_enable_search_autoload'); if ($autoload_options == 'no') { $manual_city = explode("\n", bon_get_option('idx_manual_city')); sort($manual_city); $manual_community = explode("\n", bon_get_option('idx_manual_community')); sort($manual_community); $manual_tract = explode("\n", bon_get_option('idx_manual_tract')); sort($manual_tract); $manual_zip = explode("\n", bon_get_option('idx_manual_zip')); sort($manual_zip); $searchOptions = array('cities' => $manual_city, 'communities' => $manual_community, 'tracts' => $manual_tract, 'zips' => $manual_zip); } else { $searchOptions = array('cities' => shandora_get_idx_options('City'), 'communities' => shandora_get_idx_options('Community'), 'tracts' => shandora_get_idx_options('Tract'), 'zips' => shandora_get_idx_options('Zip')); } $ro = '<div class="row search-listing-form">'; // row open $rc = '</div>'; // row close $cc = $rc; //column close $co = '<div class="large-4 column form-column small-11 small-centered large-uncentered">'; // column open ?> <form id="search-listing-form" action="<?php echo $formAction; ?> " method="get" class="custom" onsubmit="return dsidx_w.searchWidget.validate();" > <?php echo $ro . '<div class="column large-10 small-12 large-uncentered small-centered">' . $ro; ?> <?php echo $co; ?> <label for="idx-q-PropertyTypes"><?php _e('Property Type', 'bon'); ?> </label> <select name="idx-q-PropertyTypes" class="select-dark dsidx-search-widget-propertyTypes"> <option value=""><?php _e('All Property Types', 'bon'); ?> </option> <?php if (is_array($propertyTypes)) { foreach ($propertyTypes as $propertyType) { $name = htmlentities($propertyType->DisplayName); ?> <option value="<?php echo $propertyType->SearchSetupPropertyTypeID; ?> " <?php selected('idx-q-PropertyTypes', $propertyType->SearchSetupPropertyTypeID); ?> ><?php echo $name; ?> </option> <?php } } ?> </select> <label id="idx-search-invalid-msg" style="color:red"></label> <?php echo $cc; ?> <?php echo $co; ?> <label for="idx-q-Cities"><?php _e('City', 'bon'); ?> </label> <select id="idx-q-Cities" name="idx-q-Cities" class="select-dark idx-q-Location-Filter"> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php if (!empty($searchOptions['cities'])) { foreach ($searchOptions["cities"] as $city) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $city = $autoload_options == 'no' ? htmlentities(trim($city)) : htmlentities(trim($city->Name)); ?> <option value="<?php echo $city; ?> " <?php selected('idx-q-Cities', $city); ?> ><?php echo $city; ?> </option> <?php } } ?> </select> <?php echo $cc; ?> <?php echo $co; ?> <?php $bed_opt = absint(bon_get_option('maximum_bed', 5)); if (!is_int($bed_opt)) { $bed_opt = 5; } ?> <label for="idx-q-BedsMin"><?php _e('Beds', 'bon'); ?> </label> <!--<input id="idx-q-BedsMin" name="idx-q-BedsMin" type="text" class="dsidx-beds" placeholder="min bedrooms" /> --> <div class="ui-slider-wrapper-custom beds-wrapper"> <select name="idx-q-BedsMin" id="idx-q-BedsMin" class="bon-dsidx-beds2 dsidx-beds no-custom select-slider"> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php for ($i = 1; $i <= $bed_opt; $i++) { ?> <option value="<?php echo $i; ?> " <?php selected('idx-q-BedsMin', $i); ?> ><?php echo $i; ?> </option> <?php } ?> </select> </div> <?php echo $cc . $rc; ?> <?php echo $ro . $co; ?> <label for="idx-q-TractIdentifiers"><?php _e('Tract', 'bon'); ?> </label> <select id="idx-q-TractIdentifiers" name="idx-q-TractIdentifiers" class="select-dark idx-q-Location-Filter"> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php if (!empty($searchOptions['tracts'])) { foreach ($searchOptions["tracts"] as $tract) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $tract = $autoload_options == 'no' ? htmlentities(trim($tract)) : htmlentities(trim($tract->Name)); ?> <option value="<?php echo $tract; ?> " <?php selected('idx-q-TractIdentifiers', $tract); ?> ><?php echo $tract; ?> </option> <?php } } ?> </select> <?php echo $cc; ?> <?php echo $co; ?> <label for="idx-q-ZipCodes"><?php _e('Zip', 'bon'); ?> </label> <select id="idx-q-ZipCodes" name="idx-q-ZipCodes" class="select-dark idx-q-Location-Filter"> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php if (!empty($searchOptions['zips'])) { foreach ($searchOptions["zips"] as $zip) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $zip = $autoload_options == 'no' ? htmlentities(trim($zip)) : htmlentities(trim($zip->Name)); ?> <option value="<?php echo $zip; ?> " <?php selected('idx-q-ZipCodes', $zip); ?> ><?php echo $zip; ?> </option> <?php } } ?> </select> <?php echo $cc; ?> <?php echo $co; ?> <?php $bath_opt = absint(bon_get_option('maximum_bath', 5)); if (!is_int($bath_opt)) { $bath_opt = 5; } ?> <label for="idx-q-BathsMin"><?php _e('Baths', 'bon'); ?> </label> <div class="ui-slider-wrapper-custom baths-wrapper"> <select name="idx-q-BathsMin" id="idx-q-BathsMin" class="bon-dsidx-baths2 dsidx-baths no-custom select-slider"> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php for ($i = 1; $i <= $bath_opt; $i++) { ?> <option value="<?php echo $i; ?> " <?php selected('idx-q-BathsMin', $i); ?> ><?php echo $i; ?> </option> <?php } ?> </select> </div> <?php echo $cc . $rc; ?> <?php echo $ro . $co; ?> <label for="idx-q-Communities"><?php _e('Community', 'bon'); ?> </label> <select id="idx-q-Communities" name="idx-q-Communities" class="select-dark idx-q-Location-Filter"> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php if (!empty($searchOptions['communities'])) { foreach ($searchOptions["communities"] as $community) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $community = $autoload_options == 'no' ? htmlentities(trim($community)) : htmlentities(trim($community->Name)); ?> <option value="<?php echo $community; ?> " <?php selected('idx-q-Communities', $community); ?> ><?php echo $community; ?> </option> <?php } } ?> </select> <?php echo $cc; ?> <?php echo $co; ?> <label for="idx-q-MlsNumbers"><?php _e('MLS #', 'bon'); ?> </label> <input id="idx-q-MlsNumbers" name="idx-q-MlsNumbers" type="text" class="dsidx-mlsnumber" value="<?php isset($_GET['idx-q-MlsNumbers']) ? $_GET['idx-q-MlsNumbers'] : ''; ?> " /> <?php echo $cc; ?> <?php echo $co; ?> <label for="idx-q-PriceMin"><?php _e('Price Range', 'bon'); ?> <span class="price-text" id="idx-min-price-text"></span> <span class="price-text" id="idx-max-price-text"></span> </label> <div class="price-slider-wrapper ui-slider-wrapper-custom"> <div id="idx-slider-range2"></div> </div> <input id="idx-q-PriceMin" name="idx-q-PriceMin" type="hidden" class="dsidx-price bon-dsidx-price-min2" value="<?php isset($_GET['idx-q-PriceMin']) ? $_GET['idx-q-PriceMin'] : ''; ?> " placeholder="min price" /> <input id="idx-q-PriceMax" name="idx-q-PriceMax" type="hidden" class="dsidx-price bon-dsidx-price-max2" value="<?php isset($_GET['idx-q-PriceMax']) ? $_GET['idx-q-PriceMax'] : ''; ?> " placeholder="max price" /> <?php echo $cc . $rc . $cc; ?> <div class="column large-2 small-11 large-uncentered small-centered" id="submit-button"> <?php $button_color = bon_get_option('search_button_color', 'red'); $search_label = bon_get_option('search_button_label', __('Find Property', 'bon')); ?> <input type="submit" class="button flat <?php echo $button_color; ?> expand small radius submit" value="<?php echo $search_label; ?> " /> </div> </div> </form> <?php }
static function Listings($atts, $content = null, $code = "") { $options = get_option(DSIDXPRESS_OPTION_NAME); if (!$options["Activated"]) { return ""; } $atts = shortcode_atts(array("city" => "", "community" => "", "county" => "", "tract" => "", "zip" => "", "minprice" => "", "maxprice" => "", "minbeds" => "", "maxbeds" => "", "minbaths" => "", "maxbaths" => "", "mindom" => "", "maxdom" => "", "minyear" => "", "maxyear" => "", "minimpsqft" => "", "maximpsqft" => "", "minlotsqft" => "", "maxlotsqft" => "", "statuses" => "", "propertytypes" => "", "linkid" => "", "count" => "5", "orderby" => "DateAdded", "orderdir" => "DESC", "showlargerphotos" => "false"), $atts); $apiRequestParams = array(); $apiRequestParams["responseDirective.ViewNameSuffix"] = "shortcode"; $apiRequestParams["responseDirective.IncludeMetadata"] = "true"; $apiRequestParams["responseDirective.IncludeLinkMetadata"] = "true"; $apiRequestParams["responseDirective.ShowLargerPhotos"] = $atts["showlargerphotos"]; $apiRequestParams["query.Cities"] = htmlspecialchars_decode($atts["city"]); $apiRequestParams["query.Communities"] = htmlspecialchars_decode($atts["community"]); $apiRequestParams["query.Counties"] = htmlspecialchars_decode($atts["county"]); $apiRequestParams["query.TractIdentifiers"] = htmlspecialchars_decode($atts["tract"]); $apiRequestParams["query.ZipCodes"] = $atts["zip"]; $apiRequestParams["query.PriceMin"] = $atts["minprice"]; $apiRequestParams["query.PriceMax"] = $atts["maxprice"]; $apiRequestParams["query.BedsMin"] = $atts["minbeds"]; $apiRequestParams["query.BedsMax"] = $atts["maxbeds"]; $apiRequestParams["query.BathsMin"] = $atts["minbaths"]; $apiRequestParams["query.BathsMax"] = $atts["maxbaths"]; $apiRequestParams["query.DaysOnMarketMin"] = $atts["mindom"]; $apiRequestParams["query.DaysOnMarketMax"] = $atts["maxdom"]; $apiRequestParams["query.YearBuiltMin"] = $atts["minyear"]; $apiRequestParams["query.YearBuiltMax"] = $atts["maxyear"]; $apiRequestParams["query.ImprovedSqFtMin"] = $atts["minimpsqft"]; $apiRequestParams["query.ImprovedSqFtMax"] = $atts["maximpsqft"]; $apiRequestParams["query.LotSqFtMin"] = $atts["minlotsqft"]; $apiRequestParams["query.LotSqFtMax"] = $atts["maxlotsqft"]; if (self::TranslateStatuses($atts["statuses"])) { $apiRequestParams["query.ListingStatuses"] = self::TranslateStatuses($atts["statuses"]); } else { $apiRequestParams["query.ListingStatuses"] = 3; } if ($atts["propertytypes"]) { $propertyTypes = explode(",", str_replace(" ", "", $atts["propertytypes"])); $propertyTypes = array_combine(range(0, count($propertyTypes) - 1), $propertyTypes); foreach ($propertyTypes as $key => $value) { $apiRequestParams["query.PropertyTypes[{$key}]"] = $value; } } if ($atts["linkid"]) { $apiRequestParams["query.LinkID"] = $atts["linkid"]; $apiRequestParams["query.ForceUsePropertySearchConstraints"] = "true"; } $apiRequestParams["directive.ResultsPerPage"] = $atts["count"]; $apiRequestParams["directive.SortOrders[0].Column"] = $atts["orderby"]; $apiRequestParams["directive.SortOrders[0].Direction"] = $atts["orderdir"]; $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("Results", $apiRequestParams); dsidx_footer::ensure_disclaimer_exists(); if (empty($apiHttpResponse["errors"]) && $apiHttpResponse["response"]["code"] == "200") { return $apiHttpResponse["body"]; } else { if ($apiHttpResponse["response"]["code"] == "403") { return '<p class="dsidx-error">' . DSIDXPRESS_INACTIVE_ACCOUNT_MESSAGE . '</p>'; } return '<p class="dsidx-error">' . DSIDXPRESS_IDX_ERROR_MESSAGE . '</p>'; } }
public static function LinkBuilderHtml($in_post_dialog = false, $_nav_menu_placeholder = -1, $nav_menu_selected_id = 1, $in_idx_page_options = false, $preset_url = '') { $label_class = !$in_post_dialog ? ' input-with-default-title' : ''; $label_value = $in_post_dialog && isset($_GET['selected_text']) ? ' value="' . esc_attr(strip_tags($_GET['selected_text'])) . '"' : ''; $url_value = $in_post_dialog && isset($_GET['selected_url']) ? htmlspecialchars($_GET['selected_url']) : 'http://'; $link_mode = isset($_GET['idxlinkmode']) ? $_GET['idxlinkmode'] : ''; if (!empty($preset_url)) { $url_value = $preset_url; } $property_types_html = ""; $property_types = dsSearchAgent_ApiRequest::FetchData('AccountSearchSetupPropertyTypes', array(), false, 60 * 60 * 24); if (!empty($property_types) && is_array($property_types)) { $property_types = json_decode($property_types["body"]); foreach ($property_types as $property_type) { $checked_html = ''; $name = htmlentities($property_type->DisplayName); $id = $property_type->SearchSetupPropertyTypeID; $property_types_html .= <<<HTML {$id}: {$name}, HTML; } } $property_types_html = substr($property_types_html, 0, strlen($property_types_html) - 1); ?> <script> zpress_home_url = '<?php echo get_home_url(); ?> ';</script> <div id="dsidxpress-link-builder" class="customlinkdiv"> <input type="hidden" id="linkBuilderPropertyTypes" value="<?php echo $property_types_html; ?> " /> <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?> ][menu-item-type]" /> <input type="hidden" value="<?php esc_attr_e($link_mode); ?> " id="dsidx-linkbuilder-mode" ?> <?php if (!$in_idx_page_options) { ?> <p class="dsidxpress-item-wrap"> <label class="howto" for="dsidxpress-menu-item-label"> <span><?php _e('Label'); ?> </span> <input id="dsidxpress-menu-item-label" name="menu-item-label" type="text" class="regular-text menu-item-textbox<?php echo $label_class; ?> " title="<?php esc_attr_e('Menu Item'); ?> "<?php echo $label_value; ?> /> </label> </p> <?php } ?> <p class="dsidxpress-item-wrap"> <label class="howto" for="dsidxpress-filter-menu"> <span><?php _e('Add Filter'); ?> </span> <select class="regular-text" id="dsidxpress-filter-menu" ></select> </label> </p> <div id="dsidxpress-editor-wrap" class="dsidxpress-item-wrap hidden"> <div class="dsidxpress-filter-editor"> <div class="dsidxpress-editor-header"> <h4>Filter results by <b>Beds</b></h4> <span class="dsidx-editor-cancel"><a href="javascript:void(0)"></a></span> </div> <div class="dsidxpress-editor-main"></div> <div class="buttons"> <input type="button" value="Update this Filter" class="button-primary" /> <input type="button" value="Cancel" class="button-secondary dsidx-editor-cancel" /> </div> </div> </div> <div id="dsidxpress-filters-wrap" class="dsidxpress-item-wrap hidden"> <span><?php _e('Filters'); ?> </span> <ul id="dsidxpress-filter-list"></ul> </div> <?php if (!$in_idx_page_options) { ?> <p class="dsidxpress-item-wrap"> <label class="howto dsidxpress-checkbox"> <input id="dsidxpress-show-url" type="checkbox" /> <span><?php _e('Display Generated URL'); ?> </span> </label> </p> <?php } ?> <?php $inputName = 'menu-item[' . $_nav_menu_placeholder . '][menu-item-url]'; if ($in_idx_page_options) { $inputName = 'dsidxpress-assembled-url'; } ?> <p id="dsidxpress-assembled-url-wrap" class="dsidxpress-item-wrap hidden"> <label class="howto" for="dsidxpress-assembled-url"> <span><?php _e('URL'); ?> </span> <textarea id="dsidxpress-assembled-url" name="<?php echo $inputName; ?> " type="text" rows="4" class="code menu-item-textbox"><?php echo $url_value; ?> </textarea> </label> </p> <?php if (!$in_idx_page_options) { ?> <p class="button-controls"> <span class="add-to-menu"> <?php if (!$in_post_dialog) { ?> <img id="img-link-builder-waiting" style="display:none;" src="<?php echo esc_url(admin_url('images/wpspin_light.gif')); ?> " alt="" /> <input type="submit"<?php disabled($nav_menu_selected_id, 0); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?> " name="add-custom-menu-item" id="submit-linkbuilderdiv" /> <?php } else { ?> <input type="button" id="dsidxpress-lb-cancel" name="cancel" value="Cancel" class="button-secondary" onclick="tinyMCEPopup.close();" /> <input type="button" id="dsidxpress-lb-insert" name="insert" value="<?php esc_attr_e($link_mode); ?> Link" class="button-primary" style="text-transform: capitalize;" onclick="dsidxLinkBuilder.insert();" /> <?php } ?> </span> </p> <?php } ?> </div><!-- /#dsidxpress-link-builder --> <?php }
public static function renderWidget($args, $instance) { extract($args); extract($instance); $title = apply_filters("widget_title", $title); $options = get_option(DSIDXPRESS_OPTION_NAME); if (!isset($options["Activated"]) || !$options["Activated"]) { return; } $pluginUrl = get_home_url() . '/wp-content/plugins/dsidxpress/'; $formAction = get_home_url() . "/idx/"; $defaultSearchPanels = \dsSearchAgent_ApiRequest::FetchData("AccountSearchPanelsDefault", array(), false, 60 * 60 * 24); $defaultSearchPanels = $defaultSearchPanels["response"]["code"] == "200" ? json_decode($defaultSearchPanels["body"]) : null; $propertyTypes = \dsSearchAgent_ApiRequest::FetchData("AccountSearchSetupFilteredPropertyTypes", array(), false, 60 * 60 * 24); $propertyTypes = $propertyTypes["response"]["code"] == "200" ? json_decode($propertyTypes["body"]) : null; $account_options = \dsSearchAgent_ApiRequest::FetchData("AccountOptions"); $account_options = $account_options["response"]["code"] == "200" ? json_decode($account_options["body"]) : null; $widgetType = htmlspecialchars($instance["widgetType"]); $values = array(); $values['idx-q-Locations'] = isset($_GET['idx-q-Locations']) ? stripslashes($_GET['idx-q-Locations']) : null; $values['idx-q-PropertyTypes'] = isset($_GET['idx-q-PropertyTypes']) ? $_GET['idx-q-PropertyTypes'] : null; $values['idx-q-PriceMin'] = isset($_GET['idx-q-PriceMin']) ? $_GET['idx-q-PriceMin'] : null; $values['idx-q-PriceMax'] = isset($_GET['idx-q-PriceMax']) ? $_GET['idx-q-PriceMax'] : null; $specialSlugs = array('city' => 'idx-q-Cities', 'community' => 'idx-q-Communities', 'tract' => 'idx-q-TractIdentifiers', 'zip' => 'idx-q-ZipCodes'); $urlParts = explode('/', $_SERVER['REQUEST_URI']); $count = 0; foreach ($urlParts as $p) { if (array_key_exists($p, $specialSlugs) && isset($urlParts[$count + 1])) { $values['idx-q-Locations'] = ucwords($urlParts[$count + 1]); } $count++; } echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $widgetClass = $widgetType == 1 || $widgetType == 'vertical' ? 'dsidx-resp-vertical' : 'dsidx-resp-horizontal'; if (isset($instance['class'])) { //Allows us to add custim class for shortcode etc. $widgetClass .= ' ' . $instance['class']; } echo <<<HTML <div class="dsidx-resp-search-box {$widgetClass}"> <form class="dsidx-resp-search-form" action="{$formAction}" method="GET"> <fieldset> <div class="dsidx-resp-area dsidx-resp-location-area"> <label for="dsidx-resp-location" class="dsidx-resp-location">Location</label> <input placeholder="Search Term" name="idx-q-Locations" type="text" class="text dsidx-search-omnibox-autocomplete" id="dsidx-resp-location" value="{$values['idx-q-Locations']}" /> </div> <div class="dsidx-resp-area dsidx-resp-type-area"> <label for="dsidx-resp-area-type" class="dsidx-resp-type">Type</label> <select id="dsidx-resp-area-type" class="dsidx-resp-select" name="idx-q-PropertyTypes"> <option value="">Any</option> HTML; if (is_array($propertyTypes)) { foreach ($propertyTypes as $propertyType) { $name = htmlentities($propertyType->DisplayName); $selected = $propertyType->SearchSetupPropertyTypeID == $values['idx-q-PropertyTypes'] ? ' selected="selected"' : ''; echo "<option value=\"{$propertyType->SearchSetupPropertyTypeID}\"{$selected}>{$name}</option>"; } } echo <<<HTML </select> </div> <div class="dsidx-resp-area dsidx-quick-resp-min-baths-area dsidx-resp-area-half dsidx-resp-area-left"> <label for="idx-q-BedsMin">Beds</label> <select id="idx-q-BedsMin" name="idx-q-BedsMin" class="dsidx-beds"> <option value="">Any</option> HTML; for ($i = 1; $i <= 9; $i++) { $selected = $i == $values['idx-q-BedsMin'] ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '>' . $i . '+</option>'; } echo <<<HTML </select> </div> <div class="dsidx-resp-area dsidx-quick-resp-min-baths-area dsidx-resp-area-half dsidx-resp-area-right"> <label for="idx-q-BathsMin">Baths</label> <select id="idx-q-BathsMin" name="idx-q-BathsMin" class="dsidx-baths"> <option value="">Any</option> HTML; for ($i = 1; $i <= 9; $i++) { $selected = $i == $values['idx-q-BathsMin'] ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '>' . $i . '+</option>'; } echo <<<HTML </select> </div> <div class="dsidx-resp-area dsidx-quick-resp-price-area dsidx-resp-price-area-min dsidx-resp-area-half dsidx-resp-area-left"> <label for="dsidx-resp-price-min" class="dsidx-resp-price">Price</label> <input id="idx-q-PriceMin" name="idx-q-PriceMin" type="text" class="dsidx-price" placeholder="Any" value="{$values['idx-q-PriceMin']}" /> </div> <div class="dsidx-resp-area dsidx-quick-resp-price-area dsidx-resp-price-area-max dsidx-resp-area-half dsidx-resp-area-right"> <label for="dsidx-resp-price-max" class="dsidx-resp-price">To</label> <input id="idx-q-PriceMax" name="idx-q-PriceMax" type="text" class="dsidx-price" placeholder="Any" value="{$values['idx-q-PriceMax']}" /> </div> <div class="dsidx-resp-area dsidx-resp-area-submit"> <label for="dsidx-resp-submit" class="dsidx-resp-submit"> </label> <input type="submit" class="dsidx-resp-submit" value="Search" /> </div> </fieldset> </form> </div> HTML; \dsidx_footer::ensure_disclaimer_exists("search"); echo $after_widget; }
static function ApiAction($action, $get, $idx_page_id = null) { global $wp_query; $options = get_option(DSIDXPRESS_OPTION_NAME); $post_id = !$idx_page_id ? time() : $idx_page_id; wp_enqueue_script("jquery-ui-dialog", false, array(), false, true); add_action("wp_head", array("dsSearchAgent_Client", "Header")); // allow wordpress to consume the page template option the user choose in the dsIDXpress settings if ($action == "results" && !empty($options["ResultsTemplate"])) { wp_cache_set($post_id, array("_wp_page_template" => array($options["ResultsTemplate"])), "post_meta"); } else { if ($action == "details" && !empty($options["DetailsTemplate"])) { wp_cache_set($post_id, array("_wp_page_template" => array($options["DetailsTemplate"])), "post_meta"); } } $apiParams = self::GetApiParams($get); // pull account options $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("AccountOptions"); if (!empty($apiHttpResponse["errors"]) || $apiHttpResponse["response"]["code"] != "200") { switch ($apiHttpResponse["response"]["code"]) { case 403: wp_die("We're sorry, but there’s nothing to display here; MLS data service is not activated for this account."); break; default: wp_die("We're sorry, but we ran into a temporary problem while trying to load the account data. Please check back soon.", "Account data load error"); } } else { $account_options = json_decode($apiHttpResponse["body"]); } if ($action == "results" || $action == "search") { dsidxpress_autocomplete::AddScripts(false); } if ($action == "results") { // save search if (!empty($get["idx-save"]) && $get["idx-save"] == "true") { $apiParams["name"] = $get["idx-save-name"]; $apiParams["updates"] = $get["idx-save-updates"] == "on" ? "true" : "false"; $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("SaveSearch", $apiParams, false, 0); $response = json_decode($apiHttpResponse["body"]); header('Content-Type: application/json'); echo $apiHttpResponse["body"]; die; } // check allowed searched before registration $allow_results_view = 1; if (!empty($account_options->AllowedSearchesBeforeRegistration) && isset($_COOKIE['dsidx-visitor-results-views'])) { if ((int) $account_options->AllowedSearchesBeforeRegistration <= (int) $_COOKIE['dsidx-visitor-results-views']) { $allow_results_view = 0; } } $apiParams["requester.AllowVisitorResultsView"] = $allow_results_view; if (isset($apiParams["query.LinkID"])) { $apiParams["query.ForceUsePropertySearchConstraints"] = "true"; } if (isset($apiParams["query.PropertySearchID"])) { $apiParams["query.ForceUsePropertySearchConstraints"] = "true"; } $apiParams["directive.ResultsPerPage"] = 25; if (isset($apiParams["directive.ResultPage"])) { $apiParams["directive.ResultPage"] = $apiParams["directive.ResultPage"] - 1; } $apiParams["responseDirective.IncludeMetadata"] = "true"; $apiParams["responseDirective.IncludeLinkMetadata"] = "true"; } else { if ($action == "details") { // check allowed searched before registration $allow_details_view = 1; if (!empty($account_options->AllowedDetailViewsBeforeRegistration) && isset($_COOKIE['dsidx-visitor-details-views'])) { if ((int) $account_options->AllowedDetailViewsBeforeRegistration <= (int) $_COOKIE['dsidx-visitor-details-views']) { $allow_details_view = 0; } } $useJuiceBox = 'true'; if (isset($options['ImageDisplay'])) { $useJuiceBox = $options['ImageDisplay'] == "slideshow" ? 'true' : 'false'; } // echo $useJuiceBox; $apiParams["requester.AllowVisitorDetailView"] = $allow_details_view; $apiParams["responseDirective.UseJuiceBoxSlideShow"] = $useJuiceBox; // if we have an auth cookie then record a property visit if (@$_COOKIE['dsidx-visitor-auth']) { $visitParams = array("mlsNumber" => $apiParams["query.MlsNumber"]); $apiVisitResponse = dsSearchAgent_ApiRequest::FetchData("RecordVisit", $visitParams, false, 0); } $screen_name = get_option('zillow_screen_name'); if (!empty($screen_name)) { $apiParams["responseDirective.ZillowScreenName"] = $screen_name; } } } $apiParams["responseDirective.IncludeDisclaimer"] = "true"; $apiParams["responseDirective.IncludeDsDisclaimer"] = defined('ZPRESS_API') && ZPRESS_API != '' ? "false" : "true"; $apiParams["responseDirective.RemoveDsDisclaimerLinks"] = isset($options['RemoveDsDisclaimerLinks']) && $options['RemoveDsDisclaimerLinks'] == 'Y' ? "true" : "false"; $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData($wp_query->query["idx-action"], $apiParams, false); if (!isset($apiHttpResponse["body"]) || !isset($apiHttpResponse["response"])) { wp_die("We're sorry, but we ran into a temporary problem while trying to load the real estate data. Please check back soon.", "Real estate data load error"); } $apiData = $apiHttpResponse["body"]; $apiData = str_replace('{$contentDomId}', $post_id, $apiData); if ($action == 'details' && defined('ZPRESS_API') && ZPRESS_API != '') { if (!isset($personal_info)) { $personal_info = stripslashes_deep(get_option('personal_info')); } if (!empty($personal_info['google_authorship']) && !empty($personal_info['googleplus'])) { $apiData .= '<p>By <a href="' . esc_url($personal_info['googleplus']) . '?rel=author" target="_blank">' . $personal_info['first_name'] . ' ' . $personal_info['last_name'] . '</a></p>'; } } if (in_array($_SERVER["REMOTE_ADDR"], self::$DebugAllowedFrom)) { if (isset($get["debug-api-response"])) { print_r($apiHttpResponse); exit; } } if ($apiHttpResponse["response"]["code"] == "404") { $error_template = isset($options["404Template"]) ? $options["404Template"] : ''; if ($error_template == '') { } elseif (strpos($error_template, '.php')) { $error_404 = locate_template('404.php'); if (!empty($error_404)) { wp_cache_set($post_id, array("_wp_page_template" => array($error_template)), "post_meta"); } } elseif (is_numeric($error_template)) { $post_id = $error_template; } $wp_query->set('is_404', true); add_action('get_header', array("dsSearchAgent_Client", "Return404")); } else { if ($apiHttpResponse["response"]["code"] == "302") { $redirect = dsSearchAgent_Client::GetBasePath() . self::ExtractValueFromApiData($apiData, "redirect"); header("Location: {$redirect}", true, 302); exit; } else { if (empty($apiHttpResponse["body"]) || !empty($apiHttpResponse["errors"]) || substr($apiHttpResponse["response"]["code"], 0, 1) == "5") { wp_die("We're sorry, but we ran into a temporary problem while trying to load the real estate data. Please check back soon.", "Real estate data load error"); } } } /*if ($options['ResultsTitle'] != '') $title = $options['ResultsTitle']; else */ $seo_title = self::ExtractValueFromApiData($apiData, "seo_title"); $seo_description = self::ExtractValueFromApiData($apiData, "seo_description"); $seo_keywords = self::ExtractValueFromApiData($apiData, "seo_keywords"); $title = self::ExtractValueFromApiData($apiData, "title"); $dateaddedgmt = self::ExtractValueFromApiData($apiData, "dateaddedgmt"); $description = self::ExtractValueFromApiData($apiData, "description"); $firstimage = self::ExtractValueFromApiData($apiData, "firstimage"); self::$meta_tag_data = array('firstimage' => $firstimage, 'title' => $title, 'description' => $description); self::$CanonicalUri = self::ExtractValueFromApiData($apiData, "canonical"); self::$TriggeredAlternateUrlStructure = self::ExtractValueFromApiData($apiData, "alternate-urls"); if (!isset($wp_query->query['ds-idx-listings-page'])) { if ($apiHttpResponse["response"]["code"] != "404") { self::EnsureBaseUri(); } } set_query_var("name", "dsidxpress-{$action}"); // at least a few themes require _something_ to be set here to display a good <title> tag set_query_var("pagename", "dsidxpress-{$action}"); // setting pagename in case someone wants to do a custom theme file for this "page" if (isset($options["404Template"]) && !empty($options["404Template"]) && $post_id == $options["404Template"]) { $post_id = $options["404Template"]; $post = get_post($post_id); } else { $post = (object) array("ID" => $post_id, "comment_count" => 0, "comment_status" => "closed", "ping_status" => "closed", "post_author" => 1, "post_content" => $apiData, "post_date" => $dateaddedgmt ? $dateaddedgmt : date("c"), "post_date_gmt" => $dateaddedgmt ? $dateaddedgmt : gmdate("c"), "post_excerpt" => $description, "post_name" => "dsidxpress-data", "post_parent" => 0, "post_status" => "publish", "post_title" => $title, "post_type" => "page"); } if (!$idx_page_id) { wp_cache_set($post_id, $post, 'posts'); } $posts = array($post); // track the detail & result views, do this at the end in case something errors or w/e $views = intval(@$_COOKIE["dsidx-visitor-{$action}-views"]); setcookie("dsidx-visitor-{$action}-views", $views + 1, time() + 60 * 60 * 24 * 30, '/'); $dsidxpress_seo = new dsidxpress_seo($seo_title, $seo_description, $seo_keywords); if (!$idx_page_id && isset($seo_title)) { add_filter('wp_title', array($dsidxpress_seo, 'dsidxpress_title_filter')); } if (isset($seo_keywords) || isset($seo_description)) { add_action('wp_head', array($dsidxpress_seo, 'dsidxpress_head_action')); } add_action('wp_head', array("dsSearchAgent_Client", 'SocialMetaTags')); if ($action == "search") { dsidx_footer::ensure_disclaimer_exists("search"); } return $posts; }
function form($instance) { wp_enqueue_script('dsidxpress_widget_listings', DSIDXPRESS_PLUGIN_URL . 'js/widget-listings.js', array('jquery'), DSIDXPRESS_PLUGIN_VERSION, true); $options = get_option(DSIDXPRESS_OPTION_NAME); $instance = wp_parse_args($instance, array("title" => "Latest Real Estate", "listingsToShow" => "25", "defaultDisplay" => "listed", "sort" => "DateAdded|DESC", "querySource" => "area", "areaSourceConfig" => array("type" => "city", "name" => ""), "linkSourceConfig" => array("linkId" => ""))); $titleFieldId = $this->get_field_id("title"); $titleFieldName = $this->get_field_name("title"); $baseFieldId = $this->get_field_id("listingsOptions"); $baseFieldName = $this->get_field_name("listingsOptions"); $checkedDefaultDisplay = array($instance["defaultDisplay"] => "checked=\"checked\""); $checkedQuerySource = array($instance["querySource"] => "checked=\"checked\""); $selectedAreaType = array($instance["areaSourceConfig"]["type"] => "selected=\"selected\""); $selectedAreaTypeNormalized = ucwords($instance["areaSourceConfig"]["type"]); $selectedSortOrder = array(str_replace("|", "", $instance["sort"]) => "selected=\"selected\""); $selectedLink = array($instance["linkSourceConfig"]["linkId"] => "selected=\"selected\""); $availableLinks = dsSearchAgent_ApiRequest::FetchData("AccountAvailableLinks", array(), true, 0); $availableLinks = json_decode($availableLinks["body"]); $pluginUrl = DSIDXPRESS_PLUGIN_URL; $agentListingsNote = null; $officeListingsNote = null; if ($options['AgentID'] == null) { $agentListingsNote = "There are no listings to show with your current settings. Please make sure you have provided your Agent ID on the IDX > General page of your site dashboard, or change this widget's settings to show other listings."; } if ($options['OfficeID'] == null) { $officeListingsNote = "There are no listings to show with your current settings. Please make sure you have provided your Office ID on the IDX > General page of your site dashboard, or change this widget's settings to show other listings."; } echo <<<HTML \t\t\t<p> \t\t\t\t<label for="{$titleFieldId}">Widget title</label> \t\t\t\t<input id="{$titleFieldId}" name="{$titleFieldName}" value="{$instance[title]}" class="widefat" type="text" /> \t\t\t</p> \t\t\t<p> \t\t\t\t<label for="{$baseFieldId}[listingsToShow]"># of listings to show (max 50)</label> \t\t\t\t<input id="{$baseFieldId}[listingsToShow]" name="{$baseFieldName}[listingsToShow]" value="{$instance[listingsToShow]}" class="widefat" type="text" /> \t\t\t</p> \t\t\t<p> \t\t\t\t<label for="{$baseFieldId}[sort]">Sort order</label> \t\t\t\t<select id="{$baseFieldId}[sort]" name="{$baseFieldName}[sort]" class="widefat"> \t\t\t\t\t<option value="DateAdded|DESC" {$selectedSortOrder[DateAddedDESC]}>Time on market, newest first</option> \t\t\t\t\t<option value="Price|DESC" {$selectedSortOrder[PriceDESC]}>Price, highest first</option> \t\t\t\t\t<option value="Price|ASC" {$selectedSortOrder[PriceASC]}>Price, lowest first</option> \t\t\t\t\t<option value="OverallPriceDropPercent|DESC" {$selectedSortOrder[OverallPriceDropPercentDESC]}>Price drop %, largest first</option> \t\t\t\t\t<option value="WalkScore|DESC" {$selectedSortOrder[WalkScoreDESC]}>Walk Score™, highest first</option> \t\t\t\t\t<option value="ImprovedSqFt|DESC" {$selectedSortOrder[ImprovedSqFtDESC]}>Improved size, largest first</option> \t\t\t\t\t<option value="LotSqFt|DESC" {$selectedSortOrder[LotSqFtDESC]}>Lot size, largest first</option> \t\t\t\t</select> \t\t\t</p> \t\t\t<p> \t\t\t\t<input type="radio" name="{$baseFieldName}[defaultDisplay]" id="{$baseFieldId}[defaultDisplay-listed]" value="listed" {$checkedDefaultDisplay[listed]}/> \t\t\t\t<label for="{$baseFieldId}[defaultDisplay-listed]">Show in list by default</label> \t\t\t\t<br /> \t\t\t\t<input type="radio" name="{$baseFieldName}[defaultDisplay]" id="{$baseFieldId}[defaultDisplay-slideshow]" value="slideshow" {$checkedDefaultDisplay[slideshow]}/> \t\t\t\t<label for="{$baseFieldId}[defaultDisplay-slideshow]">Show slideshow details by default</label> \t\t\t\t<br /> \t\t\t\t<input type="radio" name="{$baseFieldName}[defaultDisplay]" id="{$baseFieldId}[defaultDisplay-expanded]" value="expanded" onclick="document.getElementById('{$baseFieldId}[listingsToShow]').value = 4;" {$checkedDefaultDisplay[expanded]}/> \t\t\t\t<label for="{$baseFieldId}[defaultDisplay-expanded]">Show expanded details by default</label> \t\t\t\t<br /> \t\t\t\t<input type="radio" name="{$baseFieldName}[defaultDisplay]" id="{$baseFieldId}[defaultDisplay-map]" value="map" {$checkedDefaultDisplay[map]}/> \t\t\t\t<label for="{$baseFieldId}[defaultDisplay-map]">Show on map by default</label> \t\t\t</p> \t\t\t<div class="widefat" style="border-width: 0 0 1px; margin: 20px 0;"></div> \t\t\t<table> \t\t\t\t<tr> \t\t\t\t\t<td style="width: 20px;"><p><input type="radio" name="{$baseFieldName}[querySource]" id="{$baseFieldId}[querySource-area]" value="area" {$checkedQuerySource[area]}/></p></td> \t\t\t\t\t<td><p><label for="{$baseFieldId}[querySource-area]">Pick an area</label></p></td> \t\t\t\t</tr> \t\t\t\t<tr> \t\t\t\t\t<td></td> \t\t\t\t\t<td> \t\t\t\t\t\t<p> \t\t\t\t\t\t\t<label for="{$baseFieldId}[areaSourceConfig][type]">Area type</label> \t\t\t\t\t\t\t<select id="{$baseFieldId}_areaSourceConfig_type" name="{$baseFieldName}[areaSourceConfig][type]" class="widefat" onchange="dsWidgetListings.SwitchType(this, '{$baseFieldId}_areaSourceConfig_title')"> \t\t\t\t\t\t\t\t<option value="city" {$selectedAreaType[city]}>City</option> \t\t\t\t\t\t\t\t<option value="community" {$selectedAreaType[community]}>Community</option> \t\t\t\t\t\t\t\t<option value="tract" {$selectedAreaType[tract]}>Tract</option> \t\t\t\t\t\t\t\t<option value="zip" {$selectedAreaType[zip]}>Zip Code</option> \t\t\t\t\t\t\t</select> \t\t\t\t\t\t</p> \t\t\t\t\t\t<p> \t\t\t\t\t\t\t<label for="{$baseFieldId}[areaSourceConfig][name]">Area name</label> \t\t\t\t\t\t\t<input id="{$baseFieldId}[areaSourceConfig][name]" name="{$baseFieldName}[areaSourceConfig][name]" class="widefat" type="text" value="{$instance[areaSourceConfig][name]}" /> \t\t\t\t\t\t</p> \t\t\t\t\t\t<p> \t\t\t\t\t\t\t<span class="description">See all <span id="{$baseFieldId}_areaSourceConfig_title">{$selectedAreaTypeNormalized}</span> Names <a href="javascript:void(0);" onclick="dsWidgetListings.LaunchLookupList('{$pluginUrl}locations.php', '{$baseFieldId}_areaSourceConfig_type')">here</a></span> \t\t\t\t\t\t</p> \t\t\t\t\t</td> \t\t\t\t</tr> \t\t\t\t<tr> \t\t\t\t\t<th colspan="2"><p> - OR - </p></th> \t\t\t\t</tr> \t\t\t\t<tr> \t\t\t\t\t<td valign="top"><p><input type="radio" name="{$baseFieldName}[querySource]" id="{$baseFieldId}[querySource-agentlistings]" value="agentlistings" {$checkedQuerySource[agentlistings]}/></p></td> \t\t\t\t\t<td> \t\t\t\t\t\t<p><label for="{$baseFieldId}[querySource-agentlistings]">My own listings (via agent ID, newest listings first)</label></p> \t\t\t\t\t\t<p><i>{$agentListingsNote}</i></p> \t\t\t\t\t</td> \t\t\t\t</tr> \t\t\t\t<tr> \t\t\t\t\t<th colspan="2"><p> - OR - </p></th> \t\t\t\t</tr> \t\t\t\t<tr> \t\t\t\t\t<td valign="top"><p><input type="radio" name="{$baseFieldName}[querySource]" id="{$baseFieldId}[querySource-officelistings]" value="officelistings" {$checkedQuerySource[officelistings]}/></p></td> \t\t\t\t\t<td> \t\t\t\t\t\t<p><label for="{$baseFieldId}[querySource-officelistings]">My office's listings (via office ID, newest listings first)</label></p> \t\t\t\t\t\t<p><i>{$officeListingsNote}</i></p> \t\t\t\t\t</td> \t\t\t\t</tr> HTML; if (!defined('ZPRESS_API')) { echo <<<HTML \t\t \t\t\t\t<tr> \t\t\t\t\t<th colspan="2"><p> - OR - </p></th> \t\t\t\t</tr> \t\t\t\t<tr> \t\t\t\t\t<td><p><input type="radio" name="{$baseFieldName}[querySource]" id="{$baseFieldId}[querySource-link]" value="link" {$checkedQuerySource[link]}/></p></td> \t\t\t\t\t<td><p><label for="{$baseFieldId}[querySource-link]">Use a link you created in your website control panel</label></p></td> \t\t\t\t</tr> \t\t\t\t<tr> \t\t\t\t\t<td></td> \t\t\t\t\t<td> \t\t\t\t\t\t<p> \t\t\t\t\t\t\t<select name="{$baseFieldName}[linkSourceConfig][linkId]" class="widefat"> HTML; foreach ($availableLinks as $link) { echo "<option value=\"{$link->LinkID}\" {$selectedLink[$link->LinkID]}>{$link->Title}</option>"; } echo <<<HTML \t\t\t\t\t\t\t</select> \t\t\t\t\t\t</p> \t\t\t\t\t</td> \t\t\t\t</tr> HTML; } echo <<<HTML \t\t\t</table> HTML; }
function widget($args, $instance) { extract($args); extract($instance); $title = apply_filters("widget_title", $title); $options = get_option(DSIDXPRESS_OPTION_NAME); if (!$options["Activated"]) { return; } $pluginUrl = plugins_url() . '/dsidxpress/'; wp_enqueue_script('dsidxpress_widget_search_view', $pluginUrl . 'js/widget-client.js', array('jquery'), DSIDXPRESS_PLUGIN_VERSION, true); $formAction = get_home_url() . "/idx/"; $capabilities = dsSearchAgent_ApiRequest::FetchData('MlsCapabilities'); $capabilities = json_decode($capabilities['body'], true); $defaultSearchPanels = dsSearchAgent_ApiRequest::FetchData("AccountSearchPanelsDefault", array(), false, 60 * 60 * 24); $defaultSearchPanels = $defaultSearchPanels["response"]["code"] == "200" ? json_decode($defaultSearchPanels["body"]) : null; $propertyTypes = dsSearchAgent_ApiRequest::FetchData("AccountSearchSetupFilteredPropertyTypes", array(), false, 60 * 60 * 24); $propertyTypes = $propertyTypes["response"]["code"] == "200" ? json_decode($propertyTypes["body"]) : null; $account_options = dsSearchAgent_ApiRequest::FetchData("AccountOptions", array(), false); $account_options = $account_options["response"]["code"] == "200" ? json_decode($account_options["body"]) : null; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo <<<HTML \t\t\t<div class="dsidx-search-widget dsidx-widget"> \t\t\t<form action="{$formAction}" method="get" onsubmit="return dsidx_w.searchWidget.validate();" > \t\t\t\t<select name="idx-q-PropertyTypes" class="dsidx-search-widget-propertyTypes"> \t\t\t\t\t<option value="">- All property types -</option> HTML; if (is_array($propertyTypes)) { foreach ($propertyTypes as $propertyType) { $name = htmlentities($propertyType->DisplayName); echo "<option value=\"{$propertyType->SearchSetupPropertyTypeID}\">{$name}</option>"; } } echo <<<HTML \t\t\t\t</select> \t\t\t\t<label id="idx-search-invalid-msg" style="color:red"></label> HTML; if ($searchOptions['show_cities'] == 'yes' && !empty($searchOptions['cities'])) { echo <<<HTML \t\t\t\t<select id="idx-q-Cities" name="idx-q-Cities" class="idx-q-Location-Filter"> \t\t\t\t\t<option value="">- City -</option> HTML; foreach ($searchOptions["cities"] as $city) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $city = htmlentities(trim($city)); echo "<option value=\"{$city}\">{$city}</option>"; } echo '</select>'; } if ($searchOptions['show_communities'] == 'yes' && !empty($searchOptions['communities'])) { echo <<<HTML \t\t\t\t<select id="idx-q-Communities" name="idx-q-Communities" class="idx-q-Location-Filter"> \t\t\t\t\t<option value="">- Community -</option> HTML; foreach ($searchOptions['communities'] as $community) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $community = htmlentities(trim($community)); echo "<option value=\"{$community}\">{$community}</option>"; } echo '</select>'; } if ($searchOptions['show_tracts'] == 'yes' && !empty($searchOptions['tracts'])) { echo <<<HTML \t\t\t\t<select id="idx-q-TractIdentifiers" name="idx-q-TractIdentifiers" class="idx-q-Location-Filter"> \t\t\t\t\t<option value="">- Tract -</option> HTML; foreach ($searchOptions["tracts"] as $tract) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $tract = htmlentities(trim($tract)); echo "<option value=\"{$tract}\">{$tract}</option>"; } echo '</select>'; } if ($searchOptions['show_zips'] == 'yes' && !empty($searchOptions['zips'])) { echo <<<HTML \t\t\t\t<select id="idx-q-ZipCodes" name="idx-q-ZipCodes" class="idx-q-Location-Filter"> \t\t\t\t\t<option value="">- Zip -</option> HTML; foreach ($searchOptions["zips"] as $zip) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $zip = htmlentities(trim($zip)); echo "<option value=\"{$zip}\">{$zip}</option>"; } echo '</select>'; } if ($searchOptions["show_mlsnumber"] == "yes") { echo <<<HTML \t\t\t\t<label for="idx-q-MlsNumbers">MLS #</label> \t\t\t\t<input id="idx-q-MlsNumbers" name="idx-q-MlsNumbers" type="text" class="dsidx-mlsnumber" /> HTML; } echo <<<HTML \t\t\t\t<label for="idx-q-PriceMin">Price</label> \t\t\t\t<input id="idx-q-PriceMin" name="idx-q-PriceMin" type="text" class="dsidx-price" placeholder="min price" /> \t\t\t\t<input id="idx-q-PriceMax" name="idx-q-PriceMax" type="text" class="dsidx-price" placeholder="max price" /> HTML; if (isset($defaultSearchPanels)) { foreach ($defaultSearchPanels as $key => $value) { if ($value->DomIdentifier == "search-input-home-size" && isset($capabilities['MinImprovedSqFt']) && $capabilities['MinImprovedSqFt'] > 0) { echo <<<HTML \t\t\t\t\t\t<label for="idx-q-ImprovedSqFtMin">Size</label> \t\t\t\t\t\t<input id="idx-q-ImprovedSqFtMin" name="idx-q-ImprovedSqFtMin" type="text" class="dsidx-improvedsqft" placeholder="min sqft" /> HTML; break; } } } echo <<<HTML \t\t\t\t<label for="idx-q-BedsMin">Beds</label> \t\t\t\t<input id="idx-q-BedsMin" name="idx-q-BedsMin" type="text" class="dsidx-beds" placeholder="min bedrooms" /> \t\t\t\t<label for="idx-q-BathsMin">Baths</label> \t\t\t\t<input id="idx-q-BathsMin" name="idx-q-BathsMin" type="text" class="dsidx-baths" placeholder="min bathrooms" /> \t\t\t\t<div class="dsidx-search-button search-form"> \t\t\t\t\t<input type="submit" class="submit" value="Search for properties" /> HTML; if ($options["HasSearchAgentPro"] == "yes" && $searchOptions["show_advanced"] == "yes") { echo <<<HTML \t\t\t\t\ttry our <a href="{$formAction}advanced/"><img src="{$pluginUrl}assets/adv_search-16.png" /> Advanced Search</a> HTML; } if ($account_options->EulaLink) { $eula_url = $account_options->EulaLink; echo <<<HTML \t\t\t\t\t<p>By searching, you agree to the <a href="{$eula_url}" target="_blank">EULA</a></p> HTML; } echo <<<HTML \t\t\t\t</div> \t\t\t</form> \t\t\t</div> HTML; echo $after_widget; dsidx_footer::ensure_disclaimer_exists("search"); }
} } require_once $bootstrapSearchDir . '/wp-load.php'; require_once $bootstrapSearchDir . '/wp-admin/admin.php'; require_once dirname(__FILE__) . '/../../admin.php'; if (!current_user_can("edit_posts")) { wp_die("You can't do anything destructive in here, but you shouldn't be playing around with this anyway."); } global $wp_version, $tinymce_version; $localUri = get_option("siteurl") . "/" . WPINC . "/js/"; if (is_ssl()) { $localUri = preg_replace('/http/', 'https', $localUri); } $adminUri = get_admin_url(); $property_types_html = ""; $property_types = dsSearchAgent_ApiRequest::FetchData('AccountSearchSetupPropertyTypes', array(), false, 60 * 60 * 24); if (!empty($property_types)) { $property_types = json_decode($property_types["body"]); foreach ($property_types as $property_type) { $checked_html = ''; $name = htmlentities($property_type->DisplayName); $id = $property_type->SearchSetupPropertyTypeID; $property_types_html .= <<<HTML {$id}: {$name}, HTML; } } $property_types_html = substr($property_types_html, 0, strlen($property_types_html) - 1); $idxPagesUrl = get_admin_url() . 'edit.php?post_type=ds-idx-listings-page'; $pluginUrl = DSIDXPRESS_PLUGIN_URL; ?>
/** * Get an array of all property types * * @param boolean $cache Use cached data? * @return StdObject Object. Keys include: `SearchSetupPropertyTypeID` (int), `IsSearchedByDefault` (bool), `DisplayName` (string) */ function get_property_types($cache = true, $apply_filters = true) { $propertyTypes = null; if ($cache && !(current_user_can('administrator') && isset($_GET['cache']))) { $propertyTypes = get_transient("bon_idx_property_types"); if (!empty($propertyTypes)) { $propertyTypes = maybe_unserialize($propertyTypes); return $apply_filters ? apply_filters('bon_idx_property_types', $propertyTypes) : $propertyTypes; } } $propertyTypes = dsSearchAgent_ApiRequest::FetchData("AccountSearchSetupPropertyTypes", array(), false, 60 * 60 * 24); $propertyTypes = $propertyTypes["response"]["code"] == "200" ? json_decode($propertyTypes["body"]) : null; set_transient("bon_idx_property_types", maybe_serialize($propertyTypes), 60 * 60 * 24 * 120); return $apply_filters ? apply_filters('bon_idx_property_types', $propertyTypes) : $propertyTypes; }
public static function renderIdxOptions($post) { $url_value = null; $url_value = get_post_meta($post->ID, 'dsidxpress-assembled-url', true); $adminUri = get_admin_url(); $property_types_html = ""; wp_nonce_field(plugin_basename(__FILE__), 'ds-idx-page_nonce'); $property_types_html = ""; $property_types = dsSearchAgent_ApiRequest::FetchData('AccountSearchSetupPropertyTypes', array(), false, 60 * 60 * 24); if (!empty($property_types) && is_array($property_types)) { $property_types = json_decode($property_types["body"]); foreach ($property_types as $property_type) { $checked_html = ''; $name = htmlentities($property_type->DisplayName); $id = $property_type->SearchSetupPropertyTypeID; $property_types_html .= <<<HTML {$id}: {$name}, HTML; } } $property_types_html = substr($property_types_html, 0, strlen($property_types_html) - 1); echo ' <div class="postbox"> <div class="inside"> <input type="hidden" id="linkBuilderPropertyTypes" value="' . $property_types_html . '" />'; dsSearchAgent_Admin::LinkBuilderHtml(false, -1, 1, true, $url_value); echo ' </div> </div> <div><span class="description">You must Publish/Update your page after modifying the IDX data filters.</span></div> '; }
function widget($args, $instance) { extract($args); extract($instance); $title = apply_filters("widget_title", $title); $options = get_option(DSIDXPRESS_OPTION_NAME); if (!$options["Activated"]) { return; } $pluginUrl = plugins_url() . '/dsidxpress/'; wp_enqueue_script('dsidxpress_widget_search_view', $pluginUrl . 'js/widget-client.js', array('jquery'), DSIDXPRESS_PLUGIN_VERSION, true); $formAction = get_home_url() . "/idx/"; $defaultSearchPanels = dsSearchAgent_ApiRequest::FetchData("AccountSearchPanelsDefault", array(), false, 60 * 60 * 24); $defaultSearchPanels = $defaultSearchPanels["response"]["code"] == "200" ? json_decode($defaultSearchPanels["body"]) : null; $propertyTypes = dsSearchAgent_ApiRequest::FetchData("AccountSearchSetupFilteredPropertyTypes", array(), false, 60 * 60 * 24); $propertyTypes = $propertyTypes["response"]["code"] == "200" ? json_decode($propertyTypes["body"]) : null; $account_options = dsSearchAgent_ApiRequest::FetchData("AccountOptions", array(), false); $account_options = $account_options["response"]["code"] == "200" ? json_decode($account_options["body"]) : null; $num_location_dropdowns = 0; $autoload_options = bon_get_option('idx_enable_search_autoload', 'yes'); if ($searchOptions["show_cities"] == "yes" || !isset($instance["searchOptions"]["show_cities"])) { $num_location_dropdowns++; } if ($searchOptions["show_cities"] == "yes") { if ($autoload_options == 'no') { $manual_city = explode("\n", trim(bon_get_option('idx_manual_city'))); sort($manual_city); $searchOptions['cities'] = $manual_city; } else { $searchOptions['cities'] = shandora_get_idx_options('City', true); } } if ($searchOptions["show_communities"] == "yes") { $num_location_dropdowns++; if ($autoload_options == 'no') { $manual_community = explode("\n", trim(bon_get_option('idx_manual_community'))); sort($manual_community); $searchOptions['communities'] = $manual_community; } else { $searchOptions['communities'] = shandora_get_idx_options('Community', true); } } if ($searchOptions["show_tracts"] == "yes") { $num_location_dropdowns++; if ($autoload_options == 'no') { $manual_tract = explode("\n", trim(bon_get_option('idx_manual_tract'))); sort($manual_tract); $searchOptions['tracts'] = $manual_tract; } else { $searchOptions['tracts'] = shandora_get_idx_options('Tract', true); } } if ($searchOptions["show_zips"] == "yes") { $num_location_dropdowns++; if ($autoload_options == 'no') { $manual_zip = explode("\n", trim(bon_get_option('idx_manual_zip'))); sort($manual_zip); $searchOptions['zips'] = $manual_zip; } else { $searchOptions['zips'] = shandora_get_idx_options('Zip', true); } } if ($searchOptions["show_mlsnumber"] == "yes") { $num_location_dropdowns++; } echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <div class="dsidx-search-widget dsidx-widget search-listing"> <form action="<?php echo $formAction; ?> " method="get" class="custom" onsubmit="return dsidx_w.searchWidget.validate();" > <div class="fieldset"> <label for="idx-q-PropertyTypes"><?php _e('Property Type', 'bon'); ?> </label> <select name="idx-q-PropertyTypes" class="dsidx-search-widget-propertyTypes"> <option value=""><?php _e('All Property Types', 'bon'); ?> </option> <?php if (is_array($propertyTypes)) { foreach ($propertyTypes as $propertyType) { $name = htmlentities($propertyType->DisplayName); ?> <option value="<?php echo $propertyType->SearchSetupPropertyTypeID; ?> "><?php echo $name; ?> </option> <?php } } ?> </select> <label id="idx-search-invalid-msg" style="color:red"></label> </div> <?php if ($searchOptions["show_cities"] == "yes" || !isset($instance["searchOptions"]["show_cities"])) { ?> <div class="fieldset"> <label for="idx-q-Cities"><?php _e('City', 'bon'); ?> </label> <select id="idx-q-Cities" name="idx-q-Cities" class="idx-q-Location-Filter"> <?php if ($num_location_dropdowns > 1) { ?> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php } if (!empty($searchOptions['cities'])) { foreach ($searchOptions["cities"] as $city) { $city = htmlentities(trim($city)); ?> <option value="<?php echo $city; ?> "><?php echo $city; ?> </option> <?php } } ?> </select> </div> <?php } // end show_citites if ($searchOptions["show_communities"] == "yes") { ?> <div class="fieldset"> <label for="idx-q-Communities"><?php _e('Community', 'bon'); ?> </label> <select id="idx-q-Communities" name="idx-q-Communities" class="idx-q-Location-Filter"> <?php if ($num_location_dropdowns > 1) { ?> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php } foreach ($searchOptions["communities"] as $community) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $community = htmlentities(trim($community)); ?> <option value="<?php echo $community; ?> "><?php echo $community; ?> </option> <?php } ?> </select> </div> <?php } // end show_communtities ?> <?php if ($searchOptions["show_tracts"] == "yes") { ?> <div class="fieldset"> <label for="idx-q-TractIdentifiers"><?php _e('Tract', 'bon'); ?> </label> <select id="idx-q-TractIdentifiers" name="idx-q-TractIdentifiers" class="idx-q-Location-Filter"> <?php if ($num_location_dropdowns > 1) { ?> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php } foreach ($searchOptions["tracts"] as $tract) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $tract = htmlentities(trim($tract)); ?> <option value="<?php echo $tract; ?> "><?php echo $tract; ?> </option> <?php } ?> </select> </div> <?php } // end show_tracts ?> <?php if ($searchOptions["show_zips"] == "yes") { ?> <div class="fieldset"> <label for="idx-q-ZipCodes"><?php _e('Zip', 'bon'); ?> </label> <select id="idx-q-ZipCodes" name="idx-q-ZipCodes" class="idx-q-Location-Filter"> <?php if ($num_location_dropdowns > 1) { ?> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php } foreach ($searchOptions["zips"] as $zip) { // there's an extra trim here in case the data was corrupted before the trim was added in the update code below $zip = htmlentities(trim($zip)); ?> <option value="<?php echo $zip; ?> "><?php echo $zip; ?> </option> <?php } ?> </select> </div> <?php } // end show_zips ?> <?php if ($searchOptions["show_mlsnumber"] == "yes") { ?> <div class="fieldset"> <label for="idx-q-MlsNumbers"><?php _e('MLS #', 'bon'); ?> </label> <input id="idx-q-MlsNumbers" name="idx-q-MlsNumbers" type="text" class="dsidx-mlsnumber" /> </div> <?php } if ($searchOptions["show_pricerange"] == "yes") { ?> <div class="fieldset"> <label for="idx-q-PriceMin"><?php _e('Price Range', 'bon'); ?> <span class="price-text text-min" id="idx-min-price-text-widget"></span> <span class="price-text text-max" id="idx-max-price-text-widget"></span> </label> <div class="price-slider-wrapper ui-slider-wrapper-custom"> <div id="idx-slider-range-widget"></div> </div> <input id="idx-q-PriceMin-widget" name="idx-q-PriceMin" type="hidden" class="dsidx-price" placeholder="min price" /> <input id="idx-q-PriceMax-widget" name="idx-q-PriceMax" type="hidden" class="dsidx-price" placeholder="max price" /> </div> <?php } if ($searchOptions["show_size"] == "yes") { ?> <?php if (isset($defaultSearchPanels)) { foreach ($defaultSearchPanels as $key => $value) { if ($value->DomIdentifier == "search-input-home-size") { ?> <div class="fieldset"> <label for="idx-q-ImprovedSqFtMin"><?php _e('Size', 'bon'); ?> </label> <input id="idx-q-ImprovedSqFtMin" name="idx-q-ImprovedSqFtMin" type="text" class="dsidx-improvedsqft" placeholder="min sqft" /> </div> <?php break; } } } ?> <?php } if ($searchOptions["show_beds"] == "yes") { ?> <div class="fieldset"> <label for="idx-q-BedsMin-widget"><?php _e('Beds', 'bon'); ?> </label> <div class="ui-slider-wrapper-custom beds-wrapper"> <select name="idx-q-BedsMin" id="idx-q-BedsMin-widget" class="bon-dsidx-beds dsidx-beds no-custom select-slider"> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php for ($i = 1; $i <= 10; $i++) { ?> <option value="<?php echo $i; ?> "><?php echo $i; ?> </option> <?php } ?> </select> </div> </div> <?php } if ($searchOptions["show_bath"] == "yes") { ?> <div class="fieldset"> <label for="idx-q-BathsMin-widget"><?php _e('Baths', 'bon'); ?> </label> <div class="ui-slider-wrapper-custom baths-wrapper"> <select name="idx-q-BathsMin" id="idx-q-BathsMin-widget" class="bon-dsidx-baths dsidx-baths no-custom select-slider"> <option value=""><?php _e('Any', 'bon'); ?> </option> <?php for ($i = 1; $i <= 10; $i++) { ?> <option value="<?php echo $i; ?> "><?php echo $i; ?> </option> <?php } ?> </select> </div> </div> <?php } ?> <?php $button_color = bon_get_option('search_button_color', 'red'); ?> <input type="submit" class="button flat blue <?php echo $button_color; ?> radius submit" value="<?php _e('Search for Properties', 'bon'); ?> " /> <?php if ($options["HasSearchAgentPro"] == "yes" && $searchOptions["show_advanced"] == "yes") { ?> <?php _e('try our ', 'bon'); ?> <a href="<?php echo $formAction; ?> advanced/"><img src="<?php echo $pluginUrl; ?> assets/adv_search-16.png" /><?php _e('Advanced Search', 'bon'); ?> </a> <?php } ?> <?php if ($account_options->EulaLink) { $eula_url = $account_options->EulaLink; ?> <p><?php _e('By searching, you agree to the', 'bon'); ?> <a href="<?php echo $eula_url; ?> " target="_blank"><?php _e('EULA', 'bon'); ?> </a></p> <?php } ?> </form> </div> <?php echo $after_widget; dsidx_footer::ensure_disclaimer_exists("search"); }
function dsidxpress_FlushRewriteRules() { global $wp_rewrite; $accountOptionsResponse = dsSearchAgent_ApiRequest::FetchData("AccountOptions"); $remoteOptions = json_decode($accountOptionsResponse["body"]); $localOptions = get_option(DSIDXPRESS_OPTION_NAME); $localOptions["UseAlternateUrlStructure"] = strtolower($remoteOptions->UseAlternateUrlStructureInDsIdxPress) == "true"; update_option(DSIDXPRESS_OPTION_NAME, $localOptions); $wp_rewrite->flush_rules(); }
} global $wp_version, $tinymce_version; $localJsUri = get_option("siteurl") . "/" . WPINC . "/js/"; if (is_ssl()) { $localJsUri = preg_replace('/http/', 'https', $localJsUri); } $options = get_option(DSIDXPRESS_OPTION_NAME); $mls_rules = dsSearchAgent_ApiRequest::FetchData('MlsDisplayRules', array('SearchSetupID' => $options["SearchSetupID"])); if (isset($mls_rules['body'])) { $mls_rules = json_decode($mls_rules['body'], true); } $hideSold = isset($mls_rules['HideSoldPropertyFunctionality']); $propertyTypes = dsSearchAgent_ApiRequest::FetchData("AccountSearchSetupPropertyTypes", array(), false, 60 * 60 * 24); $propertyTypes = json_decode($propertyTypes["body"]); if (!defined('ZPRESS_API')) { $availableLinks = dsSearchAgent_ApiRequest::FetchData("AccountAvailableLinks", array(), false, 0); $availableLinks = json_decode($availableLinks["body"]); } ?> <!DOCTYPE html> <html> <head> <title>dsIDXpress: Insert Properties</title> <script src="<?php echo $localJsUri; ?> tinymce/tiny_mce_popup.js?ver=<?php echo urlencode($tinymce_version); ?> "></script>