Ejemplo n.º 1
0
function wpsight_do_tracking()
{
    $tracking = wpsight_get_option('tracking');
    if (!empty($tracking)) {
        echo stripslashes($tracking) . "\n\n";
    }
}
Ejemplo n.º 2
0
function wpsight_customize_register_logo($wp_customize)
{
    // Add setting logo
    $wp_customize->add_setting(WPSIGHT_DOMAIN . '[logo]', array('default' => wpsight_get_option('logo', WPSIGHT_IMAGES . '/logo.png'), 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'customize_logo', array('label' => __('Logo', 'wpsight'), 'section' => 'title_tagline', 'settings' => WPSIGHT_DOMAIN . '[logo]')));
    // Add setting favicon
    $wp_customize->add_setting(WPSIGHT_DOMAIN . '[favicon]', array('default' => '', 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'customize_favicon', array('label' => __('Favicon', 'wpsight'), 'section' => 'title_tagline', 'settings' => WPSIGHT_DOMAIN . '[favicon]')));
}
Ejemplo n.º 3
0
 function wpsight_archive_layouts()
 {
     /**
      * Map archives with Bootstrap classes
      */
     $archive_layouts = array('home' => wpsight_get_option('archive_layout', true), 'category' => wpsight_get_option('archive_layout', true), 'tag' => wpsight_get_option('archive_layout', true), 'date' => wpsight_get_option('archive_layout', true), 'author' => wpsight_get_option('listing_archive_layout', true), 'search' => wpsight_get_option('listing_archive_layout', true), 'listing' => wpsight_get_option('listing_archive_layout', true));
     return apply_filters('wpsight_archive_layouts', $archive_layouts);
 }
Ejemplo n.º 4
0
/**  
 *	Function to build filter form
 *	@param array $filterOptions
 *	@author anhbp
 */
function buildFilterForm($filterOptions)
{
    // Get search form details
    $search_details = wpsight_get_option('search_details', true);
    // Check how many detail options are active
    $search_details_count = false;
    if (is_array($search_details)) {
        $search_details_tmp = array_filter($search_details);
        $search_details_count = count($search_details_tmp);
    }
    // Search form labels
    $search_labels = array('default' => __('Keyword or Listing ID', 'wpsight') . '…', 'submit' => __('Filter', 'wpsight'), 'advanced' => __('Advanced Search', 'wpsight'), 'reset' => __('Reset', 'wpsight'), 'price' => __('Price', 'wpsight'), 'min' => __('Price (min)', 'wpsight'), 'max' => __('Price (max)', 'wpsight'), 'orderby' => __('Orderby', 'wpsight'), 'order' => __('Order', 'wpsight'), 'desc' => __('descending', 'wpsight'), 'asc' => __('ascending', 'wpsight'), 'results' => __('Results', 'wpsight'));
    $search_labels = apply_filters('wpsight_listing_search_labels', $search_labels);
    $listing_search = '<div class="listing-search count-' . $search_details_count . ' clearfix clear filter-form">';
    /**
     * Get current query
     */
    $search_get_query = false;
    foreach ($_GET as $get => $get_v) {
        $search_get_query[$get] = $get_v;
    }
    $listing_search .= '<form method="get" action="">';
    $listing_search .= '<div class="form-inner">';
    // Text field and search button
    $search_get_query['s'] = isset($search_get_query['s']) ? $search_get_query['s'] : false;
    // Check if there are detail options
    if (!empty($search_details_tmp)) {
        // Details select drop downs
        $listing_search .= '<div class="listing-search-details">' . "\n";
        // Loop through search form fields
        $listing_search .= wpsight_search_form_fields($filterOptions, $search_details, $search_get_query);
        $listing_search .= '<input type="submit" class="' . apply_filters('wpsight_button_class_search', 'listing-search-submit btn btn-large btn-primary') . '" value="' . $search_labels['submit'] . '" />' . "\n";
        $listing_search .= '</div><!-- .listing-search-details -->' . "\n\n";
    }
    // Advanced search and reset button
    $listing_search .= '<div class="listing-search-buttons">' . "\n";
    if (isset($_COOKIE[WPSIGHT_COOKIE_SEARCH_QUERY]) && ($search_cookie == true || $search_get == true)) {
        $listing_search .= '<div class="listing-search-reset-button">' . $search_labels['reset'] . '</div>' . "\n";
    }
    if (isset($advanced_search_button)) {
        $listing_search .= $advanced_search_button;
    }
    $listing_search .= '</div><!-- .listing-search-buttons -->' . "\n\n";
    // Close form tag
    $listing_search .= '</div><!-- form-inner -->';
    $listing_search .= '</form>' . "\n";
    // Close form wrap
    $listing_search .= '</div><!-- .listing-search -->' . "\n";
    return apply_filters('wpsight_get_listing_search', $listing_search);
}
Ejemplo n.º 5
0
function wpsight_listing_details_table_shortcode($atts)
{
    $defaults = array('id' => get_the_ID(), 'before' => '', 'after' => '', 'empty' => 'true', 'wrap' => 'div');
    extract(shortcode_atts($defaults, $atts));
    // Open table
    $details = '<table class="table table-striped table-compare">';
    // Add listing ID first
    $details .= '<tr class="listing-details-sc-detail table-compare-id">';
    $details .= '<td class="table-compare-label">' . __('ID', 'wpsight') . ':</td>';
    $details .= '<td class="table-compare-value">' . wpsight_get_listing_id() . '</td>';
    $details .= '</tr><!-- .table-compare-id -->';
    // Loop through standard details
    foreach (wpsight_standard_details() as $detail => $v) {
        // Don't show detail if label is emtpy in options
        $standard_details_option = wpsight_get_option($detail);
        if (empty($standard_details_option['label'])) {
            continue;
        }
        // Apply filter to optionally deactivate single detail
        if (apply_filters('wpsight_listing_details_table_' . $detail, true) != true) {
            continue;
        }
        $detail_meta = get_post_meta($id, '_' . $detail, true);
        if (!$detail_meta && $empty != 'true') {
            continue;
        }
        $detail_value = $detail_meta ? $detail_meta . ' ' . wpsight_get_measurement_units($v['unit']) : __('n/d', 'wpsight');
        $details .= '<tr class="listing-details-sc-detail ' . $detail . '">';
        $details .= '<td class="table-compare-label">' . $v['label'] . ':</td>';
        $details .= '<td class="table-compare-value">' . $detail_value . '</td>';
        $details .= '</tr><!-- .listing-details-sc-' . $detail . ' -->';
    }
    // Add listing price at the end
    $details .= '<tr class="listing-details-sc-detail table-compare-price">';
    $details .= '<td class="table-compare-value" colspan="2">' . wpsight_get_price() . '</td>';
    $details .= '</tr><!-- .table-compare-price -->';
    // Close table
    $details .= '</table><!-- .table-compare -->';
    $output = sprintf('%1$s%3$s%2$s', $before, $after, $details);
    // Optionally wrap shortcode in HTML tags
    if (!empty($wrap) && $wrap != 'false' && in_array($wrap, array_keys(wp_kses_allowed_html('post')))) {
        $output = sprintf('<%2$s class="listing-details-table-sc">%1$s</%2$s>', $output, $wrap);
    }
    return apply_filters('wpsight_listing_details_table_shortcode', $output, $atts);
}
Ejemplo n.º 6
0
    /**
     * Place language switcher in sub menu (on the right) in Paraíba
     */
    public function wpsight_wpml_switcher_menu_paraiba()
    {
        // Check if active child theme is Paraíba
        if (wp_get_theme()->stylesheet != 'paraiba') {
            return;
        }
        // Check if location activated through options
        $locations = wpsight_get_option('wpml_locations');
        if ($locations['menu_right'] == '0') {
            return;
        }
        ?>
<div class="wpml-languages"><?php 
        do_action('icl_language_selector');
        ?>
</div><?php 
    }
Ejemplo n.º 7
0
function wpsight_do_print_header_right()
{
    // Get header right content from options
    $header_right = '<div class="print-header-right">' . wpsight_get_option('header_right', true) . '</div>';
    if (!empty($header_right)) {
        echo apply_filters('wpsight_do_header_right', nl2br($header_right));
    }
}
Ejemplo n.º 8
0
 function wpsight_meta_box_listing_details()
 {
     $details_labels = array('title' => __('Listing Details', 'wpsight'), 'id' => __('ID', 'wpsight'));
     // Get standard features and merge with title
     $standardDetails = wpsight_standard_details();
     if (!is_array($standardDetails)) {
         $standardDetails = array();
     }
     $details_labels = array_merge($details_labels, $standardDetails);
     $details_labels = apply_filters('wpsight_listing_details_labels', $details_labels);
     /**
      * Add backward compatibility
      * for old wpCasa _property_id
      * custom field value
      */
     $listing_id = false;
     if (wpsight_get_listing_edit_id()) {
         // Get old wpCasa _property_id
         $property_id_meta = get_post_meta(wpsight_get_listing_edit_id(), '_property_id', true);
         // Get new wpSight _listing_id
         $listing_id_meta = get_post_meta(wpsight_get_listing_edit_id(), '_listing_id', true);
         if (!empty($property_id_meta) && empty($listing_id_meta)) {
             update_post_meta(wpsight_get_listing_edit_id(), '_listing_id', $property_id_meta, '');
         }
         if (empty($property_id_meta) && empty($listing_id_meta)) {
             $listing_id = wpsight_get_listing_id(wpsight_get_listing_edit_id());
         }
     }
     // Set meta box
     $meta_box = array('id' => 'listing_details', 'title' => $details_labels['title'], 'pages' => array(wpsight_listing_post_type()), 'context' => 'normal', 'priority' => 'high', 'fields' => array('id' => array('name' => $details_labels['id'], 'id' => '_listing_id', 'type' => 'text', 'std' => $listing_id)));
     /**
      * Add standard details
      */
     $units = wpsight_measurement_units();
     foreach ($standardDetails as $detail => $value) {
         $standard_details_option = wpsight_get_option($detail);
         // If details hasn't been set before, display default
         if (!isset($standard_details_option['label'])) {
             $standard_details_option = wpsight_get_option($detail, true);
         }
         // Don't show detail if label is emtpy in options
         if (empty($standard_details_option['label'])) {
             continue;
         }
         if (!empty($details_labels[$detail])) {
             // Optionally add measurement label to title
             $unit = '';
             if (!empty($details_labels[$detail]['unit'])) {
                 $unit = $details_labels[$detail]['unit'];
                 $unit = $units[$unit];
                 $unit = ' (' . $unit . ')';
             }
             // If there is select data, create select fields else text
             if (!empty($details_labels[$detail]['data'])) {
                 $meta_box['fields'][$detail] = array('name' => $details_labels[$detail]['label'] . $unit, 'id' => '_' . $detail, 'type' => 'select', 'options' => $details_labels[$detail]['data'], 'desc' => $details_labels[$detail]['description']);
             } else {
                 $meta_box['fields'][$detail] = array('name' => $details_labels[$detail]['label'] . $unit, 'id' => '_' . $detail, 'type' => 'text', 'desc' => $details_labels[$detail]['description']);
             }
             // end if
         }
         // end if
     }
     // end foreach
     // Apply filter to array
     $meta_box = apply_filters('wpsight_meta_box_listing_details', $meta_box);
     return $meta_box;
 }
Ejemplo n.º 9
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $listing_type = isset($instance['listing_type']) ? $instance['listing_type'] : true;
        $listing_location = isset($instance['listing_location']) ? $instance['listing_location'] : true;
        $listing_id = isset($instance['listing_id']) ? $instance['listing_id'] : true;
        // Loop through standard details
        foreach (wpsight_standard_details() as $key => $values) {
            $key = isset($instance[$key]) ? $instance[$key] : true;
        }
        if (is_single() && get_post_type() == wpsight_listing_post_type()) {
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-details section clearfix clear">
        	
        		<div class="title clearfix">
	        		
	        		<div class="title-price listing-price">
	        			<?php 
            wpsight_price();
            ?>
	        		</div>
	        		
	        		<?php 
            // Action hook listing details title inside
            do_action('wpsight_listing_details_title_inside', $args, $instance);
            ?>
						
				</div><!-- .title -->
				
				<?php 
            // Display details
            $standard_details = wpsight_standard_details();
            $listing_details = '';
            // Loop through standard details
            if (!empty($standard_details)) {
                $i = 0;
                $listing_details .= '<div class="row">' . "\n";
                foreach ($standard_details as $feature => $value) {
                    $standard_details_option = wpsight_get_option($feature);
                    // If details hasn't been set before, display default
                    if (!isset($standard_details_option['label'])) {
                        $standard_details_option = wpsight_get_option($feature, true);
                    }
                    // Don't show detail if label is emtpy in options
                    if (empty($standard_details_option['label'])) {
                        continue;
                    }
                    // Append listing ID to details
                    if ($i == 0 && $listing_id) {
                        $listing_details_id = '<div class="' . wpsight_get_span('small') . '">' . "\n";
                        $listing_details_id .= '<span class="listing-details-label">' . __('Listing ID', 'wpsight') . ':</span>' . "\n";
                        $listing_details_id .= '<span class="listing-details-value">' . wpsight_get_listing_id(get_the_ID()) . '</span><!-- .listing-id-value -->' . "\n";
                        $listing_details_id .= '</div><!-- .listing-details-id -->' . "\n";
                        $listing_details .= apply_filters('wpsight_listing_details_id', $listing_details_id, $args, $instance);
                    }
                    $listing_details_value = get_post_meta(get_the_ID(), '_' . $feature, true);
                    // Check if value is data key
                    if (!empty($value['data'])) {
                        $listing_details_value = $value['data'][$listing_details_value];
                    }
                    $listing_details_meta = get_post_meta(get_the_ID(), '_' . $feature, true);
                    if (!empty($listing_details_meta) && $instance[$feature]) {
                        $listing_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n";
                        $listing_details .= '<span class="listing-details-label">' . $value['label'] . ':</span><!-- .listing-' . $feature . '-label -->' . "\n";
                        $listing_details .= '<span class="listing-details-value">' . $listing_details_value . ' ' . wpsight_get_measurement_units($value['unit']) . '</span><!-- .listing-' . $feature . '-value -->' . "\n";
                        $listing_details .= '</div><!-- .listing-' . $feature . ' -->' . "\n";
                    }
                    $i++;
                }
                // endforeach
                // Add date - will be hidden by CSS display:none
                $listing_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n";
                $listing_details .= '<span class="listing-date updated">' . get_the_date() . '</span>' . "\n";
                $listing_details .= '</div>' . "\n";
                $listing_details .= '</div><!-- .row -->' . "\n";
            }
            // endif
            echo apply_filters('wpsight_widget_listing_details', $listing_details, $args, $instance);
            ?>
				
			</div><!-- .listing-details --><?php 
        }
    }
Ejemplo n.º 10
0
<?php

/**
 * The template for displaying search results archive pages.
 *
 * @package wpSight
 * @since 1.0
 */
global $counter, $wp_query;
// Check search term for listing ID
if (!empty($_GET['s'])) {
    $prefix = wpsight_get_option('listing_id');
    // Built ID search query
    $id_args = array('post_type' => wpsight_listing_post_type(), 'meta_query' => array('relation' => 'OR', array('key' => '_listing_id', 'value' => $_GET['s'], 'compare' => '='), array('key' => '_property_id', 'value' => $_GET['s'], 'compare' => '='), array('key' => '_listing_id', 'value' => $prefix . $_GET['s'], 'compare' => '='), array('key' => '_property_id', 'value' => $prefix . $_GET['s'], 'compare' => '=')));
    // Execute ID search query
    $id_query = new WP_Query($id_args);
    // If only one result, redirect to single listing page
    if ($id_query->post_count == 1) {
        // Get post ID of single search result
        $id_post = $id_query->posts[0]->ID;
        // Redirect to single listing page
        wp_redirect(get_permalink($id_post));
        exit;
    }
}
get_header();
?>

<div id="main-wrap" class="wrap">	

	<?php 
Ejemplo n.º 11
0
/**
 * Match wpCasa functions
 *
 * @since 1.2
 */
function wpcasa_get_option($name, $default = false)
{
    return wpsight_get_option($name, $default);
}
Ejemplo n.º 12
0
 /**
  * Registers and enqueues plugin-specific scripts.
  */
 public function register_plugin_scripts()
 {
     wp_register_script('wpsight_currency_plugin_script', plugins_url('wpcasa-currency/js/wpcasa-currency.js'), array('jquery', 'scripts'));
     wp_enqueue_script('wpsight_currency_plugin_script');
     // Parameters to JS
     $currency_theme = wpcasa_get_option('currency');
     if ($currency_theme == 'other') {
         $currency_theme = strtolower(wpsight_get_option('currency_other'));
     }
     $params_array = array('plugin_dir' => plugin_dir_url(__FILE__), 'currency_theme' => $currency_theme, 'currency_separator' => wpcasa_get_option('currency_separator'), 'loading_text' => '<span class="currency-loading">' . __('Loading...', 'wpcasa-currency') . '</span>', 'cookie_path' => COOKIEPATH, 'currency_symbols' => apply_filters('wpsight_currency_symbols', '__return_empty_array'));
     $params_json_array = json_encode($params_array);
     $params = array('currency_param' => $params_json_array);
     wp_localize_script('wpsight_currency_plugin_script', 'wpcasaCurrency', $params);
 }
Ejemplo n.º 13
0
 function wpsight_get_currency($currency = '')
 {
     // Get currency from theme options
     if (empty($currency)) {
         $currency = wpsight_get_option('currency', 'eur');
     }
     // Check if there is a custom currency
     if ($currency != 'other') {
         // Get currency abbreviation
         $currency = wpsight_get_currency_abbr($currency);
         // Create HTML entities
         if ($currency == 'EUR') {
             $currency_ent = '&euro;';
         } elseif ($currency == 'USD') {
             $currency_ent = '&#36;';
         } elseif ($currency == 'CAD') {
             $currency_ent = 'C&#36;';
         } elseif ($currency == 'GBP') {
             $currency_ent = '&pound;';
         } elseif ($currency == 'AUD') {
             $currency_ent = 'AU&#36;';
         } elseif ($currency == 'JPY') {
             $currency_ent = '&yen;';
         } elseif ($currency == 'CHF') {
             $currency_ent = ' SFr. ';
         } elseif ($currency == 'ILS') {
             $currency_ent = '&#8362;';
         } elseif ($currency == 'THB') {
             $currency_ent = '&#3647;';
         }
     } else {
         $currency_ent = wpsight_get_option('currency_other_ent');
     }
     // If no entity, set three letter code
     if (empty($currency_ent)) {
         $currency_ent = ' ' . $currency . ' ';
     }
     return apply_filters('wpsight_currency', $currency_ent);
 }
Ejemplo n.º 14
0
 protected function _get_sender()
 {
     $name = wpsight_get_option('mail_sender_name');
     $email = wpsight_get_option('mail_sender_email');
     $defaults = wpsight_mail_get_default_sender();
     if (empty($name)) {
         $name = $defaults['name'];
     }
     if (empty($email)) {
         $email = $defaults['email'];
     }
     return apply_filters('wpsight_contact_sender', array('email' => $email, 'name' => $name));
 }
Ejemplo n.º 15
0
 function wpsight_options_listings()
 {
     /** Define data arrays */
     $options_listings = array();
     $options_listings['heading_listings'] = array('name' => __('Listings', 'wpsight'), 'id' => 'heading_listings', 'type' => 'heading');
     // Check of old 'property_id' options was active
     $listing_id_std = wpsight_get_option('property_id') ? wpsight_get_option('property_id') : __('ID-', 'wpsight');
     $options_listings['listing_id'] = array('name' => __('Listing ID Prefix', 'wpsight'), 'id' => 'listing_id', 'desc' => __('The listing ID will be this prefix plus post ID. You can optionally set individual IDs on the listing edit screen.', 'wpsight'), 'std' => $listing_id_std, 'class' => 'mini', 'type' => 'text');
     $options_listings['measurement_unit'] = array('name' => __('Measurement Unit', 'wpsight'), 'desc' => __('Please select the general measurement unit. The unit for the listing standard features can be defined separately below.', 'wpsight'), 'id' => 'measurement_unit', 'std' => 'm2', 'class' => 'mini', 'type' => 'select', 'options' => array_filter(wpsight_measurement_units()));
     $options_listings['currency'] = array('name' => __('Currency', 'wpsight'), 'desc' => __('Please select the currency for the listing prices. If your currency is not listed, please select <code>Other</code>.', 'wpsight'), 'id' => 'currency', 'std' => 'usd', 'class' => 'mini', 'type' => 'select', 'options' => array_merge(array_filter(wpsight_currencies()), array('other' => __('Other', 'wpsight'))));
     $options_listings['currency_other'] = array('name' => __('Other Currency', 'wpsight') . ' (' . __('Abbreviation', 'wpsight') . ')', 'id' => 'currency_other', 'desc' => __('Please insert the abbreviation of your currency (e.g. <code>EUR</code>).', 'wpsight'), 'class' => 'hidden mini', 'type' => 'text');
     $options_listings['currency_other_ent'] = array('name' => __('Other Currency', 'wpsight') . ' (' . __('Symbol', 'wpsight') . ')', 'id' => 'currency_other_ent', 'desc' => __('Please insert the currency symbol or HTML entity (e.g. <code>&amp;euro;</code>).', 'wpsight'), 'class' => 'hidden mini', 'type' => 'text');
     $options_listings['currency_symbol'] = array('name' => __('Currency Symbol', 'wpsight'), 'desc' => __('Please select the position of the currency symbol.', 'wpsight'), 'id' => 'currency_symbol', 'std' => 'before', 'type' => 'radio', 'options' => array('before' => __('Before the value', 'wpsight'), 'after' => __('After the value', 'wpsight')));
     $options_listings['currency_separator'] = array('name' => __('Thousands Separator', 'wpsight'), 'desc' => __('Please select the thousands separator for your listing prices.', 'wpsight'), 'id' => 'currency_separator', 'std' => 'comma', 'type' => 'radio', 'options' => array('comma' => __('Comma (e.g. 1,000,000)', 'wpsight'), 'dot' => __('Period (e.g. 1.000.000)', 'wpsight')));
     /** Toggle standard features */
     $options_listings['listing_features'] = array('name' => __('Listing Features', 'wpsight'), 'desc' => __('Please check the box to edit the listing standard features.', 'wpsight'), 'id' => 'listing_features', 'std' => '0', 'type' => 'checkbox');
     /** Loop through standard features */
     $i = 1;
     foreach (wpsight_standard_details() as $feature_id => $value) {
         $options_listings[$feature_id] = array('name' => __('Standard Feature', 'wpsight') . ' #' . $i, 'id' => $feature_id, 'desc' => $value['description'], 'std' => array('label' => $value['label'], 'unit' => $value['unit']), 'class' => 'hidden', 'type' => 'measurement');
         $i++;
     }
     /** Toggle rental periods */
     $options_listings['rental_periods'] = array('name' => __('Rental Periods', 'wpsight'), 'desc' => __('Please check the box to edit the rental periods.', 'wpsight'), 'id' => 'rental_periods', 'std' => '0', 'type' => 'checkbox');
     /** Loop through rental periods */
     $i = 1;
     foreach (wpsight_rental_periods() as $period_id => $value) {
         $options_listings[$period_id] = array('name' => __('Rental Period', 'wpsight') . ' #' . $i, 'id' => $period_id, 'std' => $value, 'class' => 'hidden', 'type' => 'text');
         $i++;
     }
     return apply_filters('wpsight_options_listings', $options_listings);
 }
Ejemplo n.º 16
0
 function wpsight_search_form_filters($search_fields, $search_details, $search_get, $search_advanced = false)
 {
     // Get advanced search filters
     $search_filters = wpsight_get_option('search_filters', false);
     if ($search_filters) {
         $get_filters = array();
         $search_filters_nr = apply_filters('wpsight_listing_search_filters_nr', 8);
         for ($i = 1; $i <= $search_filters_nr; $i++) {
             $get_filters[$i] = wpsight_get_option('filter_' . $i);
         }
         $get_filters = array_filter((array) $get_filters);
     }
     // Search filters
     if ($search_filters && !empty($get_filters)) {
         $listing_search_filters = '<div class="listing-search-field-filter">' . "\n";
         $i = 1;
         foreach ($get_filters as $filter) {
             $filter = explode(',', $filter);
             $search_get['f' . $i] = isset($search_get['f' . $i]) ? $search_get['f' . $i] : false;
             $listing_search_filters .= '<div class="listing-search-filter f' . $i . '">' . "\n";
             $listing_search_filters .= '<label class="checkbox"><input type="checkbox" name="f' . $i . '" value="' . sanitize_title($filter[1]) . '"' . checked(sanitize_title($filter[1]), $search_get['f' . $i], false) . ' /><span>' . $filter[1] . '</span></label>' . "\n";
             $listing_search_filters .= '</div><!-- .listing-search-filter.f' . $i . ' -->' . "\n";
             $i++;
         }
         $listing_search_filters .= '</div><!-- .listing-search-filters -->' . "\n\n";
         // Filter search filter section
         $listing_search_filters = apply_filters('wpsight_search_form_filters', $listing_search_filters, $search_fields, $search_details, $search_get, $search_advanced);
         return $listing_search_filters;
     }
 }
Ejemplo n.º 17
0
function wpsight_get_listing_search()
{
    // Get search form details
    $search_details = wpsight_get_option('search_details', true);
    // Check how many detail options are active
    $search_details_count = false;
    if (is_array($search_details)) {
        $search_details_tmp = array_filter($search_details);
        $search_details_count = count($search_details_tmp);
    }
    // Get advanced search options
    $advanced = wpsight_get_option('search_advanced');
    $advanced_options = wpsight_get_option('search_advanced_options');
    // Search form labels
    $search_labels = array('default' => __('Keyword or Listing ID', 'wpsight') . '&hellip;', 'submit' => __('Search', 'wpsight'), 'advanced' => __('Advanced Search', 'wpsight'), 'reset' => __('Reset', 'wpsight'), 'price' => __('Price', 'wpsight'), 'price_min' => __('Price (min)', 'wpsight'), 'price_max' => __('Price (max)', 'wpsight'), 'orderby' => __('Orderby', 'wpsight'), 'order' => __('Order', 'wpsight'), 'desc' => __('descending', 'wpsight'), 'asc' => __('ascending', 'wpsight'), 'results' => __('Results', 'wpsight'));
    $search_labels = apply_filters('wpsight_listing_search_labels', $search_labels);
    $listing_search = '<div class="listing-search count-' . $search_details_count . ' clearfix clear">';
    /**
     * Get current query
     */
    $search_get_query = false;
    // Get query cookie
    $search_cookie = apply_filters('wpsight_search_cookie', true);
    // Set query get
    $search_get = apply_filters('wpsight_search_get', true);
    if (!isset($_GET['s']) && isset($_COOKIE[WPSIGHT_COOKIE_SEARCH_QUERY]) && $search_cookie == true) {
        // When not search and cookie exists set last query
        $search_get_query = wpsight_explode_array(',', $_COOKIE[WPSIGHT_COOKIE_SEARCH_QUERY]);
    } elseif ($search_get == true) {
        foreach ($_GET as $get => $get_v) {
            $search_get_query[$get] = $get_v;
        }
    }
    $listing_search .= '<form method="get" action="' . apply_filters('wpsight_do_listing_search_form_action', home_url('/')) . '">';
    $listing_search .= '<div class="form-inner">';
    // Text field and search button
    $search_get_query['s'] = isset($search_get_query['s']) ? $search_get_query['s'] : false;
    $listing_search .= '<div class="listing-search-main">' . "\n";
    $listing_search .= '<input type="text" class="listing-search-text text" name="s" title="' . $search_labels['default'] . '" value="' . $search_get_query['s'] . '" />' . "\n";
    $listing_search .= '<input type="submit" class="' . apply_filters('wpsight_button_class_search', 'listing-search-submit btn btn-large btn-primary') . '" name="search-submit" value="' . $search_labels['submit'] . '" />' . "\n";
    $listing_search .= '</div><!-- .listing-search-main -->' . "\n\n";
    // Check if there are detail options
    if (!empty($search_details_tmp)) {
        // Details select drop downs
        $listing_search .= '<div class="listing-search-details">' . "\n";
        // Loop through search form fields
        $listing_search .= wpsight_search_form_fields(wpsight_search_form_details(), $search_details, $search_get_query);
        $listing_search .= '</div><!-- .listing-search-details -->' . "\n\n";
    }
    if ($advanced) {
        // Advanced Search
        $listing_search .= '<div class="listing-search-advanced ' . apply_filters('wpsight_listing_search_status', '') . '">' . "\n";
        // Loop through search form fields (advanced)
        $listing_search .= wpsight_search_form_fields(wpsight_search_form_details(), $advanced_options, $search_get_query, true);
        // Add search form filters
        $listing_search .= wpsight_search_form_filters(wpsight_search_form_details(), $advanced_options, $search_get_query, true);
        $listing_search .= '</div><!-- .listing-search-advanced -->' . "\n\n";
        // Advanced search button
        $advanced_search_button = '<div class="listing-search-advanced-button ' . apply_filters('wpsight_listing_search_status', '') . '">' . $search_labels['advanced'] . '</div>' . "\n";
    }
    // Advanced search and reset button
    $listing_search .= '<div class="listing-search-buttons">' . "\n";
    if (isset($_COOKIE[WPSIGHT_COOKIE_SEARCH_QUERY]) && ($search_cookie == true || $search_get == true)) {
        $listing_search .= '<div class="listing-search-reset-button">' . $search_labels['reset'] . '</div>' . "\n";
    }
    if (isset($advanced_search_button)) {
        $listing_search .= $advanced_search_button;
    }
    $listing_search .= '</div><!-- .listing-search-buttons -->' . "\n\n";
    // Close form tag
    $listing_search .= '</div><!-- form-inner -->';
    $listing_search .= '</form>' . "\n";
    // Close form wrap
    $listing_search .= '</div><!-- .listing-search -->' . "\n";
    return apply_filters('wpsight_get_listing_search', $listing_search);
}
Ejemplo n.º 18
0
function wpsight_do_header_right()
{
    // Get header right content from options
    $header_right = wpsight_get_option('header_right');
    // Set default value if option has not been set
    if (wpsight_get_option('header_right') === false) {
        $header_right = wpsight_get_option('header_right', true);
    }
    if (!empty($header_right)) {
        echo apply_filters('wpsight_do_header_right', nl2br($header_right));
    }
}