function widget($args, $instance)
    {
        extract($args);
        extract($instance);
        $options = get_option(DSIDXWIDGETS_OPTION_NAME);
        $randString = dsWidgets_Service_Base::get_random_string('abcdefghijklmnopqrstuvwxyz1234567890', 5);
        $income = htmlspecialchars($instance["income"]);
        $downPayment = htmlspecialchars($instance["downPayment"]);
        $monthlyDebts = htmlspecialchars($instance["monthlyDebts"]);
        $state = htmlspecialchars($instance["state"]);
        $city = htmlspecialchars($instance["city"]);
        $zip = htmlspecialchars($instance["zip"]);
        $priceMin = htmlspecialchars($instance["priceMin"]);
        $propType = '';
        $imagesStub = dsWidgets_Service_Base::$widgets_images_stub;
        $apiStub = dsWidgets_Service_Base::$widgets_api_stub;
        $curURL = get_home_url();
        $idxpress_options = get_option(DSIDXPRESS_OPTION_NAME);
        if (!empty($idxpress_options["AccountID"])) {
            $aid = $idxpress_options["AccountID"];
        } else {
            $aid = $options["AccountID"];
        }
        if (!empty($idxpress_options["SearchSetupID"])) {
            $ssid = $idxpress_options["SearchSetupID"];
        } else {
            $ssid = $options["SearchSetupID"];
        }
        echo $before_widget;
        if (defined('ZPRESS_API') && ZPRESS_API != '') {
            $widget_header = call_user_func('\\zpress\\themes\\Options::GetOption', 'theme_widgets_require_header');
            if (!empty($widget_header->meta) && $widget_header->meta == 'true') {
                echo $before_title;
                echo 'Affordability';
                echo $after_title;
            }
        }
        echo <<<HTML
        <div>
            <script type="text/javascript" id="divLocal{$randString}_">
\t\t\t\twindow.affordabilityHasDependency = true;
                LaunchBase{$randString} = function(){
                    var affordabilityScript, _ds_midx;
                    CreateObject{$randString} = function () { _ds_midx = {currentURL: '{$curURL}',  curAPIStub: '{$apiStub}', curImageStub: '{$imagesStub}', targetDomain: window["zpress_widget_domain_token"], accountId: '{$aid}',searchSetupId: '{$ssid}',muteStyles: true,income: '{$income}',downPayment: '{$downPayment}',monthlyDebts: '{$monthlyDebts}',state: '{$state}',city: '{$city}',zip: '{$zip}',priceMin: '{$priceMin}',curDivID: 'divLocal{$randString}_',querySchema: '12dGTTViUjEzC1rrNlw6Lq6A6wZQlgBarlIcucpGTkQrUP3gCimYF6deRFaavu2IbPpaOkZ9I4K42QaAhLVEcA==',productType: '0' }; }
                    AddJavaScriptToDOM{$randString}=function(c,d,e){if(1!=d){var a=document.createElement("script"),b=document.getElementsByTagName("script")[0];a.async=!0;a.src=c;a.onload=function(){ window[e] = 1;};b.parentNode.insertBefore(a,b)}return 1};
                    CreateWidget{$randString} = function () {
                     (window.affordabilityFinished == 1) ? (window["ds.widget.view.affordability"].isProcessing = true, CreateObject{$randString}(), new window["ds.widget.view.affordability"](_ds_midx), window["ds.widget.view.affordability"].isProcessing = false, window.affordabilityHasDependency = false) : window.setTimeout("CreateWidget{$randString}(false)", 20); 
                    }
                    if (affordabilityScript != 1) { affordabilityScript = AddJavaScriptToDOM{$randString}("{$this->widgetsCdn}/Scripts/PostCompile/Affordability_v1_1.js", affordabilityScript, 'affordabilityFinished') }; 
                      CreateWidget{$randString}();
                }
                GetToken{$randString}=function(){if(!window.zpress_widget_domain_token&&1!=window.zpress_widget_domain_token_progress){window.zpress_widget_domain_token_progress=1;var c=-1<navigator.userAgent.indexOf("MSIE 7.0")?!0:!1,d=-1<navigator.userAgent.indexOf("MSIE 8.0")||-1<navigator.userAgent.indexOf("MSIE 9.0")?!0:!1;if(c)rr=document.createElement("script"),rr.async=!0,rr.id="domainScript",rr.type="text/javascript",rr.src="{$apiStub}Encrypt/?targetString="+window.location.hostname+"&targetObject=domain&authType=Basic&curDomain="+
                window.location.hostname+"&objectName_=error",rr.onload=rr.onreadystatechange=function(){"undefined"!=typeof window.error?alert("We had a problem authenticating this domain"):(window.zpress_widget_domain_token=window.encrypted_domain,LaunchBase{$randString}())},document.getElementsByTagName("head")[0].appendChild(rr);else if(c="{$apiStub}Encrypt/?targetString="+window.location.hostname+"&targetObject=domain&authType=CORS&objectName_=error",d){var a=new XDomainRequest;a.onload=function(){window.zpress_widget_domain_token=
                eval(a.responseText);LaunchBase{$randString}()};a.onerror=function(){};a.onprogress=function(){};a.open("GET",c,!0);a.send(null)}else{var b;if(b=new XMLHttpRequest)b.onreadystatechange=function(){if(4==b.readyState)if(200==b.status){var a=eval(b.responseText);"undefined"!=typeof a.listingsError?alert(a.listingsError[0].Message):(window.zpress_widget_domain_token=a,LaunchBase{$randString}())}},b.open("GET",c,!0),b.send()}}else window.zpress_widget_domain_token?LaunchBase{$randString}():
                window.setTimeout("GetToken{$randString}()",20)};GetToken{$randString}();
            </script>
        </div>
HTML;
        echo $after_widget;
    }
    function widget($args, $instance)
    {
        extract($args);
        extract($instance);
        $error_message = dsWidgets_Service_Base::getWidgetErrorMsg($before_widget . $before_title . $title . $after_title, $after_widget);
        if ($error_message) {
            echo $error_message;
            return;
        }
        $options = get_option(DSIDXWIDGETS_OPTION_NAME);
        $randString = dsWidgets_Service_Base::get_random_string('abcdefghijklmnopqrstuvwxyz1234567890', 5);
        $title = htmlspecialchars($instance["title"]);
        $rowCount = htmlspecialchars($instance["rowCount"]);
        $community = htmlspecialchars($instance["community"]);
        $state = htmlspecialchars($instance["state"]);
        $city = htmlspecialchars($instance["city"]);
        $zip = htmlspecialchars($instance["zip"]);
        $linkTitle = htmlspecialchars($instance["linkTitle"]);
        $statusType = htmlspecialchars($instance["statusType"]);
        $imagesStub = dsWidgets_Service_Base::$widgets_images_stub;
        $apiStub = dsWidgets_Service_Base::$widgets_api_stub;
        $width = htmlspecialchars($instance["width"]);
        $curURL = get_home_url();
        $idxpress_options = get_option(DSIDXPRESS_OPTION_NAME);
        if (!empty($idxpress_options["AccountID"])) {
            $aid = $idxpress_options["AccountID"];
        } else {
            $aid = $options["AccountID"];
        }
        if (!empty($idxpress_options["SearchSetupID"])) {
            $ssid = $idxpress_options["SearchSetupID"];
        } else {
            $ssid = $options["SearchSetupID"];
        }
        echo $before_widget;
        echo $before_title . $title . $after_title;
        echo <<<HTML
        <script type="text/javascript" id="divLocal{$randString}_">
\t\t\t\twindow.recentStatusHasDependency = true;
                LaunchBase{$randString} = function(){
                var recentStatusScript, _ds_midx;
                CreateObject{$randString} = function () { _ds_midx = { currentURL: '{$curURL}', curWidth: '{$width}', showHeader: false, productType: '0', curAPIStub: '{$apiStub}', curImageStub: '{$imagesStub}', targetDomain: window["zpress_widget_domain_token"], accountId: '{$aid}',searchSetupId: '{$ssid}',muteStyles: true,curTitle: '{$title}',rowCount: '{$rowCount}',community: '{$community}',state: '{$state}',city: '{$city}',zip: '{$zip}',linkTitle: '{$linkTitle}',curDivID: 'divLocal{$randString}_',querySchema: 'MmZDz28oMETkfu/J7uVDj5me5CwqyWZUYbd0g3HEW8Ar73U98rI41MBxO894vgPN',status: '{$statusType}' }; }
                AddJavaScriptToDOM{$randString}=function(c,d,e){if(1!=d){var a=document.createElement("script"),b=document.getElementsByTagName("script")[0];a.async=!0;a.src=c;a.onload=function(){ window[e] = 1;};b.parentNode.insertBefore(a,b)}return 1};
                CreateWidget{$randString} = function () {
                 (window.recentStatusFinished == 1) ? (window["ds.widget.view.recentstatus"].isProcessing = true, CreateObject{$randString}(), new window["ds.widget.view.recentstatus"](_ds_midx), window["ds.widget.view.recentstatus"].isProcessing = false, window.recentStatusHasDependency = false) : window.setTimeout("CreateWidget{$randString}(false)", 20); 
                }
                if (recentStatusScript != 1) { recentStatusScript = AddJavaScriptToDOM{$randString}("{$this->widgetsCdn}/Scripts/PostCompile/RecentStatus_v1_1.js", recentStatusScript, 'recentStatusFinished') }; 
                  CreateWidget{$randString}();
            }
            GetToken{$randString}=function(){if(!window.zpress_widget_domain_token&&1!=window.zpress_widget_domain_token_progress){window.zpress_widget_domain_token_progress=1;var c=-1<navigator.userAgent.indexOf("MSIE 7.0")?!0:!1,d=-1<navigator.userAgent.indexOf("MSIE 8.0")||-1<navigator.userAgent.indexOf("MSIE 9.0")?!0:!1;if(c)rr=document.createElement("script"),rr.async=!0,rr.id="domainScript",rr.type="text/javascript",rr.src="{$apiStub}Encrypt/?targetString="+window.location.hostname+"&targetObject=domain&authType=Basic&curDomain="+
            window.location.hostname+"&objectName_=error",rr.onload=rr.onreadystatechange=function(){"undefined"!=typeof window.error?alert("We had a problem authenticating this domain"):(window.zpress_widget_domain_token=window.encrypted_domain,LaunchBase{$randString}())},document.getElementsByTagName("head")[0].appendChild(rr);else if(c="{$apiStub}Encrypt/?targetString="+window.location.hostname+"&targetObject=domain&authType=CORS&objectName_=error",d){var a=new XDomainRequest;a.onload=function(){window.zpress_widget_domain_token=
            eval(a.responseText);LaunchBase{$randString}()};a.onerror=function(){};a.onprogress=function(){};a.open("GET",c,!0);a.send(null)}else{var b;if(b=new XMLHttpRequest)b.onreadystatechange=function(){if(4==b.readyState)if(200==b.status){var a=eval(b.responseText);"undefined"!=typeof a.listingsError?alert(a.listingsError[0].Message):(window.zpress_widget_domain_token=a,LaunchBase{$randString}())}},b.open("GET",c,!0),b.send()}}else window.zpress_widget_domain_token?LaunchBase{$randString}():
            window.setTimeout("GetToken{$randString}()",20)};GetToken{$randString}();
        </script>
HTML;
        echo $after_widget;
    }
    function widget($args, $instance)
    {
        extract($args);
        extract($instance);
        $options = get_option(DSIDXWIDGETS_OPTION_NAME);
        $randString = dsWidgets_Service_Base::get_random_string('abcdefghijklmnopqrstuvwxyz1234567890', 5);
        $widgetType = htmlspecialchars($instance["widgetType"]);
        $imagesStub = dsWidgets_Service_Base::$widgets_images_stub;
        $apiStub = dsWidgets_Service_Base::$widgets_api_stub;
        $curURL = get_home_url();
        $idxpress_options = get_option(DSIDXPRESS_OPTION_NAME);
        if (!empty($idxpress_options["AccountID"])) {
            $aid = $idxpress_options["AccountID"];
        } else {
            $aid = $options["AccountID"];
        }
        if (!empty($idxpress_options["SearchSetupID"])) {
            $ssid = $idxpress_options["SearchSetupID"];
        } else {
            $ssid = $options["SearchSetupID"];
        }
        echo $before_widget;
        if (defined('ZPRESS_API') && ZPRESS_API != '') {
            $widget_header = call_user_func('\\zpress\\themes\\Options::GetOption', 'theme_widgets_require_header');
            if (!empty($widget_header->meta) && $widget_header->meta == 'true') {
                echo $before_title;
                echo 'Quick Search';
                echo $after_title;
            }
        }
        echo <<<HTML
        <script type="text/javascript" id="divLocal{$randString}_">
            LaunchBase{$randString} = function(){
\t\t\t\twindow.quickSearchHasDependency = true;
                var quickSearchScript, _ds_midx;
                CreateObject{$randString} = function () { _ds_midx = { currentURL: '{$curURL}', widgetType: '{$widgetType}', curAPIStub: '{$apiStub}', curImageStub: '{$imagesStub}', targetDomain: window["zpress_widget_domain_token"], accountId: '{$aid}',searchSetupId: '{$ssid}',muteStyles: true,location: 0,fields: '0123',city: '', community: '', curDivID: 'divLocal{$randString}_',product: '0' }; }
                AddJavaScriptToDOM{$randString}=function(c,d,e){if(1!=d){var a=document.createElement("script"),b=document.getElementsByTagName("script")[0];a.async=!0;a.src=c;a.onload=function(){ window[e] = 1;};b.parentNode.insertBefore(a,b)}return 1};
                CreateWidget{$randString} = function () {
                 (window.quickSearchFinished == 1) ? (window["ds.widget.view.quicksearch"].isProcessing = true, CreateObject{$randString}(), new window["ds.widget.view.quicksearch"](_ds_midx), window["ds.widget.view.quicksearch"].isProcessing = false, window.quickSearchHasDependency = false) : window.setTimeout("CreateWidget{$randString}(false)", 20); 
                }
                if (quickSearchScript != 1) { quickSearchScript = AddJavaScriptToDOM{$randString}("{$this->widgetsCdn}/Scripts/PostCompile/QuickSearch_v1_1.js", quickSearchScript, 'quickSearchFinished') }; 
                  CreateWidget{$randString}();
            }
            GetToken{$randString}=function(){if(!window.zpress_widget_domain_token&&1!=window.zpress_widget_domain_token_progress){window.zpress_widget_domain_token_progress=1;var c=-1<navigator.userAgent.indexOf("MSIE 7.0")?!0:!1,d=-1<navigator.userAgent.indexOf("MSIE 8.0")||-1<navigator.userAgent.indexOf("MSIE 9.0")?!0:!1;if(c)rr=document.createElement("script"),rr.async=!0,rr.id="domainScript",rr.type="text/javascript",rr.src="{$apiStub}Encrypt/?targetString="+window.location.hostname+"&targetObject=domain&authType=Basic&curDomain="+
            window.location.hostname+"&objectName_=error",rr.onload=rr.onreadystatechange=function(){"undefined"!=typeof window.error?alert("We had a problem authenticating this domain"):(window.zpress_widget_domain_token=window.encrypted_domain,LaunchBase{$randString}())},document.getElementsByTagName("head")[0].appendChild(rr);else if(c="{$apiStub}Encrypt/?targetString="+window.location.hostname+"&targetObject=domain&authType=CORS&objectName_=error",d){var a=new XDomainRequest;a.onload=function(){window.zpress_widget_domain_token=
            eval(a.responseText);LaunchBase{$randString}()};a.onerror=function(){};a.onprogress=function(){};a.open("GET",c,!0);a.send(null)}else{var b;if(b=new XMLHttpRequest)b.onreadystatechange=function(){if(4==b.readyState)if(200==b.status){var a=eval(b.responseText);"undefined"!=typeof a.listingsError?alert(a.listingsError[0].Message):(window.zpress_widget_domain_token=a,LaunchBase{$randString}())}},b.open("GET",c,!0),b.send()}}else window.zpress_widget_domain_token?LaunchBase{$randString}():
            window.setTimeout("GetToken{$randString}()",20)};GetToken{$randString}();
        </script>
HTML;
        echo $after_widget;
        dsidx_footer::ensure_disclaimer_exists("search");
    }
    function form($instance)
    {
        wp_enqueue_script('dsidxwidgets_widget_service_admin', DSIDXWIDGETS_PLUGIN_URL . 'js/widget-service-admin.js', array('jquery'), false, true);
        $personal_info = stripslashes_deep(get_option('personal_info'));
        $city = empty($personal_info['city']) ? 'Irvine' : $personal_info['city'];
        $state = empty($personal_info['state']) ? 'CA' : $personal_info['state'];
        $instance = wp_parse_args($instance, array("title" => "Area Statistics", "tract" => "", "community" => "", "state" => $state, "city" => $city, "zip" => "", "propType" => "", "periodType" => "1", "statusType" => "1", "eDomain" => ""));
        $title = htmlspecialchars($instance["title"]);
        $titleFieldId = $this->get_field_id("title");
        $titleFieldName = $this->get_field_name("title");
        $tract = htmlspecialchars($instance["tract"]);
        $tractFieldId = $this->get_field_id("tract");
        $tractFieldName = $this->get_field_name("tract");
        $community = htmlspecialchars($instance["community"]);
        $communityFieldId = $this->get_field_id("community");
        $communityFieldName = $this->get_field_name("community");
        $state = htmlspecialchars($instance["state"]);
        $stateFieldId = $this->get_field_id("state");
        $stateFieldName = $this->get_field_name("state");
        $city = htmlspecialchars($instance["city"]);
        $cityFieldId = $this->get_field_id("city");
        $cityFieldName = $this->get_field_name("city");
        $zip = htmlspecialchars($instance["zip"]);
        $zipFieldId = $this->get_field_id("zip");
        $zipFieldName = $this->get_field_name("zip");
        $propType = htmlspecialchars($instance["propType"]);
        $propTypeFieldId = $this->get_field_id("propType");
        $propTypeFieldName = $this->get_field_name("propType");
        $period = $instance["periodType"];
        $periodFieldId = $this->get_field_id("periodType");
        $periodFieldName = $this->get_field_name("periodType");
        $status = $instance["statusType"];
        $statusFieldId = $this->get_field_id("statusType");
        $statusFieldName = $this->get_field_name("statusType");
        $eDomain = htmlspecialchars($instance["eDomain"]);
        $eDomainFieldId = $this->get_field_id("eDomain");
        $eDomainFieldName = $this->get_field_name("eDomain");
        $baseFieldId = $this->get_field_id("areastatsOptions");
        $baseFieldName = $this->get_field_name("areastatsOptions");
        $apiStub = dsWidgets_Service_Base::$widgets_admin_api_stub;
        $property_types = dsWidgetAgent_ApiRequest::FetchData('AccountPropertyTypes', array(), false, 60 * 60 * 24);
        $checked_html = $propType == '' ? 'selected' : '';
        $property_types_html = '<option value="-1" {$checked_html} >Select Property Type</option>';
        $randString = dsWidgets_Service_Base::get_random_string('abcdefghijklmnopqrstuvwxyz1234567890', 5);
        $options = get_option(DSIDXWIDGETS_OPTION_NAME);
        $idxpress_options = get_option(DSIDXPRESS_OPTION_NAME);
        if (!empty($idxpress_options["AccountID"])) {
            $aid = $idxpress_options["AccountID"];
        } else {
            $aid = $options["AccountID"];
        }
        if (!empty($idxpress_options["SearchSetupID"])) {
            $ssid = $idxpress_options["SearchSetupID"];
        } else {
            $ssid = $options["SearchSetupID"];
        }
        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->PropertyTypeID;
                if ($id == $propType) {
                    $checked_html = 'selected';
                }
                $property_types_html .= <<<HTML
                <option value="{$id}" {$checked_html} >{$name}</option>
HTML;
            }
        }
        echo <<<HTML
\t\t\t<input type='hidden' id='ds_widgets_area_stats_domain' value='{$eDomain}' name="ds_widgets_area_stats_domain" />
        \t<p>
\t\t\t\t<label for="{$titleFieldId}">Title</label>
\t\t\t\t<input id="{$titleFieldId}" name="{$titleFieldName}" value="{$title}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$tractFieldId}">Tract</label>
\t\t\t\t<input id="{$tractFieldId}" name="{$tractFieldName}" value="{$tract}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$communityFieldId}">Community</label>
\t\t\t\t<input id="{$communityFieldId}" name="{$communityFieldName}" value="{$community}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$cityFieldId}">City</label>
\t\t\t\t<input id="{$cityFieldId}" name="{$cityFieldName}" value="{$city}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$stateFieldId}">State</label>
\t\t\t\t<input id="{$stateFieldId}" name="{$stateFieldName}" value="{$state}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$zipFieldId}">Zip Code</label>
\t\t\t\t<input id="{$zipFieldId}" name="{$zipFieldName}" value="{$zip}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$propTypeFieldId}">Property Type</label>
\t\t\t\t<select id="{$propTypeFieldId}" name="{$propTypeFieldName}"  class="widefat" type="text" onchange="jQuery(zWidgets_Area_Listener(this))">
                    {$property_types_html}
                </select>
\t\t\t</p>
            <p>
                <label for="{$periodFieldId}">Period</label>
\t\t\t\t<select class="widefat" id="{$periodFieldId}" name="{$periodFieldName}" onchange="jQuery(zWidgets_Area_Listener(this))">
\t\t\t\t\t<option 
HTML;
        if ($period == '1') {
            echo 'selected';
        }
        echo <<<HTML
                    value="1">Weekly</option>
                    <option 
HTML;
        if ($period == '2') {
            echo 'selected';
        }
        echo <<<HTML
                    value="2" >Monthly</option>
\t\t\t\t</select>
\t\t\t</p>
            <p>
                <label for="{$statusFieldId}">Status</label>
\t\t\t\t<select class="widefat" id="{$statusFieldId}" name="{$statusFieldName}" onchange="jQuery(zWidgets_Area_Listener(this))">
\t\t\t\t\t<option 
HTML;
        if ($status == '1') {
            echo 'selected';
        }
        echo <<<HTML
                    value="1">Active</option>
                    <option 
HTML;
        if ($status == '2') {
            echo 'selected';
        }
        echo <<<HTML
                    value="2" >Pending</option>
                    <option 
HTML;
        if ($status == '3') {
            echo 'selected';
        }
        echo <<<HTML
                    value="3" >Expired</option>
                    <option 
HTML;
        if ($status == '4') {
            echo 'selected';
        }
        echo <<<HTML
                    value="4" >Sold</option>
\t\t\t\t</select>
\t\t\t</p>
            <script>
                jQuery(function(){
                    var a = document.getElementById('ds_widgets_area_stats_domain');
                    if(a.value == ''){
                        zWidgetsAdmin.fetchEncryptedValue(window.location.hostname, 'domain', a, '{$apiStub}');
                    }
                })
                zWidgets_Area_Listener = function (event){
                    zWidgetsAdmin.checkForAreaData_(event, '{$randString}', document.getElementById('ds_widgets_area_stats_domain').value, '{$apiStub}', {$aid}, {$ssid} )
                };
            </script>
HTML;
    }
    function form($instance)
    {
        $personal_info = stripslashes_deep(get_option('personal_info'));
        $city = empty($personal_info['city']) ? 'Irvine' : $personal_info['city'];
        $state = empty($personal_info['state']) ? 'CA' : $personal_info['state'];
        $instance = wp_parse_args($instance, array("state" => $state, "city" => $city, "zip" => "", "priceMin" => "250000", "priceMax" => "550000", "priceFloor" => "100000", "priceCeiling" => "1000000", "bedsMin" => "2", "bathsMin" => "2", "sqftMin" => "1500", "statusType" => "1", "rowCountType" => "25", "sortType" => "0", "eDomain" => "", "height" => "494", "width" => "548"));
        $state = htmlspecialchars($instance["state"]);
        $stateFieldId = $this->get_field_id("state");
        $stateFieldName = $this->get_field_name("state");
        $city = htmlspecialchars($instance["city"]);
        $cityFieldId = $this->get_field_id("city");
        $cityFieldName = $this->get_field_name("city");
        $zip = htmlspecialchars($instance["zip"]);
        $zipFieldId = $this->get_field_id("zip");
        $zipFieldName = $this->get_field_name("zip");
        $priceMin = htmlspecialchars($instance["priceMin"]);
        $priceMinFieldId = $this->get_field_id("priceMin");
        $priceMinFieldName = $this->get_field_name("priceMin");
        $priceMax = htmlspecialchars($instance["priceMax"]);
        $priceMaxFieldId = $this->get_field_id("priceMax");
        $priceMaxFieldName = $this->get_field_name("priceMax");
        $priceFloor = htmlspecialchars($instance["priceFloor"]);
        $priceFloorFieldId = $this->get_field_id("priceFloor");
        $priceFloorFieldName = $this->get_field_name("priceFloor");
        $priceCeiling = htmlspecialchars($instance["priceCeiling"]);
        $priceCeilingFieldId = $this->get_field_id("priceCeiling");
        $priceCeilingFieldName = $this->get_field_name("priceCeiling");
        $bedsMin = htmlspecialchars($instance["bedsMin"]);
        $bedsMinFieldId = $this->get_field_id("bedsMin");
        $bedsMinFieldName = $this->get_field_name("bedsMin");
        $bathsMin = htmlspecialchars($instance["bathsMin"]);
        $bathsMinFieldId = $this->get_field_id("bathsMin");
        $bathsMinFieldName = $this->get_field_name("bathsMin");
        $sqftMin = htmlspecialchars($instance["sqftMin"]);
        $sqftMinFieldId = $this->get_field_id("sqftMin");
        $sqftMinFieldName = $this->get_field_name("sqftMin");
        $status = $instance["statusType"];
        $statusFieldId = $this->get_field_id("statusType");
        $statusFieldName = $this->get_field_name("statusType");
        $rowCount = $instance["rowCountType"];
        $rowCountFieldId = $this->get_field_id("rowCountType");
        $rowCountFieldName = $this->get_field_name("rowCountType");
        $sort = $instance["sortType"];
        $sortFieldId = $this->get_field_id("sortType");
        $sortFieldName = $this->get_field_name("sortType");
        $baseFieldId = $this->get_field_id("mapsearchOptions");
        $baseFieldName = $this->get_field_name("mapsearchOptions");
        $height = htmlspecialchars($instance["height"]);
        $heightFieldId = $this->get_field_id("height");
        $heightFieldName = $this->get_field_name("height");
        $width = htmlspecialchars($instance["width"]);
        $widthFieldId = $this->get_field_id("width");
        $widthFieldName = $this->get_field_name("width");
        $apiStub = dsWidgets_Service_Base::$widgets_admin_api_stub;
        $capabilities = dsWidgets_Service_Base::getCapabilities();
        echo <<<HTML
            <p>
\t\t\t\t<label for="{$heightFieldId}">Height</label>
\t\t\t\t<input id="{$heightFieldId}" name="{$heightFieldName}" value="{$height}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$widthFieldId}">Width</label>
\t\t\t\t<input id="{$widthFieldId}" name="{$widthFieldName}" value="{$width}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$cityFieldId}">City (Press enter after each city)</label>
\t\t\t\t<textarea id="{$cityFieldId}" name="{$cityFieldName}" rows="4" class="widefat" type="text" >{$city}</textarea>
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$stateFieldId}">State</label>
\t\t\t\t<input id="{$stateFieldId}" name="{$stateFieldName}" value="{$state}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$zipFieldId}">Zip Code</label>
\t\t\t\t<input id="{$zipFieldId}" name="{$zipFieldName}" value="{$zip}" class="widefat" type="text" />
\t\t\t</p>
HTML;
        if (!empty($capabilities->MinPrice)) {
            echo <<<HTML
            <p>
                <label for="{$priceMinFieldId}">Search Min. Price</label>
                <input id="{$priceMinFieldId}" name="{$priceMinFieldName}" value="{$priceMin}" class="widefat" type="text" />
            </p>
HTML;
        }
        if (!empty($capabilities->MaxPrice)) {
            echo <<<HTML
            <p>
                <label for="{$priceMaxFieldId}">Search Max. Price</label>
                <input id="{$priceMaxFieldId}" name="{$priceMaxFieldName}" value="{$priceMax}" class="widefat" type="text" />
            </p>
HTML;
        }
        echo <<<HTML
            <p>
\t\t\t\t<label for="{$priceFloorFieldId}">Min. Searchable Price</label>
\t\t\t\t<input id="{$priceFloorFieldId}" name="{$priceFloorFieldName}" value="{$priceFloor}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$priceCeilingFieldId}">Max. Searchable Price</label>
\t\t\t\t<input id="{$priceCeilingFieldId}" name="{$priceCeilingFieldName}" value="{$priceCeiling}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$bedsMinFieldId}">Min. Beds</label>
\t\t\t\t<input id="{$bedsMinFieldId}" name="{$bedsMinFieldName}" value="{$bedsMin}" class="widefat" type="text" />
\t\t\t</p>
            <p>
\t\t\t\t<label for="{$bathsMinFieldId}">Min. Baths</label>
\t\t\t\t<input id="{$bathsMinFieldId}" name="{$bathsMinFieldName}" value="{$bathsMin}" class="widefat" type="text" />
\t\t\t</p>
HTML;
        if (!empty($capabilities->MinImprovedSqFt)) {
            echo <<<HTML
            <p>
                <label for="{$sqftMinFieldId}">Min. Square Feet</label>
                <input id="{$sqftMinFieldId}" name="{$sqftMinFieldName}" value="{$sqftMin}" class="widefat" type="text" />
            </p>
HTML;
        }
        echo <<<HTML
            <p>
                <label for="{$statusFieldId}">Status</label>
\t\t\t\t<select class="widefat" id="{$statusFieldId}" name="{$statusFieldName}">
\t\t\t\t\t<option 
HTML;
        if ($status == '1') {
            echo 'selected';
        }
        echo <<<HTML
                    value="1">Active</option>
                    <option 
HTML;
        if ($status == '2') {
            echo 'selected';
        }
        echo <<<HTML
                    value="2" >Pending</option>
                    <option 
HTML;
        if ($status == '3') {
            echo 'selected';
        }
        echo <<<HTML
                    value="3" >Expired</option>
                    <option 
HTML;
        if ($status == '4') {
            echo 'selected';
        }
        echo <<<HTML
                    value="4" >Sold</option>
\t\t\t\t</select>
\t\t\t</p>
            <p>
                <label for="{$rowCountFieldId}">Max. # of Listings</label>
\t\t\t\t<select class="widefat" id="{$rowCountFieldId}" name="{$rowCountFieldName}">
\t\t\t\t\t<option 
HTML;
        if ($rowCount == '10') {
            echo 'selected';
        }
        echo <<<HTML
                    value="10">10</option>
                    <option 
HTML;
        if ($rowCount == '25') {
            echo 'selected';
        }
        echo <<<HTML
                    value="25" >25</option>
                    <option 
HTML;
        if ($rowCount == '50') {
            echo 'selected';
        }
        echo <<<HTML
                    value="50" >50</option>
                    <option 
HTML;
        if ($rowCount == '100') {
            echo 'selected';
        }
        echo <<<HTML
                    value="100" >100</option>
\t\t\t\t</select>
\t\t\t</p>
            <p>
                <label for="{$sortFieldId}">Sort</label>
\t\t\t\t<select class="widefat" id="{$sortFieldId}" name="{$sortFieldName}">
\t\t\t\t\t<option 
HTML;
        if ($sort == '0') {
            echo 'selected';
        }
        echo <<<HTML
                    value="0">Price \$ to \$\$\$</option>
                    <option 
HTML;
        if ($sort == '1') {
            echo 'selected';
        }
        echo <<<HTML
                    value="1" >Price \$\$\$ to \$</option>
\t\t\t\t</select>
\t\t\t</p>
HTML;
    }
Example #6
0
require_once $require_prefix . "widget-service-affordability.php";
require_once $require_prefix . "widget-service-areastats.php";
require_once $require_prefix . "widget-service-recentstatus.php";
require_once $require_prefix . "widget-service-openhouse.php";
require_once $require_prefix . "widget-service-slideshow.php";
require_once $require_prefix . "widget-service-mapsearch.php";
//require_once($require_prefix . "widget-service-quicksearch.php");
require_once $require_prefix . "widget-service-base.php";
dsWidgets_Service_Base::$widgets_admin_api_stub = admin_url() . '?zpress_widget_ajax=true';
if (defined('DS_API')) {
    // this allows us to maintain plugin independence just in case we use this outside of zpress
    dsWidgets_Service_Base::$widgets_api_stub = DS_API;
}
if (defined('WIDGETS_CDN')) {
    // this allows us to maintain plugin independence just in case we use this outside of zpress
    dsWidgets_Service_Base::$widgets_cdn = WIDGETS_CDN;
}
if (is_admin()) {
    // this is needed specifically for development as PHP seems to choke when 1) loading this in admin, 2) using windows, 3) using directory junctions
    include_once dirname(__FILE__) . "/admin.php";
}
if (defined('DSIDXPRESS_PLUGIN_VERSION')) {
    add_action("widgets_init", "dsidxwidgets_InitWidgets");
}
function dsidxwidgets_InitWidgets()
{
    $options = get_option(DSIDXPRESS_OPTION_NAME);
    if (defined('ZPRESS_API') || isset($options["dsIDXPressPackage"]) && $options["dsIDXPressPackage"] == "pro") {
        //register_widget("dsIDXWidgets_QRCode");
        register_widget("dsIDXWidgets_Affordability");
        register_widget("dsIDXWidgets_AreaStats");