示例#1
0
 static function GetSitemapOptions()
 {
     $options = get_option(DSIDXPRESS_OPTION_NAME);
     $urlBase = get_home_url();
     if (substr($urlBase, strlen($urlBase), 1) != "/") {
         $urlBase .= "/";
     }
     $urlBase .= dsSearchAgent_Rewrite::GetUrlSlug();
     $sitemapUrls = array();
     $idxPages = get_pages(array('post_type' => 'ds-idx-listings-page', 'post_status' => 'publish'));
     foreach ($idxPages as $page) {
         $sitemapUrls[] = array('location' => get_permalink($page->ID), 'frequency' => 'daily', 'priority' => 0.5);
     }
     if (isset($options["SitemapLocations"]) && is_array($options["SitemapLocations"])) {
         $location_index = 0;
         usort($options["SitemapLocations"], array("dsSearchAgent_XmlSitemaps", "CompareListObjects"));
         foreach ($options["SitemapLocations"] as $key => $value) {
             $area = $value["value"];
             $type = $value["type"];
             if (preg_match('/^[\\w\\d\\s\\-_]+$/', $area)) {
                 $location_sanitized = urlencode(strtolower(str_replace(array("-", " "), array("_", "-"), $value["value"])));
                 $url = $urlBase . $value["type"] . '/' . $location_sanitized . '/';
             } else {
                 if ($type == "city") {
                     $url = $urlBase . "?idx-q-Cities=" . urlencode($area);
                 } else {
                     if ($type == "community") {
                         $url = $urlBase . "?idx-q-Communities=" . urlencode($area);
                     } else {
                         if ($type == "tract") {
                             $url = $urlBase . "?idx-q-TractIdentifiers=" . urlencode($area);
                         }
                     }
                 }
             }
             // zips will always match the regex
             $sitemapUrls[] = array('location' => $url, 'frequency' => $options['SitemapFrequency'], 'priority' => floatval($value["priority"]));
         }
     }
     return empty($sitemapUrls) ? false : $sitemapUrls;
 }
示例#2
0
文件: admin.php 项目: kabrewer07/mrw
    static function DetailsOptions()
    {
        $options = get_option(DSIDXPRESS_OPTION_NAME);
        $apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("AccountOptions", array(), false, 0);
        if (!empty($apiHttpResponse["errors"]) || $apiHttpResponse["response"]["code"] != "200") {
            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"]);
        }
        $urlBase = get_home_url();
        if (substr($urlBase, strlen($urlBase), 1) != "/") {
            $urlBase .= "/";
        }
        $urlBase .= dsSearchAgent_Rewrite::GetUrlSlug();
        ?>
		<div class="wrap metabox-holder">
			<h1>More Options</h1>
			<?php 
        if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') {
            ?>
			<div class="updated"><p><strong><?php 
            _e('Options saved');
            ?>
</strong></p></div>
			<?php 
        }
        ?>
			<form method="post" action="options.php">
				<?php 
        settings_fields("dsidxpress_api_options");
        ?>
				<span class="description">These settings apply to any page holding details for a specific property.</span>
				<table class="form-table">
					<?php 
        if (isset($account_options->{'dsIDXPress-Package'}) && $account_options->{'dsIDXPress-Package'} == "pro") {
            ?>
					<tr>
						<th>
							<label for="dsidxpress-ShowPanel_ZillowCB">Show Zestimate:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-ShowPanel_ZillowCB" size="50" <?php 
            checked('true', strtolower($account_options->ShowPanel_Zillow));
            ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-ShowPanel_Zillow" name="<?php 
            echo DSIDXPRESS_API_OPTIONS_NAME;
            ?>
[ShowPanel_Zillow]" value="<?php 
            echo $account_options->ShowPanel_Zillow;
            ?>
" />
							<span class="description"></span>
						</td>
					</tr>
					<?php 
        }
        ?>
					<tr>
						<th>
							<label for="dsidxpress-ShowWalkScoreInDetailsCB">Show Walkscore In Details:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-ShowWalkScoreInDetailsCB" size="50" <?php 
        checked('true', strtolower($account_options->ShowWalkScoreInDetails));
        ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-ShowWalkScoreInDetails" name="<?php 
        echo DSIDXPRESS_API_OPTIONS_NAME;
        ?>
[ShowWalkScoreInDetails]" value="<?php 
        echo $account_options->ShowWalkScoreInDetails;
        ?>
" />
							<span class="description"></span>
						</td>
					</tr>
					<tr>
						<th>
							<label for="dsidxpress-ShowWalkScoreInResultsCB">Show Walkscore In Results:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-ShowWalkScoreInResultsCB" size="50" <?php 
        checked('true', strtolower($account_options->ShowWalkScoreInResults));
        ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-ShowWalkScoreInResults" name="<?php 
        echo DSIDXPRESS_API_OPTIONS_NAME;
        ?>
[ShowWalkScoreInResults]" value="<?php 
        echo $account_options->ShowWalkScoreInResults;
        ?>
" />
							<span class="description"></span>
						</td>
					</tr>
					<tr>
						<th>
							<label for="dsidxpress-ShowPanel_FeaturesCB">Show Features:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-ShowPanel_FeaturesCB" size="50" <?php 
        checked('true', strtolower($account_options->ShowPanel_Features));
        ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-ShowPanel_Features" name="<?php 
        echo DSIDXPRESS_API_OPTIONS_NAME;
        ?>
[ShowPanel_Features]" value="<?php 
        echo $account_options->ShowPanel_Features;
        ?>
" />
							<span class="description"></span>
						</td>
					</tr>
					<tr>
						<th>
							<label for="dsidxpress-AllowScheduleShowingFeatureCB">Show Schedule a Showing button:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-AllowScheduleShowingFeatureCB" size="50" <?php 
        checked('true', strtolower($account_options->AllowScheduleShowingFeature));
        ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-AllowScheduleShowingFeature" name="<?php 
        echo DSIDXPRESS_API_OPTIONS_NAME;
        ?>
[AllowScheduleShowingFeature]" value="<?php 
        echo $account_options->AllowScheduleShowingFeature;
        ?>
" />
							<span class="description"></span>
						</td>
					</tr>
					<tr>
						<th>
							<label for="dsidxpress-ShowAskAQuestionCB">Show Ask a Question button:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-ShowAskAQuestionCB" size="50" <?php 
        checked('true', strtolower($account_options->ShowAskAQuestion));
        ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-ShowAskAQuestion" name="<?php 
        echo DSIDXPRESS_API_OPTIONS_NAME;
        ?>
[ShowAskAQuestion]" value="<?php 
        echo $account_options->ShowAskAQuestion;
        ?>
" />
							<span class="description"></span>
						</td>
					</tr>
					<?php 
        if (isset($account_options->{'dsIDXPress-Package'}) && $account_options->{'dsIDXPress-Package'} == "pro") {
            ?>
					<tr>
						<th>
							<label for="dsidxpress-ShowPanel_SchoolsCB">Show Schools:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-ShowPanel_SchoolsCB" size="50" <?php 
            checked('true', strtolower($account_options->ShowPanel_Schools));
            ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-ShowPanel_Schools" name="<?php 
            echo DSIDXPRESS_API_OPTIONS_NAME;
            ?>
[ShowPanel_Schools]" value="<?php 
            echo $account_options->ShowPanel_Schools;
            ?>
" />
							<span class="description"></span>
						</td>
					</tr>
					<?php 
        }
        ?>
					<tr>
						<th>
							<label for="dsidxpress-ShowPanel_MapCB">Show Map:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-ShowPanel_MapCB" size="50" <?php 
        checked('true', strtolower($account_options->ShowPanel_Map));
        ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-ShowPanel_Map" name="<?php 
        echo DSIDXPRESS_API_OPTIONS_NAME;
        ?>
[ShowPanel_Map]" value="<?php 
        echo $account_options->ShowPanel_Map;
        ?>
" />
							<span class="description"></span>
						</td>
					</tr>
					<tr>
						<th>
							<label for="dsidxpress-ShowPanel_Contact">Show Contact Form:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-ShowPanel_ContactCB" size="50" <?php 
        checked('true', strtolower($account_options->ShowPanel_Contact));
        ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-ShowPanel_Contact" name="<?php 
        echo DSIDXPRESS_API_OPTIONS_NAME;
        ?>
[ShowPanel_Contact]" value="<?php 
        echo $account_options->ShowPanel_Contact;
        ?>
" />
							<span class="description"></span>
						</td>
					</tr>
					<tr>
						<th>
							<label for="dsidxpress-ShowOpenHousesCB">Show Open House Details:</label>
						</th>
						<td>
							<input type="checkbox" id="dsidxpress-ShowOpenHousesCB" size="50" <?php 
        checked('true', strtolower($account_options->ShowOpenHouses));
        ?>
 onclick="dsIDXpressOptions.OptionCheckBoxClick(this);" /><br />
							<input type="hidden" id="dsidxpress-ShowOpenHouses" name="<?php 
        echo DSIDXPRESS_API_OPTIONS_NAME;
        ?>
[ShowOpenHouses]" value="<?php 
        echo $account_options->ShowOpenHouses;
        ?>
" />
							<span class="description"></span>
						</td>
					</tr>
				</table>
				<br />
				<p class="submit">
					<input type="submit" class="button-primary" name="Submit" value="Save Options" />
				</p>
			</form>
		</div><?php 
    }
示例#3
0
 static function GetPermalink($incomingLink = null)
 {
     $blogUrl = get_home_url();
     $urlSlug = dsSearchAgent_Rewrite::GetUrlSlug();
     $canonicalUri = self::$CanonicalUri;
     if (isset($canonicalUri) && (!$incomingLink || preg_match("/dsidxpress-data/", $incomingLink))) {
         return "{$blogUrl}/{$urlSlug}{$canonicalUri}";
     } else {
         return $incomingLink;
     }
 }
  <?php 
}
?>
</form>
</div><!-- #default-search -->

<?php 
if (defined('DSIDXPRESS_OPTION_NAME')) {
    $idx_options = get_option(DSIDXPRESS_OPTION_NAME);
    if ($idx_options['Activated'] && get_option('colabs_idx_plugin_search') == 'true') {
        $pluginUrl = DSIDXPRESS_PLUGIN_URL;
        $formAction = home_url('/');
        if (substr($formAction, strlen($formAction), 1) != "/") {
            $formAction .= "/";
        }
        $formAction .= dsSearchAgent_Rewrite::GetUrlSlug();
        ?>
  	
  	<div class="dsidx-search" id="idx-search" style="display: none">
    <form name="property-mls-search" id="property-mls-search" method="get" action="<?php 
        echo $formAction;
        ?>
">
      			
      <?php 
        $defaultSearchPanels = dsSearchAgent_ApiRequest::FetchData("AccountSearchPanelsDefault", array(), false, 60 * 60 * 24);
        $defaultSearchPanels = $defaultSearchPanels["response"]["code"] == "200" ? json_decode($defaultSearchPanels["body"]) : null;
        $propertyTypes = dsSearchAgent_ApiRequest::FetchData("AccountSearchSetupPropertyTypes", array(), false, 60 * 60 * 24);
        $propertyTypes = $propertyTypes["response"]["code"] == "200" ? json_decode($propertyTypes["body"]) : null;
        $requestUri = dsSearchAgent_ApiRequest::$ApiEndPoint . "LocationsByType";
        //cities
示例#5
0
 private static function FilterData($data)
 {
     global $wp_version;
     $blog_url = get_home_url();
     $blogUrlWithoutProtocol = str_replace("http://", "", $blog_url);
     $blogUrlDirIndex = strpos($blogUrlWithoutProtocol, "/");
     $blogUrlDir = "";
     if ($blogUrlDirIndex) {
         // don't need to check for !== false here since WP prevents trailing /'s
         $blogUrlDir = substr($blogUrlWithoutProtocol, strpos($blogUrlWithoutProtocol, "/"));
     }
     $idxActivationPath = $blogUrlDir . "/" . dsSearchAgent_Rewrite::GetUrlSlug();
     $dsidxpress_options = get_option(DSIDXPRESS_OPTION_NAME);
     $dsidxpress_option_keys_to_output = array("ResultsDefaultState", "ResultsMapDefaultState");
     $dsidxpress_options_to_output = array();
     if (!empty($dsidxpress_options)) {
         foreach ($dsidxpress_options as $key => $value) {
             if (in_array($key, $dsidxpress_option_keys_to_output)) {
                 $dsidxpress_options_to_output[$key] = $value;
             }
         }
     }
     $data = str_replace('{$pluginUrlPath}', self::MakePluginsUrlRelative(plugin_dir_url(__FILE__)), $data);
     $data = str_replace('{$pluginVersion}', DSIDXPRESS_PLUGIN_VERSION, $data);
     $data = str_replace('{$wordpressVersion}', $wp_version, $data);
     $data = str_replace('{$wordpressBlogUrl}', $blog_url, $data);
     $data = str_replace('{$wordpressBlogUrlEncoded}', urlencode($blog_url), $data);
     $data = str_replace('{$wpOptions}', json_encode($dsidxpress_options_to_output), $data);
     $data = str_replace('{$idxActivationPath}', $idxActivationPath, $data);
     $data = str_replace('{$idxActivationPathEncoded}', urlencode($idxActivationPath), $data);
     return $data;
 }