public static function register_default_search_forms()
 {
     $search_forms = DispletRetsIdxOptionsController::get_option('search_forms');
     if (empty($search_forms)) {
         self::$_model = array();
         self::$_options = DispletRetsIdxOptionsController::get_option();
         self::$_field_options = DispletRetsIdxOptionsController::get_option('fields');
         self::set_search_forms(self::$_default_search_forms);
     }
 }
예제 #2
0
/**
 * @param: $field: string or array ( area_mls_defined, city, property_type or school_district, status or zip )
 * @return: success: array
 * @return: failure: false
 */
function displetretsidx_get_field_options($field)
{
    $field_option = DispletRetsIdxOptionsController::get_option('fields');
    if (is_array($field)) {
        $fields = array();
        foreach ($field as $slug) {
            if (isset($field_option[$slug])) {
                $fields = array_merge($fields, $field_option[$slug]);
            }
        }
        sort($fields);
        return $fields;
    } elseif (isset($field_option[$field])) {
        return $field_option[$field];
    }
    return false;
}
 private static function update_to_2_1_19()
 {
     DispletRetsIdxSettingsController::update_email_templates_at_api(DispletRetsIdxOptionsController::get_option());
     DispletRetsIdxSettingsController::update_field_options(self::$_options);
 }
 public static function update_setting($key, $value)
 {
     $options = DispletRetsIdxOptionsController::get_option();
     $options[$key] = $value;
     DispletRetsIdxOptionsController::update_option('settings', $options);
 }
 private function maybe_set_property_types()
 {
     if ($this->_model['data_from'] !== 'property_showcase' && !$this->_model['is_property_details_page'] && ($this->_model['count'] > 9 || $this->_model['layout'] == 'table') && (!empty($this->_model['property_type_navigation']) || !empty($this->_model['property_type_sorting']))) {
         $property_types = array();
         if (!empty($this->_model['property_type'])) {
             $model_property_types = explode(',', $this->_model['property_type']);
             if (count($model_property_types) > 1) {
                 foreach ($model_property_types as $property_type) {
                     $key = strtolower(trim($property_type));
                     $property_types[$key] = $property_type;
                 }
             }
         } else {
             $displetretsidx_field_option = DispletRetsIdxOptionsController::get_option('fields');
             if (!empty($displetretsidx_field_option['property_type'])) {
                 foreach ($displetretsidx_field_option['property_type'] as $property_type) {
                     $key = strtolower($property_type);
                     $property_types[$key] = $property_type;
                 }
             }
         }
         $filter_used = false;
         if (!empty($this->_options['property_type_include_filter'])) {
             foreach ($this->_options['property_type_include_filter'] as $key => $value) {
                 $new_key = strtolower($key);
                 $filter_property_types[$new_key] = $value;
                 if ($value != 'false') {
                     $filter_used = true;
                 }
             }
         }
         if (!empty($property_types) && !empty($filter_used)) {
             foreach ($property_types as $property_type_key => $value) {
                 if (isset($filter_property_types[$property_type_key]) && $filter_property_types[$property_type_key] == 'false') {
                     unset($property_types[$property_type_key]);
                 }
             }
         }
         $this->_model['property_types'] = $property_types;
         $this->_model['property_type_points'] = array_values($property_types);
     }
 }
 public static function build()
 {
     self::$_quick_start_options = DispletRetsIdxOptionsController::get_option('quick_start');
 }
    function form($instance)
    {
        $title = isset($instance['title']) ? strip_tags($instance['title']) : 'Search Properties';
        $id = isset($instance['id']) ? intval($instance['id']) : 1;
        $search_forms = DispletRetsIdxOptionsController::get_option('search_forms');
        $registered_quick_search_ids = array(1 => 1);
        if (!empty($search_forms) && is_array($search_forms)) {
            foreach ($search_forms as $key => $search_form) {
                if ($key > 3) {
                    $form_id = $key - 3;
                    $registered_quick_search_ids[$form_id] = $form_id;
                }
            }
        }
        ?>
        <p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
				Title:
			</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($title);
        ?>
" />
		</p>
        <p>
			<label for="<?php 
        echo $this->get_field_id('id');
        ?>
">
				Form ID:
			</label>
			<select class="widefat" id="<?php 
        echo $this->get_field_id('id');
        ?>
" name="<?php 
        echo $this->get_field_name('id');
        ?>
">
				<?php 
        if (!empty($registered_quick_search_ids)) {
            foreach ($registered_quick_search_ids as $option_id) {
                ?>
					<option value="<?php 
                echo $option_id;
                ?>
" <?php 
                selected($option_id, $id);
                ?>
>
						<?php 
                echo $option_id;
                ?>
					</option>
				<?php 
            }
        }
        ?>
			</select>
		</p>
	<?php 
    }
 public static function maybe_take_action_from_settings_update()
 {
     $options = DispletRetsIdxOptionsController::get_option();
     $action_options = DispletRetsIdxOptionsController::get_option('action');
     if (empty($action_options)) {
         $action_options = array();
     }
     $new_action_options = array();
     $new_action_options[] = DispletRetsIdxSettingsController::maybe_update_page_options($options, $action_options);
     $new_action_options[] = DispletRetsIdxSettingsController::maybe_authenticate_api_key($options, $action_options);
     $new_action_options[] = DispletRetsIdxSettingsController::maybe_get_field_options($options, $action_options);
     $new_action_options[] = DispletRetsIdxSettingsController::maybe_update_email_activity_report($options, $action_options);
     $new_action_options[] = DispletRetsIdxSettingsController::maybe_update_property_suggestions($options, $action_options);
     $new_action_options[] = self::maybe_update_saved_searches($options, $action_options);
     $new_action_options[] = self::_maybe_update_email_templates_api($options, $action_options);
     $new_action_options = array_filter($new_action_options);
     if (!empty($new_action_options)) {
         foreach ($new_action_options as $new_action_option) {
             if (!empty($new_action_option) && is_array($new_action_option)) {
                 $action_options = array_merge($action_options, $new_action_option);
             }
         }
         DispletRetsIdxOptionsController::update_option('action', $action_options);
     }
 }
예제 #9
0
<?php

include_once dirname(__FILE__) . '/../../../../../wp-load.php';
include_once ABSPATH . 'wp-admin/includes/plugin.php';
global $displetretsidx_option;
$model = array('options' => $displetretsidx_option, 'field_options' => DispletRetsIdxOptionsController::get_option('fields'));
?>
<!DOCTYPE html>
<html>
<head>
	<title>
		Displet RETS/IDX Listing Criteria
	</title>
	<link rel="stylesheet" type="text/css" href="<?php 
echo plugins_url('displetreader-wordpress-plugin/includes/css/displet-rets-idx-admin-styles.css');
?>
"/>
	<script>
		var displetretsidx_admin = {
			first_city: '<?php 
if (!empty($model["field_options"]["city"][0])) {
    echo $model["field_options"]["city"][0];
}
?>
',
			images: {
				close: '<?php 
echo plugins_url("displetreader-wordpress-plugin/includes/css/images/close.png");
?>
',
				close_hover: '<?php 
 private static function _set_defaults()
 {
     self::$_defaults = array('authenticated_url' => false, 'rets_page_id' => false);
     $rets_page = get_page_by_path('rets');
     if (!empty($rets_page)) {
         self::$_defaults['rets_page_id'] = $rets_page->ID;
     }
     $action_options = DispletRetsIdxOptionsController::get_option('action');
     if (!empty($action_options['authenticated_url'])) {
         self::$_defaults['authenticated_url'] = $action_options['authenticated_url'];
     }
 }